@pnpm/installing.deps-resolver 1100.0.2 → 1100.0.4
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/index.js +1 -1
- package/lib/linkPathToPeerVersion.d.ts +1 -0
- package/lib/linkPathToPeerVersion.js +54 -0
- package/lib/resolvePeers.js +2 -2
- package/package.json +16 -17
package/lib/index.js
CHANGED
|
@@ -323,7 +323,7 @@ function extendGraph(graph, opts) {
|
|
|
323
323
|
const pkgMetaIter = iterateGraphPkgMetaEntries(graph, !opts.enableGlobalVirtualStore);
|
|
324
324
|
// Only use allowBuild for engine-agnostic hash optimization when GVS is on
|
|
325
325
|
const allowBuild = opts.enableGlobalVirtualStore ? opts.allowBuild : undefined;
|
|
326
|
-
for (const { pkgMeta: { depPath }, hash } of iterateHashedGraphNodes(graph, pkgMetaIter, allowBuild)) {
|
|
326
|
+
for (const { pkgMeta: { depPath }, hash } of iterateHashedGraphNodes(graph, pkgMetaIter, allowBuild, opts.supportedArchitectures)) {
|
|
327
327
|
const modules = path.join(opts.globalVirtualStoreDir, hash, 'node_modules');
|
|
328
328
|
const node = graph[depPath];
|
|
329
329
|
Object.assign(node, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function linkPathToPeerVersion(relPath: string): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Converts a link: path into a stable, filename-safe token used as the
|
|
2
|
+
// peer's "version" inside peer-suffix hashes. The output must stay stable
|
|
3
|
+
// across pnpm versions so that lockfiles don't churn; it replicates what
|
|
4
|
+
// filenamify v4 produced for these paths in pnpm <= 10.
|
|
5
|
+
//
|
|
6
|
+
// Note: this encoding is lossy and can collide. Any leading run of `.`
|
|
7
|
+
// characters is dropped, and `/`, `\`, and literal `+` all collapse into
|
|
8
|
+
// a single `+`. For example, `packages/b`, `./packages/b`, and
|
|
9
|
+
// `../packages/b` all produce `packages+b`, and `.hidden/pkg` produces
|
|
10
|
+
// `hidden+pkg`. The only way to make this collision-free is to hash the
|
|
11
|
+
// normalized link target (or switch to a lossless escape encoding),
|
|
12
|
+
// either of which would change every link-path peer suffix in existing
|
|
13
|
+
// lockfiles. We accept the (extremely rare in practice) collision for
|
|
14
|
+
// lockfile stability; see https://github.com/pnpm/pnpm/issues/11272.
|
|
15
|
+
export function linkPathToPeerVersion(relPath) {
|
|
16
|
+
// Drop leading dots: v4 replaced `^\.+` with '+' and then stripOuter removed it.
|
|
17
|
+
let i = 0;
|
|
18
|
+
while (i < relPath.length && relPath[i] === '.')
|
|
19
|
+
i++;
|
|
20
|
+
let out = '';
|
|
21
|
+
let lastWasPlus = true; // pretend we just emitted '+' so leading '+' chars are suppressed
|
|
22
|
+
for (; i < relPath.length; i++) {
|
|
23
|
+
const c = relPath.charCodeAt(i);
|
|
24
|
+
// Reserved filename chars, C0 controls, and literal '+' all collapse into a single '+'.
|
|
25
|
+
const replace = c < 32 ||
|
|
26
|
+
c === 34 /* " */ || c === 42 /* * */ || c === 43 /* + */ ||
|
|
27
|
+
c === 47 /* / */ || c === 58 /* : */ || c === 60 /* < */ ||
|
|
28
|
+
c === 62 /* > */ || c === 63 /* ? */ || c === 92 /* \ */ ||
|
|
29
|
+
c === 124; /* | */
|
|
30
|
+
if (replace) {
|
|
31
|
+
if (!lastWasPlus) {
|
|
32
|
+
out += '+';
|
|
33
|
+
lastWasPlus = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
out += relPath[i];
|
|
38
|
+
lastWasPlus = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Trim trailing '+' and '.' (v4 stripped trailing periods and outer replacement).
|
|
42
|
+
let end = out.length;
|
|
43
|
+
while (end > 0) {
|
|
44
|
+
const ch = out.charCodeAt(end - 1);
|
|
45
|
+
if (ch !== 43 /* + */ && ch !== 46 /* . */)
|
|
46
|
+
break;
|
|
47
|
+
end--;
|
|
48
|
+
}
|
|
49
|
+
if (end > 0)
|
|
50
|
+
return out.slice(0, end);
|
|
51
|
+
// Empty result with something consumed collapses to a single '+'.
|
|
52
|
+
return relPath.length === 0 ? '' : '+';
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=linkPathToPeerVersion.js.map
|
package/lib/resolvePeers.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { createPeerDepGraphHash, depPathToFilename } from '@pnpm/deps.path';
|
|
3
3
|
import * as semverUtils from '@yarnpkg/core/semverUtils';
|
|
4
|
-
import filenamify from 'filenamify';
|
|
5
4
|
import { analyzeGraph } from 'graph-cycles';
|
|
6
5
|
import pDefer, {} from 'p-defer';
|
|
7
6
|
import { partition, pick } from 'ramda';
|
|
8
7
|
import semver from 'semver';
|
|
9
8
|
import { dedupeInjectedDeps } from './dedupeInjectedDeps.js';
|
|
9
|
+
import { linkPathToPeerVersion } from './linkPathToPeerVersion.js';
|
|
10
10
|
import { mergePeers } from './mergePeers.js';
|
|
11
11
|
export async function resolvePeers(opts) {
|
|
12
12
|
const depGraph = {};
|
|
@@ -672,7 +672,7 @@ function peerNodeIdToPeerId(alias, peerNodeId, ctx) {
|
|
|
672
672
|
if (typeof peerNodeId === 'string' && peerNodeId.startsWith('link:')) {
|
|
673
673
|
return {
|
|
674
674
|
name: alias,
|
|
675
|
-
version:
|
|
675
|
+
version: linkPathToPeerVersion(peerNodeId.slice(5)),
|
|
676
676
|
};
|
|
677
677
|
}
|
|
678
678
|
if (ctx.dedupePeers) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/installing.deps-resolver",
|
|
3
|
-
"version": "1100.0.
|
|
3
|
+
"version": "1100.0.4",
|
|
4
4
|
"description": "Resolves dependency graph of a package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@pnpm/util.lex-comparator": "^3.0.2",
|
|
28
28
|
"@yarnpkg/core": "4.5.0",
|
|
29
|
-
"filenamify": "^7.0.1",
|
|
30
29
|
"graph-cycles": "3.0.0",
|
|
31
30
|
"is-inner-link": "^5.0.0",
|
|
32
31
|
"is-subdir": "^2.0.0",
|
|
@@ -41,27 +40,27 @@
|
|
|
41
40
|
"semver-range-intersect": "^0.3.1",
|
|
42
41
|
"version-selector-type": "^3.0.0",
|
|
43
42
|
"@pnpm/catalogs.resolver": "1100.0.0",
|
|
44
|
-
"@pnpm/constants": "1100.0.0",
|
|
45
43
|
"@pnpm/catalogs.types": "1100.0.0",
|
|
46
|
-
"@pnpm/core-loggers": "1100.0.1",
|
|
47
|
-
"@pnpm/deps.graph-hasher": "1100.0.1",
|
|
48
44
|
"@pnpm/config.version-policy": "1100.0.1",
|
|
45
|
+
"@pnpm/constants": "1100.0.0",
|
|
46
|
+
"@pnpm/core-loggers": "1100.0.1",
|
|
47
|
+
"@pnpm/deps.graph-hasher": "1100.1.1",
|
|
49
48
|
"@pnpm/deps.path": "1100.0.1",
|
|
50
|
-
"@pnpm/error": "1100.0.0",
|
|
51
|
-
"@pnpm/fetching.pick-fetcher": "1100.0.1",
|
|
52
49
|
"@pnpm/deps.peer-range": "1100.0.0",
|
|
53
|
-
"@pnpm/
|
|
54
|
-
"@pnpm/
|
|
55
|
-
"@pnpm/
|
|
56
|
-
"@pnpm/
|
|
57
|
-
"@pnpm/
|
|
50
|
+
"@pnpm/error": "1100.0.0",
|
|
51
|
+
"@pnpm/fetching.pick-fetcher": "1100.0.3",
|
|
52
|
+
"@pnpm/hooks.types": "1100.0.3",
|
|
53
|
+
"@pnpm/lockfile.preferred-versions": "1100.0.4",
|
|
54
|
+
"@pnpm/lockfile.types": "1100.0.2",
|
|
58
55
|
"@pnpm/patching.types": "1100.0.0",
|
|
59
|
-
"@pnpm/lockfile.utils": "1100.0.
|
|
56
|
+
"@pnpm/lockfile.utils": "1100.0.3",
|
|
57
|
+
"@pnpm/patching.config": "1100.0.1",
|
|
60
58
|
"@pnpm/pkg-manifest.reader": "1100.0.1",
|
|
59
|
+
"@pnpm/lockfile.pruner": "1100.0.2",
|
|
61
60
|
"@pnpm/pkg-manifest.utils": "1100.1.0",
|
|
62
|
-
"@pnpm/resolving.npm-resolver": "
|
|
63
|
-
"@pnpm/
|
|
64
|
-
"@pnpm/
|
|
61
|
+
"@pnpm/resolving.npm-resolver": "1101.0.0",
|
|
62
|
+
"@pnpm/store.controller-types": "1100.0.3",
|
|
63
|
+
"@pnpm/resolving.resolver-base": "1100.1.0",
|
|
65
64
|
"@pnpm/types": "1101.0.0",
|
|
66
65
|
"@pnpm/workspace.spec-parser": "1100.0.0"
|
|
67
66
|
},
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
"@types/normalize-path": "^3.0.2",
|
|
73
72
|
"@types/ramda": "0.31.1",
|
|
74
73
|
"@types/semver": "7.7.1",
|
|
75
|
-
"@pnpm/installing.deps-resolver": "1100.0.
|
|
74
|
+
"@pnpm/installing.deps-resolver": "1100.0.4",
|
|
76
75
|
"@pnpm/logger": "1100.0.0"
|
|
77
76
|
},
|
|
78
77
|
"engines": {
|