@hyperfrontend/builder/bin/native/workerworker
Forked-worker entry script for postject inject. Sits behind the dispatchInjectWorker orchestrator in bin/native/dispatch.ts.
The worker reads a serializable InjectWorkerJob from process.argv[2], clones the Node host binary to the output path, reads the SEA preparation blob, calls postject.inject to embed the blob into the cloned binary, writes a JSON report to job.reportPath, and exits. Process isolation reclaims the ~138 MB Buffer postject allocates while loading + rewriting the host binary, keeping the parent's RSS bounded across the rest of the SEA pipeline (the empirical pre-Phase-11.8 spike was ~1.8 GB at this exact step on memory-constrained hosts).
runInjectWorkerJob(descriptor) is exported so callers and tests can drive the worker logic without spawning a new Node process.
API Reference
ƒ Functions
job in the current process and writes the resulting report to job.reportPath. Call this to drive the worker logic without spawning a new Node process. The inject normally runs in a forked child because
postject.inject loads the entire ~121 MB host binary into a Node Buffer and rewrites it with the embedded blob — a single ~138 MB allocation that needs to be reclaimed on process exit rather than retained in the parent's RSS.Parameters
| Name | Type | Description |
|---|---|---|
§job | InjectWorkerJob | Descriptor describing the inject invocation. |
Returns
Promise<InjectWorkerReport>Example
Driving the worker logic in-process for a fixture
const report = await runInjectWorkerJob({
hostBinary: '/opt/node',
outputBinary: '/tmp/out',
blobPath: '/tmp/sea.blob',
resourceName: 'NODE_SEA_BLOB',
machoSegmentName: 'NODE_SEA',
sentinelFuse: 'NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2',
reportPath: '/tmp/report.json',
})◈ Interfaces
JSON.stringify / JSON.parse — no functions, no class instances.Properties
blobPath:string— node --experimental-sea-config.hostBinary:string— sentinelFuse:string— reportPath when the worker exits cleanly. Captured from the worker process — the parent never observes the ~138 MB postject buffer because the entire load lives and dies in the child.