@yarnpkg/nm 3.1.0 → 3.1.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/buildNodeModulesTree.js +6 -16
- package/lib/hoist.js +1 -1
- package/package.json +4 -4
|
@@ -12,13 +12,13 @@ var LinkType;
|
|
|
12
12
|
(function (LinkType) {
|
|
13
13
|
LinkType["HARD"] = "HARD";
|
|
14
14
|
LinkType["SOFT"] = "SOFT";
|
|
15
|
-
})(LinkType
|
|
15
|
+
})(LinkType || (exports.LinkType = LinkType = {}));
|
|
16
16
|
var NodeModulesHoistingLimits;
|
|
17
17
|
(function (NodeModulesHoistingLimits) {
|
|
18
18
|
NodeModulesHoistingLimits["WORKSPACES"] = "workspaces";
|
|
19
19
|
NodeModulesHoistingLimits["DEPENDENCIES"] = "dependencies";
|
|
20
20
|
NodeModulesHoistingLimits["NONE"] = "none";
|
|
21
|
-
})(NodeModulesHoistingLimits
|
|
21
|
+
})(NodeModulesHoistingLimits || (exports.NodeModulesHoistingLimits = NodeModulesHoistingLimits = {}));
|
|
22
22
|
/** node_modules path segment */
|
|
23
23
|
const NODE_MODULES = `node_modules`;
|
|
24
24
|
/**
|
|
@@ -356,22 +356,14 @@ function getTargetLocatorPath(locator, pnp, options) {
|
|
|
356
356
|
const info = pnp.getPackageInformation(pkgLocator);
|
|
357
357
|
if (info === null)
|
|
358
358
|
throw new Error(`Assertion failed: Expected the package to be registered`);
|
|
359
|
-
|
|
360
|
-
let target;
|
|
361
|
-
if (options.pnpifyFs) {
|
|
359
|
+
return options.pnpifyFs
|
|
362
360
|
// In case of pnpifyFs we represent modules as symlinks to archives in NodeModulesFS
|
|
363
361
|
// `/home/user/project/foo` is a symlink to `/home/user/project/.yarn/.cache/foo.zip/node_modules/foo`
|
|
364
362
|
// To make this fs layout work with legacy tools we make
|
|
365
363
|
// `/home/user/project/.yarn/.cache/foo.zip/node_modules/foo/node_modules` (which normally does not exist inside archive) a symlink to:
|
|
366
364
|
// `/home/user/project/node_modules/foo/node_modules`, so that the tools were able to access it
|
|
367
|
-
target
|
|
368
|
-
linkType
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
target = getRealPackageLocation(info, locator, pnp);
|
|
372
|
-
linkType = info.linkType;
|
|
373
|
-
}
|
|
374
|
-
return { linkType, target };
|
|
365
|
+
? { linkType: LinkType.SOFT, target: fslib_1.npath.toPortablePath(info.packageLocation) }
|
|
366
|
+
: { linkType: info.linkType, target: getRealPackageLocation(info, locator, pnp) };
|
|
375
367
|
}
|
|
376
368
|
/**
|
|
377
369
|
* Converts hoisted tree to node modules map
|
|
@@ -452,8 +444,7 @@ const populateNodeModulesTree = (pnp, hoistedTree, options) => {
|
|
|
452
444
|
tree.set(nodeModulesLocation, leafNode);
|
|
453
445
|
const segments = nodeModulesLocation.split(`/`);
|
|
454
446
|
const nodeModulesIdx = segments.indexOf(NODE_MODULES);
|
|
455
|
-
let segCount = segments.length - 1;
|
|
456
|
-
while (nodeModulesIdx >= 0 && segCount > nodeModulesIdx) {
|
|
447
|
+
for (let segCount = segments.length - 1; nodeModulesIdx >= 0 && segCount > nodeModulesIdx; segCount--) {
|
|
457
448
|
const dirPath = fslib_1.npath.toPortablePath(segments.slice(0, segCount).join(fslib_1.ppath.sep));
|
|
458
449
|
const targetDir = (0, fslib_1.toFilename)(segments[segCount]);
|
|
459
450
|
const subdirs = tree.get(dirPath);
|
|
@@ -468,7 +459,6 @@ const populateNodeModulesTree = (pnp, hoistedTree, options) => {
|
|
|
468
459
|
subdirs.dirList.add(targetDir);
|
|
469
460
|
}
|
|
470
461
|
}
|
|
471
|
-
segCount--;
|
|
472
462
|
}
|
|
473
463
|
}
|
|
474
464
|
buildTree(dep, leafNode.linkType === LinkType.SOFT ? leafNode.target : nodeModulesLocation, nodePath);
|
package/lib/hoist.js
CHANGED
|
@@ -6,7 +6,7 @@ var HoisterDependencyKind;
|
|
|
6
6
|
HoisterDependencyKind[HoisterDependencyKind["REGULAR"] = 0] = "REGULAR";
|
|
7
7
|
HoisterDependencyKind[HoisterDependencyKind["WORKSPACE"] = 1] = "WORKSPACE";
|
|
8
8
|
HoisterDependencyKind[HoisterDependencyKind["EXTERNAL_SOFT_LINK"] = 2] = "EXTERNAL_SOFT_LINK";
|
|
9
|
-
})(HoisterDependencyKind
|
|
9
|
+
})(HoisterDependencyKind || (exports.HoisterDependencyKind = HoisterDependencyKind = {}));
|
|
10
10
|
var Hoistable;
|
|
11
11
|
(function (Hoistable) {
|
|
12
12
|
Hoistable[Hoistable["YES"] = 0] = "YES";
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/nm",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"license": "BSD-2-Clause",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@yarnpkg/core": "^3.
|
|
10
|
-
"@yarnpkg/fslib": "^2.
|
|
11
|
-
"@yarnpkg/pnp": "^3.
|
|
9
|
+
"@yarnpkg/core": "^3.6.0",
|
|
10
|
+
"@yarnpkg/fslib": "^2.10.3",
|
|
11
|
+
"@yarnpkg/pnp": "^3.3.6"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"postpack": "rm -rf lib",
|