@nimbus-sh/worker 0.1.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 (408) hide show
  1. package/README.md +219 -0
  2. package/dist/_shared/bytes.d.ts +18 -0
  3. package/dist/_shared/bytes.d.ts.map +1 -0
  4. package/dist/_shared/bytes.js +17 -0
  5. package/dist/_shared/cache-stats.d.ts +146 -0
  6. package/dist/_shared/cache-stats.d.ts.map +1 -0
  7. package/dist/_shared/cache-stats.js +162 -0
  8. package/dist/_shared/exports-resolver.d.ts +76 -0
  9. package/dist/_shared/exports-resolver.d.ts.map +1 -0
  10. package/dist/_shared/exports-resolver.js +284 -0
  11. package/dist/_shared/install-phase.d.ts +47 -0
  12. package/dist/_shared/install-phase.d.ts.map +1 -0
  13. package/dist/_shared/install-phase.js +1 -0
  14. package/dist/_shared/real-node-imports.d.ts +38 -0
  15. package/dist/_shared/real-node-imports.d.ts.map +1 -0
  16. package/dist/_shared/real-node-imports.js +46 -0
  17. package/dist/_shared/retry.d.ts +93 -0
  18. package/dist/_shared/retry.d.ts.map +1 -0
  19. package/dist/_shared/retry.js +161 -0
  20. package/dist/_shared/session-id.d.ts +39 -0
  21. package/dist/_shared/session-id.d.ts.map +1 -0
  22. package/dist/_shared/session-id.js +127 -0
  23. package/dist/_shared/session-router.d.ts +104 -0
  24. package/dist/_shared/session-router.d.ts.map +1 -0
  25. package/dist/_shared/session-router.js +165 -0
  26. package/dist/_shared/w7-frame.d.ts +93 -0
  27. package/dist/_shared/w7-frame.d.ts.map +1 -0
  28. package/dist/_shared/w7-frame.js +402 -0
  29. package/dist/auth/index.d.ts +16 -0
  30. package/dist/auth/index.d.ts.map +1 -0
  31. package/dist/auth/index.js +15 -0
  32. package/dist/auth/middleware.d.ts +85 -0
  33. package/dist/auth/middleware.d.ts.map +1 -0
  34. package/dist/auth/middleware.js +150 -0
  35. package/dist/auth/token.d.ts +96 -0
  36. package/dist/auth/token.d.ts.map +1 -0
  37. package/dist/auth/token.js +226 -0
  38. package/dist/auth/types.d.ts +141 -0
  39. package/dist/auth/types.d.ts.map +1 -0
  40. package/dist/auth/types.js +114 -0
  41. package/dist/bindings/d1.d.ts +102 -0
  42. package/dist/bindings/d1.d.ts.map +1 -0
  43. package/dist/bindings/d1.js +549 -0
  44. package/dist/bindings/kv.d.ts +82 -0
  45. package/dist/bindings/kv.d.ts.map +1 -0
  46. package/dist/bindings/kv.js +290 -0
  47. package/dist/bindings/r2.d.ts +137 -0
  48. package/dist/bindings/r2.d.ts.map +1 -0
  49. package/dist/bindings/r2.js +379 -0
  50. package/dist/cirrus-npm-cjs.generated.d.ts +17 -0
  51. package/dist/cirrus-npm-cjs.generated.d.ts.map +1 -0
  52. package/dist/cirrus-npm-cjs.generated.js +41 -0
  53. package/dist/cirrus-plugin-react.generated.d.ts +34 -0
  54. package/dist/cirrus-plugin-react.generated.d.ts.map +1 -0
  55. package/dist/cirrus-plugin-react.generated.js +33 -0
  56. package/dist/constants.d.ts +34 -0
  57. package/dist/constants.d.ts.map +1 -0
  58. package/dist/constants.js +116 -0
  59. package/dist/esbuild-wasm-bundle.generated.d.ts +41 -0
  60. package/dist/esbuild-wasm-bundle.generated.d.ts.map +1 -0
  61. package/dist/esbuild-wasm-bundle.generated.js +40 -0
  62. package/dist/facets/cirrus-real.d.ts +147 -0
  63. package/dist/facets/cirrus-real.d.ts.map +1 -0
  64. package/dist/facets/cirrus-real.js +981 -0
  65. package/dist/facets/inner-do-registry.d.ts +41 -0
  66. package/dist/facets/inner-do-registry.d.ts.map +1 -0
  67. package/dist/facets/inner-do-registry.js +51 -0
  68. package/dist/facets/manager.d.ts +314 -0
  69. package/dist/facets/manager.d.ts.map +1 -0
  70. package/dist/facets/manager.js +2681 -0
  71. package/dist/facets/process.d.ts +318 -0
  72. package/dist/facets/process.d.ts.map +1 -0
  73. package/dist/facets/process.js +567 -0
  74. package/dist/facets/real-vite-fs-shim.d.ts +151 -0
  75. package/dist/facets/real-vite-fs-shim.d.ts.map +1 -0
  76. package/dist/facets/real-vite-fs-shim.js +1279 -0
  77. package/dist/facets/real-vite-hmr.d.ts +142 -0
  78. package/dist/facets/real-vite-hmr.d.ts.map +1 -0
  79. package/dist/facets/real-vite-hmr.js +476 -0
  80. package/dist/facets/vite-dev-server.d.ts +293 -0
  81. package/dist/facets/vite-dev-server.d.ts.map +1 -0
  82. package/dist/facets/vite-dev-server.js +2580 -0
  83. package/dist/facets/wasm-swap-registry.d.ts +261 -0
  84. package/dist/facets/wasm-swap-registry.d.ts.map +1 -0
  85. package/dist/facets/wasm-swap-registry.js +551 -0
  86. package/dist/facets/ws-terminal.d.ts +107 -0
  87. package/dist/facets/ws-terminal.d.ts.map +1 -0
  88. package/dist/facets/ws-terminal.js +207 -0
  89. package/dist/git/commands.d.ts +13 -0
  90. package/dist/git/commands.d.ts.map +1 -0
  91. package/dist/git/commands.js +633 -0
  92. package/dist/git/network-facet.d.ts +61 -0
  93. package/dist/git/network-facet.d.ts.map +1 -0
  94. package/dist/git/network-facet.js +700 -0
  95. package/dist/git-bundle.generated.d.ts +16 -0
  96. package/dist/git-bundle.generated.d.ts.map +1 -0
  97. package/dist/git-bundle.generated.js +15 -0
  98. package/dist/index.d.ts +41 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +73 -0
  101. package/dist/loaders/child-process/spawn-facet.d.ts +90 -0
  102. package/dist/loaders/child-process/spawn-facet.d.ts.map +1 -0
  103. package/dist/loaders/child-process/spawn-facet.js +103 -0
  104. package/dist/loaders/child-process/spawn-pool.d.ts +110 -0
  105. package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -0
  106. package/dist/loaders/child-process/spawn-pool.js +161 -0
  107. package/dist/loaders/fanout-pool.d.ts +195 -0
  108. package/dist/loaders/fanout-pool.d.ts.map +1 -0
  109. package/dist/loaders/fanout-pool.js +326 -0
  110. package/dist/loaders/generated-workers.d.ts +26 -0
  111. package/dist/loaders/generated-workers.d.ts.map +1 -0
  112. package/dist/loaders/generated-workers.js +25 -0
  113. package/dist/loaders/index.d.ts +15 -0
  114. package/dist/loaders/index.d.ts.map +1 -0
  115. package/dist/loaders/index.js +13 -0
  116. package/dist/loaders/loader-pool.d.ts +273 -0
  117. package/dist/loaders/loader-pool.d.ts.map +1 -0
  118. package/dist/loaders/loader-pool.js +624 -0
  119. package/dist/loaders/npm-resolve-preamble.d.ts +34 -0
  120. package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -0
  121. package/dist/loaders/npm-resolve-preamble.js +237 -0
  122. package/dist/loaders/pre-bundle-preamble.d.ts +41 -0
  123. package/dist/loaders/pre-bundle-preamble.d.ts.map +1 -0
  124. package/dist/loaders/pre-bundle-preamble.js +114 -0
  125. package/dist/loaders/vendor/codegen.d.ts +24 -0
  126. package/dist/loaders/vendor/codegen.d.ts.map +1 -0
  127. package/dist/loaders/vendor/codegen.js +44 -0
  128. package/dist/loaders/vendor/errors.d.ts +24 -0
  129. package/dist/loaders/vendor/errors.d.ts.map +1 -0
  130. package/dist/loaders/vendor/errors.js +46 -0
  131. package/dist/loaders/vendor/index.d.ts +16 -0
  132. package/dist/loaders/vendor/index.d.ts.map +1 -0
  133. package/dist/loaders/vendor/index.js +11 -0
  134. package/dist/loaders/vendor/pool.d.ts +88 -0
  135. package/dist/loaders/vendor/pool.d.ts.map +1 -0
  136. package/dist/loaders/vendor/pool.js +353 -0
  137. package/dist/loaders/vendor/primitives.d.ts +11 -0
  138. package/dist/loaders/vendor/primitives.d.ts.map +1 -0
  139. package/dist/loaders/vendor/primitives.js +33 -0
  140. package/dist/loaders/vendor/serialize.d.ts +3 -0
  141. package/dist/loaders/vendor/serialize.d.ts.map +1 -0
  142. package/dist/loaders/vendor/serialize.js +25 -0
  143. package/dist/loaders/vendor/types.d.ts +60 -0
  144. package/dist/loaders/vendor/types.d.ts.map +1 -0
  145. package/dist/loaders/vendor/types.js +4 -0
  146. package/dist/npm/cache.d.ts +136 -0
  147. package/dist/npm/cache.d.ts.map +1 -0
  148. package/dist/npm/cache.js +429 -0
  149. package/dist/npm/install-batch-facet.d.ts +129 -0
  150. package/dist/npm/install-batch-facet.d.ts.map +1 -0
  151. package/dist/npm/install-batch-facet.js +598 -0
  152. package/dist/npm/install-facet.d.ts +29 -0
  153. package/dist/npm/install-facet.d.ts.map +1 -0
  154. package/dist/npm/install-facet.js +9 -0
  155. package/dist/npm/installer.d.ts +239 -0
  156. package/dist/npm/installer.d.ts.map +1 -0
  157. package/dist/npm/installer.js +2022 -0
  158. package/dist/npm/npx-install.d.ts +74 -0
  159. package/dist/npm/npx-install.d.ts.map +1 -0
  160. package/dist/npm/npx-install.js +302 -0
  161. package/dist/npm/pre-bundle-facet.d.ts +168 -0
  162. package/dist/npm/pre-bundle-facet.d.ts.map +1 -0
  163. package/dist/npm/pre-bundle-facet.js +653 -0
  164. package/dist/npm/r2-cache.d.ts +286 -0
  165. package/dist/npm/r2-cache.d.ts.map +1 -0
  166. package/dist/npm/r2-cache.js +506 -0
  167. package/dist/npm/resolve-facet.d.ts +202 -0
  168. package/dist/npm/resolve-facet.d.ts.map +1 -0
  169. package/dist/npm/resolve-facet.js +833 -0
  170. package/dist/npm/resolve-one-facet.d.ts +204 -0
  171. package/dist/npm/resolve-one-facet.d.ts.map +1 -0
  172. package/dist/npm/resolve-one-facet.js +437 -0
  173. package/dist/npm/resolver.d.ts +109 -0
  174. package/dist/npm/resolver.d.ts.map +1 -0
  175. package/dist/npm/resolver.js +899 -0
  176. package/dist/npm/tarball-stream.d.ts +85 -0
  177. package/dist/npm/tarball-stream.d.ts.map +1 -0
  178. package/dist/npm/tarball-stream.js +205 -0
  179. package/dist/npm/tarball.d.ts +51 -0
  180. package/dist/npm/tarball.d.ts.map +1 -0
  181. package/dist/npm/tarball.js +185 -0
  182. package/dist/observability/diag-counters.d.ts +292 -0
  183. package/dist/observability/diag-counters.d.ts.map +1 -0
  184. package/dist/observability/diag-counters.js +302 -0
  185. package/dist/observability/heap-estimate.d.ts +166 -0
  186. package/dist/observability/heap-estimate.d.ts.map +1 -0
  187. package/dist/observability/heap-estimate.js +192 -0
  188. package/dist/observability/heavy-alloc-coord.d.ts +95 -0
  189. package/dist/observability/heavy-alloc-coord.d.ts.map +1 -0
  190. package/dist/observability/heavy-alloc-coord.js +149 -0
  191. package/dist/observability/oom-classify.d.ts +56 -0
  192. package/dist/observability/oom-classify.d.ts.map +1 -0
  193. package/dist/observability/oom-classify.js +118 -0
  194. package/dist/observability/oom-discriminator.d.ts +192 -0
  195. package/dist/observability/oom-discriminator.d.ts.map +1 -0
  196. package/dist/observability/oom-discriminator.js +233 -0
  197. package/dist/real-vite-bundle.generated.d.ts +46 -0
  198. package/dist/real-vite-bundle.generated.d.ts.map +1 -0
  199. package/dist/real-vite-bundle.generated.js +53 -0
  200. package/dist/replica/routing.d.ts +171 -0
  201. package/dist/replica/routing.d.ts.map +1 -0
  202. package/dist/replica/routing.js +288 -0
  203. package/dist/replica/suspension.d.ts +36 -0
  204. package/dist/replica/suspension.d.ts.map +1 -0
  205. package/dist/replica/suspension.js +49 -0
  206. package/dist/router/index.d.ts +156 -0
  207. package/dist/router/index.d.ts.map +1 -0
  208. package/dist/router/index.js +220 -0
  209. package/dist/runtime/assets-loader.d.ts +71 -0
  210. package/dist/runtime/assets-loader.d.ts.map +1 -0
  211. package/dist/runtime/assets-loader.js +128 -0
  212. package/dist/runtime/barrel-detect.d.ts +46 -0
  213. package/dist/runtime/barrel-detect.d.ts.map +1 -0
  214. package/dist/runtime/barrel-detect.js +73 -0
  215. package/dist/runtime/barrel-synthesizer.d.ts +181 -0
  216. package/dist/runtime/barrel-synthesizer.d.ts.map +1 -0
  217. package/dist/runtime/barrel-synthesizer.js +541 -0
  218. package/dist/runtime/bun-repl.d.ts +46 -0
  219. package/dist/runtime/bun-repl.d.ts.map +1 -0
  220. package/dist/runtime/bun-repl.js +326 -0
  221. package/dist/runtime/bun-runner.d.ts +66 -0
  222. package/dist/runtime/bun-runner.d.ts.map +1 -0
  223. package/dist/runtime/bun-runner.js +219 -0
  224. package/dist/runtime/clang-runner.d.ts +38 -0
  225. package/dist/runtime/clang-runner.d.ts.map +1 -0
  226. package/dist/runtime/clang-runner.js +1033 -0
  227. package/dist/runtime/comment-strip.d.ts +37 -0
  228. package/dist/runtime/comment-strip.d.ts.map +1 -0
  229. package/dist/runtime/comment-strip.js +74 -0
  230. package/dist/runtime/esbuild-service.d.ts +201 -0
  231. package/dist/runtime/esbuild-service.d.ts.map +1 -0
  232. package/dist/runtime/esbuild-service.js +1444 -0
  233. package/dist/runtime/esbuild-wasm-bytes.d.ts +87 -0
  234. package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -0
  235. package/dist/runtime/esbuild-wasm-bytes.js +131 -0
  236. package/dist/runtime/framework-detect.d.ts +71 -0
  237. package/dist/runtime/framework-detect.d.ts.map +1 -0
  238. package/dist/runtime/framework-detect.js +178 -0
  239. package/dist/runtime/long-running-handle.d.ts +133 -0
  240. package/dist/runtime/long-running-handle.d.ts.map +1 -0
  241. package/dist/runtime/long-running-handle.js +192 -0
  242. package/dist/runtime/node-repl.d.ts +36 -0
  243. package/dist/runtime/node-repl.d.ts.map +1 -0
  244. package/dist/runtime/node-repl.js +293 -0
  245. package/dist/runtime/node-runner.d.ts +111 -0
  246. package/dist/runtime/node-runner.d.ts.map +1 -0
  247. package/dist/runtime/node-runner.js +194 -0
  248. package/dist/runtime/node-shims.d.ts +24 -0
  249. package/dist/runtime/node-shims.d.ts.map +1 -0
  250. package/dist/runtime/node-shims.js +3019 -0
  251. package/dist/runtime/package-manager.d.ts +118 -0
  252. package/dist/runtime/package-manager.d.ts.map +1 -0
  253. package/dist/runtime/package-manager.js +420 -0
  254. package/dist/runtime/port-registry.d.ts +80 -0
  255. package/dist/runtime/port-registry.d.ts.map +1 -0
  256. package/dist/runtime/port-registry.js +166 -0
  257. package/dist/runtime/process-logs-api.d.ts +102 -0
  258. package/dist/runtime/process-logs-api.d.ts.map +1 -0
  259. package/dist/runtime/process-logs-api.js +253 -0
  260. package/dist/runtime/process-logs.d.ts +311 -0
  261. package/dist/runtime/process-logs.d.ts.map +1 -0
  262. package/dist/runtime/process-logs.js +656 -0
  263. package/dist/runtime/process-table.d.ts +65 -0
  264. package/dist/runtime/process-table.d.ts.map +1 -0
  265. package/dist/runtime/process-table.js +107 -0
  266. package/dist/runtime/project-detect.d.ts +21 -0
  267. package/dist/runtime/project-detect.d.ts.map +1 -0
  268. package/dist/runtime/project-detect.js +46 -0
  269. package/dist/runtime/python-repl.d.ts +66 -0
  270. package/dist/runtime/python-repl.d.ts.map +1 -0
  271. package/dist/runtime/python-repl.js +563 -0
  272. package/dist/runtime/python-runner.d.ts +50 -0
  273. package/dist/runtime/python-runner.d.ts.map +1 -0
  274. package/dist/runtime/python-runner.js +870 -0
  275. package/dist/runtime/repl-session.d.ts +160 -0
  276. package/dist/runtime/repl-session.d.ts.map +1 -0
  277. package/dist/runtime/repl-session.js +393 -0
  278. package/dist/runtime/require-resolver.d.ts +52 -0
  279. package/dist/runtime/require-resolver.d.ts.map +1 -0
  280. package/dist/runtime/require-resolver.js +690 -0
  281. package/dist/runtime/router-basename.d.ts +36 -0
  282. package/dist/runtime/router-basename.d.ts.map +1 -0
  283. package/dist/runtime/router-basename.js +310 -0
  284. package/dist/runtime/ruby-repl.d.ts +43 -0
  285. package/dist/runtime/ruby-repl.d.ts.map +1 -0
  286. package/dist/runtime/ruby-repl.js +229 -0
  287. package/dist/runtime/ruby-runner.d.ts +62 -0
  288. package/dist/runtime/ruby-runner.d.ts.map +1 -0
  289. package/dist/runtime/ruby-runner.js +737 -0
  290. package/dist/runtime/runtime-catalog.d.ts +99 -0
  291. package/dist/runtime/runtime-catalog.d.ts.map +1 -0
  292. package/dist/runtime/runtime-catalog.js +183 -0
  293. package/dist/runtime/runtime-registry.d.ts +136 -0
  294. package/dist/runtime/runtime-registry.d.ts.map +1 -0
  295. package/dist/runtime/runtime-registry.js +318 -0
  296. package/dist/runtime/streams.d.ts +13 -0
  297. package/dist/runtime/streams.d.ts.map +1 -0
  298. package/dist/runtime/streams.js +402 -0
  299. package/dist/runtime/wasi-instance.d.ts +190 -0
  300. package/dist/runtime/wasi-instance.d.ts.map +1 -0
  301. package/dist/runtime/wasi-instance.js +2044 -0
  302. package/dist/runtime/wasm-runner.d.ts +117 -0
  303. package/dist/runtime/wasm-runner.d.ts.map +1 -0
  304. package/dist/runtime/wasm-runner.js +705 -0
  305. package/dist/session/bindings.d.ts +168 -0
  306. package/dist/session/bindings.d.ts.map +1 -0
  307. package/dist/session/bindings.js +524 -0
  308. package/dist/session/ctx-exports.d.ts +16 -0
  309. package/dist/session/ctx-exports.d.ts.map +1 -0
  310. package/dist/session/ctx-exports.js +22 -0
  311. package/dist/session/diag.d.ts +62 -0
  312. package/dist/session/diag.d.ts.map +1 -0
  313. package/dist/session/diag.js +118 -0
  314. package/dist/session/fs-watch.d.ts +132 -0
  315. package/dist/session/fs-watch.d.ts.map +1 -0
  316. package/dist/session/fs-watch.js +255 -0
  317. package/dist/session/helpers.d.ts +150 -0
  318. package/dist/session/helpers.d.ts.map +1 -0
  319. package/dist/session/helpers.js +472 -0
  320. package/dist/session/hibernation.d.ts +145 -0
  321. package/dist/session/hibernation.d.ts.map +1 -0
  322. package/dist/session/hibernation.js +385 -0
  323. package/dist/session/init-phases.d.ts +87 -0
  324. package/dist/session/init-phases.d.ts.map +1 -0
  325. package/dist/session/init-phases.js +137 -0
  326. package/dist/session/init.d.ts +46 -0
  327. package/dist/session/init.d.ts.map +1 -0
  328. package/dist/session/init.js +3579 -0
  329. package/dist/session/keys.d.ts +56 -0
  330. package/dist/session/keys.d.ts.map +1 -0
  331. package/dist/session/keys.js +55 -0
  332. package/dist/session/nimbus-session.d.ts +434 -0
  333. package/dist/session/nimbus-session.d.ts.map +1 -0
  334. package/dist/session/nimbus-session.js +1084 -0
  335. package/dist/session/programmatic.d.ts +105 -0
  336. package/dist/session/programmatic.d.ts.map +1 -0
  337. package/dist/session/programmatic.js +326 -0
  338. package/dist/session/replica-routes.d.ts +68 -0
  339. package/dist/session/replica-routes.d.ts.map +1 -0
  340. package/dist/session/replica-routes.js +77 -0
  341. package/dist/session/routes.d.ts +29 -0
  342. package/dist/session/routes.d.ts.map +1 -0
  343. package/dist/session/routes.js +1331 -0
  344. package/dist/session/rpc.d.ts +323 -0
  345. package/dist/session/rpc.d.ts.map +1 -0
  346. package/dist/session/rpc.js +808 -0
  347. package/dist/session/state-store.d.ts +210 -0
  348. package/dist/session/state-store.d.ts.map +1 -0
  349. package/dist/session/state-store.js +459 -0
  350. package/dist/session/supervisor-rpc.d.ts +269 -0
  351. package/dist/session/supervisor-rpc.d.ts.map +1 -0
  352. package/dist/session/supervisor-rpc.js +437 -0
  353. package/dist/session/ws-hibernation-config.d.ts +64 -0
  354. package/dist/session/ws-hibernation-config.d.ts.map +1 -0
  355. package/dist/session/ws-hibernation-config.js +89 -0
  356. package/dist/session/ws.d.ts +95 -0
  357. package/dist/session/ws.d.ts.map +1 -0
  358. package/dist/session/ws.js +395 -0
  359. package/dist/shell/features.d.ts +410 -0
  360. package/dist/shell/features.d.ts.map +1 -0
  361. package/dist/shell/features.js +1885 -0
  362. package/dist/shell/unix-commands.d.ts +15 -0
  363. package/dist/shell/unix-commands.d.ts.map +1 -0
  364. package/dist/shell/unix-commands.js +3703 -0
  365. package/dist/stubs/lifo-ui.d.ts +10 -0
  366. package/dist/stubs/lifo-ui.d.ts.map +1 -0
  367. package/dist/stubs/lifo-ui.js +1 -0
  368. package/dist/tailwind-play.generated.d.ts +19 -0
  369. package/dist/tailwind-play.generated.d.ts.map +1 -0
  370. package/dist/tailwind-play.generated.js +18 -0
  371. package/dist/vfs/dev-provider.d.ts +64 -0
  372. package/dist/vfs/dev-provider.d.ts.map +1 -0
  373. package/dist/vfs/dev-provider.js +191 -0
  374. package/dist/vfs/events.d.ts +51 -0
  375. package/dist/vfs/events.d.ts.map +1 -0
  376. package/dist/vfs/events.js +127 -0
  377. package/dist/vfs/path.d.ts +30 -0
  378. package/dist/vfs/path.d.ts.map +1 -0
  379. package/dist/vfs/path.js +41 -0
  380. package/dist/vfs/seed-project.d.ts +62 -0
  381. package/dist/vfs/seed-project.d.ts.map +1 -0
  382. package/dist/vfs/seed-project.js +1045 -0
  383. package/dist/vfs/sqlite-vfs.d.ts +435 -0
  384. package/dist/vfs/sqlite-vfs.d.ts.map +1 -0
  385. package/dist/vfs/sqlite-vfs.js +1670 -0
  386. package/dist/vfs/symlink-registry.d.ts +64 -0
  387. package/dist/vfs/symlink-registry.d.ts.map +1 -0
  388. package/dist/vfs/symlink-registry.js +137 -0
  389. package/dist/wrangler/nimbus-wrangler.d.ts +157 -0
  390. package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -0
  391. package/dist/wrangler/nimbus-wrangler.js +931 -0
  392. package/package.json +77 -0
  393. package/public/_assets/cirrus-plugin-react.bundle.js +70740 -0
  394. package/public/_assets/esbuild-0.24.2.wasm +0 -0
  395. package/public/_assets/real-vite-bundle.js +101478 -0
  396. package/public/_assets/rollup.wasm +0 -0
  397. package/public/favicon.svg +8 -0
  398. package/public/index.html +565 -0
  399. package/public/s/index.html +2379 -0
  400. package/scripts/bundle-esbuild-wasm.mjs +244 -0
  401. package/scripts/bundle-facet-workers.mjs +137 -0
  402. package/scripts/bundle-git.mjs +118 -0
  403. package/scripts/bundle-npm-cjs.mjs +363 -0
  404. package/scripts/bundle-plugin-react.mjs +480 -0
  405. package/scripts/bundle-real-vite.mjs +959 -0
  406. package/scripts/bundle-runtime.mjs +600 -0
  407. package/scripts/bundle-tailwind-play.mjs +130 -0
  408. package/scripts/patch-lifo-ui.mjs +131 -0
@@ -0,0 +1,237 @@
1
+ /**
2
+ * npm-resolve-preamble.ts — preamble injected into NimbusLoaderPool isolates
3
+ * that run src/npm-resolve-facet.ts.
4
+ *
5
+ * NimbusLoaderPool serialises the user function via fn.toString() and runs
6
+ * it inside a dynamic worker. Names referenced by the function at module
7
+ * scope are NOT in that worker's lexical scope at runtime — they must be
8
+ * re-declared in the preamble.
9
+ *
10
+ * The resolver-facet references the following preamble symbols:
11
+ * - SHOULD_SKIP_PACKAGE(name) → boolean
12
+ * - SHOULD_SWAP(name) → { from, to } | undefined (W6)
13
+ * - SHOULD_REJECT_FAIL(name) → { from, reason, suggest? } | undefined (W6)
14
+ * - SHOULD_WARN_SKIP_TRANSITIVE(name) → entry | undefined (W6)
15
+ * - PARSE_SEMVER(v) → [major, minor, patch] | null
16
+ * - COMPARE_SEMVER(a, b) → number
17
+ * - SATISFIES_RANGE(version, range) → boolean
18
+ * - RESOLVE_VERSION(versions, range) → string | null
19
+ *
20
+ * All of these are pasted from src/npm-resolver.ts and src/wasm-swap-registry.ts
21
+ * and MUST stay byte-equivalent. Divergence between supervisor and facet
22
+ * resolution would mean the facet picks different versions / makes different
23
+ * swap-or-reject decisions than the legacy in-supervisor path, breaking
24
+ * both correctness and the NIMBUS_FACET_RESOLVER=0 fallback contract.
25
+ *
26
+ * The W6 registry data is duplicated below — gated by
27
+ * `audit/probes/w6/functional/preamble-parity.mjs`.
28
+ *
29
+ * Preamble bytes are part of the loader-cache key for NimbusLoaderPool —
30
+ * any edit invalidates the warm slot and forces a re-load on next
31
+ * dispatch. Acceptable cost for a one-shot resolver phase.
32
+ */
33
+ export const NPM_RESOLVE_PREAMBLE = `
34
+ // ── Skip list (mirrors src/npm-resolver.ts SKIP_PACKAGES, post-W6+W11) ──
35
+ // W6: 'esbuild' migrated to WASM_SWAPS; 'fsevents' migrated to REJECT_INSTALL.
36
+ // W11: vite is exempted when frameworkAware=true so framework CLIs can
37
+ // import('vite') from node_modules. See audit/sections/W11-plan.md §3.0.
38
+ const __SKIP_PACKAGES = new Set([
39
+ // X.5-G: rollup migrated to WASM_SWAPS to own the rollup → @rollup/wasm-node swap.
40
+ 'typescript', 'vite', 'webpack', 'parcel',
41
+ 'postcss', 'autoprefixer', 'tailwindcss', 'cssnano',
42
+ 'prettier', 'eslint', 'stylelint',
43
+ 'chokidar', 'node-gyp', 'node-pre-gyp',
44
+ '@cloudflare/vite-plugin', '@cloudflare/workers-types', 'wrangler',
45
+ 'husky', 'lint-staged', 'commitlint',
46
+ ]);
47
+ const __FRAMEWORK_REQUIRED_PACKAGES = new Set([
48
+ 'vite',
49
+ ]);
50
+ const __SKIP_PREFIXES = [
51
+ '@types/',
52
+ '@eslint/',
53
+ '@typescript-eslint/',
54
+ 'eslint-plugin-',
55
+ 'eslint-config-',
56
+ ];
57
+ function SHOULD_SKIP_PACKAGE(name, frameworkAware) {
58
+ if (frameworkAware && __FRAMEWORK_REQUIRED_PACKAGES.has(name)) return false;
59
+ if (__SKIP_PACKAGES.has(name)) return true;
60
+ for (const p of __SKIP_PREFIXES) if (name.startsWith(p)) return true;
61
+ return false;
62
+ }
63
+
64
+ // ── W6 swap / reject registry (mirrors src/wasm-swap-registry.ts) ─────
65
+ // Gated by audit/probes/w6/functional/preamble-parity.mjs.
66
+ const __WASM_SWAPS = new Map([
67
+ ['esbuild', { from: 'esbuild', to: 'esbuild-wasm' }],
68
+ // X.5-G G2: rollup → @rollup/wasm-node (drop-in WASM build).
69
+ // See src/wasm-swap-registry.ts:73 for full WASM_SWAPS canonical entry
70
+ // and X5G-plan.md §3 for the npm 4828 / .node-can't-dlopen rationale.
71
+ ['rollup', { from: 'rollup', to: '@rollup/wasm-node' }],
72
+ ]);
73
+ // Mirror of REJECT_INSTALL in src/wasm-swap-registry.ts. Entries with
74
+ // transitive='warn' are tagged so the resolver can decide skip-vs-throw.
75
+ const __REJECT_INSTALL = new Map([
76
+ ['sharp', { from: 'sharp', reason: 'Native libvips bindings; not portable to Workers.', transitive: 'fail' }],
77
+ ['sqlite3', { from: 'sqlite3', reason: 'Native sqlite3 .node binding.', transitive: 'fail' }],
78
+ ['better-sqlite3', { from: 'better-sqlite3', reason: 'Native sqlite .node binding.', transitive: 'fail' }],
79
+ ['canvas', { from: 'canvas', reason: 'Native Cairo bindings.', transitive: 'fail' }],
80
+ ['sodium-native', { from: 'sodium-native', reason: 'Native libsodium.', transitive: 'fail' }],
81
+ ['fsevents', { from: 'fsevents', reason: 'macOS-only filesystem watcher; never runs in Workers.', transitive: 'warn' }],
82
+ ['bufferutil', { from: 'bufferutil', reason: 'Native binding for ws speedups; install requires node-gyp.', transitive: 'warn' }],
83
+ ['utf-8-validate', { from: 'utf-8-validate', reason: 'Native binding for ws speedups; install requires node-gyp.', transitive: 'warn' }],
84
+ ['node-pty', { from: 'node-pty', reason: 'PTY syscalls unavailable in workerd.', transitive: 'fail' }],
85
+ ['robotjs', { from: 'robotjs', reason: 'Desktop automation; sandboxed Workers cannot access OS UI.', transitive: 'fail' }],
86
+ ['electron', { from: 'electron', reason: 'Embedded Chromium runtime; not applicable to Workers.', transitive: 'fail' }],
87
+ ['bcrypt', { from: 'bcrypt', reason: 'Native bcrypt; require() name differs from bcryptjs.', transitive: 'fail' }],
88
+ ['argon2', { from: 'argon2', reason: 'Native Argon2 C bindings.', transitive: 'fail' }],
89
+ ['node-sass', { from: 'node-sass', reason: 'Native libsass; deprecated upstream.', transitive: 'fail' }],
90
+ ['grpc', { from: 'grpc', reason: 'Deprecated native gRPC.', transitive: 'fail' }],
91
+ ['@swc/core', { from: '@swc/core', reason: 'Native Rust SWC.', transitive: 'fail' }],
92
+ ['prisma', { from: 'prisma', reason: 'Native query engine; not portable to Workers in this configuration.', transitive: 'fail' }],
93
+ ['@prisma/client', { from: '@prisma/client', reason: 'Native Prisma query engine.', transitive: 'fail' }],
94
+ ['node-gyp', { from: 'node-gyp', reason: 'Build-time native compiler; never runs in Workers.', transitive: 'warn' }],
95
+ ['node-pre-gyp', { from: 'node-pre-gyp', reason: 'Build-time native compiler; never runs in Workers.', transitive: 'warn' }],
96
+ ['puppeteer', { from: 'puppeteer', reason: 'Bundled Chromium binary (~150 MB).', transitive: 'fail' }],
97
+ ['playwright', { from: 'playwright', reason: 'Bundled browsers (~300 MB).', transitive: 'fail' }],
98
+ ['sql.js', { from: 'sql.js', reason: 'Installs but fails at runtime: ENOENT on dist/sql-wasm.wasm — loader gap (W6.5.x).', transitive: 'fail' }],
99
+ ['@swc/wasm-web', { from: '@swc/wasm-web', reason: 'Installs but fails at runtime: workerd CSP-like new-Function block in node-shims.ts:2058 — loader gap (W6.5.x).', transitive: 'fail' }],
100
+ // W6.5 additions:
101
+ ['@img/sharp-wasm32', { from: '@img/sharp-wasm32', reason: 'WASM build of sharp; wasm32-cpu-only AND libvips initThreads() fails under workerd (no pthread).', transitive: 'fail' }],
102
+ ['@napi-rs/canvas', { from: '@napi-rs/canvas', reason: 'Native bindings only; no WASM build published.', transitive: 'fail' }],
103
+ ['@napi-rs/canvas-wasm32-wasi', { from: '@napi-rs/canvas-wasm32-wasi', reason: 'Package does not exist on npm (404); @napi-rs/canvas has no WASM/WASI build.', transitive: 'fail' }],
104
+ // X.5-26b additions: Tailwind v4 oxide + lightningcss native parents.
105
+ // Mirror of REJECT_INSTALL adds in src/wasm-swap-registry.ts.
106
+ ['@tailwindcss/oxide', { from: '@tailwindcss/oxide', reason: 'Native Rust Tailwind v4 oxide engine; only platform-specific .node bindings + wasm32-wasi shard; workerd has no node:wasi.', transitive: 'fail' }],
107
+ ['lightningcss', { from: 'lightningcss', reason: 'Native Rust CSS parser; .node bindings + wasm32-wasi-only WASM build; workerd has no node:wasi; detect-libc also fails.', transitive: 'fail' }],
108
+ ]);
109
+ function SHOULD_SWAP(name) {
110
+ return __WASM_SWAPS.get(name);
111
+ }
112
+ function SHOULD_REJECT_FAIL(name) {
113
+ const r = __REJECT_INSTALL.get(name);
114
+ if (r && r.transitive === 'fail') return r;
115
+ return undefined;
116
+ }
117
+ function SHOULD_WARN_SKIP_TRANSITIVE(name) {
118
+ const r = __REJECT_INSTALL.get(name);
119
+ if (r && r.transitive === 'warn') return r;
120
+ return undefined;
121
+ }
122
+
123
+ // ── W6.5 telemetry: facet-side event collection ──────────────────────
124
+ // The facet cannot import the registry's emitRegistryEvent (preamble has
125
+ // no import surface). Instead, decision sites push into a shared
126
+ // __pendingEvents array which resolveTreeInFacet returns inside
127
+ // ResolveFacetResult.registryEvents. The supervisor drains it and
128
+ // flushes via emitRegistryEvent (npm-installer.ts).
129
+ //
130
+ // Shape of each entry:
131
+ // { type: 'swap', from, to, ctx: 'transitive' }
132
+ // { type: 'reject', from, reason, suggest?, ctx: 'transitive' }
133
+ // { type: 'transitive-skip', from, reason }
134
+ //
135
+ // Note: ctx is always 'transitive' from this path (the supervisor's
136
+ // applyW6Registry handles 'top'-ctx events directly without the facet).
137
+ const __pendingEvents = [];
138
+ function __EMIT_EVENT(e) { __pendingEvents.push(e); }
139
+ function __DRAIN_EVENTS() {
140
+ // Hand ownership to caller; reset for next run (defensive — facet
141
+ // function bodies are re-instantiated per run anyway).
142
+ const out = __pendingEvents.slice();
143
+ __pendingEvents.length = 0;
144
+ return out;
145
+ }
146
+
147
+ // ── Semver helpers (pasted from src/npm-resolver.ts:83-202) ─────────────
148
+ function PARSE_SEMVER(v) {
149
+ const m = v.replace(/^v/, '').match(/^(\\d+)\\.(\\d+)\\.(\\d+)/);
150
+ return m ? [parseInt(m[1]), parseInt(m[2]), parseInt(m[3])] : null;
151
+ }
152
+
153
+ function COMPARE_SEMVER(a, b) {
154
+ return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
155
+ }
156
+
157
+ function __SATISFIES_COMPARATOR(version, comparator) {
158
+ const comp = comparator.trim();
159
+ if (!comp || comp === '*' || comp === 'latest' || comp === '' || comp === 'x') return true;
160
+ let op = '';
161
+ let rangeStr = comp;
162
+ const prefixMatch = comp.match(/^([~^]|>=|<=|>|<|=)\\s*/);
163
+ if (prefixMatch) {
164
+ op = prefixMatch[1];
165
+ rangeStr = comp.slice(prefixMatch[0].length);
166
+ }
167
+ rangeStr = rangeStr.replace(/\\.x/g, '.0');
168
+ if (rangeStr.match(/^\\d+$/)) rangeStr += '.0.0';
169
+ else if (rangeStr.match(/^\\d+\\.\\d+$/)) rangeStr += '.0';
170
+ const vParts = PARSE_SEMVER(version);
171
+ const rParts = PARSE_SEMVER(rangeStr);
172
+ if (!vParts || !rParts) return false;
173
+ const cmp = COMPARE_SEMVER(vParts, rParts);
174
+ switch (op) {
175
+ case '^': {
176
+ if (rParts[0] > 0) {
177
+ return vParts[0] === rParts[0] && cmp >= 0;
178
+ }
179
+ if (rParts[1] > 0) {
180
+ return vParts[0] === 0 && vParts[1] === rParts[1] && cmp >= 0;
181
+ }
182
+ return vParts[0] === 0 && vParts[1] === 0 && vParts[2] === rParts[2];
183
+ }
184
+ case '~': {
185
+ return vParts[0] === rParts[0] && vParts[1] === rParts[1] && vParts[2] >= rParts[2];
186
+ }
187
+ case '>=': return cmp >= 0;
188
+ case '>': return cmp > 0;
189
+ case '<=': return cmp <= 0;
190
+ case '<': return cmp < 0;
191
+ case '=': return cmp === 0;
192
+ default: {
193
+ if (comp.match(/^\\d/)) {
194
+ return cmp === 0;
195
+ }
196
+ return cmp === 0;
197
+ }
198
+ }
199
+ }
200
+
201
+ function SATISFIES_RANGE(version, range) {
202
+ const trimmed = range.trim();
203
+ if (!trimmed || trimmed === '*' || trimmed === 'latest' || trimmed === '') return true;
204
+ const orParts = trimmed.split(/\\s*\\|\\|\\s*/);
205
+ for (const orPart of orParts) {
206
+ const hyphen = orPart.match(/^(\\S+)\\s+-\\s+(\\S+)$/);
207
+ if (hyphen) {
208
+ if (__SATISFIES_COMPARATOR(version, '>=' + hyphen[1]) &&
209
+ __SATISFIES_COMPARATOR(version, '<=' + hyphen[2])) {
210
+ return true;
211
+ }
212
+ continue;
213
+ }
214
+ const andParts = orPart.trim().split(/\\s+/);
215
+ const allMatch = andParts.every((part) => __SATISFIES_COMPARATOR(version, part));
216
+ if (allMatch) return true;
217
+ }
218
+ return false;
219
+ }
220
+
221
+ function RESOLVE_VERSION(versions, range) {
222
+ if (!range || range === 'latest' || range === '*' || range === '') return null;
223
+ const matching = versions.filter((v) => {
224
+ if (v.includes('-') && !range.includes('-')) return false;
225
+ return SATISFIES_RANGE(v, range);
226
+ });
227
+ if (matching.length === 0) return null;
228
+ matching.sort((a, b) => {
229
+ const ap = PARSE_SEMVER(a);
230
+ const bp = PARSE_SEMVER(b);
231
+ if (!ap || !bp) return 0;
232
+ return COMPARE_SEMVER(bp, ap);
233
+ });
234
+ return matching[0];
235
+ }
236
+ // ── end npm-resolve preamble ────────────────────────────────────────────
237
+ `;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * pre-bundle-preamble.ts — preamble injected into NimbusLoaderPool isolates
3
+ * that run src/pre-bundle-facet.ts.
4
+ *
5
+ * NimbusLoaderPool serialises the user function via fn.toString() and runs
6
+ * it inside a dynamic worker built from inline modules. Names referenced
7
+ * by the function at the module-top-level scope are NOT in that worker's
8
+ * lexical scope at runtime — they must be re-declared in the preamble.
9
+ *
10
+ * Specifically prebundleOne references:
11
+ * - ESBUILD_WASM_JS_FN_BODY — function-body string (~117 KiB) that,
12
+ * when run via new Function(...)(), returns
13
+ * the esbuild namespace. SMALL — kept inline.
14
+ * - resolvePackageEntry — the npm-resolver helper used by the
15
+ * bare-specifier resolver
16
+ *
17
+ * NOT in the preamble:
18
+ * - ESBUILD_WASM_BASE64 / wasm BYTES — the wasm Module is shipped via
19
+ * NimbusLoaderPool's `wasmModules` option (LOADER `modules` map
20
+ * entry shape `{ wasm: ArrayBuffer }`). Workerd compiles it at
21
+ * module-load (startup phase) and the pool's generated worker.js
22
+ * exposes the resulting WebAssembly.Module on
23
+ * globalThis.__NIMBUS_WASM['esbuild.wasm']. The pre-bundle facet
24
+ * reads it at request time and passes to esb.initialize().
25
+ *
26
+ * resolvePackageEntry is a pure-JS function from src/npm-resolver.ts;
27
+ * we inline its source here so the facet doesn't need to fault back
28
+ * to the supervisor for it.
29
+ *
30
+ * Preamble bytes are part of the loader-cache key for NimbusLoaderPool.
31
+ * Changing this file invalidates all warm slots in the pre-bundle pool;
32
+ * fine — esbuild boot is the dominant cost and re-paying it once on a
33
+ * deploy is acceptable.
34
+ */
35
+ /**
36
+ * Preamble string injected ahead of the prebundleOne function in every
37
+ * pre-bundle facet isolate. Must be passed via NimbusLoaderPool's
38
+ * `preamble` option.
39
+ */
40
+ export declare const PRE_BUNDLE_PREAMBLE: string;
41
+ //# sourceMappingURL=pre-bundle-preamble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pre-bundle-preamble.d.ts","sourceRoot":"","sources":["../../src/loaders/pre-bundle-preamble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AA4CH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAqCjC,CAAC"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * pre-bundle-preamble.ts — preamble injected into NimbusLoaderPool isolates
3
+ * that run src/pre-bundle-facet.ts.
4
+ *
5
+ * NimbusLoaderPool serialises the user function via fn.toString() and runs
6
+ * it inside a dynamic worker built from inline modules. Names referenced
7
+ * by the function at the module-top-level scope are NOT in that worker's
8
+ * lexical scope at runtime — they must be re-declared in the preamble.
9
+ *
10
+ * Specifically prebundleOne references:
11
+ * - ESBUILD_WASM_JS_FN_BODY — function-body string (~117 KiB) that,
12
+ * when run via new Function(...)(), returns
13
+ * the esbuild namespace. SMALL — kept inline.
14
+ * - resolvePackageEntry — the npm-resolver helper used by the
15
+ * bare-specifier resolver
16
+ *
17
+ * NOT in the preamble:
18
+ * - ESBUILD_WASM_BASE64 / wasm BYTES — the wasm Module is shipped via
19
+ * NimbusLoaderPool's `wasmModules` option (LOADER `modules` map
20
+ * entry shape `{ wasm: ArrayBuffer }`). Workerd compiles it at
21
+ * module-load (startup phase) and the pool's generated worker.js
22
+ * exposes the resulting WebAssembly.Module on
23
+ * globalThis.__NIMBUS_WASM['esbuild.wasm']. The pre-bundle facet
24
+ * reads it at request time and passes to esb.initialize().
25
+ *
26
+ * resolvePackageEntry is a pure-JS function from src/npm-resolver.ts;
27
+ * we inline its source here so the facet doesn't need to fault back
28
+ * to the supervisor for it.
29
+ *
30
+ * Preamble bytes are part of the loader-cache key for NimbusLoaderPool.
31
+ * Changing this file invalidates all warm slots in the pre-bundle pool;
32
+ * fine — esbuild boot is the dominant cost and re-paying it once on a
33
+ * deploy is acceptable.
34
+ */
35
+ import { ESBUILD_WASM_JS_FN_BODY, ESBUILD_WASM_VERSION, } from '../esbuild-wasm-bundle.generated.js';
36
+ import { getExportsResolverJS } from '../_shared/exports-resolver.js';
37
+ // NOTE: wasm BYTES deliberately NOT in this preamble. They live in
38
+ // env.ASSETS at /_assets/esbuild-<version>.wasm and are fetched by
39
+ // the supervisor at pool-construction time
40
+ // (src/esbuild-wasm-bytes.ts), then handed to NimbusLoaderPool's
41
+ // `wasmModules` option which registers them in the LOADER `modules`
42
+ // map as `{ wasm: ArrayBuffer }`. workerd compiles during the
43
+ // worker's module-load phase (where wasm code generation is
44
+ // permitted) and exposes the resulting WebAssembly.Module via the
45
+ // standard ESM import the pool prepends to worker.js.
46
+ //
47
+ // Earlier approaches that DIDN'T work (history kept for context):
48
+ // 1. Inline the ~16 MiB base64 in this preamble — workerd allocates
49
+ // a 16 MiB module-source string per pool.submit dispatch which
50
+ // combined with post-install supervisor heap state OOM-killed
51
+ // the DO on entry to the pre-bundle phase (verified on prod).
52
+ // 2. WebAssembly.compile() in the facet at request time — workerd's
53
+ // deployed config disallows wasm code generation at request time
54
+ // ("Wasm code generation disallowed by embedder").
55
+ // 3. RPC of a pre-compiled WebAssembly.Module from supervisor —
56
+ // workerd's structured-clone refuses Module transfer in this
57
+ // deploy ("Unable to deserialize cloned data").
58
+ //
59
+ // Phase 2 A'.5 also moved the bytes OUT of the supervisor module
60
+ // bundle (was a 16 MiB base64 string in the generated TS file → 21
61
+ // MiB UTF-16 in supervisor module scope). Now they only live where
62
+ // they're needed: in the LOADER cache after pool construction, and
63
+ // in env.ASSETS at rest.
64
+ /**
65
+ * Resolver helpers, sourced from src/_shared/exports-resolver.ts via
66
+ * getExportsResolverJS(). Single source of truth — see
67
+ * audit/sections/03-resolver-gaps.md §3.1 for the prior 3-copy drift this
68
+ * consolidates. The pre-bundle facet uses `resolvePackageEntry` (line 492
69
+ * of src/pre-bundle-facet.ts).
70
+ */
71
+ const RESOLVER_HELPERS_SRC = getExportsResolverJS();
72
+ /**
73
+ * Preamble string injected ahead of the prebundleOne function in every
74
+ * pre-bundle facet isolate. Must be passed via NimbusLoaderPool's
75
+ * `preamble` option.
76
+ */
77
+ export const PRE_BUNDLE_PREAMBLE = `
78
+ // ── pre-bundle facet preamble (auto-generated) ──────────────────────────
79
+ // Esbuild JS helpers (small ~117 KiB). The wasm BYTES are NOT here —
80
+ // they're fetched at facet boot via env.SUPERVISOR.getEsbuildWasm() to
81
+ // keep the per-dispatch worker module source under ~120 KiB instead of
82
+ // ~16 MiB. See src/parallel/pre-bundle-preamble.ts header for why.
83
+ const ESBUILD_WASM_VERSION = ${JSON.stringify(ESBUILD_WASM_VERSION)};
84
+ const ESBUILD_WASM_JS_FN_BODY = ${JSON.stringify(ESBUILD_WASM_JS_FN_BODY)};
85
+
86
+ // ── Materialise esbuild namespace at MODULE STARTUP ─────────────────────
87
+ // workerd's deployed config disallows \"Code generation from strings\" at
88
+ // request time inside dynamic workers (verified via prod repro: pre-bundle
89
+ // fn body called \`new Function(jsBody)()\` and got
90
+ // \"Code generation from strings disallowed for this context\" for every
91
+ // spec). The codebase already documents this constraint at
92
+ // src/node-shims.ts:1006-1015.
93
+ //
94
+ // Workaround: run \`new Function(...)()\` here in the preamble — preambles
95
+ // execute at module-load time (the worker's startup phase) where eval IS
96
+ // permitted. We capture the resulting esbuild namespace in a module-scope
97
+ // const that the user fn references at request time. Same pattern as
98
+ // src/facet-manager.ts:176 (USER_CODE is compiled in the generated module
99
+ // scope, not inside the request handler).
100
+ //
101
+ // Fail-safe: if even startup-time eval is blocked, set the cache to a
102
+ // sentinel object that the user fn detects and surfaces as a loud error
103
+ // (rather than passing undefined and crashing on .initialize).
104
+ let __NIMBUS_ESBUILD_NS = null;
105
+ let __NIMBUS_ESBUILD_INIT_ERR = null;
106
+ try {
107
+ __NIMBUS_ESBUILD_NS = (new Function(ESBUILD_WASM_JS_FN_BODY))();
108
+ } catch (e) {
109
+ __NIMBUS_ESBUILD_INIT_ERR = String((e && e.message) || e);
110
+ }
111
+
112
+ ${RESOLVER_HELPERS_SRC}
113
+ // ── end pre-bundle facet preamble ───────────────────────────────────────
114
+ `;
@@ -0,0 +1,24 @@
1
+ import type { WorkerCode } from './types.js';
2
+ export interface GenerateSourceOptions {
3
+ /**
4
+ * Key/value pairs injected as module-level `const` declarations,
5
+ * so the function body can reference them as if they were in closure scope.
6
+ * Values must be JSON-serializable.
7
+ */
8
+ context?: Record<string, unknown>;
9
+ /** When true, appends `this.env` as the last argument to the user function. */
10
+ passEnv?: boolean;
11
+ }
12
+ export declare function generateWorkerSource(fnSource: string, opts?: GenerateSourceOptions): string;
13
+ export interface WorkerCodeOptions {
14
+ compatibilityDate?: string;
15
+ compatibilityFlags?: string[];
16
+ env?: Record<string, unknown>;
17
+ /**
18
+ * Network access: `null` (default) = sandboxed, `undefined` = inherit parent,
19
+ * or a service stub to redirect outbound through.
20
+ */
21
+ globalOutbound?: WorkerCode['globalOutbound'];
22
+ }
23
+ export declare function buildWorkerCode(fnSource: string, opts?: WorkerCodeOptions, sourceOpts?: GenerateSourceOptions): WorkerCode;
24
+ //# sourceMappingURL=codegen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../../src/loaders/vendor/codegen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,qBAAqB,GAC3B,MAAM,CAkCR;AAED,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B;;;OAGG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;CAC/C;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,iBAAiB,EACxB,UAAU,CAAC,EAAE,qBAAqB,GACjC,UAAU,CAyBZ"}
@@ -0,0 +1,44 @@
1
+ const DEFAULT_COMPAT_DATE = '2025-06-01';
2
+ export function generateWorkerSource(fnSource, opts) {
3
+ const lines = [
4
+ 'import { WorkerEntrypoint } from "cloudflare:workers";',
5
+ '',
6
+ ];
7
+ if (opts?.context) {
8
+ for (const [key, value] of Object.entries(opts.context)) {
9
+ lines.push(`const ${key} = ${JSON.stringify(value)};`);
10
+ }
11
+ lines.push('');
12
+ }
13
+ lines.push(`const __fn__ = ${fnSource};`);
14
+ lines.push('');
15
+ const callExpr = opts?.passEnv
16
+ ? '__fn__(...args, this.env)'
17
+ : '__fn__(...args)';
18
+ lines.push('export default class extends WorkerEntrypoint {', ' execute(...args) {', ` const result = ${callExpr};`, ' // Transparently await async/promise-returning functions.', ' if (result instanceof Promise) {', ' return result;', ' }', ' return result;', ' }', '}');
19
+ return lines.join('\n');
20
+ }
21
+ export function buildWorkerCode(fnSource, opts, sourceOpts) {
22
+ const moduleSource = generateWorkerSource(fnSource, sourceOpts);
23
+ const code = {
24
+ compatibilityDate: opts?.compatibilityDate ?? DEFAULT_COMPAT_DATE,
25
+ compatibilityFlags: opts?.compatibilityFlags,
26
+ mainModule: 'worker.js',
27
+ modules: {
28
+ 'worker.js': moduleSource,
29
+ },
30
+ env: opts?.env,
31
+ };
32
+ // WorkerCode.globalOutbound: omitted = inherit, null = sandboxed, ServiceStub = redirect.
33
+ // Distinguish explicit `{ globalOutbound: undefined }` (inherit) from key-absent (sandbox).
34
+ if (opts && 'globalOutbound' in opts) {
35
+ if (opts.globalOutbound !== undefined) {
36
+ code.globalOutbound = opts.globalOutbound;
37
+ }
38
+ // else: explicitly undefined — omit key to inherit parent network
39
+ }
40
+ else {
41
+ code.globalOutbound = null;
42
+ }
43
+ return code;
44
+ }
@@ -0,0 +1,24 @@
1
+ export declare class ParallelError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare class SerializationError extends ParallelError {
5
+ constructor(message: string);
6
+ }
7
+ export declare class ExecutionError extends ParallelError {
8
+ readonly remoteMessage: string;
9
+ readonly remoteStack?: string;
10
+ constructor(message: string, remoteStack?: string);
11
+ }
12
+ export declare class TimeoutError extends ParallelError {
13
+ readonly deadlineMs: number;
14
+ constructor(deadlineMs: number);
15
+ }
16
+ export declare class RetryExhaustedError extends ParallelError {
17
+ readonly lastError: Error;
18
+ readonly attempts: number;
19
+ constructor(attempts: number, lastError: Error);
20
+ }
21
+ export declare class BindingError extends ParallelError {
22
+ constructor(message: string);
23
+ }
24
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/loaders/vendor/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,aAAa;gBACvC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,cAAe,SAAQ,aAAa;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;CAMlD;AAED,qBAAa,YAAa,SAAQ,aAAa;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,UAAU,EAAE,MAAM;CAK/B;AAED,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK;CAQ/C;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAI5B"}
@@ -0,0 +1,46 @@
1
+ export class ParallelError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = 'ParallelError';
5
+ }
6
+ }
7
+ export class SerializationError extends ParallelError {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'SerializationError';
11
+ }
12
+ }
13
+ export class ExecutionError extends ParallelError {
14
+ remoteMessage;
15
+ remoteStack;
16
+ constructor(message, remoteStack) {
17
+ super(message);
18
+ this.name = 'ExecutionError';
19
+ this.remoteMessage = message;
20
+ this.remoteStack = remoteStack;
21
+ }
22
+ }
23
+ export class TimeoutError extends ParallelError {
24
+ deadlineMs;
25
+ constructor(deadlineMs) {
26
+ super(`Task exceeded ${deadlineMs}ms deadline`);
27
+ this.name = 'TimeoutError';
28
+ this.deadlineMs = deadlineMs;
29
+ }
30
+ }
31
+ export class RetryExhaustedError extends ParallelError {
32
+ lastError;
33
+ attempts;
34
+ constructor(attempts, lastError) {
35
+ super(`Task failed after ${attempts} attempt(s): ${lastError.message}`);
36
+ this.name = 'RetryExhaustedError';
37
+ this.attempts = attempts;
38
+ this.lastError = lastError;
39
+ }
40
+ }
41
+ export class BindingError extends ParallelError {
42
+ constructor(message) {
43
+ super(message);
44
+ this.name = 'BindingError';
45
+ }
46
+ }
@@ -0,0 +1,16 @@
1
+ export { WorkerPool } from './pool.js';
2
+ export type { PoolOptions, MapOptions, PmapOptions, SubmitOptions, StreamOptions, StreamResult, ScatterOptions, ResilienceOptions, OnErrorStrategy, } from './pool.js';
3
+ export { pure, isPure, constant } from './primitives.js';
4
+ export type { Pure } from './primitives.js';
5
+ export { serializeFunction, hashSource } from './serialize.js';
6
+ export { generateWorkerSource, buildWorkerCode } from './codegen.js';
7
+ export type { WorkerCodeOptions, GenerateSourceOptions } from './codegen.js';
8
+ export { ParallelError, SerializationError, ExecutionError, TimeoutError, RetryExhaustedError, BindingError, } from './errors.js';
9
+ export type { WorkerLoader, WorkerCode, WorkerStub, EntrypointStub, EntrypointOptions, GetCodeCallback, ServiceStub, ModuleContent, } from './types.js';
10
+ import { WorkerPool } from './pool.js';
11
+ import type { PoolOptions } from './pool.js';
12
+ import type { WorkerLoader } from './types.js';
13
+ export declare const Parallel: {
14
+ readonly pool: (loader: WorkerLoader, opts?: PoolOptions) => WorkerPool;
15
+ };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loaders/vendor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,QAAQ;4BACN,YAAY,SAAS,WAAW,KAAG,UAAU;CAGlD,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { WorkerPool } from './pool.js';
2
+ export { pure, isPure, constant } from './primitives.js';
3
+ export { serializeFunction, hashSource } from './serialize.js';
4
+ export { generateWorkerSource, buildWorkerCode } from './codegen.js';
5
+ export { ParallelError, SerializationError, ExecutionError, TimeoutError, RetryExhaustedError, BindingError, } from './errors.js';
6
+ import { WorkerPool } from './pool.js';
7
+ export const Parallel = {
8
+ pool(loader, opts) {
9
+ return new WorkerPool(loader, opts);
10
+ },
11
+ };