@nimbus-sh/worker 0.9.0 → 0.11.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/NOTICE.md +5 -0
- package/README.md +10 -0
- package/dist/_shared/session-router.d.ts +7 -0
- package/dist/_shared/session-router.d.ts.map +1 -1
- package/dist/_shared/session-router.js +7 -0
- package/dist/bindings/body.d.ts +6 -0
- package/dist/bindings/body.d.ts.map +1 -0
- package/dist/bindings/body.js +37 -0
- package/dist/bindings/kv.d.ts +0 -2
- package/dist/bindings/kv.d.ts.map +1 -1
- package/dist/bindings/kv.js +3 -42
- package/dist/bindings/r2.d.ts +0 -2
- package/dist/bindings/r2.d.ts.map +1 -1
- package/dist/bindings/r2.js +4 -44
- package/dist/esbuild-cli-artifact.generated.d.ts +18 -0
- package/dist/esbuild-cli-artifact.generated.d.ts.map +1 -0
- package/dist/esbuild-cli-artifact.generated.js +17 -0
- package/dist/esbuild-wasm-bundle.generated.d.ts +24 -24
- package/dist/esbuild-wasm-bundle.generated.d.ts.map +1 -1
- package/dist/esbuild-wasm-bundle.generated.js +24 -24
- package/dist/facets/cirrus-real.d.ts.map +1 -1
- package/dist/facets/cirrus-real.js +11 -6
- package/dist/facets/compose.d.ts +11 -7
- package/dist/facets/compose.d.ts.map +1 -1
- package/dist/facets/compose.js +8 -31
- package/dist/facets/data-plan.d.ts +79 -0
- package/dist/facets/data-plan.d.ts.map +1 -0
- package/dist/facets/data-plan.js +477 -0
- package/dist/facets/esbuild-bundle-pool.d.ts +1 -1
- package/dist/facets/esbuild-bundle-pool.js +3 -3
- package/dist/facets/esbuild-transform.d.ts +38 -8
- package/dist/facets/esbuild-transform.d.ts.map +1 -1
- package/dist/facets/esbuild-transform.js +219 -19
- package/dist/facets/exec-telemetry.d.ts +7 -3
- package/dist/facets/exec-telemetry.d.ts.map +1 -1
- package/dist/facets/manager.d.ts +198 -69
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +1276 -652
- package/dist/facets/opencode-staging.d.ts +0 -2
- package/dist/facets/opencode-staging.d.ts.map +1 -1
- package/dist/facets/opencode-staging.js +5 -11
- package/dist/facets/process.d.ts +4 -0
- package/dist/facets/process.d.ts.map +1 -1
- package/dist/facets/process.js +3 -0
- package/dist/facets/read-profile.d.ts +149 -0
- package/dist/facets/read-profile.d.ts.map +1 -0
- package/dist/facets/read-profile.js +483 -0
- package/dist/facets/real-vite-hmr.d.ts +2 -0
- package/dist/facets/real-vite-hmr.d.ts.map +1 -1
- package/dist/facets/real-vite-hmr.js +3 -2
- package/dist/facets/resident-identity.d.ts +0 -1
- package/dist/facets/resident-identity.d.ts.map +1 -1
- package/dist/facets/resident-identity.js +0 -3
- package/dist/facets/wasm-swap-registry.d.ts +34 -25
- package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
- package/dist/facets/wasm-swap-registry.js +62 -56
- package/dist/facets/ws-terminal.d.ts +4 -4
- package/dist/facets/ws-terminal.d.ts.map +1 -1
- package/dist/facets/ws-terminal.js +4 -5
- package/dist/git/commands.d.ts +33 -10
- package/dist/git/commands.d.ts.map +1 -1
- package/dist/git/commands.js +1891 -197
- package/dist/git/network-facet.d.ts +12 -2
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +69 -18
- package/dist/git/unified-diff.d.ts +74 -0
- package/dist/git/unified-diff.d.ts.map +1 -0
- package/dist/git/unified-diff.js +676 -0
- package/dist/git-bundle.generated.d.ts +7 -11
- package/dist/git-bundle.generated.d.ts.map +1 -1
- package/dist/git-bundle.generated.js +7 -11
- package/dist/hosted/commands.d.ts.map +1 -1
- package/dist/hosted/commands.js +64 -245
- package/dist/hosted/runtime.d.ts +22 -15
- package/dist/hosted/runtime.d.ts.map +1 -1
- package/dist/hosted/runtime.js +72 -14
- package/dist/hosted/services.d.ts +8 -1
- package/dist/hosted/services.d.ts.map +1 -1
- package/dist/hosted/services.js +12 -13
- package/dist/hosted/session.d.ts +165 -0
- package/dist/hosted/session.d.ts.map +1 -0
- package/dist/hosted/session.js +132 -0
- package/dist/loaders/generated-workers.d.ts +6 -3
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +8 -5
- package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
- package/dist/loaders/npm-resolve-preamble.js +0 -27
- package/dist/loaders/pre-bundle-preamble.d.ts +6 -3
- package/dist/loaders/pre-bundle-preamble.d.ts.map +1 -1
- package/dist/loaders/pre-bundle-preamble.js +13 -8
- package/dist/node-shims-artifact.generated.d.ts +13 -4
- package/dist/node-shims-artifact.generated.d.ts.map +1 -1
- package/dist/node-shims-artifact.generated.js +16 -7
- package/dist/npm/bin-links.d.ts +3 -1
- package/dist/npm/bin-links.d.ts.map +1 -1
- package/dist/npm/bin-links.js +32 -8
- package/dist/npm/cache.d.ts +11 -1
- package/dist/npm/cache.d.ts.map +1 -1
- package/dist/npm/cache.js +21 -7
- package/dist/npm/install-batch-facet.d.ts +4 -2
- package/dist/npm/install-batch-facet.d.ts.map +1 -1
- package/dist/npm/install-batch-facet.js +32 -18
- package/dist/npm/installer.d.ts +23 -3
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +330 -131
- package/dist/npm/npx-install.d.ts +3 -1
- package/dist/npm/npx-install.d.ts.map +1 -1
- package/dist/npm/npx-install.js +4 -1
- package/dist/npm/package-lock.d.ts +32 -0
- package/dist/npm/package-lock.d.ts.map +1 -0
- package/dist/npm/package-lock.js +65 -0
- package/dist/npm/placement.d.ts +16 -0
- package/dist/npm/placement.d.ts.map +1 -0
- package/dist/npm/placement.js +33 -0
- package/dist/npm/pre-bundle-facet.d.ts +1 -30
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
- package/dist/npm/pre-bundle-facet.js +3 -5
- package/dist/npm/r2-cache.d.ts +12 -6
- package/dist/npm/r2-cache.d.ts.map +1 -1
- package/dist/npm/r2-cache.js +34 -16
- package/dist/npm/resolve-one-facet.d.ts +3 -0
- package/dist/npm/resolve-one-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.js +15 -3
- package/dist/npm/resolver.d.ts +11 -13
- package/dist/npm/resolver.d.ts.map +1 -1
- package/dist/npm/resolver.js +12 -25
- package/dist/opencode-artifact.generated.js +2 -2
- package/dist/replica/routing.d.ts +2 -38
- package/dist/replica/routing.d.ts.map +1 -1
- package/dist/replica/routing.js +3 -55
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +15 -2
- package/dist/router/public-directory.d.ts +18 -0
- package/dist/router/public-directory.d.ts.map +1 -1
- package/dist/router/public-directory.js +1 -1
- package/dist/router/remote-api.d.ts +3 -1
- package/dist/router/remote-api.d.ts.map +1 -1
- package/dist/router/remote-api.js +42 -79
- package/dist/runtime/bash-repl.js +2 -2
- package/dist/runtime/bun-repl.d.ts.map +1 -1
- package/dist/runtime/bun-repl.js +2 -13
- package/dist/runtime/cpython-resident.d.ts.map +1 -1
- package/dist/runtime/cpython-resident.js +2 -10
- package/dist/runtime/esbuild-wasm-bytes.d.ts +37 -18
- package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -1
- package/dist/runtime/esbuild-wasm-bytes.js +66 -92
- package/dist/runtime/facet-loader-host.d.ts.map +1 -1
- package/dist/runtime/facet-loader-host.js +0 -7
- package/dist/runtime/git-bundle-artifact.d.ts +17 -0
- package/dist/runtime/git-bundle-artifact.d.ts.map +1 -0
- package/dist/runtime/git-bundle-artifact.js +25 -0
- package/dist/runtime/node-repl.d.ts.map +1 -1
- package/dist/runtime/node-repl.js +2 -13
- package/dist/runtime/node-shims-artifact.d.ts +22 -23
- package/dist/runtime/node-shims-artifact.d.ts.map +1 -1
- package/dist/runtime/node-shims-artifact.js +48 -78
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +2358 -996
- package/dist/runtime/opencode-artifact.d.ts.map +1 -1
- package/dist/runtime/opencode-artifact.js +17 -53
- package/dist/runtime/opencode-facet-runner.d.ts +3 -6
- package/dist/runtime/opencode-facet-runner.d.ts.map +1 -1
- package/dist/runtime/opencode-facet-runner.js +45 -10
- package/dist/runtime/opentui-wasm-bytes.d.ts.map +1 -1
- package/dist/runtime/opentui-wasm-bytes.js +16 -49
- package/dist/runtime/package-manager.d.ts +0 -2
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +0 -3
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +4 -35
- package/dist/runtime/repl-session.d.ts +10 -0
- package/dist/runtime/repl-session.d.ts.map +1 -1
- package/dist/runtime/repl-session.js +7 -0
- package/dist/runtime/ruby-repl.d.ts.map +1 -1
- package/dist/runtime/ruby-repl.js +2 -2
- package/dist/runtime/ruby-resident.d.ts.map +1 -1
- package/dist/runtime/ruby-resident.js +41 -51
- package/dist/runtime/runtime-catalog.d.ts +10 -3
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +125 -15
- package/dist/runtime/sqlite-wasm-bytes.d.ts +4 -4
- package/dist/runtime/sqlite-wasm-bytes.d.ts.map +1 -1
- package/dist/runtime/sqlite-wasm-bytes.js +21 -57
- package/dist/runtime/staged-source.d.ts +67 -0
- package/dist/runtime/staged-source.d.ts.map +1 -0
- package/dist/runtime/staged-source.js +113 -0
- package/dist/runtime/wasi/preamble.d.ts +0 -22
- package/dist/runtime/wasi/preamble.d.ts.map +1 -1
- package/dist/runtime/wasi/preamble.js +98 -1425
- package/dist/runtime-catalog.generated.js +1 -1
- package/dist/session/agent.d.ts +14 -2
- package/dist/session/agent.d.ts.map +1 -1
- package/dist/session/agent.js +57 -19
- package/dist/session/ai.d.ts +0 -11
- package/dist/session/ai.d.ts.map +1 -1
- package/dist/session/ai.js +0 -4
- package/dist/session/fs-watch.d.ts +0 -11
- package/dist/session/fs-watch.d.ts.map +1 -1
- package/dist/session/fs-watch.js +0 -21
- package/dist/session/hibernation.d.ts +68 -2
- package/dist/session/hibernation.d.ts.map +1 -1
- package/dist/session/hibernation.js +95 -1
- package/dist/session/init-phases.d.ts +1 -2
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +1 -2
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +7 -20
- package/dist/session/keys.d.ts +0 -3
- package/dist/session/keys.d.ts.map +1 -1
- package/dist/session/keys.js +0 -3
- package/dist/session/legacy-reset.d.ts +11 -0
- package/dist/session/legacy-reset.d.ts.map +1 -0
- package/dist/session/legacy-reset.js +16 -0
- package/dist/session/nimbus-session.d.ts +50 -16
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +77 -71
- package/dist/session/npm-install-port.d.ts.map +1 -1
- package/dist/session/npm-install-port.js +2 -0
- package/dist/session/programmatic.d.ts +13 -18
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +53 -39
- package/dist/session/replica-routes.d.ts +2 -3
- package/dist/session/replica-routes.d.ts.map +1 -1
- package/dist/session/replica-routes.js +3 -10
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +11 -12
- package/dist/session/rpc.d.ts +108 -21
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +194 -39
- package/dist/session/start-real-vite.js +2 -2
- package/dist/session/state-store.d.ts +1 -17
- package/dist/session/state-store.d.ts.map +1 -1
- package/dist/session/state-store.js +3 -53
- package/dist/session/supervisor-op.d.ts +7 -0
- package/dist/session/supervisor-op.d.ts.map +1 -1
- package/dist/session/supervisor-op.js +6 -1
- package/dist/session/supervisor-rpc.d.ts +116 -19
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +194 -84
- package/dist/session/vite-command.d.ts.map +1 -1
- package/dist/session/vite-command.js +17 -14
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +20 -8
- package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
- package/dist/shell/npm-bin-entrypoints.js +30 -5
- package/dist/vfs/facet-resident-limits.d.ts +33 -0
- package/dist/vfs/facet-resident-limits.d.ts.map +1 -0
- package/dist/vfs/facet-resident-limits.js +33 -0
- package/dist/vfs/facet-resident-store.d.ts +2 -10
- package/dist/vfs/facet-resident-store.d.ts.map +1 -1
- package/dist/vfs/facet-resident-store.js +1594 -219
- package/dist/workspace-host.d.ts +3 -1
- package/dist/workspace-host.d.ts.map +1 -1
- package/dist/workspace-host.js +2 -0
- package/dist/wrangler/nimbus-wrangler.d.ts +0 -2
- package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -1
- package/dist/wrangler/nimbus-wrangler.js +8 -22
- package/package.json +34 -7
- package/public/_assets/esbuild-0.24.2.js +2380 -0
- package/public/_assets/opencode/1.16.2/index-attach.js +2 -2
- package/public/_assets/runtime/esbuild-cli-c4fda380d52befc1.js +6892 -0
- package/public/_assets/runtime/git-de3e60c9f3ff006a.js +103 -0
- package/public/_assets/runtime/{node-shims-acaa037e6d26ec0d.js → node-shims-06565b121555c194.js} +2879 -992
- package/public/_assets/runtime/resident-store-6ffb1939c53d982f.js +2264 -0
- package/public/_assets/runtime/vfs-write-ledger-e501e8fc793bc2c1.js +889 -0
- package/scripts/build-opencode-attach-entry.mjs +51 -1
- package/scripts/bundle-esbuild-wasm.mjs +55 -39
- package/scripts/bundle-facet-workers.mjs +159 -10
- package/scripts/bundle-git.mjs +88 -27
- package/scripts/bundle-node-shims.mjs +72 -46
- package/scripts/bundle-runtime.mjs +18 -421
- package/scripts/cf-git-patch.mjs +137 -0
- package/scripts/patch-install-deps.mjs +49 -96
- package/scripts/runtime-specs.mjs +435 -0
- package/vendor/git-http.generated.d.ts +82 -0
- package/vendor/git-upstream.generated.d.ts +4378 -0
- package/vendor/git.LICENSE +7 -0
- package/vendor/git.generated.d.mts +21 -0
- package/vendor/git.generated.mjs +103 -0
- package/dist/replica/suspension.d.ts +0 -36
- package/dist/replica/suspension.d.ts.map +0 -1
- package/dist/replica/suspension.js +0 -49
- package/dist/runtime/static-server.d.ts +0 -3
- package/dist/runtime/static-server.d.ts.map +0 -1
- package/dist/runtime/static-server.js +0 -133
- package/scripts/clean-dist.mjs +0 -7
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
* and native-artifact classification.
|
|
4
4
|
*
|
|
5
5
|
* The contract:
|
|
6
|
-
* - swaps :
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
6
|
+
* - swaps : an npm alias the policy declares on the user's behalf —
|
|
7
|
+
* `esbuild` installs as `esbuild@npm:esbuild-wasm@<range>`,
|
|
8
|
+
* so the swap target lands under the DECLARED name's
|
|
9
|
+
* directory (`applySwaps` / `swapAliasRange`). Only
|
|
10
|
+
* `compat: 'drop-in'` swaps qualify (the consumer's
|
|
11
|
+
* `require()` call site works unchanged against the
|
|
12
|
+
* target's API). Different-API candidates (bcrypt →
|
|
13
|
+
* bcryptjs, argon2 → hash-wasm, …) are NOT swaps: aliasing
|
|
14
|
+
* them would satisfy `require(originalName)` with a module
|
|
15
|
+
* whose API differs. They live in `rejects` with a
|
|
12
16
|
* code-change suggestion.
|
|
13
17
|
*
|
|
14
18
|
* - rejects: deny list with helpful messages. Every entry is
|
|
@@ -28,17 +32,17 @@
|
|
|
28
32
|
* (`tests/unit/package-abi-policy.mjs`) extracts the injected policy and
|
|
29
33
|
* asserts equality with this module.
|
|
30
34
|
*/
|
|
31
|
-
import { NATIVE_UNSUPPORTED_ABI, NIMBUS_ABI_TARGET, PYODIDE_PACKAGE_ABI, } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
35
|
+
import { NATIVE_BIN_EXTENSIONS, NATIVE_UNSUPPORTED_ABI, NIMBUS_ABI_TARGET, PYODIDE_PACKAGE_ABI, } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
32
36
|
// ─────────────────────────────────────────────────────────────────────────
|
|
33
37
|
// The policy
|
|
34
38
|
// ─────────────────────────────────────────────────────────────────────────
|
|
35
39
|
const SWAPS = [
|
|
36
|
-
// Different-
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
// with a code-change suggestion
|
|
40
|
+
// Different-API candidates (bcrypt → bcryptjs, argon2 → hash-wasm,
|
|
41
|
+
// node-sass → sass, grpc → @grpc/grpc-js, @swc/core → @swc/wasm-web)
|
|
42
|
+
// are intentionally NOT here. A swap installs the target under the
|
|
43
|
+
// original name, so `require(originalName)` would load a module whose
|
|
44
|
+
// API the caller's code was not written against. They are in
|
|
45
|
+
// `rejects` with a code-change suggestion.
|
|
42
46
|
{
|
|
43
47
|
from: 'esbuild',
|
|
44
48
|
to: 'esbuild-wasm',
|
|
@@ -233,6 +237,19 @@ const REJECTS = [
|
|
|
233
237
|
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).',
|
|
234
238
|
transitive: 'fail',
|
|
235
239
|
},
|
|
240
|
+
// ── Rolldown (Vite 8's bundler): native shards plus a wasi-threads build ──
|
|
241
|
+
{
|
|
242
|
+
from: 'rolldown',
|
|
243
|
+
reason: 'Native Rust bundler that Vite 8 loads at startup. Its only non-native build, @rolldown/binding-wasm32-wasi, is a wasm32-wasip1-threads binary, and Workers run one thread per isolate with Atomics.wait disabled.',
|
|
244
|
+
suggest: 'no Workers-compatible target — rolldown publishes no single-threaded build, so tools that load Vite 8 themselves (Astro 7) cannot start here.',
|
|
245
|
+
transitive: 'fail',
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
from: '@rolldown/binding-wasm32-wasi',
|
|
249
|
+
reason: 'wasm32-wasip1-threads build of rolldown: it imports a shared memory and wasi thread-spawn, its Rust locks and thread parking execute memory.atomic.wait32, and its loader needs node:wasi and worker_threads. Workers run one thread per isolate with Atomics.wait disabled.',
|
|
250
|
+
suggest: 'no Workers-compatible target — rolldown publishes no single-threaded build.',
|
|
251
|
+
transitive: 'fail',
|
|
252
|
+
},
|
|
236
253
|
];
|
|
237
254
|
/**
|
|
238
255
|
* The single typed package-ABI policy (see `PackageAbiPolicy` in
|
|
@@ -279,7 +296,7 @@ export const PACKAGE_ABI_POLICY = {
|
|
|
279
296
|
// @rollup/wasm-node matches the '@rollup/rollup-'-adjacent shard shape
|
|
280
297
|
// check by prefix but is the pure-WASM build, not a native shard.
|
|
281
298
|
nativeShardExemptions: ['@rollup/wasm-node'],
|
|
282
|
-
nativeBinExtensions:
|
|
299
|
+
nativeBinExtensions: NATIVE_BIN_EXTENSIONS,
|
|
283
300
|
};
|
|
284
301
|
// ─────────────────────────────────────────────────────────────────────────
|
|
285
302
|
// Policy functions — SERIALIZED into facet preambles via fn.toString().
|
|
@@ -330,22 +347,42 @@ export function applyStagedArtifact(pkg, entry) {
|
|
|
330
347
|
policyApplyStagedArtifact(pkg, entry, STAGED_ARTIFACT_BIN_PREFIX);
|
|
331
348
|
}
|
|
332
349
|
/**
|
|
333
|
-
*
|
|
334
|
-
*
|
|
350
|
+
* The npm alias range a swap declares on the user's behalf:
|
|
351
|
+
* `esbuild@^0.20` becomes `esbuild@npm:esbuild-wasm@^0.20`.
|
|
335
352
|
*
|
|
336
|
-
*
|
|
353
|
+
* A swap IS an alias dependency. Expressing it as one means the installer's
|
|
354
|
+
* single alias path does the rest: the packument comes from the swap
|
|
355
|
+
* target, the package lands under the DECLARED name's directory
|
|
356
|
+
* (`node_modules/esbuild`), and require/import, bin links, the fs bundle
|
|
357
|
+
* and the lockfile all see the name the program asked for. Rewriting the
|
|
358
|
+
* KEY instead (`esbuild` → `esbuild-wasm`) is what left `require('esbuild')`
|
|
359
|
+
* unresolvable after `npm install esbuild`, and it collided with a sibling
|
|
360
|
+
* `esbuild-wasm` spec the project also declared.
|
|
337
361
|
*
|
|
338
|
-
* Range carry-over:
|
|
339
|
-
*
|
|
340
|
-
*
|
|
362
|
+
* Range carry-over: swap targets publish the same version numbers as the
|
|
363
|
+
* packages they stand in for, so the user's requested range is honoured
|
|
364
|
+
* against the target.
|
|
365
|
+
*/
|
|
366
|
+
export function swapAliasRange(swap, range) {
|
|
367
|
+
return `npm:${swap.to}@${range || 'latest'}`;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Pure: return a new specs map with every swap `from` key's range rewritten
|
|
371
|
+
* to the alias range of its swap target (see `swapAliasRange`). Keys are
|
|
372
|
+
* never renamed, so every spec the caller declared is still present under
|
|
373
|
+
* its own name. Records the swaps actually performed.
|
|
374
|
+
*
|
|
375
|
+
* Idempotent: a range that already names its registry package (`npm:…`)
|
|
376
|
+
* is left alone, whether the policy wrote it on a previous pass or the user
|
|
377
|
+
* typed an explicit alias — an explicit alias is authoritative.
|
|
341
378
|
*/
|
|
342
379
|
export function applySwaps(specs) {
|
|
343
380
|
const out = {};
|
|
344
381
|
const swaps = [];
|
|
345
382
|
for (const [name, range] of Object.entries(specs)) {
|
|
346
383
|
const swap = lookupSwap(name);
|
|
347
|
-
if (swap) {
|
|
348
|
-
out[
|
|
384
|
+
if (swap && !String(range).startsWith('npm:')) {
|
|
385
|
+
out[name] = swapAliasRange(swap, range);
|
|
349
386
|
swaps.push(swap);
|
|
350
387
|
}
|
|
351
388
|
else {
|
|
@@ -383,21 +420,6 @@ const ANSI_RESET = '\x1b[0m';
|
|
|
383
420
|
export function formatSwapNotice(s) {
|
|
384
421
|
return `[npm] ${ANSI_YELLOW}[swap]${ANSI_RESET} ${s.from} → ${s.to} (${s.reason})`;
|
|
385
422
|
}
|
|
386
|
-
/**
|
|
387
|
-
* Single-line yellow notice emitted for a `[skip]`.
|
|
388
|
-
* `[npm] [skip] fsevents — macOS-only filesystem watcher; never runs in Workers`
|
|
389
|
-
*
|
|
390
|
-
* When the entry carries an actionable suggestion it is appended inline
|
|
391
|
-
* (`… try: <hint>`) — the same line shape for optional-shard skips and
|
|
392
|
-
* required-package skips, so one grep explains every package the install
|
|
393
|
-
* left out.
|
|
394
|
-
*/
|
|
395
|
-
export function formatTransitiveSkip(r) {
|
|
396
|
-
const base = `[npm] ${ANSI_YELLOW}[skip]${ANSI_RESET} ${r.from} — ${r.reason}`;
|
|
397
|
-
if (r.suggest)
|
|
398
|
-
return `${base} ${ANSI_DIM}… try:${ANSI_RESET} ${r.suggest}`;
|
|
399
|
-
return base;
|
|
400
|
-
}
|
|
401
423
|
let _sink = null;
|
|
402
424
|
let _sinkThrowCount = 0;
|
|
403
425
|
/**
|
|
@@ -411,9 +433,6 @@ let _sinkThrowCount = 0;
|
|
|
411
433
|
export function setRegistryEventSink(s) {
|
|
412
434
|
_sink = s;
|
|
413
435
|
}
|
|
414
|
-
export function getRegistryEventSink() {
|
|
415
|
-
return _sink;
|
|
416
|
-
}
|
|
417
436
|
/**
|
|
418
437
|
* Forward an event to the sink. Sink throws are caught (telemetry must
|
|
419
438
|
* never break install) and counted.
|
|
@@ -502,21 +521,15 @@ export function policyIsOptionalNativeBinding(policy, p) {
|
|
|
502
521
|
* Serialized into facet preambles — self-contained by contract.
|
|
503
522
|
*/
|
|
504
523
|
export function policyNativeBinAdvisory(policy, pkg) {
|
|
524
|
+
// Self-contained: this function is serialized into the facet preamble.
|
|
505
525
|
const fileExtension = (path) => {
|
|
506
|
-
const
|
|
507
|
-
const query = text.indexOf('?');
|
|
508
|
-
const fragment = text.indexOf('#');
|
|
509
|
-
const end = query < 0
|
|
510
|
-
? (fragment < 0 ? text.length : fragment)
|
|
511
|
-
: (fragment < 0 ? query : Math.min(query, fragment));
|
|
512
|
-
const clean = text.slice(0, end);
|
|
526
|
+
const clean = String(path || '').split(/[?#]/)[0];
|
|
513
527
|
const name = clean.slice(clean.lastIndexOf('/') + 1);
|
|
514
528
|
const dot = name.lastIndexOf('.');
|
|
515
529
|
return dot > 0 ? name.slice(dot).toLowerCase() : '';
|
|
516
530
|
};
|
|
517
531
|
for (const target of Object.values(pkg.bin ?? {})) {
|
|
518
|
-
|
|
519
|
-
if (policy.nativeBinExtensions.includes(ext)) {
|
|
532
|
+
if (policy.nativeBinExtensions.includes(fileExtension(target))) {
|
|
520
533
|
return {
|
|
521
534
|
from: pkg.name,
|
|
522
535
|
reason: `Package ${pkg.name} exposes native executable bin '${target}' ` +
|
|
@@ -568,17 +581,10 @@ export function policyNativePlatformReject(policy, pkg) {
|
|
|
568
581
|
* skip classifier, which treats either native shape as skippable from
|
|
569
582
|
* an optional edge.
|
|
570
583
|
*/
|
|
571
|
-
export function policyNativeArtifactReject(policy, pkg) {
|
|
572
|
-
return (policyNativeBinAdvisory(policy, pkg) ??
|
|
573
|
-
policyNativePlatformReject(policy, pkg));
|
|
574
|
-
}
|
|
575
584
|
// Supervisor wrappers over the serializable policy functions.
|
|
576
585
|
export function isOptionalNativeBinding(p) {
|
|
577
586
|
return policyIsOptionalNativeBinding(PACKAGE_ABI_POLICY, p);
|
|
578
587
|
}
|
|
579
|
-
export function nativeExecutableReject(pkg) {
|
|
580
|
-
return policyNativeArtifactReject(PACKAGE_ABI_POLICY, pkg);
|
|
581
|
-
}
|
|
582
588
|
/**
|
|
583
589
|
* Select which entries in `peerDependencies` should be auto-installed.
|
|
584
590
|
*
|
|
@@ -58,7 +58,7 @@ export declare class WebSocketTerminal {
|
|
|
58
58
|
*/
|
|
59
59
|
flushNow(): void;
|
|
60
60
|
private flush;
|
|
61
|
-
onData(callback: (data: string) => void): void;
|
|
61
|
+
onData(callback: (data: string) => void | Promise<void>): void;
|
|
62
62
|
handleMessage(msg: {
|
|
63
63
|
type: string;
|
|
64
64
|
data?: string;
|
|
@@ -68,7 +68,7 @@ export declare class WebSocketTerminal {
|
|
|
68
68
|
content?: string;
|
|
69
69
|
dir?: string;
|
|
70
70
|
recursive?: boolean;
|
|
71
|
-
}): void
|
|
71
|
+
}): void | Promise<void>;
|
|
72
72
|
/**
|
|
73
73
|
* editor/monaco (2026-05-13): install the fs-* message handler.
|
|
74
74
|
* The callback receives the raw message + a reply lambda that
|
|
@@ -77,8 +77,8 @@ export declare class WebSocketTerminal {
|
|
|
77
77
|
* reinstalls on warm rejoin via `attach()`.
|
|
78
78
|
*/
|
|
79
79
|
onFs(cb: (msg: any, reply: (frame: any) => void) => void): void;
|
|
80
|
-
sendData(data: string): void
|
|
81
|
-
attachRepl(input: (data: string) => void
|
|
80
|
+
sendData(data: string): void | Promise<void>;
|
|
81
|
+
attachRepl(input: (data: string) => void | Promise<void>, dispose?: () => Promise<void>): () => void;
|
|
82
82
|
focus(): void;
|
|
83
83
|
clear(): void;
|
|
84
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-terminal.d.ts","sourceRoot":"","sources":["../../src/facets/ws-terminal.ts"],"names":[],"mappings":"AAQA,qBAAa,iBAAiB;IAC5B,wEAAwE;IACjE,EAAE,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"ws-terminal.d.ts","sourceRoot":"","sources":["../../src/facets/ws-terminal.ts"],"names":[],"mappings":"AAQA,qBAAa,iBAAiB;IAC5B,wEAAwE;IACjE,EAAE,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,YAAY,CAAyD;IAE7E;;;;;;;;;;;;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,GAAE,SAAS,GAAG,IAAW,EAAE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;IAKzE;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAK7D,iEAAiE;IACjE,MAAM,IAAI,IAAI;IAGd,OAAO,CAAC,WAAW,CAA4B;IA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AAI,IAAI;IACb,KAAK,IAAI,IAAI;CACd"}
|
|
@@ -141,8 +141,8 @@ export class WebSocketTerminal {
|
|
|
141
141
|
switch (msg.type) {
|
|
142
142
|
case 'input':
|
|
143
143
|
if (msg.data)
|
|
144
|
-
this.sendData(msg.data);
|
|
145
|
-
|
|
144
|
+
return this.sendData(msg.data);
|
|
145
|
+
return;
|
|
146
146
|
case 'resize':
|
|
147
147
|
if (msg.cols)
|
|
148
148
|
this._cols = msg.cols;
|
|
@@ -202,9 +202,8 @@ export class WebSocketTerminal {
|
|
|
202
202
|
}
|
|
203
203
|
sendData(data) {
|
|
204
204
|
if (this.replBinding)
|
|
205
|
-
this.replBinding.input(data);
|
|
206
|
-
|
|
207
|
-
this.dataCallback?.(data);
|
|
205
|
+
return this.replBinding.input(data);
|
|
206
|
+
return this.dataCallback?.(data);
|
|
208
207
|
}
|
|
209
208
|
attachRepl(input, dispose) {
|
|
210
209
|
if (this.replTeardown)
|
package/dist/git/commands.d.ts
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* git
|
|
2
|
+
* git/commands.ts — Nimbus v2.0 Git integration via isomorphic-git.
|
|
3
3
|
*
|
|
4
4
|
* Provides a full `git` command with subcommands:
|
|
5
|
-
* init, clone, status, add, commit, log, branch, checkout,
|
|
6
|
-
*
|
|
5
|
+
* init, clone, status, add, commit, log, branch, checkout, diff,
|
|
6
|
+
* ls-files, rev-parse, remote, fetch, pull, push, merge, reset, tag
|
|
7
7
|
*
|
|
8
8
|
* Uses a VFS→isomorphic-git FS adapter that maps all operations
|
|
9
9
|
* to the SqliteVFS.
|
|
10
10
|
*/
|
|
11
11
|
import type { SqliteVFS } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
|
|
12
12
|
import { type VfsCred } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
13
|
+
type OutputStream = {
|
|
14
|
+
write(s: string): void | Promise<void>;
|
|
15
|
+
/** Present on sinks that keep bytes verbatim (files, byte-capable pipes). */
|
|
16
|
+
writeBytes?(bytes: Uint8Array): void | Promise<void>;
|
|
17
|
+
};
|
|
13
18
|
type Ctx = {
|
|
14
19
|
pid: number;
|
|
15
20
|
cred: VfsCred;
|
|
16
21
|
args: string[];
|
|
17
|
-
stdout:
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
stderr: {
|
|
21
|
-
write(s: string): void;
|
|
22
|
-
};
|
|
22
|
+
stdout: OutputStream;
|
|
23
|
+
stderr: OutputStream;
|
|
23
24
|
cwd: string;
|
|
24
25
|
env: Record<string, string>;
|
|
25
26
|
};
|
|
27
|
+
export interface ParsedGitGlobals {
|
|
28
|
+
sub: string | undefined;
|
|
29
|
+
subArgs: string[];
|
|
30
|
+
/** The directory the subcommand runs in, after every `-C`. */
|
|
31
|
+
dir: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The options git accepts BEFORE the subcommand. `-C <path>` runs the
|
|
35
|
+
* command as if started from <path>; repeated, each is relative to the
|
|
36
|
+
* previous (`git -C a -C b` runs in `a/b`). `--no-pager` and `-P` are
|
|
37
|
+
* accepted and mean nothing here, there is no pager. Any other leading
|
|
38
|
+
* option is refused: swallowing it would run the next word as a subcommand.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseGitGlobals(args: string[], cwd: string): ParsedGitGlobals;
|
|
26
41
|
export interface ParsedCloneArgs {
|
|
27
42
|
url: string | undefined;
|
|
28
43
|
dest: string | undefined;
|
|
@@ -30,8 +45,10 @@ export interface ParsedCloneArgs {
|
|
|
30
45
|
noShallow: boolean;
|
|
31
46
|
isBg: boolean;
|
|
32
47
|
branch: string | undefined;
|
|
48
|
+
/** `-q`/`--quiet`: no progress on stdout; errors still reach stderr. */
|
|
49
|
+
quiet: boolean;
|
|
33
50
|
}
|
|
34
|
-
export declare const CLONE_USAGE = "usage: git clone [--depth <n>] [--no-shallow] [--branch <name> | -b <name>] [--bg] <url> [dir]";
|
|
51
|
+
export declare const CLONE_USAGE = "usage: git clone [-q | --quiet] [--depth <n>] [--no-shallow] [--branch <name> | -b <name>] [--bg] <url> [dir]";
|
|
35
52
|
/**
|
|
36
53
|
* Every flag is either handled or refused loudly. Silently skipping unknown
|
|
37
54
|
* flags corrupted positionals for value-taking ones (`--branch dev URL`
|
|
@@ -39,6 +56,12 @@ export declare const CLONE_USAGE = "usage: git clone [--depth <n>] [--no-shallow
|
|
|
39
56
|
* "blobless" clone that was not blobless.
|
|
40
57
|
*/
|
|
41
58
|
export declare function parseCloneArgs(args: string[]): ParsedCloneArgs;
|
|
59
|
+
/**
|
|
60
|
+
* The index entries that restoring `restored` replaces (add_index_entry_with_check):
|
|
61
|
+
* a file at one of a restored path's leading directories, or anything below a
|
|
62
|
+
* restored path.
|
|
63
|
+
*/
|
|
64
|
+
export declare function replacedIndexEntries(index: readonly string[], restored: ReadonlySet<string>): string[];
|
|
42
65
|
/**
|
|
43
66
|
* The `git` command handler. Split out from registration so it can be
|
|
44
67
|
* lazy-loaded (`await import('./commands.js')`) on first `git` use, keeping
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/git/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAmB,SAAS,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/git/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAmB,SAAS,EAAW,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAoNvF,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,6EAA6E;IAC7E,UAAU,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD,CA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