@nimbus-sh/worker 0.6.0 → 0.8.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 +2 -2
- package/dist/cirrus-npm-cjs.generated.d.ts +1 -1
- package/dist/cirrus-npm-cjs.generated.js +1 -1
- package/dist/facets/cirrus-real.d.ts.map +1 -1
- package/dist/facets/cirrus-real.js +6 -5
- package/dist/facets/compose.d.ts +148 -0
- package/dist/facets/compose.d.ts.map +1 -0
- package/dist/facets/compose.js +146 -0
- package/dist/facets/durable-images.d.ts +9 -5
- package/dist/facets/durable-images.d.ts.map +1 -1
- package/dist/facets/durable-images.js +17 -7
- package/dist/facets/esbuild-bundle-pool.d.ts +49 -0
- package/dist/facets/esbuild-bundle-pool.d.ts.map +1 -0
- package/dist/facets/esbuild-bundle-pool.js +122 -0
- package/dist/facets/exec-telemetry.d.ts +8 -0
- package/dist/facets/exec-telemetry.d.ts.map +1 -1
- package/dist/facets/manager.d.ts +240 -109
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +677 -342
- package/dist/facets/process.d.ts +20 -16
- package/dist/facets/process.d.ts.map +1 -1
- package/dist/facets/process.js +59 -28
- package/dist/facets/real-vite-fs-shim.js +2 -2
- package/dist/facets/real-vite-hmr.d.ts +3 -1
- package/dist/facets/real-vite-hmr.d.ts.map +1 -1
- package/dist/facets/real-vite-hmr.js +18 -8
- package/dist/facets/vite-dev-server.d.ts +25 -47
- package/dist/facets/vite-dev-server.d.ts.map +1 -1
- package/dist/facets/vite-dev-server.js +185 -219
- package/dist/facets/wasm-image-digest.d.ts +25 -0
- package/dist/facets/wasm-image-digest.d.ts.map +1 -0
- package/dist/facets/wasm-image-digest.js +25 -0
- package/dist/facets/wasm-swap-registry.d.ts +51 -92
- package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
- package/dist/facets/wasm-swap-registry.js +68 -227
- package/dist/facets/ws-terminal.d.ts +9 -31
- package/dist/facets/ws-terminal.d.ts.map +1 -1
- package/dist/facets/ws-terminal.js +58 -51
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +6 -5
- package/dist/hosted/commands.d.ts +12 -0
- package/dist/hosted/commands.d.ts.map +1 -0
- package/dist/hosted/commands.js +1658 -0
- package/dist/hosted/runtime.d.ts +114 -0
- package/dist/hosted/runtime.d.ts.map +1 -0
- package/dist/hosted/runtime.js +288 -0
- package/dist/hosted/services.d.ts +40 -0
- package/dist/hosted/services.d.ts.map +1 -0
- package/dist/hosted/services.js +512 -0
- package/dist/loaders/child-process/spawn-pool.d.ts +3 -2
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-pool.js +3 -2
- package/dist/loaders/generated-workers.d.ts +2 -2
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +3 -3
- package/dist/loaders/npm-resolve-preamble.d.ts +3 -6
- package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
- package/dist/loaders/npm-resolve-preamble.js +34 -108
- package/dist/node-shims-artifact.generated.js +3 -3
- package/dist/npm/install-batch-facet.d.ts +3 -2
- package/dist/npm/install-batch-facet.d.ts.map +1 -1
- package/dist/npm/install-batch-facet.js +45 -15
- package/dist/npm/installer.d.ts +22 -17
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +209 -193
- package/dist/npm/pre-bundle-facet.d.ts +1 -1
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
- package/dist/npm/pre-bundle-facet.js +1 -1
- package/dist/npm/resolve-facet.d.ts +6 -0
- package/dist/npm/resolve-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.d.ts +21 -20
- package/dist/npm/resolve-one-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.js +85 -84
- package/dist/npm/semver.d.ts +59 -0
- package/dist/npm/semver.d.ts.map +1 -0
- package/dist/npm/semver.js +226 -0
- package/dist/router/remote-api.js +31 -1
- package/dist/runtime/bash-repl.d.ts +1 -1
- package/dist/runtime/bash-repl.d.ts.map +1 -1
- package/dist/runtime/bash-repl.js +38 -4
- package/dist/runtime/bun-runner.js +1 -1
- package/dist/runtime/html-entrypoint.d.ts +7 -0
- package/dist/runtime/html-entrypoint.d.ts.map +1 -1
- package/dist/runtime/html-entrypoint.js +18 -2
- package/dist/runtime/node-runner.d.ts +4 -1
- package/dist/runtime/node-runner.d.ts.map +1 -1
- package/dist/runtime/node-runner.js +9 -2
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +305 -29
- package/dist/runtime/opencode-facet-runner.js +16 -16
- package/dist/runtime/package-manager.d.ts +35 -122
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +61 -596
- package/dist/runtime/process-logs-api.d.ts +1 -1
- package/dist/runtime/process-logs-api.d.ts.map +1 -1
- package/dist/runtime/process-logs-api.js +1 -1
- package/dist/runtime/python-repl.d.ts +2 -1
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +82 -59
- package/dist/runtime/repl-session.d.ts +9 -47
- package/dist/runtime/repl-session.d.ts.map +1 -1
- package/dist/runtime/repl-session.js +105 -105
- package/dist/runtime/runtime-catalog.d.ts +13 -0
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +88 -0
- package/dist/session/agent.d.ts +1 -21
- package/dist/session/agent.d.ts.map +1 -1
- package/dist/session/ai.d.ts +5 -1
- package/dist/session/ai.d.ts.map +1 -1
- package/dist/session/ai.js +7 -0
- package/dist/session/helpers.d.ts +38 -0
- package/dist/session/helpers.d.ts.map +1 -1
- package/dist/session/helpers.js +76 -0
- package/dist/session/hibernation.d.ts +2 -1
- package/dist/session/hibernation.d.ts.map +1 -1
- package/dist/session/hibernation.js +7 -4
- package/dist/session/init-phases.d.ts +1 -1
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +2 -12
- package/dist/session/init.d.ts +15 -36
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +50 -2327
- package/dist/session/loopback.d.ts +2 -29
- package/dist/session/loopback.d.ts.map +1 -1
- package/dist/session/loopback.js +3 -27
- package/dist/session/nimbus-session.d.ts +77 -34
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +126 -514
- package/dist/session/npm-install-port.d.ts +18 -0
- package/dist/session/npm-install-port.d.ts.map +1 -0
- package/dist/session/npm-install-port.js +37 -0
- package/dist/session/port-capability.d.ts +44 -0
- package/dist/session/port-capability.d.ts.map +1 -1
- package/dist/session/port-capability.js +110 -0
- package/dist/session/programmatic.d.ts +36 -43
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +109 -115
- package/dist/session/routes.d.ts +30 -17
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +42 -131
- package/dist/session/rpc.d.ts +15 -15
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +98 -49
- package/dist/session/serving-port.d.ts +27 -0
- package/dist/session/serving-port.d.ts.map +1 -0
- package/dist/session/serving-port.js +27 -0
- package/dist/session/start-real-vite.d.ts +12 -0
- package/dist/session/start-real-vite.d.ts.map +1 -1
- package/dist/session/start-real-vite.js +4 -4
- package/dist/session/supervisor-op.d.ts +4 -4
- package/dist/session/supervisor-op.d.ts.map +1 -1
- package/dist/session/supervisor-op.js +24 -10
- package/dist/session/supervisor-rpc.d.ts +7 -7
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +4 -0
- package/dist/session/vite-command.d.ts +18 -0
- package/dist/session/vite-command.d.ts.map +1 -0
- package/dist/session/vite-command.js +609 -0
- package/dist/session/ws.d.ts +61 -0
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +122 -12
- package/dist/shell/npm-bin-entrypoints.d.ts +0 -35
- package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
- package/dist/shell/npm-bin-entrypoints.js +12 -85
- package/dist/workspace-host.d.ts +6 -0
- package/dist/workspace-host.d.ts.map +1 -0
- package/dist/workspace-host.js +5 -0
- package/dist/workspace.d.ts +2 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +1 -0
- package/package.json +34 -9
- package/public/_assets/runtime/{node-shims-9e1380d9ee430fcc.js → node-shims-8f8c64edd2a1f0f5.js} +305 -29
- package/public/index.html +1 -1
- package/scripts/bundle-facet-workers.mjs +1 -1
- package/scripts/bundle-npm-cjs.mjs +2 -2
- package/dist/facets/on-demand-bundle-gate.d.ts +0 -65
- package/dist/facets/on-demand-bundle-gate.d.ts.map +0 -1
- package/dist/facets/on-demand-bundle-gate.js +0 -125
- package/dist/npm/install-args.d.ts +0 -21
- package/dist/npm/install-args.d.ts.map +0 -1
- package/dist/npm/install-args.js +0 -70
- package/dist/npm/npm-log.d.ts +0 -31
- package/dist/npm/npm-log.d.ts.map +0 -1
- package/dist/npm/npm-log.js +0 -51
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OnDemandBundleGate — memory-bounded admission control for on-demand
|
|
3
|
-
* /@modules/ bundling.
|
|
4
|
-
*
|
|
5
|
-
* Why this exists
|
|
6
|
-
* ───────────────
|
|
7
|
-
* The dev server bundles user packages on demand by building a file
|
|
8
|
-
* "slice" in the supervisor heap (up to SLICE_CAP_BYTES ≈ 28 MiB) and
|
|
9
|
-
* shipping it to a facet isolate over RPC. The facet RPC round-trip is
|
|
10
|
-
* the dominant wall time; the supervisor just holds the slice array
|
|
11
|
-
* alive until the clone completes. A fresh React app first-load requests
|
|
12
|
-
* many distinct /@modules/ concurrently, so the naive path either:
|
|
13
|
-
* - builds all slices at once → peak heap = N × 28 MiB → supervisor
|
|
14
|
-
* OOM on a shared DO isolate (the install-time pre-bundler proved
|
|
15
|
-
* concurrency=2 of max slices crashes a Mossaic-scale isolate), or
|
|
16
|
-
* - serializes everything behind one slot → multi-second first load.
|
|
17
|
-
*
|
|
18
|
-
* This gate threads the needle: it bounds the TOTAL slice BYTES resident
|
|
19
|
-
* at once (not a count), so many SMALL slices' RPC round-trips overlap
|
|
20
|
-
* while a single LARGE slice still serializes the rest — peak resident
|
|
21
|
-
* slice bytes never exceed `budgetBytes`, which is set to one slice cap.
|
|
22
|
-
*
|
|
23
|
-
* How it bounds peak heap
|
|
24
|
-
* ───────────────────────
|
|
25
|
-
* - Only ONE slice is ever mid-BUILD (a build lock): the slice array
|
|
26
|
-
* does not exist until built, so we can't reserve its real size up
|
|
27
|
-
* front. Serializing the (fast, synchronous) build means at most one
|
|
28
|
-
* un-accounted slice exists at any instant.
|
|
29
|
-
* - The moment a build finishes, the caller `admit(realBytes)`s: that
|
|
30
|
-
* reserves the slice's actual size against the byte budget (blocking
|
|
31
|
-
* if the budget is full) and only THEN releases the build lock for
|
|
32
|
-
* the next builder.
|
|
33
|
-
* - Reserved bytes are released when the caller's work (the facet
|
|
34
|
-
* submit) settles.
|
|
35
|
-
*
|
|
36
|
-
* Invariant: at any instant, Σ(reserved bytes of in-flight submits) +
|
|
37
|
-
* (one building slice, already counted the moment it admits) ≤
|
|
38
|
-
* budgetBytes. With budgetBytes = SLICE_CAP_BYTES the peak matches the
|
|
39
|
-
* single-slot serialization it replaces — no heap regression — while
|
|
40
|
-
* small slices proceed concurrently.
|
|
41
|
-
*/
|
|
42
|
-
export class OnDemandBundleGate {
|
|
43
|
-
budgetBytes;
|
|
44
|
-
buildLock = Promise.resolve();
|
|
45
|
-
reservedBytes = 0;
|
|
46
|
-
/** FIFO queue of callers blocked on byte-budget headroom. */
|
|
47
|
-
byteWaiters = [];
|
|
48
|
-
constructor(budgetBytes) {
|
|
49
|
-
this.budgetBytes = budgetBytes;
|
|
50
|
-
if (budgetBytes <= 0)
|
|
51
|
-
throw new Error('OnDemandBundleGate budgetBytes must be > 0');
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Run a build-then-submit job under the gate.
|
|
55
|
-
*
|
|
56
|
-
* `job` receives an `admit(bytes)` callback it MUST call exactly once,
|
|
57
|
-
* after its slice is built and its real byte size is known, before the
|
|
58
|
-
* long-running submit. `admit` reserves the bytes and releases the
|
|
59
|
-
* build lock so the next job can start building. Jobs that bail before
|
|
60
|
-
* building a slice (early return / error) simply never call `admit`;
|
|
61
|
-
* the build lock is released when `job` settles either way.
|
|
62
|
-
*/
|
|
63
|
-
async run(job) {
|
|
64
|
-
// Acquire the build lock (serialize slice construction).
|
|
65
|
-
const prev = this.buildLock;
|
|
66
|
-
let releaseBuild;
|
|
67
|
-
this.buildLock = new Promise((res) => { releaseBuild = res; });
|
|
68
|
-
await prev;
|
|
69
|
-
let admittedBytes = 0;
|
|
70
|
-
let buildReleased = false;
|
|
71
|
-
const releaseBuildOnce = () => {
|
|
72
|
-
if (!buildReleased) {
|
|
73
|
-
buildReleased = true;
|
|
74
|
-
releaseBuild();
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const admit = async (bytes) => {
|
|
78
|
-
const clamped = Math.max(0, Math.min(bytes, this.budgetBytes));
|
|
79
|
-
await this.acquireBytes(clamped);
|
|
80
|
-
admittedBytes = clamped;
|
|
81
|
-
// Slice is now accounted against the budget — let the next slice build.
|
|
82
|
-
releaseBuildOnce();
|
|
83
|
-
};
|
|
84
|
-
try {
|
|
85
|
-
return await job(admit);
|
|
86
|
-
}
|
|
87
|
-
finally {
|
|
88
|
-
// If the job never admitted (bailed pre-build), free the build lock now.
|
|
89
|
-
releaseBuildOnce();
|
|
90
|
-
if (admittedBytes > 0)
|
|
91
|
-
this.releaseBytes(admittedBytes);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
acquireBytes(bytes) {
|
|
95
|
-
// Admit when the reservation fits, OR when nothing is reserved (so a
|
|
96
|
-
// single slice larger than the budget still makes progress instead of
|
|
97
|
-
// deadlocking). FIFO: a waiter that doesn't fit blocks later waiters
|
|
98
|
-
// even if they would, to avoid starving large slices.
|
|
99
|
-
if (this.byteWaiters.length === 0 &&
|
|
100
|
-
(this.reservedBytes + bytes <= this.budgetBytes || this.reservedBytes === 0)) {
|
|
101
|
-
this.reservedBytes += bytes;
|
|
102
|
-
return Promise.resolve();
|
|
103
|
-
}
|
|
104
|
-
return new Promise((resolve) => {
|
|
105
|
-
this.byteWaiters.push({ bytes, resolve });
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
releaseBytes(bytes) {
|
|
109
|
-
this.reservedBytes = Math.max(0, this.reservedBytes - bytes);
|
|
110
|
-
// Wake head-of-line waiters that now fit. Strict FIFO: stop at the
|
|
111
|
-
// first waiter that doesn't fit (unless nothing is reserved, in which
|
|
112
|
-
// case admit it anyway so an oversized slice can't deadlock).
|
|
113
|
-
while (this.byteWaiters.length > 0) {
|
|
114
|
-
const head = this.byteWaiters[0];
|
|
115
|
-
const fits = this.reservedBytes + head.bytes <= this.budgetBytes || this.reservedBytes === 0;
|
|
116
|
-
if (!fits)
|
|
117
|
-
break;
|
|
118
|
-
this.byteWaiters.shift();
|
|
119
|
-
this.reservedBytes += head.bytes;
|
|
120
|
-
head.resolve();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/** Test/diagnostic snapshot. */
|
|
124
|
-
get inFlightBytes() { return this.reservedBytes; }
|
|
125
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type NpmLogLevel } from './npm-log.js';
|
|
2
|
-
export interface NpmInstallInvocation {
|
|
3
|
-
packages: string[];
|
|
4
|
-
global: boolean;
|
|
5
|
-
prefix: string | null;
|
|
6
|
-
/** `--loglevel`, when it names a level npm recognises; null otherwise. */
|
|
7
|
-
loglevel: NpmLogLevel | null;
|
|
8
|
-
/**
|
|
9
|
-
* `--production` / `-p` / `--omit=dev`: install dependencies only.
|
|
10
|
-
*
|
|
11
|
-
* Both npm and bun honour this, and it is the one answer a project has to a
|
|
12
|
-
* devDependency Nimbus cannot run — a headless-browser driver, a native
|
|
13
|
-
* toolchain — when the thing being installed is the runtime, not the test
|
|
14
|
-
* suite. The flag was in the arg spec but its value was dropped, so it
|
|
15
|
-
* silently did nothing and the install failed on a package the caller had
|
|
16
|
-
* already said to skip.
|
|
17
|
-
*/
|
|
18
|
-
production: boolean;
|
|
19
|
-
}
|
|
20
|
-
export declare function parseNpmInstallInvocation(args: string[]): NpmInstallInvocation;
|
|
21
|
-
//# sourceMappingURL=install-args.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install-args.d.ts","sourceRoot":"","sources":["../../src/npm/install-args.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B;;;;;;;;;OASG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAmCD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAS9E"}
|
package/dist/npm/install-args.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { parseArgs } from '@nimbus-sh/core/substrate/lifo/utils/args.js';
|
|
2
|
-
import { parseNpmLogLevel } from './npm-log.js';
|
|
3
|
-
const INSTALL_ARG_SPEC = {
|
|
4
|
-
global: { type: 'boolean', short: 'g' },
|
|
5
|
-
prefix: { type: 'string' },
|
|
6
|
-
loglevel: { type: 'string' },
|
|
7
|
-
registry: { type: 'string' },
|
|
8
|
-
tag: { type: 'string' },
|
|
9
|
-
cache: { type: 'string' },
|
|
10
|
-
omit: { type: 'string' },
|
|
11
|
-
include: { type: 'string' },
|
|
12
|
-
workspace: { type: 'string', short: 'w' },
|
|
13
|
-
'min-release-age': { type: 'string' },
|
|
14
|
-
'save-prefix': { type: 'string' },
|
|
15
|
-
'ignore-scripts': { type: 'boolean' },
|
|
16
|
-
'no-fund': { type: 'boolean' },
|
|
17
|
-
fund: { type: 'boolean' },
|
|
18
|
-
'no-audit': { type: 'boolean' },
|
|
19
|
-
audit: { type: 'boolean' },
|
|
20
|
-
progress: { type: 'boolean' },
|
|
21
|
-
save: { type: 'boolean', short: 'S' },
|
|
22
|
-
'save-dev': { type: 'boolean', short: 'D' },
|
|
23
|
-
'save-prod': { type: 'boolean', short: 'P' },
|
|
24
|
-
'save-optional': { type: 'boolean', short: 'O' },
|
|
25
|
-
'save-exact': { type: 'boolean', short: 'E' },
|
|
26
|
-
'package-lock': { type: 'boolean' },
|
|
27
|
-
'dry-run': { type: 'boolean' },
|
|
28
|
-
force: { type: 'boolean', short: 'f' },
|
|
29
|
-
'legacy-peer-deps': { type: 'boolean' },
|
|
30
|
-
workspaces: { type: 'boolean' },
|
|
31
|
-
// bun spells it `-p`; npm's `-P` is --save-prod, and the short map is
|
|
32
|
-
// case-sensitive, so both tools' spellings land where they should.
|
|
33
|
-
production: { type: 'boolean', short: 'p' },
|
|
34
|
-
};
|
|
35
|
-
export function parseNpmInstallInvocation(args) {
|
|
36
|
-
const parsed = parseArgs(args, INSTALL_ARG_SPEC);
|
|
37
|
-
return {
|
|
38
|
-
packages: parsed.positional,
|
|
39
|
-
global: parsed.flags.global === true,
|
|
40
|
-
prefix: stringFlag(parsed.flags.prefix),
|
|
41
|
-
loglevel: parseNpmLogLevel(parsed.flags.loglevel),
|
|
42
|
-
production: parsed.flags.production === true || omittedDependencyTypes(args).has('dev'),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Every `--omit` in the invocation. npm allows the flag more than once
|
|
47
|
-
* (`--omit=dev --omit=optional`), and the generic parser keeps only the last
|
|
48
|
-
* value — so the one spelling that matters would be missed whenever a caller
|
|
49
|
-
* omitted more than one kind.
|
|
50
|
-
*/
|
|
51
|
-
function omittedDependencyTypes(args) {
|
|
52
|
-
const omitted = new Set();
|
|
53
|
-
for (let i = 0; i < args.length; i++) {
|
|
54
|
-
const arg = args[i];
|
|
55
|
-
if (arg === '--')
|
|
56
|
-
break;
|
|
57
|
-
if (arg === '--omit') {
|
|
58
|
-
const value = args[++i];
|
|
59
|
-
if (value)
|
|
60
|
-
omitted.add(value);
|
|
61
|
-
}
|
|
62
|
-
else if (arg.startsWith('--omit=')) {
|
|
63
|
-
omitted.add(arg.slice('--omit='.length));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return omitted;
|
|
67
|
-
}
|
|
68
|
-
function stringFlag(value) {
|
|
69
|
-
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
70
|
-
}
|
package/dist/npm/npm-log.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* npm's own log protocol, as emitted under `--loglevel`.
|
|
3
|
-
*
|
|
4
|
-
* Third-party tooling parses these lines rather than any prose we invent:
|
|
5
|
-
* pi's `install.sh` runs `npm install --loglevel=verbose`, tees the output
|
|
6
|
-
* to a file and advances its spinner label off `npm verbose title`,
|
|
7
|
-
* `npm http fetch GET …` and `npm http cache …`. Discarding the flag left
|
|
8
|
-
* that label frozen at "starting npm install" for the whole install, so
|
|
9
|
-
* honouring it means speaking npm's wire format on the same stream.
|
|
10
|
-
*/
|
|
11
|
-
export type NpmLogLevel = 'silent' | 'error' | 'warn' | 'notice' | 'http' | 'info' | 'verbose' | 'silly';
|
|
12
|
-
/** The level a line is reported at; the caller decides whether to print it. */
|
|
13
|
-
export type NpmLogEmitter = (level: NpmLogLevel, line: string) => void;
|
|
14
|
-
export declare function parseNpmLogLevel(value: unknown): NpmLogLevel | null;
|
|
15
|
-
export declare function npmLogEnabled(configured: NpmLogLevel | null, line: NpmLogLevel): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* `npm verbose title npm install …` — npm's first verbose line, and the one
|
|
18
|
-
* that tells a watcher the resolution phase has begun.
|
|
19
|
-
*/
|
|
20
|
-
export declare function npmTitleLine(packages: readonly string[]): string;
|
|
21
|
-
/** `npm http fetch GET 200 <url> <ms>ms (cache miss)` — served from the registry. */
|
|
22
|
-
export declare function npmHttpFetchLine(url: string, elapsedMs: number): string;
|
|
23
|
-
/**
|
|
24
|
-
* `npm http cache <url>` — served from a cache tier without a registry
|
|
25
|
-
* request. Tarball lines carry the integrity prefix npm uses as the cache
|
|
26
|
-
* key, which is also how a watcher tells a tarball from a packument.
|
|
27
|
-
*/
|
|
28
|
-
export declare function npmHttpCacheLine(url: string, integrity?: string): string;
|
|
29
|
-
/** `added N packages in Xs` — npm's install summary, unstyled. */
|
|
30
|
-
export declare function npmAddedLine(packages: number, elapsedMs: number): string;
|
|
31
|
-
//# sourceMappingURL=npm-log.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"npm-log.d.ts","sourceRoot":"","sources":["../../src/npm/npm-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,SAAS,GACT,OAAO,CAAC;AAcZ,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAEnE;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAExF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEhE;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGxE"}
|
package/dist/npm/npm-log.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* npm's own log protocol, as emitted under `--loglevel`.
|
|
3
|
-
*
|
|
4
|
-
* Third-party tooling parses these lines rather than any prose we invent:
|
|
5
|
-
* pi's `install.sh` runs `npm install --loglevel=verbose`, tees the output
|
|
6
|
-
* to a file and advances its spinner label off `npm verbose title`,
|
|
7
|
-
* `npm http fetch GET …` and `npm http cache …`. Discarding the flag left
|
|
8
|
-
* that label frozen at "starting npm install" for the whole install, so
|
|
9
|
-
* honouring it means speaking npm's wire format on the same stream.
|
|
10
|
-
*/
|
|
11
|
-
/** npm's own ordering: a level enables itself and everything quieter. */
|
|
12
|
-
const LEVEL_RANK = {
|
|
13
|
-
silent: 0,
|
|
14
|
-
error: 1,
|
|
15
|
-
warn: 2,
|
|
16
|
-
notice: 3,
|
|
17
|
-
http: 4,
|
|
18
|
-
info: 5,
|
|
19
|
-
verbose: 6,
|
|
20
|
-
silly: 7,
|
|
21
|
-
};
|
|
22
|
-
export function parseNpmLogLevel(value) {
|
|
23
|
-
return typeof value === 'string' && value in LEVEL_RANK ? value : null;
|
|
24
|
-
}
|
|
25
|
-
export function npmLogEnabled(configured, line) {
|
|
26
|
-
return configured !== null && LEVEL_RANK[configured] >= LEVEL_RANK[line];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* `npm verbose title npm install …` — npm's first verbose line, and the one
|
|
30
|
-
* that tells a watcher the resolution phase has begun.
|
|
31
|
-
*/
|
|
32
|
-
export function npmTitleLine(packages) {
|
|
33
|
-
return `npm verbose title npm install${packages.map((p) => ` ${p}`).join('')}`;
|
|
34
|
-
}
|
|
35
|
-
/** `npm http fetch GET 200 <url> <ms>ms (cache miss)` — served from the registry. */
|
|
36
|
-
export function npmHttpFetchLine(url, elapsedMs) {
|
|
37
|
-
return `npm http fetch GET 200 ${url} ${Math.max(0, Math.round(elapsedMs))}ms (cache miss)`;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* `npm http cache <url>` — served from a cache tier without a registry
|
|
41
|
-
* request. Tarball lines carry the integrity prefix npm uses as the cache
|
|
42
|
-
* key, which is also how a watcher tells a tarball from a packument.
|
|
43
|
-
*/
|
|
44
|
-
export function npmHttpCacheLine(url, integrity) {
|
|
45
|
-
return `npm http cache ${integrity ? `${integrity}@${url}` : url}`;
|
|
46
|
-
}
|
|
47
|
-
/** `added N packages in Xs` — npm's install summary, unstyled. */
|
|
48
|
-
export function npmAddedLine(packages, elapsedMs) {
|
|
49
|
-
const unit = packages === 1 ? 'package' : 'packages';
|
|
50
|
-
return `added ${packages} ${unit} in ${(elapsedMs / 1000).toFixed(1)}s`;
|
|
51
|
-
}
|