Skip to main content

Module bundle

Module bundle 

Source
Expand description

Step-file front-end: rolldown bundle + tree-shake + TypeScript -> one ESM module -> compiled to QuickJS bytecode once.

rolldown (built on oxc) resolves the whole import graph including node_modules, transpiles .ts/.tsx, tree-shakes, and emits a single ESM chunk. That chunk is compiled to bytecode a single time; every per-worker session links the bytecode (one Module::load, no parse, no resolver). A hidden source map is kept so a JS error in the bundled output is reported at the original .ts/.js location.

Structs§

CompiledBundle
One bundled+tree-shaken step graph compiled to QuickJS bytecode, plus the source map to translate bundled positions back to source.
CompiledPlugin
One plugin file: rolldown-bundled (TypeScript, plugin-local imports, tree-shaking) and compiled to QuickJS bytecode, with its manifests extracted straight from the compiled module — no separate throwaway runtime per file.

Functions§

bundle_and_compile
Bundle the step entry files (TypeScript ok; node_modules and shared utils resolved + tree-shaken) into one ESM module and compile it to bytecode. Done once, before workers spawn.
bundle_source
rolldown-bundle + tree-shake + transpile the step entry files (and their node_modules/shared imports) into a single ESM module. Returns the bundled code and the (hidden) source map JSON. Exposed for diagnostics/tests; production uses bundle_and_compile.
compile_and_extract_plugins
Bundle + compile + extract every plugin file. The expensive per-file rolldown bundles run concurrently; bytecode compile + extraction share ONE throwaway runtime for the whole batch (the pre-migration path spun one full engine per file for extraction and one per file for bytecode). Unchanged files are served from the process content-hash cache with no bundle and no compile.
eval_bundle
Link + evaluate the bundled step module from precompiled bytecode in the given session. Top-level Given/When/Then run here.