-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves all non-deprecated packages to @matter.js org. Adds new packages: - packages/types contains the bulk of data definitions from matter.js. This includes datatypes, TLV, clusters, etc. - packages/protocol contains the bulk of the lower-level Matter logic from matter.js - packages/node contains the higher-level node API including behaviors, endpoints and nodes - packages/main is a new entry point that reexports all of above and automatically loads specialization for the detected platform via export conditions - packages/nodejs-ble is rename of packages/matter-node-ble.js - packages/examples is rename of packages/matter-node.js-examples The new package structures conform more closely to the export layout as defined by "exports" in package.json. Previously we had a mix of snake-case and CamelCase for sub-package exports. I moved to all "snake" for public exports. The new structures encourages direct import of types (clusters, behaviors, endpoint types) that are expensive either at build time or runtime. There are index exports for all of these components but they are not in the default package export. So e.g. you can import OnOff from @project-chip/matter.js-types/clusters or (better) @project-chip/matter.js-types/clusters/on-off. The original "matter.js" package is mostly for backwards compatibility now except for some of the controller stuff that still needs to move into the "protocol" package. Ideally the new "main" package would be our "main" package but this will need to wait on either a new package name or a deprecation period sufficient for a (very) major breaking change. "matter.js" contains a large number of re-exports to maintain backward compatibility. The "legacy" API we've been threatening to deprecate still lives there as well. Should make it easier to make a clean break when the time comes. The sub-package exports of generated code required a huge number of export files both for compatibility and for re-export in the "main" package. I added custom build logic to "main" and "matter.js" to create these at build time. Given the large number of import changes I figured it was an opportune time to add package aliasing. We now alias via package.json "imports" field for most intra- (and some inter-) package imports. This makes the imports considerably more concise and aids in portability. A bit fiddly to set up but they work well once in place. I did various refactoring along the way. In particular, I removed generic parameters from a number of the components in "protocol" that no longer need to be generic for the "node" API. This makes the code less verbose and was easy to compensate for in the legacy API where this specialization is necessary. I also removed the "ContextT" template parameter from many of the APIs in "protocol". Makes things less wordy and hopefully not controversial. The controller vs. device branches of the code both only ever deal with a single context type. I moved a bit of shared functionality into the base SessionContext type and added assertion functions for the few places where specialization is still required. The default implementation of "time" is now fully functional. Platform specialization is still available if necessary but I was able to fully implement the API using standard JS so I don't expect it'll ever be necessary. Includes numerous codegen updates to match the new package layout and make the codegen logic available at build time.
- Loading branch information
Showing
1,765 changed files
with
72,049 additions
and
72,035 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
packages/model/src/standard/elements/*.ts linguist-generated=true | ||
packages/types/src/clusters/* linguist-generated=true | ||
packages/types/src/globals/* linguist-generated=true | ||
packages/node/src/tags/* linguist-generated=true | ||
packages/node/src/endpoints/* linguist-generated=true | ||
packages/node/src/devices/* linguist-generated=true | ||
packages/node/src/behaviors/*/index.ts linguist-generated=true | ||
packages/node/src/behaviors/*/*Behavior.ts linguist-generated=true | ||
packages/node/src/behaviors/*/*Interface.ts linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.