@hyperfrontend/builder 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/_dependencies/@hyperfrontend/project-scope/core/fs/index.cjs.js +10 -3
  3. package/_dependencies/@hyperfrontend/project-scope/core/fs/index.esm.js +10 -3
  4. package/_dependencies/@hyperfrontend/project-scope/core/index.cjs.js +16 -6
  5. package/_dependencies/@hyperfrontend/project-scope/core/index.esm.js +16 -6
  6. package/_dependencies/@hyperfrontend/project-scope/core/path/index.cjs.js +4 -5
  7. package/_dependencies/@hyperfrontend/project-scope/core/path/index.esm.js +5 -4
  8. package/_dependencies/@hyperfrontend/project-scope/project/root/index.cjs.js +5 -1
  9. package/_dependencies/@hyperfrontend/project-scope/project/root/index.esm.js +5 -1
  10. package/bin/hf-build.js +110 -82
  11. package/bin/hf-build.linux-x64 +0 -0
  12. package/bin/index.cjs.js +82 -36
  13. package/bin/index.esm.js +82 -36
  14. package/bin/script/index.cjs.js +91 -45
  15. package/bin/script/index.esm.js +81 -35
  16. package/bundle/declarations/dts-per-entry.d.ts.map +1 -1
  17. package/bundle/declarations/dts-pre-pass.d.ts.map +1 -1
  18. package/bundle/declarations/index.cjs.js +118 -72
  19. package/bundle/declarations/index.esm.js +83 -37
  20. package/bundle/dependencies/index.cjs.js +95 -49
  21. package/bundle/dependencies/index.d.ts +13 -24
  22. package/bundle/dependencies/index.esm.js +79 -33
  23. package/bundle/dependencies/pre-pass.d.ts +13 -24
  24. package/bundle/dependencies/pre-pass.d.ts.map +1 -1
  25. package/bundle/index.cjs.js +203 -175
  26. package/bundle/index.esm.js +107 -79
  27. package/bundle/rollup/dispatch.d.ts +12 -14
  28. package/bundle/rollup/dispatch.d.ts.map +1 -1
  29. package/bundle/rollup/index.cjs.js +75 -29
  30. package/bundle/rollup/index.d.ts +14 -16
  31. package/bundle/rollup/index.esm.js +76 -30
  32. package/bundle/worker-locator.d.ts +47 -0
  33. package/bundle/worker-locator.d.ts.map +1 -0
  34. package/index.cjs.js +112 -84
  35. package/index.esm.js +113 -85
  36. package/package.json +31 -3
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Resolved worker invocation: an absolute script path plus any extra Node args
3
+ * prepended to the spawned child's argv (the `@swc-node/register` loader when the
4
+ * worker is reached as TypeScript source rather than a compiled artifact).
5
+ */
6
+ export interface WorkerInvocation {
7
+ /** Absolute path to the resolved worker entry script. */
8
+ path: string;
9
+ /** Extra args prepended to the spawned child's argv. */
10
+ execArgv: string[];
11
+ }
12
+ /**
13
+ * Directory of the currently-executing builder module, read from `__dirname`.
14
+ * It is present in the shipped CommonJS build, in the `@swc-node/register` source
15
+ * bootstrap, and under the test runner, so callers get their own on-disk location
16
+ * and can find the worker beside them however the builder was packaged.
17
+ *
18
+ * @returns Absolute directory path of the running module.
19
+ *
20
+ * @example Anchoring a lookup beside the running builder
21
+ * ```typescript
22
+ * const invocation = ascendForWorker(['bundle', 'rollup', 'worker'], currentModuleDir())
23
+ * ```
24
+ */
25
+ export declare const currentModuleDir: () => string;
26
+ /**
27
+ * Locate a builder worker entry by ascending from a start directory toward the
28
+ * filesystem root, returning the first ancestor at which the worker exists at the
29
+ * given in-package offset. The compiled `index.cjs.js` is preferred; an `index.ts`
30
+ * sibling (source-mode bootstrap) resolves with the swc loader attached.
31
+ *
32
+ * The worker ships inside the builder's own package, so resolving relative to the
33
+ * running module finds it wherever the package lives — built dist, an installed
34
+ * `node_modules` copy, or melded into a host bundle under `_dependencies/`.
35
+ *
36
+ * @param offset - In-package path segments to the worker directory (e.g. `['bundle', 'rollup', 'worker']`).
37
+ * @param startDir - Directory to begin the ascent from. Defaults to the running module's directory; pass an explicit value to resolve from another anchor or under test.
38
+ * @returns The resolved worker invocation, or `undefined` if no worker exists at the offset under any ancestor.
39
+ *
40
+ * @example Resolving the rollup worker from the running module
41
+ * ```typescript
42
+ * const invocation = ascendForWorker(['bundle', 'rollup', 'worker'])
43
+ * if (!invocation) throw new Error('builder rollup worker not found beside the builder module')
44
+ * ```
45
+ */
46
+ export declare const ascendForWorker: (offset: readonly string[], startDir?: string) => WorkerInvocation | undefined;
47
+ //# sourceMappingURL=worker-locator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-locator.d.ts","sourceRoot":"","sources":["../../../../../../../libs/builder/src/bundle/worker-locator.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAA;IACZ,wDAAwD;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAUD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,QAAO,MAMnC,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,MAAM,EAAE,EAAE,WAAU,MAA2B,KAAG,gBAAgB,GAAG,SAWrH,CAAA"}
package/index.cjs.js CHANGED
@@ -60,8 +60,8 @@ const ts__default = /*#__PURE__*/_interopDefaultCompat(ts);
60
60
 
61
61
  const log$g = index_cjs_js$3.logger.channel('builder:bin:native:dispatch');
62
62
  const REPORT_DIR_PREFIX$2 = 'hf-builder-inject-';
63
- const SWC_NODE_REGISTER$2 = '@swc-node/register';
64
- const swcNodeAvailable$2 = (workspaceRoot) => node_fs.existsSync(index_cjs_js$4.join(workspaceRoot, 'node_modules', '@swc-node', 'register', 'index.js'));
63
+ const SWC_NODE_REGISTER$1 = '@swc-node/register';
64
+ const swcNodeAvailable = (workspaceRoot) => node_fs.existsSync(index_cjs_js$4.join(workspaceRoot, 'node_modules', '@swc-node', 'register', 'index.js'));
65
65
  /**
66
66
  * Default worker-path resolution: prefers the built-and-published artifact, falls
67
67
  * back to the workspace dist path, and finally to the in-source TypeScript file
@@ -92,8 +92,8 @@ const resolveDefaultInjectWorkerPath = (workspaceRoot) => {
92
92
  return { path, execArgv: [] };
93
93
  }
94
94
  const sourcePath = index_cjs_js$4.join(workspaceRoot, 'libs', 'builder', 'src', 'bin', 'native', 'worker', 'index.ts');
95
- if (node_fs.existsSync(sourcePath) && swcNodeAvailable$2(workspaceRoot)) {
96
- return { path: sourcePath, execArgv: ['--require', SWC_NODE_REGISTER$2] };
95
+ if (node_fs.existsSync(sourcePath) && swcNodeAvailable(workspaceRoot)) {
96
+ return { path: sourcePath, execArgv: ['--require', SWC_NODE_REGISTER$1] };
97
97
  }
98
98
  return undefined;
99
99
  };
@@ -573,45 +573,91 @@ const toUmdBuildDescriptor = (entry, config, context, reportPath) => {
573
573
  };
574
574
  };
575
575
 
576
- const log$e = index_cjs_js$3.logger.channel('builder:bundle:rollup:dispatch');
577
- const REPORT_DIR_PREFIX$1 = 'hf-builder-rollup-';
578
- const SWC_NODE_REGISTER$1 = '@swc-node/register';
579
- const swcNodeAvailable$1 = (workspaceRoot) => node_fs.existsSync(index_cjs_js$4.join(workspaceRoot, 'node_modules', '@swc-node', 'register', 'index.js'));
576
+ const SWC_NODE_REGISTER = '@swc-node/register';
577
+ const probeDir = (dir, offset) => {
578
+ const compiled = node_path.join(dir, ...offset, 'index.cjs.js');
579
+ if (node_fs.existsSync(compiled))
580
+ return { path: compiled, execArgv: [] };
581
+ const source = node_path.join(dir, ...offset, 'index.ts');
582
+ if (node_fs.existsSync(source))
583
+ return { path: source, execArgv: ['--require', SWC_NODE_REGISTER] };
584
+ return undefined;
585
+ };
580
586
  /**
581
- * Default worker-path resolution: prefers the built-and-published artifact, falls
582
- * back to the workspace dist path, and finally to the in-source TypeScript file
583
- * via `@swc-node/register` (bootstrap case where builder is building itself for
584
- * the first time and the dist worker doesn't exist yet).
585
- *
586
- * Looks at, in order:
587
- * 1. `<workspaceRoot>/dist/libs/builder/bundle/rollup/worker/index.cjs.js`
588
- * 2. `<workspaceRoot>/node_modules/@hyperfrontend/builder/bundle/rollup/worker/index.cjs.js`
589
- * 3. `<workspaceRoot>/libs/builder/src/bundle/rollup/worker/index.ts` (with `--require \@swc-node/register`)
587
+ * Directory of the currently-executing builder module, read from `__dirname`.
588
+ * It is present in the shipped CommonJS build, in the `@swc-node/register` source
589
+ * bootstrap, and under the test runner, so callers get their own on-disk location
590
+ * and can find the worker beside them however the builder was packaged.
590
591
  *
591
- * @param workspaceRoot - Absolute workspace root.
592
- * @returns Worker invocation descriptor, or `undefined` if no candidate exists.
592
+ * @returns Absolute directory path of the running module.
593
593
  *
594
- * @example Locating the worker for an in-workspace consumer
594
+ * @example Anchoring a lookup beside the running builder
595
595
  * ```typescript
596
- * const invocation = resolveDefaultRollupWorkerPath('/abs/repo')
597
- * if (!invocation) throw new Error('builder rollup worker artifact not found')
596
+ * const invocation = ascendForWorker(['bundle', 'rollup', 'worker'], currentModuleDir())
598
597
  * ```
599
598
  */
600
- const resolveDefaultRollupWorkerPath = (workspaceRoot) => {
601
- const distCandidates = [
602
- index_cjs_js$4.join(workspaceRoot, 'dist', 'libs', 'builder', 'bundle', 'rollup', 'worker', 'index.cjs.js'),
603
- index_cjs_js$4.join(workspaceRoot, 'node_modules', '@hyperfrontend', 'builder', 'bundle', 'rollup', 'worker', 'index.cjs.js'),
604
- ];
605
- for (const path of distCandidates) {
606
- if (node_fs.existsSync(path))
607
- return { path, execArgv: [] };
599
+ const currentModuleDir = () => {
600
+ /* istanbul ignore if -- @preserve the ESM build has no __dirname; the shipped CommonJS build and the test runner always define it, so this guard is unreachable under test */
601
+ if (typeof __dirname === 'undefined') {
602
+ throw index_cjs_js$6.createError('@hyperfrontend/builder self-location requires the CommonJS build; drive build() from the CommonJS entry point');
608
603
  }
609
- const sourcePath = index_cjs_js$4.join(workspaceRoot, 'libs', 'builder', 'src', 'bundle', 'rollup', 'worker', 'index.ts');
610
- if (node_fs.existsSync(sourcePath) && swcNodeAvailable$1(workspaceRoot)) {
611
- return { path: sourcePath, execArgv: ['--require', SWC_NODE_REGISTER$1] };
604
+ return __dirname;
605
+ };
606
+ /**
607
+ * Locate a builder worker entry by ascending from a start directory toward the
608
+ * filesystem root, returning the first ancestor at which the worker exists at the
609
+ * given in-package offset. The compiled `index.cjs.js` is preferred; an `index.ts`
610
+ * sibling (source-mode bootstrap) resolves with the swc loader attached.
611
+ *
612
+ * The worker ships inside the builder's own package, so resolving relative to the
613
+ * running module finds it wherever the package lives — built dist, an installed
614
+ * `node_modules` copy, or melded into a host bundle under `_dependencies/`.
615
+ *
616
+ * @param offset - In-package path segments to the worker directory (e.g. `['bundle', 'rollup', 'worker']`).
617
+ * @param startDir - Directory to begin the ascent from. Defaults to the running module's directory; pass an explicit value to resolve from another anchor or under test.
618
+ * @returns The resolved worker invocation, or `undefined` if no worker exists at the offset under any ancestor.
619
+ *
620
+ * @example Resolving the rollup worker from the running module
621
+ * ```typescript
622
+ * const invocation = ascendForWorker(['bundle', 'rollup', 'worker'])
623
+ * if (!invocation) throw new Error('builder rollup worker not found beside the builder module')
624
+ * ```
625
+ */
626
+ const ascendForWorker = (offset, startDir = currentModuleDir()) => {
627
+ let dir = startDir;
628
+ let parent = node_path.dirname(dir);
629
+ // how: probe each level then step up; the final probe covers the filesystem root, where parent === dir
630
+ while (parent !== dir) {
631
+ const found = probeDir(dir, offset);
632
+ if (found)
633
+ return found;
634
+ dir = parent;
635
+ parent = node_path.dirname(dir);
612
636
  }
613
- return undefined;
637
+ return probeDir(dir, offset);
614
638
  };
639
+
640
+ const log$e = index_cjs_js$3.logger.channel('builder:bundle:rollup:dispatch');
641
+ const REPORT_DIR_PREFIX$1 = 'hf-builder-rollup-';
642
+ /**
643
+ * Resolves the rollup worker by self-locating it beside the running builder
644
+ * module: ascends from the module's own directory to the builder package root
645
+ * and returns the worker at `bundle/rollup/worker`. This works whether the
646
+ * builder runs from its built dist, an installed `node_modules` copy, or melded
647
+ * into a host bundle under `_dependencies/`. The compiled `index.cjs.js` is
648
+ * preferred; an `index.ts` sibling resolves with the `@swc-node/register` loader
649
+ * for source-mode bootstrap.
650
+ *
651
+ * @param startDir - Directory to begin the ascent from. Defaults to the running module's directory; pass an explicit value to resolve from another anchor or under test.
652
+ * @returns Worker invocation descriptor, or `undefined` if no worker is found under any ancestor.
653
+ *
654
+ * @example Locating the worker beside the builder
655
+ * ```typescript
656
+ * const invocation = resolveDefaultRollupWorkerPath()
657
+ * if (!invocation) throw new Error('builder rollup worker artifact not found')
658
+ * ```
659
+ */
660
+ const resolveDefaultRollupWorkerPath = (startDir) => ascendForWorker(['bundle', 'rollup', 'worker'], startDir);
615
661
  const createReportDir$1 = () => node_fs.mkdtempSync(index_cjs_js$4.join(node_os.tmpdir(), REPORT_DIR_PREFIX$1));
616
662
  const reportPathFor$1 = (reportDir, descriptor) => {
617
663
  const safeLabel = descriptor.inputFile.replace(/[^a-zA-Z0-9_-]+/g, '_');
@@ -691,10 +737,10 @@ const dispatchRollupWorker = async (descriptor, options) => {
691
737
  };
692
738
 
693
739
  const log$d = index_cjs_js$3.logger.channel('builder:bin:script');
694
- const resolveWorkerOrThrow = (workspaceRoot) => {
695
- const invocation = resolveDefaultRollupWorkerPath(workspaceRoot);
740
+ const resolveWorkerOrThrow = () => {
741
+ const invocation = resolveDefaultRollupWorkerPath();
696
742
  if (!invocation) {
697
- throw index_cjs_js$6.createError('rollup worker could not be resolved for bin script bundling. Build @hyperfrontend/builder at least once before invoking the bin phase, or ensure @swc-node/register is installed for source-mode bootstrap.');
743
+ throw index_cjs_js$6.createError('rollup worker could not be located beside the builder module for bin script bundling. The @hyperfrontend/builder package appears incomplete, or @swc-node/register is missing for source-mode bootstrap.');
698
744
  }
699
745
  return invocation;
700
746
  };
@@ -735,7 +781,7 @@ const buildJsBin = async (bin, ctx) => {
735
781
  const formats = normalizeFormats(bin.format);
736
782
  const binDir = index_cjs_js$4.join(ctx.outputPath, 'bin');
737
783
  index_cjs_js$4.ensureDir(binDir);
738
- const worker = resolveWorkerOrThrow(ctx.workspaceRoot);
784
+ const worker = resolveWorkerOrThrow();
739
785
  const outputs = [];
740
786
  for (const format of formats) {
741
787
  const descriptor = toBinBuildDescriptor(bin, ctx, format, formats, '');
@@ -1132,43 +1178,25 @@ const readReport = (reportPath, job) => {
1132
1178
  const data = index_cjs_js$5.parse(node_fs.readFileSync(reportPath, 'utf8'));
1133
1179
  return { job, outputSize: data.outputSize, endHeapMB: data.endHeapMB, endRssMB: data.endRssMB, durationMs: data.durationMs };
1134
1180
  };
1135
- const SWC_NODE_REGISTER = '@swc-node/register';
1136
- const swcNodeAvailable = (workspaceRoot) => node_fs.existsSync(index_cjs_js$4.join(workspaceRoot, 'node_modules', '@swc-node', 'register', 'index.js'));
1137
1181
  /**
1138
- * Default worker-path resolution: prefers the built-and-published artifact, falls
1139
- * back to the workspace dist path, and finally to the in-source TypeScript file
1140
- * via `@swc-node/register` (bootstrap case where builder is building itself for
1141
- * the first time and the dist worker doesn't exist yet).
1142
- *
1143
- * Looks at, in order:
1144
- * 1. `<workspaceRoot>/dist/libs/builder/bundle/dependencies/worker/index.cjs.js`
1145
- * 2. `<workspaceRoot>/node_modules/@hyperfrontend/builder/bundle/dependencies/worker/index.cjs.js`
1146
- * 3. `<workspaceRoot>/libs/builder/src/bundle/dependencies/worker/index.ts` (with `--require \@swc-node/register`)
1147
- *
1148
- * @param workspaceRoot - Absolute workspace root.
1149
- * @returns Worker invocation descriptor, or `undefined` if no candidate exists.
1150
- *
1151
- * @example Locating the worker for an in-workspace consumer
1182
+ * Resolves the dependency pre-pass worker by self-locating it beside the running
1183
+ * builder module: ascends from the module's own directory to the builder package
1184
+ * root and returns the worker at `bundle/dependencies/worker`. This works whether
1185
+ * the builder runs from its built dist, an installed `node_modules` copy, or
1186
+ * melded into a host bundle under `_dependencies/`. The compiled `index.cjs.js`
1187
+ * is preferred; an `index.ts` sibling resolves with the `@swc-node/register`
1188
+ * loader for source-mode bootstrap.
1189
+ *
1190
+ * @param startDir - Directory to begin the ascent from. Defaults to the running module's directory; pass an explicit value to resolve from another anchor or under test.
1191
+ * @returns Worker invocation descriptor, or `undefined` if no worker is found under any ancestor.
1192
+ *
1193
+ * @example Locating the worker beside the builder
1152
1194
  * ```typescript
1153
- * const invocation = resolveDefaultWorkerPath('/abs/repo')
1195
+ * const invocation = resolveDefaultWorkerPath()
1154
1196
  * if (!invocation) throw new Error('builder worker artifact not found')
1155
1197
  * ```
1156
1198
  */
1157
- const resolveDefaultWorkerPath = (workspaceRoot) => {
1158
- const distCandidates = [
1159
- index_cjs_js$4.join(workspaceRoot, 'dist', 'libs', 'builder', 'bundle', 'dependencies', 'worker', 'index.cjs.js'),
1160
- index_cjs_js$4.join(workspaceRoot, 'node_modules', '@hyperfrontend', 'builder', 'bundle', 'dependencies', 'worker', 'index.cjs.js'),
1161
- ];
1162
- for (const path of distCandidates) {
1163
- if (node_fs.existsSync(path))
1164
- return { path, execArgv: [] };
1165
- }
1166
- const sourcePath = index_cjs_js$4.join(workspaceRoot, 'libs', 'builder', 'src', 'bundle', 'dependencies', 'worker', 'index.ts');
1167
- if (node_fs.existsSync(sourcePath) && swcNodeAvailable(workspaceRoot)) {
1168
- return { path: sourcePath, execArgv: ['--require', SWC_NODE_REGISTER] };
1169
- }
1170
- return undefined;
1171
- };
1199
+ const resolveDefaultWorkerPath = (startDir) => ascendForWorker(['bundle', 'dependencies', 'worker'], startDir);
1172
1200
  /**
1173
1201
  * Sequentially runs the supplied pre-pass jobs by forking a fresh Node child
1174
1202
  * per invocation. Strict sequential execution is mandatory — concurrent
@@ -1297,9 +1325,9 @@ const buildJobs$1 = (entries, context) => {
1297
1325
  const runDtsPerEntry = async (context, monitor) => {
1298
1326
  if (context.bundledDeps.length === 0 && context.workspaceBundledDeps.length === 0)
1299
1327
  return;
1300
- const invocation = resolveDefaultWorkerPath(context.workspaceRoot);
1328
+ const invocation = resolveDefaultWorkerPath();
1301
1329
  if (!invocation) {
1302
- throw index_cjs_js$6.createError('bundleAllDeps is enabled but the pre-pass worker artifact was not found for the per-entry d.ts pass.');
1330
+ throw index_cjs_js$6.createError('bundleAllDeps is enabled but the pre-pass worker could not be located beside the builder module for the per-entry d.ts pass.');
1303
1331
  }
1304
1332
  const jobs = buildJobs$1(context.entryPointDiscovery.entryPoints, context);
1305
1333
  if (jobs.length === 0) {
@@ -1482,9 +1510,9 @@ const buildWorkspaceJobs = (context, npmDeps) => {
1482
1510
  const runDtsPrePass = async (context, monitor) => {
1483
1511
  if (context.bundledDeps.length === 0 && context.workspaceBundledDeps.length === 0)
1484
1512
  return;
1485
- const invocation = resolveDefaultWorkerPath(context.workspaceRoot);
1513
+ const invocation = resolveDefaultWorkerPath();
1486
1514
  if (!invocation) {
1487
- throw index_cjs_js$6.createError('bundleAllDeps is enabled but the pre-pass worker artifact was not found for the d.ts pre-pass.');
1515
+ throw index_cjs_js$6.createError('bundleAllDeps is enabled but the pre-pass worker could not be located beside the builder module for the d.ts pre-pass.');
1488
1516
  }
1489
1517
  const npmJobs = buildJobs(context.bundledDeps, context);
1490
1518
  const workspaceJobs = buildWorkspaceJobs(context, context.bundledDeps);
@@ -4603,25 +4631,25 @@ const buildWorkspaceJsPrePassJobs = (npmDeps, formats, context) => {
4603
4631
  }
4604
4632
  return jobs;
4605
4633
  };
4606
- const resolvePrePassWorkerOrThrow = (workspaceRoot) => {
4607
- const invocation = resolveDefaultWorkerPath(workspaceRoot);
4634
+ const resolvePrePassWorkerOrThrow = () => {
4635
+ const invocation = resolveDefaultWorkerPath();
4608
4636
  if (!invocation) {
4609
- throw index_cjs_js$6.createError('bundleAllDeps is enabled but the pre-pass worker could not be resolved. Build @hyperfrontend/builder once with bundleAllDeps disabled, or ensure @swc-node/register is installed for source-mode bootstrap.');
4637
+ throw index_cjs_js$6.createError('bundleAllDeps is enabled but the pre-pass worker could not be located beside the builder module. The @hyperfrontend/builder package appears incomplete, or @swc-node/register is missing for source-mode bootstrap.');
4610
4638
  }
4611
4639
  return invocation;
4612
4640
  };
4613
- const resolveRollupWorkerOrThrow = (workspaceRoot) => {
4614
- const invocation = resolveDefaultRollupWorkerPath(workspaceRoot);
4641
+ const resolveRollupWorkerOrThrow = () => {
4642
+ const invocation = resolveDefaultRollupWorkerPath();
4615
4643
  if (!invocation) {
4616
- throw index_cjs_js$6.createError('rollup worker could not be resolved. Build @hyperfrontend/builder at least once before invoking the bundle phase, or ensure @swc-node/register is installed for source-mode bootstrap.');
4644
+ throw index_cjs_js$6.createError('rollup worker could not be located beside the builder module. The @hyperfrontend/builder package appears incomplete, or @swc-node/register is missing for source-mode bootstrap.');
4617
4645
  }
4618
4646
  return invocation;
4619
4647
  };
4620
- const createLazyDispatchResolver = (workspaceRoot) => {
4648
+ const createLazyDispatchResolver = () => {
4621
4649
  let cached = null;
4622
4650
  return () => {
4623
4651
  if (!cached) {
4624
- const invocation = resolveRollupWorkerOrThrow(workspaceRoot);
4652
+ const invocation = resolveRollupWorkerOrThrow();
4625
4653
  cached = { workerPath: invocation.path, execArgv: invocation.execArgv };
4626
4654
  }
4627
4655
  return cached;
@@ -4715,7 +4743,7 @@ const runBundlePhase = async (context, config, monitor) => {
4715
4743
  const outputs = { esm: [], cjs: [], iife: [], umd: [] };
4716
4744
  const requestedPrePassFormats = collectFormatsRequestingPrePass(config);
4717
4745
  if (requestedPrePassFormats.length > 0 && (context.bundledDeps.length > 0 || context.workspaceBundledDeps.length > 0)) {
4718
- const invocation = resolvePrePassWorkerOrThrow(context.workspaceRoot);
4746
+ const invocation = resolvePrePassWorkerOrThrow();
4719
4747
  const npmJobs = buildJsPrePassJobs(context.bundledDeps, requestedPrePassFormats, context);
4720
4748
  const workspaceJobs = buildWorkspaceJsPrePassJobs(context.bundledDeps, requestedPrePassFormats, context);
4721
4749
  const jobs = [...npmJobs, ...workspaceJobs];
@@ -4724,7 +4752,7 @@ const runBundlePhase = async (context, config, monitor) => {
4724
4752
  await runPrePass(jobs, { workerPath: invocation.path, execArgv: invocation.execArgv, monitor });
4725
4753
  monitor?.check('bundle:dependencies:prepass:end');
4726
4754
  }
4727
- const resolveDispatch = createLazyDispatchResolver(context.workspaceRoot);
4755
+ const resolveDispatch = createLazyDispatchResolver();
4728
4756
  await runEsmFormats(config, context, outputs, resolveDispatch, monitor);
4729
4757
  await recover();
4730
4758
  monitor?.check('bundle:esm:end:post-recover');