@timurproko/a1 0.2.3-dev.656 → 0.2.3-dev.659
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/dist/foundation/release/update-recovery.d.ts +1 -0
- package/dist/foundation/release/update-recovery.js +51 -5
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/linux-x64/manifest.json +1 -1
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/package.json +1 -1
|
@@ -80,3 +80,4 @@ export declare function removeUpdateRecoveryCapsule(dataDir: string, transaction
|
|
|
80
80
|
export declare function inspectUpdateLauncherSet(capsule: UpdateRecoveryCapsule, platform?: NodeJS.Platform): Promise<"target" | "recovery" | "unavailable">;
|
|
81
81
|
/** Remove terminal recovery capsules only after no canonical launcher references them. */
|
|
82
82
|
export declare function cleanupUpdateRecoveryCapsules(dataDir: string): Promise<void>;
|
|
83
|
+
export declare function resolveNpmCli(globalRoot: string, environment: NodeJS.ProcessEnv, platform?: NodeJS.Platform, nodeExecutable?: string): Promise<string>;
|
|
@@ -119,7 +119,7 @@ export async function prepareUpdateRecoveryCapsule(options) {
|
|
|
119
119
|
const prefix = npmPrefixForGlobalRoot(canonicalGlobal, platform);
|
|
120
120
|
const launcherRoot = platform === "win32" ? prefix : resolve(prefix, "bin");
|
|
121
121
|
const npmCliRoot = await realpath(options.npmCliRoot ?? canonicalGlobal);
|
|
122
|
-
const npmCli = await resolveNpmCli(npmCliRoot, options.environment ?? process.env);
|
|
122
|
+
const npmCli = await resolveNpmCli(npmCliRoot, options.environment ?? process.env, platform);
|
|
123
123
|
const capsule = {
|
|
124
124
|
schema: UPDATE_RECOVERY_SCHEMA,
|
|
125
125
|
launchContract: PRIVATE_LAUNCH_CONTRACT,
|
|
@@ -299,15 +299,61 @@ async function spawnRecoveryWorker(entry, manifestPath, environment) {
|
|
|
299
299
|
});
|
|
300
300
|
child.unref();
|
|
301
301
|
}
|
|
302
|
-
async function resolveNpmCli(globalRoot, environment) {
|
|
303
|
-
const candidates = [environment.npm_execpath, resolve(globalRoot, "npm", "bin", "npm-cli.js")]
|
|
302
|
+
export async function resolveNpmCli(globalRoot, environment, platform = process.platform, nodeExecutable = process.execPath) {
|
|
303
|
+
const candidates = [environment.npm_execpath, resolve(globalRoot, "npm", "bin", "npm-cli.js")]
|
|
304
|
+
.filter((value) => typeof value === "string" && value.length > 0);
|
|
304
305
|
for (const candidate of candidates) {
|
|
305
|
-
const canonical = await
|
|
306
|
-
if (canonical
|
|
306
|
+
const canonical = await canonicalRegularFile(candidate);
|
|
307
|
+
if (canonical)
|
|
307
308
|
return canonical;
|
|
308
309
|
}
|
|
310
|
+
if (platform === "win32") {
|
|
311
|
+
const commandCandidate = await windowsNpmCliFromPath(environment);
|
|
312
|
+
const bundledCandidates = [commandCandidate, resolve(dirname(nodeExecutable), "node_modules", "npm", "bin", "npm-cli.js")]
|
|
313
|
+
.filter((value) => value !== null);
|
|
314
|
+
for (const candidate of bundledCandidates) {
|
|
315
|
+
const canonical = await canonicalRegularFile(candidate);
|
|
316
|
+
if (canonical)
|
|
317
|
+
return canonical;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
309
320
|
throw new Error("could not resolve npm's JavaScript entry for protected package replacement");
|
|
310
321
|
}
|
|
322
|
+
async function windowsNpmCliFromPath(environment) {
|
|
323
|
+
const pathValue = windowsEnvironmentValue(environment, "PATH");
|
|
324
|
+
if (!pathValue)
|
|
325
|
+
return null;
|
|
326
|
+
const pathExtValue = windowsEnvironmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
|
|
327
|
+
const extensions = pathExtValue.split(";")
|
|
328
|
+
.map(extension => extension.trim())
|
|
329
|
+
.filter(extension => /^\.[a-z0-9]+$/i.test(extension));
|
|
330
|
+
if (extensions.length === 0)
|
|
331
|
+
return null;
|
|
332
|
+
for (const rawDirectory of pathValue.split(";")) {
|
|
333
|
+
const directory = unquoteWindowsPathEntry(rawDirectory.trim());
|
|
334
|
+
if (!directory)
|
|
335
|
+
continue;
|
|
336
|
+
for (const extension of extensions) {
|
|
337
|
+
const command = resolve(directory, `npm${extension}`);
|
|
338
|
+
if (await canonicalRegularFile(command))
|
|
339
|
+
return resolve(directory, "node_modules", "npm", "bin", "npm-cli.js");
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
function windowsEnvironmentValue(environment, name) {
|
|
345
|
+
const key = Object.keys(environment).find(candidate => candidate.toLowerCase() === name.toLowerCase());
|
|
346
|
+
return key ? environment[key] : undefined;
|
|
347
|
+
}
|
|
348
|
+
function unquoteWindowsPathEntry(value) {
|
|
349
|
+
return value.length >= 2 && value.startsWith('"') && value.endsWith('"') ? value.slice(1, -1) : value;
|
|
350
|
+
}
|
|
351
|
+
async function canonicalRegularFile(path) {
|
|
352
|
+
const canonical = await realpath(path).catch(() => null);
|
|
353
|
+
if (!canonical)
|
|
354
|
+
return null;
|
|
355
|
+
return await lstat(canonical).then(metadata => metadata.isFile() ? canonical : null).catch(() => null);
|
|
356
|
+
}
|
|
311
357
|
async function readLiveRecoveryOwner(path, transactionId) {
|
|
312
358
|
const owner = await readJson(path).catch(() => null);
|
|
313
359
|
const metadata = await lstat(path).catch(() => null);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"platform": "darwin",
|
|
6
6
|
"architecture": "arm64",
|
|
7
7
|
"capability": "supported",
|
|
8
|
-
"builtAt": "2026-10-
|
|
8
|
+
"builtAt": "2026-10-02T08:32:06.748Z",
|
|
9
9
|
"artifact": {
|
|
10
10
|
"filename": "process-guardian",
|
|
11
11
|
"sha256": "d3979187180449cb181eb92c187d1c8d0bfc4b2ba442e2e0a7c32704ea7e9589",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"platform": "linux",
|
|
6
6
|
"architecture": "x64",
|
|
7
7
|
"capability": "supported",
|
|
8
|
-
"builtAt": "2026-10-
|
|
8
|
+
"builtAt": "2026-10-02T08:31:49.423Z",
|
|
9
9
|
"artifact": {
|
|
10
10
|
"filename": "process-guardian",
|
|
11
11
|
"sha256": "a316d11a4aabe5aa88a360169206a87a11fe4b355e836b77cd8a7950279ab415",
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
"platform": "win32",
|
|
6
6
|
"architecture": "x64",
|
|
7
7
|
"capability": "supported",
|
|
8
|
-
"builtAt": "2026-10-
|
|
8
|
+
"builtAt": "2026-10-02T08:32:39.100Z",
|
|
9
9
|
"artifact": {
|
|
10
10
|
"filename": "process-guardian.exe",
|
|
11
|
-
"sha256": "
|
|
11
|
+
"sha256": "f301a691bb9b2103d149f08126d60aab44bf130cb4bf5a9a1d8b82f4965b9d62",
|
|
12
12
|
"size": 177152
|
|
13
13
|
},
|
|
14
14
|
"provenance": {
|
|
Binary file
|
package/package.json
CHANGED