@yarnpkg/nm 4.0.1 → 4.0.3

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.
@@ -123,7 +123,7 @@ const buildWorkspaceMap = (pnp) => {
123
123
  const pkg = pnp.getPackageInformation(locator);
124
124
  if (pkg) {
125
125
  const parentLocatorKey = parentLocator ? stringifyLocator(parentLocator) : ``;
126
- if (stringifyLocator(locator) !== parentLocatorKey && pkg.linkType === LinkType.SOFT && !isExternalSoftLink(pkg, locator, pnp, topPkgPortableLocation)) {
126
+ if (stringifyLocator(locator) !== parentLocatorKey && pkg.linkType === LinkType.SOFT && !locator.reference.startsWith(`link:`) && !isExternalSoftLink(pkg, locator, pnp, topPkgPortableLocation)) {
127
127
  const location = getRealPackageLocation(pkg, locator, pnp);
128
128
  const prevLocator = workspaceLikeLocators.get(location);
129
129
  // Give workspaces a priority over portals and other protocols pointing to the same location
package/lib/hoist.js CHANGED
@@ -50,7 +50,8 @@ const hoist = (tree, opts = {}) => {
50
50
  let anotherRoundNeeded = false;
51
51
  let round = 0;
52
52
  do {
53
- anotherRoundNeeded = hoistTo(treeCopy, [treeCopy], new Set([treeCopy.locator]), new Map(), options).anotherRoundNeeded;
53
+ const result = hoistTo(treeCopy, [treeCopy], new Set([treeCopy.locator]), new Map(), options);
54
+ anotherRoundNeeded = result.anotherRoundNeeded || result.isGraphChanged;
54
55
  options.fastLookupPossible = false;
55
56
  round++;
56
57
  } while (anotherRoundNeeded);
@@ -351,23 +352,6 @@ const getNodeHoistInfo = (rootNode, rootNodePathLocators, nodePath, node, usedDe
351
352
  reason = `- external soft link with unhoisted dependencies`;
352
353
  }
353
354
  }
354
- if (isHoistable) {
355
- // Direct workspace dependencies must be hoisted to any common ancestor workspace of all the
356
- // graph paths that include the dependency, because otherwise running app with
357
- // `--preserve-symlinks` will become broken (without this flag the Node.js will pick dependency
358
- // from the ancestor on the file system and with this flag it will pick ancestor from the graph
359
- // and if these ancestors are different, the behavious of the application will be different).
360
- // Another problem, which is prevented - is a creation of multiple hoisting layouts
361
- // for the same workspace, because different dependencies of the same workspace might be hoisted
362
- // differently, depending on the recepient workspace.
363
- // It is difficult to find all common ancestors, but there is one easy to find common ancestor -
364
- // the root workspace, so, for now, we either hoist direct dependencies into the root workspace, or we keep them
365
- // unhoisted, thus we are safe from various pathological cases with `--preserve-symlinks`
366
- isHoistable = parentNode.dependencyKind !== HoisterDependencyKind.WORKSPACE || parentNode.hoistedFrom.has(node.name) || rootNodePathLocators.size === 1;
367
- if (outputReason && !isHoistable) {
368
- reason = parentNode.reasons.get(node.name);
369
- }
370
- }
371
355
  if (isHoistable) {
372
356
  isHoistable = !rootNode.peerNames.has(node.name);
373
357
  if (outputReason && !isHoistable) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarnpkg/nm",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "exports": {
@@ -9,9 +9,9 @@
9
9
  },
10
10
  "sideEffects": false,
11
11
  "dependencies": {
12
- "@yarnpkg/core": "^4.0.2",
13
- "@yarnpkg/fslib": "^3.0.1",
14
- "@yarnpkg/pnp": "^4.0.1"
12
+ "@yarnpkg/core": "^4.1.3",
13
+ "@yarnpkg/fslib": "^3.1.0",
14
+ "@yarnpkg/pnp": "^4.0.6"
15
15
  },
16
16
  "scripts": {
17
17
  "postpack": "rm -rf lib",