@yarnpkg/nm 3.0.3 → 4.0.0-rc.11
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 +4 -14
- package/package.json +7 -6
|
@@ -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
|
|
@@ -449,8 +441,7 @@ const populateNodeModulesTree = (pnp, hoistedTree, options) => {
|
|
|
449
441
|
tree.set(nodeModulesLocation, leafNode);
|
|
450
442
|
const segments = nodeModulesLocation.split(`/`);
|
|
451
443
|
const nodeModulesIdx = segments.indexOf(NODE_MODULES);
|
|
452
|
-
let segCount = segments.length - 1;
|
|
453
|
-
while (nodeModulesIdx >= 0 && segCount > nodeModulesIdx) {
|
|
444
|
+
for (let segCount = segments.length - 1; nodeModulesIdx >= 0 && segCount > nodeModulesIdx; segCount--) {
|
|
454
445
|
const dirPath = fslib_1.npath.toPortablePath(segments.slice(0, segCount).join(fslib_1.ppath.sep));
|
|
455
446
|
const targetDir = (0, fslib_1.toFilename)(segments[segCount]);
|
|
456
447
|
const subdirs = tree.get(dirPath);
|
|
@@ -465,7 +456,6 @@ const populateNodeModulesTree = (pnp, hoistedTree, options) => {
|
|
|
465
456
|
subdirs.dirList.add(targetDir);
|
|
466
457
|
}
|
|
467
458
|
}
|
|
468
|
-
segCount--;
|
|
469
459
|
}
|
|
470
460
|
}
|
|
471
461
|
buildTree(dep, leafNode.linkType === LinkType.SOFT ? leafNode.target : nodeModulesLocation, nodePath);
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/nm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.11",
|
|
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": "^
|
|
10
|
-
"@yarnpkg/fslib": "^
|
|
9
|
+
"@yarnpkg/core": "^4.0.0-rc.11",
|
|
10
|
+
"@yarnpkg/fslib": "^3.0.0-rc.11"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@yarnpkg/pnp": "^
|
|
13
|
+
"@yarnpkg/pnp": "^4.0.0-rc.11"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"postpack": "rm -rf lib",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"directory": "packages/yarnpkg-nm"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
35
|
-
}
|
|
34
|
+
"node": ">=14.15.0"
|
|
35
|
+
},
|
|
36
|
+
"stableVersion": "3.0.1"
|
|
36
37
|
}
|