dsh-crate 0.5.3 → 0.5.5
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/client/client.js +2060 -459
- package/lib/body-progress.js +4 -3
- package/lib/changelog.js +15 -2
- package/lib/discovery-cache.js +210 -0
- package/lib/discovery-compatibility.js +91 -93
- package/lib/dsh-cli.js +36 -6
- package/lib/github-install-target.js +53 -0
- package/lib/hot.js +361 -27
- package/lib/index.js +6 -5
- package/lib/install.js +37 -0
- package/lib/patch.js +116 -72
- package/lib/pending-rows.js +3 -4
- package/lib/pnpm-compat.js +79 -1
- package/lib/proc-text.js +16 -1
- package/lib/recovery.js +2 -1
- package/lib/registry.js +27 -6
- package/lib/release-candidates.js +4 -0
- package/lib/routes.js +390 -131
- package/lib/themes.js +24 -8
- package/lib/types/body-progress.d.ts +2 -1
- package/lib/types/changelog.d.ts +10 -1
- package/lib/types/discovery-cache.d.ts +38 -0
- package/lib/types/discovery-compatibility.d.ts +16 -12
- package/lib/types/dsh-cli.d.ts +19 -2
- package/lib/types/github-install-target.d.ts +11 -0
- package/lib/types/hot.d.ts +87 -5
- package/lib/types/install.d.ts +19 -0
- package/lib/types/patch.d.ts +6 -2
- package/lib/types/registry.d.ts +9 -8
- package/lib/types/release-candidates.d.ts +2 -0
- package/lib/types/routes.d.ts +2 -2
- package/lib/types/themes.d.ts +7 -1
- package/lib/types/update-notification-settings.d.ts +5 -0
- package/lib/types/update-notifications.d.ts +51 -0
- package/lib/types/updates.d.ts +5 -1
- package/lib/update-notification-settings.js +6 -0
- package/lib/update-notifications.js +166 -0
- package/lib/updates.js +41 -11
- package/lib/verify.js +5 -2
- package/package.json +1 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { DEFAULT_UPDATE_CHECK_INTERVAL_HOURS, isUpdateCheckIntervalHours } from './update-notification-settings.js';
|
|
2
|
+
export const UPDATE_CHECK_START_DELAY_MS = 30_000;
|
|
3
|
+
export const UPDATE_CHECK_INTERVAL_MS = DEFAULT_UPDATE_CHECK_INTERVAL_HOURS * 60 * 60_000;
|
|
4
|
+
const RETRY_BASE_MS = 60_000;
|
|
5
|
+
const RETRY_MAX_MS = 30 * 60_000;
|
|
6
|
+
/** Start one profile-scoped timer; callers own persistence of the preferences. */
|
|
7
|
+
export function createUpdateNotificationMonitor(deps) {
|
|
8
|
+
let enabled = deps.enabled;
|
|
9
|
+
let intervalHours = isUpdateCheckIntervalHours(deps.intervalHours) ? deps.intervalHours : DEFAULT_UPDATE_CHECK_INTERVAL_HOURS;
|
|
10
|
+
let disposed = false;
|
|
11
|
+
let timer;
|
|
12
|
+
let nextCheckAt = null;
|
|
13
|
+
let checkedAt = null;
|
|
14
|
+
let lastSuccessAt = null;
|
|
15
|
+
let error = null;
|
|
16
|
+
let stale = false;
|
|
17
|
+
let failures = 0;
|
|
18
|
+
let updates = {};
|
|
19
|
+
let identity = deps.inventory();
|
|
20
|
+
let pending = null;
|
|
21
|
+
let pendingForced = false;
|
|
22
|
+
let queuedForce = null;
|
|
23
|
+
const reconcile = () => {
|
|
24
|
+
const current = deps.inventory();
|
|
25
|
+
if (current.context !== identity.context) {
|
|
26
|
+
updates = {};
|
|
27
|
+
checkedAt = null;
|
|
28
|
+
lastSuccessAt = null;
|
|
29
|
+
error = null;
|
|
30
|
+
stale = true;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const kept = {};
|
|
34
|
+
for (const [name, status] of Object.entries(updates)) {
|
|
35
|
+
if (current.packages[name] !== undefined && current.packages[name] === identity.packages[name])
|
|
36
|
+
kept[name] = status;
|
|
37
|
+
else
|
|
38
|
+
stale = true;
|
|
39
|
+
}
|
|
40
|
+
if (Object.keys(current.packages).some(name => current.packages[name] !== identity.packages[name]))
|
|
41
|
+
stale = true;
|
|
42
|
+
updates = kept;
|
|
43
|
+
}
|
|
44
|
+
identity = current;
|
|
45
|
+
return current;
|
|
46
|
+
};
|
|
47
|
+
const stopTimer = () => {
|
|
48
|
+
if (timer !== undefined)
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
timer = undefined;
|
|
51
|
+
nextCheckAt = null;
|
|
52
|
+
};
|
|
53
|
+
const schedule = (delay) => {
|
|
54
|
+
stopTimer();
|
|
55
|
+
if (disposed || !enabled)
|
|
56
|
+
return;
|
|
57
|
+
nextCheckAt = Date.now() + delay;
|
|
58
|
+
timer = setTimeout(() => { void check(stale); }, delay);
|
|
59
|
+
timer.unref?.();
|
|
60
|
+
};
|
|
61
|
+
const nextDelay = () => failures > 0
|
|
62
|
+
? Math.min(RETRY_MAX_MS, RETRY_BASE_MS * 2 ** Math.min(failures - 1, 5))
|
|
63
|
+
: intervalHours * 60 * 60_000;
|
|
64
|
+
const check = (force = false) => {
|
|
65
|
+
if (disposed)
|
|
66
|
+
return Promise.resolve({ ...updates });
|
|
67
|
+
if (pending !== null) {
|
|
68
|
+
if (!force || pendingForced)
|
|
69
|
+
return pending;
|
|
70
|
+
// A manual refresh arriving during a cache-eligible read must still
|
|
71
|
+
// bypass that cache, once. Several such callers share the follow-up.
|
|
72
|
+
queuedForce ??= pending.then(() => check(true)).finally(() => { queuedForce = null; });
|
|
73
|
+
return queuedForce;
|
|
74
|
+
}
|
|
75
|
+
stopTimer();
|
|
76
|
+
const started = reconcile();
|
|
77
|
+
pendingForced = force || stale;
|
|
78
|
+
// Scheduling into a microtask also makes simultaneous callers share the
|
|
79
|
+
// promise before input gathering starts.
|
|
80
|
+
pending = Promise.resolve().then(async () => {
|
|
81
|
+
try {
|
|
82
|
+
const result = await deps.check(pendingForced);
|
|
83
|
+
if (disposed)
|
|
84
|
+
return { ...updates };
|
|
85
|
+
const current = reconcile();
|
|
86
|
+
const next = { ...updates };
|
|
87
|
+
let incomplete = result.error !== undefined;
|
|
88
|
+
for (const [name, status] of Object.entries(result.updates)) {
|
|
89
|
+
if (current.context !== started.context || current.packages[name] === undefined
|
|
90
|
+
|| current.packages[name] !== started.packages[name]) {
|
|
91
|
+
incomplete = true;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (status.checkFailed === true || status.checkError !== undefined) {
|
|
95
|
+
incomplete = true;
|
|
96
|
+
next[name] = { ...(updates[name] ?? status), checkFailed: true, checkError: 'unavailable',
|
|
97
|
+
...(status.sourceMigration === undefined ? {} : { sourceMigration: status.sourceMigration }) };
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
next[name] = status;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (Object.keys(current.packages).some(name => result.updates[name] === undefined
|
|
104
|
+
|| current.context !== started.context || current.packages[name] !== started.packages[name]))
|
|
105
|
+
incomplete = true;
|
|
106
|
+
updates = next;
|
|
107
|
+
checkedAt = Date.now();
|
|
108
|
+
stale = incomplete;
|
|
109
|
+
error = incomplete ? result.error ?? 'Some plugin updates could not be checked. Try again later.' : null;
|
|
110
|
+
if (!incomplete)
|
|
111
|
+
lastSuccessAt = checkedAt;
|
|
112
|
+
failures = incomplete ? failures + 1 : 0;
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
if (disposed)
|
|
116
|
+
return { ...updates };
|
|
117
|
+
reconcile();
|
|
118
|
+
updates = Object.fromEntries(Object.entries(updates).map(([name, status]) => [name, { ...status, checkFailed: true, checkError: 'unavailable' }]));
|
|
119
|
+
checkedAt = Date.now();
|
|
120
|
+
stale = true;
|
|
121
|
+
error = 'Plugin updates could not be checked. Try again later.';
|
|
122
|
+
failures += 1;
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
pending = null;
|
|
126
|
+
if (!disposed)
|
|
127
|
+
schedule(nextDelay());
|
|
128
|
+
}
|
|
129
|
+
return { ...updates };
|
|
130
|
+
});
|
|
131
|
+
return pending;
|
|
132
|
+
};
|
|
133
|
+
schedule(UPDATE_CHECK_START_DELAY_MS);
|
|
134
|
+
return {
|
|
135
|
+
snapshot: () => {
|
|
136
|
+
reconcile();
|
|
137
|
+
return {
|
|
138
|
+
enabled, intervalHours, checking: pending !== null, checkedAt, lastSuccessAt, nextCheckAt,
|
|
139
|
+
stale, error, updates: { ...updates }, boot: deps.boot, ...deps.preferences(),
|
|
140
|
+
...(deps.profileKey === undefined ? {} : { profileKey: deps.profileKey }),
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
check,
|
|
144
|
+
setEnabled: value => {
|
|
145
|
+
if (enabled === value || disposed)
|
|
146
|
+
return;
|
|
147
|
+
enabled = value;
|
|
148
|
+
stopTimer();
|
|
149
|
+
if (enabled && pending === null)
|
|
150
|
+
schedule(UPDATE_CHECK_START_DELAY_MS);
|
|
151
|
+
},
|
|
152
|
+
setIntervalHours: value => {
|
|
153
|
+
if (!isUpdateCheckIntervalHours(value) || intervalHours === value || disposed)
|
|
154
|
+
return;
|
|
155
|
+
intervalHours = value;
|
|
156
|
+
// Keep a pending check single-flight; its completion uses the newest
|
|
157
|
+
// choice. Changing a disabled monitor never opts the user in.
|
|
158
|
+
if (pending === null)
|
|
159
|
+
schedule(checkedAt === null ? UPDATE_CHECK_START_DELAY_MS : nextDelay());
|
|
160
|
+
},
|
|
161
|
+
dispose: () => {
|
|
162
|
+
disposed = true;
|
|
163
|
+
stopTimer();
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
package/lib/updates.js
CHANGED
|
@@ -57,6 +57,7 @@ export function isUpdatablePlugin(activeProfileDir, name, bundles) {
|
|
|
57
57
|
const UPDATES_TTL_MS = 30 * 60 * 1000;
|
|
58
58
|
const GIT_REMOTE_HEAD_TIMEOUT_MS = 6000;
|
|
59
59
|
let updatesCache = null;
|
|
60
|
+
let updateCheckGeneration = 0;
|
|
60
61
|
/**
|
|
61
62
|
* HEAD for an arbitrary smart-HTTP git remote (Gitea, GitLab, …). Same
|
|
62
63
|
* advertisement format as GitHub's info/refs; kept here so accelerate.ts
|
|
@@ -179,6 +180,7 @@ export function invalidateUpdates() {
|
|
|
179
180
|
// because a request merely entered the queue.
|
|
180
181
|
if (inProbe())
|
|
181
182
|
return;
|
|
183
|
+
updateCheckGeneration += 1;
|
|
182
184
|
updatesCache = null;
|
|
183
185
|
}
|
|
184
186
|
/**
|
|
@@ -205,6 +207,7 @@ export function setUpdateRegistry(base) {
|
|
|
205
207
|
if (next === registryBase)
|
|
206
208
|
return;
|
|
207
209
|
registryBase = next;
|
|
210
|
+
updateCheckGeneration += 1;
|
|
208
211
|
updatesCache = null;
|
|
209
212
|
}
|
|
210
213
|
/** A registry URL for `path`, on whichever registry is currently in force. */
|
|
@@ -409,7 +412,7 @@ export async function readVersionMaturity(name, version, profile, activeProfileD
|
|
|
409
412
|
reason: maturity.mature ? 'eligible' : maturity.publishedAt === null ? 'unknown-age' : 'held',
|
|
410
413
|
};
|
|
411
414
|
}
|
|
412
|
-
async function fetchJson(url) {
|
|
415
|
+
async function fetchJson(url, allowNotFound = false) {
|
|
413
416
|
// Through the proxy when one is configured: Node's global fetch ignores
|
|
414
417
|
// HTTP_PROXY, so on a machine whose route out is a local proxy every
|
|
415
418
|
// update check silently took the slow path — or none at all.
|
|
@@ -417,6 +420,8 @@ async function fetchJson(url) {
|
|
|
417
420
|
headers: { accept: 'application/json', 'user-agent': 'dsh-crate' },
|
|
418
421
|
signal: AbortSignal.timeout(10_000),
|
|
419
422
|
});
|
|
423
|
+
if (allowNotFound && res.status === 404)
|
|
424
|
+
return undefined;
|
|
420
425
|
if (!res.ok)
|
|
421
426
|
throw new Error(`HTTP ${res.status}`);
|
|
422
427
|
return res.json();
|
|
@@ -736,7 +741,7 @@ function profilePolicyFingerprint(dir) {
|
|
|
736
741
|
}
|
|
737
742
|
return hash.digest('hex');
|
|
738
743
|
}
|
|
739
|
-
/**
|
|
744
|
+
/** Check each plugin independently so a failed lookup leaves the other results usable. */
|
|
740
745
|
export async function checkUpdates(profile, force = false, explicitDir,
|
|
741
746
|
/**
|
|
742
747
|
* Packages that follow a release channel instead of plain `latest`. Only
|
|
@@ -768,16 +773,19 @@ catalogNpmByRepo = new Map(),
|
|
|
768
773
|
*/
|
|
769
774
|
options = {}) {
|
|
770
775
|
const activeProfileDir = profileDir(profile, explicitDir);
|
|
776
|
+
const installed = readInstalled(profile, activeProfileDir);
|
|
777
|
+
const lockCommits = readLockCommits(profile, activeProfileDir);
|
|
778
|
+
const installedIdentity = JSON.stringify(Object.entries(installed).sort(([a], [b]) => a.localeCompare(b))
|
|
779
|
+
.map(([name, spec]) => [name, spec, readInstalledVersion(profile, name, activeProfileDir), readGitResolutionCommit(profile, spec, activeProfileDir)]));
|
|
771
780
|
// The channel is part of the key: switching to betas has to change the
|
|
772
781
|
// answer immediately, and a cache keyed on the profile alone would serve
|
|
773
782
|
// the stable verdict for the rest of the TTL — reading as "the setting did
|
|
774
783
|
// nothing".
|
|
775
|
-
const cacheKey = `${activeProfileDir}\u0000${options.holdYoungReleases === true ? 'hold' : 'any'}\u0000${[...channelFor].map(([n, c]) => `${n}:${c}`).sort().join(',')}\u0000${[...onlineSourceFor].map(([n, s]) => `${n}:${s}`).sort().join(',')}\u0000${[...catalogNpmByRepo].map(([n, s]) => `${n}:${s}`).sort().join(',')}\u0000${options.holdYoungReleases === true ? profilePolicyFingerprint(activeProfileDir) : ''}` + JSON.stringify([...(options.releaseSources ?? [])]);
|
|
784
|
+
const cacheKey = `${activeProfileDir}\u0000${options.holdYoungReleases === true ? 'hold' : 'any'}\u0000${[...channelFor].map(([n, c]) => `${n}:${c}`).sort().join(',')}\u0000${[...onlineSourceFor].map(([n, s]) => `${n}:${s}`).sort().join(',')}\u0000${[...catalogNpmByRepo].map(([n, s]) => `${n}:${s}`).sort().join(',')}\u0000${options.holdYoungReleases === true ? profilePolicyFingerprint(activeProfileDir) : ''}` + JSON.stringify([...(options.releaseSources ?? [])]) + installedIdentity + JSON.stringify([...lockCommits].sort());
|
|
776
785
|
if (!force && updatesCache?.key === cacheKey && Date.now() < updatesCache.recheckAt) {
|
|
777
786
|
return updatesCache.data;
|
|
778
787
|
}
|
|
779
|
-
const
|
|
780
|
-
const lockCommits = readLockCommits(profile, activeProfileDir);
|
|
788
|
+
const generation = ++updateCheckGeneration;
|
|
781
789
|
const result = {};
|
|
782
790
|
let nextCandidateMaturityAt = Infinity;
|
|
783
791
|
await Promise.all(Object.entries(installed).map(async ([name, spec]) => {
|
|
@@ -795,6 +803,7 @@ options = {}) {
|
|
|
795
803
|
result[name] = {
|
|
796
804
|
kind: 'linked', version, current: version, latest,
|
|
797
805
|
updateAvailable: upgrade && !held,
|
|
806
|
+
...(latest === null ? { checkFailed: true, checkError: 'unavailable' } : {}),
|
|
798
807
|
...(held ? { heldUpdate: { latest: latest, until: hold.until, ...(hold.estimated ? { estimated: true } : {}) } } : {}),
|
|
799
808
|
...(upgrade ? { restoreRequired: true } : {}),
|
|
800
809
|
};
|
|
@@ -823,6 +832,7 @@ options = {}) {
|
|
|
823
832
|
kind: 'generation', version, current: version,
|
|
824
833
|
latest: isUpgrade(version, newest) ? newest : null,
|
|
825
834
|
updateAvailable: false,
|
|
835
|
+
...(onlineSource !== undefined && newest === null ? { checkFailed: true, checkError: 'unavailable' } : {}),
|
|
826
836
|
};
|
|
827
837
|
return;
|
|
828
838
|
}
|
|
@@ -861,6 +871,7 @@ options = {}) {
|
|
|
861
871
|
result[name] = {
|
|
862
872
|
kind: 'github', version, current, latest,
|
|
863
873
|
updateAvailable: byVersion ?? (current !== null && latest !== null && current !== latest),
|
|
874
|
+
...(latest === null && byVersion === null ? { checkFailed: true, checkError: 'unavailable' } : {}),
|
|
864
875
|
...(byVersion === false && current !== null && latest !== null && current !== latest
|
|
865
876
|
? { unreleasedCommit: latest } : {}),
|
|
866
877
|
};
|
|
@@ -888,6 +899,7 @@ options = {}) {
|
|
|
888
899
|
result[name] = {
|
|
889
900
|
kind: 'github', version, current, latest,
|
|
890
901
|
updateAvailable: byVersion ?? (current !== null && latest !== null && current !== latest),
|
|
902
|
+
...(latest === null && byVersion === null ? { checkFailed: true, checkError: 'unavailable' } : {}),
|
|
891
903
|
...(byVersion === false && current !== null && latest !== null && current !== latest
|
|
892
904
|
? { unreleasedCommit: latest } : {}),
|
|
893
905
|
};
|
|
@@ -902,7 +914,7 @@ options = {}) {
|
|
|
902
914
|
const source = options.releaseSources?.get(name);
|
|
903
915
|
if (source !== undefined) {
|
|
904
916
|
const release = await publishedReleaseUpdate(source, name);
|
|
905
|
-
result[name] = { kind: 'npm', version, current: version, latest: release?.version ?? null, updateAvailable: isUpgrade(version, release?.version ?? null) };
|
|
917
|
+
result[name] = { kind: 'npm', version, current: version, latest: release?.version ?? null, updateAvailable: isUpgrade(version, release?.version ?? null), ...(release === null ? { checkFailed: true, checkError: 'unavailable' } : {}) };
|
|
906
918
|
return;
|
|
907
919
|
}
|
|
908
920
|
const repo = lookupRepoFromUrl(spec);
|
|
@@ -912,8 +924,10 @@ options = {}) {
|
|
|
912
924
|
return;
|
|
913
925
|
}
|
|
914
926
|
}
|
|
915
|
-
const meta = (await fetchJson(npmUrl(`${encodeURIComponent(name)}/latest`)));
|
|
916
|
-
const stable = typeof meta
|
|
927
|
+
const meta = (await fetchJson(npmUrl(`${encodeURIComponent(name)}/latest`), true));
|
|
928
|
+
const stable = typeof meta?.version === 'string' && parseSemver(meta.version) !== null ? meta.version : null;
|
|
929
|
+
if (meta !== undefined && stable === null)
|
|
930
|
+
throw new Error('npm latest response has no valid version');
|
|
917
931
|
const channel = channelFor.get(name);
|
|
918
932
|
const latest = channel === undefined ? stable : await versionOnChannel(name, channel, stable);
|
|
919
933
|
// Forwards is an update; a difference in the other direction is a
|
|
@@ -954,6 +968,7 @@ options = {}) {
|
|
|
954
968
|
result[name] = {
|
|
955
969
|
kind: 'npm', version, current: version, latest,
|
|
956
970
|
updateAvailable: mature === null ? upgrade && !held : mature.candidate !== null,
|
|
971
|
+
...(mature?.reason === 'registry-unavailable' ? { checkFailed: true, checkError: 'unavailable' } : {}),
|
|
957
972
|
...(mature?.candidate !== null && mature?.candidate !== undefined ? { eligibleVersion: mature.candidate } : {}),
|
|
958
973
|
...(mature?.heldUpdate !== undefined ? { heldUpdate: mature.heldUpdate }
|
|
959
974
|
: hold !== null && hold !== 'past' ? { heldUpdate: { latest: latest, until: hold.until, ...(hold.estimated ? { estimated: true } : {}) } } : {}),
|
|
@@ -963,7 +978,10 @@ options = {}) {
|
|
|
963
978
|
}
|
|
964
979
|
}
|
|
965
980
|
catch {
|
|
966
|
-
result[name] = {
|
|
981
|
+
result[name] = {
|
|
982
|
+
kind: (spec.startsWith('github:') || isGitHostedSpec(spec)) ? 'github' : 'npm',
|
|
983
|
+
version, current: null, latest: null, updateAvailable: false, checkFailed: true, checkError: 'unavailable',
|
|
984
|
+
};
|
|
967
985
|
}
|
|
968
986
|
}));
|
|
969
987
|
// A plain dependency can have a newer release; it is just not an update the
|
|
@@ -975,7 +993,19 @@ options = {}) {
|
|
|
975
993
|
continue;
|
|
976
994
|
result[name] = { ...status, updateAvailable: false, notAPlugin: true };
|
|
977
995
|
}
|
|
978
|
-
|
|
979
|
-
|
|
996
|
+
// A delayed check must not replace a newer snapshot or refill a cache that
|
|
997
|
+
// was invalidated while the request was in flight.
|
|
998
|
+
if (generation === updateCheckGeneration) {
|
|
999
|
+
const now = Date.now();
|
|
1000
|
+
if (Object.values(result).some(status => status.checkFailed === true || status.checkError !== undefined)) {
|
|
1001
|
+
// Keep the last confirmed data, but let the next ordinary refresh try
|
|
1002
|
+
// again even when this was a forced refresh during the normal TTL.
|
|
1003
|
+
if (updatesCache?.key === cacheKey)
|
|
1004
|
+
updatesCache.recheckAt = now;
|
|
1005
|
+
}
|
|
1006
|
+
else {
|
|
1007
|
+
updatesCache = { key: cacheKey, recheckAt: Math.min(now + UPDATES_TTL_MS, nextHoldRecheck(result), nextCandidateMaturityAt), data: result };
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
980
1010
|
return result;
|
|
981
1011
|
}
|
package/lib/verify.js
CHANGED
|
@@ -30,7 +30,7 @@ import { readFileSync, realpathSync, statSync } from 'node:fs';
|
|
|
30
30
|
import { createRequire, isBuiltin } from 'node:module';
|
|
31
31
|
import { Script } from 'node:vm';
|
|
32
32
|
import { join } from 'node:path';
|
|
33
|
-
import {
|
|
33
|
+
import { hotMountFailure, listLiveHotMounts, patchBlockerReason, scanPatch } from './hot.js';
|
|
34
34
|
import { userPatchPackageReferences } from './patch.js';
|
|
35
35
|
import { nameMatchesPackage } from './entry-identity.js';
|
|
36
36
|
import { bundlePatchInsertedIds, declaredBundlePatchFiles, hasDshManifest, hasLoadableEntry, pluginSubdirs, profileDir, readInstalled } from './profile.js';
|
|
@@ -414,7 +414,7 @@ export function defaultHostRuntimeFacts(activeProfileDir) {
|
|
|
414
414
|
catch { /* no exemption file — nothing may bypass the gate */ }
|
|
415
415
|
return { runtimeVersion: discoverRuntimeVersion(), exemptions };
|
|
416
416
|
}
|
|
417
|
-
export function verifyActivation(profile, name, live = new Set(
|
|
417
|
+
export function verifyActivation(profile, name, live = new Set(listLiveHotMounts()), explicitDir, isDisabled = false, hostFacts, loaderObserved = false,
|
|
418
418
|
/**
|
|
419
419
|
* The host's OWN row for this package exists and has no fiber (#1023).
|
|
420
420
|
* The loader creates an entry before it imports the module, so an entry
|
|
@@ -444,6 +444,9 @@ loaderNeverStarted = false) {
|
|
|
444
444
|
hot: false,
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
+
const mountFailure = hotMountFailure(name, activeProfileDir);
|
|
448
|
+
if (mountFailure !== null)
|
|
449
|
+
return { state: 'failed', reasons: [mountFailure], bundle: inBundles, hot: false };
|
|
447
450
|
const dir = join(activeProfileDir, 'node_modules', name);
|
|
448
451
|
// OBSERVED beats INFERRED (#135): the loader inventory is ground truth, so
|
|
449
452
|
// a package the loader is running is live no matter what its manifest says.
|