Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@matter/main

Package Overview
Dependencies
Maintainers
0
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matter/main

Matter.js main entrypoint

  • 0.11.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
increased by71.08%
Maintainers
0
Weekly downloads
 
Created
Source

@matter/main

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:

  • Network (UDP/MDNS)
  • Crypto
  • Storage
  • Date/Timer
  • Logger (Default uses "console")
  • Environment (Process and Configuration handling)

Exported functionality

[!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:

ExportDescription
@matter/mainRe-Exports all functionality from @matter/general, @matter/node, Environment class, Matter model class and the datatypes from @matter/types
@matter/main/behaviorsExports 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/clustersExports all Matter Cluster definitions
@matter/main/clusters/*Exports Matter Cluster definitions as cluster-name export
@matter/main/devicesExports Matter Device type classes
@matter/main/devices/*Exports Matter Device type classes as cluster-name export
@matter/main/endpointsExports Matter Endpoint structure classes
@matter/main/endpoints/*Exports Matter Endpoint structure classes as cluster-name export
@matter/main/modelExports a JavaScript version of the Matter data model. Re-exports @matter/model package.
@matter/main/nodeExports the matter node specific classes. Re-exports @matter/node package.
@matter/main/protocolExports Basic Matter protocol functionality. Re-exports @matter/protocol package.
@matter/main/typesExports 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.

Typescript note

To have Typescript and your IDE know all the relevant exported functionality you need to use the following in your tsconfig.json:

{
    compilerOptions: {
        "target": "es2022", // Matter.js most likely won't work with older versions of ES
        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.

Building

  • 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 scratch

Tests

  • npm run test-node: Run tests in node.js
  • npm run test-web: Run tests in the browser
  • npm run test: Run all tests

test-web will create a /coverage directory containing the test code coverage

Keywords

FAQs

Package last updated on 07 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc