@yarnpkg/nm 4.0.2 → 4.0.4
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/hoist.js +5 -22
- package/package.json +4 -4
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
|
-
|
|
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);
|
|
@@ -192,11 +193,10 @@ const getHoistIdentMap = (rootNode, preferenceMap) => {
|
|
|
192
193
|
if (entry2.hoistPriority !== entry1.hoistPriority) {
|
|
193
194
|
return entry2.hoistPriority - entry1.hoistPriority;
|
|
194
195
|
}
|
|
195
|
-
else if (entry2.peerDependents.size !== entry1.peerDependents.size) {
|
|
196
|
-
return entry2.peerDependents.size - entry1.peerDependents.size;
|
|
197
|
-
}
|
|
198
196
|
else {
|
|
199
|
-
|
|
197
|
+
const entry1Usages = entry1.dependents.size + entry1.peerDependents.size;
|
|
198
|
+
const entry2Usages = entry2.dependents.size + entry2.peerDependents.size;
|
|
199
|
+
return entry2Usages - entry1Usages;
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
202
|
for (const key of keyList) {
|
|
@@ -351,23 +351,6 @@ const getNodeHoistInfo = (rootNode, rootNodePathLocators, nodePath, node, usedDe
|
|
|
351
351
|
reason = `- external soft link with unhoisted dependencies`;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
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
354
|
if (isHoistable) {
|
|
372
355
|
isHoistable = !rootNode.peerNames.has(node.name);
|
|
373
356
|
if (outputReason && !isHoistable) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/nm",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
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.
|
|
13
|
-
"@yarnpkg/fslib": "^3.0
|
|
14
|
-
"@yarnpkg/pnp": "^4.0.
|
|
12
|
+
"@yarnpkg/core": "^4.1.4",
|
|
13
|
+
"@yarnpkg/fslib": "^3.1.0",
|
|
14
|
+
"@yarnpkg/pnp": "^4.0.6"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"postpack": "rm -rf lib",
|