forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 3
/
package-graph.patch
24 lines (23 loc) 路 1.08 KB
/
package-graph.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff --git a/index.js b/index.js
index f860af4d2..27c4ce21d 100644
--- a/index.js
+++ b/index.js
@@ -57,8 +57,18 @@ class PackageGraph extends Map {
// Yarn decided to ignore https://github.com/npm/npm/pull/15900 and implemented "link:"
// As they apparently have no intention of being compatible, we have to do it for them.
// @see https://github.com/yarnpkg/yarn/issues/4212
- const spec = graphDependencies[depName].replace(/^link:/, "file:");
+ let spec = graphDependencies[depName].replace(/^link:/, "file:");
+
+ // npa doesn't support the explicit workspace: protocol, supported by
+ // pnpm and Yarn.
+ // https://github.com/lerna/lerna/pull/2450
+ const explicitWorkspace = /^workspace:/.test(spec);
+ if (explicitWorkspace) {
+ spec = spec.replace(/^workspace:/, "");
+ }
+
const resolved = npa.resolve(depName, spec, currentNode.location);
+ resolved.explicitWorkspace = explicitWorkspace;
if (!depNode) {
// it's an external dependency, store the resolution and bail