Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@matter/main
Advanced tools
Implementation of Matter protocol in typescript with no native dependencies (and very limited dependencies).
This is a convenient single-dependency for applications build on matter.js and have automatic registrations for Node.js and react-native as platforms.
This package supports all Node.js LTS versions starting with 18.x (when Node.js is used).
The following features are abstracted away to allow to be implemented environment specific:
[!IMPORTANT] All exports here are for the current API. Legacy Cluster implementations are only exported via @project-chip/matter.js!
This library exports the Matter protocol functionality as well as some helper functions as named exports:
Export | Description |
---|---|
@matter/main | Re-Exports all functionality from @matter/general , @matter/node , Environment class, Matter model class and the datatypes from @matter/types |
@matter/main/behaviors | Exports Behavior classes as framework to implement all relevant Logic for clusters and internal logic. Contains auto-generated class structures and also Cluster default implementations. |
@matter/main/behaviors/* | Exports Behavior classes as framework to implement all relevant Logic for clusters and internal logic. Contains auto-generated class structures and also Cluster default implementations as cluster-name export |
@matter/main/clusters | Exports all Matter Cluster definitions |
@matter/main/clusters/* | Exports Matter Cluster definitions as cluster-name export |
@matter/main/devices | Exports Matter Device type classes |
@matter/main/devices/* | Exports Matter Device type classes as cluster-name export |
@matter/main/endpoints | Exports Matter Endpoint structure classes |
@matter/main/endpoints/* | Exports Matter Endpoint structure classes as cluster-name export |
@matter/main/model | Exports a JavaScript version of the Matter data model. Re-exports @matter/model package. |
@matter/main/node | Exports the matter node specific classes. Re-exports @matter/node package. |
@matter/main/protocol | Exports Basic Matter protocol functionality. Re-exports @matter/protocol package. |
@matter/main/types | Exports all Types (includes Clusters and Matter datatypes and matter.js own datatypes. Re-exports @matter/types package. |
Both exports and the typings are exported as CommonJS and ES6 modules.
For more details please refer to the API Documentation.
To have Typescript and your IDE know all the relevant exported functionality you need to use the following in your tsconfig.json:
{
compilerOptions: {
moduleResolution: "node16", // Required to support package.json exports
module: "node16", // Required to make sure all imports are js
},
}
Additionally, we recommend using "strictNullChecks": true
or better for code quality "strict": true
to make sure that all types are correctly determined.
npm run build
: Build all code and create CommonJS and ES6 variants in dist directory. This will built incrementally and only build the changed files.npm run build-clean
: Clean the dist directory and build all code from scratchnpm run test-node
: Run tests in node.jsnpm run test-web
: Run tests in the browsernpm run test
: Run all teststest-web will create a /coverage directory containing the test code coverage
0.11.0 (2024-10-29)
IMPORTANT: As of 0.10.0 the @project-chip/matter.js module has grown quite large. This release includes major refactoring that moves functional areas into independent NPM packages under the "@matter" org. We have added exports to maintain backwards compatibility but these are not exhaustive. In some cases you may need to update imports to reference new code locations.
Cross-module changes
package.json
"imports" field. This is an internal change that simplifies imports but should not affect consumers@matter/general:
@project-chip/matter.js
. It now lives in @matter/general
ObserverGroup
class simplifies binding management for multiple observables@matter/main:
@matter/model:
@project-chip/matter.js/model
now resides in @matter/model
@matter/node:
@project-chip/matter.js
now reside in @matter/node
. The Node API includes node management, behavior definitions and endpoint definitions@matter/node/behaviors
or individually (e.g. @matter/node/behaviors/on-off
)@matter/node/endpoints
and @matter/node/devices
respectively. You may also import these via index or individually@matter/nodejs:
@project-chip/matter-node.js
remains as a compatibility import.@matter/nodejs-ble
@project-chip/matter-node-ble.js
remains as a compatibility import.@matter/nodejs-shell:
@matter/protocol:
@project-chip/matter.js
now resides in @matter/protocol
. This includes network communication, fabric management and cluster invocation, read/write, events, etc.DeviceCommissioner
, DeviceAdvertiser
, NodeFinder
and Subscription
now perform functions that previously were in the (deprecated) MatterDevice class@matter/types:
@project-chip/matter.js
now reside in @matter/types
. This includes most TLV structures, cluster definitions, and various support types@project-chip/matter.js
. You can import via @project-chip/types/clusters
or individually (e.g. @project-chip/types/clusters/window-covering
)@matter/examples:
@matter/cli-tool:
@matter/create
npm init @matter help
anywhere you have Node.js installedMatter-Core functionality:
matter.js clusters:
matter.js Controller API:
FAQs
Matter.js main entrypoint
The npm package @matter/main receives a total of 15,230 weekly downloads. As such, @matter/main popularity was classified as popular.
We found that @matter/main demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.