dsh-plugin-upgrader 1.6.3 → 1.7.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.
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Version ordering and release-link helpers.
2
+ * Version ordering, release-link helpers, and range matching.
3
3
  *
4
4
  * Everything here is pure: no I/O, no clock, no ambient state. The host half
5
- * uses it to sort published versions and to decide which GitHub page a version
6
- * line opens, and the test suite exercises it directly.
5
+ * uses it to sort published versions, to decide which GitHub page a version
6
+ * line opens, and to answer whether a published version is allowed on the
7
+ * runtime this profile is actually running.
7
8
  *
8
9
  * @module dsh-plugin-upgrader/lib/version
9
10
  */
@@ -38,6 +39,24 @@ export declare function comparePre(left: readonly string[], right: readonly stri
38
39
  * @returns negative when left is older.
39
40
  */
40
41
  export declare function compareVersions(left: string | undefined | null, right: string | undefined | null): number;
42
+ /**
43
+ * Does a version fall inside a manifest range?
44
+ *
45
+ * The host gate calls `semver.satisfies(version, range, { includePrerelease:
46
+ * true })` before it installs anything, so prereleases take part in comparisons
47
+ * here for the same reason: a plugin declaring `>=0.2.0-rc.2 <0.3.0-0` accepts
48
+ * the `0.2.1-rc.5` build people actually run, and marking that version
49
+ * unusable would be a lie.
50
+ *
51
+ * Ranges this module cannot parse answer `true`. A manifest written in a way
52
+ * this parser does not understand must never be the reason a version is called
53
+ * incompatible — the host stays the judge, and the page only loses a hint.
54
+ *
55
+ * @param version - the version to test, such as `0.2.1-rc.5`.
56
+ * @param range - a range as a manifest writes it; `''` means "no limit".
57
+ * @returns whether the version is inside the range.
58
+ */
59
+ export declare function satisfiesRange(version: string | undefined | null, range: string | undefined | null): boolean;
41
60
  /**
42
61
  * The tag a published version was released under.
43
62
  *
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/host/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,K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AAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAsBpF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAUzG;AAkPD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAClC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAC/B,OAAO,CA0BT;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5F"}
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Version ordering and release-link helpers.
2
+ * Version ordering, release-link helpers, and range matching.
3
3
  *
4
4
  * Everything here is pure: no I/O, no clock, no ambient state. The host half
5
- * uses it to sort published versions and to decide which GitHub page a version
6
- * line opens, and the test suite exercises it directly.
5
+ * uses it to sort published versions, to decide which GitHub page a version
6
+ * line opens, and to answer whether a published version is allowed on the
7
+ * runtime this profile is actually running.
7
8
  *
8
9
  * @module dsh-plugin-upgrader/lib/version
9
10
  */
@@ -80,6 +81,280 @@ export function compareVersions(left, right) {
80
81
  a.patch - b.patch ||
81
82
  comparePre(a.pre, b.pre));
82
83
  }
84
+ /** A wildcard segment, which a range may write as `x`, `X`, or `*`. */
85
+ const WILDCARD = /^[xX*]$/;
86
+ /**
87
+ * Parse one possibly-partial version, the way a range writes it.
88
+ *
89
+ * @param value - `1`, `1.2`, `1.2.3`, `1.2.x`, `1.2.3-rc.1`.
90
+ * @returns the parts, with `null` for absent or wildcard segments, or `null`
91
+ * when the text is not a version at all.
92
+ */
93
+ function parsePartial(value) {
94
+ const text = value.trim().replace(/^v/, '');
95
+ const match = /^(\d+|[xX*])(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(text);
96
+ if (match === null)
97
+ return null;
98
+ const segment = (raw) => {
99
+ if (raw === undefined || WILDCARD.test(raw))
100
+ return null;
101
+ return Number(raw);
102
+ };
103
+ const major = segment(match[1]);
104
+ // A wildcard in a lower segment means "any value here", so the segments
105
+ // after it cannot narrow the range either: `1.x.3` is `1.x`.
106
+ const minor = major === null ? null : segment(match[2]);
107
+ const patch = minor === null ? null : segment(match[3]);
108
+ return {
109
+ major,
110
+ minor,
111
+ patch,
112
+ pre: match[4] === undefined ? [] : match[4].split('.'),
113
+ };
114
+ }
115
+ /**
116
+ * Build one comparator.
117
+ *
118
+ * @param op - the comparison.
119
+ * @param major - major segment.
120
+ * @param minor - minor segment.
121
+ * @param patch - patch segment.
122
+ * @param pre - prerelease identifiers.
123
+ * @returns the comparator.
124
+ */
125
+ function bound(op, major, minor, patch, pre = []) {
126
+ return { op, parts: { major, minor, patch, pre: [...pre] } };
127
+ }
128
+ /**
129
+ * The lower bound semver writes for a partial range, `>=x.y.z-0`.
130
+ *
131
+ * A missing segment means "any value here", so the range has to start below
132
+ * that segment's first release — prereleases of it included. That is why
133
+ * `1.2` expands to `>=1.2.0-0`, not `>=1.2.0`: the latter would reject
134
+ * `1.2.0-rc.1`, which a partial range accepts.
135
+ *
136
+ * `>=0.0.0-0` is true of every version, so it is dropped rather than emitted;
137
+ * carrying it would only make the comparator list longer than the one semver
138
+ * builds, and these lists are compared against semver's in the test suite.
139
+ *
140
+ * @param major - major segment.
141
+ * @param minor - minor segment.
142
+ * @param patch - patch segment.
143
+ * @param pre - prerelease identifiers; `['0']` when a segment was missing.
144
+ * @returns zero or one comparator.
145
+ */
146
+ function atLeast(major, minor, patch, pre = []) {
147
+ if (major === 0 && minor === 0 && patch === 0 && pre.length === 1 && pre[0] === '0')
148
+ return [];
149
+ return [bound('>=', major, minor, patch, pre)];
150
+ }
151
+ /**
152
+ * The exclusive upper bound semver writes as `<x.y.z-0` for a partial range.
153
+ *
154
+ * The `-0` matters: with prereleases in play, `<0.3.0` would still admit
155
+ * `0.3.0-rc.1`, while `<0.3.0-0` does not. Plugin authors write this bound by
156
+ * hand (`<0.3.0-0`) and the ranges below have to mean the same thing.
157
+ *
158
+ * @param major - upper major.
159
+ * @param minor - upper minor.
160
+ * @param patch - upper patch.
161
+ * @returns the comparator.
162
+ */
163
+ function belowRelease(major, minor, patch) {
164
+ return bound('<', major, minor, patch, ['0']);
165
+ }
166
+ /**
167
+ * Expand one written version into the comparators it stands for.
168
+ *
169
+ * The expansions follow `node-semver`, which is what the host's compatibility
170
+ * gate uses; agreeing with it is the whole point, because a version this page
171
+ * calls usable and the host then refuses is worse than no marking at all.
172
+ * `test/version.test.ts` pins the table below against the real package.
173
+ *
174
+ * @param partial - the version as written.
175
+ * @param op - the operator in front of it, `^` and `~` included.
176
+ * @returns comparators, or `null` when the range is not understood.
177
+ */
178
+ function expand(partial, op) {
179
+ const { major, minor, patch, pre } = partial;
180
+ if (major === null)
181
+ return [];
182
+ const M = major;
183
+ const m = minor ?? 0;
184
+ const p = patch ?? 0;
185
+ /** A missing segment widens the range downwards, prereleases included. */
186
+ const open = ['0'];
187
+ switch (op) {
188
+ case '^':
189
+ if (minor === null)
190
+ return [...atLeast(M, 0, 0, open), belowRelease(M + 1, 0, 0)];
191
+ if (patch === null) {
192
+ return M === 0
193
+ ? [...atLeast(0, m, 0, open), belowRelease(0, m + 1, 0)]
194
+ : [...atLeast(M, m, 0, open), belowRelease(M + 1, 0, 0)];
195
+ }
196
+ if (M !== 0)
197
+ return [bound('>=', M, m, p, pre), belowRelease(M + 1, 0, 0)];
198
+ if (m !== 0)
199
+ return [bound('>=', 0, m, p, pre), belowRelease(0, m + 1, 0)];
200
+ return [bound('>=', 0, 0, p, pre), belowRelease(0, 0, p + 1)];
201
+ case '~':
202
+ // `~1.2.3` is `>=1.2.3 <1.3.0`, so the lower bound keeps the patch —
203
+ // that is what makes `~0.1.7-rc.1` refuse `0.1.6`.
204
+ if (minor === null)
205
+ return [...atLeast(M, 0, 0, open), belowRelease(M + 1, 0, 0)];
206
+ if (patch === null)
207
+ return [...atLeast(M, m, 0, open), belowRelease(M, m + 1, 0)];
208
+ return [bound('>=', M, m, p, pre), belowRelease(M, m + 1, 0)];
209
+ case '>':
210
+ if (minor === null)
211
+ return [bound('>=', M + 1, 0, 0)];
212
+ if (patch === null)
213
+ return [bound('>=', M, m + 1, 0)];
214
+ return [bound('>', M, m, p, pre)];
215
+ case '>=':
216
+ if (minor === null)
217
+ return atLeast(M, 0, 0, open);
218
+ if (patch === null)
219
+ return atLeast(M, m, 0, open);
220
+ return [bound('>=', M, m, p, pre)];
221
+ case '<':
222
+ if (minor === null)
223
+ return [belowRelease(M, 0, 0)];
224
+ if (patch === null)
225
+ return [belowRelease(M, m, 0)];
226
+ return [bound('<', M, m, p, pre)];
227
+ case '<=':
228
+ if (minor === null)
229
+ return [belowRelease(M + 1, 0, 0)];
230
+ if (patch === null)
231
+ return [belowRelease(M, m + 1, 0)];
232
+ return [bound('<=', M, m, p, pre)];
233
+ default:
234
+ if (minor === null)
235
+ return [...atLeast(M, 0, 0, open), belowRelease(M + 1, 0, 0)];
236
+ if (patch === null)
237
+ return [...atLeast(M, m, 0, open), belowRelease(M, m + 1, 0)];
238
+ return [bound('=', M, m, p, pre)];
239
+ }
240
+ }
241
+ /**
242
+ * Turn one alternative such as `>=0.2.0-rc.2 <0.3.0-0` into comparators.
243
+ *
244
+ * Two pieces of syntax are handled before the comparator loop: a hyphen range
245
+ * (`1.2.3 - 2.0.0`) and an operator separated from its version by a space
246
+ * (`>= 0.2.0`). Both are written by hand in real manifests, and refusing to
247
+ * read them would silently turn a real bound into "anything goes".
248
+ *
249
+ * @param text - one alternative, already split on `||`.
250
+ * @returns comparators, or `null` when a piece is not understood.
251
+ */
252
+ function parseAlternative(text) {
253
+ const trimmed = text.trim();
254
+ if (trimmed === '')
255
+ return [];
256
+ const hyphen = /^(\S+)\s+-\s+(\S+)$/.exec(trimmed);
257
+ if (hyphen !== null) {
258
+ const low = parsePartial(hyphen[1]);
259
+ const high = parsePartial(hyphen[2]);
260
+ if (low === null || high === null)
261
+ return null;
262
+ /*
263
+ * A hyphen range is inclusive on both ends, and with prereleases in play
264
+ * semver widens it: `1.2.3 - 2.0.0` becomes `>=1.2.3-0 <2.0.1-0`. The lower
265
+ * `-0` admits `1.2.3-beta.1`; the upper bound bumps the last written
266
+ * segment so `2.0.1-rc.1` stays out.
267
+ */
268
+ const from = low.pre.length === 0 ? atLeast(low.major ?? 0, low.minor ?? 0, low.patch ?? 0, ['0']) : expand(low, '>=');
269
+ const upperMajor = high.major === null ? 0 : high.major;
270
+ const upperMinor = high.minor === null ? 0 : high.minor;
271
+ const upperPatch = high.patch === null ? 0 : high.patch;
272
+ const to = high.minor === null
273
+ ? [belowRelease(upperMajor + 1, 0, 0)]
274
+ : high.patch === null
275
+ ? [belowRelease(upperMajor, upperMinor + 1, 0)]
276
+ : [belowRelease(upperMajor, upperMinor, upperPatch + 1)];
277
+ if (from === null)
278
+ return null;
279
+ return [...from, ...to];
280
+ }
281
+ const comparators = [];
282
+ const normalized = trimmed.replace(/(~|\^|>=|<=|>|<|=)\s+(\S)/g, '$1$2');
283
+ for (const token of normalized.split(/\s+/)) {
284
+ const match = /^(~|\^|>=|<=|>|<|=)?(.+)$/.exec(token);
285
+ if (match === null)
286
+ return null;
287
+ const partial = parsePartial(match[2]);
288
+ if (partial === null)
289
+ return null;
290
+ const expanded = expand(partial, match[1] ?? '=');
291
+ if (expanded === null)
292
+ return null;
293
+ comparators.push(...expanded);
294
+ }
295
+ return comparators;
296
+ }
297
+ /**
298
+ * Compare two parsed versions.
299
+ *
300
+ * @param left - left version.
301
+ * @param right - right version.
302
+ * @returns negative, zero, or positive.
303
+ */
304
+ function compareParts(left, right) {
305
+ return (left.major - right.major ||
306
+ left.minor - right.minor ||
307
+ left.patch - right.patch ||
308
+ comparePre(left.pre, right.pre));
309
+ }
310
+ /**
311
+ * Does a version fall inside a manifest range?
312
+ *
313
+ * The host gate calls `semver.satisfies(version, range, { includePrerelease:
314
+ * true })` before it installs anything, so prereleases take part in comparisons
315
+ * here for the same reason: a plugin declaring `>=0.2.0-rc.2 <0.3.0-0` accepts
316
+ * the `0.2.1-rc.5` build people actually run, and marking that version
317
+ * unusable would be a lie.
318
+ *
319
+ * Ranges this module cannot parse answer `true`. A manifest written in a way
320
+ * this parser does not understand must never be the reason a version is called
321
+ * incompatible — the host stays the judge, and the page only loses a hint.
322
+ *
323
+ * @param version - the version to test, such as `0.2.1-rc.5`.
324
+ * @param range - a range as a manifest writes it; `''` means "no limit".
325
+ * @returns whether the version is inside the range.
326
+ */
327
+ export function satisfiesRange(version, range) {
328
+ const text = String(range ?? '').trim();
329
+ if (text === '')
330
+ return true;
331
+ const parts = parseVersion(version);
332
+ if (parts === null)
333
+ return true;
334
+ for (const alternative of text.split('||')) {
335
+ const comparators = parseAlternative(alternative);
336
+ if (comparators === null)
337
+ return true;
338
+ const passes = comparators.every((comparator) => {
339
+ const delta = compareParts(parts, comparator.parts);
340
+ switch (comparator.op) {
341
+ case '<':
342
+ return delta < 0;
343
+ case '<=':
344
+ return delta <= 0;
345
+ case '>':
346
+ return delta > 0;
347
+ case '>=':
348
+ return delta >= 0;
349
+ default:
350
+ return delta === 0;
351
+ }
352
+ });
353
+ if (passes)
354
+ return true;
355
+ }
356
+ return false;
357
+ }
83
358
  /**
84
359
  * The tag a published version was released under.
85
360
  *
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/host/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAgC;IAC3D,MAAM,KAAK,GAAG,oEAAoE,CA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C,KAAK,CAAC,CAAA;YACnD,QAAQ,UAAU,CAAC,EAAE,EAAE,CAAC;gBACtB,KAAK,GAAG;oBACN,OAAO,KAAK,GAAG,CAAC,CAAA;gBAClB,KAAK,IAAI;oBACP,OAAO,KAAK,IAAI,CAAC,CAAA;gBACnB,KAAK,GAAG;oBACN,OAAO,KAAK,GAAG,CAAC,CAAA;gBAClB,KAAK,IAAI;oBACP,OAAO,KAAK,IAAI,CAAC,CAAA;gBACnB;oBACE,OAAO,KAAK,KAAK,CAAC,CAAA;YACtB,CAAC;QACH,CAAC,CAAC,CAAA;QACF,IAAI,MAAM;YAAE,OAAO,IAAI,CAAA;IACzB,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAA;AAC1D,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,aAAa,CAAC,IAAqC,EAAE,OAAe;IAClF,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1B,OAAO,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC,CAAC,WAAW,CAAA;AACvE,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { type UpgraderConfig } from './host/config.ts';
2
+ import { type StepOutcome } from './host/install.ts';
3
+ import { type Phase } from './host/progress.ts';
2
4
  import { type HostContext } from './host/manager.ts';
3
5
  /**
4
6
  * The plugin's config schema, read by the loader before `apply` runs.
@@ -12,6 +14,82 @@ export { Config } from './host/config.ts';
12
14
  export declare const name = "plugin-upgrader";
13
15
  /** The web server is the only hard dependency; pluginManager is read lazily. */
14
16
  export declare const inject: string[];
17
+ /** Lifecycle of one batch. */
18
+ type JobStatus = 'queued' | 'running' | 'finished' | 'cancelled';
19
+ /** One batch of steps, as the browser polls it. */
20
+ interface JobRecord {
21
+ id: string;
22
+ status: JobStatus;
23
+ total: number;
24
+ done: number;
25
+ failed: number;
26
+ results: StepOutcome[];
27
+ log: string[];
28
+ /** Characters kept in `log`, so a chatty pnpm run cannot grow without limit. */
29
+ logChars: number;
30
+ cancelled: boolean;
31
+ startedAt: number;
32
+ finishedAt?: number;
33
+ heartbeatAt?: number;
34
+ /** The step being worked on, when one is in flight. */
35
+ current?: string;
36
+ /** When that step started, so the panel can show a live elapsed time. */
37
+ stepStartedAt?: number;
38
+ /** What that step is doing right now. */
39
+ phase?: Phase;
40
+ /**
41
+ * The last thing pnpm printed, trimmed.
42
+ *
43
+ * A phase alone cannot distinguish "downloading" from "stuck on the eleventh
44
+ * registry timeout", and those look identical to somebody watching a clock
45
+ * climb. This is the newest non-blank line, so the panel can show the actual
46
+ * work instead of only its category.
47
+ */
48
+ activity?: string;
49
+ /** 1-based number of the registry being tried, and how many there are. */
50
+ attempt?: {
51
+ index: number;
52
+ total: number;
53
+ registry: string | null;
54
+ };
55
+ cacheDirty?: boolean;
56
+ abandoned?: boolean;
57
+ /**
58
+ * The request ids this job has run under, newest last.
59
+ */
60
+ requestIds: string[];
61
+ }
62
+ /**
63
+ * The state that has to outlive a module replacement.
64
+ *
65
+ * `jobs` is keyed by job id and read by the poll route; `live` is the batch the
66
+ * manager events belong to. Both are reached through `globalThis` so a
67
+ * replacement module instance adopts a batch that is still running rather than
68
+ * answering `unknown-job` for it.
69
+ */
70
+ interface JobStore {
71
+ jobs: Map<string, JobRecord>;
72
+ /** The job manager events belong to, while one is running. */
73
+ live: JobRecord | null;
74
+ /** The installation the manager is currently running, for cancellation. */
75
+ inFlight: {
76
+ requestId: string;
77
+ } | null;
78
+ }
79
+ /**
80
+ * The shared batch store, created once per process.
81
+ *
82
+ * Read through `globalThis` rather than a module-level constant: a replaced
83
+ * module gets a fresh scope, so a module-level map would be empty again and the
84
+ * very batch that caused the replacement would vanish.
85
+ *
86
+ * Exported so a test can prove a re-evaluated module adopts the same map
87
+ * instead of starting empty — which is the whole point of keeping it off the
88
+ * module scope.
89
+ *
90
+ * @returns the process-wide store.
91
+ */
92
+ export declare function sharedJobStore(): JobStore;
15
93
  /**
16
94
  * Mount the host half.
17
95
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAQrE,OAAO,EAEL,KAAK,WAAW,EAMjB,MAAM,mBAAmB,CAAA;AAE1B;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,kEAAkE;AAClE,eAAO,MAAM,IAAI,oBAAoB,CAAA;AAErC,gFAAgF;AAChF,eAAO,MAAM,MAAM,UAAgB,CAAA;AAgGnC;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CA2drE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAIrE,OAAO,EAA4C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE9F,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAG1D,OAAO,EAEL,KAAK,WAAW,EAMjB,MAAM,mBAAmB,CAAA;AAE1B;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,kEAAkE;AAClE,eAAO,MAAM,IAAI,oBAAoB,CAAA;AAErC,gFAAgF;AAChF,eAAO,MAAM,MAAM,UAAgB,CAAA;AA8CnC,8BAA8B;AAC9B,KAAK,SAA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;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,IAAI,QAAQ,CAQzC;AAWD;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAyfrE"}
package/lib/index.js CHANGED
@@ -5,7 +5,8 @@ import { buildOverview } from './host/overview.js';
5
5
  import { runStep, validateStep } from './host/install.js';
6
6
  import { profileDirFrom, recoverPendingDrop } from './host/manifest.js';
7
7
  import { nextPhase } from './host/progress.js';
8
- import { probeRegistry } from './host/registry.js';
8
+ import { dshRequirementOf, fetchPackument, probeRegistry } from './host/registry.js';
9
+ import { runtimeVersionOf } from './host/runtime.js';
9
10
  import { asPluginManager, } from './host/manager.js';
10
11
  /**
11
12
  * The plugin's config schema, read by the loader before `apply` runs.
@@ -54,6 +55,50 @@ const ADOPTED_LOG_LIMIT = 60;
54
55
  * tail of a pnpm warning says what failed, the head only repeats the registry.
55
56
  */
56
57
  const ACTIVITY_CHARS = 120;
58
+ /**
59
+ * Where the batch bookkeeping lives.
60
+ *
61
+ * These maps used to be locals of `apply`, which made every batch disappear the
62
+ * moment the host replaced this plugin's code. The host does exactly that while
63
+ * a batch is running: a batch is what upgrades other plugins, and HMR evicts
64
+ * any loaded file whose bytes changed — including this one, when the user
65
+ * upgrades the upgrader, or when a linked checkout is rebuilt. The tab then
66
+ * polls a job id the new instance has never heard of, gets `unknown-job`, and
67
+ * reports "lost contact" over an install that finished perfectly well.
68
+ *
69
+ * A module-level `const` would not fix that: HMR re-evaluates the module, so a
70
+ * fresh module scope is created and the map would start empty again. Only an
71
+ * object reached through `globalThis` outlives the re-evaluation. That is the
72
+ * point of the symbol — the same key is found by the replacement module, so the
73
+ * new instance adopts the batch that is still running in the old one instead of
74
+ * pretending it never existed.
75
+ *
76
+ * The map is still expected to empty out on a real restart, which is correct:
77
+ * a restarted host has no running batch to report.
78
+ */
79
+ const JOB_STORE_KEY = Symbol.for('dsh-plugin-upgrader/jobs');
80
+ /**
81
+ * The shared batch store, created once per process.
82
+ *
83
+ * Read through `globalThis` rather than a module-level constant: a replaced
84
+ * module gets a fresh scope, so a module-level map would be empty again and the
85
+ * very batch that caused the replacement would vanish.
86
+ *
87
+ * Exported so a test can prove a re-evaluated module adopts the same map
88
+ * instead of starting empty — which is the whole point of keeping it off the
89
+ * module scope.
90
+ *
91
+ * @returns the process-wide store.
92
+ */
93
+ export function sharedJobStore() {
94
+ const scope = globalThis;
95
+ let store = scope[JOB_STORE_KEY];
96
+ if (store === undefined) {
97
+ store = { jobs: new Map(), live: null, inFlight: null };
98
+ scope[JOB_STORE_KEY] = store;
99
+ }
100
+ return store;
101
+ }
57
102
  /**
58
103
  * Mount the host half.
59
104
  *
@@ -64,10 +109,8 @@ const ACTIVITY_CHARS = 120;
64
109
  export function apply(ctx, config) {
65
110
  const packumentCache = new Map();
66
111
  const tagCache = new Map();
67
- const jobs = new Map();
68
- let inFlight = null;
69
- /** The job a manager event belongs to, while one is running. */
70
- let liveJob = null;
112
+ const store = sharedJobStore();
113
+ const jobs = store.jobs;
71
114
  /**
72
115
  * The registry the user picked, read fresh on every use.
73
116
  *
@@ -108,6 +151,33 @@ export function apply(ctx, config) {
108
151
  };
109
152
  /** The manager, or a reason the request cannot be served. */
110
153
  const requireManager = () => asPluginManager(ctx.get('pluginManager', false));
154
+ /**
155
+ * The compatibility check handed to every step.
156
+ *
157
+ * It answers from the same packument the page already reads, so asking costs
158
+ * at most one registry request — and only for a package the page has never
159
+ * listed. When the requirement or the runtime version cannot be read, the
160
+ * answer is "unknown" and the manager's own gate stays the final word; that
161
+ * is deliberate, since guessing here would refuse versions that work.
162
+ *
163
+ * @returns the guard, or `undefined` when no runtime version could be read.
164
+ */
165
+ const buildGuard = () => {
166
+ const runtimeVersion = runtimeVersionOf(process.argv);
167
+ if (runtimeVersion === undefined)
168
+ return undefined;
169
+ return {
170
+ runtimeVersion,
171
+ requirementOf: async (name, version) => {
172
+ const { data } = await fetchPackument(chosenRegistry(), name, packumentCache, false);
173
+ if (data === undefined || data === null || typeof data !== 'object')
174
+ return undefined;
175
+ const manifest = data.versions?.[version];
176
+ const requirement = dshRequirementOf(manifest);
177
+ return requirement === undefined ? undefined : { range: requirement.range };
178
+ },
179
+ };
180
+ };
111
181
  /**
112
182
  * Run a batch job to completion in the background.
113
183
  *
@@ -129,7 +199,7 @@ export function apply(ctx, config) {
129
199
  }
130
200
  job.status = 'running';
131
201
  job.heartbeatAt = Date.now();
132
- liveJob = job;
202
+ store.live = job;
133
203
  const beat = setInterval(() => {
134
204
  job.heartbeatAt = Date.now();
135
205
  }, HEARTBEAT_MS);
@@ -145,9 +215,9 @@ export function apply(ctx, config) {
145
215
  appendLog(job, `→ ${job.current}`);
146
216
  const outcome = await runStep(manager, step, (message) => appendLog(job, message), (requestId) => {
147
217
  job.requestIds.push(requestId);
148
- inFlight = { requestId };
149
- }, chosenRegistry());
150
- inFlight = null;
218
+ store.inFlight = { requestId };
219
+ }, chosenRegistry(), buildGuard());
220
+ store.inFlight = null;
151
221
  job.heartbeatAt = Date.now();
152
222
  job.results.push(outcome);
153
223
  job.done = job.results.length;
@@ -160,8 +230,15 @@ export function apply(ctx, config) {
160
230
  }
161
231
  finally {
162
232
  clearInterval(beat);
163
- liveJob = null;
164
- inFlight = null;
233
+ /*
234
+ * Only clear what this run owns. A replacement instance shares the store,
235
+ * so a blind `store.live = null` from a run that is finishing would blind
236
+ * whichever batch the new instance had just adopted.
237
+ */
238
+ if (store.live === job)
239
+ store.live = null;
240
+ if (store.inFlight?.requestId === job.requestIds.at(-1))
241
+ store.inFlight = null;
165
242
  }
166
243
  job.status = job.cancelled ? 'cancelled' : 'finished';
167
244
  job.current = undefined;
@@ -340,7 +417,7 @@ export function apply(ctx, config) {
340
417
  running.cancelled = true;
341
418
  appendLog(running, '! cancel requested');
342
419
  const manager = requireManager();
343
- const target = inFlight?.requestId ?? running.requestIds.at(-1);
420
+ const target = store.inFlight?.requestId ?? running.requestIds.at(-1);
344
421
  if (manager !== undefined && target !== undefined && target !== '') {
345
422
  try {
346
423
  const outcome = await manager.cancelInstall(target);
@@ -424,7 +501,7 @@ export function apply(ctx, config) {
424
501
  }
425
502
  };
426
503
  subscribe('plugin-manager/install-log', (chunk) => {
427
- const job = liveJob;
504
+ const job = store.live;
428
505
  if (job === null)
429
506
  return;
430
507
  const tagged = chunk.requestId !== undefined && chunk.requestId !== '';
@@ -454,7 +531,7 @@ export function apply(ctx, config) {
454
531
  }
455
532
  }, 'plugin-upgrader: install output');
456
533
  subscribe('plugin-manager/install-state', (state) => {
457
- const job = liveJob;
534
+ const job = store.live;
458
535
  if (job === null)
459
536
  return;
460
537
  if (!job.requestIds.includes(state.requestId))