@teambit/dependency-resolver 1.0.1097 → 1.0.1098
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/dist/hoisted-resolution-bridge.d.ts +38 -6
- package/dist/hoisted-resolution-bridge.js +83 -26
- package/dist/hoisted-resolution-bridge.js.map +1 -1
- package/dist/hoisted-resolution-bridge.spec.js +169 -0
- package/dist/hoisted-resolution-bridge.spec.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/{preview-1786219819000.js → preview-1786365057144.js} +2 -2
- package/package.json +23 -23
|
@@ -27,19 +27,51 @@ export declare function parseRecordedVirtualStoreDir(modulesManifest: string): s
|
|
|
27
27
|
* the root has not escaped it.
|
|
28
28
|
*/
|
|
29
29
|
export declare function isPathInsideOrEqual(child: string, parent: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether two spellings name the same directory. `path.relative` normalizes both sides first, so a
|
|
32
|
+
* trailing separator, a redundant `.`, a relative spelling and - on Windows - a difference in case
|
|
33
|
+
* all compare equal, which string equality would miss. Anything written by hand into `NODE_PATH`
|
|
34
|
+
* arrives in whatever spelling its author chose.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isSamePath(one: string, other: string): boolean;
|
|
30
37
|
export declare function isGlobalVirtualStoreLayout(workspaceRoot: string): boolean;
|
|
31
38
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
39
|
+
* The root of the installation this module runs from: the nearest ancestor that owns a
|
|
40
|
+
* `node_modules/.modules.yaml`. For a bvm-installed bit that is the bvm version directory; for a
|
|
41
|
+
* workspace-provided bit it is the workspace.
|
|
42
|
+
*
|
|
43
|
+
* Two candidate starting points, because Node realpaths module filenames: under the global
|
|
44
|
+
* virtual store this module's `__dirname` is the *store slot* - a dead end with no
|
|
45
|
+
* `.modules.yaml` and no physical path back to the installation. The entry script's
|
|
46
|
+
* `process.argv[1]` is the path *as invoked*, unresolved through symlinks, so for a store-linked
|
|
47
|
+
* installation it still sits inside the installation tree. `__dirname` remains the fallback for
|
|
48
|
+
* setups that invoke bit through a resolved path (and for the copy-shaped installations where it
|
|
49
|
+
* works fine). `undefined` when neither leads to an installation (e.g. running from source).
|
|
50
|
+
*/
|
|
51
|
+
export declare function selfInstallationRoot(): string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Bridge the *running installation's* own directories when that installation is itself linked to
|
|
54
|
+
* the global virtual store - its packages then live in store slots and their phantom requires
|
|
55
|
+
* need the installation's private hoist exactly like a workspace's do. Judged by the same
|
|
56
|
+
* `.modules.yaml` record, read at the installation root. A conventional project-local
|
|
36
57
|
* installation (bvm's default) reads project-local and stays unbridged, so nothing changes for
|
|
37
58
|
* it or for the processes it spawns.
|
|
38
59
|
*/
|
|
39
60
|
export declare function ensureSelfInstallationBridge(): void;
|
|
40
61
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
62
|
+
* The directories a package resolved from `<root>` used to reach by walking up, in the order the
|
|
63
|
+
* walk reached them: the hoisted `node_modules/.pnpm/node_modules` first, then the root's own
|
|
64
|
+
* `node_modules`. Both are lost under the global virtual store, and they hold disjoint sets -
|
|
65
|
+
* pnpm hoists only *non-direct* dependencies, so a direct dependency of the root exists solely in
|
|
66
|
+
* the second. Missing directories are dropped; a root with neither yields an empty list.
|
|
67
|
+
*
|
|
68
|
+
* Shared with the type-resolution side of the bridge, which has to reach the same two directories
|
|
69
|
+
* through the mechanism TypeScript offers instead of `NODE_PATH`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function hoistedResolutionDirs(root: string): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Put the given root's {@link hoistedResolutionDirs} on the resolution path of this process and
|
|
74
|
+
* its children. Idempotent; a no-op when neither directory exists. Callers decide *whether* the
|
|
43
75
|
* root needs the bridge ({@link isGlobalVirtualStoreLayout} for the pre-aspect gate, the
|
|
44
76
|
* dependency-resolver's own config after an install).
|
|
45
77
|
*/
|
|
@@ -5,9 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ensureHoistedDependencyResolution = ensureHoistedDependencyResolution;
|
|
7
7
|
exports.ensureSelfInstallationBridge = ensureSelfInstallationBridge;
|
|
8
|
+
exports.hoistedResolutionDirs = hoistedResolutionDirs;
|
|
8
9
|
exports.isGlobalVirtualStoreLayout = isGlobalVirtualStoreLayout;
|
|
9
10
|
exports.isPathInsideOrEqual = isPathInsideOrEqual;
|
|
11
|
+
exports.isSamePath = isSamePath;
|
|
10
12
|
exports.parseRecordedVirtualStoreDir = parseRecordedVirtualStoreDir;
|
|
13
|
+
exports.selfInstallationRoot = selfInstallationRoot;
|
|
11
14
|
function fs() {
|
|
12
15
|
const data = _interopRequireWildcard(require("fs"));
|
|
13
16
|
fs = function () {
|
|
@@ -42,15 +45,22 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
42
45
|
* This covers phantom dependencies generally, not one class of them. Bit's core aspects are the
|
|
43
46
|
* case that motivated it - `@teambit/*` is required by every published env and aspect without
|
|
44
47
|
* being declared, because it has to be the single copy from the running installation - but any
|
|
45
|
-
* under-declared package in the graph resolves the same way, which is why
|
|
46
|
-
*
|
|
48
|
+
* under-declared package in the graph resolves the same way, which is why whole directories go on
|
|
49
|
+
* the path rather than a hand-picked list.
|
|
50
|
+
*
|
|
51
|
+
* Both directories the walk reached are restored ({@link hoistedResolutionDirs}), because they
|
|
52
|
+
* hold disjoint sets: pnpm hoists only *non-direct* dependencies, so a direct dependency of the
|
|
53
|
+
* root - the workspace's own `mocha`, `react`, `@types/react` - is reachable through the root's
|
|
54
|
+
* `node_modules` and nowhere else.
|
|
47
55
|
*
|
|
48
56
|
* pnpm's answer for this layout is `NODE_PATH` pointing at the hoisted directory, which stays
|
|
49
57
|
* project-local under the global virtual store. pnpm sets it in the command shims it writes, but
|
|
50
58
|
* bit runs from bvm rather than through a shim and loads aspects in its own process, so it has to
|
|
51
59
|
* do this itself. `NODE_PATH` only covers CommonJS; an ESM loader (adapted from pnpm's
|
|
52
60
|
* `@pnpm/plugin-esm-node-path`, MIT) handles the ESM side, registered both in-process via
|
|
53
|
-
* `module.register` and for child processes via a `NODE_OPTIONS --import` flag.
|
|
61
|
+
* `module.register` and for child processes via a `NODE_OPTIONS --import` flag. TypeScript reads
|
|
62
|
+
* neither, so the type-resolution half lives in `@teambit/typescript` and builds its `paths` from
|
|
63
|
+
* the same directories.
|
|
54
64
|
*
|
|
55
65
|
* Two call sites, and both matter:
|
|
56
66
|
* - `bootstrap()` in `@teambit/bit`, before any aspect loads, gated on the layout the last
|
|
@@ -61,10 +71,18 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
61
71
|
* old layout, yet the same process goes on to reload envs and compile from store slots. The
|
|
62
72
|
* installer re-applies the bridge the moment the target layout is known.
|
|
63
73
|
*
|
|
64
|
-
* Everything here is idempotent, so calling it again is always safe:
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
74
|
+
* Everything here is idempotent, so calling it again is always safe: `NODE_PATH` is rebuilt to the
|
|
75
|
+
* same value, the ESM loader re-registers only when the ordered entry list changes, and the
|
|
76
|
+
* process's own `NODE_OPTIONS` flag is replaced rather than stacked.
|
|
77
|
+
*
|
|
78
|
+
* One asymmetry to know about when reading the ESM half. Node runs the *last* registered loader
|
|
79
|
+
* first and it delegates through `defaultResolve` before its own fallback, so an earlier
|
|
80
|
+
* registration resolves anything it can before a later one is consulted. A re-registration
|
|
81
|
+
* therefore corrects what child processes inherit - the `--import` flag carries the current list -
|
|
82
|
+
* while in-process the earlier registration keeps its precedence for the entries it already had.
|
|
83
|
+
* That only diverges from CommonJS for a specifier resolvable from more than one entry across two
|
|
84
|
+
* registrations with different orders, which needs a process bridging two roots in alternating
|
|
85
|
+
* order; the CommonJS half, rebuilt on every call, is always right.
|
|
68
86
|
*/
|
|
69
87
|
|
|
70
88
|
/**
|
|
@@ -72,8 +90,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
72
90
|
* The entries cannot be read from `NODE_PATH` inside the loader: on modern Node the hooks run on
|
|
73
91
|
* a separate thread whose `process.env` is a snapshot taken at registration, so late additions -
|
|
74
92
|
* an install switching the workspace onto the global virtual store mid-process - would never be
|
|
75
|
-
* seen. Injecting the list makes each registration self-contained
|
|
76
|
-
*
|
|
93
|
+
* seen. Injecting the list makes each registration self-contained, at the cost of needing a new
|
|
94
|
+
* registration whenever the list changes - by order as much as by membership, since the loader
|
|
95
|
+
* searches these entries in the order given.
|
|
77
96
|
*/
|
|
78
97
|
const esmNodePathLoaderSource = dirs => `
|
|
79
98
|
import { createRequire } from 'node:module'
|
|
@@ -98,9 +117,10 @@ export async function resolve (specifier, context, defaultResolve) {
|
|
|
98
117
|
}
|
|
99
118
|
// createRequire anchored inside the entry searches the entry itself: Node skips appending
|
|
100
119
|
// /node_modules to a directory already named node_modules, and the parent step re-yields it
|
|
101
|
-
// (.pnpm -> .pnpm/node_modules). Exact for the
|
|
102
|
-
// an entry not named node_modules would be searched one level deeper
|
|
103
|
-
// does - those entries are already covered by the CommonJS side and
|
|
120
|
+
// (.pnpm -> .pnpm/node_modules). Exact for the entries this loader exists for, both of which
|
|
121
|
+
// are named node_modules; an entry not named node_modules would be searched one level deeper
|
|
122
|
+
// than CommonJS NODE_PATH does - those entries are already covered by the CommonJS side and
|
|
123
|
+
// are not ours to fix.
|
|
104
124
|
for (const basePath of extraNodePaths) {
|
|
105
125
|
try {
|
|
106
126
|
const require = createRequire(pathToFileURL(basePath + '/').href)
|
|
@@ -111,7 +131,7 @@ export async function resolve (specifier, context, defaultResolve) {
|
|
|
111
131
|
}
|
|
112
132
|
}
|
|
113
133
|
`;
|
|
114
|
-
|
|
134
|
+
let lastRegisteredEntries;
|
|
115
135
|
let lastImportFlag;
|
|
116
136
|
|
|
117
137
|
/**
|
|
@@ -156,6 +176,16 @@ function isPathInsideOrEqual(child, parent) {
|
|
|
156
176
|
// component-aware traversal check: a child legitimately named `..foo` also starts with `..`
|
|
157
177
|
return !path().isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${path().sep}`);
|
|
158
178
|
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Whether two spellings name the same directory. `path.relative` normalizes both sides first, so a
|
|
182
|
+
* trailing separator, a redundant `.`, a relative spelling and - on Windows - a difference in case
|
|
183
|
+
* all compare equal, which string equality would miss. Anything written by hand into `NODE_PATH`
|
|
184
|
+
* arrives in whatever spelling its author chose.
|
|
185
|
+
*/
|
|
186
|
+
function isSamePath(one, other) {
|
|
187
|
+
return path().relative(one, other) === '';
|
|
188
|
+
}
|
|
159
189
|
function isGlobalVirtualStoreLayout(workspaceRoot) {
|
|
160
190
|
let modulesManifest;
|
|
161
191
|
try {
|
|
@@ -209,10 +239,10 @@ function selfInstallationRoot() {
|
|
|
209
239
|
}
|
|
210
240
|
|
|
211
241
|
/**
|
|
212
|
-
* Bridge the *running installation's* own
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
242
|
+
* Bridge the *running installation's* own directories when that installation is itself linked to
|
|
243
|
+
* the global virtual store - its packages then live in store slots and their phantom requires
|
|
244
|
+
* need the installation's private hoist exactly like a workspace's do. Judged by the same
|
|
245
|
+
* `.modules.yaml` record, read at the installation root. A conventional project-local
|
|
216
246
|
* installation (bvm's default) reads project-local and stays unbridged, so nothing changes for
|
|
217
247
|
* it or for the processes it spawns.
|
|
218
248
|
*/
|
|
@@ -224,17 +254,41 @@ function ensureSelfInstallationBridge() {
|
|
|
224
254
|
}
|
|
225
255
|
|
|
226
256
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
257
|
+
* The directories a package resolved from `<root>` used to reach by walking up, in the order the
|
|
258
|
+
* walk reached them: the hoisted `node_modules/.pnpm/node_modules` first, then the root's own
|
|
259
|
+
* `node_modules`. Both are lost under the global virtual store, and they hold disjoint sets -
|
|
260
|
+
* pnpm hoists only *non-direct* dependencies, so a direct dependency of the root exists solely in
|
|
261
|
+
* the second. Missing directories are dropped; a root with neither yields an empty list.
|
|
262
|
+
*
|
|
263
|
+
* Shared with the type-resolution side of the bridge, which has to reach the same two directories
|
|
264
|
+
* through the mechanism TypeScript offers instead of `NODE_PATH`.
|
|
265
|
+
*/
|
|
266
|
+
function hoistedResolutionDirs(root) {
|
|
267
|
+
return [path().join(root, 'node_modules', '.pnpm', 'node_modules'), path().join(root, 'node_modules')].filter(dir => fs().existsSync(dir));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Put the given root's {@link hoistedResolutionDirs} on the resolution path of this process and
|
|
272
|
+
* its children. Idempotent; a no-op when neither directory exists. Callers decide *whether* the
|
|
229
273
|
* root needs the bridge ({@link isGlobalVirtualStoreLayout} for the pre-aspect gate, the
|
|
230
274
|
* dependency-resolver's own config after an install).
|
|
231
275
|
*/
|
|
232
276
|
function ensureHoistedDependencyResolution(workspaceRoot) {
|
|
233
|
-
const
|
|
234
|
-
if (!
|
|
277
|
+
const dirs = hoistedResolutionDirs(workspaceRoot);
|
|
278
|
+
if (!dirs.length) return;
|
|
235
279
|
const existing = process.env.NODE_PATH;
|
|
236
|
-
|
|
237
|
-
|
|
280
|
+
const untouched = (existing?.split(path().delimiter).filter(Boolean) ?? []).filter(
|
|
281
|
+
// by path rather than by spelling, so an entry naming a directory this bridge owns is replaced
|
|
282
|
+
// by the canonical one instead of being kept alongside it as a redundant search base
|
|
283
|
+
dir => !dirs.some(owned => isSamePath(dir, owned)));
|
|
284
|
+
// rebuilt rather than prepended, because order is resolution order and an entry already present
|
|
285
|
+
// is not necessarily in front of the one it has to beat: a bit that bridged the hoisted
|
|
286
|
+
// directory alone leaves it in `NODE_PATH` for its children, and adding the root's node_modules
|
|
287
|
+
// in front of it there would invert the walk the bridge exists to reproduce. Everything this
|
|
288
|
+
// bridge does not own keeps its relative order, behind what the walk reached first.
|
|
289
|
+
const next = [...dirs, ...untouched].join(path().delimiter);
|
|
290
|
+
if (next !== existing) {
|
|
291
|
+
process.env.NODE_PATH = next;
|
|
238
292
|
// `NODE_PATH` is read once when the module system initializes, so a later assignment only
|
|
239
293
|
// takes effect after re-deriving the global paths.
|
|
240
294
|
require('module')._initPaths();
|
|
@@ -261,10 +315,13 @@ function ensureHoistedDependencyResolution(workspaceRoot) {
|
|
|
261
315
|
function registerEsmNodePathLoader() {
|
|
262
316
|
const nodeModule = require('module');
|
|
263
317
|
if (typeof nodeModule.register !== 'function') return;
|
|
264
|
-
// mirror the CommonJS side exactly: every current NODE_PATH entry participates
|
|
318
|
+
// mirror the CommonJS side exactly: every current NODE_PATH entry participates, in its order
|
|
265
319
|
const dirs = (process.env.NODE_PATH || '').split(path().delimiter).filter(Boolean);
|
|
266
320
|
if (!dirs.length) return;
|
|
267
|
-
|
|
321
|
+
const entries = dirs.join(path().delimiter);
|
|
322
|
+
// ordered, not a set: the loader inlines the list, so a reordering leaves a registration whose
|
|
323
|
+
// precedence no longer matches the one CommonJS now uses
|
|
324
|
+
if (lastImportFlag && entries === lastRegisteredEntries) return;
|
|
268
325
|
const loaderUrl = `data:text/javascript,${encodeURIComponent(esmNodePathLoaderSource(dirs))}`;
|
|
269
326
|
const parentUrl = (0, _url().pathToFileURL)(path().join(process.cwd(), '/')).href;
|
|
270
327
|
try {
|
|
@@ -274,7 +331,7 @@ function registerEsmNodePathLoader() {
|
|
|
274
331
|
// half of the workaround is unaffected, and only ESM packages relying on hoisting are lost.
|
|
275
332
|
return;
|
|
276
333
|
}
|
|
277
|
-
|
|
334
|
+
lastRegisteredEntries = entries;
|
|
278
335
|
const registration = `import{register}from'node:module';register(${JSON.stringify(loaderUrl)},${JSON.stringify(parentUrl)});`;
|
|
279
336
|
const importFlag = `--import=data:text/javascript,${encodeURIComponent(registration)}`;
|
|
280
337
|
// children get one flag carrying the full current set: replace our previous flag rather than
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fs","data","_interopRequireWildcard","require","path","_url","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","esmNodePathLoaderSource","dirs","JSON","stringify","registeredEsmDirs","Set","lastImportFlag","parseRecordedVirtualStoreDir","modulesManifest","parsed","parse","virtualStoreDir","undefined","match","isPathInsideOrEqual","child","parent","rel","relative","isAbsolute","startsWith","sep","isGlobalVirtualStoreLayout","workspaceRoot","readFileSync","join","workspaceRealpath","realpathSync","resolved","resolve","storeRealpath","selfInstallationRoot","candidates","process","argv","__dirname","filter","Boolean","candidate","dir","dirname","existsSync","ensureSelfInstallationBridge","installationRoot","ensureHoistedDependencyResolution","hoistedDir","existing","env","NODE_PATH","split","delimiter","includes","_initPaths","registerEsmNodePathLoader","nodeModule","register","length","every","loaderUrl","encodeURIComponent","parentUrl","pathToFileURL","cwd","href","forEach","add","registration","importFlag","NODE_OPTIONS","replace"],"sources":["hoisted-resolution-bridge.ts"],"sourcesContent":["/**\n * Make a workspace's privately hoisted dependencies resolvable from pnpm's global virtual store.\n *\n * Under the project-local virtual store, a package in `node_modules/.pnpm` resolves anything it\n * requires without declaring it by walking *up* into the workspace - the hoisted\n * `node_modules/.pnpm/node_modules` first, then the workspace root. Under the global virtual\n * store the package lives in a store shared with every other project on the machine, with no\n * workspace above it, so every such require fails.\n *\n * This covers phantom dependencies generally, not one class of them. Bit's core aspects are the\n * case that motivated it - `@teambit/*` is required by every published env and aspect without\n * being declared, because it has to be the single copy from the running installation - but any\n * under-declared package in the graph resolves the same way, which is why the whole hoisted\n * directory goes on the path rather than a hand-picked list.\n *\n * pnpm's answer for this layout is `NODE_PATH` pointing at the hoisted directory, which stays\n * project-local under the global virtual store. pnpm sets it in the command shims it writes, but\n * bit runs from bvm rather than through a shim and loads aspects in its own process, so it has to\n * do this itself. `NODE_PATH` only covers CommonJS; an ESM loader (adapted from pnpm's\n * `@pnpm/plugin-esm-node-path`, MIT) handles the ESM side, registered both in-process via\n * `module.register` and for child processes via a `NODE_OPTIONS --import` flag.\n *\n * Two call sites, and both matter:\n * - `bootstrap()` in `@teambit/bit`, before any aspect loads, gated on the layout the last\n * install recorded ({@link isGlobalVirtualStoreLayout}). It deep-requires this module's dist\n * file directly so CLI startup never pays for the dependency-resolver barrel.\n * - the install flow, right after the package manager finishes: the first install that switches\n * a workspace onto the global virtual store runs with `bootstrap`'s gate still reflecting the\n * old layout, yet the same process goes on to reload envs and compile from store slots. The\n * installer re-applies the bridge the moment the target layout is known.\n *\n * Everything here is idempotent, so calling it again is always safe: the `NODE_PATH` entry is\n * added once, the ESM loader re-registers only when the entry set grows (the previous, subset\n * loader keeps chaining harmlessly), and the process's own `NODE_OPTIONS` flag is replaced\n * rather than stacked.\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { pathToFileURL } from 'url';\n\n/**\n * Source of the registered ESM loader, with the resolution entries injected at registration time.\n * The entries cannot be read from `NODE_PATH` inside the loader: on modern Node the hooks run on\n * a separate thread whose `process.env` is a snapshot taken at registration, so late additions -\n * an install switching the workspace onto the global virtual store mid-process - would never be\n * seen. Injecting the list makes each registration self-contained; when the set grows, a new\n * loader is registered and chains after the previous (whose entries are a subset - harmless).\n */\nconst esmNodePathLoaderSource = (dirs: string[]) => `\nimport { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\nconst extraNodePaths = ${JSON.stringify(dirs)}\n\nexport async function resolve (specifier, context, defaultResolve) {\n try {\n return await defaultResolve(specifier, context, defaultResolve)\n } catch (originalError) {\n // Only bare specifiers can come from the hoisted directory; the rest are already anchored.\n // Windows absolute (drive-letter) and UNC paths are path specifiers too.\n if (\n specifier.startsWith('.') ||\n specifier.startsWith('/') ||\n specifier.startsWith('node:') ||\n specifier.startsWith('\\\\\\\\') ||\n /^[a-zA-Z]:[\\\\\\\\/]/.test(specifier)\n ) {\n throw originalError\n }\n // createRequire anchored inside the entry searches the entry itself: Node skips appending\n // /node_modules to a directory already named node_modules, and the parent step re-yields it\n // (.pnpm -> .pnpm/node_modules). Exact for the hoisted-dir entries this loader exists for;\n // an entry not named node_modules would be searched one level deeper than CommonJS NODE_PATH\n // does - those entries are already covered by the CommonJS side and are not ours to fix.\n for (const basePath of extraNodePaths) {\n try {\n const require = createRequire(pathToFileURL(basePath + '/').href)\n return { url: pathToFileURL(require.resolve(specifier)).href, shortCircuit: true }\n } catch {}\n }\n throw originalError\n }\n}\n`;\n\nconst registeredEsmDirs = new Set<string>();\nlet lastImportFlag: string | undefined;\n\n/**\n * The `virtualStoreDir` pnpm recorded in a `node_modules/.modules.yaml`, or undefined when the\n * manifest records none.\n *\n * Current pnpm writes this manifest as JSON (YAML 1.2 being a superset of it), so the structured\n * read is a plain `JSON.parse` - no dependency, and correct for every value the writer can emit.\n * Older versions wrote block YAML, which the line match handles. A full YAML parser is\n * deliberately avoided: this runs in `bootstrap`, before any command does its work, and parsing\n * the whole manifest costs ~40ms on this repo's own 415KB one against ~0.2ms for the line match\n * (the manifest carries the entire hoisted alias map, so it grows with the dependency graph).\n * Taking a package dependency here would also make the earliest, least recoverable step of CLI\n * startup depend on module resolution - the very thing this module exists to repair.\n */\nexport function parseRecordedVirtualStoreDir(modulesManifest: string): string | undefined {\n try {\n const parsed = JSON.parse(modulesManifest) as { virtualStoreDir?: unknown };\n return typeof parsed.virtualStoreDir === 'string' ? parsed.virtualStoreDir : undefined;\n } catch {\n // not JSON - a block-YAML manifest from an older pnpm\n }\n return modulesManifest.match(/^\\s*\"?virtualStoreDir\"?:\\s*\"?([^\"\\n]+?)\"?,?\\s*$/m)?.[1];\n}\n\n/**\n * Whether the workspace's last install used pnpm's global virtual store, judged by the\n * `virtualStoreDir` the engine records in `node_modules/.modules.yaml`: `.pnpm` (or any path\n * inside the workspace) means project-local; a path escaping the workspace means the global\n * store. No manifest or no recorded value reads as project-local - a workspace that never\n * installed under the global store has nothing to bridge.\n */\n/**\n * Platform-safe path containment: `path.relative` is case-insensitive on Windows (where the\n * filesystem is) and case-sensitive on posix, which a bare `startsWith` prefix check gets wrong\n * for drive-letter casing differences between realpath results and given spellings. Equality\n * counts as inside - every caller asks \"does this path escape that root\", and a path equal to\n * the root has not escaped it.\n */\nexport function isPathInsideOrEqual(child: string, parent: string): boolean {\n const rel = path.relative(parent, child);\n // component-aware traversal check: a child legitimately named `..foo` also starts with `..`\n return !path.isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${path.sep}`);\n}\n\nexport function isGlobalVirtualStoreLayout(workspaceRoot: string): boolean {\n let modulesManifest: string;\n try {\n modulesManifest = fs.readFileSync(path.join(workspaceRoot, 'node_modules', '.modules.yaml'), 'utf8');\n } catch {\n return false;\n }\n const virtualStoreDir = parseRecordedVirtualStoreDir(modulesManifest);\n if (!virtualStoreDir) return false;\n let workspaceRealpath = workspaceRoot;\n try {\n workspaceRealpath = fs.realpathSync(workspaceRoot);\n } catch {\n // fall back to the given spelling\n }\n const resolved = path.resolve(workspaceRealpath, 'node_modules', virtualStoreDir);\n let storeRealpath = resolved;\n try {\n storeRealpath = fs.realpathSync(resolved);\n } catch {\n // dangling recorded dir - judge by the lexical resolution\n }\n return !isPathInsideOrEqual(storeRealpath, workspaceRealpath);\n}\n\n/**\n * The root of the installation this module runs from: the nearest ancestor that owns a\n * `node_modules/.modules.yaml`. For a bvm-installed bit that is the bvm version directory; for a\n * workspace-provided bit it is the workspace.\n *\n * Two candidate starting points, because Node realpaths module filenames: under the global\n * virtual store this module's `__dirname` is the *store slot* - a dead end with no\n * `.modules.yaml` and no physical path back to the installation. The entry script's\n * `process.argv[1]` is the path *as invoked*, unresolved through symlinks, so for a store-linked\n * installation it still sits inside the installation tree. `__dirname` remains the fallback for\n * setups that invoke bit through a resolved path (and for the copy-shaped installations where it\n * works fine). `undefined` when neither leads to an installation (e.g. running from source).\n */\nfunction selfInstallationRoot(): string | undefined {\n const candidates = [process.argv[1], __dirname].filter(Boolean) as string[];\n for (const candidate of candidates) {\n let dir = path.dirname(path.resolve(candidate));\n for (;;) {\n if (fs.existsSync(path.join(dir, 'node_modules', '.modules.yaml'))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n }\n return undefined;\n}\n\n/**\n * Bridge the *running installation's* own hoisted directory when that installation is itself\n * linked to the global virtual store - its packages then live in store slots and their phantom\n * requires need the installation's private hoist exactly like a workspace's do. Judged by the\n * same `.modules.yaml` record, read at the installation root. A conventional project-local\n * installation (bvm's default) reads project-local and stays unbridged, so nothing changes for\n * it or for the processes it spawns.\n */\nexport function ensureSelfInstallationBridge(): void {\n const installationRoot = selfInstallationRoot();\n if (!installationRoot) return;\n if (!isGlobalVirtualStoreLayout(installationRoot)) return;\n ensureHoistedDependencyResolution(installationRoot);\n}\n\n/**\n * Put the given root's hoisted directory on the resolution path of this process and its children.\n * Idempotent; a no-op when the hoisted directory doesn't exist. Callers decide *whether* the\n * root needs the bridge ({@link isGlobalVirtualStoreLayout} for the pre-aspect gate, the\n * dependency-resolver's own config after an install).\n */\nexport function ensureHoistedDependencyResolution(workspaceRoot: string): void {\n const hoistedDir = path.join(workspaceRoot, 'node_modules', '.pnpm', 'node_modules');\n if (!fs.existsSync(hoistedDir)) return;\n const existing = process.env.NODE_PATH;\n if (!existing?.split(path.delimiter).includes(hoistedDir)) {\n process.env.NODE_PATH = existing ? `${hoistedDir}${path.delimiter}${existing}` : hoistedDir;\n // `NODE_PATH` is read once when the module system initializes, so a later assignment only\n // takes effect after re-deriving the global paths.\n (require('module') as { _initPaths(): void })._initPaths();\n }\n registerEsmNodePathLoader();\n}\n\n/**\n * The ESM half of {@link ensureHoistedDependencyResolution}.\n *\n * Node consults `NODE_PATH` only for CommonJS; ESM resolution ignores it entirely. Bit supports\n * ESM components, so without this an ESM package in the store cannot reach the hoisted directory\n * at all and the CommonJS half would only cover part of the problem.\n *\n * Registered two ways, because both matter:\n * - `module.register` for bit's own process, which is where aspects and envs are loaded.\n * - `NODE_OPTIONS`, so the processes bit spawns - env build steps, app servers, test workers -\n * inherit it. They resolve their own dependencies and hit the same wall.\n *\n * The loader is inlined as a data URL rather than taken as a dependency so there is no file to\n * ship and no install step to depend on. `module.register` needs Node 20.6, so this is skipped\n * on older runtimes - the CommonJS half still applies there.\n */\nfunction registerEsmNodePathLoader(): void {\n const nodeModule = require('module') as {\n register?: (specifier: string, parentURL: string) => void;\n };\n if (typeof nodeModule.register !== 'function') return;\n // mirror the CommonJS side exactly: every current NODE_PATH entry participates\n const dirs = (process.env.NODE_PATH || '').split(path.delimiter).filter(Boolean);\n if (!dirs.length) return;\n if (lastImportFlag && dirs.every((dir) => registeredEsmDirs.has(dir))) return;\n const loaderUrl = `data:text/javascript,${encodeURIComponent(esmNodePathLoaderSource(dirs))}`;\n const parentUrl = pathToFileURL(path.join(process.cwd(), '/')).href;\n try {\n nodeModule.register(loaderUrl, parentUrl);\n } catch {\n // A runtime that rejects the loader must not take the whole CLI down with it - the CommonJS\n // half of the workaround is unaffected, and only ESM packages relying on hoisting are lost.\n return;\n }\n dirs.forEach((dir) => registeredEsmDirs.add(dir));\n const registration = `import{register}from'node:module';register(${JSON.stringify(loaderUrl)},${JSON.stringify(parentUrl)});`;\n const importFlag = `--import=data:text/javascript,${encodeURIComponent(registration)}`;\n // children get one flag carrying the full current set: replace our previous flag rather than\n // stacking loaders, and match our own flag exactly - a user's `--require ts-node/register`\n // in NODE_OPTIONS must not suppress the loader's propagation\n if (lastImportFlag && process.env.NODE_OPTIONS?.includes(lastImportFlag)) {\n process.env.NODE_OPTIONS = process.env.NODE_OPTIONS.replace(lastImportFlag, importFlag);\n } else if (!process.env.NODE_OPTIONS?.includes(importFlag)) {\n process.env.NODE_OPTIONS = process.env.NODE_OPTIONS\n ? `${process.env.NODE_OPTIONS} ${importFlag}`\n : importFlag;\n }\n lastImportFlag = importFlag;\n}\n"],"mappings":";;;;;;;;;;AAoCA,SAAAA,GAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,EAA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AA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAtCpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMkB,uBAAuB,GAAIC,IAAc,IAAK;AACpD;AACA;AACA;AACA,yBAAyBC,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMG,iBAAiB,GAAG,IAAIC,GAAG,CAAS,CAAC;AAC3C,IAAIC,cAAkC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,4BAA4BA,CAACC,eAAuB,EAAsB;EACxF,IAAI;IACF,MAAMC,MAAM,GAAGP,IAAI,CAACQ,KAAK,CAACF,eAAe,CAAkC;IAC3E,OAAO,OAAOC,MAAM,CAACE,eAAe,KAAK,QAAQ,GAAGF,MAAM,CAACE,eAAe,GAAGC,SAAS;EACxF,CAAC,CAAC,MAAM;IACN;EAAA;EAEF,OAAOJ,eAAe,CAACK,KAAK,CAAC,kDAAkD,CAAC,GAAG,CAAC,CAAC;AACvF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAACC,KAAa,EAAEC,MAAc,EAAW;EAC1E,MAAMC,GAAG,GAAGtC,IAAI,CAAD,CAAC,CAACuC,QAAQ,CAACF,MAAM,EAAED,KAAK,CAAC;EACxC;EACA,OAAO,CAACp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AiB,CAAC6D,GAAG,CAAC1B,GAAG,CAAC,CAAC;EACjD,MAAM2B,YAAY,GAAG,8CAA8ChE,IAAI,CAACC,SAAS,CAACuD,SAAS,CAAC,IAAIxD,IAAI,CAACC,SAAS,CAACyD,SAAS,CAAC,IAAI;EAC7H,MAAMO,UAAU,GAAG,iCAAiCR,kBAAkB,CAACO,YAAY,CAAC,EAAE;EACtF;EACA;EACA;EACA,IAAI5D,cAAc,IAAI2B,OAAO,CAACc,GAAG,CAACqB,YAAY,EAAEjB,QAAQ,CAAC7C,cAAc,CAAC,EAAE;IACxE2B,OAAO,CAACc,GAAG,CAACqB,YAAY,GAAGnC,OAAO,CAACc,GAAG,CAACqB,YAAY,CAACC,OAAO,CAAC/D,cAAc,EAAE6D,UAAU,CAAC;EACzF,CAAC,MAAM,IAAI,CAAClC,OAAO,CAACc,GAAG,CAACqB,YAAY,EAAEjB,QAAQ,CAACgB,UAAU,CAAC,EAAE;IAC1DlC,OAAO,CAACc,GAAG,CAACqB,YAAY,GAAGnC,OAAO,CAACc,GAAG,CAACqB,YAAY,GAC/C,GAAGnC,OAAO,CAACc,GAAG,CAACqB,YAAY,IAAID,UAAU,EAAE,GAC3CA,UAAU;EAChB;EACA7D,cAAc,GAAG6D,UAAU;AAC7B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["fs","data","_interopRequireWildcard","require","path","_url","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","esmNodePathLoaderSource","dirs","JSON","stringify","lastRegisteredEntries","lastImportFlag","parseRecordedVirtualStoreDir","modulesManifest","parsed","parse","virtualStoreDir","undefined","match","isPathInsideOrEqual","child","parent","rel","relative","isAbsolute","startsWith","sep","isSamePath","one","other","isGlobalVirtualStoreLayout","workspaceRoot","readFileSync","join","workspaceRealpath","realpathSync","resolved","resolve","storeRealpath","selfInstallationRoot","candidates","process","argv","__dirname","filter","Boolean","candidate","dir","dirname","existsSync","ensureSelfInstallationBridge","installationRoot","ensureHoistedDependencyResolution","hoistedResolutionDirs","root","length","existing","env","NODE_PATH","untouched","split","delimiter","some","owned","next","_initPaths","registerEsmNodePathLoader","nodeModule","register","entries","loaderUrl","encodeURIComponent","parentUrl","pathToFileURL","cwd","href","registration","importFlag","NODE_OPTIONS","includes","replace"],"sources":["hoisted-resolution-bridge.ts"],"sourcesContent":["/**\n * Make a workspace's privately hoisted dependencies resolvable from pnpm's global virtual store.\n *\n * Under the project-local virtual store, a package in `node_modules/.pnpm` resolves anything it\n * requires without declaring it by walking *up* into the workspace - the hoisted\n * `node_modules/.pnpm/node_modules` first, then the workspace root. Under the global virtual\n * store the package lives in a store shared with every other project on the machine, with no\n * workspace above it, so every such require fails.\n *\n * This covers phantom dependencies generally, not one class of them. Bit's core aspects are the\n * case that motivated it - `@teambit/*` is required by every published env and aspect without\n * being declared, because it has to be the single copy from the running installation - but any\n * under-declared package in the graph resolves the same way, which is why whole directories go on\n * the path rather than a hand-picked list.\n *\n * Both directories the walk reached are restored ({@link hoistedResolutionDirs}), because they\n * hold disjoint sets: pnpm hoists only *non-direct* dependencies, so a direct dependency of the\n * root - the workspace's own `mocha`, `react`, `@types/react` - is reachable through the root's\n * `node_modules` and nowhere else.\n *\n * pnpm's answer for this layout is `NODE_PATH` pointing at the hoisted directory, which stays\n * project-local under the global virtual store. pnpm sets it in the command shims it writes, but\n * bit runs from bvm rather than through a shim and loads aspects in its own process, so it has to\n * do this itself. `NODE_PATH` only covers CommonJS; an ESM loader (adapted from pnpm's\n * `@pnpm/plugin-esm-node-path`, MIT) handles the ESM side, registered both in-process via\n * `module.register` and for child processes via a `NODE_OPTIONS --import` flag. TypeScript reads\n * neither, so the type-resolution half lives in `@teambit/typescript` and builds its `paths` from\n * the same directories.\n *\n * Two call sites, and both matter:\n * - `bootstrap()` in `@teambit/bit`, before any aspect loads, gated on the layout the last\n * install recorded ({@link isGlobalVirtualStoreLayout}). It deep-requires this module's dist\n * file directly so CLI startup never pays for the dependency-resolver barrel.\n * - the install flow, right after the package manager finishes: the first install that switches\n * a workspace onto the global virtual store runs with `bootstrap`'s gate still reflecting the\n * old layout, yet the same process goes on to reload envs and compile from store slots. The\n * installer re-applies the bridge the moment the target layout is known.\n *\n * Everything here is idempotent, so calling it again is always safe: `NODE_PATH` is rebuilt to the\n * same value, the ESM loader re-registers only when the ordered entry list changes, and the\n * process's own `NODE_OPTIONS` flag is replaced rather than stacked.\n *\n * One asymmetry to know about when reading the ESM half. Node runs the *last* registered loader\n * first and it delegates through `defaultResolve` before its own fallback, so an earlier\n * registration resolves anything it can before a later one is consulted. A re-registration\n * therefore corrects what child processes inherit - the `--import` flag carries the current list -\n * while in-process the earlier registration keeps its precedence for the entries it already had.\n * That only diverges from CommonJS for a specifier resolvable from more than one entry across two\n * registrations with different orders, which needs a process bridging two roots in alternating\n * order; the CommonJS half, rebuilt on every call, is always right.\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { pathToFileURL } from 'url';\n\n/**\n * Source of the registered ESM loader, with the resolution entries injected at registration time.\n * The entries cannot be read from `NODE_PATH` inside the loader: on modern Node the hooks run on\n * a separate thread whose `process.env` is a snapshot taken at registration, so late additions -\n * an install switching the workspace onto the global virtual store mid-process - would never be\n * seen. Injecting the list makes each registration self-contained, at the cost of needing a new\n * registration whenever the list changes - by order as much as by membership, since the loader\n * searches these entries in the order given.\n */\nconst esmNodePathLoaderSource = (dirs: string[]) => `\nimport { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\nconst extraNodePaths = ${JSON.stringify(dirs)}\n\nexport async function resolve (specifier, context, defaultResolve) {\n try {\n return await defaultResolve(specifier, context, defaultResolve)\n } catch (originalError) {\n // Only bare specifiers can come from the hoisted directory; the rest are already anchored.\n // Windows absolute (drive-letter) and UNC paths are path specifiers too.\n if (\n specifier.startsWith('.') ||\n specifier.startsWith('/') ||\n specifier.startsWith('node:') ||\n specifier.startsWith('\\\\\\\\') ||\n /^[a-zA-Z]:[\\\\\\\\/]/.test(specifier)\n ) {\n throw originalError\n }\n // createRequire anchored inside the entry searches the entry itself: Node skips appending\n // /node_modules to a directory already named node_modules, and the parent step re-yields it\n // (.pnpm -> .pnpm/node_modules). Exact for the entries this loader exists for, both of which\n // are named node_modules; an entry not named node_modules would be searched one level deeper\n // than CommonJS NODE_PATH does - those entries are already covered by the CommonJS side and\n // are not ours to fix.\n for (const basePath of extraNodePaths) {\n try {\n const require = createRequire(pathToFileURL(basePath + '/').href)\n return { url: pathToFileURL(require.resolve(specifier)).href, shortCircuit: true }\n } catch {}\n }\n throw originalError\n }\n}\n`;\n\nlet lastRegisteredEntries: string | undefined;\nlet lastImportFlag: string | undefined;\n\n/**\n * The `virtualStoreDir` pnpm recorded in a `node_modules/.modules.yaml`, or undefined when the\n * manifest records none.\n *\n * Current pnpm writes this manifest as JSON (YAML 1.2 being a superset of it), so the structured\n * read is a plain `JSON.parse` - no dependency, and correct for every value the writer can emit.\n * Older versions wrote block YAML, which the line match handles. A full YAML parser is\n * deliberately avoided: this runs in `bootstrap`, before any command does its work, and parsing\n * the whole manifest costs ~40ms on this repo's own 415KB one against ~0.2ms for the line match\n * (the manifest carries the entire hoisted alias map, so it grows with the dependency graph).\n * Taking a package dependency here would also make the earliest, least recoverable step of CLI\n * startup depend on module resolution - the very thing this module exists to repair.\n */\nexport function parseRecordedVirtualStoreDir(modulesManifest: string): string | undefined {\n try {\n const parsed = JSON.parse(modulesManifest) as { virtualStoreDir?: unknown };\n return typeof parsed.virtualStoreDir === 'string' ? parsed.virtualStoreDir : undefined;\n } catch {\n // not JSON - a block-YAML manifest from an older pnpm\n }\n return modulesManifest.match(/^\\s*\"?virtualStoreDir\"?:\\s*\"?([^\"\\n]+?)\"?,?\\s*$/m)?.[1];\n}\n\n/**\n * Whether the workspace's last install used pnpm's global virtual store, judged by the\n * `virtualStoreDir` the engine records in `node_modules/.modules.yaml`: `.pnpm` (or any path\n * inside the workspace) means project-local; a path escaping the workspace means the global\n * store. No manifest or no recorded value reads as project-local - a workspace that never\n * installed under the global store has nothing to bridge.\n */\n/**\n * Platform-safe path containment: `path.relative` is case-insensitive on Windows (where the\n * filesystem is) and case-sensitive on posix, which a bare `startsWith` prefix check gets wrong\n * for drive-letter casing differences between realpath results and given spellings. Equality\n * counts as inside - every caller asks \"does this path escape that root\", and a path equal to\n * the root has not escaped it.\n */\nexport function isPathInsideOrEqual(child: string, parent: string): boolean {\n const rel = path.relative(parent, child);\n // component-aware traversal check: a child legitimately named `..foo` also starts with `..`\n return !path.isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${path.sep}`);\n}\n\n/**\n * Whether two spellings name the same directory. `path.relative` normalizes both sides first, so a\n * trailing separator, a redundant `.`, a relative spelling and - on Windows - a difference in case\n * all compare equal, which string equality would miss. Anything written by hand into `NODE_PATH`\n * arrives in whatever spelling its author chose.\n */\nexport function isSamePath(one: string, other: string): boolean {\n return path.relative(one, other) === '';\n}\n\nexport function isGlobalVirtualStoreLayout(workspaceRoot: string): boolean {\n let modulesManifest: string;\n try {\n modulesManifest = fs.readFileSync(path.join(workspaceRoot, 'node_modules', '.modules.yaml'), 'utf8');\n } catch {\n return false;\n }\n const virtualStoreDir = parseRecordedVirtualStoreDir(modulesManifest);\n if (!virtualStoreDir) return false;\n let workspaceRealpath = workspaceRoot;\n try {\n workspaceRealpath = fs.realpathSync(workspaceRoot);\n } catch {\n // fall back to the given spelling\n }\n const resolved = path.resolve(workspaceRealpath, 'node_modules', virtualStoreDir);\n let storeRealpath = resolved;\n try {\n storeRealpath = fs.realpathSync(resolved);\n } catch {\n // dangling recorded dir - judge by the lexical resolution\n }\n return !isPathInsideOrEqual(storeRealpath, workspaceRealpath);\n}\n\n/**\n * The root of the installation this module runs from: the nearest ancestor that owns a\n * `node_modules/.modules.yaml`. For a bvm-installed bit that is the bvm version directory; for a\n * workspace-provided bit it is the workspace.\n *\n * Two candidate starting points, because Node realpaths module filenames: under the global\n * virtual store this module's `__dirname` is the *store slot* - a dead end with no\n * `.modules.yaml` and no physical path back to the installation. The entry script's\n * `process.argv[1]` is the path *as invoked*, unresolved through symlinks, so for a store-linked\n * installation it still sits inside the installation tree. `__dirname` remains the fallback for\n * setups that invoke bit through a resolved path (and for the copy-shaped installations where it\n * works fine). `undefined` when neither leads to an installation (e.g. running from source).\n */\nexport function selfInstallationRoot(): string | undefined {\n const candidates = [process.argv[1], __dirname].filter(Boolean) as string[];\n for (const candidate of candidates) {\n let dir = path.dirname(path.resolve(candidate));\n for (;;) {\n if (fs.existsSync(path.join(dir, 'node_modules', '.modules.yaml'))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n }\n return undefined;\n}\n\n/**\n * Bridge the *running installation's* own directories when that installation is itself linked to\n * the global virtual store - its packages then live in store slots and their phantom requires\n * need the installation's private hoist exactly like a workspace's do. Judged by the same\n * `.modules.yaml` record, read at the installation root. A conventional project-local\n * installation (bvm's default) reads project-local and stays unbridged, so nothing changes for\n * it or for the processes it spawns.\n */\nexport function ensureSelfInstallationBridge(): void {\n const installationRoot = selfInstallationRoot();\n if (!installationRoot) return;\n if (!isGlobalVirtualStoreLayout(installationRoot)) return;\n ensureHoistedDependencyResolution(installationRoot);\n}\n\n/**\n * The directories a package resolved from `<root>` used to reach by walking up, in the order the\n * walk reached them: the hoisted `node_modules/.pnpm/node_modules` first, then the root's own\n * `node_modules`. Both are lost under the global virtual store, and they hold disjoint sets -\n * pnpm hoists only *non-direct* dependencies, so a direct dependency of the root exists solely in\n * the second. Missing directories are dropped; a root with neither yields an empty list.\n *\n * Shared with the type-resolution side of the bridge, which has to reach the same two directories\n * through the mechanism TypeScript offers instead of `NODE_PATH`.\n */\nexport function hoistedResolutionDirs(root: string): string[] {\n return [path.join(root, 'node_modules', '.pnpm', 'node_modules'), path.join(root, 'node_modules')].filter((dir) =>\n fs.existsSync(dir)\n );\n}\n\n/**\n * Put the given root's {@link hoistedResolutionDirs} on the resolution path of this process and\n * its children. Idempotent; a no-op when neither directory exists. Callers decide *whether* the\n * root needs the bridge ({@link isGlobalVirtualStoreLayout} for the pre-aspect gate, the\n * dependency-resolver's own config after an install).\n */\nexport function ensureHoistedDependencyResolution(workspaceRoot: string): void {\n const dirs = hoistedResolutionDirs(workspaceRoot);\n if (!dirs.length) return;\n const existing = process.env.NODE_PATH;\n const untouched = (existing?.split(path.delimiter).filter(Boolean) ?? []).filter(\n // by path rather than by spelling, so an entry naming a directory this bridge owns is replaced\n // by the canonical one instead of being kept alongside it as a redundant search base\n (dir) => !dirs.some((owned) => isSamePath(dir, owned))\n );\n // rebuilt rather than prepended, because order is resolution order and an entry already present\n // is not necessarily in front of the one it has to beat: a bit that bridged the hoisted\n // directory alone leaves it in `NODE_PATH` for its children, and adding the root's node_modules\n // in front of it there would invert the walk the bridge exists to reproduce. Everything this\n // bridge does not own keeps its relative order, behind what the walk reached first.\n const next = [...dirs, ...untouched].join(path.delimiter);\n if (next !== existing) {\n process.env.NODE_PATH = next;\n // `NODE_PATH` is read once when the module system initializes, so a later assignment only\n // takes effect after re-deriving the global paths.\n (require('module') as { _initPaths(): void })._initPaths();\n }\n registerEsmNodePathLoader();\n}\n\n/**\n * The ESM half of {@link ensureHoistedDependencyResolution}.\n *\n * Node consults `NODE_PATH` only for CommonJS; ESM resolution ignores it entirely. Bit supports\n * ESM components, so without this an ESM package in the store cannot reach the hoisted directory\n * at all and the CommonJS half would only cover part of the problem.\n *\n * Registered two ways, because both matter:\n * - `module.register` for bit's own process, which is where aspects and envs are loaded.\n * - `NODE_OPTIONS`, so the processes bit spawns - env build steps, app servers, test workers -\n * inherit it. They resolve their own dependencies and hit the same wall.\n *\n * The loader is inlined as a data URL rather than taken as a dependency so there is no file to\n * ship and no install step to depend on. `module.register` needs Node 20.6, so this is skipped\n * on older runtimes - the CommonJS half still applies there.\n */\nfunction registerEsmNodePathLoader(): void {\n const nodeModule = require('module') as {\n register?: (specifier: string, parentURL: string) => void;\n };\n if (typeof nodeModule.register !== 'function') return;\n // mirror the CommonJS side exactly: every current NODE_PATH entry participates, in its order\n const dirs = (process.env.NODE_PATH || '').split(path.delimiter).filter(Boolean);\n if (!dirs.length) return;\n const entries = dirs.join(path.delimiter);\n // ordered, not a set: the loader inlines the list, so a reordering leaves a registration whose\n // precedence no longer matches the one CommonJS now uses\n if (lastImportFlag && entries === lastRegisteredEntries) return;\n const loaderUrl = `data:text/javascript,${encodeURIComponent(esmNodePathLoaderSource(dirs))}`;\n const parentUrl = pathToFileURL(path.join(process.cwd(), '/')).href;\n try {\n nodeModule.register(loaderUrl, parentUrl);\n } catch {\n // A runtime that rejects the loader must not take the whole CLI down with it - the CommonJS\n // half of the workaround is unaffected, and only ESM packages relying on hoisting are lost.\n return;\n }\n lastRegisteredEntries = entries;\n const registration = `import{register}from'node:module';register(${JSON.stringify(loaderUrl)},${JSON.stringify(parentUrl)});`;\n const importFlag = `--import=data:text/javascript,${encodeURIComponent(registration)}`;\n // children get one flag carrying the full current set: replace our previous flag rather than\n // stacking loaders, and match our own flag exactly - a user's `--require ts-node/register`\n // in NODE_OPTIONS must not suppress the loader's propagation\n if (lastImportFlag && process.env.NODE_OPTIONS?.includes(lastImportFlag)) {\n process.env.NODE_OPTIONS = process.env.NODE_OPTIONS.replace(lastImportFlag, importFlag);\n } else if (!process.env.NODE_OPTIONS?.includes(importFlag)) {\n process.env.NODE_OPTIONS = process.env.NODE_OPTIONS ? `${process.env.NODE_OPTIONS} ${importFlag}` : importFlag;\n }\n lastImportFlag = importFlag;\n}\n"],"mappings":";;;;;;;;;;;;;AAmDA,SAAAA,GAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,EAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMkB,uBAAuB,GAAIC,IAAc,IAAK;AACpD;AACA;AACA;AACA,yBAAyBC,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,IAAIG,qBAAyC;AAC7C,IAAIC,cAAkC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,4BAA4BA,CAACC,eAAuB,EAAsB;EACxF,IAAI;IACF,MAAMC,MAAM,GAAGN,IAAI,CAACO,KAAK,CAACF,eAAe,CAAkC;IAC3E,OAAO,OAAOC,MAAM,CAACE,eAAe,KAAK,QAAQ,GAAGF,MAAM,CAACE,eAAe,GAAGC,SAAS;EACxF,CAAC,CAAC,MAAM;IACN;EAAA;EAEF,OAAOJ,eAAe,CAACK,KAAK,CAAC,kDAAkD,CAAC,GAAG,CAAC,CAAC;AACvF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAACC,KAAa,EAAEC,MAAc,EAAW;EAC1E,MAAMC,GAAG,GAAGrC,IAAI,CAAD,CAAC,CAACsC,QAAQ,CAACF,MAAM,EAAED,KAAK,CAAC;EACxC;EACA,OAAO,CAACnC,IAAI,CAAD,CAAC,CAACuC,UAAU,CAACF,GAAG,CAAC,IAAIA,GAAG,KAAK,IAAI,IAAI,CAACA,GAAG,CAACG,UAAU,CAAC,KAAKxC,IAAI,CAAD,CAAC,CAACyC,GAAG,EAA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AG,CAACqB,YAAY,IAAID,UAAU,EAAE,GAAGA,UAAU;EAChH;EACAlE,cAAc,GAAGkE,UAAU;AAC7B","ignoreList":[]}
|
|
@@ -7,6 +7,27 @@ function _chai() {
|
|
|
7
7
|
};
|
|
8
8
|
return data;
|
|
9
9
|
}
|
|
10
|
+
function _fsExtra() {
|
|
11
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
12
|
+
_fsExtra = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function _module() {
|
|
18
|
+
const data = _interopRequireDefault(require("module"));
|
|
19
|
+
_module = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _os() {
|
|
25
|
+
const data = _interopRequireDefault(require("os"));
|
|
26
|
+
_os = function () {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
10
31
|
function _path() {
|
|
11
32
|
const data = _interopRequireDefault(require("path"));
|
|
12
33
|
_path = function () {
|
|
@@ -60,5 +81,153 @@ describe('parseRecordedVirtualStoreDir()', () => {
|
|
|
60
81
|
}))).to.eq(undefined);
|
|
61
82
|
});
|
|
62
83
|
});
|
|
84
|
+
describe('hoistedResolutionDirs()', () => {
|
|
85
|
+
let root;
|
|
86
|
+
const hoisted = () => _path().default.join(root, 'node_modules', '.pnpm', 'node_modules');
|
|
87
|
+
const rootModules = () => _path().default.join(root, 'node_modules');
|
|
88
|
+
beforeEach(() => {
|
|
89
|
+
root = _fsExtra().default.mkdtempSync(_path().default.join(_os().default.tmpdir(), 'hoisted-resolution-dirs-'));
|
|
90
|
+
});
|
|
91
|
+
afterEach(() => _fsExtra().default.removeSync(root));
|
|
92
|
+
it('should return both directories in the order the walk reached them', () => {
|
|
93
|
+
_fsExtra().default.ensureDirSync(hoisted());
|
|
94
|
+
(0, _chai().expect)((0, _hoistedResolutionBridge().hoistedResolutionDirs)(root)).to.deep.eq([hoisted(), rootModules()]);
|
|
95
|
+
});
|
|
96
|
+
it('should keep the root node_modules when nothing was hoisted', () => {
|
|
97
|
+
_fsExtra().default.ensureDirSync(rootModules());
|
|
98
|
+
(0, _chai().expect)((0, _hoistedResolutionBridge().hoistedResolutionDirs)(root)).to.deep.eq([rootModules()]);
|
|
99
|
+
});
|
|
100
|
+
it('should return nothing for a root that was never installed', () => {
|
|
101
|
+
(0, _chai().expect)((0, _hoistedResolutionBridge().hoistedResolutionDirs)(root)).to.deep.eq([]);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe('ensureHoistedDependencyResolution()', () => {
|
|
105
|
+
let root;
|
|
106
|
+
let nodePath;
|
|
107
|
+
let nodeOptions;
|
|
108
|
+
let register;
|
|
109
|
+
// the two process-global side effects of the function under test, neither of them scoped to a
|
|
110
|
+
// test: `_initPaths()` rederives Module.globalPaths from NODE_PATH, and `module.register()`
|
|
111
|
+
// installs an ESM loader that cannot be removed for the life of the process
|
|
112
|
+
const nodeModule = _module().default;
|
|
113
|
+
const hoisted = () => _path().default.join(root, 'node_modules', '.pnpm', 'node_modules');
|
|
114
|
+
const rootModules = () => _path().default.join(root, 'node_modules');
|
|
115
|
+
const entries = () => (process.env.NODE_PATH ?? '').split(_path().default.delimiter).filter(Boolean);
|
|
116
|
+
beforeEach(() => {
|
|
117
|
+
root = _fsExtra().default.mkdtempSync(_path().default.join(_os().default.tmpdir(), 'ensure-hoisted-resolution-'));
|
|
118
|
+
_fsExtra().default.ensureDirSync(hoisted());
|
|
119
|
+
nodePath = process.env.NODE_PATH;
|
|
120
|
+
nodeOptions = process.env.NODE_OPTIONS;
|
|
121
|
+
// these cases are about NODE_PATH order; taking `register` away keeps the ESM half - the
|
|
122
|
+
// irreversible half - out of the test process, through the same guard that carries older
|
|
123
|
+
// runtimes
|
|
124
|
+
register = nodeModule.register;
|
|
125
|
+
nodeModule.register = undefined;
|
|
126
|
+
});
|
|
127
|
+
afterEach(() => {
|
|
128
|
+
if (nodePath === undefined) delete process.env.NODE_PATH;else process.env.NODE_PATH = nodePath;
|
|
129
|
+
if (nodeOptions === undefined) delete process.env.NODE_OPTIONS;else process.env.NODE_OPTIONS = nodeOptions;
|
|
130
|
+
nodeModule.register = register;
|
|
131
|
+
// restoring the variable is not enough: the resolver reads the paths derived from it, which
|
|
132
|
+
// would otherwise still point into the directory removed on the next line
|
|
133
|
+
nodeModule._initPaths();
|
|
134
|
+
_fsExtra().default.removeSync(root);
|
|
135
|
+
});
|
|
136
|
+
it('should put both directories in walk order', () => {
|
|
137
|
+
delete process.env.NODE_PATH;
|
|
138
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(root);
|
|
139
|
+
(0, _chai().expect)(entries()).to.deep.eq([hoisted(), rootModules()]);
|
|
140
|
+
});
|
|
141
|
+
it('should reorder entries a previous bridge left in the wrong order', () => {
|
|
142
|
+
// a bit that bridged the hoisted directory alone leaves it in NODE_PATH for its children;
|
|
143
|
+
// adding the root's node_modules in front of it there would invert the walk
|
|
144
|
+
process.env.NODE_PATH = hoisted();
|
|
145
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(root);
|
|
146
|
+
(0, _chai().expect)(entries()).to.deep.eq([hoisted(), rootModules()]);
|
|
147
|
+
});
|
|
148
|
+
it('should keep entries it does not own, behind its own', () => {
|
|
149
|
+
const foreign = _path().default.join(root, 'somewhere-else');
|
|
150
|
+
process.env.NODE_PATH = [rootModules(), foreign].join(_path().default.delimiter);
|
|
151
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(root);
|
|
152
|
+
(0, _chai().expect)(entries()).to.deep.eq([hoisted(), rootModules(), foreign]);
|
|
153
|
+
});
|
|
154
|
+
it('should replace an entry that names an owned directory in another spelling', () => {
|
|
155
|
+
process.env.NODE_PATH = [`${rootModules()}${_path().default.sep}`, `${hoisted()}${_path().default.sep}.`].join(_path().default.delimiter);
|
|
156
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(root);
|
|
157
|
+
(0, _chai().expect)(entries()).to.deep.eq([hoisted(), rootModules()]);
|
|
158
|
+
});
|
|
159
|
+
it('should leave NODE_PATH untouched when it already reads correctly', () => {
|
|
160
|
+
process.env.NODE_PATH = [hoisted(), rootModules()].join(_path().default.delimiter);
|
|
161
|
+
const before = process.env.NODE_PATH;
|
|
162
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(root);
|
|
163
|
+
(0, _chai().expect)(process.env.NODE_PATH).to.eq(before);
|
|
164
|
+
});
|
|
165
|
+
it('should do nothing for a root that was never installed', () => {
|
|
166
|
+
const bare = _fsExtra().default.mkdtempSync(_path().default.join(_os().default.tmpdir(), 'ensure-hoisted-resolution-bare-'));
|
|
167
|
+
delete process.env.NODE_PATH;
|
|
168
|
+
try {
|
|
169
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(bare);
|
|
170
|
+
(0, _chai().expect)(process.env.NODE_PATH).to.eq(undefined);
|
|
171
|
+
} finally {
|
|
172
|
+
_fsExtra().default.removeSync(bare);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
describe('ensureHoistedDependencyResolution() esm registration', () => {
|
|
177
|
+
let first;
|
|
178
|
+
let second;
|
|
179
|
+
let nodePath;
|
|
180
|
+
let nodeOptions;
|
|
181
|
+
let register;
|
|
182
|
+
const nodeModule = _module().default;
|
|
183
|
+
const flag = () => (process.env.NODE_OPTIONS ?? '').match(/--import=\S+/)?.[0];
|
|
184
|
+
beforeEach(() => {
|
|
185
|
+
first = _fsExtra().default.mkdtempSync(_path().default.join(_os().default.tmpdir(), 'esm-registration-first-'));
|
|
186
|
+
second = _fsExtra().default.mkdtempSync(_path().default.join(_os().default.tmpdir(), 'esm-registration-second-'));
|
|
187
|
+
[first, second].forEach(root => _fsExtra().default.ensureDirSync(_path().default.join(root, 'node_modules', '.pnpm', 'node_modules')));
|
|
188
|
+
nodePath = process.env.NODE_PATH;
|
|
189
|
+
nodeOptions = process.env.NODE_OPTIONS;
|
|
190
|
+
delete process.env.NODE_PATH;
|
|
191
|
+
delete process.env.NODE_OPTIONS;
|
|
192
|
+
register = nodeModule.register;
|
|
193
|
+
// a no-op keeps the body running - the flag is what these cases are about - without leaving a
|
|
194
|
+
// loader registered on the process
|
|
195
|
+
nodeModule.register = () => {};
|
|
196
|
+
});
|
|
197
|
+
afterEach(() => {
|
|
198
|
+
if (nodePath === undefined) delete process.env.NODE_PATH;else process.env.NODE_PATH = nodePath;
|
|
199
|
+
if (nodeOptions === undefined) delete process.env.NODE_OPTIONS;else process.env.NODE_OPTIONS = nodeOptions;
|
|
200
|
+
nodeModule.register = register;
|
|
201
|
+
nodeModule._initPaths();
|
|
202
|
+
[first, second].forEach(root => _fsExtra().default.removeSync(root));
|
|
203
|
+
});
|
|
204
|
+
it('should hand children a flag carrying the order NODE_PATH now reads', () => {
|
|
205
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(first);
|
|
206
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(second);
|
|
207
|
+
const beforeReorder = flag();
|
|
208
|
+
// bridging the first root again moves its directories back to the front, so the list the
|
|
209
|
+
// loader was registered with no longer matches the one CommonJS resolves through
|
|
210
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(first);
|
|
211
|
+
(0, _chai().expect)(flag()).to.not.eq(beforeReorder);
|
|
212
|
+
});
|
|
213
|
+
it('should leave the flag alone when nothing about the list changed', () => {
|
|
214
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(first);
|
|
215
|
+
const unchanged = flag();
|
|
216
|
+
(0, _hoistedResolutionBridge().ensureHoistedDependencyResolution)(first);
|
|
217
|
+
(0, _chai().expect)(flag()).to.eq(unchanged);
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
describe('isSamePath()', () => {
|
|
221
|
+
const dir = _path().default.resolve('/base', 'node_modules');
|
|
222
|
+
it('should ignore a trailing separator', () => {
|
|
223
|
+
(0, _chai().expect)((0, _hoistedResolutionBridge().isSamePath)(`${dir}${_path().default.sep}`, dir)).to.eq(true);
|
|
224
|
+
});
|
|
225
|
+
it('should ignore a redundant current-directory segment', () => {
|
|
226
|
+
(0, _chai().expect)((0, _hoistedResolutionBridge().isSamePath)(_path().default.join(dir, '.'), dir)).to.eq(true);
|
|
227
|
+
});
|
|
228
|
+
it('should separate genuinely different directories', () => {
|
|
229
|
+
(0, _chai().expect)((0, _hoistedResolutionBridge().isSamePath)(_path().default.join(dir, 'nested'), dir)).to.eq(false);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
63
232
|
|
|
64
233
|
//# sourceMappingURL=hoisted-resolution-bridge.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chai","data","require","_path","_interopRequireDefault","_hoistedResolutionBridge","e","__esModule","default","describe","base","path","resolve","it","expect","isPathInsideOrEqual","join","to","eq","dirname","manifest","JSON","stringify","hoistedDependencies","virtualStoreDir","parseRecordedVirtualStoreDir","undefined","layoutVersion"],"sources":["hoisted-resolution-bridge.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport path from 'path';\nimport { isPathInsideOrEqual, parseRecordedVirtualStoreDir } from './hoisted-resolution-bridge';\n\ndescribe('isPathInsideOrEqual()', () => {\n const base = path.resolve('/base');\n it('should count a descendant as inside', () => {\n expect(isPathInsideOrEqual(path.join(base, 'child'), base)).to.eq(true);\n });\n it('should count a descendant whose name starts with dots as inside', () => {\n expect(isPathInsideOrEqual(path.join(base, '..foo', 'child'), base)).to.eq(true);\n });\n it('should count the parent itself as inside', () => {\n expect(isPathInsideOrEqual(base, base)).to.eq(true);\n });\n it('should count an ancestor as outside', () => {\n expect(isPathInsideOrEqual(path.dirname(base), base)).to.eq(false);\n });\n it('should count a sibling as outside', () => {\n expect(isPathInsideOrEqual(path.join(path.dirname(base), 'sibling'), base)).to.eq(false);\n });\n});\n\ndescribe('parseRecordedVirtualStoreDir()', () => {\n it('should read the JSON manifest current pnpm writes', () => {\n const manifest = JSON.stringify({ hoistedDependencies: {}, virtualStoreDir: '../../store/v11/links' }, null, 2);\n expect(parseRecordedVirtualStoreDir(manifest)).to.eq('../../store/v11/links');\n });\n it('should read a block-YAML manifest from an older pnpm', () => {\n expect(parseRecordedVirtualStoreDir('layoutVersion: 5\\nvirtualStoreDir: .pnpm\\n')).to.eq('.pnpm');\n });\n it('should not confuse virtualStoreDirMaxLength for the store dir', () => {\n expect(parseRecordedVirtualStoreDir('virtualStoreDirMaxLength: 120\\n')).to.eq(undefined);\n });\n it('should return undefined when the manifest records no store dir', () => {\n expect(parseRecordedVirtualStoreDir(JSON.stringify({ layoutVersion: 5 }))).to.eq(undefined);\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,yBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,wBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgG,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhGG,QAAQ,CAAC,uBAAuB,EAAE,MAAM;EACtC,MAAMC,IAAI,GAAGC,eAAI,CAACC,OAAO,CAAC,OAAO,CAAC;EAClCC,EAAE,CAAC,qCAAqC,EAAE,MAAM;IAC9C,IAAAC,cAAM,EAAC,IAAAC,8CAAmB,EAACJ,eAAI,CAACK,IAAI,CAACN,IAAI,EAAE,OAA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cAAM,EAAC,IAAAW,uDAA4B,EAACL,QAAQ,CAAC,CAAC,CAACH,EAAE,CAACC,EAAE,CAAC,uBAAuB,CAAC;EAC/E,CAAC,CAAC;EACFL,EAAE,CAAC,sDAAsD,EAAE,MAAM;IAC/D,IAAAC,cAAM,EAAC,IAAAW,uDAA4B,EAAC,4CAA4C,CAAC,CAAC,CAACR,EAAE,CAACC,EAAE,CAAC,OAAO,CAAC;EACnG,CAAC,CAAC;EACFL,EAAE,CAAC,+DAA+D,EAAE,MAAM;IACxE,IAAAC,cAAM,EAAC,IAAAW,uDAA4B,EAAC,iCAAiC,CAAC,CAAC,CAACR,EAAE,CAACC,EAAE,CAACQ,SAAS,CAAC;EAC1F,CAAC,CAAC;EACFb,EAAE,CAAC,gEAAgE,EAAE,MAAM;IACzE,IAAAC,cAAM,EAAC,IAAAW,uDAA4B,EAACJ,IAAI,CAACC,SAAS,CAAC;MAAEK,aAAa,EAAE;IAAE,CAAC,CAAC,CAAC,CAAC,CAACV,EAAE,CAACC,EAAE,CAACQ,SAAS,CAAC;EAC7F,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_fsExtra","_interopRequireDefault","_module","_os","_path","_hoistedResolutionBridge","e","__esModule","default","describe","base","path","resolve","it","expect","isPathInsideOrEqual","join","to","eq","dirname","manifest","JSON","stringify","hoistedDependencies","virtualStoreDir","parseRecordedVirtualStoreDir","undefined","layoutVersion","root","hoisted","rootModules","beforeEach","fs","mkdtempSync","os","tmpdir","afterEach","removeSync","ensureDirSync","hoistedResolutionDirs","deep","nodePath","nodeOptions","register","nodeModule","Module","entries","process","env","NODE_PATH","split","delimiter","filter","Boolean","NODE_OPTIONS","_initPaths","ensureHoistedDependencyResolution","foreign","sep","before","bare","first","second","flag","match","forEach","beforeReorder","not","unchanged","dir","isSamePath"],"sources":["hoisted-resolution-bridge.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport fs from 'fs-extra';\nimport Module from 'module';\nimport os from 'os';\nimport path from 'path';\nimport {\n ensureHoistedDependencyResolution,\n hoistedResolutionDirs,\n isPathInsideOrEqual,\n isSamePath,\n parseRecordedVirtualStoreDir,\n} from './hoisted-resolution-bridge';\n\ndescribe('isPathInsideOrEqual()', () => {\n const base = path.resolve('/base');\n it('should count a descendant as inside', () => {\n expect(isPathInsideOrEqual(path.join(base, 'child'), base)).to.eq(true);\n });\n it('should count a descendant whose name starts with dots as inside', () => {\n expect(isPathInsideOrEqual(path.join(base, '..foo', 'child'), base)).to.eq(true);\n });\n it('should count the parent itself as inside', () => {\n expect(isPathInsideOrEqual(base, base)).to.eq(true);\n });\n it('should count an ancestor as outside', () => {\n expect(isPathInsideOrEqual(path.dirname(base), base)).to.eq(false);\n });\n it('should count a sibling as outside', () => {\n expect(isPathInsideOrEqual(path.join(path.dirname(base), 'sibling'), base)).to.eq(false);\n });\n});\n\ndescribe('parseRecordedVirtualStoreDir()', () => {\n it('should read the JSON manifest current pnpm writes', () => {\n const manifest = JSON.stringify({ hoistedDependencies: {}, virtualStoreDir: '../../store/v11/links' }, null, 2);\n expect(parseRecordedVirtualStoreDir(manifest)).to.eq('../../store/v11/links');\n });\n it('should read a block-YAML manifest from an older pnpm', () => {\n expect(parseRecordedVirtualStoreDir('layoutVersion: 5\\nvirtualStoreDir: .pnpm\\n')).to.eq('.pnpm');\n });\n it('should not confuse virtualStoreDirMaxLength for the store dir', () => {\n expect(parseRecordedVirtualStoreDir('virtualStoreDirMaxLength: 120\\n')).to.eq(undefined);\n });\n it('should return undefined when the manifest records no store dir', () => {\n expect(parseRecordedVirtualStoreDir(JSON.stringify({ layoutVersion: 5 }))).to.eq(undefined);\n });\n});\n\ndescribe('hoistedResolutionDirs()', () => {\n let root: string;\n const hoisted = () => path.join(root, 'node_modules', '.pnpm', 'node_modules');\n const rootModules = () => path.join(root, 'node_modules');\n\n beforeEach(() => {\n root = fs.mkdtempSync(path.join(os.tmpdir(), 'hoisted-resolution-dirs-'));\n });\n afterEach(() => fs.removeSync(root));\n\n it('should return both directories in the order the walk reached them', () => {\n fs.ensureDirSync(hoisted());\n expect(hoistedResolutionDirs(root)).to.deep.eq([hoisted(), rootModules()]);\n });\n it('should keep the root node_modules when nothing was hoisted', () => {\n fs.ensureDirSync(rootModules());\n expect(hoistedResolutionDirs(root)).to.deep.eq([rootModules()]);\n });\n it('should return nothing for a root that was never installed', () => {\n expect(hoistedResolutionDirs(root)).to.deep.eq([]);\n });\n});\n\ndescribe('ensureHoistedDependencyResolution()', () => {\n let root: string;\n let nodePath: string | undefined;\n let nodeOptions: string | undefined;\n let register: unknown;\n // the two process-global side effects of the function under test, neither of them scoped to a\n // test: `_initPaths()` rederives Module.globalPaths from NODE_PATH, and `module.register()`\n // installs an ESM loader that cannot be removed for the life of the process\n const nodeModule = Module as unknown as { register?: unknown; _initPaths(): void };\n const hoisted = () => path.join(root, 'node_modules', '.pnpm', 'node_modules');\n const rootModules = () => path.join(root, 'node_modules');\n const entries = () => (process.env.NODE_PATH ?? '').split(path.delimiter).filter(Boolean);\n\n beforeEach(() => {\n root = fs.mkdtempSync(path.join(os.tmpdir(), 'ensure-hoisted-resolution-'));\n fs.ensureDirSync(hoisted());\n nodePath = process.env.NODE_PATH;\n nodeOptions = process.env.NODE_OPTIONS;\n // these cases are about NODE_PATH order; taking `register` away keeps the ESM half - the\n // irreversible half - out of the test process, through the same guard that carries older\n // runtimes\n register = nodeModule.register;\n nodeModule.register = undefined;\n });\n afterEach(() => {\n if (nodePath === undefined) delete process.env.NODE_PATH;\n else process.env.NODE_PATH = nodePath;\n if (nodeOptions === undefined) delete process.env.NODE_OPTIONS;\n else process.env.NODE_OPTIONS = nodeOptions;\n nodeModule.register = register;\n // restoring the variable is not enough: the resolver reads the paths derived from it, which\n // would otherwise still point into the directory removed on the next line\n nodeModule._initPaths();\n fs.removeSync(root);\n });\n\n it('should put both directories in walk order', () => {\n delete process.env.NODE_PATH;\n ensureHoistedDependencyResolution(root);\n expect(entries()).to.deep.eq([hoisted(), rootModules()]);\n });\n\n it('should reorder entries a previous bridge left in the wrong order', () => {\n // a bit that bridged the hoisted directory alone leaves it in NODE_PATH for its children;\n // adding the root's node_modules in front of it there would invert the walk\n process.env.NODE_PATH = hoisted();\n ensureHoistedDependencyResolution(root);\n expect(entries()).to.deep.eq([hoisted(), rootModules()]);\n });\n\n it('should keep entries it does not own, behind its own', () => {\n const foreign = path.join(root, 'somewhere-else');\n process.env.NODE_PATH = [rootModules(), foreign].join(path.delimiter);\n ensureHoistedDependencyResolution(root);\n expect(entries()).to.deep.eq([hoisted(), rootModules(), foreign]);\n });\n\n it('should replace an entry that names an owned directory in another spelling', () => {\n process.env.NODE_PATH = [`${rootModules()}${path.sep}`, `${hoisted()}${path.sep}.`].join(path.delimiter);\n ensureHoistedDependencyResolution(root);\n expect(entries()).to.deep.eq([hoisted(), rootModules()]);\n });\n\n it('should leave NODE_PATH untouched when it already reads correctly', () => {\n process.env.NODE_PATH = [hoisted(), rootModules()].join(path.delimiter);\n const before = process.env.NODE_PATH;\n ensureHoistedDependencyResolution(root);\n expect(process.env.NODE_PATH).to.eq(before);\n });\n\n it('should do nothing for a root that was never installed', () => {\n const bare = fs.mkdtempSync(path.join(os.tmpdir(), 'ensure-hoisted-resolution-bare-'));\n delete process.env.NODE_PATH;\n try {\n ensureHoistedDependencyResolution(bare);\n expect(process.env.NODE_PATH).to.eq(undefined);\n } finally {\n fs.removeSync(bare);\n }\n });\n});\n\ndescribe('ensureHoistedDependencyResolution() esm registration', () => {\n let first: string;\n let second: string;\n let nodePath: string | undefined;\n let nodeOptions: string | undefined;\n let register: unknown;\n const nodeModule = Module as unknown as { register?: unknown; _initPaths(): void };\n const flag = () => (process.env.NODE_OPTIONS ?? '').match(/--import=\\S+/)?.[0];\n\n beforeEach(() => {\n first = fs.mkdtempSync(path.join(os.tmpdir(), 'esm-registration-first-'));\n second = fs.mkdtempSync(path.join(os.tmpdir(), 'esm-registration-second-'));\n [first, second].forEach((root) => fs.ensureDirSync(path.join(root, 'node_modules', '.pnpm', 'node_modules')));\n nodePath = process.env.NODE_PATH;\n nodeOptions = process.env.NODE_OPTIONS;\n delete process.env.NODE_PATH;\n delete process.env.NODE_OPTIONS;\n register = nodeModule.register;\n // a no-op keeps the body running - the flag is what these cases are about - without leaving a\n // loader registered on the process\n nodeModule.register = () => {};\n });\n afterEach(() => {\n if (nodePath === undefined) delete process.env.NODE_PATH;\n else process.env.NODE_PATH = nodePath;\n if (nodeOptions === undefined) delete process.env.NODE_OPTIONS;\n else process.env.NODE_OPTIONS = nodeOptions;\n nodeModule.register = register;\n nodeModule._initPaths();\n [first, second].forEach((root) => fs.removeSync(root));\n });\n\n it('should hand children a flag carrying the order NODE_PATH now reads', () => {\n ensureHoistedDependencyResolution(first);\n ensureHoistedDependencyResolution(second);\n const beforeReorder = flag();\n // bridging the first root again moves its directories back to the front, so the list the\n // loader was registered with no longer matches the one CommonJS resolves through\n ensureHoistedDependencyResolution(first);\n expect(flag()).to.not.eq(beforeReorder);\n });\n\n it('should leave the flag alone when nothing about the list changed', () => {\n ensureHoistedDependencyResolution(first);\n const unchanged = flag();\n ensureHoistedDependencyResolution(first);\n expect(flag()).to.eq(unchanged);\n });\n});\n\ndescribe('isSamePath()', () => {\n const dir = path.resolve('/base', 'node_modules');\n it('should ignore a trailing separator', () => {\n expect(isSamePath(`${dir}${path.sep}`, dir)).to.eq(true);\n });\n it('should ignore a redundant current-directory segment', () => {\n expect(isSamePath(path.join(dir, '.'), dir)).to.eq(true);\n });\n it('should separate genuinely different directories', () => {\n expect(isSamePath(path.join(dir, 'nested'), dir)).to.eq(false);\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,QAA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,CAACpD,EAAE,CAACC,EAAE,CAAC,KAAK,CAAC;EAChE,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,5 +22,5 @@ export { extendWithComponentsFromDir } from './extend-with-components-from-dir';
|
|
|
22
22
|
export { isRange } from './manifest/deduping/hoist-dependencies';
|
|
23
23
|
export type { DependencyEnv } from './dependency-env';
|
|
24
24
|
export { DetectorHook, DependencyDetector, FileContext } from './detector-hook';
|
|
25
|
-
export { ensureHoistedDependencyResolution, ensureSelfInstallationBridge, isGlobalVirtualStoreLayout } from './hoisted-resolution-bridge';
|
|
25
|
+
export { ensureHoistedDependencyResolution, ensureSelfInstallationBridge, hoistedResolutionDirs, isGlobalVirtualStoreLayout, selfInstallationRoot, } from './hoisted-resolution-bridge';
|
|
26
26
|
export { DependencyResolverAspect as default, DependencyResolverAspect };
|
package/dist/index.js
CHANGED
|
@@ -141,6 +141,12 @@ Object.defineProperty(exports, "extendWithComponentsFromDir", {
|
|
|
141
141
|
return _extendWithComponentsFromDir().extendWithComponentsFromDir;
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
+
Object.defineProperty(exports, "hoistedResolutionDirs", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _hoistedResolutionBridge().hoistedResolutionDirs;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
144
150
|
Object.defineProperty(exports, "isGlobalVirtualStoreLayout", {
|
|
145
151
|
enumerable: true,
|
|
146
152
|
get: function () {
|
|
@@ -153,6 +159,12 @@ Object.defineProperty(exports, "isRange", {
|
|
|
153
159
|
return _hoistDependencies().isRange;
|
|
154
160
|
}
|
|
155
161
|
});
|
|
162
|
+
Object.defineProperty(exports, "selfInstallationRoot", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () {
|
|
165
|
+
return _hoistedResolutionBridge().selfInstallationRoot;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
156
168
|
function _dependencyResolver() {
|
|
157
169
|
const data = require("./dependency-resolver.aspect");
|
|
158
170
|
_dependencyResolver = function () {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dependencyResolver","data","require","_manifest","_dependencyResolverMain","_dependencies","_policy","_dependencyLinker","_dependencyInstaller","_extendWithComponentsFromDir","_hoistDependencies","_detectorHook","_hoistedResolutionBridge"],"sources":["index.ts"],"sourcesContent":["import { DependencyResolverAspect } from './dependency-resolver.aspect';\n\nexport type { UpdatedComponent } from './apply-updates';\nexport type { RawComponentState, ComponentsManifestsMap, RegistriesMap } from './types';\nexport { WorkspaceManifest, ComponentManifest } from './manifest';\nexport type { CreateFromComponentsOptions, ManifestDependenciesObject } from './manifest';\nexport type {\n InstallationContext,\n PackageImportMethod,\n PackageExtension,\n PackageManager,\n PackageManagerInstallOptions,\n PackageManagerResolveRemoteVersionOptions,\n ResolvedPackageVersion,\n CalcDepsGraphOptions,\n CalcDepsGraphForComponentOptions,\n ComponentIdByPkgName,\n} from './package-manager';\nexport type {\n DependencyResolverWorkspaceConfig,\n NodeLinker,\n ComponentRangePrefix,\n} from './dependency-resolver-workspace-config';\nexport type {\n DependencyResolverMain,\n DependencyResolverVariantConfig,\n MergedOutdatedPkg,\n} from './dependency-resolver.main.runtime';\nexport { NPM_REGISTRY, BIT_CLOUD_REGISTRY } from './dependency-resolver.main.runtime';\nexport type {\n ProxyConfig as PackageManagerProxyConfig,\n NetworkConfig as PackageManagerNetworkConfig,\n} from './dependency-resolver.main.runtime';\nexport {\n DependencyList,\n BaseDependency,\n ComponentDependency,\n KEY_NAME_BY_LIFECYCLE_TYPE,\n COMPONENT_DEP_TYPE,\n} from './dependencies';\nexport type {\n DependencyLifecycleType,\n WorkspaceDependencyLifecycleType,\n DependencyFactory,\n SerializedDependency,\n Dependency,\n SemverVersion,\n DependenciesManifest,\n} from './dependencies';\nexport { WorkspacePolicy, VariantPolicy, EnvPolicy, EnvPolicyEnvJsoncConfigObject } from './policy';\nexport type {\n WorkspacePolicyEntry,\n WorkspacePolicyConfigObject,\n VariantPolicyConfigObject,\n Policy,\n PolicySemver,\n PolicyConfigKeys,\n PolicyConfigKeysNames,\n PolicyEntry,\n SerializedVariantPolicy,\n WorkspacePolicyConfigKeysNames,\n EnvPolicyConfigObject,\n VariantPolicyConfigArr,\n} from './policy';\nexport { DependencyLinker } from './dependency-linker';\nexport type {\n CoreAspectLinkResult,\n LinkDetail,\n LinkResults,\n LinkingOptions,\n DepsLinkedToEnvResult,\n NestedNMDepsLinksResult,\n LinkToDirResult,\n} from './dependency-linker';\nexport { DependencyInstaller } from './dependency-installer';\nexport type { GetComponentManifestsOptions, InstallOptions, InstallArgs } from './dependency-installer';\nexport type { DependencySource, VariantPolicyEntry } from './policy/variant-policy/variant-policy';\nexport type { OutdatedPkg, CurrentPkg } from './get-all-policy-pkgs';\nexport { extendWithComponentsFromDir } from './extend-with-components-from-dir';\nexport { isRange } from './manifest/deduping/hoist-dependencies';\nexport type { DependencyEnv } from './dependency-env';\nexport { DetectorHook, DependencyDetector, FileContext } from './detector-hook';\nexport {
|
|
1
|
+
{"version":3,"names":["_dependencyResolver","data","require","_manifest","_dependencyResolverMain","_dependencies","_policy","_dependencyLinker","_dependencyInstaller","_extendWithComponentsFromDir","_hoistDependencies","_detectorHook","_hoistedResolutionBridge"],"sources":["index.ts"],"sourcesContent":["import { DependencyResolverAspect } from './dependency-resolver.aspect';\n\nexport type { UpdatedComponent } from './apply-updates';\nexport type { RawComponentState, ComponentsManifestsMap, RegistriesMap } from './types';\nexport { WorkspaceManifest, ComponentManifest } from './manifest';\nexport type { CreateFromComponentsOptions, ManifestDependenciesObject } from './manifest';\nexport type {\n InstallationContext,\n PackageImportMethod,\n PackageExtension,\n PackageManager,\n PackageManagerInstallOptions,\n PackageManagerResolveRemoteVersionOptions,\n ResolvedPackageVersion,\n CalcDepsGraphOptions,\n CalcDepsGraphForComponentOptions,\n ComponentIdByPkgName,\n} from './package-manager';\nexport type {\n DependencyResolverWorkspaceConfig,\n NodeLinker,\n ComponentRangePrefix,\n} from './dependency-resolver-workspace-config';\nexport type {\n DependencyResolverMain,\n DependencyResolverVariantConfig,\n MergedOutdatedPkg,\n} from './dependency-resolver.main.runtime';\nexport { NPM_REGISTRY, BIT_CLOUD_REGISTRY } from './dependency-resolver.main.runtime';\nexport type {\n ProxyConfig as PackageManagerProxyConfig,\n NetworkConfig as PackageManagerNetworkConfig,\n} from './dependency-resolver.main.runtime';\nexport {\n DependencyList,\n BaseDependency,\n ComponentDependency,\n KEY_NAME_BY_LIFECYCLE_TYPE,\n COMPONENT_DEP_TYPE,\n} from './dependencies';\nexport type {\n DependencyLifecycleType,\n WorkspaceDependencyLifecycleType,\n DependencyFactory,\n SerializedDependency,\n Dependency,\n SemverVersion,\n DependenciesManifest,\n} from './dependencies';\nexport { WorkspacePolicy, VariantPolicy, EnvPolicy, EnvPolicyEnvJsoncConfigObject } from './policy';\nexport type {\n WorkspacePolicyEntry,\n WorkspacePolicyConfigObject,\n VariantPolicyConfigObject,\n Policy,\n PolicySemver,\n PolicyConfigKeys,\n PolicyConfigKeysNames,\n PolicyEntry,\n SerializedVariantPolicy,\n WorkspacePolicyConfigKeysNames,\n EnvPolicyConfigObject,\n VariantPolicyConfigArr,\n} from './policy';\nexport { DependencyLinker } from './dependency-linker';\nexport type {\n CoreAspectLinkResult,\n LinkDetail,\n LinkResults,\n LinkingOptions,\n DepsLinkedToEnvResult,\n NestedNMDepsLinksResult,\n LinkToDirResult,\n} from './dependency-linker';\nexport { DependencyInstaller } from './dependency-installer';\nexport type { GetComponentManifestsOptions, InstallOptions, InstallArgs } from './dependency-installer';\nexport type { DependencySource, VariantPolicyEntry } from './policy/variant-policy/variant-policy';\nexport type { OutdatedPkg, CurrentPkg } from './get-all-policy-pkgs';\nexport { extendWithComponentsFromDir } from './extend-with-components-from-dir';\nexport { isRange } from './manifest/deduping/hoist-dependencies';\nexport type { DependencyEnv } from './dependency-env';\nexport { DetectorHook, DependencyDetector, FileContext } from './detector-hook';\nexport {\n ensureHoistedDependencyResolution,\n ensureSelfInstallationBridge,\n hoistedResolutionDirs,\n isGlobalVirtualStoreLayout,\n selfInstallationRoot,\n} from './hoisted-resolution-bridge';\nexport { DependencyResolverAspect as default, DependencyResolverAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,oBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,mBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAwBA,SAAAG,wBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,uBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAgBA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAeA,SAAAM,kBAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,iBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAAAO,qBAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,oBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAQ,6BAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,4BAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,mBAAA;EAAA,MAAAT,IAAA,GAAAC,OAAA;EAAAQ,kBAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAU,cAAA;EAAA,MAAAV,IAAA,GAAAC,OAAA;EAAAS,aAAA,YAAAA,CAAA;IAAA,OAAAV,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAW,yBAAA;EAAA,MAAAX,IAAA,GAAAC,OAAA;EAAAU,wBAAA,YAAAA,CAAA;IAAA,OAAAX,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_dependency-resolver@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_dependency-resolver@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_dependency-resolver@1.0.1098/dist/dependency-resolver.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_dependency-resolver@1.0.1098/dist/dependency-resolver.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/dependency-resolver",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1098",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/dependencies/dependency-resolver",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.dependencies",
|
|
8
8
|
"name": "dependency-resolver",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1098"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -25,42 +25,42 @@
|
|
|
25
25
|
"@pnpm/napi": "12.0.0-rc.1",
|
|
26
26
|
"semver-intersect": "1.4.0",
|
|
27
27
|
"semver-range-intersect": "0.3.1",
|
|
28
|
+
"@teambit/logger": "0.0.1457",
|
|
28
29
|
"@teambit/toolbox.path.path": "0.0.21",
|
|
29
30
|
"@teambit/bit-error": "0.0.404",
|
|
30
31
|
"@teambit/bvm.path": "1.0.0",
|
|
32
|
+
"@teambit/dependencies.fs.linked-dependencies": "0.0.71",
|
|
33
|
+
"@teambit/pkg.modules.component-package-name": "0.0.152",
|
|
31
34
|
"@teambit/harmony": "0.4.12",
|
|
32
35
|
"@pnpm/network.ca-file": "3.0.3",
|
|
33
36
|
"@teambit/bit.get-bit-version": "0.0.26",
|
|
37
|
+
"@teambit/cli": "0.0.1364",
|
|
34
38
|
"@teambit/component-id": "1.2.4",
|
|
35
39
|
"@teambit/component-version": "1.0.4",
|
|
36
|
-
"@teambit/harmony.modules.requireable-component": "0.0.524",
|
|
37
|
-
"@teambit/pkg.entities.registry": "0.0.4",
|
|
38
|
-
"@teambit/pkg.modules.semver-helper": "0.0.33",
|
|
39
|
-
"@teambit/workspace.root-components": "1.0.1",
|
|
40
|
-
"@teambit/component-issues": "0.0.183",
|
|
41
|
-
"@teambit/component-package-version": "0.0.460",
|
|
42
|
-
"@teambit/legacy-bit-id": "1.1.3",
|
|
43
|
-
"@teambit/toolbox.crypto.sha1": "0.0.20",
|
|
44
|
-
"@teambit/toolbox.object.sorter": "0.0.2",
|
|
45
|
-
"@teambit/component": "1.0.1097",
|
|
46
|
-
"@teambit/envs": "1.0.1097",
|
|
47
|
-
"@teambit/aspect-loader": "1.0.1097",
|
|
48
|
-
"@teambit/logger": "0.0.1457",
|
|
49
|
-
"@teambit/objects": "0.0.604",
|
|
50
|
-
"@teambit/dependencies.fs.linked-dependencies": "0.0.71",
|
|
51
|
-
"@teambit/pkg.modules.component-package-name": "0.0.152",
|
|
52
|
-
"@teambit/graphql": "1.0.1097",
|
|
53
|
-
"@teambit/cli": "0.0.1364",
|
|
54
40
|
"@teambit/component.sources": "0.0.197",
|
|
55
41
|
"@teambit/config-store": "0.0.245",
|
|
56
42
|
"@teambit/config": "0.0.1539",
|
|
57
43
|
"@teambit/harmony.modules.feature-toggle": "0.0.53",
|
|
44
|
+
"@teambit/harmony.modules.requireable-component": "0.0.524",
|
|
58
45
|
"@teambit/legacy.constants": "0.0.41",
|
|
59
46
|
"@teambit/legacy.consumer-component": "0.0.146",
|
|
60
47
|
"@teambit/legacy.extension-data": "0.0.147",
|
|
48
|
+
"@teambit/pkg.entities.registry": "0.0.4",
|
|
49
|
+
"@teambit/pkg.modules.semver-helper": "0.0.33",
|
|
61
50
|
"@teambit/scope.network": "0.0.145",
|
|
62
51
|
"@teambit/workspace.modules.node-modules-linker": "0.0.376",
|
|
63
|
-
"@teambit/
|
|
52
|
+
"@teambit/workspace.root-components": "1.0.1",
|
|
53
|
+
"@teambit/component-issues": "0.0.183",
|
|
54
|
+
"@teambit/component-package-version": "0.0.460",
|
|
55
|
+
"@teambit/legacy-bit-id": "1.1.3",
|
|
56
|
+
"@teambit/legacy.consumer-config": "0.0.145",
|
|
57
|
+
"@teambit/toolbox.crypto.sha1": "0.0.20",
|
|
58
|
+
"@teambit/toolbox.object.sorter": "0.0.2",
|
|
59
|
+
"@teambit/component": "1.0.1098",
|
|
60
|
+
"@teambit/envs": "1.0.1098",
|
|
61
|
+
"@teambit/aspect-loader": "1.0.1098",
|
|
62
|
+
"@teambit/objects": "0.0.605",
|
|
63
|
+
"@teambit/graphql": "1.0.1098"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/fs-extra": "9.0.7",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"sinon": "17.0.1",
|
|
69
69
|
"@types/semver": "7.5.8",
|
|
70
70
|
"@types/mocha": "9.1.0",
|
|
71
|
-
"@teambit/
|
|
72
|
-
"@teambit/
|
|
71
|
+
"@teambit/dependencies.aspect-docs.dependency-resolver": "0.0.191",
|
|
72
|
+
"@teambit/harmony.envs.core-aspect-env": "2.0.6"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|