@teambit/dependency-resolver 1.0.1096 → 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.
Files changed (32) hide show
  1. package/dist/dependency-installer.d.ts +67 -2
  2. package/dist/dependency-installer.js +155 -1
  3. package/dist/dependency-installer.js.map +1 -1
  4. package/dist/dependency-linker.d.ts +23 -0
  5. package/dist/dependency-linker.js +82 -4
  6. package/dist/dependency-linker.js.map +1 -1
  7. package/dist/dependency-resolver-workspace-config.d.ts +5 -1
  8. package/dist/dependency-resolver-workspace-config.js.map +1 -1
  9. package/dist/dependency-resolver.main.runtime.d.ts +34 -0
  10. package/dist/dependency-resolver.main.runtime.js +80 -1
  11. package/dist/dependency-resolver.main.runtime.js.map +1 -1
  12. package/dist/exceptions/index.d.ts +1 -0
  13. package/dist/exceptions/index.js +13 -0
  14. package/dist/exceptions/index.js.map +1 -1
  15. package/dist/exceptions/self-hosted-virtual-store-transition.d.ts +16 -0
  16. package/dist/exceptions/self-hosted-virtual-store-transition.js +36 -0
  17. package/dist/exceptions/self-hosted-virtual-store-transition.js.map +1 -0
  18. package/dist/hoisted-resolution-bridge.d.ts +78 -0
  19. package/dist/hoisted-resolution-bridge.js +348 -0
  20. package/dist/hoisted-resolution-bridge.js.map +1 -0
  21. package/dist/hoisted-resolution-bridge.spec.d.ts +1 -0
  22. package/dist/hoisted-resolution-bridge.spec.js +233 -0
  23. package/dist/hoisted-resolution-bridge.spec.js.map +1 -0
  24. package/dist/index.d.ts +2 -1
  25. package/dist/index.js +37 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/package-manager.d.ts +39 -0
  28. package/dist/package-manager.js.map +1 -1
  29. package/dist/{preview-1785958716068.js → preview-1786365057144.js} +2 -2
  30. package/exceptions/index.ts +1 -0
  31. package/exceptions/self-hosted-virtual-store-transition.ts +26 -0
  32. package/package.json +28 -27
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+
3
+ function _chai() {
4
+ const data = require("chai");
5
+ _chai = function () {
6
+ return data;
7
+ };
8
+ return data;
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
+ }
31
+ function _path() {
32
+ const data = _interopRequireDefault(require("path"));
33
+ _path = function () {
34
+ return data;
35
+ };
36
+ return data;
37
+ }
38
+ function _hoistedResolutionBridge() {
39
+ const data = require("./hoisted-resolution-bridge");
40
+ _hoistedResolutionBridge = function () {
41
+ return data;
42
+ };
43
+ return data;
44
+ }
45
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
46
+ describe('isPathInsideOrEqual()', () => {
47
+ const base = _path().default.resolve('/base');
48
+ it('should count a descendant as inside', () => {
49
+ (0, _chai().expect)((0, _hoistedResolutionBridge().isPathInsideOrEqual)(_path().default.join(base, 'child'), base)).to.eq(true);
50
+ });
51
+ it('should count a descendant whose name starts with dots as inside', () => {
52
+ (0, _chai().expect)((0, _hoistedResolutionBridge().isPathInsideOrEqual)(_path().default.join(base, '..foo', 'child'), base)).to.eq(true);
53
+ });
54
+ it('should count the parent itself as inside', () => {
55
+ (0, _chai().expect)((0, _hoistedResolutionBridge().isPathInsideOrEqual)(base, base)).to.eq(true);
56
+ });
57
+ it('should count an ancestor as outside', () => {
58
+ (0, _chai().expect)((0, _hoistedResolutionBridge().isPathInsideOrEqual)(_path().default.dirname(base), base)).to.eq(false);
59
+ });
60
+ it('should count a sibling as outside', () => {
61
+ (0, _chai().expect)((0, _hoistedResolutionBridge().isPathInsideOrEqual)(_path().default.join(_path().default.dirname(base), 'sibling'), base)).to.eq(false);
62
+ });
63
+ });
64
+ describe('parseRecordedVirtualStoreDir()', () => {
65
+ it('should read the JSON manifest current pnpm writes', () => {
66
+ const manifest = JSON.stringify({
67
+ hoistedDependencies: {},
68
+ virtualStoreDir: '../../store/v11/links'
69
+ }, null, 2);
70
+ (0, _chai().expect)((0, _hoistedResolutionBridge().parseRecordedVirtualStoreDir)(manifest)).to.eq('../../store/v11/links');
71
+ });
72
+ it('should read a block-YAML manifest from an older pnpm', () => {
73
+ (0, _chai().expect)((0, _hoistedResolutionBridge().parseRecordedVirtualStoreDir)('layoutVersion: 5\nvirtualStoreDir: .pnpm\n')).to.eq('.pnpm');
74
+ });
75
+ it('should not confuse virtualStoreDirMaxLength for the store dir', () => {
76
+ (0, _chai().expect)((0, _hoistedResolutionBridge().parseRecordedVirtualStoreDir)('virtualStoreDirMaxLength: 120\n')).to.eq(undefined);
77
+ });
78
+ it('should return undefined when the manifest records no store dir', () => {
79
+ (0, _chai().expect)((0, _hoistedResolutionBridge().parseRecordedVirtualStoreDir)(JSON.stringify({
80
+ layoutVersion: 5
81
+ }))).to.eq(undefined);
82
+ });
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
+ });
232
+
233
+ //# sourceMappingURL=hoisted-resolution-bridge.spec.js.map
@@ -0,0 +1 @@
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,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAC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,CAAC,iEAAiE,EAAE,MAAM;IAC1E,IAAA2C,4DAAiC,EAACK,KAAK,CAAC;IACxC,MAAMO,SAAS,GAAGL,IAAI,CAAC,CAAC;IACxB,IAAAP,4DAAiC,EAACK,KAAK,CAAC;IACxC,IAAA/C,cAAM,EAACiD,IAAI,CAAC,CAAC,CAAC,CAAC9C,EAAE,CAACC,EAAE,CAACkD,SAAS,CAAC;EACjC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF3D,QAAQ,CAAC,cAAc,EAAE,MAAM;EAC7B,MAAM4D,GAAG,GAAG1D,eAAI,CAACC,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC;EACjDC,EAAE,CAAC,oCAAoC,EAAE,MAAM;IAC7C,IAAAC,cAAM,EAAC,IAAAwD,qCAAU,EAAC,GAAGD,GAAG,GAAG1D,eAAI,CAAC+C,GAAG,EAAE,EAAEW,GAAG,CAAC,CAAC,CAACpD,EAAE,CAACC,EAAE,CAAC,IAAI,CAAC;EAC1D,CAAC,CAAC;EACFL,EAAE,CAAC,qDAAqD,EAAE,MAAM;IAC9D,IAAAC,cAAM,EAAC,IAAAwD,qCAAU,EAAC3D,eAAI,CAACK,IAAI,CAACqD,GAAG,EAAE,GAAG,CAAC,EAAEA,GAAG,CAAC,CAAC,CAACpD,EAAE,CAACC,EAAE,CAAC,IAAI,CAAC;EAC1D,CAAC,CAAC;EACFL,EAAE,CAAC,iDAAiD,EAAE,MAAM;IAC1D,IAAAC,cAAM,EAAC,IAAAwD,qCAAU,EAAC3D,eAAI,CAACK,IAAI,CAACqD,GAAG,EAAE,QAAQ,CAAC,EAAEA,GAAG,CAAC,CAAC,CAACpD,EAAE,CAACC,EAAE,CAAC,KAAK,CAAC;EAChE,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export type { UpdatedComponent } from './apply-updates';
3
3
  export type { RawComponentState, ComponentsManifestsMap, RegistriesMap } from './types';
4
4
  export { WorkspaceManifest, ComponentManifest } from './manifest';
5
5
  export type { CreateFromComponentsOptions, ManifestDependenciesObject } from './manifest';
6
- export type { InstallationContext, PackageImportMethod, PackageManager, PackageManagerInstallOptions, PackageManagerResolveRemoteVersionOptions, ResolvedPackageVersion, CalcDepsGraphOptions, CalcDepsGraphForComponentOptions, ComponentIdByPkgName, } from './package-manager';
6
+ export type { InstallationContext, PackageImportMethod, PackageExtension, PackageManager, PackageManagerInstallOptions, PackageManagerResolveRemoteVersionOptions, ResolvedPackageVersion, CalcDepsGraphOptions, CalcDepsGraphForComponentOptions, ComponentIdByPkgName, } from './package-manager';
7
7
  export type { DependencyResolverWorkspaceConfig, NodeLinker, ComponentRangePrefix, } from './dependency-resolver-workspace-config';
8
8
  export type { DependencyResolverMain, DependencyResolverVariantConfig, MergedOutdatedPkg, } from './dependency-resolver.main.runtime';
9
9
  export { NPM_REGISTRY, BIT_CLOUD_REGISTRY } from './dependency-resolver.main.runtime';
@@ -22,4 +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, hoistedResolutionDirs, isGlobalVirtualStoreLayout, selfInstallationRoot, } from './hoisted-resolution-bridge';
25
26
  export { DependencyResolverAspect as default, DependencyResolverAspect };
package/dist/index.js CHANGED
@@ -123,18 +123,48 @@ Object.defineProperty(exports, "default", {
123
123
  return _dependencyResolver().DependencyResolverAspect;
124
124
  }
125
125
  });
126
+ Object.defineProperty(exports, "ensureHoistedDependencyResolution", {
127
+ enumerable: true,
128
+ get: function () {
129
+ return _hoistedResolutionBridge().ensureHoistedDependencyResolution;
130
+ }
131
+ });
132
+ Object.defineProperty(exports, "ensureSelfInstallationBridge", {
133
+ enumerable: true,
134
+ get: function () {
135
+ return _hoistedResolutionBridge().ensureSelfInstallationBridge;
136
+ }
137
+ });
126
138
  Object.defineProperty(exports, "extendWithComponentsFromDir", {
127
139
  enumerable: true,
128
140
  get: function () {
129
141
  return _extendWithComponentsFromDir().extendWithComponentsFromDir;
130
142
  }
131
143
  });
144
+ Object.defineProperty(exports, "hoistedResolutionDirs", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _hoistedResolutionBridge().hoistedResolutionDirs;
148
+ }
149
+ });
150
+ Object.defineProperty(exports, "isGlobalVirtualStoreLayout", {
151
+ enumerable: true,
152
+ get: function () {
153
+ return _hoistedResolutionBridge().isGlobalVirtualStoreLayout;
154
+ }
155
+ });
132
156
  Object.defineProperty(exports, "isRange", {
133
157
  enumerable: true,
134
158
  get: function () {
135
159
  return _hoistDependencies().isRange;
136
160
  }
137
161
  });
162
+ Object.defineProperty(exports, "selfInstallationRoot", {
163
+ enumerable: true,
164
+ get: function () {
165
+ return _hoistedResolutionBridge().selfInstallationRoot;
166
+ }
167
+ });
138
168
  function _dependencyResolver() {
139
169
  const data = require("./dependency-resolver.aspect");
140
170
  _dependencyResolver = function () {
@@ -205,5 +235,12 @@ function _detectorHook() {
205
235
  };
206
236
  return data;
207
237
  }
238
+ function _hoistedResolutionBridge() {
239
+ const data = require("./hoisted-resolution-bridge");
240
+ _hoistedResolutionBridge = function () {
241
+ return data;
242
+ };
243
+ return data;
244
+ }
208
245
 
209
246
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_dependencyResolver","data","require","_manifest","_dependencyResolverMain","_dependencies","_policy","_dependencyLinker","_dependencyInstaller","_extendWithComponentsFromDir","_hoistDependencies","_detectorHook"],"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 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 { 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;AAuBA,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","ignoreList":[]}
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, DependencyResol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A;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":[]}
@@ -7,6 +7,15 @@ import type { DepsFilterFn } from './manifest';
7
7
  import type { NetworkConfig, ProxyConfig } from './dependency-resolver.main.runtime';
8
8
  export { PeerDependencyIssuesByProjects };
9
9
  export type PackageImportMethod = 'auto' | 'hardlink' | 'copy' | 'clone';
10
+ /**
11
+ * Dependency groups grafted onto a package that under-declares them - pnpm's `packageExtensions`
12
+ * entry shape.
13
+ */
14
+ export type PackageExtension = {
15
+ dependencies?: Record<string, string>;
16
+ optionalDependencies?: Record<string, string>;
17
+ peerDependencies?: Record<string, string>;
18
+ };
10
19
  export type PackageManagerInstallOptions = {
11
20
  cacheRootDir?: string;
12
21
  /**
@@ -28,6 +37,27 @@ export type PackageManagerInstallOptions = {
28
37
  nodeLinker?: 'hoisted' | 'isolated';
29
38
  packageManagerConfigRootDir?: string;
30
39
  packageImportMethod?: PackageImportMethod;
40
+ /**
41
+ * Create dependency directories once in the global virtual store and share them across
42
+ * workspaces, instead of re-creating them in every `node_modules/.pnpm`. Capsule installs
43
+ * never use it - the installer forces the project-local layout there.
44
+ */
45
+ enableGlobalVirtualStore?: boolean;
46
+ /**
47
+ * Where the global virtual store materializes those directories. pnpm's own shared
48
+ * `<storeDir>/links` unless overridden (see `PnpmPackageManager.getGlobalVirtualStoreDir` for
49
+ * why the shared root works).
50
+ */
51
+ globalVirtualStoreDir?: string;
52
+ /**
53
+ * A map of package name (optionally with a version range) to a patch file path.
54
+ * Relative paths are resolved against the installation root directory.
55
+ */
56
+ patchedDependencies?: Record<string, string>;
57
+ /**
58
+ * Dependency groups to graft onto packages that under-declare them (pnpm's `packageExtensions`).
59
+ */
60
+ packageExtensions?: Record<string, PackageExtension>;
31
61
  rootComponents?: boolean;
32
62
  rootComponentsForCapsules?: boolean;
33
63
  useNesting?: boolean;
@@ -147,6 +177,15 @@ export interface PackageManager {
147
177
  resolveRemoteVersion(packageName: string, options: PackageManagerResolveRemoteVersionOptions): Promise<ResolvedPackageVersion>;
148
178
  getPeerDependencyIssues?(rootDir: string, manifests: Record<string, ProjectManifest>, options: PackageManagerGetPeerDependencyIssuesOptions): Promise<PeerDependencyIssuesByProjects>;
149
179
  getInjectedDirs?(rootDir: string, componentDir: string, packageName: string): Promise<string[]>;
180
+ /**
181
+ * The directory the global virtual store materializes dependency directories in.
182
+ * `installationId` scopes it to the bit installation that is running - see
183
+ * `DependencyResolverMain.getGlobalVirtualStoreDir` for why that root cannot be shared.
184
+ */
185
+ getGlobalVirtualStoreDir?(options: {
186
+ packageManagerConfigRootDir?: string;
187
+ installationId: string;
188
+ }): Promise<string>;
150
189
  getRegistries?(): Promise<Registries>;
151
190
  getProxyConfig?(): Promise<ProxyConfig>;
152
191
  getNetworkConfig?(): Promise<NetworkConfig>;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["package-manager.ts"],"sourcesContent":["import type { PeerDependencyIssuesByProjects } from '@pnpm/napi';\nimport type { PeerDependencyRules, ProjectManifest, DependencyManifest } from '@pnpm/types';\nimport type { ComponentID, ComponentMap, Component } from '@teambit/component';\nimport { type DependenciesGraph } from '@teambit/objects';\nimport type { Registries } from '@teambit/pkg.entities.registry';\nimport type { DepsFilterFn } from './manifest';\nimport type { NetworkConfig, ProxyConfig } from './dependency-resolver.main.runtime';\n\nexport { PeerDependencyIssuesByProjects };\n\nexport type PackageImportMethod = 'auto' | 'hardlink' | 'copy' | 'clone';\n\nexport type PackageManagerInstallOptions = {\n cacheRootDir?: string;\n /**\n * decide whether to dedup dependencies.\n */\n dedupe?: boolean;\n\n copyPeerToRuntimeOnRoot?: boolean;\n\n copyPeerToRuntimeOnComponents?: boolean;\n\n excludeLinksFromLockfile?: boolean;\n\n installPeersFromEnvs?: boolean;\n\n resolveEnvPeersFromRoot?: boolean;\n\n dependencyFilterFn?: DepsFilterFn;\n\n overrides?: Record<string, string>;\n\n lockfileOnly?: boolean;\n\n /**\n * When false, the package manager will not write the node_modules directory\n */\n enableModulesDir?: boolean;\n\n nodeLinker?: 'hoisted' | 'isolated';\n\n packageManagerConfigRootDir?: string;\n\n packageImportMethod?: PackageImportMethod;\n\n rootComponents?: boolean;\n\n rootComponentsForCapsules?: boolean;\n\n useNesting?: boolean;\n\n keepExistingModulesDir?: boolean;\n\n sideEffectsCache?: boolean;\n\n engineStrict?: boolean;\n\n nodeVersion?: string;\n\n peerDependencyRules?: PeerDependencyRules;\n\n includeOptionalDeps?: boolean;\n\n updateAll?: boolean;\n\n hidePackageManagerOutput?: boolean;\n\n pruneNodeModules?: boolean;\n\n hasRootComponents?: boolean;\n\n neverBuiltDependencies?: string[];\n\n allowScripts?: Record<string, boolean | 'warn'>;\n\n dangerouslyAllowAllScripts?: boolean;\n\n preferOffline?: boolean;\n\n nmSelfReferences?: boolean;\n\n /**\n * e.g. when running `bit install` through the web or the IDE, not from the CLI.\n */\n optimizeReportForNonTerminal?: boolean;\n\n /**\n * Sets the frequency of updating the progress output in milliseconds.\n * E.g., if this is set to 1000, then the progress will be updated every second.\n */\n throttleProgress?: number;\n\n hideProgressPrefix?: boolean;\n\n hideLifecycleOutput?: boolean;\n\n /**\n * Do installation using lockfile only. Ignore the component manifests.\n */\n ignorePackageManifest?: boolean;\n\n /**\n * When enabled, installation by the package manager will be skipped\n * but all the options will be calculated and the rebuild function will be returned.\n * We use this option for a performance optimization in Ripple CI.\n */\n dryRun?: boolean;\n\n dedupeInjectedDeps?: boolean;\n\n /**\n * When this is set to true, pnpm will hoist workspace packages to node_modules/.pnpm/node_modules.\n * This is something we need in capsules.\n */\n hoistWorkspacePackages?: boolean;\n\n /**\n * Tells pnpm which packages should be hoisted to node_modules/.pnpm/node_modules.\n * By default, all packages are hoisted - however, if you know that only some flawed packages have phantom dependencies,\n * you can use this option to exclusively hoist the phantom dependencies (recommended).\n */\n hoistPatterns?: string[];\n\n /**\n * When true, dependencies from the workspace are hoisted to node_modules/.pnpm/node_modules\n * even if they are found in the root node_modules\n */\n hoistInjectedDependencies?: boolean;\n\n /**\n * Tells pnpm to automatically install peer dependencies. It is true by default.\n */\n autoInstallPeers?: boolean;\n\n /**\n * When true, pnpm will deduplicate peer dependencies where possible. It is enabled by default.\n */\n dedupePeers?: boolean;\n\n /**\n * Tells the package manager to return the list of dependencies that has to be built.\n * This is used by Ripple CI.\n */\n returnListOfDepsRequiringBuild?: boolean;\n\n dependenciesGraph?: DependenciesGraph;\n\n forcedHarmonyVersion?: string;\n\n /**\n * Defines the minimum number of minutes that must pass after a version is published before pnpm will install it.\n * This applies to all dependencies, including transitive ones.\n */\n minimumReleaseAge?: number;\n\n /**\n * If you set minimumReleaseAge but need certain dependencies to always install the newest version immediately,\n * you can list them under minimumReleaseAgeExclude. The exclusion works by package name or package name pattern\n * and applies to all versions of that package.\n */\n minimumReleaseAgeExclude?: string[];\n};\n\nexport type PackageManagerGetPeerDependencyIssuesOptions = PackageManagerInstallOptions;\n\nexport type ResolvedPackageVersion = {\n packageName: string;\n version: string | null;\n wantedRange?: string;\n isSemver: boolean;\n resolvedVia?: string;\n manifest?: DependencyManifest;\n};\n\nexport type PackageManagerResolveRemoteVersionOptions = {\n rootDir: string;\n cacheRootDir?: string;\n packageManagerConfigRootDir?: string;\n fullMetadata?: boolean;\n // fetchToCache?: boolean;\n // update?: boolean;\n};\n\nexport interface InstallationContext {\n rootDir: string;\n manifests: Record<string, ProjectManifest>;\n componentDirectoryMap: ComponentMap<string>;\n}\n\nexport interface PackageManager {\n /**\n * Name of the package manager\n */\n name: string;\n /**\n * install dependencies\n * @param componentDirectoryMap\n */\n install(\n context: InstallationContext,\n options: PackageManagerInstallOptions\n ): Promise<{ dependenciesChanged: boolean }>;\n\n pruneModules?(rootDir: string): Promise<void>;\n\n resolveRemoteVersion(\n packageName: string,\n options: PackageManagerResolveRemoteVersionOptions\n ): Promise<ResolvedPackageVersion>;\n\n getPeerDependencyIssues?(\n rootDir: string,\n manifests: Record<string, ProjectManifest>,\n options: PackageManagerGetPeerDependencyIssuesOptions\n ): Promise<PeerDependencyIssuesByProjects>;\n\n getInjectedDirs?(rootDir: string, componentDir: string, packageName: string): Promise<string[]>;\n\n getRegistries?(): Promise<Registries>;\n\n getProxyConfig?(): Promise<ProxyConfig>;\n\n getNetworkConfig?(): Promise<NetworkConfig>;\n\n /**\n * Specify if the package manager can be run with deduping on existing worksapce (which already contains root dependencies)\n * again, with a different context.\n * If the package manager is not capable of doing so, we want to disable the deduping.\n */\n supportsDedupingOnExistingRoot?: () => boolean;\n\n /**\n * Returns \"dependencies\" entries for \".bit_roots\".\n * These entries tell the package manager from where to the local components should be installed.\n */\n getWorkspaceDepsOfBitRoots(manifests: ProjectManifest[]): Record<string, string>;\n\n findUsages?(depName: string, opts: { lockfileDir: string; depth?: number }): Promise<string>;\n\n calcDependenciesGraph?(options: CalcDepsGraphOptions): Promise<void>;\n}\n\nexport interface CalcDepsGraphForComponentOptions {\n component: Component;\n componentRootDir?: string;\n componentRelativeDir: string;\n pkgName?: string;\n}\n\nexport interface CalcDepsGraphOptions {\n components: CalcDepsGraphForComponentOptions[];\n componentIdByPkgName: ComponentIdByPkgName;\n rootDir: string;\n}\n\nexport type ComponentIdByPkgName = Map<string, ComponentID>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["package-manager.ts"],"sourcesContent":["import type { PeerDependencyIssuesByProjects } from '@pnpm/napi';\nimport type { PeerDependencyRules, ProjectManifest, DependencyManifest } from '@pnpm/types';\nimport type { ComponentID, ComponentMap, Component } from '@teambit/component';\nimport { type DependenciesGraph } from '@teambit/objects';\nimport type { Registries } from '@teambit/pkg.entities.registry';\nimport type { DepsFilterFn } from './manifest';\nimport type { NetworkConfig, ProxyConfig } from './dependency-resolver.main.runtime';\n\nexport { PeerDependencyIssuesByProjects };\n\nexport type PackageImportMethod = 'auto' | 'hardlink' | 'copy' | 'clone';\n\n/**\n * Dependency groups grafted onto a package that under-declares them - pnpm's `packageExtensions`\n * entry shape.\n */\nexport type PackageExtension = {\n dependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n};\n\nexport type PackageManagerInstallOptions = {\n cacheRootDir?: string;\n /**\n * decide whether to dedup dependencies.\n */\n dedupe?: boolean;\n\n copyPeerToRuntimeOnRoot?: boolean;\n\n copyPeerToRuntimeOnComponents?: boolean;\n\n excludeLinksFromLockfile?: boolean;\n\n installPeersFromEnvs?: boolean;\n\n resolveEnvPeersFromRoot?: boolean;\n\n dependencyFilterFn?: DepsFilterFn;\n\n overrides?: Record<string, string>;\n\n lockfileOnly?: boolean;\n\n /**\n * When false, the package manager will not write the node_modules directory\n */\n enableModulesDir?: boolean;\n\n nodeLinker?: 'hoisted' | 'isolated';\n\n packageManagerConfigRootDir?: string;\n\n packageImportMethod?: PackageImportMethod;\n\n /**\n * Create dependency directories once in the global virtual store and share them across\n * workspaces, instead of re-creating them in every `node_modules/.pnpm`. Capsule installs\n * never use it - the installer forces the project-local layout there.\n */\n enableGlobalVirtualStore?: boolean;\n\n /**\n * Where the global virtual store materializes those directories. pnpm's own shared\n * `<storeDir>/links` unless overridden (see `PnpmPackageManager.getGlobalVirtualStoreDir` for\n * why the shared root works).\n */\n globalVirtualStoreDir?: string;\n\n /**\n * A map of package name (optionally with a version range) to a patch file path.\n * Relative paths are resolved against the installation root directory.\n */\n patchedDependencies?: Record<string, string>;\n\n /**\n * Dependency groups to graft onto packages that under-declare them (pnpm's `packageExtensions`).\n */\n packageExtensions?: Record<string, PackageExtension>;\n\n rootComponents?: boolean;\n\n rootComponentsForCapsules?: boolean;\n\n useNesting?: boolean;\n\n keepExistingModulesDir?: boolean;\n\n sideEffectsCache?: boolean;\n\n engineStrict?: boolean;\n\n nodeVersion?: string;\n\n peerDependencyRules?: PeerDependencyRules;\n\n includeOptionalDeps?: boolean;\n\n updateAll?: boolean;\n\n hidePackageManagerOutput?: boolean;\n\n pruneNodeModules?: boolean;\n\n hasRootComponents?: boolean;\n\n neverBuiltDependencies?: string[];\n\n allowScripts?: Record<string, boolean | 'warn'>;\n\n dangerouslyAllowAllScripts?: boolean;\n\n preferOffline?: boolean;\n\n nmSelfReferences?: boolean;\n\n /**\n * e.g. when running `bit install` through the web or the IDE, not from the CLI.\n */\n optimizeReportForNonTerminal?: boolean;\n\n /**\n * Sets the frequency of updating the progress output in milliseconds.\n * E.g., if this is set to 1000, then the progress will be updated every second.\n */\n throttleProgress?: number;\n\n hideProgressPrefix?: boolean;\n\n hideLifecycleOutput?: boolean;\n\n /**\n * Do installation using lockfile only. Ignore the component manifests.\n */\n ignorePackageManifest?: boolean;\n\n /**\n * When enabled, installation by the package manager will be skipped\n * but all the options will be calculated and the rebuild function will be returned.\n * We use this option for a performance optimization in Ripple CI.\n */\n dryRun?: boolean;\n\n dedupeInjectedDeps?: boolean;\n\n /**\n * When this is set to true, pnpm will hoist workspace packages to node_modules/.pnpm/node_modules.\n * This is something we need in capsules.\n */\n hoistWorkspacePackages?: boolean;\n\n /**\n * Tells pnpm which packages should be hoisted to node_modules/.pnpm/node_modules.\n * By default, all packages are hoisted - however, if you know that only some flawed packages have phantom dependencies,\n * you can use this option to exclusively hoist the phantom dependencies (recommended).\n */\n hoistPatterns?: string[];\n\n /**\n * When true, dependencies from the workspace are hoisted to node_modules/.pnpm/node_modules\n * even if they are found in the root node_modules\n */\n hoistInjectedDependencies?: boolean;\n\n /**\n * Tells pnpm to automatically install peer dependencies. It is true by default.\n */\n autoInstallPeers?: boolean;\n\n /**\n * When true, pnpm will deduplicate peer dependencies where possible. It is enabled by default.\n */\n dedupePeers?: boolean;\n\n /**\n * Tells the package manager to return the list of dependencies that has to be built.\n * This is used by Ripple CI.\n */\n returnListOfDepsRequiringBuild?: boolean;\n\n dependenciesGraph?: DependenciesGraph;\n\n forcedHarmonyVersion?: string;\n\n /**\n * Defines the minimum number of minutes that must pass after a version is published before pnpm will install it.\n * This applies to all dependencies, including transitive ones.\n */\n minimumReleaseAge?: number;\n\n /**\n * If you set minimumReleaseAge but need certain dependencies to always install the newest version immediately,\n * you can list them under minimumReleaseAgeExclude. The exclusion works by package name or package name pattern\n * and applies to all versions of that package.\n */\n minimumReleaseAgeExclude?: string[];\n};\n\nexport type PackageManagerGetPeerDependencyIssuesOptions = PackageManagerInstallOptions;\n\nexport type ResolvedPackageVersion = {\n packageName: string;\n version: string | null;\n wantedRange?: string;\n isSemver: boolean;\n resolvedVia?: string;\n manifest?: DependencyManifest;\n};\n\nexport type PackageManagerResolveRemoteVersionOptions = {\n rootDir: string;\n cacheRootDir?: string;\n packageManagerConfigRootDir?: string;\n fullMetadata?: boolean;\n // fetchToCache?: boolean;\n // update?: boolean;\n};\n\nexport interface InstallationContext {\n rootDir: string;\n manifests: Record<string, ProjectManifest>;\n componentDirectoryMap: ComponentMap<string>;\n}\n\nexport interface PackageManager {\n /**\n * Name of the package manager\n */\n name: string;\n /**\n * install dependencies\n * @param componentDirectoryMap\n */\n install(\n context: InstallationContext,\n options: PackageManagerInstallOptions\n ): Promise<{ dependenciesChanged: boolean }>;\n\n pruneModules?(rootDir: string): Promise<void>;\n\n resolveRemoteVersion(\n packageName: string,\n options: PackageManagerResolveRemoteVersionOptions\n ): Promise<ResolvedPackageVersion>;\n\n getPeerDependencyIssues?(\n rootDir: string,\n manifests: Record<string, ProjectManifest>,\n options: PackageManagerGetPeerDependencyIssuesOptions\n ): Promise<PeerDependencyIssuesByProjects>;\n\n getInjectedDirs?(rootDir: string, componentDir: string, packageName: string): Promise<string[]>;\n\n /**\n * The directory the global virtual store materializes dependency directories in.\n * `installationId` scopes it to the bit installation that is running - see\n * `DependencyResolverMain.getGlobalVirtualStoreDir` for why that root cannot be shared.\n */\n getGlobalVirtualStoreDir?(options: { packageManagerConfigRootDir?: string; installationId: string }): Promise<string>;\n\n getRegistries?(): Promise<Registries>;\n\n getProxyConfig?(): Promise<ProxyConfig>;\n\n getNetworkConfig?(): Promise<NetworkConfig>;\n\n /**\n * Specify if the package manager can be run with deduping on existing worksapce (which already contains root dependencies)\n * again, with a different context.\n * If the package manager is not capable of doing so, we want to disable the deduping.\n */\n supportsDedupingOnExistingRoot?: () => boolean;\n\n /**\n * Returns \"dependencies\" entries for \".bit_roots\".\n * These entries tell the package manager from where to the local components should be installed.\n */\n getWorkspaceDepsOfBitRoots(manifests: ProjectManifest[]): Record<string, string>;\n\n findUsages?(depName: string, opts: { lockfileDir: string; depth?: number }): Promise<string>;\n\n calcDependenciesGraph?(options: CalcDepsGraphOptions): Promise<void>;\n}\n\nexport interface CalcDepsGraphForComponentOptions {\n component: Component;\n componentRootDir?: string;\n componentRelativeDir: string;\n pkgName?: string;\n}\n\nexport interface CalcDepsGraphOptions {\n components: CalcDepsGraphForComponentOptions[];\n componentIdByPkgName: ComponentIdByPkgName;\n rootDir: string;\n}\n\nexport type ComponentIdByPkgName = Map<string, ComponentID>;\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_dependency-resolver@1.0.1096/dist/dependency-resolver.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_dependency-resolver@1.0.1096/dist/dependency-resolver.docs.mdx';
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];
@@ -5,3 +5,4 @@ export { MainAspectNotLinkable } from './main-aspect-not-linkable';
5
5
  export { CoreAspectLinkError } from './core-aspect-link-error';
6
6
  export { NonAspectCorePackageLinkError } from './non-aspect-core-package-link-error';
7
7
  export { InvalidVersionWithPrefix } from './invalid-version-with-prefix';
8
+ export { SelfHostedVirtualStoreTransition } from './self-hosted-virtual-store-transition';
@@ -0,0 +1,26 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+
3
+ /**
4
+ * Thrown before an install that would switch this workspace between the project-local virtual
5
+ * store (`node_modules/.pnpm`) and pnpm's global virtual store while the running bit itself is
6
+ * installed inside this workspace's `node_modules`.
7
+ *
8
+ * A layout switch rebuilds the workspace's injected component packages from source, which
9
+ * discards their compiled `dist` until the end-of-install compile restores it. A bit that runs
10
+ * from those very packages loses its own code mid-install and crashes before it can recompile,
11
+ * leaving `node_modules` unusable. Steady-state installs are safe in both layouts - they
12
+ * preserve the top-level package directories - so only the one-time transition has to be driven
13
+ * by a bit that lives outside this workspace.
14
+ */
15
+ export class SelfHostedVirtualStoreTransition extends BitError {
16
+ constructor(workspacePath: string, enablingGlobalVirtualStore: boolean) {
17
+ const direction = enablingGlobalVirtualStore
18
+ ? 'from the project-local virtual store to the global virtual store'
19
+ : 'from the global virtual store back to the project-local virtual store';
20
+ super(
21
+ `this install would switch "${workspacePath}" ${direction}, but the running bit is itself installed inside this workspace's node_modules.
22
+ The switch rebuilds this workspace's component packages from source, which would delete the running bit's compiled code mid-install and leave node_modules broken.
23
+ Run this one install with a bit installation that lives outside the workspace (e.g. a bvm-installed bit). Subsequent installs from within the workspace are safe in either layout.`
24
+ );
25
+ }
26
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/dependency-resolver",
3
- "version": "1.0.1096",
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.1096"
9
+ "version": "1.0.1098"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -22,44 +22,45 @@
22
22
  "multimatch": "5.0.0",
23
23
  "semver": "7.7.1",
24
24
  "p-limit": "3.1.0",
25
- "@pnpm/napi": "12.0.0-beta.4",
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",
36
+ "@teambit/bit.get-bit-version": "0.0.26",
37
+ "@teambit/cli": "0.0.1364",
33
38
  "@teambit/component-id": "1.2.4",
34
39
  "@teambit/component-version": "1.0.4",
40
+ "@teambit/component.sources": "0.0.197",
41
+ "@teambit/config-store": "0.0.245",
42
+ "@teambit/config": "0.0.1539",
43
+ "@teambit/harmony.modules.feature-toggle": "0.0.53",
44
+ "@teambit/harmony.modules.requireable-component": "0.0.524",
45
+ "@teambit/legacy.constants": "0.0.41",
46
+ "@teambit/legacy.consumer-component": "0.0.146",
47
+ "@teambit/legacy.extension-data": "0.0.147",
35
48
  "@teambit/pkg.entities.registry": "0.0.4",
49
+ "@teambit/pkg.modules.semver-helper": "0.0.33",
50
+ "@teambit/scope.network": "0.0.145",
51
+ "@teambit/workspace.modules.node-modules-linker": "0.0.376",
36
52
  "@teambit/workspace.root-components": "1.0.1",
53
+ "@teambit/component-issues": "0.0.183",
54
+ "@teambit/component-package-version": "0.0.460",
37
55
  "@teambit/legacy-bit-id": "1.1.3",
56
+ "@teambit/legacy.consumer-config": "0.0.145",
38
57
  "@teambit/toolbox.crypto.sha1": "0.0.20",
39
58
  "@teambit/toolbox.object.sorter": "0.0.2",
40
- "@teambit/component": "1.0.1096",
41
- "@teambit/envs": "1.0.1096",
42
- "@teambit/aspect-loader": "1.0.1096",
43
- "@teambit/logger": "0.0.1456",
44
- "@teambit/objects": "0.0.603",
45
- "@teambit/dependencies.fs.linked-dependencies": "0.0.70",
46
- "@teambit/pkg.modules.component-package-name": "0.0.151",
47
- "@teambit/graphql": "1.0.1096",
48
- "@teambit/cli": "0.0.1363",
49
- "@teambit/component.sources": "0.0.196",
50
- "@teambit/config-store": "0.0.244",
51
- "@teambit/config": "0.0.1538",
52
- "@teambit/harmony.modules.feature-toggle": "0.0.52",
53
- "@teambit/harmony.modules.requireable-component": "0.0.524",
54
- "@teambit/legacy.constants": "0.0.40",
55
- "@teambit/legacy.consumer-component": "0.0.145",
56
- "@teambit/legacy.extension-data": "0.0.146",
57
- "@teambit/pkg.modules.semver-helper": "0.0.33",
58
- "@teambit/scope.network": "0.0.144",
59
- "@teambit/workspace.modules.node-modules-linker": "0.0.375",
60
- "@teambit/component-issues": "0.0.183",
61
- "@teambit/component-package-version": "0.0.460",
62
- "@teambit/legacy.consumer-config": "0.0.144"
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"
63
64
  },
64
65
  "devDependencies": {
65
66
  "@types/fs-extra": "9.0.7",
@@ -67,7 +68,7 @@
67
68
  "sinon": "17.0.1",
68
69
  "@types/semver": "7.5.8",
69
70
  "@types/mocha": "9.1.0",
70
- "@teambit/dependencies.aspect-docs.dependency-resolver": "0.0.190",
71
+ "@teambit/dependencies.aspect-docs.dependency-resolver": "0.0.191",
71
72
  "@teambit/harmony.envs.core-aspect-env": "2.0.6"
72
73
  },
73
74
  "peerDependencies": {