Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial decomposition pass on matter.js #1154

Merged
merged 4 commits into from
Sep 9, 2024

Commits on Sep 9, 2024

  1. Initial decomposition pass on matter.js

    This is a partial pass deconstructing the matter.js package.  I tried to stick to decisions we'd previously agreed to.
    
    The new @project-chip/matter.js-general package contains those portions of matter.js that are not Matter specific.
    
    The new @project-chip/matter.js-model package contains the Matter object model.
    
    Since I was moving stuff around I got rid of the Uint8Array monkey patches we did in ByteArray.  For the most part this just consisted of replacing the "ByteArray" type with "Uint8Array".  The methods we injected I moved to a "Bytes" namespace containing utility functions.  This is a breaking change.
    
    Following new conventions, the new packages don't have "matter.js" in their names, so they're just in "packages/general" and "packages/model".  I also renamed packages/matter.js-tools to packages/tools.  I did not rename the other directories yet.
    
    I updated codegen and the intermediate model package dependencies, so codegen errors do not prevent codegen from running except for the generated model files in @project-chip/matter.js-model.
    
    The new packages are smaller so I moved to a flat namespace for exports.  So there are no subpaths exported from the "general" package, even though most of the exports were previously exported as subpaths of matter.js.  I think this improves readability and makes consumption simpler.
    
    "model" also has a flat namespace but this was true of the previous "@project-chip/matter.js/model" module so this isn't as big of a change.
    
    I did my best to add exports to matter.js to support backward compatibility.  However I used a little editorial control to select which exports to reproduce at the old location...  I made sure to cover all of those we used previously in the examples.  Many of the other exports were probably not ever used externally.  Shouldn't be a big deal if I got it wrong; we can add additional exports or just inform users of the new locations.
    
    Fixes project-chip#156
    lauckhart committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    b4e6411 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4f385fb View commit details
    Browse the repository at this point in the history
  3. PR feedback

    Also changes git package versions from "git" to "0.0.0-git" because NPM intermittently chokes on the former.
    lauckhart committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    8837c71 View commit details
    Browse the repository at this point in the history
  4. eslint optimizations

    Analyze TS files as a single project and do not analyze intermediate models.
    
    Linting goes from 4m 16s to 1m 49s on my laptop.  Hopefully further optimization possible.
    lauckhart committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    a67aa1d View commit details
    Browse the repository at this point in the history