@pnpm/installing.deps-resolver 1100.2.3 → 1100.2.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/lib/dedupeInjectedDeps.js +16 -9
- package/lib/getNonDevWantedDependencies.d.ts +2 -0
- package/lib/index.js +16 -0
- package/lib/resolveDependencies.d.ts +20 -0
- package/lib/resolveDependencies.js +73 -4
- package/lib/resolveDependencyTree.d.ts +5 -0
- package/lib/resolveDependencyTree.js +1 -0
- package/lib/resolvePeers.js +15 -3
- package/lib/toResolveImporter.js +1 -1
- package/lib/updateProjectManifest.js +28 -8
- package/package.json +20 -20
|
@@ -27,19 +27,26 @@ function getDedupeMap(injectedDepsByProjects, opts) {
|
|
|
27
27
|
for (const [id, deps] of injectedDepsByProjects.entries()) {
|
|
28
28
|
const dedupedInjectedDeps = new Map();
|
|
29
29
|
for (const [alias, dep] of deps.entries()) {
|
|
30
|
-
|
|
31
|
-
// The injected project in the workspace may have dev deps
|
|
32
|
-
const children = Object.entries(opts.depGraph[dep.depPath].children);
|
|
30
|
+
const node = opts.depGraph[dep.depPath];
|
|
33
31
|
const targetProjectDeps = opts.dependenciesByProjectId[dep.id];
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
// injected dep
|
|
32
|
+
// In single-project operations (e.g. `pnpm rm` from inside a workspace package) the target
|
|
33
|
+
// workspace project isn't being resolved, so its children aren't in
|
|
34
|
+
// `dependenciesByProjectId`. The injected dep was resolved against the same workspace
|
|
35
|
+
// package source, so dedupe is safe. The exception is peer-suffixed depPaths, whose
|
|
36
|
+
// resolution depends on the importer's peer context. A plain `link:` would lose that, so
|
|
37
|
+
// we skip dedupe for those. A depPath is `${pkgIdWithPatchHash}${peerDepGraphHash}`, so it
|
|
38
|
+
// carries a peer suffix exactly when it differs from its peer-free `pkgIdWithPatchHash`.
|
|
37
39
|
if (!targetProjectDeps) {
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
+
if (node.pkgIdWithPatchHash === dep.depPath) {
|
|
41
|
+
dedupedInjectedDeps.set(alias, dep.id);
|
|
42
|
+
}
|
|
43
|
+
continue;
|
|
40
44
|
}
|
|
45
|
+
// Check for subgroup not equal.
|
|
46
|
+
// The injected project in the workspace may have dev deps
|
|
47
|
+
const children = Object.entries(node.children);
|
|
41
48
|
const isSubset = children
|
|
42
|
-
.every(([alias, depPath]) => targetProjectDeps
|
|
49
|
+
.every(([alias, depPath]) => targetProjectDeps.get(alias) === depPath);
|
|
43
50
|
if (isSubset) {
|
|
44
51
|
dedupedInjectedDeps.set(alias, dep.id);
|
|
45
52
|
}
|
|
@@ -6,6 +6,8 @@ export interface WantedDependency {
|
|
|
6
6
|
optional: boolean;
|
|
7
7
|
injected?: boolean;
|
|
8
8
|
saveCatalogName?: string;
|
|
9
|
+
/** Whether this dependency's spec should be (re)written to the manifest. */
|
|
10
|
+
updateSpec?: boolean;
|
|
9
11
|
}
|
|
10
12
|
type GetNonDevWantedDependenciesManifest = Pick<DependencyManifest, 'bundleDependencies' | 'bundledDependencies' | 'optionalDependencies' | 'dependencies' | 'dependenciesMeta'> & {
|
|
11
13
|
name?: string;
|
package/lib/index.js
CHANGED
|
@@ -221,6 +221,7 @@ export async function resolveDependencies(importers, opts) {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
+
await waitForResolutionFetches(resolvedPkgsById);
|
|
224
225
|
const newLockfile = updateLockfile({
|
|
225
226
|
dependenciesGraph,
|
|
226
227
|
lockfile: opts.wantedLockfile,
|
|
@@ -334,6 +335,21 @@ function alignDependencyTypes(manifest, projectSnapshot) {
|
|
|
334
335
|
}
|
|
335
336
|
}
|
|
336
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Waits for fetches that complete resolution data used by the lockfile snapshot and
|
|
340
|
+
* virtual-store paths. Other package fetches are awaited later by `waitTillAllFetchingsFinish`.
|
|
341
|
+
*/
|
|
342
|
+
async function waitForResolutionFetches(resolvedPkgsById) {
|
|
343
|
+
const fetches = [];
|
|
344
|
+
for (const pkg of Object.values(resolvedPkgsById)) {
|
|
345
|
+
if (pkg.resolutionNeedsFetch && pkg.fetching != null) {
|
|
346
|
+
fetches.push(pkg.fetching());
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (fetches.length > 0) {
|
|
350
|
+
await Promise.all(fetches);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
337
353
|
function getAliasToDependencyTypeMap(manifest) {
|
|
338
354
|
const depTypesOfAliases = {};
|
|
339
355
|
for (const depType of DEPENDENCIES_FIELDS) {
|
|
@@ -45,6 +45,11 @@ export interface PkgAddressOrLinkBase {
|
|
|
45
45
|
optional: boolean;
|
|
46
46
|
pkg: PackageManifest;
|
|
47
47
|
pkgId: PkgResolutionId;
|
|
48
|
+
/**
|
|
49
|
+
* The wanted dependency this direct dependency was resolved from, carried so
|
|
50
|
+
* consumers can recover the request directly. See `updateProjectManifest`.
|
|
51
|
+
*/
|
|
52
|
+
wantedDependency?: WantedDependency;
|
|
48
53
|
}
|
|
49
54
|
export interface LinkedDependency extends PkgAddressOrLinkBase {
|
|
50
55
|
isLinkedDependency: true;
|
|
@@ -201,6 +206,12 @@ export interface ResolvedPackage {
|
|
|
201
206
|
dev: boolean;
|
|
202
207
|
optional: boolean;
|
|
203
208
|
fetching: () => Promise<PkgRequestFetchResult>;
|
|
209
|
+
/**
|
|
210
|
+
* The resolution can't be completed without awaiting `fetching` (e.g. a registry tarball
|
|
211
|
+
* whose integrity is computed from the downloaded bytes). The lockfile snapshot and the
|
|
212
|
+
* virtual-store paths derived from the integrity must await `fetching` for these first.
|
|
213
|
+
*/
|
|
214
|
+
resolutionNeedsFetch?: boolean;
|
|
204
215
|
filesIndexFile: string;
|
|
205
216
|
name: string;
|
|
206
217
|
version: string;
|
|
@@ -278,6 +289,15 @@ export declare function resolveDependencies(ctx: ResolutionContext, preferredVer
|
|
|
278
289
|
updateDepth?: number;
|
|
279
290
|
}>, options: ResolvedDependenciesOptions): Promise<ResolvedDependenciesResult>;
|
|
280
291
|
export declare function createNodeIdForLinkedLocalPkg(lockfileDir: string, pkgDir: string): NodeId;
|
|
292
|
+
export declare function claimChildrenResolution(ctx: ResolutionContext, opts: {
|
|
293
|
+
currentDepth: number;
|
|
294
|
+
parentIds: PkgResolutionId[];
|
|
295
|
+
pkgId: PkgResolutionId;
|
|
296
|
+
}): {
|
|
297
|
+
id: number;
|
|
298
|
+
isOwner: boolean;
|
|
299
|
+
missingPeersOfChildren?: MissingPeersOfChildren;
|
|
300
|
+
};
|
|
281
301
|
export declare function buildTree(ctx: {
|
|
282
302
|
childrenByParentId: ChildrenByParentId;
|
|
283
303
|
dependenciesTree: DependenciesTree<ResolvedPackage>;
|
|
@@ -314,6 +314,7 @@ function getPublishedByDate(pkgAddresses, timeFromLockfile = {}) {
|
|
|
314
314
|
export async function resolveDependencies(ctx, preferredVersions, wantedDependencies, options) {
|
|
315
315
|
const extendedWantedDeps = getDepsToResolve(wantedDependencies, ctx.wantedLockfile, {
|
|
316
316
|
preferredDependencies: options.preferredDependencies,
|
|
317
|
+
preferredVersions,
|
|
317
318
|
prefix: options.prefix,
|
|
318
319
|
proceed: options.proceed || ctx.forceFullResolution,
|
|
319
320
|
registries: ctx.registries,
|
|
@@ -610,7 +611,7 @@ function hasActivePackageResolutionBeforeDepth(ctx, depth) {
|
|
|
610
611
|
}
|
|
611
612
|
return false;
|
|
612
613
|
}
|
|
613
|
-
function claimChildrenResolution(ctx, opts) {
|
|
614
|
+
export function claimChildrenResolution(ctx, opts) {
|
|
614
615
|
const owner = {
|
|
615
616
|
depth: opts.currentDepth,
|
|
616
617
|
importerOrder: ctx.importerResolutionOrder[opts.parentIds[0]] ?? Number.MAX_SAFE_INTEGER,
|
|
@@ -656,8 +657,13 @@ function claimChildrenResolution(ctx, opts) {
|
|
|
656
657
|
if (ctx.hoistPeers &&
|
|
657
658
|
!opts.parentIds.includes(opts.pkgId) &&
|
|
658
659
|
existing.missingPeersOfChildren &&
|
|
659
|
-
|
|
660
|
-
|
|
660
|
+
existing.owner.depth >= opts.currentDepth) {
|
|
661
|
+
// Gating reuse on the owner's depth keeps a transitive optional peer's
|
|
662
|
+
// presence in the resolved suffix a function of graph structure, not of
|
|
663
|
+
// which occurrence happened to finish resolving first. A strictly shallower
|
|
664
|
+
// owner is excluded because its promise may still be unsettled here, and
|
|
665
|
+
// awaiting it can deadlock under auto-install-peers
|
|
666
|
+
// (https://github.com/pnpm/pnpm/issues/5454).
|
|
661
667
|
missingPeersOfChildren = existing.missingPeersOfChildren;
|
|
662
668
|
}
|
|
663
669
|
return {
|
|
@@ -849,12 +855,33 @@ function getDepsToResolve(wantedDependencies, wantedLockfile, options) {
|
|
|
849
855
|
});
|
|
850
856
|
for (const wantedDependency of wantedDependencies) {
|
|
851
857
|
let reference = undefined;
|
|
858
|
+
let preferredVersion = undefined;
|
|
852
859
|
let proceed = proceedAll;
|
|
853
860
|
if (wantedDependency.alias) {
|
|
854
861
|
const satisfiesWanted = satisfiesWanted2Args.bind(null, wantedDependency);
|
|
855
862
|
if (resolvedDependencies[wantedDependency.alias] &&
|
|
856
863
|
(satisfiesWanted(resolvedDependencies[wantedDependency.alias]) || resolvedDependencies[wantedDependency.alias].startsWith('file:'))) {
|
|
857
|
-
|
|
864
|
+
const pinnedRef = resolvedDependencies[wantedDependency.alias];
|
|
865
|
+
// Reusing a lockfile pin verbatim bypasses the preferred-versions
|
|
866
|
+
// walk, so a transitive edge stays on a stale lower version even
|
|
867
|
+
// when a direct dependency resolved to a higher version in range.
|
|
868
|
+
const pinned = pinnedRef.startsWith('file:')
|
|
869
|
+
? undefined
|
|
870
|
+
: getPinnedNameVer(wantedLockfile, pinnedRef, wantedDependency.alias);
|
|
871
|
+
const higherDirectVersion = pinned == null
|
|
872
|
+
? undefined
|
|
873
|
+
: findHigherDirectDepVersion(options.preferredVersions, pinned.name, pinned.version, wantedDependency.bareSpecifier);
|
|
874
|
+
if (higherDirectVersion != null) {
|
|
875
|
+
// `preferredVersion` (singular) overrides the
|
|
876
|
+
// EXISTING_VERSION_SELECTOR_WEIGHT stability bias that would
|
|
877
|
+
// otherwise re-pick the lower version. The lower version is then
|
|
878
|
+
// never resolved or fetched.
|
|
879
|
+
proceed = true;
|
|
880
|
+
preferredVersion = higherDirectVersion;
|
|
881
|
+
}
|
|
882
|
+
else {
|
|
883
|
+
reference = pinnedRef;
|
|
884
|
+
}
|
|
858
885
|
}
|
|
859
886
|
else if (
|
|
860
887
|
// If dependencies that were used by the previous version of the package
|
|
@@ -885,6 +912,7 @@ function getDepsToResolve(wantedDependencies, wantedLockfile, options) {
|
|
|
885
912
|
}
|
|
886
913
|
extendedWantedDeps.push({
|
|
887
914
|
infoFromLockfile,
|
|
915
|
+
preferredVersion,
|
|
888
916
|
proceed,
|
|
889
917
|
wantedDependency,
|
|
890
918
|
});
|
|
@@ -909,6 +937,44 @@ function referenceSatisfiesWantedSpec(opts, wantedDep, preferredRef) {
|
|
|
909
937
|
}
|
|
910
938
|
return semver.satisfies(version, wantedDep.bareSpecifier, true);
|
|
911
939
|
}
|
|
940
|
+
function getPinnedNameVer(lockfile, reference, alias) {
|
|
941
|
+
const depPath = dp.refToRelative(reference, alias);
|
|
942
|
+
if (depPath === null)
|
|
943
|
+
return undefined;
|
|
944
|
+
const pkgSnapshot = lockfile.packages?.[depPath];
|
|
945
|
+
if (pkgSnapshot == null)
|
|
946
|
+
return undefined;
|
|
947
|
+
return nameVerFromPkgSnapshot(depPath, pkgSnapshot);
|
|
948
|
+
}
|
|
949
|
+
// The highest version a direct dependency (the only deterministic,
|
|
950
|
+
// resolved-first anchor) resolved to that is higher than the
|
|
951
|
+
// lockfile-pinned `pinnedVersion` and still satisfies the edge's range, or
|
|
952
|
+
// `undefined` when none exists. Direct-dependency versions are marked with
|
|
953
|
+
// DIRECT_DEP_SELECTOR_WEIGHT in preferredVersions.
|
|
954
|
+
function findHigherDirectDepVersion(preferredVersions, pinnedName, pinnedVersion, bareSpecifier) {
|
|
955
|
+
if (preferredVersions == null)
|
|
956
|
+
return undefined;
|
|
957
|
+
if (!semver.valid(pinnedVersion))
|
|
958
|
+
return undefined;
|
|
959
|
+
if (semver.validRange(bareSpecifier) === null)
|
|
960
|
+
return undefined;
|
|
961
|
+
const selectors = preferredVersions[pinnedName];
|
|
962
|
+
if (selectors == null)
|
|
963
|
+
return undefined;
|
|
964
|
+
let best;
|
|
965
|
+
for (const [candidate, selector] of Object.entries(selectors)) {
|
|
966
|
+
if (typeof selector === 'object' &&
|
|
967
|
+
selector.selectorType === 'version' &&
|
|
968
|
+
selector.weight === DIRECT_DEP_SELECTOR_WEIGHT &&
|
|
969
|
+
semver.valid(candidate) &&
|
|
970
|
+
semver.gt(candidate, pinnedVersion) &&
|
|
971
|
+
semver.satisfies(candidate, bareSpecifier, true) &&
|
|
972
|
+
(best == null || semver.gt(candidate, best))) {
|
|
973
|
+
best = candidate;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
return best;
|
|
977
|
+
}
|
|
912
978
|
function getLockedPeerContext(dependencyLockfile) {
|
|
913
979
|
if (dependencyLockfile.peerDependencies == null)
|
|
914
980
|
return undefined;
|
|
@@ -1123,6 +1189,7 @@ async function resolveDependency(wantedDependency, ctx, options) {
|
|
|
1123
1189
|
version: pkgResponse.body.manifest.version,
|
|
1124
1190
|
normalizedBareSpecifier: pkgResponse.body.normalizedBareSpecifier,
|
|
1125
1191
|
pkg: pkgResponse.body.manifest,
|
|
1192
|
+
wantedDependency,
|
|
1126
1193
|
};
|
|
1127
1194
|
}
|
|
1128
1195
|
let prepare;
|
|
@@ -1303,6 +1370,7 @@ async function resolveDependency(wantedDependency, ctx, options) {
|
|
|
1303
1370
|
resolvedVia: pkgResponse.body.resolvedVia,
|
|
1304
1371
|
isNew,
|
|
1305
1372
|
nodeId,
|
|
1373
|
+
wantedDependency,
|
|
1306
1374
|
normalizedBareSpecifier: pkgResponse.body.normalizedBareSpecifier,
|
|
1307
1375
|
missingPeersOfChildren,
|
|
1308
1376
|
childrenResolutionId: childrenResolution.id,
|
|
@@ -1372,6 +1440,7 @@ function getResolvedPackage(options) {
|
|
|
1372
1440
|
pkgIdWithPatchHash: options.pkgIdWithPatchHash,
|
|
1373
1441
|
dev: options.wantedDependency.dev,
|
|
1374
1442
|
fetching: options.pkgResponse.fetching,
|
|
1443
|
+
resolutionNeedsFetch: options.pkgResponse.resolutionNeedsFetch,
|
|
1375
1444
|
filesIndexFile: options.pkgResponse.filesIndexFile,
|
|
1376
1445
|
hasBin: options.hasBin,
|
|
1377
1446
|
hasBundledDependencies: !((options.pkg.bundledDependencies ?? options.pkg.bundleDependencies) == null),
|
|
@@ -25,6 +25,11 @@ export interface ResolvedDirectDependency {
|
|
|
25
25
|
name: string;
|
|
26
26
|
catalogLookup?: CatalogLookupMetadata;
|
|
27
27
|
normalizedBareSpecifier?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The wanted dependency this was resolved from, carried so consumers can
|
|
30
|
+
* recover the request directly. See `updateProjectManifest`.
|
|
31
|
+
*/
|
|
32
|
+
wantedDependency?: WantedDependency;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
30
35
|
* Information related to the catalog entry for this dependency if it was
|
|
@@ -164,6 +164,7 @@ export async function resolveDependencyTree(importers, opts) {
|
|
|
164
164
|
resolution: resolvedPackage.resolution,
|
|
165
165
|
version: resolvedPackage.version,
|
|
166
166
|
normalizedBareSpecifier: dep.normalizedBareSpecifier,
|
|
167
|
+
wantedDependency: dep.wantedDependency,
|
|
167
168
|
};
|
|
168
169
|
}),
|
|
169
170
|
directNodeIdsByAlias: new Map(directNonLinkedDeps.map(({ alias, nodeId }) => [alias, nodeId])),
|
package/lib/resolvePeers.js
CHANGED
|
@@ -259,10 +259,11 @@ async function resolvePeersOfNode(currentAlias, nodeId, parentParentPkgs, ctx) {
|
|
|
259
259
|
parentPkgs = { ...parentParentPkgs };
|
|
260
260
|
const parentPkgNodes = [];
|
|
261
261
|
for (const [alias, nodeId] of Object.entries(children)) {
|
|
262
|
-
|
|
262
|
+
const childNode = ctx.dependenciesTree.get(nodeId);
|
|
263
|
+
if (ctx.allPeerDepNames.has(alias) || (alias !== childNode.resolvedPackage.name && ctx.allPeerDepNames.has(childNode.resolvedPackage.name))) {
|
|
263
264
|
parentPkgNodes.push({
|
|
264
265
|
alias,
|
|
265
|
-
node:
|
|
266
|
+
node: childNode,
|
|
266
267
|
nodeId,
|
|
267
268
|
parentNodeIds,
|
|
268
269
|
});
|
|
@@ -391,7 +392,18 @@ async function resolvePeersOfNode(currentAlias, nodeId, parentParentPkgs, ctx) {
|
|
|
391
392
|
}
|
|
392
393
|
let cache;
|
|
393
394
|
const isPure = allResolvedPeers.size === 0 && allMissingPeers.size === 0;
|
|
394
|
-
|
|
395
|
+
// A cycle re-entry resolves against truncated children (the cycle is broken by
|
|
396
|
+
// dropping the repeated package's subtree), so its empty/partial peer sets are
|
|
397
|
+
// not authoritative for the package as a whole. Recording that verdict — as
|
|
398
|
+
// pure or in peersCache — lets it short-circuit other occurrences that *can*
|
|
399
|
+
// see the full subtree, dropping their transitivePeerDependencies depending on
|
|
400
|
+
// traversal order and churning the lockfile (https://github.com/pnpm/pnpm/issues/5108).
|
|
401
|
+
const resolvedThroughCycle = ctx.parentDepPathsChain.includes(resolvedPackage.pkgIdWithPatchHash);
|
|
402
|
+
if (resolvedThroughCycle) {
|
|
403
|
+
// Leave both caches untouched so later occurrences re-resolve (or hit the
|
|
404
|
+
// authoritative entry of the same package) instead of reusing this partial one.
|
|
405
|
+
}
|
|
406
|
+
else if (isPure) {
|
|
395
407
|
ctx.purePkgs.add(resolvedPackage.pkgIdWithPatchHash);
|
|
396
408
|
}
|
|
397
409
|
else {
|
package/lib/toResolveImporter.js
CHANGED
|
@@ -48,7 +48,7 @@ export async function toResolveImporter(opts, project) {
|
|
|
48
48
|
...project.wantedDependencies.map(defaultUpdateDepth < 0
|
|
49
49
|
? updateLocalTarballs
|
|
50
50
|
: (dep) => ({ ...dep, updateDepth: defaultUpdateDepth })),
|
|
51
|
-
...existingDeps.map(
|
|
51
|
+
...existingDeps.map(project.updateMatching != null
|
|
52
52
|
? updateLocalTarballs
|
|
53
53
|
: (dep) => ({ ...dep, updateDepth: -1 })),
|
|
54
54
|
];
|
|
@@ -3,19 +3,24 @@ export async function updateProjectManifest(importer, opts) {
|
|
|
3
3
|
if (!importer.manifest) {
|
|
4
4
|
throw new Error('Cannot save because no package.json found');
|
|
5
5
|
}
|
|
6
|
-
const specsToUpsert =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const specsToUpsert = [];
|
|
7
|
+
for (const rdd of opts.directDependencies) {
|
|
8
|
+
const wantedDep = rdd.wantedDependency;
|
|
9
|
+
if (wantedDep?.updateSpec !== true)
|
|
10
|
+
continue;
|
|
11
|
+
specsToUpsert.push({
|
|
11
12
|
alias: rdd.alias,
|
|
12
13
|
peer: importer.peer,
|
|
13
|
-
bareSpecifier:
|
|
14
|
+
bareSpecifier: getBareSpecifierToSave(wantedDep, rdd, opts.preserveWorkspaceProtocol),
|
|
14
15
|
resolvedVersion: rdd.version,
|
|
15
16
|
pinnedVersion: importer.pinnedVersion,
|
|
16
17
|
saveType: importer.targetDependenciesField,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
// Re-save a dependency flagged for update that failed to resolve (e.g. a
|
|
21
|
+
// missing optional, hence absent from `directDependencies`) carrying no
|
|
22
|
+
// specifier, so it keeps its existing version under the importer's target
|
|
23
|
+
// field (which is unset for a plain install/update, making this a no-op).
|
|
19
24
|
for (const pkgToInstall of importer.wantedDependencies) {
|
|
20
25
|
if (pkgToInstall.updateSpec && pkgToInstall.alias && !specsToUpsert.some(({ alias }) => alias === pkgToInstall.alias)) {
|
|
21
26
|
specsToUpsert.push({
|
|
@@ -31,4 +36,19 @@ export async function updateProjectManifest(importer, opts) {
|
|
|
31
36
|
: undefined;
|
|
32
37
|
return [hookedManifest, originalManifest];
|
|
33
38
|
}
|
|
39
|
+
function getBareSpecifierToSave(wantedDep, resolvedDep, preserveWorkspaceProtocol) {
|
|
40
|
+
if (resolvedDep.catalogLookup != null) {
|
|
41
|
+
return resolvedDep.catalogLookup.userSpecifiedBareSpecifier;
|
|
42
|
+
}
|
|
43
|
+
if (preserveWorkspaceProtocol && isWorkspaceLocalPathSpecifier(wantedDep.bareSpecifier)) {
|
|
44
|
+
return wantedDep.bareSpecifier;
|
|
45
|
+
}
|
|
46
|
+
return resolvedDep.normalizedBareSpecifier ?? wantedDep.bareSpecifier;
|
|
47
|
+
}
|
|
48
|
+
function isWorkspaceLocalPathSpecifier(bareSpecifier) {
|
|
49
|
+
if (!bareSpecifier.startsWith('workspace:'))
|
|
50
|
+
return false;
|
|
51
|
+
const pref = bareSpecifier.slice('workspace:'.length);
|
|
52
|
+
return pref.startsWith('.') || pref.startsWith('/') || pref.startsWith('~/') || /^[A-Z]:/i.test(pref);
|
|
53
|
+
}
|
|
34
54
|
//# sourceMappingURL=updateProjectManifest.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/installing.deps-resolver",
|
|
3
|
-
"version": "1100.2.
|
|
3
|
+
"version": "1100.2.5",
|
|
4
4
|
"description": "Resolves dependency graph of a package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"funding": "https://opencollective.com/pnpm",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/pnpm/pnpm/tree/main/installing/deps-resolver"
|
|
13
|
+
"url": "https://github.com/pnpm/pnpm/tree/main/pnpm11/installing/deps-resolver"
|
|
14
14
|
},
|
|
15
|
-
"homepage": "https://github.com/pnpm/pnpm/tree/main/installing/deps-resolver#readme",
|
|
15
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/pnpm11/installing/deps-resolver#readme",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/pnpm/pnpm/issues"
|
|
18
18
|
},
|
|
@@ -45,28 +45,28 @@
|
|
|
45
45
|
"version-selector-type": "^3.0.0",
|
|
46
46
|
"@pnpm/catalogs.resolver": "1100.0.0",
|
|
47
47
|
"@pnpm/catalogs.types": "1100.0.0",
|
|
48
|
-
"@pnpm/config.version-policy": "1100.1.
|
|
48
|
+
"@pnpm/config.version-policy": "1100.1.6",
|
|
49
49
|
"@pnpm/constants": "1100.0.0",
|
|
50
50
|
"@pnpm/core-loggers": "1100.2.1",
|
|
51
|
-
"@pnpm/deps.graph-hasher": "1100.2.5",
|
|
52
51
|
"@pnpm/deps.path": "1100.0.8",
|
|
53
|
-
"@pnpm/
|
|
52
|
+
"@pnpm/deps.graph-hasher": "1100.2.6",
|
|
54
53
|
"@pnpm/deps.peer-range": "1100.0.2",
|
|
55
|
-
"@pnpm/
|
|
56
|
-
"@pnpm/
|
|
57
|
-
"@pnpm/
|
|
58
|
-
"@pnpm/lockfile.
|
|
59
|
-
"@pnpm/lockfile.
|
|
60
|
-
"@pnpm/lockfile.
|
|
61
|
-
"@pnpm/
|
|
54
|
+
"@pnpm/error": "1100.0.1",
|
|
55
|
+
"@pnpm/fetching.pick-fetcher": "1100.0.13",
|
|
56
|
+
"@pnpm/hooks.types": "1100.1.0",
|
|
57
|
+
"@pnpm/lockfile.preferred-versions": "1100.0.17",
|
|
58
|
+
"@pnpm/lockfile.pruner": "1100.0.12",
|
|
59
|
+
"@pnpm/lockfile.types": "1100.0.12",
|
|
60
|
+
"@pnpm/lockfile.utils": "1100.1.0",
|
|
61
|
+
"@pnpm/patching.config": "1100.0.9",
|
|
62
62
|
"@pnpm/patching.types": "1100.0.0",
|
|
63
|
-
"@pnpm/pkg-manifest.
|
|
64
|
-
"@pnpm/pkg-manifest.
|
|
65
|
-
"@pnpm/resolving.
|
|
66
|
-
"@pnpm/store.controller-types": "1100.1.
|
|
63
|
+
"@pnpm/pkg-manifest.reader": "1100.0.9",
|
|
64
|
+
"@pnpm/pkg-manifest.utils": "1100.2.6",
|
|
65
|
+
"@pnpm/resolving.resolver-base": "1100.5.0",
|
|
66
|
+
"@pnpm/store.controller-types": "1100.1.6",
|
|
67
|
+
"@pnpm/resolving.npm-resolver": "1102.1.0",
|
|
67
68
|
"@pnpm/types": "1101.3.2",
|
|
68
|
-
"@pnpm/workspace.spec-parser": "1100.0.0"
|
|
69
|
-
"@pnpm/resolving.resolver-base": "1100.4.2"
|
|
69
|
+
"@pnpm/workspace.spec-parser": "1100.0.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@pnpm/logger": "^1100.0.0"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@types/ramda": "0.31.1",
|
|
78
78
|
"@types/semver": "7.7.1",
|
|
79
79
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
80
|
-
"@pnpm/installing.deps-resolver": "1100.2.
|
|
80
|
+
"@pnpm/installing.deps-resolver": "1100.2.5",
|
|
81
81
|
"@pnpm/logger": "1100.0.0"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|