@teambit/dependency-resolver 1.0.339 → 1.0.341
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 +23 -23
- package/artifacts/preview/teambit_dependencies_dependency_resolver-preview.js +1 -1
- package/artifacts/schema.json +858 -1146
- package/dist/dependency-resolver.main.runtime.d.ts +1 -6
- package/dist/dependency-resolver.main.runtime.js +6 -24
- package/dist/dependency-resolver.main.runtime.js.map +1 -1
- package/dist/{preview-1721223204715.js → preview-1721272773287.js} +2 -2
- package/package.json +18 -18
|
@@ -221,12 +221,7 @@ export declare class DependencyResolverMain {
|
|
|
221
221
|
getPackageName(component: Component): string;
|
|
222
222
|
getDepResolverData(component: Component): DependencyResolverComponentData | undefined;
|
|
223
223
|
calcPackageName(component: Component): string;
|
|
224
|
-
|
|
225
|
-
workspacePath: string;
|
|
226
|
-
rootComponentsPath: string;
|
|
227
|
-
}): string;
|
|
228
|
-
getRuntimeModulePathInCapsules(component: Component): string;
|
|
229
|
-
_getRuntimeModulePath(component: Component, rootComponentsRelativePath?: string): string;
|
|
224
|
+
getRuntimeModulePath(component: Component, isInWorkspace?: boolean): string;
|
|
230
225
|
/**
|
|
231
226
|
* returns the package path in the /node_modules/ folder
|
|
232
227
|
* 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 _bitRoots() {
|
|
48
|
+
const data = require("@teambit/bit-roots");
|
|
49
|
+
_bitRoots = function () {
|
|
50
50
|
return data;
|
|
51
51
|
};
|
|
52
52
|
return data;
|
|
@@ -632,35 +632,17 @@ class DependencyResolverMain {
|
|
|
632
632
|
return (0, _pkgModules().componentIdToPackageName)(component.state._consumer);
|
|
633
633
|
}
|
|
634
634
|
|
|
635
|
-
/*
|
|
636
|
-
* Returns the location where the component is installed with its peer dependencies inside a workspace.
|
|
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
|
-
*/
|
|
639
|
-
getRuntimeModulePathInWorkspace(component, opts) {
|
|
640
|
-
const rootComponentsRelativePath = (0, _path().relative)(opts.workspacePath, opts.rootComponentsPath);
|
|
641
|
-
return this._getRuntimeModulePath(component, rootComponentsRelativePath);
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
/*
|
|
645
|
-
* Returns the location where the component is installed with its peer dependencies inside capsules.
|
|
646
|
-
* This is used in cases you want to actually run the components and make sure all the dependencies (especially peers) are resolved correctly
|
|
647
|
-
*/
|
|
648
|
-
getRuntimeModulePathInCapsules(component) {
|
|
649
|
-
return this._getRuntimeModulePath(component);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
635
|
/*
|
|
653
636
|
* Returns the location where the component is installed with its peer dependencies
|
|
654
637
|
* This is used in cases you want to actually run the components and make sure all the dependencies (especially peers) are resolved correctly
|
|
655
638
|
*/
|
|
656
|
-
|
|
639
|
+
getRuntimeModulePath(component, isInWorkspace = false) {
|
|
657
640
|
if (!this.hasRootComponents()) {
|
|
658
641
|
const modulePath = this.getModulePath(component);
|
|
659
642
|
return modulePath;
|
|
660
643
|
}
|
|
661
644
|
const pkgName = this.getPackageName(component);
|
|
662
|
-
const
|
|
663
|
-
const selfRootDir = getRelativeRootComponentDir(rootComponentsRelativePath == null ? component.id.toString() : component.id.toStringWithoutVersion());
|
|
645
|
+
const selfRootDir = (0, _bitRoots().getRelativeRootComponentDir)(!isInWorkspace ? component.id.toString() : component.id.toStringWithoutVersion());
|
|
664
646
|
// In case the component is it's own root we want to load it from it's own root folder
|
|
665
647
|
if (_fsExtra().default.pathExistsSync(selfRootDir)) {
|
|
666
648
|
const innerDir = (0, _path().join)(selfRootDir, 'node_modules', pkgName);
|
|
@@ -670,7 +652,7 @@ class DependencyResolverMain {
|
|
|
670
652
|
return this.getModulePath(component);
|
|
671
653
|
}
|
|
672
654
|
const envId = this.envs.getEnvId(component);
|
|
673
|
-
const dirInEnvRoot = (0, _path().join)(getRelativeRootComponentDir(envId), 'node_modules', pkgName);
|
|
655
|
+
const dirInEnvRoot = (0, _path().join)((0, _bitRoots().getRelativeRootComponentDir)(envId), 'node_modules', pkgName);
|
|
674
656
|
if (_fsExtra().default.pathExistsSync(dirInEnvRoot)) return dirInEnvRoot;
|
|
675
657
|
return this.getModulePath(component);
|
|
676
658
|
}
|