@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.
- package/README.md +219 -0
- package/dist/_shared/bytes.d.ts +18 -0
- package/dist/_shared/bytes.d.ts.map +1 -0
- package/dist/_shared/bytes.js +17 -0
- package/dist/_shared/cache-stats.d.ts +146 -0
- package/dist/_shared/cache-stats.d.ts.map +1 -0
- package/dist/_shared/cache-stats.js +162 -0
- package/dist/_shared/exports-resolver.d.ts +76 -0
- package/dist/_shared/exports-resolver.d.ts.map +1 -0
- package/dist/_shared/exports-resolver.js +284 -0
- package/dist/_shared/install-phase.d.ts +47 -0
- package/dist/_shared/install-phase.d.ts.map +1 -0
- package/dist/_shared/install-phase.js +1 -0
- package/dist/_shared/real-node-imports.d.ts +38 -0
- package/dist/_shared/real-node-imports.d.ts.map +1 -0
- package/dist/_shared/real-node-imports.js +46 -0
- package/dist/_shared/retry.d.ts +93 -0
- package/dist/_shared/retry.d.ts.map +1 -0
- package/dist/_shared/retry.js +161 -0
- package/dist/_shared/session-id.d.ts +39 -0
- package/dist/_shared/session-id.d.ts.map +1 -0
- package/dist/_shared/session-id.js +127 -0
- package/dist/_shared/session-router.d.ts +104 -0
- package/dist/_shared/session-router.d.ts.map +1 -0
- package/dist/_shared/session-router.js +165 -0
- package/dist/_shared/w7-frame.d.ts +93 -0
- package/dist/_shared/w7-frame.d.ts.map +1 -0
- package/dist/_shared/w7-frame.js +402 -0
- package/dist/auth/index.d.ts +16 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +15 -0
- package/dist/auth/middleware.d.ts +85 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +150 -0
- package/dist/auth/token.d.ts +96 -0
- package/dist/auth/token.d.ts.map +1 -0
- package/dist/auth/token.js +226 -0
- package/dist/auth/types.d.ts +141 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +114 -0
- package/dist/bindings/d1.d.ts +102 -0
- package/dist/bindings/d1.d.ts.map +1 -0
- package/dist/bindings/d1.js +549 -0
- package/dist/bindings/kv.d.ts +82 -0
- package/dist/bindings/kv.d.ts.map +1 -0
- package/dist/bindings/kv.js +290 -0
- package/dist/bindings/r2.d.ts +137 -0
- package/dist/bindings/r2.d.ts.map +1 -0
- package/dist/bindings/r2.js +379 -0
- package/dist/cirrus-npm-cjs.generated.d.ts +17 -0
- package/dist/cirrus-npm-cjs.generated.d.ts.map +1 -0
- package/dist/cirrus-npm-cjs.generated.js +41 -0
- package/dist/cirrus-plugin-react.generated.d.ts +34 -0
- package/dist/cirrus-plugin-react.generated.d.ts.map +1 -0
- package/dist/cirrus-plugin-react.generated.js +33 -0
- package/dist/constants.d.ts +34 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +116 -0
- package/dist/esbuild-wasm-bundle.generated.d.ts +41 -0
- package/dist/esbuild-wasm-bundle.generated.d.ts.map +1 -0
- package/dist/esbuild-wasm-bundle.generated.js +40 -0
- package/dist/facets/cirrus-real.d.ts +147 -0
- package/dist/facets/cirrus-real.d.ts.map +1 -0
- package/dist/facets/cirrus-real.js +981 -0
- package/dist/facets/inner-do-registry.d.ts +41 -0
- package/dist/facets/inner-do-registry.d.ts.map +1 -0
- package/dist/facets/inner-do-registry.js +51 -0
- package/dist/facets/manager.d.ts +314 -0
- package/dist/facets/manager.d.ts.map +1 -0
- package/dist/facets/manager.js +2681 -0
- package/dist/facets/process.d.ts +318 -0
- package/dist/facets/process.d.ts.map +1 -0
- package/dist/facets/process.js +567 -0
- package/dist/facets/real-vite-fs-shim.d.ts +151 -0
- package/dist/facets/real-vite-fs-shim.d.ts.map +1 -0
- package/dist/facets/real-vite-fs-shim.js +1279 -0
- package/dist/facets/real-vite-hmr.d.ts +142 -0
- package/dist/facets/real-vite-hmr.d.ts.map +1 -0
- package/dist/facets/real-vite-hmr.js +476 -0
- package/dist/facets/vite-dev-server.d.ts +293 -0
- package/dist/facets/vite-dev-server.d.ts.map +1 -0
- package/dist/facets/vite-dev-server.js +2580 -0
- package/dist/facets/wasm-swap-registry.d.ts +261 -0
- package/dist/facets/wasm-swap-registry.d.ts.map +1 -0
- package/dist/facets/wasm-swap-registry.js +551 -0
- package/dist/facets/ws-terminal.d.ts +107 -0
- package/dist/facets/ws-terminal.d.ts.map +1 -0
- package/dist/facets/ws-terminal.js +207 -0
- package/dist/git/commands.d.ts +13 -0
- package/dist/git/commands.d.ts.map +1 -0
- package/dist/git/commands.js +633 -0
- package/dist/git/network-facet.d.ts +61 -0
- package/dist/git/network-facet.d.ts.map +1 -0
- package/dist/git/network-facet.js +700 -0
- package/dist/git-bundle.generated.d.ts +16 -0
- package/dist/git-bundle.generated.d.ts.map +1 -0
- package/dist/git-bundle.generated.js +15 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/loaders/child-process/spawn-facet.d.ts +90 -0
- package/dist/loaders/child-process/spawn-facet.d.ts.map +1 -0
- package/dist/loaders/child-process/spawn-facet.js +103 -0
- package/dist/loaders/child-process/spawn-pool.d.ts +110 -0
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -0
- package/dist/loaders/child-process/spawn-pool.js +161 -0
- package/dist/loaders/fanout-pool.d.ts +195 -0
- package/dist/loaders/fanout-pool.d.ts.map +1 -0
- package/dist/loaders/fanout-pool.js +326 -0
- package/dist/loaders/generated-workers.d.ts +26 -0
- package/dist/loaders/generated-workers.d.ts.map +1 -0
- package/dist/loaders/generated-workers.js +25 -0
- package/dist/loaders/index.d.ts +15 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +13 -0
- package/dist/loaders/loader-pool.d.ts +273 -0
- package/dist/loaders/loader-pool.d.ts.map +1 -0
- package/dist/loaders/loader-pool.js +624 -0
- package/dist/loaders/npm-resolve-preamble.d.ts +34 -0
- package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -0
- package/dist/loaders/npm-resolve-preamble.js +237 -0
- package/dist/loaders/pre-bundle-preamble.d.ts +41 -0
- package/dist/loaders/pre-bundle-preamble.d.ts.map +1 -0
- package/dist/loaders/pre-bundle-preamble.js +114 -0
- package/dist/loaders/vendor/codegen.d.ts +24 -0
- package/dist/loaders/vendor/codegen.d.ts.map +1 -0
- package/dist/loaders/vendor/codegen.js +44 -0
- package/dist/loaders/vendor/errors.d.ts +24 -0
- package/dist/loaders/vendor/errors.d.ts.map +1 -0
- package/dist/loaders/vendor/errors.js +46 -0
- package/dist/loaders/vendor/index.d.ts +16 -0
- package/dist/loaders/vendor/index.d.ts.map +1 -0
- package/dist/loaders/vendor/index.js +11 -0
- package/dist/loaders/vendor/pool.d.ts +88 -0
- package/dist/loaders/vendor/pool.d.ts.map +1 -0
- package/dist/loaders/vendor/pool.js +353 -0
- package/dist/loaders/vendor/primitives.d.ts +11 -0
- package/dist/loaders/vendor/primitives.d.ts.map +1 -0
- package/dist/loaders/vendor/primitives.js +33 -0
- package/dist/loaders/vendor/serialize.d.ts +3 -0
- package/dist/loaders/vendor/serialize.d.ts.map +1 -0
- package/dist/loaders/vendor/serialize.js +25 -0
- package/dist/loaders/vendor/types.d.ts +60 -0
- package/dist/loaders/vendor/types.d.ts.map +1 -0
- package/dist/loaders/vendor/types.js +4 -0
- package/dist/npm/cache.d.ts +136 -0
- package/dist/npm/cache.d.ts.map +1 -0
- package/dist/npm/cache.js +429 -0
- package/dist/npm/install-batch-facet.d.ts +129 -0
- package/dist/npm/install-batch-facet.d.ts.map +1 -0
- package/dist/npm/install-batch-facet.js +598 -0
- package/dist/npm/install-facet.d.ts +29 -0
- package/dist/npm/install-facet.d.ts.map +1 -0
- package/dist/npm/install-facet.js +9 -0
- package/dist/npm/installer.d.ts +239 -0
- package/dist/npm/installer.d.ts.map +1 -0
- package/dist/npm/installer.js +2022 -0
- package/dist/npm/npx-install.d.ts +74 -0
- package/dist/npm/npx-install.d.ts.map +1 -0
- package/dist/npm/npx-install.js +302 -0
- package/dist/npm/pre-bundle-facet.d.ts +168 -0
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -0
- package/dist/npm/pre-bundle-facet.js +653 -0
- package/dist/npm/r2-cache.d.ts +286 -0
- package/dist/npm/r2-cache.d.ts.map +1 -0
- package/dist/npm/r2-cache.js +506 -0
- package/dist/npm/resolve-facet.d.ts +202 -0
- package/dist/npm/resolve-facet.d.ts.map +1 -0
- package/dist/npm/resolve-facet.js +833 -0
- package/dist/npm/resolve-one-facet.d.ts +204 -0
- package/dist/npm/resolve-one-facet.d.ts.map +1 -0
- package/dist/npm/resolve-one-facet.js +437 -0
- package/dist/npm/resolver.d.ts +109 -0
- package/dist/npm/resolver.d.ts.map +1 -0
- package/dist/npm/resolver.js +899 -0
- package/dist/npm/tarball-stream.d.ts +85 -0
- package/dist/npm/tarball-stream.d.ts.map +1 -0
- package/dist/npm/tarball-stream.js +205 -0
- package/dist/npm/tarball.d.ts +51 -0
- package/dist/npm/tarball.d.ts.map +1 -0
- package/dist/npm/tarball.js +185 -0
- package/dist/observability/diag-counters.d.ts +292 -0
- package/dist/observability/diag-counters.d.ts.map +1 -0
- package/dist/observability/diag-counters.js +302 -0
- package/dist/observability/heap-estimate.d.ts +166 -0
- package/dist/observability/heap-estimate.d.ts.map +1 -0
- package/dist/observability/heap-estimate.js +192 -0
- package/dist/observability/heavy-alloc-coord.d.ts +95 -0
- package/dist/observability/heavy-alloc-coord.d.ts.map +1 -0
- package/dist/observability/heavy-alloc-coord.js +149 -0
- package/dist/observability/oom-classify.d.ts +56 -0
- package/dist/observability/oom-classify.d.ts.map +1 -0
- package/dist/observability/oom-classify.js +118 -0
- package/dist/observability/oom-discriminator.d.ts +192 -0
- package/dist/observability/oom-discriminator.d.ts.map +1 -0
- package/dist/observability/oom-discriminator.js +233 -0
- package/dist/real-vite-bundle.generated.d.ts +46 -0
- package/dist/real-vite-bundle.generated.d.ts.map +1 -0
- package/dist/real-vite-bundle.generated.js +53 -0
- package/dist/replica/routing.d.ts +171 -0
- package/dist/replica/routing.d.ts.map +1 -0
- package/dist/replica/routing.js +288 -0
- package/dist/replica/suspension.d.ts +36 -0
- package/dist/replica/suspension.d.ts.map +1 -0
- package/dist/replica/suspension.js +49 -0
- package/dist/router/index.d.ts +156 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +220 -0
- package/dist/runtime/assets-loader.d.ts +71 -0
- package/dist/runtime/assets-loader.d.ts.map +1 -0
- package/dist/runtime/assets-loader.js +128 -0
- package/dist/runtime/barrel-detect.d.ts +46 -0
- package/dist/runtime/barrel-detect.d.ts.map +1 -0
- package/dist/runtime/barrel-detect.js +73 -0
- package/dist/runtime/barrel-synthesizer.d.ts +181 -0
- package/dist/runtime/barrel-synthesizer.d.ts.map +1 -0
- package/dist/runtime/barrel-synthesizer.js +541 -0
- package/dist/runtime/bun-repl.d.ts +46 -0
- package/dist/runtime/bun-repl.d.ts.map +1 -0
- package/dist/runtime/bun-repl.js +326 -0
- package/dist/runtime/bun-runner.d.ts +66 -0
- package/dist/runtime/bun-runner.d.ts.map +1 -0
- package/dist/runtime/bun-runner.js +219 -0
- package/dist/runtime/clang-runner.d.ts +38 -0
- package/dist/runtime/clang-runner.d.ts.map +1 -0
- package/dist/runtime/clang-runner.js +1033 -0
- package/dist/runtime/comment-strip.d.ts +37 -0
- package/dist/runtime/comment-strip.d.ts.map +1 -0
- package/dist/runtime/comment-strip.js +74 -0
- package/dist/runtime/esbuild-service.d.ts +201 -0
- package/dist/runtime/esbuild-service.d.ts.map +1 -0
- package/dist/runtime/esbuild-service.js +1444 -0
- package/dist/runtime/esbuild-wasm-bytes.d.ts +87 -0
- package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -0
- package/dist/runtime/esbuild-wasm-bytes.js +131 -0
- package/dist/runtime/framework-detect.d.ts +71 -0
- package/dist/runtime/framework-detect.d.ts.map +1 -0
- package/dist/runtime/framework-detect.js +178 -0
- package/dist/runtime/long-running-handle.d.ts +133 -0
- package/dist/runtime/long-running-handle.d.ts.map +1 -0
- package/dist/runtime/long-running-handle.js +192 -0
- package/dist/runtime/node-repl.d.ts +36 -0
- package/dist/runtime/node-repl.d.ts.map +1 -0
- package/dist/runtime/node-repl.js +293 -0
- package/dist/runtime/node-runner.d.ts +111 -0
- package/dist/runtime/node-runner.d.ts.map +1 -0
- package/dist/runtime/node-runner.js +194 -0
- package/dist/runtime/node-shims.d.ts +24 -0
- package/dist/runtime/node-shims.d.ts.map +1 -0
- package/dist/runtime/node-shims.js +3019 -0
- package/dist/runtime/package-manager.d.ts +118 -0
- package/dist/runtime/package-manager.d.ts.map +1 -0
- package/dist/runtime/package-manager.js +420 -0
- package/dist/runtime/port-registry.d.ts +80 -0
- package/dist/runtime/port-registry.d.ts.map +1 -0
- package/dist/runtime/port-registry.js +166 -0
- package/dist/runtime/process-logs-api.d.ts +102 -0
- package/dist/runtime/process-logs-api.d.ts.map +1 -0
- package/dist/runtime/process-logs-api.js +253 -0
- package/dist/runtime/process-logs.d.ts +311 -0
- package/dist/runtime/process-logs.d.ts.map +1 -0
- package/dist/runtime/process-logs.js +656 -0
- package/dist/runtime/process-table.d.ts +65 -0
- package/dist/runtime/process-table.d.ts.map +1 -0
- package/dist/runtime/process-table.js +107 -0
- package/dist/runtime/project-detect.d.ts +21 -0
- package/dist/runtime/project-detect.d.ts.map +1 -0
- package/dist/runtime/project-detect.js +46 -0
- package/dist/runtime/python-repl.d.ts +66 -0
- package/dist/runtime/python-repl.d.ts.map +1 -0
- package/dist/runtime/python-repl.js +563 -0
- package/dist/runtime/python-runner.d.ts +50 -0
- package/dist/runtime/python-runner.d.ts.map +1 -0
- package/dist/runtime/python-runner.js +870 -0
- package/dist/runtime/repl-session.d.ts +160 -0
- package/dist/runtime/repl-session.d.ts.map +1 -0
- package/dist/runtime/repl-session.js +393 -0
- package/dist/runtime/require-resolver.d.ts +52 -0
- package/dist/runtime/require-resolver.d.ts.map +1 -0
- package/dist/runtime/require-resolver.js +690 -0
- package/dist/runtime/router-basename.d.ts +36 -0
- package/dist/runtime/router-basename.d.ts.map +1 -0
- package/dist/runtime/router-basename.js +310 -0
- package/dist/runtime/ruby-repl.d.ts +43 -0
- package/dist/runtime/ruby-repl.d.ts.map +1 -0
- package/dist/runtime/ruby-repl.js +229 -0
- package/dist/runtime/ruby-runner.d.ts +62 -0
- package/dist/runtime/ruby-runner.d.ts.map +1 -0
- package/dist/runtime/ruby-runner.js +737 -0
- package/dist/runtime/runtime-catalog.d.ts +99 -0
- package/dist/runtime/runtime-catalog.d.ts.map +1 -0
- package/dist/runtime/runtime-catalog.js +183 -0
- package/dist/runtime/runtime-registry.d.ts +136 -0
- package/dist/runtime/runtime-registry.d.ts.map +1 -0
- package/dist/runtime/runtime-registry.js +318 -0
- package/dist/runtime/streams.d.ts +13 -0
- package/dist/runtime/streams.d.ts.map +1 -0
- package/dist/runtime/streams.js +402 -0
- package/dist/runtime/wasi-instance.d.ts +190 -0
- package/dist/runtime/wasi-instance.d.ts.map +1 -0
- package/dist/runtime/wasi-instance.js +2044 -0
- package/dist/runtime/wasm-runner.d.ts +117 -0
- package/dist/runtime/wasm-runner.d.ts.map +1 -0
- package/dist/runtime/wasm-runner.js +705 -0
- package/dist/session/bindings.d.ts +168 -0
- package/dist/session/bindings.d.ts.map +1 -0
- package/dist/session/bindings.js +524 -0
- package/dist/session/ctx-exports.d.ts +16 -0
- package/dist/session/ctx-exports.d.ts.map +1 -0
- package/dist/session/ctx-exports.js +22 -0
- package/dist/session/diag.d.ts +62 -0
- package/dist/session/diag.d.ts.map +1 -0
- package/dist/session/diag.js +118 -0
- package/dist/session/fs-watch.d.ts +132 -0
- package/dist/session/fs-watch.d.ts.map +1 -0
- package/dist/session/fs-watch.js +255 -0
- package/dist/session/helpers.d.ts +150 -0
- package/dist/session/helpers.d.ts.map +1 -0
- package/dist/session/helpers.js +472 -0
- package/dist/session/hibernation.d.ts +145 -0
- package/dist/session/hibernation.d.ts.map +1 -0
- package/dist/session/hibernation.js +385 -0
- package/dist/session/init-phases.d.ts +87 -0
- package/dist/session/init-phases.d.ts.map +1 -0
- package/dist/session/init-phases.js +137 -0
- package/dist/session/init.d.ts +46 -0
- package/dist/session/init.d.ts.map +1 -0
- package/dist/session/init.js +3579 -0
- package/dist/session/keys.d.ts +56 -0
- package/dist/session/keys.d.ts.map +1 -0
- package/dist/session/keys.js +55 -0
- package/dist/session/nimbus-session.d.ts +434 -0
- package/dist/session/nimbus-session.d.ts.map +1 -0
- package/dist/session/nimbus-session.js +1084 -0
- package/dist/session/programmatic.d.ts +105 -0
- package/dist/session/programmatic.d.ts.map +1 -0
- package/dist/session/programmatic.js +326 -0
- package/dist/session/replica-routes.d.ts +68 -0
- package/dist/session/replica-routes.d.ts.map +1 -0
- package/dist/session/replica-routes.js +77 -0
- package/dist/session/routes.d.ts +29 -0
- package/dist/session/routes.d.ts.map +1 -0
- package/dist/session/routes.js +1331 -0
- package/dist/session/rpc.d.ts +323 -0
- package/dist/session/rpc.d.ts.map +1 -0
- package/dist/session/rpc.js +808 -0
- package/dist/session/state-store.d.ts +210 -0
- package/dist/session/state-store.d.ts.map +1 -0
- package/dist/session/state-store.js +459 -0
- package/dist/session/supervisor-rpc.d.ts +269 -0
- package/dist/session/supervisor-rpc.d.ts.map +1 -0
- package/dist/session/supervisor-rpc.js +437 -0
- package/dist/session/ws-hibernation-config.d.ts +64 -0
- package/dist/session/ws-hibernation-config.d.ts.map +1 -0
- package/dist/session/ws-hibernation-config.js +89 -0
- package/dist/session/ws.d.ts +95 -0
- package/dist/session/ws.d.ts.map +1 -0
- package/dist/session/ws.js +395 -0
- package/dist/shell/features.d.ts +410 -0
- package/dist/shell/features.d.ts.map +1 -0
- package/dist/shell/features.js +1885 -0
- package/dist/shell/unix-commands.d.ts +15 -0
- package/dist/shell/unix-commands.d.ts.map +1 -0
- package/dist/shell/unix-commands.js +3703 -0
- package/dist/stubs/lifo-ui.d.ts +10 -0
- package/dist/stubs/lifo-ui.d.ts.map +1 -0
- package/dist/stubs/lifo-ui.js +1 -0
- package/dist/tailwind-play.generated.d.ts +19 -0
- package/dist/tailwind-play.generated.d.ts.map +1 -0
- package/dist/tailwind-play.generated.js +18 -0
- package/dist/vfs/dev-provider.d.ts +64 -0
- package/dist/vfs/dev-provider.d.ts.map +1 -0
- package/dist/vfs/dev-provider.js +191 -0
- package/dist/vfs/events.d.ts +51 -0
- package/dist/vfs/events.d.ts.map +1 -0
- package/dist/vfs/events.js +127 -0
- package/dist/vfs/path.d.ts +30 -0
- package/dist/vfs/path.d.ts.map +1 -0
- package/dist/vfs/path.js +41 -0
- package/dist/vfs/seed-project.d.ts +62 -0
- package/dist/vfs/seed-project.d.ts.map +1 -0
- package/dist/vfs/seed-project.js +1045 -0
- package/dist/vfs/sqlite-vfs.d.ts +435 -0
- package/dist/vfs/sqlite-vfs.d.ts.map +1 -0
- package/dist/vfs/sqlite-vfs.js +1670 -0
- package/dist/vfs/symlink-registry.d.ts +64 -0
- package/dist/vfs/symlink-registry.d.ts.map +1 -0
- package/dist/vfs/symlink-registry.js +137 -0
- package/dist/wrangler/nimbus-wrangler.d.ts +157 -0
- package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -0
- package/dist/wrangler/nimbus-wrangler.js +931 -0
- package/package.json +77 -0
- package/public/_assets/cirrus-plugin-react.bundle.js +70740 -0
- package/public/_assets/esbuild-0.24.2.wasm +0 -0
- package/public/_assets/real-vite-bundle.js +101478 -0
- package/public/_assets/rollup.wasm +0 -0
- package/public/favicon.svg +8 -0
- package/public/index.html +565 -0
- package/public/s/index.html +2379 -0
- package/scripts/bundle-esbuild-wasm.mjs +244 -0
- package/scripts/bundle-facet-workers.mjs +137 -0
- package/scripts/bundle-git.mjs +118 -0
- package/scripts/bundle-npm-cjs.mjs +363 -0
- package/scripts/bundle-plugin-react.mjs +480 -0
- package/scripts/bundle-real-vite.mjs +959 -0
- package/scripts/bundle-runtime.mjs +600 -0
- package/scripts/bundle-tailwind-play.mjs +130 -0
- package/scripts/patch-lifo-ui.mjs +131 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm-installer.ts — Unified npm installer for Nimbus.
|
|
3
|
+
*
|
|
4
|
+
* Designed for bun/pnpm-level performance on Cloudflare DO + SQLite.
|
|
5
|
+
*
|
|
6
|
+
* Pipeline:
|
|
7
|
+
* Phase 0: Lock-check — instant if lockfile valid
|
|
8
|
+
* Phase 1: Resolve — pipelined, 12-wide concurrency, registry cached
|
|
9
|
+
* Phase 2: Hoist — compute flat node_modules layout
|
|
10
|
+
* Phase 3: Diff — skip packages already cached
|
|
11
|
+
* Phase 4: Fetch+Extract — wave-based, 15 pkgs/wave, cache results
|
|
12
|
+
* Phase 5: Write — ONE transactionSync() per wave via writeBatch()
|
|
13
|
+
* Phase 6: Link bins — create node_modules/.bin/ entries
|
|
14
|
+
* Phase 7: Pre-bundle — scan source, esbuild used packages (background)
|
|
15
|
+
*
|
|
16
|
+
* Key invariants:
|
|
17
|
+
* - All VFS writes go through writeBatch() (never individual writeFile)
|
|
18
|
+
* - Tarball cache is per-package (name, version) — no cross-package dedup
|
|
19
|
+
* - Lockfile stored in SQLite (not JSON file)
|
|
20
|
+
* - ESM pre-bundles cached in SQLite for /@modules/ serving
|
|
21
|
+
*/
|
|
22
|
+
import type { SqliteVFS } from '../vfs/sqlite-vfs.js';
|
|
23
|
+
import type { EsbuildService } from '../runtime/esbuild-service.js';
|
|
24
|
+
import { NpmCache } from './cache.js';
|
|
25
|
+
import { type FetchFn } from './resolver.js';
|
|
26
|
+
export type { InstallPhase } from '../_shared/install-phase.js';
|
|
27
|
+
import type { InstallPhase } from '../_shared/install-phase.js';
|
|
28
|
+
export interface InstallProgress {
|
|
29
|
+
phase: InstallPhase;
|
|
30
|
+
resolved: number;
|
|
31
|
+
totalToResolve: number;
|
|
32
|
+
fetched: number;
|
|
33
|
+
totalToFetch: number;
|
|
34
|
+
written: number;
|
|
35
|
+
totalToWrite: number;
|
|
36
|
+
cachedHits: number;
|
|
37
|
+
elapsed: number;
|
|
38
|
+
}
|
|
39
|
+
export interface NpmInstallResult {
|
|
40
|
+
installed: string[];
|
|
41
|
+
failed: string[];
|
|
42
|
+
totalFiles: number;
|
|
43
|
+
elapsed: number;
|
|
44
|
+
cachedHits: number;
|
|
45
|
+
phases: Record<string, number>;
|
|
46
|
+
}
|
|
47
|
+
export declare class NpmInstaller {
|
|
48
|
+
private vfs;
|
|
49
|
+
private cache;
|
|
50
|
+
private esbuild;
|
|
51
|
+
private ctx;
|
|
52
|
+
private env;
|
|
53
|
+
private onProgress;
|
|
54
|
+
/**
|
|
55
|
+
* Injectable fetch function. Required because DO fetch() hangs in
|
|
56
|
+
* wrangler local dev. The caller (NimbusSession) provides a function
|
|
57
|
+
* that routes fetches through a facet worker. Used only by the resolve
|
|
58
|
+
* path (packument JSON) — tarball fetches happen inside the facet pool
|
|
59
|
+
* when the feature flag is on, using the facet's own global fetch.
|
|
60
|
+
*/
|
|
61
|
+
private fetchFn;
|
|
62
|
+
constructor(vfs: SqliteVFS, sql: SqlStorage, opts?: {
|
|
63
|
+
esbuild?: EsbuildService;
|
|
64
|
+
ctx?: DurableObjectState;
|
|
65
|
+
env?: any;
|
|
66
|
+
onProgress?: (msg: string) => void;
|
|
67
|
+
fetchFn?: FetchFn;
|
|
68
|
+
});
|
|
69
|
+
/** Expose cache for external use (e.g., serveModule in vite-dev-server). */
|
|
70
|
+
get npmCache(): NpmCache;
|
|
71
|
+
/**
|
|
72
|
+
* Install packages for a project. Handles:
|
|
73
|
+
* - Lockfile-based fast path (no network if lock is valid)
|
|
74
|
+
* - Full resolution + fetch + write pipeline
|
|
75
|
+
* - Incremental: only fetches/writes what changed
|
|
76
|
+
*/
|
|
77
|
+
install(projectDir: string, opts?: {
|
|
78
|
+
packages?: string[];
|
|
79
|
+
production?: boolean;
|
|
80
|
+
}): Promise<NpmInstallResult>;
|
|
81
|
+
private _installInner;
|
|
82
|
+
/**
|
|
83
|
+
* F-2 frontier-coordinator path. Replaces the single-resolve-facet
|
|
84
|
+
* dispatch with a per-package fanout: each BFS layer becomes ONE
|
|
85
|
+
* `NimbusFanoutPool.submitMany` call, layer N+1 builds from the
|
|
86
|
+
* resolved metadata of layer N.
|
|
87
|
+
*
|
|
88
|
+
* Topology auto-routes per layer:
|
|
89
|
+
* width < IN_DO_THRESHOLD (5) → POC C in-DO loader-pool
|
|
90
|
+
* width >= IN_DO_THRESHOLD → POC B peer-DO (sibling NimbusSession DOs)
|
|
91
|
+
*
|
|
92
|
+
* The supervisor still owns:
|
|
93
|
+
* - cycle detection (`seen`),
|
|
94
|
+
* - X.5-F top-level / required-peer policy,
|
|
95
|
+
* - X.5-G G1 optional-native silent-skip,
|
|
96
|
+
* - X.5-drizzle best-effort tagging on optional-peer subtrees,
|
|
97
|
+
* - W6 swap / warn / reject decisions (top-level enforcement; the
|
|
98
|
+
* per-package task ALSO checks these for transitive correctness),
|
|
99
|
+
* - cache flushing (one batched putRegistryEntries at end).
|
|
100
|
+
*
|
|
101
|
+
* The per-package task (resolveOnePackumentInFacet) owns ONLY the
|
|
102
|
+
* fetch + version pick + edge extraction. See
|
|
103
|
+
* audit/sections/F2-RESOLVER-FANOUT-plan.md.
|
|
104
|
+
*
|
|
105
|
+
* Anti-requirements (cleanup-not-done charter): NO setTimeout
|
|
106
|
+
* between layers, NO fallback to single-facet on missing bindings.
|
|
107
|
+
*/
|
|
108
|
+
private resolveTreeViaFanout;
|
|
109
|
+
/**
|
|
110
|
+
* Batch install via two-tier fan-out (NimbusFanoutPool).
|
|
111
|
+
*
|
|
112
|
+
* Topology selected automatically based on the spec count:
|
|
113
|
+
* specs.length < IN_DO_THRESHOLD (5) → POC C in-DO
|
|
114
|
+
* 1 NimbusLoaderPool with concurrency = specs.length, capped at
|
|
115
|
+
* 4 by V8 invariant. Each spec is one facet running its own
|
|
116
|
+
* installPackagesInFacet over a single-element shard.
|
|
117
|
+
* specs.length >= IN_DO_THRESHOLD → POC B peer-DO
|
|
118
|
+
* N peer NimbusSession sibling DOs (N = min(specs.length,
|
|
119
|
+
* MAX_PEER_FANOUT = 32)), each running ONE installPackagesInFacet
|
|
120
|
+
* against its own shard with internal pLimit(3).
|
|
121
|
+
*
|
|
122
|
+
* Sharding strategy: round-robin (`pkgIdx % N`) so every peer DO
|
|
123
|
+
* receives roughly equal work. Stable-id router maps each
|
|
124
|
+
* `shard-${i}` task key deterministically (tests can predict
|
|
125
|
+
* placement).
|
|
126
|
+
*
|
|
127
|
+
* Pre-fix lineage: this site previously ran ONE NimbusLoaderPool
|
|
128
|
+
* with concurrency=1, internal pLimit(3) — the explicit "collapses
|
|
129
|
+
* what was 4 concurrent dynamic workers (pool.map slots) into 1"
|
|
130
|
+
* YELLOW retreat documented in audit/sections/FANOUT-AUDIT.md (P1).
|
|
131
|
+
* Two-tier topology re-expands the fan-out without re-introducing
|
|
132
|
+
* the V8 cap risk.
|
|
133
|
+
*/
|
|
134
|
+
private fetchViaBatchFacet;
|
|
135
|
+
/**
|
|
136
|
+
* Build the dependency specs from package.json + explicit packages.
|
|
137
|
+
*/
|
|
138
|
+
/**
|
|
139
|
+
* W11: framework detection at install time. Reads package.json from the
|
|
140
|
+
* project root and runs detectFramework() against its deps + the basenames
|
|
141
|
+
* we can see in node_modules-adjacent siblings.
|
|
142
|
+
*
|
|
143
|
+
* Returns true if the project is detected as one of {next, astro, nuxt,
|
|
144
|
+
* remix, sveltekit, vite, wrangler}. False for 'unknown'.
|
|
145
|
+
*/
|
|
146
|
+
private detectFrameworkAware;
|
|
147
|
+
private buildSpecs;
|
|
148
|
+
/**
|
|
149
|
+
* W6: apply WASM_SWAPS rewrites and REJECT_INSTALL deny list to a
|
|
150
|
+
* top-level spec map. Emits `[swap]` notices via onProgress; throws
|
|
151
|
+
* a multi-line error on any reject (with `transitive='warn'` rejects
|
|
152
|
+
* also failing at top level — they only soften at depth>0).
|
|
153
|
+
*
|
|
154
|
+
* Idempotent: running on already-swapped specs is a no-op.
|
|
155
|
+
*/
|
|
156
|
+
private applyW6Registry;
|
|
157
|
+
/**
|
|
158
|
+
* Check if a lockfile is still valid against current package.json specs.
|
|
159
|
+
*/
|
|
160
|
+
private isLockfileValid;
|
|
161
|
+
/**
|
|
162
|
+
* Convert a lockfile back to resolved packages (for cache restore).
|
|
163
|
+
*/
|
|
164
|
+
private lockfileToResolved;
|
|
165
|
+
/**
|
|
166
|
+
* Write lockfile to SQLite.
|
|
167
|
+
*/
|
|
168
|
+
private writeLockfile;
|
|
169
|
+
/**
|
|
170
|
+
* Create node_modules/.bin/ entries for packages with "bin" fields.
|
|
171
|
+
*/
|
|
172
|
+
private linkBins;
|
|
173
|
+
private updatePackageJson;
|
|
174
|
+
/**
|
|
175
|
+
* Pre-bundle ESM modules that are actually imported by the project source.
|
|
176
|
+
* Scans .ts/.tsx/.jsx/.js files for bare import specifiers (including
|
|
177
|
+
* subpaths like `react/jsx-runtime`), then bundles each via esbuild.build()
|
|
178
|
+
* with the VFS plugin.
|
|
179
|
+
*
|
|
180
|
+
* Critical: each bundle must externalize react / scheduler / jsx-runtime
|
|
181
|
+
* as appropriate for the specifier being built. Without this, react-dom
|
|
182
|
+
* and jsx-runtime each get their own embedded React copy and cross-bundle
|
|
183
|
+
* JSX elements get rejected as "alien" — silent render failure.
|
|
184
|
+
*/
|
|
185
|
+
private prebundleUsedModules;
|
|
186
|
+
/**
|
|
187
|
+
* Scan project source files for bare import specifiers.
|
|
188
|
+
* Returns unique bare specifiers including subpaths (e.g., both `react`
|
|
189
|
+
* AND `react/jsx-runtime` so each can be pre-bundled separately with the
|
|
190
|
+
* correct externals for shared-runtime isolation).
|
|
191
|
+
*
|
|
192
|
+
* Also injects common JSX-runtime subpaths derived from esbuild's automatic
|
|
193
|
+
* JSX transform: if `react` is imported, we also queue `react/jsx-runtime`
|
|
194
|
+
* and `react/jsx-dev-runtime` because the compiled JSX output imports from
|
|
195
|
+
* them even if the source never wrote `import ... from "react/jsx-runtime"`.
|
|
196
|
+
*/
|
|
197
|
+
private scanBareImports;
|
|
198
|
+
/**
|
|
199
|
+
* Resolve a package's entry point to a VFS path.
|
|
200
|
+
*/
|
|
201
|
+
/**
|
|
202
|
+
* Resolve a specifier (possibly with subpath, e.g. "react/jsx-runtime" or
|
|
203
|
+
* "react-dom/client") to an entry-point VFS path under node_modules.
|
|
204
|
+
*
|
|
205
|
+
* Algorithm:
|
|
206
|
+
* 1. Split specifier into pkgName and subpath
|
|
207
|
+
* (e.g. "react-dom/client" → pkgName="react-dom", subpath="client";
|
|
208
|
+
* "@scope/pkg/sub" → pkgName="@scope/pkg", subpath="sub")
|
|
209
|
+
* 2. Read node_modules/<pkgName>/package.json
|
|
210
|
+
* 3. Use resolvePackageEntry(pkg, './' + subpath) to consult exports field
|
|
211
|
+
* with ESM conditions
|
|
212
|
+
* 4. Try extensions and index-file fallbacks
|
|
213
|
+
*/
|
|
214
|
+
private resolvePackageEntryPath;
|
|
215
|
+
/**
|
|
216
|
+
* P5 (prod-bugs-2) — deterministic supervisor-heap estimate in MiB.
|
|
217
|
+
*
|
|
218
|
+
* Routes through observability/heap-estimate.ts which sums KNOWN
|
|
219
|
+
* supervisor heap allocation sources from runtime counters that
|
|
220
|
+
* ARE accurate inside a DO context (DiagCounters singleton +
|
|
221
|
+
* SqliteVFS.getStats()). This replaces a previous use of
|
|
222
|
+
* process.memoryUsage() which returned 0 for every field inside a
|
|
223
|
+
* Durable Object class context, making the printed
|
|
224
|
+
* "supervisor heap N MiB" lines actively misleading (they always
|
|
225
|
+
* read 0.0 MiB regardless of actual heap state).
|
|
226
|
+
*
|
|
227
|
+
* The estimator is INTENTIONALLY conservative — peak-or-current
|
|
228
|
+
* components, sum may overestimate — but it never under-reports.
|
|
229
|
+
* Returns 0 if the estimator throws (defensive: a counter
|
|
230
|
+
* regression must not block install completion).
|
|
231
|
+
*
|
|
232
|
+
* Same call shape used by /api/_diag/memory in
|
|
233
|
+
* src/session/routes.ts:247, so the value printed in the
|
|
234
|
+
* pre-bundle banner is comparable to the value the diag endpoint
|
|
235
|
+
* reports for the same isolate.
|
|
236
|
+
*/
|
|
237
|
+
private _estimateSupervisorHeapMiB;
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=installer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/npm/installer.ts"],"names":[],"mappings":"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"}
|