@pnpm/exec.commands 1100.3.0 → 1100.3.1
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/lib/dlx.js +29 -5
- package/package.json +25 -25
package/lib/dlx.js
CHANGED
|
@@ -8,10 +8,11 @@ import { OUTPUT_OPTIONS } from '@pnpm/cli.common-cli-options-help';
|
|
|
8
8
|
import { docsUrl, readProjectManifestOnly } from '@pnpm/cli.utils';
|
|
9
9
|
import { types } from '@pnpm/config.reader';
|
|
10
10
|
import { getPublishedByPolicy } from '@pnpm/config.version-policy';
|
|
11
|
-
import {
|
|
11
|
+
import { createShortHash } from '@pnpm/crypto.hash';
|
|
12
12
|
import { PnpmError } from '@pnpm/error';
|
|
13
13
|
import { createResolver, makeResolutionStrict } from '@pnpm/installing.client';
|
|
14
14
|
import { add } from '@pnpm/installing.commands';
|
|
15
|
+
import { logger } from '@pnpm/logger';
|
|
15
16
|
import { readPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
|
|
16
17
|
import { parseWantedDependency } from '@pnpm/resolving.parse-wanted-dependency';
|
|
17
18
|
import { lexCompare } from '@pnpm/util.lex-comparator';
|
|
@@ -186,8 +187,23 @@ export async function handler(opts, [command, ...args], commands) {
|
|
|
186
187
|
}
|
|
187
188
|
else {
|
|
188
189
|
// Drop the partially-populated cache so a subsequent dlx run starts
|
|
189
|
-
// clean instead of reusing a broken install.
|
|
190
|
-
|
|
190
|
+
// clean instead of reusing a broken install. This is best-effort: on
|
|
191
|
+
// Windows the just-run install scripts (or antivirus) can briefly hold
|
|
192
|
+
// handles on freshly written files, so retry with backoff. A cleanup
|
|
193
|
+
// failure must never mask the original install error, which is the one
|
|
194
|
+
// worth surfacing — log it and rethrow err. A leftover prepare dir is
|
|
195
|
+
// harmless: it has a unique name and findCache only trusts the `pkg`
|
|
196
|
+
// symlink.
|
|
197
|
+
try {
|
|
198
|
+
await fs.promises.rm(cachedDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
199
|
+
}
|
|
200
|
+
catch (cleanupErr) {
|
|
201
|
+
logger.warn({
|
|
202
|
+
error: cleanupErr,
|
|
203
|
+
message: `Failed to clean up the dlx cache directory at "${cachedDir}"`,
|
|
204
|
+
prefix: cachedDir,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
191
207
|
throw err;
|
|
192
208
|
}
|
|
193
209
|
}
|
|
@@ -353,7 +369,12 @@ export function createCacheKey(opts) {
|
|
|
353
369
|
}
|
|
354
370
|
}
|
|
355
371
|
const hashStr = JSON.stringify(args);
|
|
356
|
-
|
|
372
|
+
// A short (truncated) hash keeps the dlx cache path short. The full
|
|
373
|
+
// virtual-store path below it (`<key>/<prepare>/node_modules/.pnpm/<pkgId>/
|
|
374
|
+
// node_modules/<pkg>`) can otherwise blow past Windows' MAX_PATH (260) and
|
|
375
|
+
// make lifecycle scripts fail with a `spawn cmd.exe ENOENT` (the cwd no
|
|
376
|
+
// longer resolves). 128 bits is ample collision resistance for a cache key.
|
|
377
|
+
return createShortHash(hashStr);
|
|
357
378
|
}
|
|
358
379
|
function getValidCacheDir(cacheLink, dlxCacheMaxAge) {
|
|
359
380
|
let stats;
|
|
@@ -379,7 +400,10 @@ function getValidCacheDir(cacheLink, dlxCacheMaxAge) {
|
|
|
379
400
|
return isValid ? target : undefined;
|
|
380
401
|
}
|
|
381
402
|
function getPrepareDir(cachePath) {
|
|
382
|
-
|
|
403
|
+
// base36 (vs hex) keeps this segment short — see createCacheKey for why dlx
|
|
404
|
+
// path length matters on Windows. time+pid stays unique across concurrent
|
|
405
|
+
// dlx processes and across a process's own retries of a failed install.
|
|
406
|
+
const name = `${Date.now().toString(36)}-${process.pid.toString(36)}`;
|
|
383
407
|
return path.join(cachePath, name);
|
|
384
408
|
}
|
|
385
409
|
function resolveCatalogProtocol(catalogResolver, alias, bareSpecifier) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/exec.commands",
|
|
3
|
-
"version": "1100.3.
|
|
3
|
+
"version": "1100.3.1",
|
|
4
4
|
"description": "Commands for running scripts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"funding": "https://opencollective.com/pnpm",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/pnpm/pnpm/tree/main/exec/commands"
|
|
14
|
+
"url": "https://github.com/pnpm/pnpm/tree/main/pnpm11/exec/commands"
|
|
15
15
|
},
|
|
16
|
-
"homepage": "https://github.com/pnpm/pnpm/tree/main/exec/commands#readme",
|
|
16
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/pnpm11/exec/commands#readme",
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/pnpm/pnpm/issues"
|
|
19
19
|
},
|
|
@@ -41,31 +41,31 @@
|
|
|
41
41
|
"symlink-dir": "^10.0.1",
|
|
42
42
|
"which": "npm:@pnpm/which@^3.0.1",
|
|
43
43
|
"write-json-file": "^7.0.0",
|
|
44
|
-
"@pnpm/building.commands": "1100.1.
|
|
45
|
-
"@pnpm/catalogs.resolver": "1100.0.0",
|
|
44
|
+
"@pnpm/building.commands": "1100.1.7",
|
|
46
45
|
"@pnpm/bins.resolver": "1100.0.8",
|
|
47
46
|
"@pnpm/cli.command": "1100.0.1",
|
|
48
47
|
"@pnpm/cli.common-cli-options-help": "1100.0.2",
|
|
49
|
-
"@pnpm/
|
|
50
|
-
"@pnpm/
|
|
51
|
-
"@pnpm/
|
|
48
|
+
"@pnpm/cli.utils": "1101.0.13",
|
|
49
|
+
"@pnpm/config.reader": "1101.10.1",
|
|
50
|
+
"@pnpm/catalogs.resolver": "1100.0.0",
|
|
51
|
+
"@pnpm/config.version-policy": "1100.1.6",
|
|
52
52
|
"@pnpm/core-loggers": "1100.2.1",
|
|
53
|
-
"@pnpm/error": "1100.0.0",
|
|
54
53
|
"@pnpm/crypto.hash": "1100.0.1",
|
|
54
|
+
"@pnpm/deps.status": "1100.1.3",
|
|
55
|
+
"@pnpm/engine.runtime.commands": "1100.1.7",
|
|
56
|
+
"@pnpm/error": "1100.0.1",
|
|
57
|
+
"@pnpm/exec.lifecycle": "1100.1.1",
|
|
58
|
+
"@pnpm/installing.commands": "1100.10.1",
|
|
55
59
|
"@pnpm/exec.pnpm-cli-runner": "1100.0.1",
|
|
56
|
-
"@pnpm/installing.client": "1100.2.
|
|
57
|
-
"@pnpm/exec.lifecycle": "1100.1.0",
|
|
58
|
-
"@pnpm/installing.commands": "1100.10.0",
|
|
59
|
-
"@pnpm/pkg-manifest.reader": "1100.0.8",
|
|
60
|
-
"@pnpm/shell.path": "1100.0.1",
|
|
60
|
+
"@pnpm/installing.client": "1100.2.10",
|
|
61
61
|
"@pnpm/resolving.parse-wanted-dependency": "1100.0.1",
|
|
62
|
-
"@pnpm/
|
|
62
|
+
"@pnpm/shell.path": "1100.0.1",
|
|
63
63
|
"@pnpm/types": "1101.3.2",
|
|
64
|
-
"@pnpm/
|
|
65
|
-
"@pnpm/
|
|
66
|
-
"@pnpm/
|
|
67
|
-
"@pnpm/workspace.
|
|
68
|
-
"@pnpm/
|
|
64
|
+
"@pnpm/workspace.injected-deps-syncer": "1100.0.21",
|
|
65
|
+
"@pnpm/store.path": "1100.0.2",
|
|
66
|
+
"@pnpm/pkg-manifest.reader": "1100.0.9",
|
|
67
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.14",
|
|
68
|
+
"@pnpm/workspace.projects-sorter": "1100.0.7"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@pnpm/logger": "^1100.0.0"
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"@types/which": "^3.0.4",
|
|
78
78
|
"is-windows": "^1.0.2",
|
|
79
79
|
"write-yaml-file": "^6.0.0",
|
|
80
|
-
"@pnpm/exec.commands": "1100.3.
|
|
81
|
-
"@pnpm/logger": "1100.0.0",
|
|
82
|
-
"@pnpm/prepare": "1100.0.16",
|
|
80
|
+
"@pnpm/exec.commands": "1100.3.1",
|
|
83
81
|
"@pnpm/engine.runtime.system-version": "1100.0.3",
|
|
84
|
-
"@pnpm/
|
|
82
|
+
"@pnpm/logger": "1100.0.0",
|
|
83
|
+
"@pnpm/prepare": "1100.0.17",
|
|
85
84
|
"@pnpm/test-ipc-server": "1100.0.0",
|
|
86
|
-
"@pnpm/
|
|
85
|
+
"@pnpm/workspace.projects-filter": "1100.0.23",
|
|
86
|
+
"@pnpm/testing.command-defaults": "1100.0.7"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": ">=22.13"
|