starbeamjs / starbeam

Fun and simple reactivity
Other
339 stars 15 forks source link

Reduce the number of packages #154

Open NullVoxPopuli opened 4 months ago

NullVoxPopuli commented 4 months ago

There are a lot of core packages right now.

We don't want users to have to know what to install, so we've talked about bundling them all in to one published package that users would install.

It is useful to have separate boundaries for conceptual reasons, and hard package boundaries enforce that -- at the cost of build complexity.

Perhaps we can combine all the core packages (leaving out renderers, collections), and keep boundary enforcement via this lint: https://eslint.org/docs/latest/rules/no-restricted-imports

example:

given:

@starbeam/core: 
  src/
    core/
    core-utils/ # does this need to be separate? (move to utils?)
    debug/ 
    reactive-core/
    resource/
    runtime/ 
    lifetime/
    interfaces/ # would probably no longer need to exist, interfaces can be inlined where needed

@starbeam/renderer:
  unchanged

this would greatly improve our dead-code-elimination as well. https://github.com/starbeamjs/starbeam/pull/149

an example of configuring the lint rule:

{
  files: ['**/debug'],
  rules: {
    "no-restricted-imports": ["error", {
        "patterns": ["../*"] # no parent imports at all
    }]
  }

This would mean in order to import from other folders, we'd want to use subpath imports, described here: https://nodejs.org/api/packages.html#subpath-imports (an ESM / type=module only feature)