@nimbus-sh/worker 0.12.0 → 0.13.0

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 (198) hide show
  1. package/dist/esbuild-cli-artifact.generated.d.ts +1 -1
  2. package/dist/esbuild-cli-artifact.generated.js +4 -4
  3. package/dist/esbuild-wasm-bundle.generated.d.ts +11 -10
  4. package/dist/esbuild-wasm-bundle.generated.d.ts.map +1 -1
  5. package/dist/esbuild-wasm-bundle.generated.js +11 -10
  6. package/dist/facets/build-facet.d.ts +53 -0
  7. package/dist/facets/build-facet.d.ts.map +1 -0
  8. package/dist/facets/build-facet.js +346 -0
  9. package/dist/facets/cirrus-real.d.ts +3 -0
  10. package/dist/facets/cirrus-real.d.ts.map +1 -1
  11. package/dist/facets/cirrus-real.js +1 -2
  12. package/dist/facets/compose.d.ts +1 -0
  13. package/dist/facets/compose.d.ts.map +1 -1
  14. package/dist/facets/compose.js +3 -0
  15. package/dist/facets/data-plan.d.ts +14 -30
  16. package/dist/facets/data-plan.d.ts.map +1 -1
  17. package/dist/facets/data-plan.js +153 -13
  18. package/dist/facets/dev-stylesheet.d.ts +27 -0
  19. package/dist/facets/dev-stylesheet.d.ts.map +1 -0
  20. package/dist/facets/dev-stylesheet.js +65 -0
  21. package/dist/facets/esbuild-transform.d.ts +23 -18
  22. package/dist/facets/esbuild-transform.d.ts.map +1 -1
  23. package/dist/facets/esbuild-transform.js +63 -109
  24. package/dist/facets/manager.d.ts +49 -9
  25. package/dist/facets/manager.d.ts.map +1 -1
  26. package/dist/facets/manager.js +238 -69
  27. package/dist/facets/oxc-transform.d.ts +29 -0
  28. package/dist/facets/oxc-transform.d.ts.map +1 -0
  29. package/dist/facets/oxc-transform.js +198 -0
  30. package/dist/facets/prebundle-pool.d.ts +23 -0
  31. package/dist/facets/prebundle-pool.d.ts.map +1 -0
  32. package/dist/facets/prebundle-pool.js +55 -0
  33. package/dist/facets/process.d.ts +13 -6
  34. package/dist/facets/process.d.ts.map +1 -1
  35. package/dist/facets/process.js +37 -31
  36. package/dist/facets/transform-store.d.ts +4 -4
  37. package/dist/facets/transform-store.js +4 -4
  38. package/dist/facets/vite-dev-server.d.ts +89 -12
  39. package/dist/facets/vite-dev-server.d.ts.map +1 -1
  40. package/dist/facets/vite-dev-server.js +66 -43
  41. package/dist/hosted/commands.d.ts.map +1 -1
  42. package/dist/hosted/commands.js +20 -4
  43. package/dist/hosted/runtime.d.ts.map +1 -1
  44. package/dist/hosted/runtime.js +7 -2
  45. package/dist/hosted/services.d.ts +3 -3
  46. package/dist/hosted/services.d.ts.map +1 -1
  47. package/dist/hosted/services.js +102 -95
  48. package/dist/hosted/session.d.ts +1 -0
  49. package/dist/hosted/session.d.ts.map +1 -1
  50. package/dist/loaders/generated-workers.d.ts +3 -0
  51. package/dist/loaders/generated-workers.d.ts.map +1 -1
  52. package/dist/loaders/generated-workers.js +3 -0
  53. package/dist/napi-wasm-artifacts.generated.js +2 -2
  54. package/dist/node-shims-artifact.generated.d.ts +14 -1
  55. package/dist/node-shims-artifact.generated.d.ts.map +1 -1
  56. package/dist/node-shims-artifact.generated.js +23 -10
  57. package/dist/npm/bin-links.d.ts +7 -4
  58. package/dist/npm/bin-links.d.ts.map +1 -1
  59. package/dist/npm/bin-links.js +14 -55
  60. package/dist/npm/cache.d.ts +6 -0
  61. package/dist/npm/cache.d.ts.map +1 -1
  62. package/dist/npm/cache.js +26 -4
  63. package/dist/npm/installer.d.ts +1 -1
  64. package/dist/npm/installer.d.ts.map +1 -1
  65. package/dist/npm/installer.js +26 -52
  66. package/dist/npm/pre-bundle-facet.d.ts +15 -117
  67. package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
  68. package/dist/npm/pre-bundle-facet.js +13 -511
  69. package/dist/oxc-facet-artifact.generated.d.ts +18 -0
  70. package/dist/oxc-facet-artifact.generated.d.ts.map +1 -0
  71. package/dist/oxc-facet-artifact.generated.js +17 -0
  72. package/dist/oxc-wasm-artifact.generated.d.ts +20 -0
  73. package/dist/oxc-wasm-artifact.generated.d.ts.map +1 -0
  74. package/dist/oxc-wasm-artifact.generated.js +19 -0
  75. package/dist/rolldown-facet-artifact.generated.d.ts +18 -0
  76. package/dist/rolldown-facet-artifact.generated.d.ts.map +1 -0
  77. package/dist/rolldown-facet-artifact.generated.js +17 -0
  78. package/dist/router/remote-api.d.ts.map +1 -1
  79. package/dist/router/remote-api.js +9 -0
  80. package/dist/runtime/bash-repl.d.ts.map +1 -1
  81. package/dist/runtime/bash-repl.js +1 -4
  82. package/dist/runtime/cpython-resident.d.ts.map +1 -1
  83. package/dist/runtime/cpython-resident.js +1 -0
  84. package/dist/runtime/esbuild-wasm-bytes.d.ts +25 -23
  85. package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -1
  86. package/dist/runtime/esbuild-wasm-bytes.js +30 -25
  87. package/dist/runtime/facet-loader-host.d.ts +5 -4
  88. package/dist/runtime/facet-loader-host.d.ts.map +1 -1
  89. package/dist/runtime/facet-loader-host.js +5 -4
  90. package/dist/runtime/node-runner.d.ts +2 -0
  91. package/dist/runtime/node-runner.d.ts.map +1 -1
  92. package/dist/runtime/node-runner.js +1 -0
  93. package/dist/runtime/node-shims-artifact.d.ts +8 -1
  94. package/dist/runtime/node-shims-artifact.d.ts.map +1 -1
  95. package/dist/runtime/node-shims-artifact.js +32 -4
  96. package/dist/runtime/node-shims.d.ts.map +1 -1
  97. package/dist/runtime/node-shims.js +145 -109
  98. package/dist/runtime/opencode-facet-runner.d.ts.map +1 -1
  99. package/dist/runtime/opencode-facet-runner.js +6 -2
  100. package/dist/runtime/oxc-wasm-bytes.d.ts +19 -0
  101. package/dist/runtime/oxc-wasm-bytes.d.ts.map +1 -0
  102. package/dist/runtime/oxc-wasm-bytes.js +39 -0
  103. package/dist/runtime/package-manager.js +1 -1
  104. package/dist/runtime/process-logs-api.d.ts.map +1 -1
  105. package/dist/runtime/process-logs-api.js +2 -0
  106. package/dist/runtime/project-fs.d.ts +8 -1
  107. package/dist/runtime/project-fs.d.ts.map +1 -1
  108. package/dist/runtime/project-fs.js +15 -1
  109. package/dist/runtime/python-repl.d.ts +40 -1
  110. package/dist/runtime/python-repl.d.ts.map +1 -1
  111. package/dist/runtime/python-repl.js +19 -11
  112. package/dist/runtime/ruby-repl.d.ts +38 -0
  113. package/dist/runtime/ruby-repl.d.ts.map +1 -1
  114. package/dist/runtime/ruby-repl.js +24 -5
  115. package/dist/runtime/ruby-resident.d.ts.map +1 -1
  116. package/dist/runtime/ruby-resident.js +2 -0
  117. package/dist/session/nimbus-session.d.ts +13 -8
  118. package/dist/session/nimbus-session.d.ts.map +1 -1
  119. package/dist/session/nimbus-session.js +11 -5
  120. package/dist/session/programmatic.d.ts +25 -30
  121. package/dist/session/programmatic.d.ts.map +1 -1
  122. package/dist/session/programmatic.js +65 -93
  123. package/dist/session/routes.d.ts.map +1 -1
  124. package/dist/session/routes.js +23 -7
  125. package/dist/session/rpc.d.ts +16 -6
  126. package/dist/session/rpc.d.ts.map +1 -1
  127. package/dist/session/rpc.js +53 -13
  128. package/dist/session/start-real-vite.d.ts +24 -9
  129. package/dist/session/start-real-vite.d.ts.map +1 -1
  130. package/dist/session/start-real-vite.js +40 -4
  131. package/dist/session/supervisor-op.d.ts +14 -0
  132. package/dist/session/supervisor-op.d.ts.map +1 -1
  133. package/dist/session/supervisor-op.js +49 -0
  134. package/dist/session/supervisor-rpc.d.ts +11 -0
  135. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  136. package/dist/session/supervisor-rpc.js +18 -0
  137. package/dist/session/vite-command.d.ts.map +1 -1
  138. package/dist/session/vite-command.js +23 -19
  139. package/dist/session/ws-relay.d.ts.map +1 -1
  140. package/dist/session/ws-relay.js +13 -1
  141. package/dist/shell/npm-bin-entrypoints.d.ts +3 -1
  142. package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
  143. package/dist/shell/npm-bin-entrypoints.js +53 -25
  144. package/dist/vfs/facet-resident-store.d.ts.map +1 -1
  145. package/dist/vfs/facet-resident-store.js +11 -5
  146. package/dist/wrangler/nimbus-wrangler.d.ts +8 -0
  147. package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -1
  148. package/dist/wrangler/nimbus-wrangler.js +54 -57
  149. package/package.json +6 -4
  150. package/public/_assets/esbuild-0.24.2.wasm +0 -0
  151. package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/napi-wasm-loader.mjs +4 -4
  152. package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/provenance.json +2 -2
  153. package/public/_assets/oxc/nimbus-oxc-1aa8c4c7057c6c28.provenance.json +72 -0
  154. package/public/_assets/oxc/nimbus-oxc-1aa8c4c7057c6c28.wasm +0 -0
  155. package/public/_assets/runtime/esbuild-cli-f13e6a112b03ac07.js +1143 -0
  156. package/public/_assets/runtime/js-interpreter-3c37c48024f0f651.js +23 -0
  157. package/public/_assets/runtime/js-interpreter-ops-2f4dfec6798e70fc.js +290 -0
  158. package/public/_assets/runtime/js-interpreter-primordials-e620a61b7e9800fa.js +1 -0
  159. package/public/_assets/runtime/{node-shims-f92f16c7d7c532e9.js → node-shims-e3adc4576da31e6e.js} +651 -103
  160. package/public/_assets/runtime/{esbuild-cli-b7aecffd4c6a36fe.js → oxc-facet-fd86fefcdf16bf9c.js} +217 -1047
  161. package/public/_assets/runtime/{resident-store-92386265e8b306dc.js → resident-store-009f39539ac989fc.js} +11 -5
  162. package/public/_assets/runtime/rolldown-facet-09983434e2dbe93e.js +15165 -0
  163. package/public/_assets/runtime/{vfs-write-ledger-d33ee0034446c3e0.js → vfs-write-ledger-9e9594591425a9b8.js} +4 -1
  164. package/scripts/acorn-primordials.mjs +637 -0
  165. package/scripts/bundle-esbuild-wasm.mjs +42 -50
  166. package/scripts/bundle-facet-workers.mjs +247 -18
  167. package/scripts/bundle-node-shims.mjs +29 -2
  168. package/scripts/bundle-oxc-wasm.mjs +105 -0
  169. package/scripts/interpreter-bundle.mjs +105 -0
  170. package/scripts/napi-wasm/build.mjs +4 -1
  171. package/scripts/napi-wasm/loader/napi-wasm-loader.ts +38 -3
  172. package/scripts/oxc-wasm/Cargo.lock +1246 -0
  173. package/scripts/oxc-wasm/Cargo.toml +30 -0
  174. package/scripts/oxc-wasm/build.mjs +249 -0
  175. package/scripts/oxc-wasm/examples/memory.rs +51 -0
  176. package/scripts/oxc-wasm/examples/transform.rs +20 -0
  177. package/scripts/oxc-wasm/inputs.mjs +32 -0
  178. package/scripts/oxc-wasm/rust-toolchain.toml +5 -0
  179. package/scripts/oxc-wasm/src/abi.rs +136 -0
  180. package/scripts/oxc-wasm/src/diagnostics.rs +49 -0
  181. package/scripts/oxc-wasm/src/helpers.rs +139 -0
  182. package/scripts/oxc-wasm/src/lib.rs +247 -0
  183. package/scripts/oxc-wasm/src/module.rs +978 -0
  184. package/scripts/oxc-wasm/src/names.rs +175 -0
  185. package/scripts/oxc-wasm/src/options.rs +154 -0
  186. package/scripts/parser-audit.mjs +492 -0
  187. package/scripts/rolldown-facet/entry.mjs +21 -0
  188. package/scripts/rolldown-facet/shims.mjs +64 -0
  189. package/dist/facets/esbuild-bundle-pool.d.ts +0 -43
  190. package/dist/facets/esbuild-bundle-pool.d.ts.map +0 -1
  191. package/dist/facets/esbuild-bundle-pool.js +0 -80
  192. package/dist/loaders/pre-bundle-preamble.d.ts +0 -44
  193. package/dist/loaders/pre-bundle-preamble.d.ts.map +0 -1
  194. package/dist/loaders/pre-bundle-preamble.js +0 -116
  195. package/dist/runtime/host-wasm.d.ts +0 -8
  196. package/dist/runtime/host-wasm.d.ts.map +0 -1
  197. package/dist/runtime/host-wasm.js +0 -33
  198. /package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/wasi-trampoline.wasm +0 -0
@@ -901,7 +901,7 @@ const __fsMod = (() => {
901
901
  const real = __nsResolve(own && own.alias !== undefined ? own.alias : k, true);
902
902
  if (real && real !== "ELOOP") {
903
903
  for (const child of __nsChildren(real.path)) {
904
- names.set(child.name, child.kind === 1 ? "directory" : child.kind === 2 ? "symlink" : "file");
904
+ names.set(child.name, child.kind === 1 ? "directory" : child.kind === 2 ? "symlink" : _direntTypeOfMode(child.mode, "file"));
905
905
  }
906
906
  }
907
907
  }
@@ -976,8 +976,9 @@ const __fsMod = (() => {
976
976
  function _noteCreation(k) {
977
977
  if (_createdHere.has(k)) return;
978
978
  const absPath = "/" + k;
979
- // Known absent: the namespace names everything this credential can see.
980
- if (_statLadder(absPath) !== undefined) return;
979
+ // Known absent: the namespace names everything this credential can see,
980
+ // except on a mount where the launch did not list it, which is unknown.
981
+ if (_statLadder(absPath) !== undefined || _nsUnlisted(absPath, true, false) !== null) return;
981
982
  _createdHere.add(k);
982
983
  }
983
984
  function _forgetCreation(k) {
@@ -2613,24 +2614,37 @@ const __fsMod = (() => {
2613
2614
  return stat;
2614
2615
  }
2615
2616
 
2617
+ // Each exact dirent type's S_IFMT bits and Node predicate (core's vfs/dirent-type.ts).
2618
+ const _direntTypes = {"file":{"format":32768,"node":"isFile"},"directory":{"format":16384,"node":"isDirectory"},"symlink":{"format":40960,"node":"isSymbolicLink"},"character":{"format":8192,"node":"isCharacterDevice"},"block":{"format":24576,"node":"isBlockDevice"},"fifo":{"format":4096,"node":"isFIFO"},"socket":{"format":49152,"node":"isSocket"}};
2619
+ /** The dirent type a mode's format bits name, or `fallback` where they name none. */
2620
+ function _direntTypeOfMode(mode, fallback) {
2621
+ const format = Number(mode) & 0o170000;
2622
+ for (const type in _direntTypes) if (_direntTypes[type].format === format) return type;
2623
+ return fallback;
2624
+ }
2625
+ /** The dirent type an lstat says, for an entry the listing could not type ('unknown'). */
2626
+ function _direntTypeOfStats(st) {
2627
+ return _direntTypeOfMode(st.mode, st.isDirectory() ? "directory" : st.isSymbolicLink() ? "symlink" : "file");
2628
+ }
2629
+
2616
2630
  // The one Dirent shape: readdir({ withFileTypes }) sync and async, and
2617
- // every Dir.read(). `parentPath` is Node's field; `path` its deprecated
2631
+ // every Dir.read(), for an entry whose type is known (an 'unknown' one is
2632
+ // lstat'ed first). `parentPath` is Node's field; `path` its deprecated
2618
2633
  // alias that older callers still read.
2619
2634
  class __Dirent {
2620
2635
  constructor(name, type, parentPath) {
2621
2636
  this.name = name;
2622
2637
  this.parentPath = parentPath === undefined ? "" : String(parentPath);
2623
2638
  this.path = this.parentPath;
2624
- this._isDir = type === "directory" || type === "dir";
2625
- this._isSymlink = type === "symlink";
2639
+ this._holds = _direntTypes[type === "dir" ? "directory" : type]?.node;
2626
2640
  }
2627
- isFile() { return !this._isDir && !this._isSymlink; }
2628
- isDirectory() { return this._isDir; }
2629
- isSymbolicLink() { return this._isSymlink; }
2630
- isBlockDevice() { return false; }
2631
- isCharacterDevice() { return false; }
2632
- isFIFO() { return false; }
2633
- isSocket() { return false; }
2641
+ isFile() { return this._holds === "isFile"; }
2642
+ isDirectory() { return this._holds === "isDirectory"; }
2643
+ isSymbolicLink() { return this._holds === "isSymbolicLink"; }
2644
+ isBlockDevice() { return this._holds === "isBlockDevice"; }
2645
+ isCharacterDevice() { return this._holds === "isCharacterDevice"; }
2646
+ isFIFO() { return this._holds === "isFIFO"; }
2647
+ isSocket() { return this._holds === "isSocket"; }
2634
2648
  }
2635
2649
  function _direntObject(name, type, parentPath) { return new __Dirent(name, type, parentPath); }
2636
2650
 
@@ -3033,8 +3047,11 @@ const __fsMod = (() => {
3033
3047
  // listing does not. So it is asked for, never assumed (one lstat per
3034
3048
  // child directory, concurrently).
3035
3049
  if (opts?.withFileTypes) {
3050
+ const base = absPath === "/" ? "" : absPath;
3051
+ const types = await Promise.all(entries.map(async (entry) =>
3052
+ entry.type === "unknown" ? _direntTypeOfStats(await _lstatAsync(base + "/" + entry.name)) : entry.type));
3036
3053
  return entries
3037
- .map((entry) => _direntObject(entry.name, entry.type, absPath))
3054
+ .map((entry, i) => _direntObject(entry.name, types[i], absPath))
3038
3055
  .sort((a, b) => a.name.localeCompare(b.name));
3039
3056
  }
3040
3057
  return entries.map((entry) => entry.name).sort();
@@ -3080,8 +3097,12 @@ const __fsMod = (() => {
3080
3097
 
3081
3098
  async function _writeFileAsync(p, data, opts) {
3082
3099
  const absPath = _resolveFollow(p, "open");
3083
- writeFileSync(p, data, opts);
3084
3100
  const supervisor = _supervisor();
3101
+ // A target this view cannot judge (on a mount, where the launch did not
3102
+ // list it) is the authority's to answer for, as the async rename's
3103
+ // destination is: parked and written back like any other write, and
3104
+ // refused (and the parked bytes dropped) if the authority refuses it.
3105
+ _parkWholeWrite(p, data, supervisor && typeof supervisor.writeFile === "function");
3085
3106
  if (supervisor && typeof supervisor.writeFile === "function") {
3086
3107
  await _announceLocalDirs(absPath, supervisor);
3087
3108
  // The revision comes back so the ledger can stamp the cell: an async
@@ -3502,8 +3523,17 @@ const __fsMod = (() => {
3502
3523
  // (the hot path for source code / package.json / user JS).
3503
3524
  // Anything else is stringified (Node's behaviour for e.g. numbers).
3504
3525
  function writeFileSync(p, data, opts) {
3526
+ _parkWholeWrite(p, data, false);
3527
+ }
3528
+
3529
+ /**
3530
+ * A whole-file write's local effect: the bytes parked for write-back.
3531
+ * `live`: the async form, whose write-back the authority answers for a
3532
+ * target this view cannot judge (_ensureWritable).
3533
+ */
3534
+ function _parkWholeWrite(p, data, live) {
3505
3535
  const absPath = _resolveFollow(p, "open");
3506
- _ensureWritable(absPath, "open", p);
3536
+ _ensureWritable(absPath, "open", p, live);
3507
3537
  const k = _strip(absPath);
3508
3538
  let cell;
3509
3539
  if (data instanceof Uint8Array) cell = data;
@@ -7627,31 +7657,20 @@ const __cryptoMod = (() => {
7627
7657
  // execution does not. Documented in W3 retro for W3.5 follow-up
7628
7658
  // (a parser-based vm fallback, or pre-bundle vm-using scripts at
7629
7659
  // install time).
7630
- // ── Runtime code: the async and generator Function constructors ──
7660
+ // ── Runtime code: the Function constructors ──
7631
7661
  //
7632
7662
  // A Worker generates code from strings only while its modules evaluate: at
7633
7663
  // request time — where every program runs — `new Function(...)` and its async
7634
7664
  // and generator siblings throw EvalError "Code generation from strings
7635
- // disallowed for this context". The async and generator constructors here ask
7636
- // the native one first and, refused that way, hand the arguments to the
7637
- // launch's runtime-code service (core/_shared/commonjs-cell.ts, RUNTIME CODE),
7638
- // which answers from this launch's module map or records the text for the next
7639
- // launch of the command and throws EvalError code ERR_NIMBUS_CODE_NEXT_LAUNCH.
7640
- // That is the constructor a module runner evaluates with (Vite's SSR runner:
7641
- // `new AsyncFunction(...)`), reached as each kind's `prototype.constructor`,
7642
- // which is how `(async function () {}).constructor` finds it. A facet without
7643
- // the service (opencode's) keeps the native refusal.
7644
- //
7645
- // The plain `Function` constructor is routed differently, on evidence: code
7646
- // probes it once and keeps the answer. TypeBox's CanEvaluate (pi 0.87.1) tries
7647
- // `Function("null")`, remembers whether it worked, and then compiles every
7648
- // schema check with `Function`; staging every text, the next launch staged the
7649
- // probe's text but not the checks' — the probe said yes, the first check threw,
7650
- // and pi's TUI died. So it answers only text an earlier launch staged, keeps
7651
- // the native refusal otherwise, and stages a refused text only when a failed
7652
- // launch is attributable to it (the service's plainFunction, noteFailure and
7653
- // stageFailedLaunch): a probe answers the same in every launch, while depd's
7654
- // wrapper (express 4) and ajv's validators (serve) run from the next launch on.
7665
+ // disallowed for this context". Each constructor here asks the native one
7666
+ // first and, refused that way, hands the arguments to the launch's
7667
+ // runtime-code service (core/_shared/commonjs-cell.ts, RUNTIME CODE), which
7668
+ // answers from this launch's module map when an earlier launch staged the
7669
+ // text, and otherwise records it for the next launch and runs it in the
7670
+ // interpreter. That is the constructor a module runner evaluates with
7671
+ // (Vite's SSR runner: `new AsyncFunction(...)`), reached as each kind's
7672
+ // `prototype.constructor`, which is how `(async function () {}).constructor`
7673
+ // finds it. A facet without the service (opencode's) keeps the native refusal.
7655
7674
  function __nimbusIsCodegenRefusal(e) {
7656
7675
  return e instanceof EvalError && /Code generation from strings disallowed/.test(String(e.message));
7657
7676
  }
@@ -7772,15 +7791,20 @@ const __nimbusDecodeStringLiteral = function decodeJavaScriptStringLiteral(sourc
7772
7791
  if (Native.__nimbusNative) continue;
7773
7792
  const routed = function (...args) {
7774
7793
  try {
7775
- return Reflect.apply(Native, undefined, args);
7794
+ return new.target === undefined ? Reflect.apply(Native, undefined, args) : Reflect.construct(Native, args, new.target);
7776
7795
  } catch (e) {
7777
7796
  const service = globalThis.__nimbusRuntimeCode;
7778
7797
  if (!__nimbusIsCodegenRefusal(e) || !service) throw e;
7779
7798
  const params = args.slice(0, -1).map(String);
7780
7799
  const body = args.length > 0 ? String(args[args.length - 1]) : "";
7781
- if (kind === "function") return service.plainFunction(params, body, e);
7782
7800
  try {
7783
- return service.compileFunction(kind, params, body);
7801
+ const fn = service.compileFunction(kind, params, body);
7802
+ // A subclass's `new` (`class F extends Function`) makes an instance of the subclass.
7803
+ if (new.target !== undefined && new.target !== routed) {
7804
+ const proto = new.target.prototype;
7805
+ if (proto !== null && (typeof proto === "object" || typeof proto === "function")) Object.setPrototypeOf(fn, proto);
7806
+ }
7807
+ return fn;
7784
7808
  } catch (refusal) {
7785
7809
  const importAt = params.indexOf("__vite_ssr_import__");
7786
7810
  if (kind !== "async" || importAt < 0 || !refusal || refusal.code !== "ERR_NIMBUS_CODE_NEXT_LAUNCH") throw refusal;
@@ -7813,6 +7837,11 @@ const __nimbusDecodeStringLiteral = function decodeJavaScriptStringLiteral(sourc
7813
7837
 
7814
7838
  const __vmMod = (() => {
7815
7839
  const real = (typeof __real_vm !== 'undefined') ? (__real_vm.default ?? __real_vm) : null;
7840
+ // What a script's function is called with, as the launch starts: the
7841
+ // program may later replace Reflect.apply or the globalThis property, and
7842
+ // native vm consults neither.
7843
+ const apply = Reflect.apply;
7844
+ const scriptThis = globalThis;
7816
7845
  function honestError(method, originalErr) {
7817
7846
  const e = new Error(
7818
7847
  'vm.' + method + ': workerd does not implement runtime eval. ' +
@@ -7849,12 +7878,16 @@ const __vmMod = (() => {
7849
7878
  isContext: real?.isContext ?? ((o) => !!o),
7850
7879
  runInContext: wrapRuntimeEval('runInContext'),
7851
7880
  runInNewContext: wrapRuntimeEval('runInNewContext'),
7852
- // jiti evaluates a parenthesized (async) CommonJS wrapper expression.
7853
- // Stage that expression as a zero-argument function returning its value;
7854
- // the wrapper itself executes only when the caller invokes it. This is
7855
- // not a vm context or a global-script evaluator: declarations/completion
7856
- // values spanning statements, execution deadlines and context mutation
7857
- // have no equivalent here and remain unsupported.
7881
+ // jiti evaluates a parenthesized (async) CommonJS wrapper expression
7882
+ // statement, `(function (exports, require, ...) { ... });`. The service
7883
+ // stages a script that is one expression as a zero-argument function
7884
+ // returning its value (the script's completion value); the wrapper
7885
+ // itself executes only when the caller invokes it. The function is
7886
+ // called with the global object as `this`, which is a script's
7887
+ // `this` at its top level, strict or not. This is not a vm
7888
+ // context or a global-script evaluator: declarations/completion values
7889
+ // spanning statements, execution deadlines and context mutation have no
7890
+ // equivalent here and remain unsupported.
7858
7891
  runInThisContext: (code, options = {}) => {
7859
7892
  try { return wrapRuntimeEval('runInThisContext')(code, options); }
7860
7893
  catch (e) {
@@ -7862,7 +7895,7 @@ const __vmMod = (() => {
7862
7895
  if (e?.code !== 'ERR_VM_DYNAMIC_EVAL_DISALLOWED' || !service
7863
7896
  || options?.timeout !== undefined || options?.breakOnSigint
7864
7897
  || options?.importModuleDynamically || options?.cachedData) throw e;
7865
- return service.compileFunction("function", [], "return (\n" + String(code) + "\n);")();
7898
+ return apply(service.compileExpression(String(code)), scriptThis, []);
7866
7899
  }
7867
7900
  },
7868
7901
  // A function of `params` and `code` is what the Function constructor
@@ -7888,45 +7921,540 @@ const __vmMod = (() => {
7888
7921
  })();
7889
7922
 
7890
7923
  // ═══════════════════════════════════════════════════════════════════════
7891
- // ── http2 module (W3: stub — non-throwing load, honest connect err) ─
7924
+ // ── http2 module: Node's exports, no HTTP/2 transport ──────────────
7892
7925
  // ═══════════════════════════════════════════════════════════════════════
7893
7926
  //
7894
7927
  // axios's dist/node code does `var http2 = require('http2')` at top
7895
- // level, unconditionally. Without this stub the require fails →
7896
- // axios fails to load. The actual HTTP/2 transport is only invoked
7897
- // when user opts in (`httpVersion: 2`); otherwise this shim is dormant.
7898
- const __http2Mod = (() => {
7899
- function _err(op) {
7900
- const e = new Error('http2.' + op + ': not implemented in Nimbus. Use fetch() or HTTP/1.1.');
7901
- e.code = 'ERR_HTTP2_NOT_SUPPORTED';
7902
- return e;
7928
+ // level, unconditionally, and Astro's dev server asks
7929
+ // `res instanceof Http2ServerResponse` of every response: the module
7930
+ // loads with every name Node's has, and only opening HTTP/2 refuses.
7931
+ // core/_shared/http2-module.ts, compiled once by
7932
+ // scripts/bundle-facet-workers.mjs, declares createHttp2Module; the
7933
+ // substrate's node-compat imports the same function.
7934
+ function createHttp2Module(host) {
7935
+ const nodeError = (Base, code, message, props = {}) => Object.assign(new Base(message), { code }, props);
7936
+ const notSupported = (op) => nodeError(Error, "ERR_HTTP2_NOT_SUPPORTED", `http2.${op}: not implemented in Nimbus. Use fetch() or HTTP/1.1.`);
7937
+ const describe = (value) => {
7938
+ if (value === null) return "null";
7939
+ if (value === void 0) return "undefined";
7940
+ switch (typeof value) {
7941
+ case "bigint":
7942
+ return `type bigint (${value}n)`;
7943
+ case "number":
7944
+ if (Object.is(value, -0)) return "type number (-0)";
7945
+ return `type number (${value})`;
7946
+ case "boolean":
7947
+ return `type boolean (${value})`;
7948
+ case "symbol":
7949
+ return `type symbol (${String(value)})`;
7950
+ case "function":
7951
+ return `function ${value.name}`;
7952
+ case "string": {
7953
+ const shown = value.length > 28 ? `${value.slice(0, 25)}...` : value;
7954
+ return shown.includes("'") ? `type string (${JSON.stringify(shown)})` : `type string ('${shown}')`;
7955
+ }
7956
+ default: {
7957
+ const ctor = Reflect.get(Object(value), "constructor");
7958
+ return typeof ctor === "function" && ctor.name ? `an instance of ${ctor.name}` : String(value);
7959
+ }
7960
+ }
7961
+ };
7962
+ const invalidArgType = (name, expected, value) => nodeError(TypeError, "ERR_INVALID_ARG_TYPE", `The "${name}" argument must be ${expected}. Received ${describe(value)}`);
7963
+ const invalidSetting = (Base, name, actual, min, max) => nodeError(
7964
+ Base,
7965
+ "ERR_HTTP2_INVALID_SETTING_VALUE",
7966
+ `Invalid value for setting "${name}": ${String(actual)}`,
7967
+ min === void 0 ? { actual } : { actual, min, max }
7968
+ );
7969
+ const MAX_INT = 2 ** 32 - 1;
7970
+ const MAX_ADDITIONAL_SETTINGS = 10;
7971
+ const HEADER_TABLE_SIZE = 1;
7972
+ const ENABLE_PUSH = 2;
7973
+ const MAX_CONCURRENT_STREAMS = 3;
7974
+ const INITIAL_WINDOW_SIZE = 4;
7975
+ const MAX_FRAME_SIZE = 5;
7976
+ const MAX_HEADER_LIST_SIZE = 6;
7977
+ const ENABLE_CONNECT_PROTOCOL = 8;
7978
+ const NO_RFC7540_PRIORITIES = 9;
7979
+ const isObjectArg = (value) => value === void 0 || value !== null && typeof value === "object" && !Array.isArray(value);
7980
+ const withinRange = (name, value, min, max) => {
7981
+ if (value !== void 0 && (typeof value !== "number" || value < min || value > max)) {
7982
+ throw invalidSetting(RangeError, name, value, min, max);
7983
+ }
7984
+ };
7985
+ const validate = (settings) => {
7986
+ if (settings === void 0) return;
7987
+ if (!isObjectArg(settings.customSettings)) throw invalidArgType("customSettings", "an instance of Number", settings.customSettings);
7988
+ if (settings.customSettings) {
7989
+ const entries = Object.entries(settings.customSettings);
7990
+ if (entries.length > MAX_ADDITIONAL_SETTINGS) {
7991
+ throw nodeError(Error, "ERR_HTTP2_TOO_MANY_CUSTOM_SETTINGS", "Number of custom settings exceeds MAX_ADDITIONAL_SETTINGS");
7992
+ }
7993
+ for (const [key, value] of entries) {
7994
+ withinRange("customSettings:id", Number(key), 0, 65535);
7995
+ withinRange("customSettings:value", Number(value), 0, MAX_INT);
7996
+ }
7997
+ }
7998
+ withinRange("headerTableSize", settings.headerTableSize, 0, MAX_INT);
7999
+ withinRange("initialWindowSize", settings.initialWindowSize, 0, 2 ** 31 - 1);
8000
+ withinRange("maxFrameSize", settings.maxFrameSize, 16384, 2 ** 24 - 1);
8001
+ withinRange("maxConcurrentStreams", settings.maxConcurrentStreams, 0, MAX_INT);
8002
+ withinRange("maxHeaderListSize", settings.maxHeaderListSize, 0, MAX_INT);
8003
+ withinRange("maxHeaderSize", settings.maxHeaderSize, 0, MAX_INT);
8004
+ for (const name of ["enablePush", "enableConnectProtocol"]) {
8005
+ const value = settings[name];
8006
+ if (value !== void 0 && typeof value !== "boolean") throw invalidSetting(TypeError, name, value);
8007
+ }
8008
+ };
8009
+ function getDefaultSettings() {
8010
+ const settings = Object.create(null);
8011
+ settings.headerTableSize = 4096;
8012
+ settings.enablePush = true;
8013
+ settings.initialWindowSize = 65535;
8014
+ settings.maxFrameSize = 16384;
8015
+ settings.maxConcurrentStreams = MAX_INT;
8016
+ settings.maxHeaderListSize = settings.maxHeaderSize = 65535;
8017
+ settings.enableConnectProtocol = false;
8018
+ return settings;
8019
+ }
8020
+ function getPackedSettings(settings) {
8021
+ if (!isObjectArg(settings)) throw invalidArgType("settings", "of type object", settings);
8022
+ validate(settings);
8023
+ const given = { ...settings };
8024
+ const slots = [
8025
+ "headerTableSize",
8026
+ "enablePush",
8027
+ "initialWindowSize",
8028
+ "maxFrameSize",
8029
+ "maxConcurrentStreams",
8030
+ "maxHeaderListSize",
8031
+ "enableConnectProtocol"
8032
+ ];
8033
+ const known = new Map();
8034
+ const custom = new Map();
8035
+ if (typeof given.customSettings === "object") {
8036
+ for (const key in given.customSettings) {
8037
+ const value = given.customSettings[key];
8038
+ if (typeof value !== "number") continue;
8039
+ const id = Number(key);
8040
+ if (Number.isNaN(id) || id <= 0 || id > 65535) throw invalidSetting(RangeError, "Range Error", id, 0, 65535);
8041
+ if (Number.isNaN(value) || value <= 0 || value > 4294967295) throw invalidSetting(RangeError, "Range Error", value, 0, 4294967295);
8042
+ if (id < slots.length) known.set(slots[id], value);
8043
+ else {
8044
+ if (!custom.has(id) && custom.size === MAX_ADDITIONAL_SETTINGS) {
8045
+ throw nodeError(Error, "ERR_HTTP2_TOO_MANY_CUSTOM_SETTINGS", "Number of custom settings exceeds MAX_ADDITIONAL_SETTINGS");
8046
+ }
8047
+ custom.set(id, value);
8048
+ }
8049
+ }
8050
+ }
8051
+ for (const name of ["headerTableSize", "maxConcurrentStreams", "initialWindowSize", "maxFrameSize"]) {
8052
+ const value = given[name];
8053
+ if (typeof value === "number") known.set(name, value);
8054
+ }
8055
+ if (typeof given.maxHeaderListSize === "number" || typeof given.maxHeaderSize === "number") {
8056
+ if (given.maxHeaderSize !== void 0 && given.maxHeaderSize !== given.maxHeaderListSize) {
8057
+ host.emitWarning?.("settings.maxHeaderSize overwrite settings.maxHeaderListSize");
8058
+ known.set("maxHeaderListSize", Number(given.maxHeaderSize));
8059
+ } else {
8060
+ known.set("maxHeaderListSize", Number(given.maxHeaderListSize));
8061
+ }
8062
+ }
8063
+ for (const name of ["enablePush", "enableConnectProtocol"]) {
8064
+ const value = given[name];
8065
+ if (typeof value === "boolean") known.set(name, Number(value));
8066
+ }
8067
+ const ids = {
8068
+ headerTableSize: HEADER_TABLE_SIZE,
8069
+ enablePush: ENABLE_PUSH,
8070
+ maxConcurrentStreams: MAX_CONCURRENT_STREAMS,
8071
+ initialWindowSize: INITIAL_WINDOW_SIZE,
8072
+ maxFrameSize: MAX_FRAME_SIZE,
8073
+ maxHeaderListSize: MAX_HEADER_LIST_SIZE,
8074
+ enableConnectProtocol: ENABLE_CONNECT_PROTOCOL
8075
+ };
8076
+ const entries = [];
8077
+ for (const name of [
8078
+ "headerTableSize",
8079
+ "enablePush",
8080
+ "maxConcurrentStreams",
8081
+ "initialWindowSize",
8082
+ "maxFrameSize",
8083
+ "maxHeaderListSize",
8084
+ "enableConnectProtocol"
8085
+ ]) {
8086
+ const value = known.get(name);
8087
+ if (value !== void 0) entries.push([ids[name], value >>> 0]);
8088
+ }
8089
+ for (const [id, value] of custom) entries.push([id, value >>> 0]);
8090
+ for (const [id, value] of entries) {
8091
+ if ((id === ENABLE_PUSH || id === ENABLE_CONNECT_PROTOCOL || id === NO_RFC7540_PRIORITIES) && value > 1) return void 0;
8092
+ if (id === INITIAL_WINDOW_SIZE && value > 2 ** 31 - 1) return void 0;
8093
+ if (id === MAX_FRAME_SIZE && (value < 16384 || value > 2 ** 24 - 1)) return void 0;
8094
+ }
8095
+ const out = host.Buffer.alloc(entries.length * 6);
8096
+ const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
8097
+ entries.forEach(([id, value], i) => {
8098
+ view.setUint16(i * 6, id);
8099
+ view.setUint32(i * 6 + 2, value);
8100
+ });
8101
+ return out;
7903
8102
  }
7904
- class Http2Session extends __eventsMod {
7905
- constructor() { super(); this.destroyed = false; }
7906
- request() { throw _err('request'); }
7907
- close() { this.destroyed = true; this.emit('close'); }
7908
- destroy(err) { this.destroyed = true; if (err) this.emit('error', err); this.emit('close'); }
7909
- settings() {}
8103
+ function getUnpackedSettings(buf, options = {}) {
8104
+ if (!ArrayBuffer.isView(buf) || Reflect.get(buf, "length") === void 0) {
8105
+ throw invalidArgType("buf", "an instance of Buffer or TypedArray", buf);
8106
+ }
8107
+ if (buf.length % 6 !== 0) {
8108
+ throw nodeError(RangeError, "ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH", "Packed settings length must be a multiple of six");
8109
+ }
8110
+ const settings = {};
8111
+ for (let offset = 0; offset < buf.length; offset += 6) {
8112
+ const id = buf[offset] * 2 ** 8 + buf[offset + 1];
8113
+ const value = buf[offset + 2] * 2 ** 24 + buf[offset + 3] * 2 ** 16 + buf[offset + 4] * 2 ** 8 + buf[offset + 5];
8114
+ switch (id) {
8115
+ case HEADER_TABLE_SIZE:
8116
+ settings.headerTableSize = value;
8117
+ break;
8118
+ case ENABLE_PUSH:
8119
+ settings.enablePush = value !== 0;
8120
+ break;
8121
+ case MAX_CONCURRENT_STREAMS:
8122
+ settings.maxConcurrentStreams = value;
8123
+ break;
8124
+ case INITIAL_WINDOW_SIZE:
8125
+ settings.initialWindowSize = value;
8126
+ break;
8127
+ case MAX_FRAME_SIZE:
8128
+ settings.maxFrameSize = value;
8129
+ break;
8130
+ case MAX_HEADER_LIST_SIZE:
8131
+ settings.maxHeaderListSize = settings.maxHeaderSize = value;
8132
+ break;
8133
+ case ENABLE_CONNECT_PROTOCOL:
8134
+ settings.enableConnectProtocol = value !== 0;
8135
+ break;
8136
+ default:
8137
+ (settings.customSettings ??= {})[id] = value;
8138
+ }
8139
+ }
8140
+ if (options != null && options.validate) validate(settings);
8141
+ return settings;
8142
+ }
8143
+ class ClientHttp2Session extends host.EventEmitter {
8144
+ destroyed = false;
8145
+ closed = false;
8146
+ constructor() {
8147
+ super();
8148
+ queueMicrotask(() => this.emit("error", notSupported("connect")));
8149
+ }
8150
+ request() {
8151
+ throw notSupported("request");
8152
+ }
8153
+ settings() {
8154
+ }
8155
+ close(callback) {
8156
+ this.closed = true;
8157
+ queueMicrotask(() => {
8158
+ this.emit("close");
8159
+ callback?.();
8160
+ });
8161
+ }
8162
+ destroy(error) {
8163
+ this.destroyed = true;
8164
+ if (error) this.emit("error", error);
8165
+ this.emit("close");
8166
+ }
8167
+ }
8168
+ function connect(_authority, _options, _listener) {
8169
+ return new ClientHttp2Session();
8170
+ }
8171
+ function createServer(_options, _onRequestHandler) {
8172
+ throw notSupported("createServer");
7910
8173
  }
7911
- function connect(/* authority, opts, listener */) {
7912
- const session = new Http2Session();
7913
- queueMicrotask(() => session.emit('error', _err('connect')));
7914
- return session;
8174
+ function createSecureServer(_options, _onRequestHandler) {
8175
+ throw notSupported("createSecureServer");
7915
8176
  }
7916
- function createServer() { throw _err('createServer'); }
8177
+ function performServerHandshake(_socket, _options = {}) {
8178
+ throw notSupported("performServerHandshake");
8179
+ }
8180
+ class Http2ServerRequest extends host.Readable {
8181
+ constructor(_stream, _headers, _options, _rawHeaders) {
8182
+ super();
8183
+ throw notSupported("Http2ServerRequest");
8184
+ }
8185
+ }
8186
+ class Http2ServerResponse extends host.Stream {
8187
+ constructor(_stream, _options) {
8188
+ super();
8189
+ throw notSupported("Http2ServerResponse");
8190
+ }
8191
+ }
8192
+ const constants = {
8193
+ NGHTTP2_ERR_FRAME_SIZE_ERROR: -522,
8194
+ NGHTTP2_SESSION_SERVER: 0,
8195
+ NGHTTP2_SESSION_CLIENT: 1,
8196
+ NGHTTP2_STREAM_STATE_IDLE: 1,
8197
+ NGHTTP2_STREAM_STATE_OPEN: 2,
8198
+ NGHTTP2_STREAM_STATE_RESERVED_LOCAL: 3,
8199
+ NGHTTP2_STREAM_STATE_RESERVED_REMOTE: 4,
8200
+ NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: 5,
8201
+ NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: 6,
8202
+ NGHTTP2_STREAM_STATE_CLOSED: 7,
8203
+ NGHTTP2_FLAG_NONE: 0,
8204
+ NGHTTP2_FLAG_END_STREAM: 1,
8205
+ NGHTTP2_FLAG_END_HEADERS: 4,
8206
+ NGHTTP2_FLAG_ACK: 1,
8207
+ NGHTTP2_FLAG_PADDED: 8,
8208
+ NGHTTP2_FLAG_PRIORITY: 32,
8209
+ DEFAULT_SETTINGS_HEADER_TABLE_SIZE: 4096,
8210
+ DEFAULT_SETTINGS_ENABLE_PUSH: 1,
8211
+ DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS: 4294967295,
8212
+ DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: 65535,
8213
+ DEFAULT_SETTINGS_MAX_FRAME_SIZE: 16384,
8214
+ DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE: 65535,
8215
+ DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL: 0,
8216
+ MAX_MAX_FRAME_SIZE: 16777215,
8217
+ MIN_MAX_FRAME_SIZE: 16384,
8218
+ MAX_INITIAL_WINDOW_SIZE: 2147483647,
8219
+ NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: 1,
8220
+ NGHTTP2_SETTINGS_ENABLE_PUSH: 2,
8221
+ NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: 3,
8222
+ NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: 4,
8223
+ NGHTTP2_SETTINGS_MAX_FRAME_SIZE: 5,
8224
+ NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: 6,
8225
+ NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: 8,
8226
+ PADDING_STRATEGY_NONE: 0,
8227
+ PADDING_STRATEGY_ALIGNED: 1,
8228
+ PADDING_STRATEGY_MAX: 2,
8229
+ PADDING_STRATEGY_CALLBACK: 1,
8230
+ NGHTTP2_NO_ERROR: 0,
8231
+ NGHTTP2_PROTOCOL_ERROR: 1,
8232
+ NGHTTP2_INTERNAL_ERROR: 2,
8233
+ NGHTTP2_FLOW_CONTROL_ERROR: 3,
8234
+ NGHTTP2_SETTINGS_TIMEOUT: 4,
8235
+ NGHTTP2_STREAM_CLOSED: 5,
8236
+ NGHTTP2_FRAME_SIZE_ERROR: 6,
8237
+ NGHTTP2_REFUSED_STREAM: 7,
8238
+ NGHTTP2_CANCEL: 8,
8239
+ NGHTTP2_COMPRESSION_ERROR: 9,
8240
+ NGHTTP2_CONNECT_ERROR: 10,
8241
+ NGHTTP2_ENHANCE_YOUR_CALM: 11,
8242
+ NGHTTP2_INADEQUATE_SECURITY: 12,
8243
+ NGHTTP2_HTTP_1_1_REQUIRED: 13,
8244
+ NGHTTP2_DEFAULT_WEIGHT: 16,
8245
+ HTTP2_HEADER_STATUS: ":status",
8246
+ HTTP2_HEADER_METHOD: ":method",
8247
+ HTTP2_HEADER_AUTHORITY: ":authority",
8248
+ HTTP2_HEADER_SCHEME: ":scheme",
8249
+ HTTP2_HEADER_PATH: ":path",
8250
+ HTTP2_HEADER_PROTOCOL: ":protocol",
8251
+ HTTP2_HEADER_ACCEPT_ENCODING: "accept-encoding",
8252
+ HTTP2_HEADER_ACCEPT_LANGUAGE: "accept-language",
8253
+ HTTP2_HEADER_ACCEPT_RANGES: "accept-ranges",
8254
+ HTTP2_HEADER_ACCEPT: "accept",
8255
+ HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: "access-control-allow-credentials",
8256
+ HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: "access-control-allow-headers",
8257
+ HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: "access-control-allow-methods",
8258
+ HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: "access-control-allow-origin",
8259
+ HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: "access-control-expose-headers",
8260
+ HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: "access-control-request-headers",
8261
+ HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: "access-control-request-method",
8262
+ HTTP2_HEADER_AGE: "age",
8263
+ HTTP2_HEADER_AUTHORIZATION: "authorization",
8264
+ HTTP2_HEADER_CACHE_CONTROL: "cache-control",
8265
+ HTTP2_HEADER_CONNECTION: "connection",
8266
+ HTTP2_HEADER_CONTENT_DISPOSITION: "content-disposition",
8267
+ HTTP2_HEADER_CONTENT_ENCODING: "content-encoding",
8268
+ HTTP2_HEADER_CONTENT_LENGTH: "content-length",
8269
+ HTTP2_HEADER_CONTENT_TYPE: "content-type",
8270
+ HTTP2_HEADER_COOKIE: "cookie",
8271
+ HTTP2_HEADER_DATE: "date",
8272
+ HTTP2_HEADER_ETAG: "etag",
8273
+ HTTP2_HEADER_FORWARDED: "forwarded",
8274
+ HTTP2_HEADER_HOST: "host",
8275
+ HTTP2_HEADER_IF_MODIFIED_SINCE: "if-modified-since",
8276
+ HTTP2_HEADER_IF_NONE_MATCH: "if-none-match",
8277
+ HTTP2_HEADER_IF_RANGE: "if-range",
8278
+ HTTP2_HEADER_LAST_MODIFIED: "last-modified",
8279
+ HTTP2_HEADER_LINK: "link",
8280
+ HTTP2_HEADER_LOCATION: "location",
8281
+ HTTP2_HEADER_RANGE: "range",
8282
+ HTTP2_HEADER_REFERER: "referer",
8283
+ HTTP2_HEADER_SERVER: "server",
8284
+ HTTP2_HEADER_SET_COOKIE: "set-cookie",
8285
+ HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: "strict-transport-security",
8286
+ HTTP2_HEADER_TRANSFER_ENCODING: "transfer-encoding",
8287
+ HTTP2_HEADER_TE: "te",
8288
+ HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS: "upgrade-insecure-requests",
8289
+ HTTP2_HEADER_UPGRADE: "upgrade",
8290
+ HTTP2_HEADER_USER_AGENT: "user-agent",
8291
+ HTTP2_HEADER_VARY: "vary",
8292
+ HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS: "x-content-type-options",
8293
+ HTTP2_HEADER_X_FRAME_OPTIONS: "x-frame-options",
8294
+ HTTP2_HEADER_KEEP_ALIVE: "keep-alive",
8295
+ HTTP2_HEADER_PROXY_CONNECTION: "proxy-connection",
8296
+ HTTP2_HEADER_X_XSS_PROTECTION: "x-xss-protection",
8297
+ HTTP2_HEADER_ALT_SVC: "alt-svc",
8298
+ HTTP2_HEADER_CONTENT_SECURITY_POLICY: "content-security-policy",
8299
+ HTTP2_HEADER_EARLY_DATA: "early-data",
8300
+ HTTP2_HEADER_EXPECT_CT: "expect-ct",
8301
+ HTTP2_HEADER_ORIGIN: "origin",
8302
+ HTTP2_HEADER_PURPOSE: "purpose",
8303
+ HTTP2_HEADER_TIMING_ALLOW_ORIGIN: "timing-allow-origin",
8304
+ HTTP2_HEADER_X_FORWARDED_FOR: "x-forwarded-for",
8305
+ HTTP2_HEADER_PRIORITY: "priority",
8306
+ HTTP2_HEADER_ACCEPT_CHARSET: "accept-charset",
8307
+ HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE: "access-control-max-age",
8308
+ HTTP2_HEADER_ALLOW: "allow",
8309
+ HTTP2_HEADER_CONTENT_LANGUAGE: "content-language",
8310
+ HTTP2_HEADER_CONTENT_LOCATION: "content-location",
8311
+ HTTP2_HEADER_CONTENT_MD5: "content-md5",
8312
+ HTTP2_HEADER_CONTENT_RANGE: "content-range",
8313
+ HTTP2_HEADER_DNT: "dnt",
8314
+ HTTP2_HEADER_EXPECT: "expect",
8315
+ HTTP2_HEADER_EXPIRES: "expires",
8316
+ HTTP2_HEADER_FROM: "from",
8317
+ HTTP2_HEADER_IF_MATCH: "if-match",
8318
+ HTTP2_HEADER_IF_UNMODIFIED_SINCE: "if-unmodified-since",
8319
+ HTTP2_HEADER_MAX_FORWARDS: "max-forwards",
8320
+ HTTP2_HEADER_PREFER: "prefer",
8321
+ HTTP2_HEADER_PROXY_AUTHENTICATE: "proxy-authenticate",
8322
+ HTTP2_HEADER_PROXY_AUTHORIZATION: "proxy-authorization",
8323
+ HTTP2_HEADER_REFRESH: "refresh",
8324
+ HTTP2_HEADER_RETRY_AFTER: "retry-after",
8325
+ HTTP2_HEADER_TRAILER: "trailer",
8326
+ HTTP2_HEADER_TK: "tk",
8327
+ HTTP2_HEADER_VIA: "via",
8328
+ HTTP2_HEADER_WARNING: "warning",
8329
+ HTTP2_HEADER_WWW_AUTHENTICATE: "www-authenticate",
8330
+ HTTP2_HEADER_HTTP2_SETTINGS: "http2-settings",
8331
+ HTTP2_METHOD_ACL: "ACL",
8332
+ HTTP2_METHOD_BASELINE_CONTROL: "BASELINE-CONTROL",
8333
+ HTTP2_METHOD_BIND: "BIND",
8334
+ HTTP2_METHOD_CHECKIN: "CHECKIN",
8335
+ HTTP2_METHOD_CHECKOUT: "CHECKOUT",
8336
+ HTTP2_METHOD_CONNECT: "CONNECT",
8337
+ HTTP2_METHOD_COPY: "COPY",
8338
+ HTTP2_METHOD_DELETE: "DELETE",
8339
+ HTTP2_METHOD_GET: "GET",
8340
+ HTTP2_METHOD_HEAD: "HEAD",
8341
+ HTTP2_METHOD_LABEL: "LABEL",
8342
+ HTTP2_METHOD_LINK: "LINK",
8343
+ HTTP2_METHOD_LOCK: "LOCK",
8344
+ HTTP2_METHOD_MERGE: "MERGE",
8345
+ HTTP2_METHOD_MKACTIVITY: "MKACTIVITY",
8346
+ HTTP2_METHOD_MKCALENDAR: "MKCALENDAR",
8347
+ HTTP2_METHOD_MKCOL: "MKCOL",
8348
+ HTTP2_METHOD_MKREDIRECTREF: "MKREDIRECTREF",
8349
+ HTTP2_METHOD_MKWORKSPACE: "MKWORKSPACE",
8350
+ HTTP2_METHOD_MOVE: "MOVE",
8351
+ HTTP2_METHOD_OPTIONS: "OPTIONS",
8352
+ HTTP2_METHOD_ORDERPATCH: "ORDERPATCH",
8353
+ HTTP2_METHOD_PATCH: "PATCH",
8354
+ HTTP2_METHOD_POST: "POST",
8355
+ HTTP2_METHOD_PRI: "PRI",
8356
+ HTTP2_METHOD_PROPFIND: "PROPFIND",
8357
+ HTTP2_METHOD_PROPPATCH: "PROPPATCH",
8358
+ HTTP2_METHOD_PUT: "PUT",
8359
+ HTTP2_METHOD_REBIND: "REBIND",
8360
+ HTTP2_METHOD_REPORT: "REPORT",
8361
+ HTTP2_METHOD_SEARCH: "SEARCH",
8362
+ HTTP2_METHOD_TRACE: "TRACE",
8363
+ HTTP2_METHOD_UNBIND: "UNBIND",
8364
+ HTTP2_METHOD_UNCHECKOUT: "UNCHECKOUT",
8365
+ HTTP2_METHOD_UNLINK: "UNLINK",
8366
+ HTTP2_METHOD_UNLOCK: "UNLOCK",
8367
+ HTTP2_METHOD_UPDATE: "UPDATE",
8368
+ HTTP2_METHOD_UPDATEREDIRECTREF: "UPDATEREDIRECTREF",
8369
+ HTTP2_METHOD_VERSION_CONTROL: "VERSION-CONTROL",
8370
+ HTTP_STATUS_CONTINUE: 100,
8371
+ HTTP_STATUS_SWITCHING_PROTOCOLS: 101,
8372
+ HTTP_STATUS_PROCESSING: 102,
8373
+ HTTP_STATUS_EARLY_HINTS: 103,
8374
+ HTTP_STATUS_OK: 200,
8375
+ HTTP_STATUS_CREATED: 201,
8376
+ HTTP_STATUS_ACCEPTED: 202,
8377
+ HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: 203,
8378
+ HTTP_STATUS_NO_CONTENT: 204,
8379
+ HTTP_STATUS_RESET_CONTENT: 205,
8380
+ HTTP_STATUS_PARTIAL_CONTENT: 206,
8381
+ HTTP_STATUS_MULTI_STATUS: 207,
8382
+ HTTP_STATUS_ALREADY_REPORTED: 208,
8383
+ HTTP_STATUS_IM_USED: 226,
8384
+ HTTP_STATUS_MULTIPLE_CHOICES: 300,
8385
+ HTTP_STATUS_MOVED_PERMANENTLY: 301,
8386
+ HTTP_STATUS_FOUND: 302,
8387
+ HTTP_STATUS_SEE_OTHER: 303,
8388
+ HTTP_STATUS_NOT_MODIFIED: 304,
8389
+ HTTP_STATUS_USE_PROXY: 305,
8390
+ HTTP_STATUS_TEMPORARY_REDIRECT: 307,
8391
+ HTTP_STATUS_PERMANENT_REDIRECT: 308,
8392
+ HTTP_STATUS_BAD_REQUEST: 400,
8393
+ HTTP_STATUS_UNAUTHORIZED: 401,
8394
+ HTTP_STATUS_PAYMENT_REQUIRED: 402,
8395
+ HTTP_STATUS_FORBIDDEN: 403,
8396
+ HTTP_STATUS_NOT_FOUND: 404,
8397
+ HTTP_STATUS_METHOD_NOT_ALLOWED: 405,
8398
+ HTTP_STATUS_NOT_ACCEPTABLE: 406,
8399
+ HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: 407,
8400
+ HTTP_STATUS_REQUEST_TIMEOUT: 408,
8401
+ HTTP_STATUS_CONFLICT: 409,
8402
+ HTTP_STATUS_GONE: 410,
8403
+ HTTP_STATUS_LENGTH_REQUIRED: 411,
8404
+ HTTP_STATUS_PRECONDITION_FAILED: 412,
8405
+ HTTP_STATUS_PAYLOAD_TOO_LARGE: 413,
8406
+ HTTP_STATUS_URI_TOO_LONG: 414,
8407
+ HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: 415,
8408
+ HTTP_STATUS_RANGE_NOT_SATISFIABLE: 416,
8409
+ HTTP_STATUS_EXPECTATION_FAILED: 417,
8410
+ HTTP_STATUS_TEAPOT: 418,
8411
+ HTTP_STATUS_MISDIRECTED_REQUEST: 421,
8412
+ HTTP_STATUS_UNPROCESSABLE_ENTITY: 422,
8413
+ HTTP_STATUS_LOCKED: 423,
8414
+ HTTP_STATUS_FAILED_DEPENDENCY: 424,
8415
+ HTTP_STATUS_TOO_EARLY: 425,
8416
+ HTTP_STATUS_UPGRADE_REQUIRED: 426,
8417
+ HTTP_STATUS_PRECONDITION_REQUIRED: 428,
8418
+ HTTP_STATUS_TOO_MANY_REQUESTS: 429,
8419
+ HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
8420
+ HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: 451,
8421
+ HTTP_STATUS_INTERNAL_SERVER_ERROR: 500,
8422
+ HTTP_STATUS_NOT_IMPLEMENTED: 501,
8423
+ HTTP_STATUS_BAD_GATEWAY: 502,
8424
+ HTTP_STATUS_SERVICE_UNAVAILABLE: 503,
8425
+ HTTP_STATUS_GATEWAY_TIMEOUT: 504,
8426
+ HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: 505,
8427
+ HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: 506,
8428
+ HTTP_STATUS_INSUFFICIENT_STORAGE: 507,
8429
+ HTTP_STATUS_LOOP_DETECTED: 508,
8430
+ HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: 509,
8431
+ HTTP_STATUS_NOT_EXTENDED: 510,
8432
+ HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: 511
8433
+ };
7917
8434
  return {
7918
- connect, createServer,
7919
- createSecureServer: createServer,
7920
- Http2Session,
7921
- constants: {
7922
- NGHTTP2_NO_ERROR: 0, NGHTTP2_PROTOCOL_ERROR: 1,
7923
- HTTP2_HEADER_PATH: ':path', HTTP2_HEADER_METHOD: ':method',
7924
- HTTP2_HEADER_STATUS: ':status', HTTP2_HEADER_AUTHORITY: ':authority',
7925
- HTTP2_HEADER_SCHEME: ':scheme',
7926
- },
7927
- sensitiveHeaders: Symbol('nodejs.http2.sensitiveHeaders'),
8435
+ connect,
8436
+ constants,
8437
+ createServer,
8438
+ createSecureServer,
8439
+ getDefaultSettings,
8440
+ getPackedSettings,
8441
+ getUnpackedSettings,
8442
+ performServerHandshake,
8443
+ sensitiveHeaders: Symbol("sensitiveHeaders"),
8444
+ Http2ServerRequest,
8445
+ Http2ServerResponse
7928
8446
  };
7929
- })();
8447
+ }
8448
+ const __http2Mod = createHttp2Module({
8449
+ EventEmitter: __eventsMod,
8450
+ Readable: __streamMod.Readable,
8451
+ Stream: __streamMod,
8452
+ Buffer: __BufferMod,
8453
+ emitWarning: (message) => {
8454
+ const proc = globalThis.process;
8455
+ if (proc && typeof proc.emitWarning === "function") proc.emitWarning(message);
8456
+ },
8457
+ });
7930
8458
 
7931
8459
  // ═══════════════════════════════════════════════════════════════════════
7932
8460
  // ── repl module (W3: forward to workerd) ───────────────────────────
@@ -9599,7 +10127,6 @@ function __nimbusFailUnhandledAsync(error, kind) {
9599
10127
  __nimbusReportProcessExit(error.code, "");
9600
10128
  return;
9601
10129
  }
9602
- if (globalThis.__nimbusRuntimeCode) globalThis.__nimbusRuntimeCode.noteFailure(error);
9603
10130
  const label = kind === "rejection"
9604
10131
  ? "Unhandled promise rejection: "
9605
10132
  : "Uncaught exception: ";
@@ -10838,6 +11365,9 @@ builtins.undici = __undiciMod;
10838
11365
  // ── require() — full Node.js module resolution ─────────────────────
10839
11366
  // ═══════════════════════════════════════════════════════════════════════
10840
11367
  const __moduleCache = new Map();
11368
+ // A module cell's evaluation when it completes later (top-level await), by
11369
+ // its evaluation key: what an import of it waits for.
11370
+ const __moduleEvaluations = new Map();
10841
11371
  // package → why the package ABI policy says it cannot run here (wasm-swap-registry.ts).
10842
11372
  const __nimbusAbiAdvisories = new Map([["sharp","Native libvips bindings; not portable to Workers. … try: no Workers-compatible target — render server-side or use Cloudflare Images. For the wasm32 build see @img/sharp-wasm32 entry below."],["sqlite3","Native sqlite3 .node binding. … try: better-sqlite3-wasm (untested by Nimbus) or sql.js once wasm asset loading is available."],["better-sqlite3","Native sqlite .node binding. … try: better-sqlite3-wasm (untested by Nimbus) or @libsql/client if its subpath exports resolve in your project."],["canvas","Native Cairo bindings. … try: canvaskit-wasm (Skia -> WASM, canvas-API-compatible, ~7MB; untested by Nimbus) or @resvg/resvg-wasm for SVG."],["sodium-native","Native libsodium. … try: tweetnacl (pure JS, untested by Nimbus) or libsodium-wrappers (WASM, untested by Nimbus)."],["node-pty","PTY syscalls unavailable in workerd. … try: no Workers-compatible target — use the Nimbus built-in shell."],["robotjs","Desktop automation; sandboxed Workers cannot access OS UI. … try: no Workers-compatible target."],["electron","Embedded Chromium runtime; not applicable to Workers. … try: no Workers-compatible target."],["bcrypt","Native bcrypt; pure-JS bcryptjs has an equivalent sync API but the require() name differs and Nimbus does not yet support npm aliases. … try: change `require(\"bcrypt\")` to `require(\"bcryptjs\")`, then `npm install bcryptjs`. APIs are sync-compatible."],["argon2","Native Argon2 C bindings. … try: hash-wasm for argon2d, argon2i, and argon2id."],["node-sass","Native libsass; deprecated upstream. … try: sass (dart-sass, pure JS)."],["grpc","Deprecated native gRPC. … try: @grpc/grpc-js (pure JS, untested end-to-end in Nimbus)."],["@swc/core","Native Rust SWC. … try: @swc/wasm-web for transform/parse only; it does not provide the native Plugin API."],["prisma","Native query engine; not portable to Workers in this configuration. … try: @prisma/adapter-d1 (Prisma official Workers adapter, untested by Nimbus), or migrate to drizzle-orm + @libsql/client (untested by Nimbus)."],["@prisma/client","Same as `prisma` (native query engine). … try: @prisma/adapter-d1 (untested by Nimbus), or drizzle-orm + @libsql/client (untested)."],["puppeteer","Bundled Chromium binary (~150 MB). … try: no Workers-compatible target for the bundled binary — use puppeteer-core + Cloudflare Browser Rendering (untested by Nimbus)."],["playwright","Bundled browsers (~300 MB). … try: no Workers-compatible target for bundled browsers — use @playwright/test against a remote browser endpoint (untested by Nimbus)."],["sql.js","Installs but fails at runtime because dist/sql-wasm.wasm is not available to the runtime loader. … try: For SQL in Workers, consider Cloudflare D1 or @libsql/client."],["@swc/wasm-web","Installs but fails at runtime because its generated code path depends on workerd-blocked dynamic code generation. … try: For ESM transforms consider esbuild-wasm."],["@img/sharp-wasm32","WASM build of sharp; package is wasm32-cpu-only and libvips initThreads() requires pthread support unavailable in Workers. … try: wasm-vips may work for simple pipelines; for complex pipelines, render server-side and ship pixels."],["@napi-rs/canvas","Native bindings only (linux-x64-gnu/musl, darwin-arm64/x64, android-arm64, linux-arm64-gnu/musl, win32-x64-msvc, linux-arm-gnueabihf). No WASM build published. … try: canvaskit-wasm (Skia -> WASM, canvas-API-compatible, ~7MB; untested by Nimbus) or @resvg/resvg-wasm for SVG."],["@napi-rs/canvas-wasm32-wasi","@napi-rs/canvas does not publish a wasm32-wasi variant on npm (404). The @napi-rs/canvas project ships only native bindings. No WASM/WASI build exists. … try: canvaskit-wasm (Skia -> WASM, canvas-API-compatible; untested by Nimbus) or @resvg/resvg-wasm for SVG."],["@tailwindcss/oxide","Native Rust Tailwind v4 oxide engine; ships only platform-specific .node bindings plus a wasm32-wasi shard. workerd has no node:wasi, and bare native bindings cannot dlopen. … try: no Workers-compatible target — Tailwind v3 (`tailwindcss@^3`) is pure JS and works in Workers (untested by Nimbus). Tailwind v4 inherently requires the Rust oxide engine."]]);
10843
11373
 
@@ -11340,6 +11870,22 @@ function __makeLoadingExports(mod) {
11340
11870
  * Nothing here compiles source: request-time code generation is not
11341
11871
  * available in a Worker, so a file the launch did not map cannot run.
11342
11872
  */
11873
+ // import.meta of the module file at `filename`, evaluated as `url`: an
11874
+ // entry script's or a loaded module's. It lives on the module, not in source
11875
+ // text, so the five CommonJS arguments stay as they are, and
11876
+ // import.meta.resolve keeps its parent even when extracted and called later.
11877
+ // The registry's own import.meta cannot serve: its module URLs all live
11878
+ // under file:///bundle/, never at the file's own path. dirname and filename
11879
+ // name the file, without the URL's query or fragment.
11880
+ function __nimbusFileImportMeta(filename, url = builtins.url.pathToFileURL(filename).href) {
11881
+ return Object.assign(Object.create(null), {
11882
+ dirname: __pathMod.dirname(filename),
11883
+ filename,
11884
+ url,
11885
+ resolve: (specifier) => globalThis.__nimbusImportMetaResolve(specifier, url),
11886
+ });
11887
+ }
11888
+
11343
11889
  function __loadModule(resolvedPath, evaluationKey = resolvedPath) {
11344
11890
  if (globalThis.__nimbusProfileStaged) globalThis.__nimbusProfileStaged.delete(String(resolvedPath).replace(/^\/+/, ""));
11345
11891
  if (__moduleCache.has(evaluationKey)) return __moduleCache.get(evaluationKey);
@@ -11377,19 +11923,7 @@ function __loadModule(resolvedPath, evaluationKey = resolvedPath) {
11377
11923
  globalThis.__currentModulePath = resolvedPath;
11378
11924
  const moduleUrl = evaluationKey.startsWith("file:")
11379
11925
  ? evaluationKey : builtins.url.pathToFileURL("/" + resolvedPath).href;
11380
- // Evaluation metadata lives on the module, not in source text. Keeping
11381
- // it here preserves the five CommonJS arguments and captures the parent
11382
- // even when import.meta.resolve is extracted and called later. The
11383
- // registry's own import.meta cannot serve: its module URLs all live under
11384
- // file:///bundle/, never at the file's own path.
11385
- // dirname and filename name the file, without the URL's query or fragment.
11386
- const importMeta = Object.assign(Object.create(null), {
11387
- dirname: __pathMod.dirname("/" + resolvedPath),
11388
- filename: "/" + resolvedPath,
11389
- url: moduleUrl,
11390
- resolve: (specifier) => globalThis.__nimbusImportMetaResolve(specifier, moduleUrl),
11391
- });
11392
- Object.defineProperty(mod, "__nimbusImportMeta", { value: importMeta });
11926
+ Object.defineProperty(mod, "__nimbusImportMeta", { value: __nimbusFileImportMeta("/" + resolvedPath, moduleUrl) });
11393
11927
  try {
11394
11928
  const normalizedPath = resolvedPath.replace(/^\/+/, "");
11395
11929
  let cell = __nimbusModuleCell(normalizedPath);
@@ -11407,7 +11941,11 @@ function __loadModule(resolvedPath, evaluationKey = resolvedPath) {
11407
11941
  cell = __nimbusRuntimeModule(normalizedPath, text);
11408
11942
  globalThis.__nimbusModuleMisses.delete(normalizedPath);
11409
11943
  }
11410
- cell(mod.exports, scopedRequire, mod, "/" + resolvedPath, "/" + modDir);
11944
+ const evaluation = cell(mod.exports, scopedRequire, mod, "/" + resolvedPath, "/" + modDir);
11945
+ // A module with top-level await completes later. require() returns its
11946
+ // exports now (static imports lowered to require cannot wait); import()
11947
+ // waits for it (__esmLoad).
11948
+ if (evaluation && typeof evaluation.then === "function") __moduleEvaluations.set(evaluationKey, evaluation);
11411
11949
  } catch (e) {
11412
11950
  __moduleCache.delete(evaluationKey);
11413
11951
  if (e && typeof e === "object" && !e.__nimbusModulePath) {
@@ -12096,21 +12634,31 @@ function __esmLoad(resolution) {
12096
12634
  // Canonical queryless ESM shares evaluation with require() and static
12097
12635
  // imports lowered to require(). Queries/fragments are distinct jobs.
12098
12636
  const variant = esm && (resolution.url.includes("?") || resolution.url.includes("#"));
12099
- const exports = __loadModule(key, variant ? resolution.url : key);
12100
- if (resolution.format === "json") {
12101
- ns = __esmNamespaceOf(["default"], () => exports);
12102
- } else if (esm) {
12103
- // The ESM→CJS transform's exports: the module's own names, live.
12104
- const names = exports && typeof exports === "object" ? Object.keys(exports).filter((name) => name !== "__esModule") : [];
12105
- ns = __esmNamespaceOf(names, (name) => exports[name]);
12106
- } else {
12637
+ const evaluationKey = variant ? resolution.url : key;
12638
+ const exports = __loadModule(key, evaluationKey);
12639
+ const namespace = () => {
12640
+ if (resolution.format === "json") return __esmNamespaceOf(["default"], () => exports);
12641
+ if (esm) {
12642
+ // The ESM→CJS transform's exports: the module's own names, live.
12643
+ const names = exports && typeof exports === "object" ? Object.keys(exports).filter((name) => name !== "__esModule") : [];
12644
+ return __esmNamespaceOf(names, (name) => exports[name]);
12645
+ }
12107
12646
  // CommonJS: module.exports is the default, its names the named exports.
12108
12647
  const mod = exports;
12109
12648
  const names = new Set(mod && (typeof mod === "object" || typeof mod === "function") ? Object.keys(mod) : []);
12110
12649
  names.delete("default");
12111
12650
  names.add("default");
12112
- ns = __esmNamespaceOf(names, (name) => name === "default" ? mod : mod[name]);
12113
- }
12651
+ return __esmNamespaceOf(names, (name) => name === "default" ? mod : mod[name]);
12652
+ };
12653
+ // A module with top-level await: the import resolves once its evaluation
12654
+ // completes, and rejects with what it throws.
12655
+ const evaluation = __moduleEvaluations.get(evaluationKey);
12656
+ if (evaluation !== undefined) {
12657
+ const pending = evaluation.then(namespace, (error) => { __esmNamespaces.delete(resolution.url); throw error; });
12658
+ __esmNamespaces.set(resolution.url, pending);
12659
+ return pending;
12660
+ }
12661
+ ns = namespace();
12114
12662
  }
12115
12663
  __esmNamespaces.set(resolution.url, ns);
12116
12664
  return ns;