You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the runtime package expects to find a directory within the JS modules tarball, at the name __runtime__; however, the runtime codebase produces a structure under the directory node_modules. There are some other bugs, too, which are worth fixing, so that the JS modules can be used directly as an output in the main codebase. These are summarized below.
1) Directory structure
Expected:__runtime__/<module>/...
Actual:node_modules/<module>/...
We need to restructure the tarball so that it matches the expected layout. Without this layout, loading the tarball will immediately crash the CLI upon start.
2) Compression of tarball
Currently, the tarball is a simple, uncompressed package. It needs to be compressed or the CLI will fail to load it.
3) Incorrect module pointers
Via built-in module package.json files, certain built-in module files have a module or main attribute which points to an invalid file. Obviously this must be fixed as it also causes crashes. We need to uniformly provide main and module for all built-in modules, and additionally provide the exports property.
The package.json structure should look like this (sample from buffer):
4) Uniform availability of both ESM and CJS exports
As mentioned in part above, all built-in modules should provide both types of import support -- CJS and ESM. This is probably accomplished via tuning the esbuild flags for those modules.
Example (again, from buffer):
buffer.cjs:
/** * Intrinsic: Buffer. * * Provides a shim which offers a `Buffer` implementation that is compatible with Node.js-style imports. *//** * Export the intrinsic `Buffer` type as the main export, and also an export called `Buffer`. */module.exports.Buffer=globalThis['Buffer'];
buffer.mjs:
/** * Intrinsic: Buffer. * * Provides a shim which offers a `Buffer` implementation that is compatible with Node.js-style imports. *//** * Export the intrinsic `Buffer` type as the main export, and also an export called `Buffer`. */exportconstBuffer=globalThis['Buffer'];exportdefault{
Buffer
};
5) Invalid ESM bundles
There is a bug coming from somewhere which results in an invalid ESM package within the builtin JS modules. It generally looks like this:
export{<...>asdefault}
The text was updated successfully, but these errors were encountered:
Currently, the runtime package expects to find a directory within the JS modules tarball, at the name
__runtime__
; however, theruntime
codebase produces a structure under the directorynode_modules
. There are some other bugs, too, which are worth fixing, so that the JS modules can be used directly as an output in the main codebase. These are summarized below.1) Directory structure
__runtime__/<module>/...
node_modules/<module>/...
We need to restructure the tarball so that it matches the expected layout. Without this layout, loading the tarball will immediately crash the CLI upon start.
2) Compression of tarball
Currently, the tarball is a simple, uncompressed package. It needs to be compressed or the CLI will fail to load it.
3) Incorrect module pointers
Via built-in module
package.json
files, certain built-in module files have amodule
ormain
attribute which points to an invalid file. Obviously this must be fixed as it also causes crashes. We need to uniformly providemain
andmodule
for all built-in modules, and additionally provide theexports
property.The
package.json
structure should look like this (sample frombuffer
):4) Uniform availability of both ESM and CJS exports
As mentioned in part above, all built-in modules should provide both types of import support -- CJS and ESM. This is probably accomplished via tuning the esbuild flags for those modules.
Example (again, from
buffer
):buffer.cjs
:buffer.mjs
:5) Invalid ESM bundles
There is a bug coming from somewhere which results in an invalid ESM package within the builtin JS modules. It generally looks like this:
The text was updated successfully, but these errors were encountered: