fix(cli): emit child-process runtime worker in the published package
engine's child-process-runtime forks dist/child-process-worker.js as a sibling of the bundled bin.js, but the CLI build never emitted it, so isolationMode: "child-process" could not spawn its runtime worker from any published install. Add a named tsup entry bundling the engine worker with bin.js's exact externals; verified via fork() with the runtime's spawn options (IPC handlers register, no module-resolution errors) and npm pack --dry-run listing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
7
.changeset/ship-child-process-worker.md
Normal file
7
.changeset/ship-child-process-worker.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@runfusion/fusion": patch
|
||||
---
|
||||
|
||||
summary: Ship the child-process runtime worker so isolationMode "child-process" works from npm installs.
|
||||
category: fix
|
||||
dev: New tsup entry emits dist/child-process-worker.js beside bin.js, matching the engine's getWorkerPath() sibling resolution; bundled with bin.js's noExternal/external/banner shape.
|
||||
@@ -368,7 +368,23 @@ function assertAllStagedBundledPluginsLoadable() {
|
||||
const pluginSdkEntry = join(__dirname, "..", "plugin-sdk", "src", "index.ts");
|
||||
|
||||
const cliBuildConfig = {
|
||||
entry: ["src/bin.ts", "src/extension.ts"],
|
||||
/*
|
||||
* FNXC:CliPackaging 2026-07-17-21:05:
|
||||
* Projects with isolationMode "child-process" fork a runtime worker that the engine's
|
||||
* getWorkerPath() resolves as child-process-worker.js NEXT TO the running compiled module —
|
||||
* i.e. dist/child-process-worker.js beside the bundled dist/bin.js in a published install.
|
||||
* The published package never shipped that file, so child-process isolation always failed
|
||||
* with ERR_MODULE_NOT_FOUND. Emit the engine worker as a sibling named entry here so it
|
||||
* inherits the exact bin.js bundling shape (ESM, @fusion/* bundled via noExternal, native and
|
||||
* platform-specific deps external and resolved from the installed package's node_modules,
|
||||
* createRequire banner). The worker is spawned with node fork() + IPC, so it must be a plain
|
||||
* Node-runnable ESM file; every external below is a published dependency of @runfusion/fusion.
|
||||
*/
|
||||
entry: {
|
||||
bin: "src/bin.ts",
|
||||
extension: "src/extension.ts",
|
||||
"child-process-worker": "../engine/src/runtimes/child-process-worker.ts",
|
||||
},
|
||||
format: ["esm"],
|
||||
platform: "node",
|
||||
target: "node22",
|
||||
|
||||
Reference in New Issue
Block a user