Consider if package structure can be simplified
Currently the package dependency structure is:
api /->
core -> api
wasm -> core
addon -> core
runtime -> wasm, ?addon
server -> runtime
helpers -> core, api
A couple things are not clear to me:
- Is there a need to separate
runtimeandserver? I don't see anything that would get in the way of mergingruntimeintoserver. Am I missing something? - Is the exported API surface of
coreactually the minimal common functionality that is needed by bothwasmandaddon? If not, should the extras be moved intowasm/addon? - Is there a need to separate
corefromapi, or couldcorebe merged intoapibut not exported?
There has been a bit of drift since then, but initially there was (IIRC) only core, server and helpers (and client but that was before SSE), i.e. no api, no wasm, no addon and no runtime. The idea was that:
serverwould contain only the logic for taking a reactive service definition and spawning the http servers to expose it through HTTP/SSE.corewould contain the type definitions needed to declare a reactive service, along with the skip bindingshelperswould contain a mix of things that were not strictly needed by the other two, but probably nice to have for some users in some cases (and was expected to be reviewed and stripped down).
@skiplabsdaniel can probably give you more accurate context on why api/wasm/addon/runtime were introduced.
In first place, api was introduced to have a common interface between addon and wasm. Initially the addon was a node native copy of wasm code. Now, api and core can effectively be merged.
wasm and addon was created to allow separated load, as addon is built during npm install it's need to be in separated package to prevent full install failure.
runtime was introduced to automatically manage the addon install failure and use the wasm version in that case.
If we consider that we never use the skip runtime without the server, server and the runtime can effectively be merged.
Today, the wasm package is always installed with runtime due to the npm project manager mechanism, in clean npm world, the package wasm is installed only if the addon install failed.