@yarnpkg/nm 4.0.0-rc.25 → 4.0.0-rc.27

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.
@@ -402,9 +402,11 @@ const populateNodeModulesTree = (pnp, hoistedTree, options) => {
402
402
  if (seenNodes.has(pkg))
403
403
  return;
404
404
  seenNodes.add(pkg);
405
+ const pkgReferences = Array.from(pkg.references).sort().join(`#`);
405
406
  for (const dep of pkg.dependencies) {
407
+ const depReferences = Array.from(dep.references).sort().join(`#`);
406
408
  // We do not want self-references in node_modules, since they confuse existing tools
407
- if (dep === pkg)
409
+ if (dep.identName === pkg.identName && depReferences === pkgReferences)
408
410
  continue;
409
411
  const references = Array.from(dep.references).sort();
410
412
  const locator = { name: dep.identName, reference: references[0] };
@@ -422,7 +424,8 @@ const populateNodeModulesTree = (pnp, hoistedTree, options) => {
422
424
  const workspace = options.project.workspacesByCwd.get(leafNode.target.slice(0, -1));
423
425
  isAnonymousWorkspace = !!(workspace && !workspace.manifest.name);
424
426
  }
425
- if (!dep.name.endsWith(WORKSPACE_NAME_SUFFIX) && !isAnonymousWorkspace) {
427
+ const isCircularSymlink = leafNode.linkType === LinkType.SOFT && nodeModulesLocation.startsWith(leafNode.target);
428
+ if (!dep.name.endsWith(WORKSPACE_NAME_SUFFIX) && !isAnonymousWorkspace && !isCircularSymlink) {
426
429
  const prevNode = tree.get(nodeModulesLocation);
427
430
  if (prevNode) {
428
431
  if (prevNode.dirList) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarnpkg/nm",
3
- "version": "4.0.0-rc.25",
3
+ "version": "4.0.0-rc.27",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "exports": {
@@ -9,11 +9,9 @@
9
9
  },
10
10
  "sideEffects": false,
11
11
  "dependencies": {
12
- "@yarnpkg/core": "^4.0.0-rc.25",
13
- "@yarnpkg/fslib": "^3.0.0-rc.25"
14
- },
15
- "devDependencies": {
16
- "@yarnpkg/pnp": "^4.0.0-rc.25"
12
+ "@yarnpkg/core": "^4.0.0-rc.27",
13
+ "@yarnpkg/fslib": "^3.0.0-rc.27",
14
+ "@yarnpkg/pnp": "^4.0.0-rc.27"
17
15
  },
18
16
  "scripts": {
19
17
  "postpack": "rm -rf lib",