@hyperfrontend/builder/bundle/dependencies/workerworker
Forked-worker entry script for the dependency pre-pass. Sits behind the runPrePass orchestrator in bundle/dependencies/pre-pass.ts.
The worker reads a serializable PrePassWorkerJob from process.argv[2] and reconstructs RollupOptions for one of four kinds: the npm JS pre-pass (json + nodeResolve + commonjs), the npm d.ts pre-pass (rollup-plugin-dts), the workspace-source JS pre-pass (the same JS chain plus @rollup/plugin-typescript driving the dep's tsconfig), or the workspace-source d.ts pre-pass (rollup-plugin-dts driven by that tsconfig). It then 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 so each dep is pre-passed in a fresh address space, keeping the parent bounded across the full dep set.
runPrePassWorkerJob(job) 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. Public so callers (and tests) can drive the worker logic without spawning a new Node process.
Parameters
| Name | Type | Description |
|---|---|---|
§job | PrePassWorkerJob | Job spec describing the rollup invocation. |
Returns
Promise< PrePassWorkerReport>Example
Driving the worker logic in-process for a fixture
const report = await runPrePassWorkerJob({ kind: 'js', dep: 'rollup', ... })◈ Interfaces
process.argv[2]. Each invocation produces exactly one rollup output and one JSON report at
reportPath so the parent orchestrator can collect per-job statistics.Properties
depsRoot?:stringAbsolute path to the project's _dependencies/ root. Required when npmDeps or workspaceRoutes is non-empty.format:"cjs" | "esm"Output format. JS jobs must use 'esm' or 'cjs'. dts jobs always use 'es' internally.inputPath:stringAbsolute path to the dep's entry (main / module for JS, types for dts, source .ts for workspace-*).kind:PrePassWorkerJobKindPre-pass kind. js and dts run the npm-dep pipeline; workspace-js and workspace-dts add @rollup/plugin-typescript (or rollup-plugin-dts's tsconfig integration) so TypeScript source workspace deps can be hoisted.npmDeps?:string[ ]NPM bundled-dep names consumed by the canonical externalize plugin to rewrite cross-dep imports to relative paths under depsRoot.otherDeps:string[ ]Other deps in the pre-pass set; marked external so cross-dep imports stay link-time. Prefix-matched.otherWorkspaceSpecifiers?:string[ ]Sub-path-mode workspace specifiers in the pre-pass set; matched as exact specifier only (e.g. @hyperfrontend/immutable-api-utils/built-in-copy/array). Used by workspace-* jobs so sibling sub-paths externalize cleanly without also externalizing every other sub-path on the same package.selfDtsPath?:stringAbsolute path to the input file's owning entry directory (used to compute sibling specifiers).selfSrcPath?:stringOwning entry's srcPath (used for diagnostics). Empty string for the package root.siblingEntries?:SiblingEntry[ ]Sibling-entry descriptors used by the per-entry dts pass to externalize imports that resolve into another entry's directory. Empty / omitted for dep pre-pass jobs.workspaceRoot?:stringAbsolute workspace root used as baseUrl for path-mapping resolution (workspace-* jobs only).workspaceRoutes?:WorkspaceBundledDepRoute[ ]Workspace bundled-dep routes consumed by the canonical externalize plugin. For self-pre-pass jobs (workspace-js / workspace-dts) this excludes the specifier or package being built so the chunk inlines its own internals.reportPath when a worker exits cleanly.