@teambit/dependency-resolver 1.0.347 → 1.0.348
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/artifacts/__bit_junit.xml +32 -32
- package/artifacts/preview/teambit_dependencies_dependency_resolver-preview.js +1 -1
- package/artifacts/schema.json +984 -864
- package/dist/dependency-resolver.main.runtime.d.ts +5 -1
- package/dist/dependency-resolver.main.runtime.js +8 -6
- package/dist/dependency-resolver.main.runtime.js.map +1 -1
- package/dist/{preview-1721704844483.js → preview-1721791303259.js} +2 -2
- package/package.json +18 -18
|
@@ -221,7 +221,11 @@ export declare class DependencyResolverMain {
|
|
|
221
221
|
getPackageName(component: Component): string;
|
|
222
222
|
getDepResolverData(component: Component): DependencyResolverComponentData | undefined;
|
|
223
223
|
calcPackageName(component: Component): string;
|
|
224
|
-
getRuntimeModulePath(component: Component,
|
|
224
|
+
getRuntimeModulePath(component: Component, options: {
|
|
225
|
+
workspacePath: string;
|
|
226
|
+
rootComponentsPath: string;
|
|
227
|
+
isInWorkspace?: boolean;
|
|
228
|
+
}): string;
|
|
225
229
|
/**
|
|
226
230
|
* returns the package path in the /node_modules/ folder
|
|
227
231
|
* In case you call this in order to run the code from the path, please refer to the `getRuntimeModulePath` API
|
|
@@ -44,9 +44,9 @@ function _bit() {
|
|
|
44
44
|
};
|
|
45
45
|
return data;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const data = require("@teambit/
|
|
49
|
-
|
|
47
|
+
function _workspace() {
|
|
48
|
+
const data = require("@teambit/workspace.root-components");
|
|
49
|
+
_workspace = function () {
|
|
50
50
|
return data;
|
|
51
51
|
};
|
|
52
52
|
return data;
|
|
@@ -636,13 +636,15 @@ class DependencyResolverMain {
|
|
|
636
636
|
* Returns the location where the component is installed with its peer dependencies
|
|
637
637
|
* This is used in cases you want to actually run the components and make sure all the dependencies (especially peers) are resolved correctly
|
|
638
638
|
*/
|
|
639
|
-
getRuntimeModulePath(component,
|
|
639
|
+
getRuntimeModulePath(component, options) {
|
|
640
640
|
if (!this.hasRootComponents()) {
|
|
641
641
|
const modulePath = this.getModulePath(component);
|
|
642
642
|
return modulePath;
|
|
643
643
|
}
|
|
644
644
|
const pkgName = this.getPackageName(component);
|
|
645
|
-
const
|
|
645
|
+
const rootComponentsRelativePath = (0, _path().relative)(options.workspacePath, options.rootComponentsPath);
|
|
646
|
+
const getRelativeRootComponentDir = _workspace().getRootComponentDir.bind(null, rootComponentsRelativePath ?? '');
|
|
647
|
+
const selfRootDir = getRelativeRootComponentDir(options.isInWorkspace ? component.id.toStringWithoutVersion() : component.id.toString());
|
|
646
648
|
// In case the component is it's own root we want to load it from it's own root folder
|
|
647
649
|
if (_fsExtra().default.pathExistsSync(selfRootDir)) {
|
|
648
650
|
const innerDir = (0, _path().join)(selfRootDir, 'node_modules', pkgName);
|
|
@@ -652,7 +654,7 @@ class DependencyResolverMain {
|
|
|
652
654
|
return this.getModulePath(component);
|
|
653
655
|
}
|
|
654
656
|
const envId = this.envs.getEnvId(component);
|
|
655
|
-
const dirInEnvRoot = (0, _path().join)(
|
|
657
|
+
const dirInEnvRoot = (0, _path().join)(getRelativeRootComponentDir(envId), 'node_modules', pkgName);
|
|
656
658
|
if (_fsExtra().default.pathExistsSync(dirInEnvRoot)) return dirInEnvRoot;
|
|
657
659
|
return this.getModulePath(component);
|
|
658
660
|
}
|