@oclif/core 3.4.1-dev.0 → 3.6.0
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/util/find-root.js +8 -3
- package/package.json +1 -1
package/lib/util/find-root.js
CHANGED
|
@@ -76,9 +76,12 @@ let pnp;
|
|
|
76
76
|
function maybeRequirePnpApi(root) {
|
|
77
77
|
if (pnp)
|
|
78
78
|
return pnp;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
try {
|
|
80
|
+
// eslint-disable-next-line node/no-missing-require
|
|
81
|
+
pnp = require(require.resolve('pnpapi', { paths: [root] }));
|
|
82
|
+
return pnp;
|
|
83
|
+
}
|
|
84
|
+
catch { }
|
|
82
85
|
}
|
|
83
86
|
const getKey = (locator) => JSON.stringify(locator);
|
|
84
87
|
const isPeerDependency = (pkg, parentPkg, name) => getKey(pkg?.packageDependencies.get(name)) === getKey(parentPkg?.packageDependencies.get(name));
|
|
@@ -89,6 +92,8 @@ const isPeerDependency = (pkg, parentPkg, name) => getKey(pkg?.packageDependenci
|
|
|
89
92
|
*/
|
|
90
93
|
function findPnpRoot(name, root) {
|
|
91
94
|
maybeRequirePnpApi(root);
|
|
95
|
+
if (!pnp)
|
|
96
|
+
return;
|
|
92
97
|
const seen = new Set();
|
|
93
98
|
const traverseDependencyTree = (locator, parentPkg) => {
|
|
94
99
|
// Prevent infinite recursion when A depends on B which depends on A
|