@hyperfrontend/builder/bundle/rollup/workerworker
Forked-worker entry script for per-entry rollup invocations. Sits behind the dispatchRollupWorker orchestrator in bundle/rollup/dispatch.ts.
The worker reads a serializable RollupBuildDescriptor from process.argv[2], reconstructs RollupOptions using the same plugin factories the parent would have used in-process, runs rollup() → bundle.write() → bundle.close(), writes a JSON report to job.reportPath, and exits. Process isolation reclaims the rollup-invocation heap and RSS at exit, keeping the parent bounded across libraries with many entries (per-entry rollup invocations accumulate ~150-225MB heap and V8 retains freed pages even after explicit GC).
runRollupWorkerJob(descriptor) is exported so callers and tests can drive the worker logic without spawning a new Node process.
API Reference
ƒ Functions
job and writes the resulting report to job.reportPath. Use this to drive the worker logic in-process; use dispatchRollupWorker to run the same job in a forked Node process.
Parameters
| Name | Type | Description |
|---|---|---|
§job | RollupBuildDescriptor | Descriptor describing the rollup invocation. |
Returns
Promise<RollupWorkerReport>Example
Driving the worker logic in-process for a fixture
const report = await runRollupWorkerJob({ format: 'esm', inputFile: '/abs/in.ts', ... })◈ Interfaces
JSON.stringify / JSON.parse — no functions, no class instances. The worker reconstructs
RollupOptions from the descriptor using the same plugin factories the parent would have used in-process.Properties
bin:RollupWorkerBin— null for non-bin entries.bundle:RollupWorkerBundleOutput— null for esm/cjs.bundledDepsPlugin:RollupWorkerBundledDepsPlugin— workspaceRoutes:WorkspaceBundledDepRoute[]— _dependencies/<packageName>(/<sub>)?/index.<ext> chunk. Empty array for descriptors that do not opt into workspace-dep hoisting.Captures the format-specific output knobs the worker needs to reconstruct
OutputOptions for a self-contained browser bundle.reportPath when the worker exits cleanly.◆ Types
type RollupWorkerFormat = "esm" | "cjs" | "iife" | "umd"