@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
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/hosted/services.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,oBAAo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AAE,MAAM,KAAK,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAkB7L;AAEH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAsCjK;AAEH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMtH;AAEH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAW1H;AAEH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,qBAAqB;;;;;oCAjKkB,MAAM,KAAK,IAAI;gCAgFnB,MAAM,KAAK,IAAI,yBAAU,MAAM,SAAS,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC;6CAoBtD,MAAM,KAAK,IAAI;;;EAyE3I"}
@@ -1,10 +1,16 @@
1
1
  import { staticStdinReader } from "@nimbus-sh/core/shell/stdin-adapter.js";
2
2
  import { composeFacetManager } from "../facets/compose.js";
3
3
  import { FacetProcessManager, textBytes } from "../facets/process.js";
4
+ import { isRuntimeInstallHint } from "../shell/npm-bin-entrypoints.js";
4
5
  import { ChildProcessSpawnPool } from "../loaders/child-process/spawn-pool.js";
5
6
  import { CRED_KERNEL, CRED_SESSION_USER } from "@nimbus-sh/core/runtime/os-contracts.js";
6
7
  import { ProcessFiles, ProcessView } from "@nimbus-sh/core/runtime/process-files.js";
7
- import { EsbuildBundlePool } from "../facets/esbuild-bundle-pool.js";
8
+ import { KILLED_BY_SIGPIPE } from "@nimbus-sh/core/substrate/lifo/shell/signals.js";
9
+ import { isBrokenPipe } from "@nimbus-sh/core/substrate/lifo/utils/bytes-io.js";
10
+ import { resolveContext } from "@nimbus-sh/core/substrate/lifo/commands/registry.js";
11
+ import { syscallError } from "@nimbus-sh/core/vfs/vfs-error.js";
12
+ import { errorText } from "@nimbus-sh/core/_shared/error-text.js";
13
+ import { PrebundlePool } from "../facets/prebundle-pool.js";
8
14
  import { supervisorEsbuildService } from "../facets/esbuild-transform.js";
9
15
  import { CF_COMPAT_DATE, GUEST_COMPAT_FLAGS } from "@nimbus-sh/core/constants.js";
10
16
  import { notifyTerminalEvent } from "../runtime/process-logs-api.js";
@@ -22,10 +28,6 @@ import { WebSocketRelay } from "../session/ws-relay.js";
22
28
  // They are imported here (so call sites in this file work unchanged) and
23
29
  // re-exported (so external callers importing them from
24
30
  // `./nimbus-session.js` keep working — back-compat).
25
- //
26
- // (esbuild wasm bytes are fetched from env.ASSETS by
27
- // src/esbuild-wasm-bytes.ts at pool-construction time; A'.5 dropped
28
- // the supervisor-resident cache + the SUPERVISOR.getEsbuildWasm RPC.)
29
31
  // Helpers needed by this class file's own logic (not just re-export).
30
32
  import { _classifyCommand } from "../session/helpers.js";
31
33
  import { z } from "zod/v4";
@@ -56,7 +58,7 @@ function normalizeCpCommandName(name) {
56
58
  }
57
59
  export function ensureBundlePool(self, runtimeContext) {
58
60
  if (!self.bundlePool)
59
- self.bundlePool = new EsbuildBundlePool(runtimeContext.env, runtimeContext.ctx);
61
+ self.bundlePool = new PrebundlePool(runtimeContext.env, runtimeContext.ctx);
60
62
  return self.bundlePool;
61
63
  }
62
64
  export function ensureFacetManager(self, runtimeContext) {
@@ -114,7 +116,7 @@ export function ensureFacetManager(self, runtimeContext) {
114
116
  }
115
117
  const composed = self.facetManagerComposed;
116
118
  // The session may create its esbuild after the manager exists, so it is
117
- // offered on every call. Either one runs in the session's esbuild facet.
119
+ // offered on every call. Either one transforms in the session's transform facet.
118
120
  if (self.esbuildService) {
119
121
  composed.manager.setEsbuildService(self.esbuildService);
120
122
  }
@@ -130,6 +132,8 @@ export function _ensureFacetProcessManager(self, runtimeContext) {
130
132
  return self.facetProcessManager;
131
133
  self.ensureSqliteFs();
132
134
  self.ensureFacetManager();
135
+ /** The namespace as process `pid` sees it under `cred`. */
136
+ const processView = (pid, cred) => new ProcessView(self.getFilesystemAuthority().bind({ pid, cred }));
133
137
  // FacetProcessManager is statically imported at top-of-file (W8).
134
138
  // No lazy-import: workerd doesn't ship CJS require, and the dynamic
135
139
  // import would be async — making _ensureFacetProcessManager async
@@ -165,42 +169,24 @@ export function _ensureFacetProcessManager(self, runtimeContext) {
165
169
  return 127;
166
170
  }
167
171
  const commandName = normalizeCpCommandName(payload.command);
168
- const cmd = await registry.resolve(commandName, { cwd: payload.cwd || '/home/user' });
172
+ const cred = self.processes.cred(payload.processPid);
173
+ const vfs = processView(payload.processPid, cred);
174
+ const cmd = await registry.resolve(commandName, resolveContext(payload.cwd || '/home/user', payload.env, vfs));
169
175
  if (!cmd) {
170
176
  hooks.onStderr(textBytes(`${payload.command}: command not found\n`));
171
177
  return 127;
172
178
  }
173
179
  // Synthesize a CommandContext for the internal shell substrate.
174
- const stdoutStream = { write: (d) => hooks.onStdout(textBytes(String(d))) };
175
- const stderrStream = { write: (d) => hooks.onStderr(textBytes(String(d))) };
176
180
  const ac = new AbortController();
177
- const cred = self.processes.cred(payload.processPid);
181
+ const io = processIo(payload.processPid, payload.env || {}, payload.cwd || '/home/user', payload.stdin || '', hooks);
178
182
  const ctx = {
179
- pid: payload.processPid,
183
+ ...io,
180
184
  cred,
181
185
  args: payload.args || [],
182
- env: payload.env || {},
183
- cwd: payload.cwd || '/home/user',
184
- vfs: new ProcessView(self.getFilesystemAuthority().bind({ pid: payload.processPid, cred })),
185
- stdout: stdoutStream,
186
- stderr: stderrStream,
186
+ vfs,
187
187
  signal: ac.signal,
188
- // For commands that need stdin we pass a tiny adapter.
189
- stdin: staticStdinReader(payload.stdin || ''),
190
188
  setUmask: (mask) => { self.processes.setUmask(payload.processPid, mask); },
191
- runAs: async (targetCred, argv) => {
192
- if (argv.length === 0)
193
- return 0;
194
- const child = self.processes.spawn(argv.join(' '), argv, payload.cwd, { parentPid: payload.processPid, cred: targetCred });
195
- let exitCode = 1;
196
- try {
197
- exitCode = await cmdRegistryAdapter.runPureBuiltin(child.pid, argv[0], argv.slice(1), payload.env, payload.cwd, payload.stdin, hooks);
198
- return exitCode;
199
- }
200
- finally {
201
- self.processes.exit(child.pid, exitCode);
202
- }
203
- },
189
+ runAs: (targetCred, argv, options) => spawnBuiltin(options?.parent ?? io, targetCred, argv),
204
190
  // Reuse the broker's pid and let runtime RPC output reach its
205
191
  // live queues. A direct inline invocation without a managed child
206
192
  // still needs a captured result.
@@ -231,22 +217,26 @@ export function _ensureFacetProcessManager(self, runtimeContext) {
231
217
  // attached to `this._cpRegistry` by the shell-init path (see
232
218
  // construction near line 2058 — registry passed as ctor arg there).
233
219
  const cmdRegistryAdapter = {
234
- // Consult the live shell registry FIRST so dynamically-registered
235
- // commands (registerUnixCommands / git / npm / wrangler etc.) are seen
236
- // even if they're not in the static _CP_PURE_BUILTIN allow-list. Falls
237
- // back to the static facet-direct table for known facet-only commands.
238
- // Returns null
239
- // (→ exit 127) for everything unknown.
240
- resolve: (name) => {
220
+ // The static tables keep their kinds (node/npm/git/... run in a facet
221
+ // even though they are registry entries too). Another registered
222
+ // command runs inline, as a pure builtin. Any other name (a runtime
223
+ // that is not installed is not registered) is a program
224
+ // the child's PATH may find, which runs as one named by its path does
225
+ // (facet-direct): its own pid, live stdin, its output on its queues.
226
+ // That dispatch searches PATH from the child's cwd, as execvp does, and
227
+ // finding nothing is "command not found", 127. Null (also 127) only
228
+ // while no registry is attached.
229
+ resolve: async (name, from) => {
241
230
  const commandName = normalizeCpCommandName(name);
231
+ const classified = _classifyCommand(commandName);
232
+ if (classified)
233
+ return classified;
242
234
  const registry = self._cpRegistry;
243
- if (registry && typeof registry.has === 'function' && registry.has(commandName)) {
244
- // Registered — classify by name. Reuse the static table so
245
- // facet-direct commands (node/npm/git/...) keep their kind
246
- // even when they ALSO happen to be registry entries.
247
- return _classifyCommand(commandName) || { kind: 'pure-builtin' };
248
- }
249
- return _classifyCommand(commandName);
235
+ if (!registry)
236
+ return null;
237
+ const view = processView(from.pid, self.processes.cred(from.pid));
238
+ const registered = await registry.resolve(commandName, { ...resolveContext(from.cwd, from.env, view), search: false });
239
+ return { kind: registered && !isRuntimeInstallHint(registered) ? 'pure-builtin' : 'facet-direct' };
250
240
  },
251
241
  runPureBuiltin: async (pid, name, args, env, cwd, stdin, hooks) => {
252
242
  const registry = self._cpRegistry;
@@ -254,48 +244,76 @@ export function _ensureFacetProcessManager(self, runtimeContext) {
254
244
  hooks.onStderr(textBytes('cp: registry unavailable\n'));
255
245
  return 127;
256
246
  }
257
- const commandName = normalizeCpCommandName(name);
258
- const cmd = await registry.resolve(commandName, { cwd });
247
+ const view = processView(pid, self.processes.cred(pid));
248
+ const cmd = await registry.resolve(normalizeCpCommandName(name), resolveContext(cwd, env, view));
259
249
  if (!cmd) {
260
250
  hooks.onStderr(textBytes(`${name}: command not found\n`));
261
251
  return 127;
262
252
  }
263
- const cred = self.processes.cred(pid);
264
- const ac = new AbortController();
265
- const ctx = {
266
- pid,
267
- cred,
268
- args, env, cwd,
269
- vfs: new ProcessView(self.getFilesystemAuthority().bind({ pid, cred })),
270
- stdout: { write: (d) => hooks.onStdout(textBytes(String(d))) },
271
- stderr: { write: (d) => hooks.onStderr(textBytes(String(d))) },
272
- signal: ac.signal,
273
- stdin: staticStdinReader(stdin),
274
- setUmask: (mask) => { self.processes.setUmask(pid, mask); },
275
- runAs: async (targetCred, argv) => {
276
- if (argv.length === 0)
277
- return 0;
278
- const child = self.processes.spawn(argv.join(' '), argv, cwd, { parentPid: pid, cred: targetCred });
279
- let exitCode = 1;
280
- try {
281
- exitCode = await cmdRegistryAdapter.runPureBuiltin(child.pid, argv[0], argv.slice(1), env, cwd, stdin, hooks);
282
- return exitCode;
283
- }
284
- finally {
285
- self.processes.exit(child.pid, exitCode);
286
- }
287
- },
288
- };
289
- try {
290
- const code = await cmd(ctx);
291
- return typeof code === 'number' ? code : 0;
292
- }
293
- catch (e) {
294
- hooks.onStderr(textBytes(`${name}: ${e?.message || String(e)}\n`));
295
- return 1;
296
- }
253
+ return (await runBuiltin(cmd, name, args, processIo(pid, env, cwd, stdin, hooks))).status;
297
254
  },
298
255
  };
256
+ /** A process's descriptors, environment and directory, over the facet's output hooks and its stdin text. */
257
+ const processIo = (pid, env, cwd, stdin, hooks) => ({
258
+ pid,
259
+ env,
260
+ cwd,
261
+ stdout: { write: (d) => hooks.onStdout(textBytes(String(d))) },
262
+ stderr: { write: (d) => hooks.onStderr(textBytes(String(d))) },
263
+ stdin: staticStdinReader(stdin),
264
+ });
265
+ /** A registry command run as process `io.pid`, on `io`'s descriptors, and how it ended. */
266
+ const runBuiltin = async (cmd, name, args, io) => {
267
+ const cred = self.processes.cred(io.pid);
268
+ const ac = new AbortController();
269
+ const ctx = {
270
+ ...io,
271
+ cred,
272
+ args,
273
+ vfs: processView(io.pid, cred),
274
+ signal: ac.signal,
275
+ setUmask: (mask) => { self.processes.setUmask(io.pid, mask); },
276
+ runAs: (targetCred, argv, options) => spawnBuiltin(options?.parent ?? io, targetCred, argv),
277
+ };
278
+ try {
279
+ const code = await cmd(ctx);
280
+ return { status: typeof code === 'number' ? code : 0, signal: null };
281
+ }
282
+ catch (e) {
283
+ // A write that finds its reader gone ends the process, silently.
284
+ if (isBrokenPipe(e))
285
+ return KILLED_BY_SIGPIPE;
286
+ await io.stderr.write(`${name}: ${errorText(e)}\n`);
287
+ return { status: 1, signal: null };
288
+ }
289
+ };
290
+ /**
291
+ * runAs for a builtin run on a process's behalf: execvp of `argv` in a
292
+ * child of `parent` under `cred`, inheriting `parent`'s descriptors,
293
+ * environment and directory. A program that is not there is ENOENT, as
294
+ * execvp fails, for the caller to report.
295
+ */
296
+ const spawnBuiltin = async (parent, cred, argv) => {
297
+ const [name, ...args] = argv;
298
+ if (name === undefined)
299
+ return { status: 0, signal: null };
300
+ const registry = self._cpRegistry;
301
+ // Found as the child will run it: under its credential.
302
+ const view = processView(parent.pid, cred);
303
+ const cmd = registry ? await registry.resolve(normalizeCpCommandName(name), resolveContext(parent.cwd, parent.env, view)) : undefined;
304
+ if (!cmd)
305
+ throw syscallError('ENOENT', 'execvp', name);
306
+ const child = self.processes.spawn(argv.join(' '), argv, parent.cwd, { parentPid: parent.pid, cred });
307
+ let exitCode = 1;
308
+ try {
309
+ const ended = await runBuiltin(cmd, name, args, { pid: child.pid, env: parent.env, cwd: parent.cwd, stdin: parent.stdin, stdout: parent.stdout, stderr: parent.stderr });
310
+ exitCode = ended.status;
311
+ return ended;
312
+ }
313
+ finally {
314
+ self.processes.exit(child.pid, exitCode);
315
+ }
316
+ };
299
317
  // Construct the child-process Loader pool when the binding is available.
300
318
  // Unit-test hosts without LOADER continue through direct dispatch.
301
319
  let spawnPool;
@@ -321,19 +339,8 @@ export function _ensureFacetProcessManager(self, runtimeContext) {
321
339
  }
322
340
  const cred = self.processes.cred(pid);
323
341
  const setUmask = (mask) => { self.processes.setUmask(pid, mask); };
324
- const runAs = async (_parent, targetCred, argv) => {
325
- if (argv.length === 0)
326
- return 0;
327
- const child = self.processes.spawn(argv.join(' '), argv, cwd, { parentPid: pid, cred: targetCred });
328
- let exitCode = 1;
329
- try {
330
- exitCode = await cmdRegistryAdapter.runPureBuiltin(child.pid, argv[0], argv.slice(1), env, cwd, stdin, hooks);
331
- return exitCode;
332
- }
333
- finally {
334
- self.processes.exit(child.pid, exitCode);
335
- }
336
- };
342
+ // The child inherits from the command that starts it: its pipes and redirections, and the directory a `cd` moved to.
343
+ const runAs = (parent, targetCred, argv) => spawnBuiltin(parent, targetCred, argv);
337
344
  const result = await self.shell.execute(String(commandLine), {
338
345
  cwd: cwd || '/home/user',
339
346
  env: { ...self.shell.env, ...(env || {}) },
@@ -122,6 +122,7 @@ export declare class HostedSession extends RpcTarget {
122
122
  }>;
123
123
  _rpcListPorts(): Promise<operations.SerializedPort[]>;
124
124
  _rpcExposePort(port: number, options?: Visibility): Promise<{
125
+ execId?: string;
125
126
  port: number;
126
127
  listening: boolean;
127
128
  pid: number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/hosted/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAG1F,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,0GAA0G;IAC1G,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,KAAK,cAAc,GAAG,UAAU,CAAC,uBAAuB,GAAG;IACzD,QAAQ,CAAC,EAAE,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;CACjC,CAAC;AAEF,KAAK,UAAU,GAAG;IAAE,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,MAAM,WAAW,kBAAmB,SAAQ,UAAU,CAAC,gBAAgB;IACrE,kBAAkB,IAAI,IAAI,CAAC;CAC5B;AAOD,qBAAa,aAAc,SAAQ,SAAS;IAG9B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;gBAErB,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,kBAAkB;IAMjF,wHAAwH;IACxH,OAAO,CAAC,MAAM;IAKd;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U,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;IAGtH,oBAAoB,CAAC,KAAK,EAAE,MAAM;;;;;IAElC,qFAAqF;IAC/E,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC;CAGpC"}
@@ -5,6 +5,7 @@
5
5
  * - @nimbus-sh/core src/_shared/tarball-stream.ts (streaming tar primitives)
6
6
  * - @nimbus-sh/platform src/w7-frame.ts (W7 streaming bulk-write encoder)
7
7
  * - @nimbus-sh/core src/_shared/esm-resolver.ts (Node's ESM resolver, for the node shims)
8
+ * - @nimbus-sh/core src/_shared/http2-module.ts (node:http2, for the node shims)
8
9
  *
9
10
  * Consumed by fabric/isolate-pool.ts callers via the `preamble`
10
11
  * option. The preamble is injected at the top of every generated
@@ -23,4 +24,6 @@ export declare const TAR_STREAM_PREAMBLE: string;
23
24
  export declare const W7_FRAME_PREAMBLE: string;
24
25
  /** Declares `function createEsmResolver(host)`; the node shims call it. */
25
26
  export declare const ESM_RESOLVER_PREAMBLE: string;
27
+ /** Declares `function createHttp2Module(host)`; the node shims call it. */
28
+ export declare const HTTP2_MODULE_PREAMBLE: string;
26
29
  //# sourceMappingURL=generated-workers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generated-workers.d.ts","sourceRoot":"","sources":["../../src/loaders/generated-workers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,mBAAmB,EAAE,MAAwyJ,CAAC;AAE30J,eAAO,MAAM,iBAAiB,EAAE,MAAyt+B,CAAC;AAE1v+B,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,EAAE,MAA6uuB,CAAC"}
1
+ {"version":3,"file":"generated-workers.d.ts","sourceRoot":"","sources":["../../src/loaders/generated-workers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,eAAO,MAAM,mBAAmB,EAAE,MAAwyJ,CAAC;AAE30J,eAAO,MAAM,iBAAiB,EAAE,MAAyt+B,CAAC;AAE1v+B,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,EAAE,MAA6uuB,CAAC;AAElxuB,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,EAAE,MAA4kqB,CAAC"}
@@ -5,6 +5,7 @@
5
5
  * - @nimbus-sh/core src/_shared/tarball-stream.ts (streaming tar primitives)
6
6
  * - @nimbus-sh/platform src/w7-frame.ts (W7 streaming bulk-write encoder)
7
7
  * - @nimbus-sh/core src/_shared/esm-resolver.ts (Node's ESM resolver, for the node shims)
8
+ * - @nimbus-sh/core src/_shared/http2-module.ts (node:http2, for the node shims)
8
9
  *
9
10
  * Consumed by fabric/isolate-pool.ts callers via the `preamble`
10
11
  * option. The preamble is injected at the top of every generated
@@ -23,3 +24,5 @@ export const TAR_STREAM_PREAMBLE = "var MAX_FILE_BYTES = 2e7;\nfunction canonica
23
24
  export const W7_FRAME_PREAMBLE = "var CRC_NATIVE_MIN_BYTES = 128;\nvar nativeCrc32 = (() => {\n try {\n const crc322 = globalThis.process?.getBuiltinModule?.(\"node:zlib\")?.crc32;\n return typeof crc322 === \"function\" ? crc322 : null;\n } catch {\n return null;\n }\n})();\nvar crcTables = null;\nfunction createCrcTables() {\n const table = new Uint32Array(256 * 8);\n for (let index = 0; index < 256; index++) {\n let value = index;\n for (let bit = 0; bit < 8; bit++) value = (value & 1) !== 0 ? 3988292384 ^ value >>> 1 : value >>> 1;\n table[index] = value;\n }\n for (let index = 0; index < 256; index++) {\n let value = table[index];\n for (let k = 1; k < 8; k++) {\n value = table[value & 255] ^ value >>> 8;\n table[k * 256 + index] = value;\n }\n }\n return table;\n}\nfunction crc32(bytes, previous = 0) {\n if (nativeCrc32 !== null && bytes.length >= CRC_NATIVE_MIN_BYTES) return nativeCrc32(bytes, previous) >>> 0;\n const t = crcTables ??= createCrcTables();\n let value = ~previous;\n const length = bytes.length;\n const whole = length - (length & 7);\n let i = 0;\n for (; i < whole; i += 8) {\n const low = value ^ (bytes[i] | bytes[i + 1] << 8 | bytes[i + 2] << 16 | bytes[i + 3] << 24);\n const high = bytes[i + 4] | bytes[i + 5] << 8 | bytes[i + 6] << 16 | bytes[i + 7] << 24;\n value = t[1792 + (low & 255)] ^ t[1536 + (low >>> 8 & 255)] ^ t[1280 + (low >>> 16 & 255)] ^ t[1024 + (low >>> 24)] ^ t[768 + (high & 255)] ^ t[512 + (high >>> 8 & 255)] ^ t[256 + (high >>> 16 & 255)] ^ t[high >>> 24];\n }\n for (; i < length; i++) value = t[(value ^ bytes[i]) & 255] ^ value >>> 8;\n return ~value >>> 0;\n}\n\nvar CHUNK_SIZE = 65536;\nvar MAX_TX_BLOB_BYTES = 1 * 1024 * 1024;\nvar SQLITE_MAX_STATEMENT_BYTES = 100 * 1024;\nvar MAX_RPC_SAFE_PAYLOAD_BYTES = 28 * 1024 * 1024;\nvar ONE_SHOT_MODULE_MAP_MAX_BYTES = 18 * 1024 * 1024;\nvar SUPERVISOR_HEAP_CEILING_BYTES = 64 * 1024 * 1024;\nvar FACET_OWN_WRITE_MEMORY_BYTES = 32 * 1024 * 1024;\nvar SUPERVISOR_IN_FLIGHT_ALLOCATION_BUDGET_BYTES = 40 * 1024 * 1024;\nvar SUPERVISOR_READ_RESERVE_BYTES = 1024 * 1024;\nvar MAX_GLOBAL_WRITE_STREAM_CREDIT_BYTES = 8 * 1024 * 1024;\n\nvar W7_MAGIC = new Uint8Array([78, 87, 55, 3]);\nvar ENCODER_QUEUE_HWM = 0;\nvar MAX_METADATA_BYTES = 64 * 1024;\nvar MAX_PATH_BYTES = 64 * 1024;\nvar MAX_BATCH_ID_BYTES = 128;\nvar MAX_CONTENT_ID_BYTES = 256;\nvar W7_MAX_PATHS_PER_BATCH = 128;\nvar W7_MAX_OWNED_PATH_BYTES = 64 * 1024;\nvar W7_MAX_RECORD_BYTES = 5 + 4 + MAX_CONTENT_ID_BYTES + 8 + CHUNK_SIZE;\nvar MODE = \"path-atomic-committed-prefix\";\nfunction encodeWriteBatchStream(payload) {\n const batchId = crypto.randomUUID();\n const { deletes, directories, files } = preparePayload(payload, batchId);\n const iterator = encodeRecords(batchId, deletes, directories, files);\n let closed = false;\n let magicEmitted = false;\n const source = {\n type: \"bytes\",\n pull(controller) {\n if (closed) return;\n try {\n if (!magicEmitted) {\n magicEmitted = true;\n controller.enqueue(W7_MAGIC.slice());\n return;\n }\n const next = iterator.next();\n if (next.done) {\n closed = true;\n controller.close();\n return;\n }\n for (const part of next.value) controller.enqueue(part);\n } catch (error) {\n closed = true;\n controller.error(error);\n }\n },\n cancel() {\n closed = true;\n iterator.return?.(void 0);\n }\n };\n return new ReadableStream(source, {\n highWaterMark: ENCODER_QUEUE_HWM\n });\n}\nasync function decodeWriteBatchStream(stream, options = {}) {\n let reader;\n try {\n reader = stream.getReader({ mode: \"byob\" });\n } catch {\n throw new Error(\"w7-frame: stream must be a byte-oriented ReadableStream\");\n }\n const buffer = new ExactByteReader(reader, options.signal);\n let handedOff = false;\n try {\n throwIfAborted(options.signal);\n const magic = await buffer.readExact(W7_MAGIC.length, \"magic\");\n if (!bytesEqual(magic, W7_MAGIC)) {\n const version = magic.length === 4 && magic[0] === 78 && magic[1] === 87 && magic[2] === 55 ? magic[3] : null;\n if (version !== null) {\n throw new Error(`w7-frame: unsupported protocol version ${version}; expected 3`);\n }\n throw new Error(`w7-frame: bad magic, expected NW7\\\\x03, got ${hex(magic)}`);\n }\n const beginEnvelope = await readEnvelope(buffer, \"batch-begin\");\n if (beginEnvelope.tag !== 1 ) {\n throw new Error(`w7-frame: first record must be batch-begin, got tag ${beginEnvelope.tag}`);\n }\n if (beginEnvelope.length > MAX_METADATA_BYTES) {\n throw new Error(\n `w7-frame: batch-begin length ${beginEnvelope.length} exceeds ${MAX_METADATA_BYTES}`\n );\n }\n const beginPayload = await buffer.readExact(beginEnvelope.length, \"batch-begin payload\");\n const begin = parseBatchBegin(beginPayload);\n const initialCheck = updateRecordCheck(0, beginEnvelope.header, beginPayload);\n handedOff = true;\n return {\n batchId: begin.id,\n mode: begin.mode,\n records: decodeRecords(stream, reader, buffer, options, initialCheck)\n };\n } catch (error) {\n if (!handedOff) await cancelReader(reader, error);\n throw error;\n }\n}\nasync function* decodeRecords(stream, reader, buffer, options, initialCheck) {\n const ownedPaths = new PathOwnership();\n const contentIds = new Set();\n let active = null;\n let batchCheck = initialCheck;\n const summary = {\n recordCount: 1,\n pathCount: 0,\n deleteCount: 0,\n directoryCount: 0,\n fileCount: 0,\n chunkCount: 0,\n byteCount: 0\n };\n let completed = false;\n let failure = new DOMException(\"W7 consumer cancelled\", \"AbortError\");\n try {\n while (true) {\n throwIfAborted(options.signal);\n const envelope = await readEnvelope(buffer, \"record\");\n if (active && envelope.tag !== 5 && envelope.tag !== 6 ) {\n throw new Error(`w7-frame: file ${active.inode.path} ended without file-end`);\n }\n if (envelope.tag === 5 ) {\n if (!active) throw new Error(\"w7-frame: file-chunk without active file\");\n const prefixLength = Math.min(envelope.length, 4 + MAX_CONTENT_ID_BYTES + 8);\n const idLengthBytes = await buffer.readExact(4, \"file-chunk content-id length\");\n const idLength = readU32LE(idLengthBytes, 0);\n if (idLength === 0 || idLength > MAX_CONTENT_ID_BYTES) {\n throw new Error(`w7-frame: invalid file-chunk content-id length ${idLength}`);\n }\n const remainingPrefixLength = idLength + 8;\n if (4 + remainingPrefixLength > prefixLength || 4 + remainingPrefixLength > envelope.length) {\n throw new Error(\"w7-frame: malformed file-chunk record length\");\n }\n const rest = await buffer.readExact(remainingPrefixLength, \"file-chunk header\");\n const contentId = decodeText(rest.subarray(0, idLength), \"file-chunk content id\");\n const chunkId = readU32LE(rest, idLength);\n const dataLength = readU32LE(rest, idLength + 4);\n if (envelope.length !== 4 + idLength + 8 + dataLength) {\n throw new Error(\"w7-frame: file-chunk payload length mismatch\");\n }\n if (contentId !== active.metadata.contentId) {\n throw new Error(`w7-frame: file-chunk content id ${contentId} does not own ${active.inode.path}`);\n }\n if (chunkId !== active.nextChunkId) {\n throw new Error(\n `w7-frame: ${active.inode.path}: expected chunk ${active.nextChunkId}, got ${chunkId}`\n );\n }\n if (chunkId >= active.inode.chunkCount) {\n throw new Error(`w7-frame: ${active.inode.path}: chunk ${chunkId} is out of range`);\n }\n const expectedBytes = Math.min(\n CHUNK_SIZE,\n active.inode.size - chunkId * CHUNK_SIZE\n );\n if (dataLength !== expectedBytes || dataLength > CHUNK_SIZE) {\n throw new Error(\n `w7-frame: ${active.inode.path}: chunk ${chunkId} has ${dataLength} bytes; expected ${expectedBytes}`\n );\n }\n const headerPayload = concatBytes(idLengthBytes, rest);\n let retention = null;\n try {\n retention = options.retainChunk ? await options.retainChunk(dataLength, options.signal) : noopRetention(dataLength);\n throwIfAborted(options.signal);\n const data = await buffer.readExact(dataLength, \"file-chunk data\");\n batchCheck = updateRecordCheck(batchCheck, envelope.header, headerPayload, data);\n active.check = crc32(data, active.check);\n active.nextChunkId++;\n active.receivedBytes += dataLength;\n summary.recordCount++;\n summary.chunkCount++;\n summary.byteCount += dataLength;\n const record = {\n type: \"file-chunk\",\n streamContentId: contentId,\n path: active.inode.path,\n chunkId,\n data,\n retention\n };\n retention = null;\n yield record;\n } finally {\n retention?.release();\n }\n continue;\n }\n if (envelope.length > MAX_METADATA_BYTES) {\n throw new Error(`w7-frame: metadata record length ${envelope.length} exceeds ${MAX_METADATA_BYTES}`);\n }\n const payload = await buffer.readExact(envelope.length, \"record payload\");\n if (envelope.tag !== 7 ) {\n batchCheck = updateRecordCheck(batchCheck, envelope.header, payload);\n summary.recordCount++;\n }\n switch (envelope.tag) {\n case 2 : {\n const metadata = parseDelete(payload);\n claimPath(ownedPaths, metadata.path);\n summary.pathCount++;\n summary.deleteCount++;\n yield { type: \"delete\", path: metadata.path };\n break;\n }\n case 3 : {\n const metadata = parseDirectory(payload);\n claimPath(ownedPaths, metadata.path);\n summary.pathCount++;\n summary.directoryCount++;\n yield { type: \"directory\", inode: directoryInode(metadata) };\n break;\n }\n case 4 : {\n const metadata = parseFileBegin(payload);\n claimPath(ownedPaths, metadata.path);\n if (contentIds.has(metadata.contentId)) {\n throw new Error(`w7-frame: duplicate stream content id ${metadata.contentId}`);\n }\n contentIds.add(metadata.contentId);\n const inode = fileInode(metadata);\n summary.pathCount++;\n summary.fileCount++;\n active = {\n metadata,\n inode,\n nextChunkId: 0,\n receivedBytes: 0,\n check: 0\n };\n yield { type: \"file-begin\", streamContentId: metadata.contentId, inode };\n break;\n }\n case 6 : {\n if (!active) throw new Error(\"w7-frame: file-end without active file\");\n const metadata = parseFileEnd(payload);\n const actualCheck = active.check;\n if (metadata.contentId !== active.metadata.contentId) {\n throw new Error(`w7-frame: file-end content id mismatch for ${active.inode.path}`);\n }\n if (metadata.size !== active.receivedBytes || metadata.size !== active.inode.size) {\n throw new Error(`w7-frame: file-end byte total mismatch for ${active.inode.path}`);\n }\n if (metadata.chunkCount !== active.nextChunkId || metadata.chunkCount !== active.inode.chunkCount) {\n throw new Error(`w7-frame: file-end chunk count mismatch for ${active.inode.path}`);\n }\n if (metadata.check !== actualCheck) {\n throw new Error(`w7-frame: file-end check mismatch for ${active.inode.path}`);\n }\n const record = {\n type: \"file-end\",\n streamContentId: metadata.contentId,\n path: active.inode.path,\n size: metadata.size,\n chunkCount: metadata.chunkCount,\n check: metadata.check\n };\n active = null;\n yield record;\n break;\n }\n case 7 : {\n if (active) throw new Error(`w7-frame: batch-end while file ${active.inode.path} is active`);\n const actual = parseBatchEnd(payload);\n const expected = { ...summary, check: batchCheck };\n if (!sameSummary(actual, expected)) {\n throw new Error(\n `w7-frame: batch-end summary mismatch; expected ${JSON.stringify(expected)}, got ${JSON.stringify(actual)}`\n );\n }\n await buffer.ensureEof(stream);\n completed = true;\n yield { type: \"batch-end\", summary: actual };\n return;\n }\n case 1 :\n throw new Error(\"w7-frame: duplicate batch-begin\");\n default:\n throw new Error(`w7-frame: unknown record tag ${envelope.tag}`);\n }\n }\n } catch (error) {\n failure = error;\n throw error;\n } finally {\n if (completed) {\n try {\n reader.releaseLock();\n } catch {\n }\n } else {\n await cancelReader(reader, failure);\n }\n }\n}\nfunction* encodeRecords(batchId, deletes, directories, files) {\n const state = {\n batchCheck: 0,\n summary: {\n recordCount: 0,\n pathCount: 0,\n deleteCount: 0,\n directoryCount: 0,\n fileCount: 0,\n chunkCount: 0,\n byteCount: 0\n }\n };\n yield encodeMetadataRecord(1 , { id: batchId, mode: MODE }, state);\n for (const path of deletes) {\n state.summary.pathCount++;\n state.summary.deleteCount++;\n yield encodeMetadataRecord(2 , { path }, state);\n }\n for (const inode of directories) {\n state.summary.pathCount++;\n state.summary.directoryCount++;\n yield encodeMetadataRecord(3 , {\n ...inodeMetadata(inode),\n kind: inode.kind\n }, state);\n }\n for (const file of files) {\n state.summary.pathCount++;\n state.summary.fileCount++;\n yield encodeMetadataRecord(4 , {\n ...inodeMetadata(file.inode),\n kind: file.inode.kind,\n contentId: file.contentId,\n size: file.inode.size,\n chunkCount: file.inode.chunkCount\n }, state);\n let fileCheck = 0;\n for (const chunk of file.chunks) {\n const data = chunk.data;\n const contentBytes = new TextEncoder().encode(file.contentId);\n const prefix = new Uint8Array(4 + contentBytes.length + 8);\n writeU32LE(prefix, 0, contentBytes.length);\n prefix.set(contentBytes, 4);\n writeU32LE(prefix, 4 + contentBytes.length, chunk.chunkId);\n writeU32LE(prefix, 8 + contentBytes.length, data.byteLength);\n const header = recordHeader(5 , prefix.byteLength + data.byteLength);\n state.batchCheck = updateRecordCheck(state.batchCheck, header, prefix, data);\n state.summary.recordCount++;\n state.summary.chunkCount++;\n state.summary.byteCount += data.byteLength;\n fileCheck = crc32(data, fileCheck);\n yield [concatBytes(header, prefix), data];\n }\n yield encodeMetadataRecord(6 , {\n contentId: file.contentId,\n size: file.inode.size,\n chunkCount: file.inode.chunkCount,\n check: fileCheck\n }, state);\n }\n const end = {\n ...state.summary,\n check: state.batchCheck\n };\n yield encodeMetadataRecord(7 , end);\n}\nfunction encodeMetadataRecord(tag, value, state) {\n const payload = new TextEncoder().encode(JSON.stringify(value));\n if (payload.byteLength > MAX_METADATA_BYTES) {\n throw new Error(`w7-frame: metadata record exceeds ${MAX_METADATA_BYTES} bytes`);\n }\n const header = recordHeader(tag, payload.byteLength);\n if (state && tag !== 7 ) {\n state.batchCheck = updateRecordCheck(state.batchCheck, header, payload);\n state.summary.recordCount++;\n }\n return [concatBytes(header, payload)];\n}\nfunction preparePayload(payload, batchId) {\n if (!payload || !Array.isArray(payload.inodes) || !Array.isArray(payload.chunks)) {\n throw new Error(\"w7-frame: payload must contain inode and chunk arrays\");\n }\n const ownedPaths = new PathOwnership();\n const deletes = [...payload.deletePaths ?? []];\n for (const path of deletes) claimPath(ownedPaths, canonicalPath(path, \"delete path\"));\n const chunksByPath = new Map();\n for (const chunk of payload.chunks) {\n const path = canonicalPath(chunk.path, \"chunk path\");\n const list = chunksByPath.get(path);\n if (list) list.push(chunk);\n else chunksByPath.set(path, [chunk]);\n }\n const directories = [];\n const files = [];\n let fileIndex = 0;\n for (const inode of payload.inodes) {\n const path = canonicalPath(inode.path, \"inode path\");\n if (path !== inode.path) throw new Error(`w7-frame: noncanonical inode path ${inode.path}`);\n claimPath(ownedPaths, path);\n const normalizedInode = normalizeInode(inode);\n const fileChunks = chunksByPath.get(path) ?? [];\n if (normalizedInode.kind === \"directory\") {\n if (fileChunks.length > 0) throw new Error(`w7-frame: directory ${path} has chunks`);\n directories.push(normalizedInode);\n } else {\n validateChunks(normalizedInode, fileChunks);\n files.push({\n inode: normalizedInode,\n contentId: `${batchId}:${fileIndex++}`,\n chunks: fileChunks\n });\n }\n chunksByPath.delete(path);\n }\n if (chunksByPath.size > 0) {\n throw new Error(`w7-frame: chunk has no inode: ${chunksByPath.keys().next().value}`);\n }\n return { deletes, directories, files };\n}\nfunction parseBatchBegin(bytes) {\n const value = parseObject(bytes, \"batch-begin\", [\"id\", \"mode\"]);\n const id = boundedString(value.id, \"batch id\", MAX_BATCH_ID_BYTES);\n if (value.mode !== MODE) throw new Error(`w7-frame: unsupported batch mode ${String(value.mode)}`);\n return { id, mode: MODE };\n}\nfunction parseDelete(bytes) {\n const value = parseObject(bytes, \"delete\", [\"path\"]);\n return { path: canonicalPath(value.path, \"delete path\") };\n}\nfunction parseDirectory(bytes) {\n const value = parseObject(bytes, \"directory\", [\"path\", \"kind\", \"mtime\", \"mode\"], [\"atime\"]);\n if (value.kind !== \"directory\") {\n throw new Error(`w7-frame: unsupported directory kind ${String(value.kind)}`);\n }\n return { ...parseInodeMetadata(value, \"directory\"), kind: \"directory\" };\n}\nfunction parseFileBegin(bytes) {\n const value = parseObject(\n bytes,\n \"file-begin\",\n [\"path\", \"kind\", \"contentId\", \"size\", \"chunkCount\", \"mtime\", \"mode\"],\n [\"atime\"]\n );\n const base = parseInodeMetadata(value, \"file-begin\");\n if (value.kind !== \"file\" && value.kind !== \"symlink\") {\n throw new Error(`w7-frame: unsupported file-begin kind ${String(value.kind)}`);\n }\n const contentId = boundedString(value.contentId, \"stream content id\", MAX_CONTENT_ID_BYTES);\n if (!/^[A-Za-z0-9._:-]+$/.test(contentId)) {\n throw new Error(`w7-frame: invalid stream content id ${contentId}`);\n }\n const size = safeInteger(value.size, \"file size\");\n const chunkCount = u32(value.chunkCount, \"file chunk count\");\n const expected = size === 0 ? 0 : Math.ceil(size / CHUNK_SIZE);\n if (chunkCount !== expected) {\n throw new Error(`w7-frame: ${base.path}: expected ${expected} chunks, got ${chunkCount}`);\n }\n return { ...base, kind: value.kind, contentId, size, chunkCount };\n}\nfunction parseFileEnd(bytes) {\n const value = parseObject(bytes, \"file-end\", [\"contentId\", \"size\", \"chunkCount\", \"check\"]);\n return {\n contentId: boundedString(value.contentId, \"stream content id\", MAX_CONTENT_ID_BYTES),\n size: safeInteger(value.size, \"file-end size\"),\n chunkCount: u32(value.chunkCount, \"file-end chunk count\"),\n check: u32(value.check, \"file-end check\")\n };\n}\nfunction parseBatchEnd(bytes) {\n const keys = [\n \"recordCount\",\n \"pathCount\",\n \"deleteCount\",\n \"directoryCount\",\n \"fileCount\",\n \"chunkCount\",\n \"byteCount\",\n \"check\"\n ];\n const value = parseObject(bytes, \"batch-end\", keys);\n return {\n recordCount: safeInteger(value.recordCount, \"batch record count\"),\n pathCount: safeInteger(value.pathCount, \"batch path count\"),\n deleteCount: safeInteger(value.deleteCount, \"batch delete count\"),\n directoryCount: safeInteger(value.directoryCount, \"batch directory count\"),\n fileCount: safeInteger(value.fileCount, \"batch file count\"),\n chunkCount: safeInteger(value.chunkCount, \"batch chunk count\"),\n byteCount: safeInteger(value.byteCount, \"batch byte count\"),\n check: u32(value.check, \"batch check\")\n };\n}\nfunction parseInodeMetadata(value, label) {\n return {\n path: canonicalPath(value.path, `${label} path`),\n ...value.atime === void 0 ? {} : { atime: safeInteger(value.atime, `${label} atime`) },\n mtime: safeInteger(value.mtime, `${label} mtime`),\n mode: u32(value.mode, `${label} mode`)\n };\n}\nfunction parseObject(bytes, label, required, optional = []) {\n let value;\n try {\n value = JSON.parse(decodeText(bytes, label));\n } catch (error) {\n if (error instanceof Error && error.message.startsWith(\"w7-frame:\")) throw error;\n throw new Error(`w7-frame: invalid ${label} JSON: ${errorMessage(error)}`);\n }\n if (!isObject(value) || Array.isArray(value)) throw new Error(`w7-frame: ${label} must be an object`);\n const allowed = new Set([...required, ...optional]);\n for (const key of required) {\n if (!Object.hasOwn(value, key)) throw new Error(`w7-frame: ${label} missing ${key}`);\n }\n for (const key of Object.keys(value)) {\n if (!allowed.has(key)) throw new Error(`w7-frame: ${label} has unknown field ${key}`);\n }\n return value;\n}\nfunction normalizeInode(inode) {\n canonicalPath(inode.path, \"inode path\");\n if (inode.parentPath !== parentPath(inode.path)) {\n throw new Error(`w7-frame: ${inode.path}: noncanonical parent path ${inode.parentPath}`);\n }\n safeInteger(inode.size, `${inode.path} size`);\n u32(inode.chunkCount, `${inode.path} chunk count`);\n safeInteger(inode.mtime, `${inode.path} mtime`);\n if (inode.atime !== void 0) safeInteger(inode.atime, `${inode.path} atime`);\n u32(inode.mode, `${inode.path} mode`);\n const rawKind = inode.kind ?? (inode.isDir ? \"directory\" : \"file\");\n if (rawKind !== \"file\" && rawKind !== \"directory\" && rawKind !== \"symlink\") {\n throw new Error(`w7-frame: unsupported inode kind ${String(rawKind)}`);\n }\n const kind = rawKind;\n if (kind === \"directory\" && !inode.isDir) {\n throw new Error(`w7-frame: directory inode ${inode.path} must be a directory`);\n }\n if (kind !== \"directory\" && inode.isDir) {\n throw new Error(`w7-frame: ${kind} inode ${inode.path} cannot be a directory`);\n }\n if (kind === \"directory\" && (inode.size !== 0 || inode.chunkCount !== 0)) {\n throw new Error(`w7-frame: directory ${inode.path} must have zero size and chunks`);\n }\n if (kind !== \"directory\") {\n const expected = inode.size === 0 ? 0 : Math.ceil(inode.size / CHUNK_SIZE);\n if (inode.chunkCount !== expected) {\n throw new Error(`w7-frame: ${inode.path}: expected ${expected} chunks, got ${inode.chunkCount}`);\n }\n return { ...inode, kind, isDir: false };\n }\n return { ...inode, kind, isDir: true };\n}\nfunction validateChunks(inode, chunks) {\n if (chunks.length !== inode.chunkCount) {\n throw new Error(`w7-frame: ${inode.path}: expected ${inode.chunkCount} chunks, got ${chunks.length}`);\n }\n chunks.sort((left, right) => left.chunkId - right.chunkId);\n for (let index = 0; index < chunks.length; index++) {\n const chunk = chunks[index];\n if (chunk.chunkId !== index) {\n throw new Error(`w7-frame: ${inode.path}: expected chunk ${index}, got ${chunk.chunkId}`);\n }\n const expected = Math.min(CHUNK_SIZE, inode.size - index * CHUNK_SIZE);\n if (!(chunk.data instanceof Uint8Array) || chunk.data.byteLength !== expected) {\n throw new Error(`w7-frame: ${inode.path}: chunk ${index} must contain ${expected} bytes`);\n }\n }\n}\nfunction directoryInode(metadata) {\n return {\n path: metadata.path,\n parentPath: parentPath(metadata.path),\n kind: metadata.kind,\n isDir: true,\n size: 0,\n atime: metadata.atime,\n mtime: metadata.mtime,\n mode: metadata.mode,\n chunkCount: 0\n };\n}\nfunction fileInode(metadata) {\n return {\n path: metadata.path,\n parentPath: parentPath(metadata.path),\n kind: metadata.kind,\n isDir: false,\n size: metadata.size,\n atime: metadata.atime,\n mtime: metadata.mtime,\n mode: metadata.mode,\n chunkCount: metadata.chunkCount\n };\n}\nfunction inodeMetadata(inode) {\n return {\n path: inode.path,\n ...inode.atime === void 0 ? {} : { atime: inode.atime },\n mtime: inode.mtime,\n mode: inode.mode\n };\n}\nfunction canonicalPath(value, label) {\n const path = boundedString(value, label, MAX_PATH_BYTES);\n if (path.includes(\"\\0\")) throw new Error(`w7-frame: ${label} contains NUL`);\n const normalized = normalizePath(path);\n if (!path || normalized !== path) throw new Error(`w7-frame: noncanonical ${label}: ${path}`);\n return path;\n}\nvar PathOwnership = class {\n paths = new Set();\n pathBytes = 0;\n claim(path) {\n if (this.paths.has(path)) throw new Error(`w7-frame: duplicate path ownership: ${path}`);\n if (this.paths.size >= W7_MAX_PATHS_PER_BATCH) {\n throw new Error(`w7-frame: batch exceeds ${W7_MAX_PATHS_PER_BATCH} owned paths`);\n }\n const nextPathBytes = this.pathBytes + new TextEncoder().encode(path).byteLength;\n if (nextPathBytes > W7_MAX_OWNED_PATH_BYTES) {\n throw new Error(\n `w7-frame: owned path bytes exceed ${W7_MAX_OWNED_PATH_BYTES}`\n );\n }\n this.paths.add(path);\n this.pathBytes = nextPathBytes;\n }\n};\nfunction claimPath(paths, path) {\n paths.claim(path);\n}\nfunction normalizePath(path) {\n const out = [];\n for (const segment of path.split(\"/\")) {\n if (segment === \"..\") {\n if (out.length > 0) out.pop();\n } else if (segment !== \"\" && segment !== \".\") {\n out.push(segment);\n }\n }\n return out.join(\"/\");\n}\nfunction parentPath(path) {\n const index = path.lastIndexOf(\"/\");\n return index < 0 ? \"\" : path.slice(0, index);\n}\nfunction boundedString(value, label, maxBytes) {\n if (typeof value !== \"string\" || value.length === 0) {\n throw new Error(`w7-frame: ${label} must be a non-empty string`);\n }\n const length = new TextEncoder().encode(value).byteLength;\n if (length > maxBytes) throw new Error(`w7-frame: ${label} exceeds ${maxBytes} bytes`);\n return value;\n}\nfunction safeInteger(value, label) {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(`w7-frame: ${label} must be a non-negative safe integer`);\n }\n return value;\n}\nfunction u32(value, label) {\n const integer = safeInteger(value, label);\n if (integer > 4294967295) throw new Error(`w7-frame: ${label} exceeds uint32`);\n return integer;\n}\nfunction sameSummary(left, right) {\n return left.recordCount === right.recordCount && left.pathCount === right.pathCount && left.deleteCount === right.deleteCount && left.directoryCount === right.directoryCount && left.fileCount === right.fileCount && left.chunkCount === right.chunkCount && left.byteCount === right.byteCount && left.check === right.check;\n}\nasync function readEnvelope(buffer, label) {\n const header = await buffer.readExact(5, `${label} header`);\n return { tag: header[0], length: readU32LE(header, 1), header };\n}\nfunction recordHeader(tag, length) {\n const header = new Uint8Array(5);\n header[0] = tag;\n writeU32LE(header, 1, length);\n return header;\n}\nfunction writeU32LE(out, offset, value) {\n out[offset] = value & 255;\n out[offset + 1] = value >>> 8 & 255;\n out[offset + 2] = value >>> 16 & 255;\n out[offset + 3] = value >>> 24 & 255;\n}\nfunction readU32LE(bytes, offset) {\n return (bytes[offset] | bytes[offset + 1] << 8 | bytes[offset + 2] << 16 | bytes[offset + 3] << 24) >>> 0;\n}\nfunction updateRecordCheck(seed, ...parts) {\n let check = seed;\n for (const part of parts) check = crc32(part, check);\n return check;\n}\nfunction noopRetention(bytes) {\n return { bytes, release() {\n } };\n}\nfunction decodeText(bytes, label) {\n try {\n return new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: false }).decode(bytes);\n } catch (error) {\n throw new Error(`w7-frame: invalid UTF-8 in ${label}: ${errorMessage(error)}`);\n }\n}\nfunction concatBytes(...parts) {\n const output = new Uint8Array(parts.reduce((total, part) => total + part.byteLength, 0));\n let offset = 0;\n for (const part of parts) {\n output.set(part, offset);\n offset += part.byteLength;\n }\n return output;\n}\nfunction bytesEqual(left, right) {\n return left.length === right.length && left.every((byte, index) => byte === right[index]);\n}\nfunction hex(bytes) {\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\")).join(\" \");\n}\nfunction isObject(value) {\n return typeof value === \"object\" && value !== null;\n}\nfunction errorMessage(error) {\n return error instanceof Error ? error.message : String(error);\n}\nfunction throwIfAborted(signal) {\n if (!signal?.aborted) return;\n throw new DOMException(\n signal.reason instanceof Error ? signal.reason.message : String(signal.reason ?? \"Aborted\"),\n \"AbortError\"\n );\n}\nasync function cancelReader(reader, reason) {\n try {\n await reader.cancel(reason);\n } catch {\n }\n try {\n reader.releaseLock();\n } catch {\n }\n}\nvar ExactByteReader = class {\n constructor(reader, signal) {\n this.reader = reader;\n this.signal = signal;\n }\n reader;\n signal;\n done = false;\n async read(read, cancel) {\n throwIfAborted(this.signal);\n const abort = () => {\n void cancel().catch(() => {\n });\n };\n this.signal?.addEventListener(\"abort\", abort, { once: true });\n try {\n const result = await read();\n throwIfAborted(this.signal);\n return result;\n } finally {\n this.signal?.removeEventListener(\"abort\", abort);\n }\n }\n async readExact(length, label) {\n if (length === 0) return new Uint8Array(0);\n const output = new Uint8Array(length);\n let offset = 0;\n while (offset < length) {\n if (this.done) {\n throw new Error(\n `w7-frame: stream ended ${offset} bytes into expected ${length}-byte ${label}`\n );\n }\n const next = await this.read(\n () => this.reader.read(new Uint8Array(length - offset)),\n () => this.reader.cancel(this.signal?.reason)\n );\n if (next.done) this.done = true;\n else if (next.value.byteLength > 0) {\n output.set(next.value, offset);\n offset += next.value.byteLength;\n }\n }\n return output;\n }\n async ensureEof(stream) {\n if (this.done) return;\n this.reader.releaseLock();\n const reader = stream.getReader();\n try {\n const next = await this.read(() => reader.read(), () => reader.cancel(this.signal?.reason));\n if (!next.done && next.value.byteLength > 0) {\n await reader.cancel(new Error(\"w7-frame: trailing bytes after batch-end\"));\n throw new Error(\"w7-frame: trailing bytes after batch-end\");\n }\n this.done = true;\n } finally {\n try {\n reader.releaseLock();\n } catch {\n }\n }\n }\n};";
24
25
  /** Declares `function createEsmResolver(host)`; the node shims call it. */
25
26
  export const ESM_RESOLVER_PREAMBLE = "function createEsmResolver(host) {\n const conditions = new Set([\"node\", \"import\", \"module-sync\"]);\n const ask = {\n *kind(path) {\n const kind = yield host.kind(path);\n return kind === \"file\" || kind === \"directory\" ? kind : null;\n },\n *readText(path) {\n const text = yield host.readText(path);\n return typeof text === \"string\" ? text : null;\n },\n *realpath(path) {\n const real = yield host.realpath(path);\n return typeof real === \"string\" ? real : path;\n },\n *cjsResolve(specifier, parentPath) {\n const found = yield host.cjsResolve(specifier, parentPath);\n return typeof found === \"string\" ? found : null;\n }\n };\n function codedError(Ctor, code, message) {\n return Object.assign(new Ctor(message), { code });\n }\n const codeOf = (error) => error !== null && typeof error === \"object\" && \"code\" in error ? error.code : void 0;\n const filePath = (url) => decodeURIComponent(new URL(String(url)).pathname);\n const fileUrl = (path) => {\n const url = new URL(\"file://\");\n url.pathname = path;\n return url;\n };\n function isRelativeSpecifier(specifier) {\n if (specifier[0] !== \".\") return false;\n if (specifier.length === 1 || specifier[1] === \"/\") return true;\n return specifier[1] === \".\" && (specifier.length === 2 || specifier[2] === \"/\");\n }\n const isRelativeOrAbsolute = (specifier) => specifier !== \"\" && (specifier[0] === \"/\" || isRelativeSpecifier(specifier));\n function* readPackageConfig(pjsonPath, specifier, base) {\n const text = (yield* ask.kind(pjsonPath)) === \"file\" ? yield* ask.readText(pjsonPath) : null;\n if (text === null) return { exists: false, pjsonPath, type: \"none\" };\n let parsed;\n try {\n parsed = JSON.parse(text);\n } catch {\n throw codedError(\n Error,\n \"ERR_INVALID_PACKAGE_CONFIG\",\n `Invalid package config ${pjsonPath}` + (base ? ` while importing ${JSON.stringify(specifier)} from ${base}` : \"\") + \".\"\n );\n }\n const config = { exists: true, pjsonPath, type: \"none\" };\n if (parsed === null || typeof parsed !== \"object\") return config;\n if (typeof parsed.name === \"string\") config.name = parsed.name;\n if (typeof parsed.main === \"string\") config.main = parsed.main;\n if (\"exports\" in parsed) config.exports = parsed.exports;\n if (parsed.imports !== null && typeof parsed.imports === \"object\") config.imports = parsed.imports;\n if (parsed.type === \"module\" || parsed.type === \"commonjs\") config.type = parsed.type;\n return config;\n }\n function* packageScopeConfig(resolved) {\n let pjsonUrl = new URL(\"./package.json\", resolved);\n while (true) {\n if (pjsonUrl.pathname.endsWith(\"node_modules/package.json\")) break;\n const config = yield* readPackageConfig(filePath(pjsonUrl), resolved.href, void 0);\n if (config.exists) return config;\n const last = pjsonUrl;\n pjsonUrl = new URL(\"../package.json\", pjsonUrl);\n if (pjsonUrl.pathname === last.pathname) break;\n }\n return { exists: false, pjsonPath: filePath(pjsonUrl), type: \"none\" };\n }\n function invalidPackageTarget(key, target, pjsonUrl, internal, base) {\n const text = typeof target === \"object\" && target !== null ? JSON.stringify(target, null, \"\") : `${target}`;\n const pkgPath = filePath(new URL(\".\", pjsonUrl));\n const related = !internal && text.length > 0 && !text.startsWith(\"./\");\n const tail = `in the package config ${pkgPath}package.json imported from ${base}${related ? '; targets must start with \"./\"' : \"\"}`;\n return codedError(\n Error,\n \"ERR_INVALID_PACKAGE_TARGET\",\n key === \".\" ? `Invalid \"exports\" main target ${JSON.stringify(text)} defined ${tail}` : `Invalid \"${internal ? \"imports\" : \"exports\"}\" target ${JSON.stringify(text)} defined for '${key}' ${tail}`\n );\n }\n const invalidSegment = /(^|\\\\|\\/)((\\.|%2e)(\\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\\\|\\/|$)/i;\n const deprecatedInvalidSegment = /(^|\\\\|\\/)((\\.|%2e)(\\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\\\|\\/|$)/i;\n function* resolveTargetString(target, subpath, match, pjsonUrl, base, pattern, internal, isPathMap) {\n if (subpath !== \"\" && !pattern && target[target.length - 1] !== \"/\") {\n throw invalidPackageTarget(match, target, pjsonUrl, internal, base);\n }\n if (!target.startsWith(\"./\")) {\n if (internal && !target.startsWith(\"../\") && !target.startsWith(\"/\")) {\n let isUrl = false;\n try {\n new URL(target);\n isUrl = true;\n } catch {\n }\n if (!isUrl) {\n const exportTarget = pattern ? target.replace(/\\*/g, () => subpath) : target + subpath;\n return yield* packageResolve(exportTarget, pjsonUrl.href);\n }\n }\n throw invalidPackageTarget(match, target, pjsonUrl, internal, base);\n }\n if (invalidSegment.test(target.slice(2)) && deprecatedInvalidSegment.test(target.slice(2))) {\n throw invalidPackageTarget(match, target, pjsonUrl, internal, base);\n }\n const resolved = new URL(target, pjsonUrl);\n if (!resolved.pathname.startsWith(new URL(\".\", pjsonUrl).pathname)) {\n throw invalidPackageTarget(match, target, pjsonUrl, internal, base);\n }\n if (subpath === \"\") return resolved;\n if (invalidSegment.test(subpath) && deprecatedInvalidSegment.test(subpath) && !isPathMap) {\n const request = pattern ? match.replace(\"*\", () => subpath) : match + subpath;\n throw codedError(\n TypeError,\n \"ERR_INVALID_MODULE_SPECIFIER\",\n `Invalid module \"${request}\" request is not a valid match in pattern \"${match}\" for the \"${internal ? \"imports\" : \"exports\"}\" resolution of ${filePath(pjsonUrl)} imported from ${base}`\n );\n }\n if (pattern) return new URL(resolved.href.replace(/\\*/g, () => subpath));\n return new URL(subpath, resolved);\n }\n function* resolveTarget(pjsonUrl, target, subpath, key, base, pattern, internal, isPathMap) {\n if (typeof target === \"string\") {\n return yield* resolveTargetString(target, subpath, key, pjsonUrl, base, pattern, internal, isPathMap);\n }\n if (Array.isArray(target)) {\n if (target.length === 0) return null;\n let lastException;\n for (const item of target) {\n let result;\n try {\n result = yield* resolveTarget(pjsonUrl, item, subpath, key, base, pattern, internal, isPathMap);\n } catch (error) {\n lastException = error;\n if (codeOf(error) === \"ERR_INVALID_PACKAGE_TARGET\") continue;\n throw error;\n }\n if (result === void 0) continue;\n if (result === null) {\n lastException = null;\n continue;\n }\n return result;\n }\n if (lastException === void 0 || lastException === null) return lastException;\n throw lastException;\n }\n if (typeof target === \"object\" && target !== null) {\n const keys = Object.getOwnPropertyNames(target);\n for (const condition of keys) {\n if (/^\\d+$/.test(condition) && String(Number(condition)) === condition && Number(condition) < 4294967295) {\n throw codedError(\n Error,\n \"ERR_INVALID_PACKAGE_CONFIG\",\n `Invalid package config ${filePath(pjsonUrl)} while importing ${fileUrl(base).href}. \"exports\" cannot contain numeric property keys.`\n );\n }\n }\n for (const condition of keys) {\n if (condition !== \"default\" && !conditions.has(condition)) continue;\n const result = yield* resolveTarget(\n pjsonUrl,\n Reflect.get(target, condition),\n subpath,\n key,\n base,\n pattern,\n internal,\n isPathMap\n );\n if (result === void 0) continue;\n return result;\n }\n return void 0;\n }\n if (target === null) return null;\n throw invalidPackageTarget(key, target, pjsonUrl, internal, base);\n }\n function patternKeyCompare(a, b) {\n const aStar = a.indexOf(\"*\");\n const bStar = b.indexOf(\"*\");\n const baseA = aStar === -1 ? a.length : aStar + 1;\n const baseB = bStar === -1 ? b.length : bStar + 1;\n if (baseA > baseB) return -1;\n if (baseB > baseA) return 1;\n if (aStar === -1) return 1;\n if (bStar === -1) return -1;\n if (a.length > b.length) return -1;\n if (b.length > a.length) return 1;\n return 0;\n }\n function bestPattern(map, name) {\n let best = \"\";\n let bestSubpath = \"\";\n for (const key of Object.getOwnPropertyNames(map)) {\n const star = key.indexOf(\"*\");\n if (star === -1 || !name.startsWith(key.slice(0, star))) continue;\n const trailer = key.slice(star + 1);\n if (name.length >= key.length && name.endsWith(trailer) && patternKeyCompare(best, key) === 1 && key.lastIndexOf(\"*\") === star) {\n best = key;\n bestSubpath = name.slice(star, name.length - trailer.length);\n }\n }\n return best ? { key: best, subpath: bestSubpath } : null;\n }\n function exportsNotFound(subpath, pjsonUrl, base) {\n const pkgPath = filePath(new URL(\".\", pjsonUrl));\n return codedError(\n Error,\n \"ERR_PACKAGE_PATH_NOT_EXPORTED\",\n subpath === \".\" ? `No \"exports\" main defined in ${pkgPath}package.json imported from ${base}` : `Package subpath '${subpath}' is not defined by \"exports\" in ${pkgPath}package.json imported from ${base}`\n );\n }\n function* packageExportsResolve(pjsonUrl, subpath, config, base) {\n let exports = config.exports;\n const isSugar = (() => {\n if (typeof exports === \"string\" || Array.isArray(exports)) return true;\n if (typeof exports !== \"object\" || exports === null) return false;\n let sugar = false;\n let i = 0;\n for (const key of Object.getOwnPropertyNames(exports)) {\n const current = key === \"\" || key[0] !== \".\";\n if (i++ === 0) sugar = current;\n else if (sugar !== current) {\n throw codedError(\n Error,\n \"ERR_INVALID_PACKAGE_CONFIG\",\n `Invalid package config ${filePath(pjsonUrl)} while importing ${fileUrl(base).href}. \"exports\" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`\n );\n }\n }\n return sugar;\n })();\n if (isSugar) exports = { \".\": exports };\n const map = exports;\n if (Object.prototype.hasOwnProperty.call(map, subpath) && !subpath.includes(\"*\") && !subpath.endsWith(\"/\")) {\n const result = yield* resolveTarget(pjsonUrl, map[subpath], \"\", subpath, base, false, false, false);\n if (result == null) throw exportsNotFound(subpath, pjsonUrl, base);\n return result;\n }\n const best = bestPattern(map, subpath);\n if (best) {\n const result = yield* resolveTarget(pjsonUrl, map[best.key], best.subpath, best.key, base, true, false, subpath.endsWith(\"/\"));\n if (result == null) throw exportsNotFound(subpath, pjsonUrl, base);\n return result;\n }\n throw exportsNotFound(subpath, pjsonUrl, base);\n }\n function* packageImportsResolve(name, baseUrl) {\n const base = filePath(baseUrl);\n if (name === \"#\" || name.startsWith(\"#/\") || name.endsWith(\"/\")) {\n throw codedError(TypeError, \"ERR_INVALID_MODULE_SPECIFIER\", `Invalid module \"${name}\" is not a valid internal imports specifier name imported from ${base}`);\n }\n const config = yield* packageScopeConfig(new URL(baseUrl));\n let pjsonUrl;\n if (config.exists) {\n pjsonUrl = fileUrl(config.pjsonPath);\n const imports = config.imports;\n if (imports) {\n if (Object.prototype.hasOwnProperty.call(imports, name) && !name.includes(\"*\")) {\n const result = yield* resolveTarget(pjsonUrl, imports[name], \"\", name, base, false, true, false);\n if (result != null) return result;\n } else {\n const best = bestPattern(imports, name);\n if (best) {\n const result = yield* resolveTarget(pjsonUrl, imports[best.key], best.subpath, best.key, base, true, true, false);\n if (result != null) return result;\n }\n }\n }\n }\n const where = pjsonUrl ? ` in package ${filePath(new URL(\".\", pjsonUrl))}package.json` : \"\";\n throw codedError(TypeError, \"ERR_PACKAGE_IMPORT_NOT_DEFINED\", `Package import specifier \"${name}\" is not defined${where} imported from ${base}`);\n }\n function* legacyMainResolve(pjsonUrl, config, base) {\n const tries = [];\n if (config.main !== void 0) {\n for (const suffix of [\"\", \".js\", \".json\", \".node\", \"/index.js\", \"/index.json\", \"/index.node\"]) tries.push(`./${config.main}${suffix}`);\n }\n tries.push(\"./index.js\", \"./index.json\", \"./index.node\");\n for (const candidate of tries) {\n const url = new URL(candidate, pjsonUrl);\n if ((yield* ask.kind(filePath(url))) === \"file\") return url;\n }\n const dir = fileUrl(filePath(new URL(\".\", pjsonUrl)).replace(/\\/+/g, \"/\"));\n const missing = filePath(new URL(config.main ?? \"index.js\", dir));\n throw codedError(Error, \"ERR_MODULE_NOT_FOUND\", `Cannot find package '${missing}' imported from ${base}`);\n }\n function* packageResolve(specifier, baseUrl) {\n if (host.isBuiltin(specifier)) return new URL(\"node:\" + specifier);\n const base = filePath(baseUrl);\n let separator = specifier.indexOf(\"/\");\n let valid = true;\n let scoped = false;\n if (specifier[0] === \"@\") {\n scoped = true;\n if (separator === -1 || specifier.length === 0) valid = false;\n else separator = specifier.indexOf(\"/\", separator + 1);\n }\n const name = separator === -1 ? specifier : specifier.slice(0, separator);\n if (/^\\.|%|\\\\/.test(name)) valid = false;\n if (!valid) {\n throw codedError(TypeError, \"ERR_INVALID_MODULE_SPECIFIER\", `Invalid module \"${specifier}\" is not a valid package name imported from ${base}`);\n }\n const subpath = \".\" + (separator === -1 ? \"\" : specifier.slice(separator));\n const self = yield* packageScopeConfig(new URL(baseUrl));\n if (self.exists && self.exports != null && self.name === name) {\n return yield* packageExportsResolve(fileUrl(self.pjsonPath), subpath, self, base);\n }\n let pjsonUrl = new URL(\"./node_modules/\" + name + \"/package.json\", baseUrl);\n let pjsonPath = filePath(pjsonUrl);\n let lastPath;\n do {\n if ((yield* ask.kind(pjsonPath.slice(0, pjsonPath.length - 13))) !== \"directory\") {\n lastPath = pjsonPath;\n pjsonUrl = new URL((scoped ? \"../../../../node_modules/\" : \"../../../node_modules/\") + name + \"/package.json\", pjsonUrl);\n pjsonPath = filePath(pjsonUrl);\n continue;\n }\n const config = yield* readPackageConfig(pjsonPath, specifier, base);\n if (config.exports != null) return yield* packageExportsResolve(pjsonUrl, subpath, config, base);\n if (subpath === \".\") return yield* legacyMainResolve(pjsonUrl, config, base);\n return new URL(subpath, pjsonUrl);\n } while (pjsonPath.length !== lastPath.length);\n throw codedError(Error, \"ERR_MODULE_NOT_FOUND\", `Cannot find package '${name}' imported from ${base}`);\n }\n function* formatOf(url, path) {\n const base = path.slice(path.lastIndexOf(\"/\") + 1);\n const dot = base.lastIndexOf(\".\");\n const ext = dot > 0 ? base.slice(dot) : \"\";\n if (ext === \".mjs\" || ext === \".mts\") return \"module\";\n if (ext === \".cjs\" || ext === \".cts\") return \"commonjs\";\n if (ext === \".json\") return \"json\";\n if (ext === \".js\" || ext === \".ts\" || ext === \"\") {\n const type = (yield* packageScopeConfig(url)).type;\n if (type === \"module\") return \"module\";\n if (type === \"commonjs\") return \"commonjs\";\n return \"detect\";\n }\n throw codedError(TypeError, \"ERR_UNKNOWN_FILE_EXTENSION\", `Unknown file extension \"${ext}\" for ${path}`);\n }\n function* finalizeResolution(resolved, baseUrl) {\n const base = filePath(baseUrl);\n if (/%2f|%5c/i.test(resolved.pathname)) {\n throw codedError(\n TypeError,\n \"ERR_INVALID_MODULE_SPECIFIER\",\n `Invalid module \"${resolved.pathname}\" must not include encoded \"/\" or \"\\\\\" characters imported from ${base}`\n );\n }\n const path = filePath(resolved);\n const kind = path.endsWith(\"/\") ? \"directory\" : yield* ask.kind(path);\n if (kind === \"directory\") {\n throw Object.assign(\n codedError(Error, \"ERR_UNSUPPORTED_DIR_IMPORT\", `Directory import '${path}' is not supported resolving ES modules imported from ${base}`),\n { url: resolved.href }\n );\n }\n if (kind !== \"file\") {\n throw Object.assign(\n codedError(Error, \"ERR_MODULE_NOT_FOUND\", `Cannot find module '${path}' imported from ${base}`),\n { url: resolved.href }\n );\n }\n const real = yield* ask.realpath(path);\n const url = fileUrl(real);\n url.search = resolved.search;\n url.hash = resolved.hash;\n return { url: url.href, path: real };\n }\n function* moduleResolve(specifier, parentUrl) {\n let resolved;\n if (isRelativeOrAbsolute(specifier)) resolved = new URL(specifier, parentUrl);\n else if (specifier[0] === \"#\") resolved = yield* packageImportsResolve(specifier, parentUrl);\n else {\n try {\n resolved = new URL(specifier);\n } catch {\n resolved = yield* packageResolve(specifier, parentUrl);\n }\n }\n if (resolved.protocol === \"node:\") return { url: \"node:\" + resolved.pathname, builtin: resolved.pathname };\n if (resolved.protocol !== \"file:\") return { url: resolved.href };\n return yield* finalizeResolution(resolved, parentUrl);\n }\n function* loadable(resolved) {\n if (resolved.builtin !== void 0) {\n if (!host.isBuiltin(\"node:\" + resolved.builtin)) {\n throw codedError(Error, \"ERR_UNKNOWN_BUILTIN_MODULE\", `No such built-in module: node:${resolved.builtin}`);\n }\n return { url: resolved.url, builtin: resolved.builtin, format: \"builtin\" };\n }\n if (resolved.url.startsWith(\"data:\")) return { url: resolved.url, format: \"data\" };\n if (resolved.path === void 0) {\n throw codedError(\n Error,\n \"ERR_UNSUPPORTED_ESM_URL_SCHEME\",\n `Only URLs with a scheme in: file and data are supported by the default ESM loader. Received protocol '${new URL(resolved.url).protocol}'`\n );\n }\n return { url: resolved.url, path: resolved.path, format: yield* formatOf(new URL(resolved.url), resolved.path) };\n }\n function* commonJsHint(specifier, parentUrl) {\n let found = yield* ask.cjsResolve(specifier, filePath(parentUrl));\n if (found === null) return null;\n if (isRelativeSpecifier(specifier)) {\n const from = parentUrl.slice(\"file://\".length, parentUrl.lastIndexOf(\"/\")).split(\"/\").filter(Boolean);\n const to = fileUrl(found).pathname.split(\"/\").filter(Boolean);\n let common = 0;\n while (common < from.length && common < to.length && from[common] === to[common]) common++;\n found = [...from.slice(common).map(() => \"..\"), ...to.slice(common)].join(\"/\");\n if (!found.startsWith(\"../\")) found = `./${found}`;\n } else if (specifier[0] && specifier[0] !== \"/\" && specifier[0] !== \".\") {\n const slash = specifier.indexOf(\"/\");\n const pkg = slash === -1 ? specifier : specifier.slice(0, slash);\n const needle = `/node_modules/${pkg}/`;\n const at = found.lastIndexOf(needle);\n found = at !== -1 ? pkg + \"/\" + found.slice(at + needle.length).split(\"/\").map(encodeURIComponent).join(\"/\") : fileUrl(found).href;\n }\n return found;\n }\n function* resolveWithHint(specifier, parentUrl) {\n try {\n return yield* moduleResolve(specifier, parentUrl);\n } catch (error) {\n const code = codeOf(error);\n if (error instanceof Error && (code === \"ERR_MODULE_NOT_FOUND\" || code === \"ERR_UNSUPPORTED_DIR_IMPORT\")) {\n const asGiven = specifier.startsWith(\"file://\") ? filePath(specifier) : specifier;\n const found = yield* commonJsHint(asGiven, parentUrl);\n if (found && found !== asGiven) error.message += `\nDid you mean to import ${JSON.stringify(found)}?`;\n }\n throw error;\n }\n }\n function* importTarget(specifier, parentUrl) {\n return yield* loadable(yield* resolveWithHint(specifier, parentUrl));\n }\n function* metaResolve(specifier, parentUrl) {\n try {\n return (yield* moduleResolve(specifier, parentUrl)).url;\n } catch (error) {\n const code = codeOf(error);\n if ((code === \"ERR_MODULE_NOT_FOUND\" || code === \"ERR_UNSUPPORTED_DIR_IMPORT\") && error !== null && typeof error === \"object\" && \"url\" in error && typeof error.url === \"string\") return error.url;\n throw error;\n }\n }\n function runSync(steps) {\n let next = steps.next();\n while (!next.done) {\n if (next.value instanceof Promise) throw new Error(\"resolveSync: the host answered asynchronously\");\n next = steps.next(next.value);\n }\n return next.value;\n }\n return {\n async resolve(specifier, parentUrl) {\n const steps = importTarget(specifier, parentUrl);\n let next = steps.next();\n while (!next.done) {\n let answer;\n try {\n answer = await next.value;\n } catch (error) {\n next = steps.throw(error);\n continue;\n }\n next = steps.next(answer);\n }\n return next.value;\n },\n resolveSync: (specifier, parentUrl) => runSync(importTarget(specifier, parentUrl)),\n metaResolveSync: (specifier, parentUrl) => runSync(metaResolve(specifier, parentUrl)),\n validateAttributes(url, format, attributes) {\n for (const key of Object.keys(attributes)) {\n if (key !== \"type\") {\n throw codedError(TypeError, \"ERR_IMPORT_ATTRIBUTE_UNSUPPORTED\", `Import attribute \"${key}\" with value \"${attributes[key]}\" is not supported in ${url}`);\n }\n }\n const type = attributes.type;\n if (format === \"json\" || format === \"data\" && /^data:application\\/json(?:;[^,]*)?,/.test(url)) {\n if (type === \"json\") return;\n if (!(\"type\" in attributes)) {\n throw codedError(TypeError, \"ERR_IMPORT_ATTRIBUTE_MISSING\", `Module \"${url}\" needs an import attribute of \"type: json\"`);\n }\n } else if (type == null) {\n return;\n }\n if (typeof type !== \"string\") {\n throw codedError(TypeError, \"ERR_INVALID_ARG_TYPE\", `The \"type\" argument must be of type string. Received ${typeof type}`);\n }\n if (type !== \"json\") {\n throw codedError(TypeError, \"ERR_IMPORT_ATTRIBUTE_UNSUPPORTED\", `Import attribute \"type\" with value \"${type}\" is not supported in ${url}`);\n }\n throw codedError(TypeError, \"ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE\", `Module \"${url}\" is not of type \"json\"`);\n }\n };\n}";
27
+ /** Declares `function createHttp2Module(host)`; the node shims call it. */
28
+ export const HTTP2_MODULE_PREAMBLE = "function createHttp2Module(host) {\n const nodeError = (Base, code, message, props = {}) => Object.assign(new Base(message), { code }, props);\n const notSupported = (op) => nodeError(Error, \"ERR_HTTP2_NOT_SUPPORTED\", `http2.${op}: not implemented in Nimbus. Use fetch() or HTTP/1.1.`);\n const describe = (value) => {\n if (value === null) return \"null\";\n if (value === void 0) return \"undefined\";\n switch (typeof value) {\n case \"bigint\":\n return `type bigint (${value}n)`;\n case \"number\":\n if (Object.is(value, -0)) return \"type number (-0)\";\n return `type number (${value})`;\n case \"boolean\":\n return `type boolean (${value})`;\n case \"symbol\":\n return `type symbol (${String(value)})`;\n case \"function\":\n return `function ${value.name}`;\n case \"string\": {\n const shown = value.length > 28 ? `${value.slice(0, 25)}...` : value;\n return shown.includes(\"'\") ? `type string (${JSON.stringify(shown)})` : `type string ('${shown}')`;\n }\n default: {\n const ctor = Reflect.get(Object(value), \"constructor\");\n return typeof ctor === \"function\" && ctor.name ? `an instance of ${ctor.name}` : String(value);\n }\n }\n };\n const invalidArgType = (name, expected, value) => nodeError(TypeError, \"ERR_INVALID_ARG_TYPE\", `The \"${name}\" argument must be ${expected}. Received ${describe(value)}`);\n const invalidSetting = (Base, name, actual, min, max) => nodeError(\n Base,\n \"ERR_HTTP2_INVALID_SETTING_VALUE\",\n `Invalid value for setting \"${name}\": ${String(actual)}`,\n min === void 0 ? { actual } : { actual, min, max }\n );\n const MAX_INT = 2 ** 32 - 1;\n const MAX_ADDITIONAL_SETTINGS = 10;\n const HEADER_TABLE_SIZE = 1;\n const ENABLE_PUSH = 2;\n const MAX_CONCURRENT_STREAMS = 3;\n const INITIAL_WINDOW_SIZE = 4;\n const MAX_FRAME_SIZE = 5;\n const MAX_HEADER_LIST_SIZE = 6;\n const ENABLE_CONNECT_PROTOCOL = 8;\n const NO_RFC7540_PRIORITIES = 9;\n const isObjectArg = (value) => value === void 0 || value !== null && typeof value === \"object\" && !Array.isArray(value);\n const withinRange = (name, value, min, max) => {\n if (value !== void 0 && (typeof value !== \"number\" || value < min || value > max)) {\n throw invalidSetting(RangeError, name, value, min, max);\n }\n };\n const validate = (settings) => {\n if (settings === void 0) return;\n if (!isObjectArg(settings.customSettings)) throw invalidArgType(\"customSettings\", \"an instance of Number\", settings.customSettings);\n if (settings.customSettings) {\n const entries = Object.entries(settings.customSettings);\n if (entries.length > MAX_ADDITIONAL_SETTINGS) {\n throw nodeError(Error, \"ERR_HTTP2_TOO_MANY_CUSTOM_SETTINGS\", \"Number of custom settings exceeds MAX_ADDITIONAL_SETTINGS\");\n }\n for (const [key, value] of entries) {\n withinRange(\"customSettings:id\", Number(key), 0, 65535);\n withinRange(\"customSettings:value\", Number(value), 0, MAX_INT);\n }\n }\n withinRange(\"headerTableSize\", settings.headerTableSize, 0, MAX_INT);\n withinRange(\"initialWindowSize\", settings.initialWindowSize, 0, 2 ** 31 - 1);\n withinRange(\"maxFrameSize\", settings.maxFrameSize, 16384, 2 ** 24 - 1);\n withinRange(\"maxConcurrentStreams\", settings.maxConcurrentStreams, 0, MAX_INT);\n withinRange(\"maxHeaderListSize\", settings.maxHeaderListSize, 0, MAX_INT);\n withinRange(\"maxHeaderSize\", settings.maxHeaderSize, 0, MAX_INT);\n for (const name of [\"enablePush\", \"enableConnectProtocol\"]) {\n const value = settings[name];\n if (value !== void 0 && typeof value !== \"boolean\") throw invalidSetting(TypeError, name, value);\n }\n };\n function getDefaultSettings() {\n const settings = Object.create(null);\n settings.headerTableSize = 4096;\n settings.enablePush = true;\n settings.initialWindowSize = 65535;\n settings.maxFrameSize = 16384;\n settings.maxConcurrentStreams = MAX_INT;\n settings.maxHeaderListSize = settings.maxHeaderSize = 65535;\n settings.enableConnectProtocol = false;\n return settings;\n }\n function getPackedSettings(settings) {\n if (!isObjectArg(settings)) throw invalidArgType(\"settings\", \"of type object\", settings);\n validate(settings);\n const given = { ...settings };\n const slots = [\n \"headerTableSize\",\n \"enablePush\",\n \"initialWindowSize\",\n \"maxFrameSize\",\n \"maxConcurrentStreams\",\n \"maxHeaderListSize\",\n \"enableConnectProtocol\"\n ];\n const known = new Map();\n const custom = new Map();\n if (typeof given.customSettings === \"object\") {\n for (const key in given.customSettings) {\n const value = given.customSettings[key];\n if (typeof value !== \"number\") continue;\n const id = Number(key);\n if (Number.isNaN(id) || id <= 0 || id > 65535) throw invalidSetting(RangeError, \"Range Error\", id, 0, 65535);\n if (Number.isNaN(value) || value <= 0 || value > 4294967295) throw invalidSetting(RangeError, \"Range Error\", value, 0, 4294967295);\n if (id < slots.length) known.set(slots[id], value);\n else {\n if (!custom.has(id) && custom.size === MAX_ADDITIONAL_SETTINGS) {\n throw nodeError(Error, \"ERR_HTTP2_TOO_MANY_CUSTOM_SETTINGS\", \"Number of custom settings exceeds MAX_ADDITIONAL_SETTINGS\");\n }\n custom.set(id, value);\n }\n }\n }\n for (const name of [\"headerTableSize\", \"maxConcurrentStreams\", \"initialWindowSize\", \"maxFrameSize\"]) {\n const value = given[name];\n if (typeof value === \"number\") known.set(name, value);\n }\n if (typeof given.maxHeaderListSize === \"number\" || typeof given.maxHeaderSize === \"number\") {\n if (given.maxHeaderSize !== void 0 && given.maxHeaderSize !== given.maxHeaderListSize) {\n host.emitWarning?.(\"settings.maxHeaderSize overwrite settings.maxHeaderListSize\");\n known.set(\"maxHeaderListSize\", Number(given.maxHeaderSize));\n } else {\n known.set(\"maxHeaderListSize\", Number(given.maxHeaderListSize));\n }\n }\n for (const name of [\"enablePush\", \"enableConnectProtocol\"]) {\n const value = given[name];\n if (typeof value === \"boolean\") known.set(name, Number(value));\n }\n const ids = {\n headerTableSize: HEADER_TABLE_SIZE,\n enablePush: ENABLE_PUSH,\n maxConcurrentStreams: MAX_CONCURRENT_STREAMS,\n initialWindowSize: INITIAL_WINDOW_SIZE,\n maxFrameSize: MAX_FRAME_SIZE,\n maxHeaderListSize: MAX_HEADER_LIST_SIZE,\n enableConnectProtocol: ENABLE_CONNECT_PROTOCOL\n };\n const entries = [];\n for (const name of [\n \"headerTableSize\",\n \"enablePush\",\n \"maxConcurrentStreams\",\n \"initialWindowSize\",\n \"maxFrameSize\",\n \"maxHeaderListSize\",\n \"enableConnectProtocol\"\n ]) {\n const value = known.get(name);\n if (value !== void 0) entries.push([ids[name], value >>> 0]);\n }\n for (const [id, value] of custom) entries.push([id, value >>> 0]);\n for (const [id, value] of entries) {\n if ((id === ENABLE_PUSH || id === ENABLE_CONNECT_PROTOCOL || id === NO_RFC7540_PRIORITIES) && value > 1) return void 0;\n if (id === INITIAL_WINDOW_SIZE && value > 2 ** 31 - 1) return void 0;\n if (id === MAX_FRAME_SIZE && (value < 16384 || value > 2 ** 24 - 1)) return void 0;\n }\n const out = host.Buffer.alloc(entries.length * 6);\n const view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n entries.forEach(([id, value], i) => {\n view.setUint16(i * 6, id);\n view.setUint32(i * 6 + 2, value);\n });\n return out;\n }\n function getUnpackedSettings(buf, options = {}) {\n if (!ArrayBuffer.isView(buf) || Reflect.get(buf, \"length\") === void 0) {\n throw invalidArgType(\"buf\", \"an instance of Buffer or TypedArray\", buf);\n }\n if (buf.length % 6 !== 0) {\n throw nodeError(RangeError, \"ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH\", \"Packed settings length must be a multiple of six\");\n }\n const settings = {};\n for (let offset = 0; offset < buf.length; offset += 6) {\n const id = buf[offset] * 2 ** 8 + buf[offset + 1];\n const value = buf[offset + 2] * 2 ** 24 + buf[offset + 3] * 2 ** 16 + buf[offset + 4] * 2 ** 8 + buf[offset + 5];\n switch (id) {\n case HEADER_TABLE_SIZE:\n settings.headerTableSize = value;\n break;\n case ENABLE_PUSH:\n settings.enablePush = value !== 0;\n break;\n case MAX_CONCURRENT_STREAMS:\n settings.maxConcurrentStreams = value;\n break;\n case INITIAL_WINDOW_SIZE:\n settings.initialWindowSize = value;\n break;\n case MAX_FRAME_SIZE:\n settings.maxFrameSize = value;\n break;\n case MAX_HEADER_LIST_SIZE:\n settings.maxHeaderListSize = settings.maxHeaderSize = value;\n break;\n case ENABLE_CONNECT_PROTOCOL:\n settings.enableConnectProtocol = value !== 0;\n break;\n default:\n (settings.customSettings ??= {})[id] = value;\n }\n }\n if (options != null && options.validate) validate(settings);\n return settings;\n }\n class ClientHttp2Session extends host.EventEmitter {\n destroyed = false;\n closed = false;\n constructor() {\n super();\n queueMicrotask(() => this.emit(\"error\", notSupported(\"connect\")));\n }\n request() {\n throw notSupported(\"request\");\n }\n settings() {\n }\n close(callback) {\n this.closed = true;\n queueMicrotask(() => {\n this.emit(\"close\");\n callback?.();\n });\n }\n destroy(error) {\n this.destroyed = true;\n if (error) this.emit(\"error\", error);\n this.emit(\"close\");\n }\n }\n function connect(_authority, _options, _listener) {\n return new ClientHttp2Session();\n }\n function createServer(_options, _onRequestHandler) {\n throw notSupported(\"createServer\");\n }\n function createSecureServer(_options, _onRequestHandler) {\n throw notSupported(\"createSecureServer\");\n }\n function performServerHandshake(_socket, _options = {}) {\n throw notSupported(\"performServerHandshake\");\n }\n class Http2ServerRequest extends host.Readable {\n constructor(_stream, _headers, _options, _rawHeaders) {\n super();\n throw notSupported(\"Http2ServerRequest\");\n }\n }\n class Http2ServerResponse extends host.Stream {\n constructor(_stream, _options) {\n super();\n throw notSupported(\"Http2ServerResponse\");\n }\n }\n const constants = {\n NGHTTP2_ERR_FRAME_SIZE_ERROR: -522,\n NGHTTP2_SESSION_SERVER: 0,\n NGHTTP2_SESSION_CLIENT: 1,\n NGHTTP2_STREAM_STATE_IDLE: 1,\n NGHTTP2_STREAM_STATE_OPEN: 2,\n NGHTTP2_STREAM_STATE_RESERVED_LOCAL: 3,\n NGHTTP2_STREAM_STATE_RESERVED_REMOTE: 4,\n NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: 5,\n NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: 6,\n NGHTTP2_STREAM_STATE_CLOSED: 7,\n NGHTTP2_FLAG_NONE: 0,\n NGHTTP2_FLAG_END_STREAM: 1,\n NGHTTP2_FLAG_END_HEADERS: 4,\n NGHTTP2_FLAG_ACK: 1,\n NGHTTP2_FLAG_PADDED: 8,\n NGHTTP2_FLAG_PRIORITY: 32,\n DEFAULT_SETTINGS_HEADER_TABLE_SIZE: 4096,\n DEFAULT_SETTINGS_ENABLE_PUSH: 1,\n DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS: 4294967295,\n DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: 65535,\n DEFAULT_SETTINGS_MAX_FRAME_SIZE: 16384,\n DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE: 65535,\n DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL: 0,\n MAX_MAX_FRAME_SIZE: 16777215,\n MIN_MAX_FRAME_SIZE: 16384,\n MAX_INITIAL_WINDOW_SIZE: 2147483647,\n NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: 1,\n NGHTTP2_SETTINGS_ENABLE_PUSH: 2,\n NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: 3,\n NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: 4,\n NGHTTP2_SETTINGS_MAX_FRAME_SIZE: 5,\n NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: 6,\n NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: 8,\n PADDING_STRATEGY_NONE: 0,\n PADDING_STRATEGY_ALIGNED: 1,\n PADDING_STRATEGY_MAX: 2,\n PADDING_STRATEGY_CALLBACK: 1,\n NGHTTP2_NO_ERROR: 0,\n NGHTTP2_PROTOCOL_ERROR: 1,\n NGHTTP2_INTERNAL_ERROR: 2,\n NGHTTP2_FLOW_CONTROL_ERROR: 3,\n NGHTTP2_SETTINGS_TIMEOUT: 4,\n NGHTTP2_STREAM_CLOSED: 5,\n NGHTTP2_FRAME_SIZE_ERROR: 6,\n NGHTTP2_REFUSED_STREAM: 7,\n NGHTTP2_CANCEL: 8,\n NGHTTP2_COMPRESSION_ERROR: 9,\n NGHTTP2_CONNECT_ERROR: 10,\n NGHTTP2_ENHANCE_YOUR_CALM: 11,\n NGHTTP2_INADEQUATE_SECURITY: 12,\n NGHTTP2_HTTP_1_1_REQUIRED: 13,\n NGHTTP2_DEFAULT_WEIGHT: 16,\n HTTP2_HEADER_STATUS: \":status\",\n HTTP2_HEADER_METHOD: \":method\",\n HTTP2_HEADER_AUTHORITY: \":authority\",\n HTTP2_HEADER_SCHEME: \":scheme\",\n HTTP2_HEADER_PATH: \":path\",\n HTTP2_HEADER_PROTOCOL: \":protocol\",\n HTTP2_HEADER_ACCEPT_ENCODING: \"accept-encoding\",\n HTTP2_HEADER_ACCEPT_LANGUAGE: \"accept-language\",\n HTTP2_HEADER_ACCEPT_RANGES: \"accept-ranges\",\n HTTP2_HEADER_ACCEPT: \"accept\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: \"access-control-allow-credentials\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: \"access-control-allow-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: \"access-control-allow-methods\",\n HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: \"access-control-allow-origin\",\n HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: \"access-control-expose-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: \"access-control-request-headers\",\n HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: \"access-control-request-method\",\n HTTP2_HEADER_AGE: \"age\",\n HTTP2_HEADER_AUTHORIZATION: \"authorization\",\n HTTP2_HEADER_CACHE_CONTROL: \"cache-control\",\n HTTP2_HEADER_CONNECTION: \"connection\",\n HTTP2_HEADER_CONTENT_DISPOSITION: \"content-disposition\",\n HTTP2_HEADER_CONTENT_ENCODING: \"content-encoding\",\n HTTP2_HEADER_CONTENT_LENGTH: \"content-length\",\n HTTP2_HEADER_CONTENT_TYPE: \"content-type\",\n HTTP2_HEADER_COOKIE: \"cookie\",\n HTTP2_HEADER_DATE: \"date\",\n HTTP2_HEADER_ETAG: \"etag\",\n HTTP2_HEADER_FORWARDED: \"forwarded\",\n HTTP2_HEADER_HOST: \"host\",\n HTTP2_HEADER_IF_MODIFIED_SINCE: \"if-modified-since\",\n HTTP2_HEADER_IF_NONE_MATCH: \"if-none-match\",\n HTTP2_HEADER_IF_RANGE: \"if-range\",\n HTTP2_HEADER_LAST_MODIFIED: \"last-modified\",\n HTTP2_HEADER_LINK: \"link\",\n HTTP2_HEADER_LOCATION: \"location\",\n HTTP2_HEADER_RANGE: \"range\",\n HTTP2_HEADER_REFERER: \"referer\",\n HTTP2_HEADER_SERVER: \"server\",\n HTTP2_HEADER_SET_COOKIE: \"set-cookie\",\n HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: \"strict-transport-security\",\n HTTP2_HEADER_TRANSFER_ENCODING: \"transfer-encoding\",\n HTTP2_HEADER_TE: \"te\",\n HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS: \"upgrade-insecure-requests\",\n HTTP2_HEADER_UPGRADE: \"upgrade\",\n HTTP2_HEADER_USER_AGENT: \"user-agent\",\n HTTP2_HEADER_VARY: \"vary\",\n HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS: \"x-content-type-options\",\n HTTP2_HEADER_X_FRAME_OPTIONS: \"x-frame-options\",\n HTTP2_HEADER_KEEP_ALIVE: \"keep-alive\",\n HTTP2_HEADER_PROXY_CONNECTION: \"proxy-connection\",\n HTTP2_HEADER_X_XSS_PROTECTION: \"x-xss-protection\",\n HTTP2_HEADER_ALT_SVC: \"alt-svc\",\n HTTP2_HEADER_CONTENT_SECURITY_POLICY: \"content-security-policy\",\n HTTP2_HEADER_EARLY_DATA: \"early-data\",\n HTTP2_HEADER_EXPECT_CT: \"expect-ct\",\n HTTP2_HEADER_ORIGIN: \"origin\",\n HTTP2_HEADER_PURPOSE: \"purpose\",\n HTTP2_HEADER_TIMING_ALLOW_ORIGIN: \"timing-allow-origin\",\n HTTP2_HEADER_X_FORWARDED_FOR: \"x-forwarded-for\",\n HTTP2_HEADER_PRIORITY: \"priority\",\n HTTP2_HEADER_ACCEPT_CHARSET: \"accept-charset\",\n HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE: \"access-control-max-age\",\n HTTP2_HEADER_ALLOW: \"allow\",\n HTTP2_HEADER_CONTENT_LANGUAGE: \"content-language\",\n HTTP2_HEADER_CONTENT_LOCATION: \"content-location\",\n HTTP2_HEADER_CONTENT_MD5: \"content-md5\",\n HTTP2_HEADER_CONTENT_RANGE: \"content-range\",\n HTTP2_HEADER_DNT: \"dnt\",\n HTTP2_HEADER_EXPECT: \"expect\",\n HTTP2_HEADER_EXPIRES: \"expires\",\n HTTP2_HEADER_FROM: \"from\",\n HTTP2_HEADER_IF_MATCH: \"if-match\",\n HTTP2_HEADER_IF_UNMODIFIED_SINCE: \"if-unmodified-since\",\n HTTP2_HEADER_MAX_FORWARDS: \"max-forwards\",\n HTTP2_HEADER_PREFER: \"prefer\",\n HTTP2_HEADER_PROXY_AUTHENTICATE: \"proxy-authenticate\",\n HTTP2_HEADER_PROXY_AUTHORIZATION: \"proxy-authorization\",\n HTTP2_HEADER_REFRESH: \"refresh\",\n HTTP2_HEADER_RETRY_AFTER: \"retry-after\",\n HTTP2_HEADER_TRAILER: \"trailer\",\n HTTP2_HEADER_TK: \"tk\",\n HTTP2_HEADER_VIA: \"via\",\n HTTP2_HEADER_WARNING: \"warning\",\n HTTP2_HEADER_WWW_AUTHENTICATE: \"www-authenticate\",\n HTTP2_HEADER_HTTP2_SETTINGS: \"http2-settings\",\n HTTP2_METHOD_ACL: \"ACL\",\n HTTP2_METHOD_BASELINE_CONTROL: \"BASELINE-CONTROL\",\n HTTP2_METHOD_BIND: \"BIND\",\n HTTP2_METHOD_CHECKIN: \"CHECKIN\",\n HTTP2_METHOD_CHECKOUT: \"CHECKOUT\",\n HTTP2_METHOD_CONNECT: \"CONNECT\",\n HTTP2_METHOD_COPY: \"COPY\",\n HTTP2_METHOD_DELETE: \"DELETE\",\n HTTP2_METHOD_GET: \"GET\",\n HTTP2_METHOD_HEAD: \"HEAD\",\n HTTP2_METHOD_LABEL: \"LABEL\",\n HTTP2_METHOD_LINK: \"LINK\",\n HTTP2_METHOD_LOCK: \"LOCK\",\n HTTP2_METHOD_MERGE: \"MERGE\",\n HTTP2_METHOD_MKACTIVITY: \"MKACTIVITY\",\n HTTP2_METHOD_MKCALENDAR: \"MKCALENDAR\",\n HTTP2_METHOD_MKCOL: \"MKCOL\",\n HTTP2_METHOD_MKREDIRECTREF: \"MKREDIRECTREF\",\n HTTP2_METHOD_MKWORKSPACE: \"MKWORKSPACE\",\n HTTP2_METHOD_MOVE: \"MOVE\",\n HTTP2_METHOD_OPTIONS: \"OPTIONS\",\n HTTP2_METHOD_ORDERPATCH: \"ORDERPATCH\",\n HTTP2_METHOD_PATCH: \"PATCH\",\n HTTP2_METHOD_POST: \"POST\",\n HTTP2_METHOD_PRI: \"PRI\",\n HTTP2_METHOD_PROPFIND: \"PROPFIND\",\n HTTP2_METHOD_PROPPATCH: \"PROPPATCH\",\n HTTP2_METHOD_PUT: \"PUT\",\n HTTP2_METHOD_REBIND: \"REBIND\",\n HTTP2_METHOD_REPORT: \"REPORT\",\n HTTP2_METHOD_SEARCH: \"SEARCH\",\n HTTP2_METHOD_TRACE: \"TRACE\",\n HTTP2_METHOD_UNBIND: \"UNBIND\",\n HTTP2_METHOD_UNCHECKOUT: \"UNCHECKOUT\",\n HTTP2_METHOD_UNLINK: \"UNLINK\",\n HTTP2_METHOD_UNLOCK: \"UNLOCK\",\n HTTP2_METHOD_UPDATE: \"UPDATE\",\n HTTP2_METHOD_UPDATEREDIRECTREF: \"UPDATEREDIRECTREF\",\n HTTP2_METHOD_VERSION_CONTROL: \"VERSION-CONTROL\",\n HTTP_STATUS_CONTINUE: 100,\n HTTP_STATUS_SWITCHING_PROTOCOLS: 101,\n HTTP_STATUS_PROCESSING: 102,\n HTTP_STATUS_EARLY_HINTS: 103,\n HTTP_STATUS_OK: 200,\n HTTP_STATUS_CREATED: 201,\n HTTP_STATUS_ACCEPTED: 202,\n HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: 203,\n HTTP_STATUS_NO_CONTENT: 204,\n HTTP_STATUS_RESET_CONTENT: 205,\n HTTP_STATUS_PARTIAL_CONTENT: 206,\n HTTP_STATUS_MULTI_STATUS: 207,\n HTTP_STATUS_ALREADY_REPORTED: 208,\n HTTP_STATUS_IM_USED: 226,\n HTTP_STATUS_MULTIPLE_CHOICES: 300,\n HTTP_STATUS_MOVED_PERMANENTLY: 301,\n HTTP_STATUS_FOUND: 302,\n HTTP_STATUS_SEE_OTHER: 303,\n HTTP_STATUS_NOT_MODIFIED: 304,\n HTTP_STATUS_USE_PROXY: 305,\n HTTP_STATUS_TEMPORARY_REDIRECT: 307,\n HTTP_STATUS_PERMANENT_REDIRECT: 308,\n HTTP_STATUS_BAD_REQUEST: 400,\n HTTP_STATUS_UNAUTHORIZED: 401,\n HTTP_STATUS_PAYMENT_REQUIRED: 402,\n HTTP_STATUS_FORBIDDEN: 403,\n HTTP_STATUS_NOT_FOUND: 404,\n HTTP_STATUS_METHOD_NOT_ALLOWED: 405,\n HTTP_STATUS_NOT_ACCEPTABLE: 406,\n HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: 407,\n HTTP_STATUS_REQUEST_TIMEOUT: 408,\n HTTP_STATUS_CONFLICT: 409,\n HTTP_STATUS_GONE: 410,\n HTTP_STATUS_LENGTH_REQUIRED: 411,\n HTTP_STATUS_PRECONDITION_FAILED: 412,\n HTTP_STATUS_PAYLOAD_TOO_LARGE: 413,\n HTTP_STATUS_URI_TOO_LONG: 414,\n HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: 415,\n HTTP_STATUS_RANGE_NOT_SATISFIABLE: 416,\n HTTP_STATUS_EXPECTATION_FAILED: 417,\n HTTP_STATUS_TEAPOT: 418,\n HTTP_STATUS_MISDIRECTED_REQUEST: 421,\n HTTP_STATUS_UNPROCESSABLE_ENTITY: 422,\n HTTP_STATUS_LOCKED: 423,\n HTTP_STATUS_FAILED_DEPENDENCY: 424,\n HTTP_STATUS_TOO_EARLY: 425,\n HTTP_STATUS_UPGRADE_REQUIRED: 426,\n HTTP_STATUS_PRECONDITION_REQUIRED: 428,\n HTTP_STATUS_TOO_MANY_REQUESTS: 429,\n HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: 431,\n HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: 451,\n HTTP_STATUS_INTERNAL_SERVER_ERROR: 500,\n HTTP_STATUS_NOT_IMPLEMENTED: 501,\n HTTP_STATUS_BAD_GATEWAY: 502,\n HTTP_STATUS_SERVICE_UNAVAILABLE: 503,\n HTTP_STATUS_GATEWAY_TIMEOUT: 504,\n HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: 505,\n HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: 506,\n HTTP_STATUS_INSUFFICIENT_STORAGE: 507,\n HTTP_STATUS_LOOP_DETECTED: 508,\n HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: 509,\n HTTP_STATUS_NOT_EXTENDED: 510,\n HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: 511\n };\n return {\n connect,\n constants,\n createServer,\n createSecureServer,\n getDefaultSettings,\n getPackedSettings,\n getUnpackedSettings,\n performServerHandshake,\n sensitiveHeaders: Symbol(\"sensitiveHeaders\"),\n Http2ServerRequest,\n Http2ServerResponse\n };\n}";
@@ -9,8 +9,8 @@
9
9
  * evaluated; PACKAGE_ABI_POLICY.stagedArtifacts routes each owner package and
10
10
  * the packages it requires the binding by to its entry.
11
11
  */
12
- export const NAPI_WASM_LOADER = { "path": "/_assets/napi-wasm/loader/99efae93dd1dcc2b/napi-wasm-loader.mjs", "sha256": "f24fab814c228497f89b03b1d00ae9b13a97e7473a064c97e444c3d31ec28245", "bytes": 201636 };
13
- export const NAPI_WASM_TRAMPOLINE = { "path": "/_assets/napi-wasm/loader/99efae93dd1dcc2b/wasi-trampoline.wasm", "sha256": "0ad53da157e16656eee42877724d38aaa9876de20369f975f44b8a5e5d6f9cf6", "bytes": 1961 };
12
+ export const NAPI_WASM_LOADER = { "path": "/_assets/napi-wasm/loader/ab7e57fe9e8750c2/napi-wasm-loader.mjs", "sha256": "f074459d57aeecc2436edb904d28cf439fe08c67c93cdce63aae8bdf857d90f6", "bytes": 201947 };
13
+ export const NAPI_WASM_TRAMPOLINE = { "path": "/_assets/napi-wasm/loader/ab7e57fe9e8750c2/wasi-trampoline.wasm", "sha256": "0ad53da157e16656eee42877724d38aaa9876de20369f975f44b8a5e5d6f9cf6", "bytes": 1961 };
14
14
  export const STAGED_BINDING_ARTIFACTS = [
15
15
  {
16
16
  "name": "rolldown",
@@ -3,7 +3,8 @@
3
3
  * scripts/bundle-node-shims.mjs. DO NOT EDIT.
4
4
  *
5
5
  * Pins the staged sources of the node-compat layer, promoted out of the worker
6
- * bundle: the shims, the VFS write ledger and the resident store. Each
6
+ * bundle: the shims, the VFS write ledger, the resident store, and the
7
+ * runtime-code interpreter with its host module. Each
7
8
  * <NAME>_BUILD_ID is a content-hash prefix so cache layers never serve stale
8
9
  * bytes after a rebuild; <NAME>_SHA256 is the full digest verified at fetch time.
9
10
  */
@@ -19,4 +20,16 @@ export declare const VFS_WRITE_LEDGER_SHA256: string;
19
20
  export declare const RESIDENT_STORE_ENTRY: string;
20
21
  export declare const RESIDENT_STORE_BUILD_ID: string;
21
22
  export declare const RESIDENT_STORE_SHA256: string;
23
+ /** @nimbus-sh/core src/interpreter/primordials.ts, bundled by scripts/interpreter-bundle.mjs */
24
+ export declare const JS_INTERPRETER_PRIMORDIALS_ENTRY: string;
25
+ export declare const JS_INTERPRETER_PRIMORDIALS_BUILD_ID: string;
26
+ export declare const JS_INTERPRETER_PRIMORDIALS_SHA256: string;
27
+ /** @nimbus-sh/core src/interpreter, bundled by scripts/interpreter-bundle.mjs */
28
+ export declare const JS_INTERPRETER_ENTRY: string;
29
+ export declare const JS_INTERPRETER_BUILD_ID: string;
30
+ export declare const JS_INTERPRETER_SHA256: string;
31
+ /** @nimbus-sh/core src/interpreter/host-ops.ts HOST_OPS_SOURCE */
32
+ export declare const JS_INTERPRETER_OPS_ENTRY: string;
33
+ export declare const JS_INTERPRETER_OPS_BUILD_ID: string;
34
+ export declare const JS_INTERPRETER_OPS_SHA256: string;
22
35
  //# sourceMappingURL=node-shims-artifact.generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-shims-artifact.generated.d.ts","sourceRoot":"","sources":["../src/node-shims-artifact.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,qDAAqD;AACrD,eAAO,MAAM,gBAAgB,EAAE,MAA0D,CAAC;AAC1F,eAAO,MAAM,mBAAmB,EAAE,MAA2B,CAAC;AAC9D,eAAO,MAAM,iBAAiB,EAAE,MAA2E,CAAC;AAE5G,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,EAAE,MAAgE,CAAC;AACtG,eAAO,MAAM,yBAAyB,EAAE,MAA2B,CAAC;AACpE,eAAO,MAAM,uBAAuB,EAAE,MAA2E,CAAC;AAElH,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,EAAE,MAA8D,CAAC;AAClG,eAAO,MAAM,uBAAuB,EAAE,MAA2B,CAAC;AAClE,eAAO,MAAM,qBAAqB,EAAE,MAA2E,CAAC"}
1
+ {"version":3,"file":"node-shims-artifact.generated.d.ts","sourceRoot":"","sources":["../src/node-shims-artifact.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,qDAAqD;AACrD,eAAO,MAAM,gBAAgB,EAAE,MAA0D,CAAC;AAC1F,eAAO,MAAM,mBAAmB,EAAE,MAA2B,CAAC;AAC9D,eAAO,MAAM,iBAAiB,EAAE,MAA2E,CAAC;AAE5G,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,EAAE,MAAgE,CAAC;AACtG,eAAO,MAAM,yBAAyB,EAAE,MAA2B,CAAC;AACpE,eAAO,MAAM,uBAAuB,EAAE,MAA2E,CAAC;AAElH,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,EAAE,MAA8D,CAAC;AAClG,eAAO,MAAM,uBAAuB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