@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,551 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W6 — WASM swap + REJECT_INSTALL registry.
|
|
3
|
+
*
|
|
4
|
+
* The contract:
|
|
5
|
+
* - WASM_SWAPS : name→name rewrite at the resolver/installer boundary.
|
|
6
|
+
* Only `compat: 'drop-in'` swaps qualify (the consumer's
|
|
7
|
+
* `require()` call site works unchanged). Different-
|
|
8
|
+
* require-name candidates (bcrypt → bcryptjs, argon2 →
|
|
9
|
+
* hash-wasm, …) are NOT swaps until the resolver supports
|
|
10
|
+
* `npm:` aliases. They live in REJECT_INSTALL with a
|
|
11
|
+
* code-change suggestion.
|
|
12
|
+
*
|
|
13
|
+
* - REJECT_INSTALL: deny list with helpful messages. Each entry has a
|
|
14
|
+
* per-entry `transitive` policy:
|
|
15
|
+
* 'fail' = hard-fail at any depth (top + transitive).
|
|
16
|
+
* 'warn' = top-level fails; transitive logs `[skip]`
|
|
17
|
+
* and continues (matches the existing
|
|
18
|
+
* `shouldSkipPackage` UX for build-only).
|
|
19
|
+
*
|
|
20
|
+
* IMPORTANT: This module is the single source of truth in the supervisor
|
|
21
|
+
* isolate. The same data is *duplicated* into
|
|
22
|
+
* `src/parallel/npm-resolve-preamble.ts` because that preamble is shipped
|
|
23
|
+
* into NimbusLoaderPool isolates as a string (cannot `import`). The
|
|
24
|
+
* `audit/probes/w6/functional/preamble-parity.mjs` snapshot test gates
|
|
25
|
+
* the duplication.
|
|
26
|
+
*
|
|
27
|
+
* See `audit/sections/W6-plan.md` §3.
|
|
28
|
+
*/
|
|
29
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
30
|
+
// Registries
|
|
31
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
32
|
+
export const WASM_SWAPS = [
|
|
33
|
+
// Different-require-name candidates (bcrypt → bcryptjs, argon2 →
|
|
34
|
+
// hash-wasm, node-sass → sass, grpc → @grpc/grpc-js, @swc/core →
|
|
35
|
+
// @swc/wasm-web) are intentionally NOT here. Without npm-alias
|
|
36
|
+
// support, swapping them would silently break the user's
|
|
37
|
+
// `require(originalName)` call site. They are in REJECT_INSTALL
|
|
38
|
+
// with a code-change suggestion. Tracked as W6.5 to add alias
|
|
39
|
+
// support. See plan §2 + §10.
|
|
40
|
+
{
|
|
41
|
+
from: 'esbuild',
|
|
42
|
+
to: 'esbuild-wasm',
|
|
43
|
+
reason: 'Native esbuild not available in Workers; esbuild-wasm exposes the same build/transform/version/initialize API.',
|
|
44
|
+
compat: 'drop-in',
|
|
45
|
+
},
|
|
46
|
+
// X.5-G G2: rollup ships native platform shards as
|
|
47
|
+
// `optionalDependencies` (26 of them). On any host where the matching
|
|
48
|
+
// shard isn't present, rollup's own `native.js` throws the famous
|
|
49
|
+
// 'npm has a bug related to optional dependencies (#4828)'. Even
|
|
50
|
+
// when the matching shard IS installed, the .node binary cannot
|
|
51
|
+
// load in workerd. @rollup/wasm-node is the upstream-published
|
|
52
|
+
// pure-WASM build with byte-identical exports (verified via registry
|
|
53
|
+
// packument compare 2026-05-05; both ship `dist/rollup.js` with the
|
|
54
|
+
// same `exports` map). Drop-in swap.
|
|
55
|
+
{
|
|
56
|
+
from: 'rollup',
|
|
57
|
+
to: '@rollup/wasm-node',
|
|
58
|
+
reason: 'Native rollup uses optionalDependencies for 26 platform shards (npm CLI bug #4828) ' +
|
|
59
|
+
'and ships .node binaries that workerd cannot load. @rollup/wasm-node is the upstream ' +
|
|
60
|
+
'pure-WASM build with identical exports.',
|
|
61
|
+
compat: 'drop-in',
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
export const REJECT_INSTALL = [
|
|
65
|
+
// ── Same-require-name natives that crash at load time ────────────────
|
|
66
|
+
{
|
|
67
|
+
from: 'sharp',
|
|
68
|
+
reason: 'Native libvips bindings; not portable to Workers.',
|
|
69
|
+
suggest: 'no Workers-compatible target — render server-side or use Cloudflare Images. ' +
|
|
70
|
+
'For the wasm32 build see @img/sharp-wasm32 entry below.',
|
|
71
|
+
transitive: 'fail',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
from: 'sqlite3',
|
|
75
|
+
reason: 'Native sqlite3 .node binding.',
|
|
76
|
+
suggest: 'better-sqlite3-wasm (untested by Nimbus) or sql.js (loader gap — see audit/probes/w6.5/spike/sql-js.verdict.md).',
|
|
77
|
+
transitive: 'fail',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
from: 'better-sqlite3',
|
|
81
|
+
reason: 'Native sqlite .node binding.',
|
|
82
|
+
suggest: 'better-sqlite3-wasm (untested by Nimbus) or @libsql/client (resolver subpath gap — see audit/probes/w6.5/spike/libsql-client.verdict.md; may already work post-W2.6a).',
|
|
83
|
+
transitive: 'fail',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
from: 'canvas',
|
|
87
|
+
reason: 'Native Cairo bindings.',
|
|
88
|
+
suggest: 'canvaskit-wasm (Skia → WASM, canvas-API-compatible, ~7MB; untested by Nimbus) ' +
|
|
89
|
+
'or @resvg/resvg-wasm for SVG (verified — see audit/probes/wasm/resvg-wasm.out.txt).',
|
|
90
|
+
transitive: 'fail',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
from: 'sodium-native',
|
|
94
|
+
reason: 'Native libsodium.',
|
|
95
|
+
suggest: 'tweetnacl (pure JS, untested by Nimbus) or libsodium-wrappers (WASM, untested by Nimbus).',
|
|
96
|
+
transitive: 'fail',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
from: 'fsevents',
|
|
100
|
+
reason: 'macOS-only filesystem watcher; never runs in Workers.',
|
|
101
|
+
suggest: 'optional dep — chokidar/watchpack work without it (untested by Nimbus). ' +
|
|
102
|
+
'Move to optionalDependencies in your package.json.',
|
|
103
|
+
transitive: 'warn',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
from: 'bufferutil',
|
|
107
|
+
reason: 'Native binding for ws speedups; install requires node-gyp.',
|
|
108
|
+
suggest: 'optional dep — ws works without it (slower frames; untested by Nimbus). ' +
|
|
109
|
+
'Move to optionalDependencies.',
|
|
110
|
+
transitive: 'warn',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
from: 'utf-8-validate',
|
|
114
|
+
reason: 'Native binding for ws speedups; install requires node-gyp.',
|
|
115
|
+
suggest: 'optional dep — ws works without it (untested by Nimbus). Same as bufferutil.',
|
|
116
|
+
transitive: 'warn',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
from: 'node-pty',
|
|
120
|
+
reason: 'PTY syscalls unavailable in workerd.',
|
|
121
|
+
suggest: 'no Workers-compatible target — use the Nimbus built-in shell.',
|
|
122
|
+
transitive: 'fail',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
from: 'robotjs',
|
|
126
|
+
reason: 'Desktop automation; sandboxed Workers cannot access OS UI.',
|
|
127
|
+
suggest: 'no Workers-compatible target.',
|
|
128
|
+
transitive: 'fail',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
from: 'electron',
|
|
132
|
+
reason: 'Embedded Chromium runtime; not applicable to Workers.',
|
|
133
|
+
suggest: 'no Workers-compatible target.',
|
|
134
|
+
transitive: 'fail',
|
|
135
|
+
},
|
|
136
|
+
// ── Different-require-name natives (would be swaps with alias support) ─
|
|
137
|
+
{
|
|
138
|
+
from: 'bcrypt',
|
|
139
|
+
reason: 'Native bcrypt; pure-JS bcryptjs has identical sync API but the require() name differs and Nimbus does not yet support `npm:` aliases (W6.6).',
|
|
140
|
+
suggest: 'change `require("bcrypt")` to `require("bcryptjs")`, then `npm install bcryptjs` (verified — see audit/probes/wasm/bcryptjs.out.txt). APIs are sync-compatible.',
|
|
141
|
+
transitive: 'fail',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
from: 'argon2',
|
|
145
|
+
reason: 'Native Argon2 C bindings.',
|
|
146
|
+
suggest: 'hash-wasm (argon2d/argon2i/argon2id; verified — see audit/probes/wasm/hash-wasm.out.txt).',
|
|
147
|
+
transitive: 'fail',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
from: 'node-sass',
|
|
151
|
+
reason: 'Native libsass; deprecated upstream.',
|
|
152
|
+
suggest: 'sass (dart-sass, pure JS — partial support: top-level CJS load fails today, see audit/probes/wasm/sass.out.txt; untested for ESM imports).',
|
|
153
|
+
transitive: 'fail',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
from: 'grpc',
|
|
157
|
+
reason: 'Deprecated native gRPC.',
|
|
158
|
+
suggest: '@grpc/grpc-js (pure JS — runtime resolver gap on internal subpath today, see audit/probes/wasm/grpc-grpc-js.out.txt; untested end-to-end).',
|
|
159
|
+
transitive: 'fail',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
from: '@swc/core',
|
|
163
|
+
reason: 'Native Rust SWC.',
|
|
164
|
+
suggest: '@swc/wasm-web (transform/parse only; no Plugin API; loader gap — see audit/probes/wasm/swc-wasm-web.out.txt and audit/probes/w6.5/spike/swc-wasm-web.verdict.md).',
|
|
165
|
+
transitive: 'fail',
|
|
166
|
+
},
|
|
167
|
+
// ── ORM natives ──────────────────────────────────────────────────────
|
|
168
|
+
{
|
|
169
|
+
from: 'prisma',
|
|
170
|
+
reason: 'Native query engine; not portable to Workers in this configuration.',
|
|
171
|
+
suggest: '@prisma/adapter-d1 (Prisma official Workers adapter, untested by Nimbus), ' +
|
|
172
|
+
'or migrate to drizzle-orm + @libsql/client (untested; @libsql/client has known resolver gap — see audit/probes/wasm/libsql-client.out.txt).',
|
|
173
|
+
transitive: 'fail',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
from: '@prisma/client',
|
|
177
|
+
reason: 'Same as `prisma` (native query engine).',
|
|
178
|
+
suggest: '@prisma/adapter-d1 (untested by Nimbus), or drizzle-orm + @libsql/client (untested).',
|
|
179
|
+
transitive: 'fail',
|
|
180
|
+
},
|
|
181
|
+
// ── Build-time native compilers (always wrong in Workers) ───────────
|
|
182
|
+
{
|
|
183
|
+
from: 'node-gyp',
|
|
184
|
+
reason: 'Build-time native compiler; never runs in Workers.',
|
|
185
|
+
suggest: 'no Workers-compatible target — remove from dependencies. Nimbus pre-skips build-only tools transitively.',
|
|
186
|
+
transitive: 'warn',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
from: 'node-pre-gyp',
|
|
190
|
+
reason: 'Build-time native compiler; never runs in Workers.',
|
|
191
|
+
suggest: 'no Workers-compatible target — remove from dependencies.',
|
|
192
|
+
transitive: 'warn',
|
|
193
|
+
},
|
|
194
|
+
// ── Bundled-binary giants ──────────────────────────────────────────
|
|
195
|
+
{
|
|
196
|
+
from: 'puppeteer',
|
|
197
|
+
reason: 'Bundled Chromium binary (~150 MB).',
|
|
198
|
+
suggest: 'no Workers-compatible target for the bundled binary — use puppeteer-core + Cloudflare Browser Rendering (untested by Nimbus).',
|
|
199
|
+
transitive: 'fail',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
from: 'playwright',
|
|
203
|
+
reason: 'Bundled browsers (~300 MB).',
|
|
204
|
+
suggest: 'no Workers-compatible target for bundled browsers — use @playwright/test against a remote browser endpoint (untested by Nimbus).',
|
|
205
|
+
transitive: 'fail',
|
|
206
|
+
},
|
|
207
|
+
// ── Loader-gap honesty (install OK; runtime FAIL today) ─────────────
|
|
208
|
+
// These come out of REJECT once the loader work lands. Spike verdicts
|
|
209
|
+
// (audit/probes/w6.5/spike/) confirmed both gaps span >1 src/ file.
|
|
210
|
+
{
|
|
211
|
+
from: 'sql.js',
|
|
212
|
+
reason: 'Installs but fails at runtime: ENOENT on dist/sql-wasm.wasm. Loader gap NOT in tar extraction — likely between streamTarEntries and writeBatch RPC handler, or in cirrus-real fs shim. See audit/probes/w6.5/spike/sql-js.verdict.md.',
|
|
213
|
+
suggest: 'no Workers-compatible target today — tracked for W6.5.x (multi-file fix exceeded W6.5 surface-area gate). For SQL in Workers consider Cloudflare D1 or @libsql/client (loader gap — see audit/probes/w6.5/spike/libsql-client.verdict.md).',
|
|
214
|
+
transitive: 'fail',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
from: '@swc/wasm-web',
|
|
218
|
+
reason: 'Installs but fails at runtime: node-shims.ts:2058 throws "Cannot load module … file was not pre-bundled" — this is a workerd CSP-like new-Function block, not a slice walker gap. See audit/probes/w6.5/spike/swc-wasm-web.verdict.md.',
|
|
219
|
+
suggest: 'no Workers-compatible target today — tracked for W6.5.x (general facet-runtime issue, not @swc/wasm-web-specific). For ESM transforms consider esbuild-wasm (verified — see audit/probes/wasm/esbuild-wasm.out.txt; a Nimbus W6 swap target).',
|
|
220
|
+
transitive: 'fail',
|
|
221
|
+
},
|
|
222
|
+
// ── W6.5 additions: WASM/wasi-flavour packages that don't load ──────
|
|
223
|
+
{
|
|
224
|
+
from: '@img/sharp-wasm32',
|
|
225
|
+
reason: 'WASM build of sharp; package is wasm32-cpu-only (npm refuses install on x64) AND libvips initThreads() fails under workerd (no pthread support — see audit/sections/07-workerd-hard-limits.md).',
|
|
226
|
+
suggest: 'wasm-vips (verified install + load, default-export-only API — see audit/probes/wasm/wasm-vips.out.txt). For complex pipelines: render server-side and ship pixels.',
|
|
227
|
+
transitive: 'fail',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
from: '@napi-rs/canvas',
|
|
231
|
+
reason: 'Native bindings only (linux-x64-gnu/musl, darwin-arm64/x64, android-arm64, linux-arm64-gnu/musl, win32-x64-msvc, linux-arm-gnueabihf). No WASM build published.',
|
|
232
|
+
suggest: 'canvaskit-wasm (Skia → WASM, canvas-API-compatible, ~7MB; untested by Nimbus) ' +
|
|
233
|
+
'or @resvg/resvg-wasm for SVG (verified — see audit/probes/wasm/resvg-wasm.out.txt).',
|
|
234
|
+
transitive: 'fail',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
from: '@napi-rs/canvas-wasm32-wasi',
|
|
238
|
+
reason: '@napi-rs/canvas does not publish a wasm32-wasi variant on npm (404). The @napi-rs/canvas project ships only native bindings. No WASM/WASI build exists.',
|
|
239
|
+
suggest: 'canvaskit-wasm (Skia → WASM, canvas-API-compatible; untested by Nimbus) ' +
|
|
240
|
+
'or @resvg/resvg-wasm (verified — see audit/probes/wasm/resvg-wasm.out.txt) for SVG.',
|
|
241
|
+
transitive: 'fail',
|
|
242
|
+
},
|
|
243
|
+
// ── X.5-26b additions: Tailwind v4 oxide + lightningcss native parents ─
|
|
244
|
+
// Both ship only platform-native .node bindings + a wasm32-wasi shard.
|
|
245
|
+
// workerd has no node:wasi (W6.5 hard limit), so neither path loads.
|
|
246
|
+
// Without these REJECT entries, both parents install fine and surface
|
|
247
|
+
// a misleading runtime error (npm-4828 fallthrough for oxide, detect-
|
|
248
|
+
// libc execSync gap for lightningcss). With transitive='fail', the
|
|
249
|
+
// install is loud-rejected at resolve time → ⚠ → ⛔ classifier flip.
|
|
250
|
+
// Investigation: audit/probes/x526b/investigation/{tailwindcss-oxide,lightningcss}.out.txt
|
|
251
|
+
// Plan: audit/sections/X526b-plan.md §3.1
|
|
252
|
+
// Functional probes: audit/probes/x526b/functional/{oxide,lightningcss}-rejected.mjs
|
|
253
|
+
// E2E probes: audit/probes/x526b/e2e/{oxide,lightningcss,tailwindcss-vite-transitive}-e2e.mjs
|
|
254
|
+
{
|
|
255
|
+
from: '@tailwindcss/oxide',
|
|
256
|
+
reason: 'Native Rust Tailwind v4 oxide engine; ships only platform-specific .node bindings (linux-x64-gnu/musl, darwin-x64/arm64, freebsd-x64, win32-x64-msvc, etc.) plus a wasm32-wasi shard. workerd has no node:wasi (W6.5 hard limit; see audit/sections/07-workerd-hard-limits.md), and bare native bindings cannot dlopen. The parent index.js throws an npm-4828 message at runtime when no sibling shard loads.',
|
|
257
|
+
suggest: 'no Workers-compatible target — Tailwind v3 (`tailwindcss@^3`) is pure JS and works in Workers (untested by Nimbus). Tailwind v4 inherently requires the Rust oxide engine.',
|
|
258
|
+
transitive: 'fail',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
from: 'lightningcss',
|
|
262
|
+
reason: 'Native Rust CSS parser; ships platform-specific .node bindings + a wasm32-wasi-only `lightningcss-wasm` package (cpu=wasm32; npm refuses install on x64). workerd has no node:wasi (W6.5). Even before the binding load, the detect-libc dependency throws because child_process.execSync returns undefined inside workerd.',
|
|
263
|
+
suggest: 'no Workers-compatible target today — postcss + cssnano (pure JS, untested by Nimbus) cover most lightningcss use cases. For CSS minification only: clean-css (pure JS, untested by Nimbus).',
|
|
264
|
+
transitive: 'fail',
|
|
265
|
+
},
|
|
266
|
+
];
|
|
267
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
268
|
+
// Lookup API
|
|
269
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
270
|
+
const _swapByFrom = new Map(WASM_SWAPS.map((e) => [e.from, e]));
|
|
271
|
+
const _rejectByFrom = new Map(REJECT_INSTALL.map((e) => [e.from, e]));
|
|
272
|
+
export function lookupSwap(name) {
|
|
273
|
+
return _swapByFrom.get(name);
|
|
274
|
+
}
|
|
275
|
+
export function lookupReject(name) {
|
|
276
|
+
return _rejectByFrom.get(name);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Pure: return a new specs map with every WASM_SWAPS.from key rewritten
|
|
280
|
+
* to its swap target. Records the swaps actually performed.
|
|
281
|
+
*
|
|
282
|
+
* Idempotent: running on already-swapped specs is a no-op.
|
|
283
|
+
*
|
|
284
|
+
* Range carry-over: the original spec range is preserved on the new key.
|
|
285
|
+
* (Future W6.5 may want 'latest' to force pulling the current swap-target
|
|
286
|
+
* version, but for now we honour the user's intent.)
|
|
287
|
+
*/
|
|
288
|
+
export function applySwaps(specs) {
|
|
289
|
+
const out = {};
|
|
290
|
+
const swaps = [];
|
|
291
|
+
for (const [name, range] of Object.entries(specs)) {
|
|
292
|
+
const swap = _swapByFrom.get(name);
|
|
293
|
+
if (swap) {
|
|
294
|
+
out[swap.to] = range;
|
|
295
|
+
swaps.push(swap);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
out[name] = range;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return { specs: out, swaps };
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Return rejects whose policy applies at this depth.
|
|
305
|
+
* ctx='top' → all matching rejects (any policy).
|
|
306
|
+
* ctx='transitive' → only `transitive: 'fail'` rejects (the 'warn'
|
|
307
|
+
* policy is handled by the caller as a `[skip]`
|
|
308
|
+
* log + continue).
|
|
309
|
+
*/
|
|
310
|
+
export function findRejects(specs, ctx) {
|
|
311
|
+
const out = [];
|
|
312
|
+
for (const name of Object.keys(specs)) {
|
|
313
|
+
const r = _rejectByFrom.get(name);
|
|
314
|
+
if (!r)
|
|
315
|
+
continue;
|
|
316
|
+
if (ctx === 'transitive' && r.transitive !== 'fail')
|
|
317
|
+
continue;
|
|
318
|
+
out.push(r);
|
|
319
|
+
}
|
|
320
|
+
return out;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Lookup that the resolver uses at depth>0 to decide between throw and
|
|
324
|
+
* `[skip]`+continue. Returns the entry only when its policy is 'warn'
|
|
325
|
+
* (i.e., this is a transitive-skip case). 'fail' entries return undefined
|
|
326
|
+
* here; the caller handles those via findRejects/throw.
|
|
327
|
+
*/
|
|
328
|
+
export function shouldWarnSkipTransitive(name) {
|
|
329
|
+
const r = _rejectByFrom.get(name);
|
|
330
|
+
if (r && r.transitive === 'warn')
|
|
331
|
+
return r;
|
|
332
|
+
return undefined;
|
|
333
|
+
}
|
|
334
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
335
|
+
// Formatters
|
|
336
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
337
|
+
const ANSI_RED = '\x1b[31m';
|
|
338
|
+
const ANSI_YELLOW = '\x1b[33m';
|
|
339
|
+
const ANSI_DIM = '\x1b[2m';
|
|
340
|
+
const ANSI_RESET = '\x1b[0m';
|
|
341
|
+
/**
|
|
342
|
+
* Single-line yellow notice emitted to onProgress when a swap fires.
|
|
343
|
+
* `[npm] [swap] esbuild → esbuild-wasm (Native esbuild not available …)`
|
|
344
|
+
*/
|
|
345
|
+
export function formatSwapNotice(s) {
|
|
346
|
+
return `[npm] ${ANSI_YELLOW}[swap]${ANSI_RESET} ${s.from} → ${s.to} (${s.reason})`;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Multi-line red error thrown when one or more top-level rejects fire.
|
|
350
|
+
* Includes a leading summary line and a `try:` suggestion per package
|
|
351
|
+
* (when present).
|
|
352
|
+
*/
|
|
353
|
+
export function formatRejectError(rejects) {
|
|
354
|
+
if (rejects.length === 0)
|
|
355
|
+
return '';
|
|
356
|
+
const head = `${ANSI_RED}npm install rejected:${ANSI_RESET} ${rejects.length} package${rejects.length === 1 ? '' : 's'} not supported on Nimbus.`;
|
|
357
|
+
const lines = rejects.map((r) => {
|
|
358
|
+
const main = ` ❌ ${r.from} — ${r.reason}`;
|
|
359
|
+
if (r.suggest) {
|
|
360
|
+
return `${main}\n ${ANSI_DIM}try:${ANSI_RESET} ${r.suggest}`;
|
|
361
|
+
}
|
|
362
|
+
return main;
|
|
363
|
+
});
|
|
364
|
+
return [head, ...lines].join('\n');
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Single-line yellow notice emitted for a transitive `[skip]`.
|
|
368
|
+
* `[npm] [skip] fsevents — macOS-only filesystem watcher; never runs in Workers`
|
|
369
|
+
*/
|
|
370
|
+
export function formatTransitiveSkip(r) {
|
|
371
|
+
return `[npm] ${ANSI_YELLOW}[skip]${ANSI_RESET} ${r.from} — ${r.reason}`;
|
|
372
|
+
}
|
|
373
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
374
|
+
// Error class — used to mark registry-driven rejects across the
|
|
375
|
+
// supervisor/facet boundary
|
|
376
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
377
|
+
/**
|
|
378
|
+
* Tag class for registry-driven rejects. Both the supervisor-side path
|
|
379
|
+
* (npm-installer.ts:applyW6Registry, npm-resolver.ts:resolveTree) and the
|
|
380
|
+
* facet-side path (npm-resolve-facet.ts:resolveTreeInFacet) throw errors
|
|
381
|
+
* tagged for this case.
|
|
382
|
+
*
|
|
383
|
+
* Supervisor-side: throw `new RegistryRejectError(rejects)` directly.
|
|
384
|
+
* Facet-side: cannot import this class (preamble has no import surface),
|
|
385
|
+
* so the facet throws `new Error(...)` with `err.__w6_reject = true`.
|
|
386
|
+
* Both are detected via `isRegistryReject()`.
|
|
387
|
+
*
|
|
388
|
+
* The own-property `__w6_reject = true` survives any boundary that
|
|
389
|
+
* preserves error own-properties (NimbusLoaderPool's loadable contract
|
|
390
|
+
* is checked in audit/probes/w6/ ...).
|
|
391
|
+
*/
|
|
392
|
+
export class RegistryRejectError extends Error {
|
|
393
|
+
rejects;
|
|
394
|
+
__w6_reject = true;
|
|
395
|
+
constructor(rejects) {
|
|
396
|
+
super(formatRejectError(rejects));
|
|
397
|
+
this.name = 'RegistryRejectError';
|
|
398
|
+
this.rejects = rejects;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Robust check that survives the supervisor↔facet boundary: prototypes
|
|
403
|
+
* are lost across that boundary, so we tag via an own-property.
|
|
404
|
+
*/
|
|
405
|
+
export function isRegistryReject(e) {
|
|
406
|
+
return !!(e && typeof e === 'object' && e.__w6_reject === true);
|
|
407
|
+
}
|
|
408
|
+
let _sink = null;
|
|
409
|
+
let _sinkThrowCount = 0;
|
|
410
|
+
/**
|
|
411
|
+
* Install (or clear, with `null`) the global registry event sink.
|
|
412
|
+
*
|
|
413
|
+
* The sink is a per-isolate singleton. The supervisor isolate's sink does
|
|
414
|
+
* NOT propagate to facet isolates — facet emits travel through
|
|
415
|
+
* `ResolveFacetResult.registryEvents` and are flushed by the supervisor
|
|
416
|
+
* after the facet returns. See W6.5-plan.md §5.5 for the per-isolate
|
|
417
|
+
* invariant.
|
|
418
|
+
*/
|
|
419
|
+
export function setRegistryEventSink(s) {
|
|
420
|
+
_sink = s;
|
|
421
|
+
}
|
|
422
|
+
export function getRegistryEventSink() {
|
|
423
|
+
return _sink;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Forward an event to the sink. Sink throws are caught (telemetry must
|
|
427
|
+
* never break install) and counted.
|
|
428
|
+
*/
|
|
429
|
+
export function emitRegistryEvent(e) {
|
|
430
|
+
if (!_sink)
|
|
431
|
+
return;
|
|
432
|
+
try {
|
|
433
|
+
_sink(e);
|
|
434
|
+
}
|
|
435
|
+
catch {
|
|
436
|
+
_sinkThrowCount++;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Number of sink invocations that threw (and were caught). Useful for
|
|
441
|
+
* production monitoring (and probes).
|
|
442
|
+
*/
|
|
443
|
+
export function getSinkThrowCount() {
|
|
444
|
+
return _sinkThrowCount;
|
|
445
|
+
}
|
|
446
|
+
// Known native-shard name globs. Matched as `prefix-` (so the parent
|
|
447
|
+
// package name without a platform suffix never matches).
|
|
448
|
+
const NATIVE_SHARD_PREFIXES = [
|
|
449
|
+
'@rollup/rollup-',
|
|
450
|
+
'@parcel/watcher-',
|
|
451
|
+
'@swc/core-',
|
|
452
|
+
'@next/swc-',
|
|
453
|
+
'@tailwindcss/oxide-',
|
|
454
|
+
'@img/sharp-',
|
|
455
|
+
'@napi-rs/canvas-',
|
|
456
|
+
'@biomejs/cli-',
|
|
457
|
+
'@esbuild/',
|
|
458
|
+
];
|
|
459
|
+
/**
|
|
460
|
+
* Heuristic: does this packument represent a platform-native binding
|
|
461
|
+
* that workerd cannot load?
|
|
462
|
+
*
|
|
463
|
+
* Returns true when ANY of:
|
|
464
|
+
* - `os`, `cpu`, or `libc` field is non-empty (npm spec platform
|
|
465
|
+
* constraints — package is opting out of cross-platform installs).
|
|
466
|
+
* - `main` ends in `.node` (Node.js N-API binary, not workerd-loadable).
|
|
467
|
+
* - name matches a known native-shard glob (see NATIVE_SHARD_PREFIXES).
|
|
468
|
+
*
|
|
469
|
+
* Returns false for pure-JS packages, parent wrappers (e.g. the
|
|
470
|
+
* non-platform `@parcel/watcher` itself), and packuments with empty
|
|
471
|
+
* platform-constraint arrays.
|
|
472
|
+
*
|
|
473
|
+
* X.5-G G1: the resolver consults this on every packument fetched from
|
|
474
|
+
* a transitive `optionalDependencies` entry. Returns-true → silent-skip
|
|
475
|
+
* (emit a `transitive-skip` RegistryEvent, drop the package from the
|
|
476
|
+
* resolved tree).
|
|
477
|
+
*/
|
|
478
|
+
export function isOptionalNativeBinding(p) {
|
|
479
|
+
if (!p)
|
|
480
|
+
return false;
|
|
481
|
+
if (Array.isArray(p.os) && p.os.length > 0)
|
|
482
|
+
return true;
|
|
483
|
+
if (Array.isArray(p.cpu) && p.cpu.length > 0)
|
|
484
|
+
return true;
|
|
485
|
+
if (Array.isArray(p.libc) && p.libc.length > 0)
|
|
486
|
+
return true;
|
|
487
|
+
if (typeof p.main === 'string' && /\.node$/.test(p.main))
|
|
488
|
+
return true;
|
|
489
|
+
if (typeof p.name === 'string') {
|
|
490
|
+
for (const prefix of NATIVE_SHARD_PREFIXES) {
|
|
491
|
+
// Require the prefix-then-something-else shape. The parent package
|
|
492
|
+
// (e.g. `@parcel/watcher`, `@rollup/wasm-node`) does not match.
|
|
493
|
+
if (p.name.startsWith(prefix) && p.name.length > prefix.length) {
|
|
494
|
+
// Carve out @rollup/wasm-node: it's the WASM build, not a native shard.
|
|
495
|
+
if (p.name === '@rollup/wasm-node')
|
|
496
|
+
return false;
|
|
497
|
+
return true;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Select which entries in `peerDependencies` should be auto-installed.
|
|
505
|
+
*
|
|
506
|
+
* npm v7+ default behaviour:
|
|
507
|
+
* - All `peerDependencies` entries auto-install.
|
|
508
|
+
* - Entries marked `optional: true` in `peerDependenciesMeta` STILL
|
|
509
|
+
* auto-install (with `--include=peer` default-on) — but tools may
|
|
510
|
+
* opt-out with `--no-include=peer`.
|
|
511
|
+
* - Entries that exist ONLY in `peerDependenciesMeta` (NOT in
|
|
512
|
+
* `peerDependencies`) are NEVER auto-installed (they're feature-
|
|
513
|
+
* detect signals, e.g. ts-jest's `esbuild`).
|
|
514
|
+
*
|
|
515
|
+
* X.5-G strict mode (the default here): we only iterate `peerDependencies`
|
|
516
|
+
* keys. peer-meta-only entries are excluded by construction.
|
|
517
|
+
*
|
|
518
|
+
* The `requiredOnly` flag, when true, also filters out entries marked
|
|
519
|
+
* optional in meta — used for transitive (depth>0) enqueue per X5F R2.
|
|
520
|
+
* When false (top-level / X5F R2.5), all `peerDependencies` entries are
|
|
521
|
+
* returned including optional-marked-in-meta ones (npm CLI default).
|
|
522
|
+
*/
|
|
523
|
+
export function selectAutoInstallPeers(pkg, opts = {}) {
|
|
524
|
+
const peers = pkg.peerDependencies || {};
|
|
525
|
+
const meta = pkg.peerDependenciesMeta || {};
|
|
526
|
+
const out = [];
|
|
527
|
+
for (const name of Object.keys(peers)) {
|
|
528
|
+
if (opts.requiredOnly && meta[name]?.optional)
|
|
529
|
+
continue;
|
|
530
|
+
out.push(name);
|
|
531
|
+
}
|
|
532
|
+
return out;
|
|
533
|
+
}
|
|
534
|
+
export function classifyInstallError(e, ctx = {}) {
|
|
535
|
+
if (isRegistryReject(e))
|
|
536
|
+
return 'registry-reject';
|
|
537
|
+
if (ctx.isOptional)
|
|
538
|
+
return 'optional-dep-skip';
|
|
539
|
+
return 'real-resolve-fail';
|
|
540
|
+
}
|
|
541
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
542
|
+
// Module-load assertion: WASM_SWAPS.from and REJECT_INSTALL.from are disjoint
|
|
543
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
544
|
+
(() => {
|
|
545
|
+
for (const s of WASM_SWAPS) {
|
|
546
|
+
if (_rejectByFrom.has(s.from)) {
|
|
547
|
+
throw new Error(`W6 registry conflict: '${s.from}' is in both WASM_SWAPS and REJECT_INSTALL. ` +
|
|
548
|
+
`A name must own one role.`);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
})();
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket-backed terminal matching Nimbus's ITerminal interface.
|
|
3
|
+
* HeadlessTerminal has: write, writeln, onData, sendData, cols, rows, focus, clear
|
|
4
|
+
*
|
|
5
|
+
* [B'.5] The `ws` ref is no longer readonly: a wsClose leaves the
|
|
6
|
+
* Shell + this terminal alive in-memory; the next /ws upgrade calls
|
|
7
|
+
* `attach(newWs, ...)` to swap in the new socket. The buffer/flush
|
|
8
|
+
* timer state is preserved across the swap so any in-flight
|
|
9
|
+
* coalescing continues seamlessly.
|
|
10
|
+
*/
|
|
11
|
+
export declare class WebSocketTerminal {
|
|
12
|
+
ws: WebSocket;
|
|
13
|
+
private dataCallback;
|
|
14
|
+
/**
|
|
15
|
+
* REPL-W1: secondary input callback installed by interactive runtimes
|
|
16
|
+
* (e.g. `python` no-args). When non-null, sendData() routes input to
|
|
17
|
+
* this callback INSTEAD of the shell. Set via attachRepl(); cleared
|
|
18
|
+
* by the disposer the attach call returns. Supports nesting (the
|
|
19
|
+
* disposer restores the prior callback).
|
|
20
|
+
*
|
|
21
|
+
* Reasoning per /workspace/.seal-internal/2026-05-11-repl-plan/plan.md
|
|
22
|
+
* §3 (Layer 2): the explicit handoff mirrors how `vim`/`less` swap
|
|
23
|
+
* the parent shell's terminal handler. Auto-detect was rejected as
|
|
24
|
+
* fragile. Additive only — when null, behavior is identical to pre-W1.
|
|
25
|
+
*/
|
|
26
|
+
private replCallback;
|
|
27
|
+
/**
|
|
28
|
+
* monaco-wave-a (2026-05-13): Editor-pane file-system bridge.
|
|
29
|
+
*
|
|
30
|
+
* When non-null, fs-* messages (fs-read / fs-write / fs-list) are
|
|
31
|
+
* routed to this callback INSTEAD of the shell. The callback is
|
|
32
|
+
* supplied by init.ts which holds the SqliteVFS handle; it uses
|
|
33
|
+
* the same `reply` lambda we provide to send back fs-*-result
|
|
34
|
+
* frames over the live WS.
|
|
35
|
+
*
|
|
36
|
+
* Additive — when null, fs-* messages are silently dropped (same
|
|
37
|
+
* pre-Wave-A behavior, since handleMessage's switch had no case
|
|
38
|
+
* for them).
|
|
39
|
+
*/
|
|
40
|
+
private fsCallback;
|
|
41
|
+
private _cols;
|
|
42
|
+
private _rows;
|
|
43
|
+
private buffer;
|
|
44
|
+
private flushTimer;
|
|
45
|
+
/** [B'.3] Optional tee called from flush() with the final coalesced
|
|
46
|
+
* frame data. Used by initSession to mirror every WS output frame
|
|
47
|
+
* into nimbus_terminal_scrollback. Single-frame granularity (not
|
|
48
|
+
* per-write) keeps the row count bounded by the 5 ms flush cadence. */
|
|
49
|
+
private onFlush;
|
|
50
|
+
constructor(ws: WebSocket, onFlush?: (data: string) => void);
|
|
51
|
+
/**
|
|
52
|
+
* [B'.5] Swap the underlying WebSocket on a warm rejoin. The Shell
|
|
53
|
+
* keeps `terminal` as a stable instance reference (it stored
|
|
54
|
+
* `this.terminal = e` in its ctor); we just point our ws ref at
|
|
55
|
+
* the new socket. The optional onFlush replaces the prior tee
|
|
56
|
+
* (initSession passes a fresh closure capturing the same
|
|
57
|
+
* self.ctx, but TypeScript-wise it's a fresh function value).
|
|
58
|
+
*/
|
|
59
|
+
attach(ws: WebSocket, onFlush?: (data: string) => void): void;
|
|
60
|
+
get cols(): number;
|
|
61
|
+
get rows(): number;
|
|
62
|
+
write(data: string): void;
|
|
63
|
+
writeln(data: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* REPL-A1 (master plan §1): drain the buffer synchronously, bypassing
|
|
66
|
+
* the 5 ms coalescer. Used by ReplSession.submitLine to emit stdout,
|
|
67
|
+
* stderr, and the next-prompt as three discrete frames in deterministic
|
|
68
|
+
* order. Without this, all three coalesce into one `{type:'output'}`
|
|
69
|
+
* frame and probes asserting frame-order (stderr-before-stdout or
|
|
70
|
+
* prompt-after-output) see false-RED.
|
|
71
|
+
*
|
|
72
|
+
* Idempotent: cancels the pending timer + sends current buffer (if any).
|
|
73
|
+
* Safe to call on an empty buffer (no-op).
|
|
74
|
+
*/
|
|
75
|
+
flushNow(): void;
|
|
76
|
+
private flush;
|
|
77
|
+
onData(callback: (data: string) => void): void;
|
|
78
|
+
handleMessage(msg: {
|
|
79
|
+
type: string;
|
|
80
|
+
data?: string;
|
|
81
|
+
cols?: number;
|
|
82
|
+
rows?: number;
|
|
83
|
+
path?: string;
|
|
84
|
+
content?: string;
|
|
85
|
+
dir?: string;
|
|
86
|
+
recursive?: boolean;
|
|
87
|
+
}): void;
|
|
88
|
+
/**
|
|
89
|
+
* monaco-wave-a (2026-05-13): install the fs-* message handler.
|
|
90
|
+
* The callback receives the raw message + a reply lambda that
|
|
91
|
+
* accepts a JSON-serializable frame and pushes it over this WS.
|
|
92
|
+
* Single-slot (last call wins) — init.ts is the only caller and
|
|
93
|
+
* reinstalls on warm rejoin via `attach()`.
|
|
94
|
+
*/
|
|
95
|
+
onFs(cb: (msg: any, reply: (frame: any) => void) => void): void;
|
|
96
|
+
sendData(data: string): void;
|
|
97
|
+
/**
|
|
98
|
+
* REPL-W1: install a runtime-side input handler. Returns a disposer
|
|
99
|
+
* that restores the prior handler (supports nesting). Calling this
|
|
100
|
+
* does NOT change the shell's dataCallback — it just shadows it
|
|
101
|
+
* until the disposer runs.
|
|
102
|
+
*/
|
|
103
|
+
attachRepl(cb: (data: string) => void): () => void;
|
|
104
|
+
focus(): void;
|
|
105
|
+
clear(): void;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=ws-terminal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-terminal.d.ts","sourceRoot":"","sources":["../../src/facets/ws-terminal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,iBAAiB;IACrB,EAAE,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,YAAY,CAAyC;IAC7D;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,YAAY,CAAyC;IAC7D;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,UAAU,CAAkE;IACpF,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,UAAU,CAA8C;IAChE;;;4EAGwE;IACxE,OAAO,CAAC,OAAO,CAAkC;gBAErC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;IAK3D;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAK7D,IAAI,IAAI,IAAI,MAAM,CAAuB;IACzC,IAAI,IAAI,IAAI,MAAM,CAAuB;IAEzC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOzB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAE3B;;;;;;;;;;OAUG;IACH,QAAQ,IAAI,IAAI;IAQhB,OAAO,CAAC,KAAK;IAeb,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAE9C,aAAa,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IA+C3J;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,GAAG,IAAI;IAI/D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAO5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAWlD,KAAK,IAAI,IAAI;IACb,KAAK,IAAI,IAAI;CACd"}
|