@teambit/dependency-resolver 1.0.514 → 1.0.515
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 +29 -29
- package/artifacts/preview/teambit_dependencies_dependency_resolver-preview.js +1 -1
- package/artifacts/schema.json +11 -11
- package/dist/dependency-linker.js +2 -2
- package/dist/dependency-linker.js.map +1 -1
- package/dist/{preview-1736911321716.js → preview-1736934050040.js} +2 -2
- package/package.json +13 -13
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="50" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.dependencies/dependency-resolver@1.0.
|
|
3
|
+
<testsuite name="teambit.dependencies/dependency-resolver@1.0.515" timestamp="2025-01-15T10:11:47.569Z" tests="50" failures="0" errors="0" skipped="0">
|
|
4
4
|
<testcase classname="update-dependency-version.spec.js" name="should pick version from root policy, when no variation policy is present" time="0.027"/>
|
|
5
|
-
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer supportedRange is empty" time="0.
|
|
5
|
+
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer supportedRange is empty" time="0.047"/>
|
|
6
6
|
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer supportedRange is null"/>
|
|
7
7
|
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer version is empty" time="0.001"/>
|
|
8
8
|
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer version is null"/>
|
|
9
9
|
<testcase classname="apply-updates.spec.js" name="should apply updates on root dependencies" time="0.054"/>
|
|
10
10
|
<testcase classname="apply-updates.spec.js" name="should apply updates on variant dependencies" time="0.001"/>
|
|
11
|
-
<testcase classname="apply-updates.spec.js" name="should apply updates on component dependencies" time="0.
|
|
12
|
-
<testcase classname="get-all-policy-pkgs.spec.js" name="should read the version from a version object" time="0.
|
|
13
|
-
<testcase classname="get-all-policy-pkgs.spec.js" name="should deduplicate dependencies that are present in root policies" time="0.
|
|
14
|
-
<testcase classname="hoist-dependencies.spec.js" name="the root manifest should have the preserved version" time="0.
|
|
11
|
+
<testcase classname="apply-updates.spec.js" name="should apply updates on component dependencies" time="0.118"/>
|
|
12
|
+
<testcase classname="get-all-policy-pkgs.spec.js" name="should read the version from a version object" time="0.115"/>
|
|
13
|
+
<testcase classname="get-all-policy-pkgs.spec.js" name="should deduplicate dependencies that are present in root policies" time="0.073"/>
|
|
14
|
+
<testcase classname="hoist-dependencies.spec.js" name="the root manifest should have the preserved version" time="0.084"/>
|
|
15
15
|
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies which intersects with the preserved should be empty" time="0.001"/>
|
|
16
|
-
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies which not intersects with the preserved to have a proper version"
|
|
16
|
+
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies which not intersects with the preserved to have a proper version"/>
|
|
17
17
|
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies should be empty" time="0.002"/>
|
|
18
18
|
<testcase classname="hoist-dependencies.spec.js" name="should hoist the dependency to the root"/>
|
|
19
19
|
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies should be empty"/>
|
|
20
20
|
<testcase classname="hoist-dependencies.spec.js" name="should hoist the dependency to the root" time="0.001"/>
|
|
21
21
|
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies should be empty"/>
|
|
22
22
|
<testcase classname="hoist-dependencies.spec.js" name="should not hoist the dependency to the root"/>
|
|
23
|
-
<testcase classname="hoist-dependencies.spec.js" name="should have the peers in each component" time="0.
|
|
24
|
-
<testcase classname="hoist-dependencies.spec.js" name="should not hoist the dependency to the root"/>
|
|
25
|
-
<testcase classname="hoist-dependencies.spec.js" name="should not report about peer conflicts" time="0.001"/>
|
|
26
|
-
<testcase classname="hoist-dependencies.spec.js" name="should have the peers in each component"/>
|
|
23
|
+
<testcase classname="hoist-dependencies.spec.js" name="should have the peers in each component" time="0.013"/>
|
|
27
24
|
<testcase classname="hoist-dependencies.spec.js" name="should not hoist the dependency to the root" time="0.001"/>
|
|
25
|
+
<testcase classname="hoist-dependencies.spec.js" name="should not report about peer conflicts"/>
|
|
26
|
+
<testcase classname="hoist-dependencies.spec.js" name="should have the peers in each component"/>
|
|
27
|
+
<testcase classname="hoist-dependencies.spec.js" name="should not hoist the dependency to the root"/>
|
|
28
28
|
<testcase classname="hoist-dependencies.spec.js" name="should report about peer conflicts" time="0.001"/>
|
|
29
|
-
<testcase classname="hoist-dependencies.spec.js" name="should hoist the most common version to the root" time="0.
|
|
30
|
-
<testcase classname="hoist-dependencies.spec.js" name="should not put the most common version in the components that has it"
|
|
31
|
-
<testcase classname="hoist-dependencies.spec.js" name="should put other versions in the components"/>
|
|
32
|
-
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.
|
|
33
|
-
<testcase classname="hoist-dependencies.spec.js" name="should not put the dependency in components that matches the best range" time="0.
|
|
34
|
-
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.
|
|
29
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the most common version to the root" time="0.03"/>
|
|
30
|
+
<testcase classname="hoist-dependencies.spec.js" name="should not put the most common version in the components that has it"/>
|
|
31
|
+
<testcase classname="hoist-dependencies.spec.js" name="should put other versions in the components" time="0.001"/>
|
|
32
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.007"/>
|
|
33
|
+
<testcase classname="hoist-dependencies.spec.js" name="should not put the dependency in components that matches the best range" time="0.002"/>
|
|
34
|
+
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.002"/>
|
|
35
35
|
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best version to the root" time="0.001"/>
|
|
36
|
-
<testcase classname="hoist-dependencies.spec.js" name="should not put the dependency in components that matches the best version"/>
|
|
37
|
-
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components"
|
|
38
|
-
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.
|
|
36
|
+
<testcase classname="hoist-dependencies.spec.js" name="should not put the dependency in components that matches the best version" time="0.001"/>
|
|
37
|
+
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components"/>
|
|
38
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.001"/>
|
|
39
39
|
<testcase classname="hoist-dependencies.spec.js" name="should not put the dependency in components that matches the best range" time="0.001"/>
|
|
40
|
-
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.
|
|
41
|
-
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.
|
|
40
|
+
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.001"/>
|
|
41
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.028"/>
|
|
42
42
|
<testcase classname="hoist-dependencies.spec.js" name="should not put the dependency in components that matches the best range or the combined version" time="0.023"/>
|
|
43
|
-
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.
|
|
44
|
-
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return settings from global config" time="0.
|
|
43
|
+
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.023"/>
|
|
44
|
+
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return settings from global config" time="0.007"/>
|
|
45
45
|
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return settings from package manager config" time="0.001"/>
|
|
46
46
|
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return settings from aspect config"/>
|
|
47
|
-
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should merge settings from global config, package manager config, and aspect config"
|
|
48
|
-
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should read cafile when it is returned by the global config" time="0.
|
|
49
|
-
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return outdated dependencies" time="0.
|
|
47
|
+
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should merge settings from global config, package manager config, and aspect config"/>
|
|
48
|
+
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should read cafile when it is returned by the global config" time="0.005"/>
|
|
49
|
+
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return outdated dependencies" time="0.078"/>
|
|
50
50
|
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return outdated dependencies when forcedVersionBump is set to patch" time="0.001"/>
|
|
51
51
|
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return outdated dependencies when forcedVersionBump is set to minor" time="0.001"/>
|
|
52
|
-
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return outdated dependencies when forcedVersionBump is set to major"/>
|
|
53
|
-
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should throw an error if the env policy has a peer with an empty string set for the supportedRange" time="0.
|
|
52
|
+
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return outdated dependencies when forcedVersionBump is set to major" time="0.001"/>
|
|
53
|
+
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should throw an error if the env policy has a peer with an empty string set for the supportedRange" time="0.084"/>
|
|
54
54
|
</testsuite>
|
|
55
55
|
</testsuites>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.dependencies/dependency-resolver-preview"]=n():e["teambit.dependencies/dependency-resolver-preview"]=n()}(self,(()=>(()=>{"use strict";var e={392:(e,n,t)=>{var a={id:"teambit.dependencies/aspect-docs/dependency-resolver@0.0.181",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/dependency-resolver",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=c,d(t(594));var o=t(16),i=["components"];function d(e){return e&&e.__esModule?e:{default:e}}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},r.apply(null,arguments)}function l(e,n){if(null==e)return{};var t,a,o=s(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function s(e,n){if(null==e)return{};var t={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(n.includes(a))continue;t[a]=e[a]}return t}d.__bit_component=a,r.__bit_component=a,l.__bit_component=a,s.__bit_component=a;var p={},m="wrapper";function c(e){var n=e.components,t=l(e,i);return(0,o.mdx)(m,r({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.mdx)("p",null,"The ",(0,o.mdx)("a",{parentName:"p",href:"https://bit.cloud/teambit/dependencies/dependency-resolver"},"Dependency Resolver")," configures and installs dependencies for components in a Bit workspace. It auto-generates the dependency graph for components to spare us the tedious work of manually configuring it ourselves.\nIt does so by integrating the dependency policies set by various Bit extensions (primarily the workspace) with the components' parsed and analyzed ",(0,o.mdx)("inlineCode",{parentName:"p"},"import"),"/",(0,o.mdx)("inlineCode",{parentName:"p"},"require")," statements.\nIn addition to that, the Dependency Resolver offers an efficient API to manually modify the generated graph using policies that can be applied on groups of components."),(0,o.mdx)("h4",null,"Features"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"Auto-generated dependency graph"),":\nThe Dependency Resolver saves us time and effort by generating the dependency graph for each component handled by the workspace. It does so by parsing out all ",(0,o.mdx)("inlineCode",{parentName:"p"},"import")," \\ ",(0,o.mdx)("inlineCode",{parentName:"p"},"require")," statements in the component's files.\nIt then determines if these dependencies are packages, components or internal implementation files.\nIf they are external components or packages, it goes on to determine their version and dependency-type (",(0,o.mdx)("inlineCode",{parentName:"p"},"dependencies"),", ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies"),", ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies"),").")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"An efficient dependency configuration API:"),"\nThe Dependency Resolver strikes the right balance between automation and customization by offering a simple and efficient configuration API.\nUse it in the workspace configuration file to manually modify the version and dependency type of dependencies in the generated dependency graph.\nWhen used in combination with ",(0,o.mdx)("inlineCode",{parentName:"p"},"@teambit.workspace/variant")," it allows to define, in a cascading (CSS-like) way,\ndifferent dependency policies for different sets of components, and even to add or remove dependencies altogether.")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"Optimized dependency installation:"),"\nThe Dependency Resolver directs the package manager to install the correct packages in the correct location in the workspace file structure.\nWhen a dependency appears in the workspace dependency graph more than once, the Resolver searches for a common version that satisfies ",(0,o.mdx)("em",{parentName:"p"},"most")," dependent\ncomponents and installs it at the workspace root directory, where it can be shared by all relevant components."),(0,o.mdx)("blockquote",{parentName:"li"},(0,o.mdx)("p",{parentName:"blockquote"},"dependency versions that are used by a minority of components will be installed in each component's directory."))),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"A single 'install command for packages and components:"),"\nA single ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit install")," command will not only install packages but will also import components listed in your ",(0,o.mdx)("inlineCode",{parentName:"p"},".bitmap")," file.\nThese components will then be linked to your ",(0,o.mdx)("inlineCode",{parentName:"p"},"node_modules")," directory, to keep the same import pattern for both module types, components and packages.")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"Programmatic API for extensions and environments"),"\nThe Dependency Resolver provides other extensions and environments with an API that allows them to register their own dependency policies.\nFor example, the 'React environment' uses the Dependency Resolver to set 'react-dom' as a peerDependency for all components using it (in case a component author had either left ",(0,o.mdx)("inlineCode",{parentName:"p"},"react-dom")," out of its dependencies, or even registered it as a regular dependency)."))),(0,o.mdx)("h2",null,"Quickstart & configuration"),(0,o.mdx)("h3",null,"Auto-registered dependency version and type"),(0,o.mdx)("p",null,"Dependency policies define the version and dependency type of each package used by components in the workspace.\nWhen installing a package, the Dependency Resolver registers its version in the dependency configuration (if a version is not specified upon installation, it will default to the latest one)."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// At the root-level of the workspace configuration JSON\n{\n "@teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "lodash": "4.17.0"\n }\n }\n }\n}\n')),(0,o.mdx)("h2",null,"The dependency policies hierarchy"),(0,o.mdx)("p",null,"The Dependency Resolver integrates dependency policies from various sources to determine the component's final dependency graph.\nCases of conflicting policies are resolved according to a hierarchy of source types, where a 'higher' rule in the list overrides lower rules."),(0,o.mdx)("p",null,"The hierarchy in a descending order:"),(0,o.mdx)("ol",null,(0,o.mdx)("li",{parentName:"ol"},"Policies set by Variants (",(0,o.mdx)("inlineCode",{parentName:"li"},"@teambit/variants"),") and the ",(0,o.mdx)("inlineCode",{parentName:"li"},"component.json"),' files of "ejected" components (these two sources are merged by Variants).'),(0,o.mdx)("li",{parentName:"ol"},"Policies set by various extensions/aspects (using ",(0,o.mdx)("inlineCode",{parentName:"li"},"registerDependencyPolicy"),")"),(0,o.mdx)("li",{parentName:"ol"},"Policies set by the environment (using ",(0,o.mdx)("inlineCode",{parentName:"li"},"getDependencies"),")"),(0,o.mdx)("li",{parentName:"ol"},"Bit’s automated dependency detections, and policies set by the Dependency Resolver at the workspace configuration root-level.")),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"Use the ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit dependencies <component-id>")," command to understand the calculations and interactions which resolved to the generated dependency graph of a specific component.")),(0,o.mdx)("h3",null,"Select a package manager"),(0,o.mdx)("p",null,"The Dependency resolver does not replace package managers - it uses them and directs them.\nTo choose between 'Yarn' and 'pnpm', set the ",(0,o.mdx)("inlineCode",{parentName:"p"},"packageManager")," property to either of the following:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},"teambit.dependencies/yarn")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},"teambit.dependencies/pnpm"))),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// At the root-level of the workspace configuration JSON\n{\n "teambit.dependencies/dependency-resolver": {\n "packageManager": "teambit.dependencies/yarn"\n }\n}\n')),(0,o.mdx)("h3",null,"Select the type of node_modules"),(0,o.mdx)("p",null,"By default, pnpm creates a symlinked ",(0,o.mdx)("inlineCode",{parentName:"p"},"node_modules"),' whereas Yarn creates a "classic" hoisted one.\nThis may be changed by setting the ',(0,o.mdx)("inlineCode",{parentName:"p"},"nodeLinker")," configuration option."),(0,o.mdx)("p",null,"Allowed values of ",(0,o.mdx)("inlineCode",{parentName:"p"},"nodeLinker"),":"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"hoisted"')," - create a hoisted (aka flat) ",(0,o.mdx)("inlineCode",{parentName:"li"},"node_modules")," directory without using symlinks. Similar to the one created by npm or Yarn classic."),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"isolated"')," - create a ",(0,o.mdx)("inlineCode",{parentName:"li"},"node_modules")," directory using symlinks. All dependencies are symlinked from a flat storage at ",(0,o.mdx)("inlineCode",{parentName:"li"},"node_modules/.pnpm")," (when using pnpm) or ",(0,o.mdx)("inlineCode",{parentName:"li"},"node_modules/.store")," (when using Yarn).")),(0,o.mdx)("h3",null,"Apply policies on all relevant components"),(0,o.mdx)("p",null,"A dependency policy configured at the root level of the workspace configuration (JSON) will by default affect ",(0,o.mdx)("em",{parentName:"p"},"all")," components that have that package as their dependency (i.e., components that have this module listed in their generated dependency graph).\n",(0,o.mdx)("strong",{parentName:"p"},"Components that do not have this package as a dependency will not be affected.")),(0,o.mdx)("p",null,"For example:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// At the root-level of the workspace configuration JSON\n\n// Every component in the workspace that has \'lodash\' as a dependency will version \'3.0.0\'.\n// This policy will not affect any component that does not have \'lodash\' as a dependency.\n\n{\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "lodash": "3.0.0"\n }\n }\n }\n}\n')),(0,o.mdx)("h3",null,"Apply policies on a selected group of components"),(0,o.mdx)("p",null,"Dependency policies can be applied on a specific group of components. This is done using the ",(0,o.mdx)("inlineCode",{parentName:"p"},"@teambit.workspace/variants")," configuration API."),(0,o.mdx)("p",null,"For example, to set version ",(0,o.mdx)("inlineCode",{parentName:"p"},"1.0.0")," of ",(0,o.mdx)("inlineCode",{parentName:"p"},"classnames")," as a dependency of all components located inside the ",(0,o.mdx)("inlineCode",{parentName:"p"},"./components/react")," directory (or any of its sub-directories):"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.workspace/variants": {\n "components/react": {\n // this creates a variant for all components contained in the components/react directory and it\'s sub-directories\n "teambit.dependencies/dependency-resolver": {\n // this creates dependencies overrides for the current variant\n "policy": {\n "dependencies": {\n "classnames": "1.0.0"\n }\n }\n }\n }\n }\n}\n')),(0,o.mdx)("h3",null,"Remove a dependency"),(0,o.mdx)("p",null,'Dependency policies can also be used to move or remove a dependency. That\'s especially useful when a dependency is defined with an incorrect dependency type.\nFor example, a module can be "moved" from ',(0,o.mdx)("inlineCode",{parentName:"p"},"dependencies")," to ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies")," by removing it from ",(0,o.mdx)("inlineCode",{parentName:"p"},"dependencies")," and listing it under ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies"),"."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},' "teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "enzyme": "-"\n },\n "peerDependencies": {\n "enzyme": "^3.11.0"\n }\n }\n')),(0,o.mdx)("h3",null,"Override cascading policies"),(0,o.mdx)("p",null,"Policies set on a specific group of components will override any conflicting policies that have cascaded from more general configurations."),(0,o.mdx)("p",null,"For example, the following configuration will set ",(0,o.mdx)("inlineCode",{parentName:"p"},"classnames")," version ",(0,o.mdx)("inlineCode",{parentName:"p"},"1.0.0")," on all components using the ",(0,o.mdx)("inlineCode",{parentName:"p"},"react-ui")," namespace. This policy will override the workspace-level policy that uses version ",(0,o.mdx)("inlineCode",{parentName:"p"},"2.0.0")," of that same package."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// All components using the namespace \'react-ui\' will use version 1.0.0 of "classnames"\n// instead of version "2.0.0" which is set as the more general default for all components in the workspace\n{\n "teambit.workspace/workspace": {\n "name": "my-workspace"\n },\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "classnames": "2.0.0"\n }\n }\n },\n "teambit.workspace/variants": {\n "{react-ui/*}": {\n // the {} notation sets the variant grouping via namespace, so in this case any (/*) components whose namespace begins with \'react-ui\'\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "classnames": "1.0.0"\n }\n }\n }\n }\n}\n')),(0,o.mdx)("h3",null,'"Forcibly" add dependencies to a component'),(0,o.mdx)("p",null,'Dependency policies applied on a selected group of components will "forcibly" add the listed packages to any ',"[selected]"," component for whom the Dependency Resolved has not already identified that package as a dependency.\nThis can be useful when a component depends on another module but has no ",(0,o.mdx)("inlineCode",{parentName:"p"},"import"),"/",(0,o.mdx)("inlineCode",{parentName:"p"},"require")," statement to be parsed by the Dependency Resolver (for example, in a Webpack configuration file, or as a peerDependency of a consumed package)."),(0,o.mdx)("p",null,"In the following example, ",(0,o.mdx)("inlineCode",{parentName:"p"},"classnames@1.0.0"),' will be "forcibly" added as a dependency to any component using the ',(0,o.mdx)("inlineCode",{parentName:"p"},"react-ui")," namespace."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},' "teambit.workspace/variants": {\n "{react-ui/*}": {\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "classnames": "1.0.0"\n }\n }\n }\n }\n')),(0,o.mdx)("h3",null,"Set dependency types"),(0,o.mdx)("h4",null,"dev dependencies"),(0,o.mdx)("p",null,"Dev dependencies are determined by the type of file in a component that uses the dependency.\nIf it is a development file (e.g, ",(0,o.mdx)("inlineCode",{parentName:"p"},"doSomething.test.ts"),") then the packages consumed by it are also considered\nto be used for development and will therefore be registered as ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies"),". In cases where a module is consumed by both a runtime file and a development file, the module will be considered as a runtime (regular) dependency."),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies")," that are set by the Dependency Resolver will not be visible in the component's configuration. To validate that a dependency is registered as a dev dependency, use the ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit show <component>")," command.")),(0,o.mdx)("p",null,"The list of file patterns to be considered as development files is determined by the various Bit extensions. For example, the ",(0,o.mdx)("inlineCode",{parentName:"p"},"@teambit.react/react")," environment lists all ",(0,o.mdx)("inlineCode",{parentName:"p"},"*.spec.tsx")," files as dev files.\nAny component using that environment will have its ",(0,o.mdx)("inlineCode",{parentName:"p"},".spec.tsx")," files considered as dev files and all these files' dependencies considered as ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies"),"."),(0,o.mdx)("h5",null,"Register file patterns to be considered as dev files"),(0,o.mdx)("p",null,"Set the ",(0,o.mdx)("inlineCode",{parentName:"p"},"devFilePatterns")," property to add your own list of file extensions to be considered as development files (and to have all their dependencies considered as ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies"),"):"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// At the root-level of the workspace configuration JSON\n{\n "teambit.dependencies/dependency-resolver": {\n "devFilePatterns": [".spec.ts"]\n }\n}\n')),(0,o.mdx)("h5",null,"Configure specific dependencies as devDependencies"),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"Dependencies can be ",(0,o.mdx)("em",{parentName:"p"},"directly")," configured as ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies")," ",(0,o.mdx)("em",{parentName:"p"},"only")," via the ",(0,o.mdx)("inlineCode",{parentName:"p"},"variants")," config API.")),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.workspace/variants": {\n "*": {\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "devDependencies": {\n "react-test-renderer": "17.0.1"\n }\n }\n }\n }\n }\n}\n')),(0,o.mdx)("h4",null,"peer dependencies"),(0,o.mdx)("p",null,"Setting a package as a peer dependency ensures the package manager installs only a single version of that package. If that is not possible, i.e. if there is no single “agreed upon” version for all components in the workspace, then an error will be thrown."),(0,o.mdx)("p",null,"This can be crucial when different components communicate with each other using shared objects that are instantiated by an installed package (the dependency). If different versions of the same package create different object instances then the “means of communication” is broken. There is no single object to address, no single source of truth. This can turn out to be critical when working with modules that are used as “plugins” of another module (for example, Babel), or when working with components that are coordinated in runtime using a shared library (for example, React)."),(0,o.mdx)("p",null,"To set a package as a peer dependency, place it under the ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies")," entry, like so:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.bit/dependency-resolver": {\n "policy": {\n "dependencies": {},\n "peerDependencies": {\n "react": "^17.0.0",\n "react-dom": "^17.0.0",\n }\n }\n}\n')),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},'Peer dependencies are usually used in the context of a single "hosting code". That could be an application or a single component library.\nBit may generate multiple "hosts", one for each environment being used, to run components of different types.\nThat could translate into multiple versions of the same peer dependency, one for each environment.')),(0,o.mdx)("h2",null,"Enforce the installation of a specific package version"),(0,o.mdx)("p",null,"The dependency resolver determines the package version that best fits the requirements of most components consuming the same package.\nIt then installs it at the root of the workspace to make it available to all components sharing the same package (those that cannot use it will have their dependency installed inside their own directory)."),(0,o.mdx)("p",null,"As a result, a package installed by the Dependency Resolver may not have the same version that was specified in the Dependency Resolver policy.\nTo enforce the installation of the exact version specified in the policy, set the ",(0,o.mdx)("inlineCode",{parentName:"p"},"preserve")," property to ",(0,o.mdx)("inlineCode",{parentName:"p"},"true"),"."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "lodash": {\n "version": "3.0.0",\n "preserve": true\n }\n }\n }\n }\n}\n')),(0,o.mdx)("h2",null,"Set a proxy for outgoing HTTP/HTTPS requests"),(0,o.mdx)("p",null,"The package manager can be configured to use a proxy for outgoing network requests."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"proxy")," - A URL for a proxy to be used in both HTTP and HTTPS requests."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"httpsProxy")," - A URL specific for HTTPS requests (this will override the value set in ",(0,o.mdx)("inlineCode",{parentName:"p"},"proxy")," for HTTPS requests)."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.dependencies/dependency-resolver": {\n "proxy": "http://domain-one.proxy.com:8080",\n "httpsProxy": "http://domain-two.proxy.com:8080"\n }\n}\n')),(0,o.mdx)("h5",null,"A proxy can also be set in NPM's and Bit's global configurations"),(0,o.mdx)("p",null,"To get the value for 'proxy'/'https-proxy':"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit config get proxy\n\nbit config get https-proxy\n")),(0,o.mdx)("p",null,"To set a new 'proxy'/'https-proxy' value:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit config set proxy http://domain-one.proxy.com:8080\n\nbit config set https-proxy http://domain-one.proxy.com:8080\n")),(0,o.mdx)("p",null,"Read about setting a proxy in NPM's global configuration ",(0,o.mdx)("a",{parentName:"p",href:"https://docs.npmjs.com/cli/v6/using-npm/config#https-proxy"},"here")),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"Notice the Dependency Resolver config will override ",(0,o.mdx)("em",{parentName:"p"},"all")," other proxy configurations. The NPM config will override Bit's global proxy configurations.")),(0,o.mdx)("h2",null,"Network settings"),(0,o.mdx)("p",null,"Settings that allow to change how aggressively the package manager is making and retrying network requests. Currently, these settings affect only the behavior of pnpm."),(0,o.mdx)("p",null,"These are settings passed to the aspect configuration. For instance:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.dependencies/dependency-resolver": {\n "networkConcurrency": 4\n }\n}\n')),(0,o.mdx)("h3",null,"networkConcurrency"),(0,o.mdx)("p",null,"Controls the maximum number of HTTP(S) requests to process simultaneously."),(0,o.mdx)("h3",null,"fetchRetries"),(0,o.mdx)("p",null,"How many times to retry if Bit fails to fetch from the registry."),(0,o.mdx)("h3",null,"fetchRetryFactor"),(0,o.mdx)("p",null,"The exponential factor for retry backoff."),(0,o.mdx)("h3",null,"fetchRetryMintimeout"),(0,o.mdx)("p",null,"The minimum (base) timeout for retrying requests."),(0,o.mdx)("h3",null,"fetchRetryMaxtimeout"),(0,o.mdx)("p",null,"The maximum fallback timeout to ensure the retry factor does not make requests too long."),(0,o.mdx)("h3",null,"fetchTimeout"),(0,o.mdx)("p",null,"The maximum amount of time (in milliseconds) to wait for HTTP requests to complete."),(0,o.mdx)("h3",null,"maxSockets"),(0,o.mdx)("p",null,"The maximum number of connections to use per origin (protocol/host/port combination)."),(0,o.mdx)("h2",null,"Overrides"),(0,o.mdx)("p",null,"This field allows you to instruct Bit to override any dependency in the dependency graph. This is useful to enforce all your packages to use a single version of a dependency, backport a fix, or replace a dependency with a fork."),(0,o.mdx)("p",null,"An example of the ",(0,o.mdx)("inlineCode",{parentName:"p"},'"overrides"')," field:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "overrides": {\n "foo": "^1.0.0",\n "quux": "npm:@myorg/quux@^1.0.0",\n "bar@^2.1.0": "3.0.0",\n "qar@1>zoo": "2"\n }\n }\n}\n')),(0,o.mdx)("p",null,"You may specify the package the overriden dependency belongs to by separating the package selector from the dependency selector with a ",(0,o.mdx)("inlineCode",{parentName:"p"},'">"'),", for example ",(0,o.mdx)("inlineCode",{parentName:"p"},"qar@1>zoo")," will only override the ",(0,o.mdx)("inlineCode",{parentName:"p"},"zoo")," dependency of ",(0,o.mdx)("inlineCode",{parentName:"p"},"qar@1"),", not for any other dependencies."),(0,o.mdx)("h2",null,"Side-Effects cache"),(0,o.mdx)("p",null,"By default, when pnpm is set as the package manager, build artifacts are cached. So when installing a package with pre/postinstall hooks, it is only built the first time it is installed on a computer."),(0,o.mdx)("p",null,"Side-effects cache can be turned off by setting the ",(0,o.mdx)("inlineCode",{parentName:"p"},"sideEffectsCache")," field to ",(0,o.mdx)("inlineCode",{parentName:"p"},"false"),":"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "sideEffectsCache": false\n }\n}\n')),(0,o.mdx)("h2",null,"Node.js engine checks"),(0,o.mdx)("p",null,"If you want to prevent contributors of your project from adding new incompatible dependencies, use ",(0,o.mdx)("inlineCode",{parentName:"p"},"nodeVersion")," and ",(0,o.mdx)("inlineCode",{parentName:"p"},"engineStrict")," in your ",(0,o.mdx)("inlineCode",{parentName:"p"},"workspace.jsonc"),":"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "engineStrict": true,\n "nodeVersion": "12.22.0"\n }\n}\n')),(0,o.mdx)("p",null,"This way, even if someone is using Node.js v16, they will not be able to install a new dependency that doesn't support Node.js v12.22.0."),(0,o.mdx)("p",null,"NOTE: This works only with pnpm currently."),(0,o.mdx)("h2",null,"peerDependencyRules"),(0,o.mdx)("h3",null,"peerDependencyRules.ignoreMissing"),(0,o.mdx)("p",null,"Bit will not print warnings about missing peer dependencies from this list."),(0,o.mdx)("p",null,"For instance, with the following configuration, Bit will not print warnings if a dependency needs ",(0,o.mdx)("inlineCode",{parentName:"p"},"react")," but ",(0,o.mdx)("inlineCode",{parentName:"p"},"react")," is not installed:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "peerDependencyRules": {\n "ignoreMissing": ["react"]\n }\n }\n}\n')),(0,o.mdx)("p",null,"Package name patterns may also be used:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "peerDependencyRules": {\n "ignoreMissing": ["@babel/*", "@eslint/*"]\n }\n }\n}\n')),(0,o.mdx)("h3",null,"peerDependencyRules.allowedVersions"),(0,o.mdx)("p",null,"Unmet peer dependency warnings will not be printed for peer dependencies of the specified range."),(0,o.mdx)("p",null,"For instance, if you have some dependencies that need ",(0,o.mdx)("inlineCode",{parentName:"p"},"react@16")," but you know that they work fine with ",(0,o.mdx)("inlineCode",{parentName:"p"},"react@17"),", then you may use the following configuration:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "peerDependencyRules": {\n "allowedVersions": {\n "react": "17"\n }\n }\n }\n}\n')),(0,o.mdx)("p",null,"This will tell Bit that any dependency that has react in its peer dependencies should allow ",(0,o.mdx)("inlineCode",{parentName:"p"},"react")," v17 to be installed."),(0,o.mdx)("h3",null,"peerDependencyRules.allowAny"),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"allowAny")," is an array of package name patterns, any peer dependency matching the pattern will be resolved from any version, regardless of the range specified in ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies"),". For instance:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "peerDependencyRules": {\n "allowAny": ["@babel/*", "eslint"]\n }\n }\n}\n')),(0,o.mdx)("p",null,"The above setting will mute any warnings about peer dependency version mismatches related to ",(0,o.mdx)("inlineCode",{parentName:"p"},"@babel/")," packages or ",(0,o.mdx)("inlineCode",{parentName:"p"},"eslint"),"."),(0,o.mdx)("h2",null,"Build"),(0,o.mdx)("h3",null,"neverBuiltDependencies"),(0,o.mdx)("p",null,'This field allows to ignore the builds of specific dependencies. The "preinstall", "install", and "postinstall" scripts of the listed packages will not be executed during installation.'),(0,o.mdx)("p",null,'An example of the "neverBuiltDependencies" field:'),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "neverBuiltDependencies": ["fsevents", "level"]\n }\n}\n')),(0,o.mdx)("h2",null,"CLI reference"),(0,o.mdx)("h3",null,"install"),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"By default, the Dependency Resolver installs packages from Bit.dev's registry. The authentication for that registry is via your Bit.dev token, listed under ",(0,o.mdx)("inlineCode",{parentName:"p"},"@bit"),", in your ",(0,o.mdx)("inlineCode",{parentName:"p"},".npmrc")," file.\nIf that token cannot be found in the ",(0,o.mdx)("inlineCode",{parentName:"p"},".npmrc")," file, Bit will look for it in your global Bit configurations (use the ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit config")," command to output your ",(0,o.mdx)("inlineCode",{parentName:"p"},"user.token")," property)."),(0,o.mdx)("br",null),"If your npm is configured to use a registry other than npmjs's, then the Dependency Resolver will use that configured registry, instead."),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"The 'install' process includes importing components and linking them to the ",(0,o.mdx)("inlineCode",{parentName:"p"},"node_modules")," directory.")),(0,o.mdx)("h5",null,"Install all dependencies listed in the Dependency Resolver configuration:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit install\n")),(0,o.mdx)("h5",null,"Install the latest version of a package:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit install <package>\n\n// For example\nbit install lodash\n")),(0,o.mdx)("h5",null,"Install a specific version of a package:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit install <package>@<version>\n\n// For example\nbit install lodash@1.0.0\n")),(0,o.mdx)("h5",null,"Install packages without importing components"),(0,o.mdx)("p",null,"The 'install' process includes importing components listed in the ",(0,o.mdx)("inlineCode",{parentName:"p"},".bitmap")," file and linking them to the ",(0,o.mdx)("inlineCode",{parentName:"p"},"node_modules")," directory.\nTo disable importing and install all packages and components as standard packages use:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit install --skip-import\n")))}c.__bit_component=a,c.isMDXComponent=!0},171:(e,n,t)=>{Object.defineProperty(n,"Q",{enumerable:!0,get:function(){return a.default}});var a=o(t(392));function o(e){return e&&e.__esModule?e:{default:e}}o.__bit_component={id:"teambit.dependencies/aspect-docs/dependency-resolver@0.0.181",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/dependency-resolver",exported:!0}},311:(e,n,t)=>{var a={id:"teambit.dependencies/dependency-resolver@1.0.514",homepage:"https://bit.cloud/teambit/dependencies/dependency-resolver",exported:!0};function o(){const e=i(t(594));return o=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,o.__bit_component=a,i.__bit_component=a;const d=()=>o().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},o().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/dependencies.svg"}));d.__bit_component=a,n.Logo=d},16:e=>{e.exports=MdxJsReact},594:e=>{e.exports=React}},n={};function t(a){var o=n[a];if(void 0!==o)return o.exports;var i=n[a]={exports:{}};return e[a](i,i.exports,t),i.exports}t.d=(e,n)=>{for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};t.r(a),t.d(a,{compositions:()=>h,compositions_metadata:()=>y,overview:()=>x});var o={};t.r(o),t.d(o,{default:()=>u});var i=t(311),d=(t(594),t(16));const r=TeambitMdxUiMdxScopeContext;var l=t(171),s=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},p.apply(null,arguments)}var m={},c="wrapper";function u(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,a,o=function(e,n){if(null==e)return{};var t={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(n.includes(a))continue;t[a]=e[a]}return t}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(e,s);return(0,d.mdx)(c,p({},m,t,{components:n,mdxType:"MDXLayout"}),(0,d.mdx)(r.MDXScopeProvider,{components:{DependencyResolver:l.Q},mdxType:"MDXScopeProvider"},(0,d.mdx)(l.Q,{mdxType:"DependencyResolver"})))}u.isMDXComponent=!0;const h=[i],x=[o],y={compositions:[{displayName:"Logo",identifier:"Logo"}]};return a})()));
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.dependencies/dependency-resolver-preview"]=n():e["teambit.dependencies/dependency-resolver-preview"]=n()}(self,(()=>(()=>{"use strict";var e={392:(e,n,t)=>{var a={id:"teambit.dependencies/aspect-docs/dependency-resolver@0.0.181",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/dependency-resolver",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=c,d(t(594));var o=t(16),i=["components"];function d(e){return e&&e.__esModule?e:{default:e}}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},r.apply(null,arguments)}function l(e,n){if(null==e)return{};var t,a,o=s(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function s(e,n){if(null==e)return{};var t={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(n.includes(a))continue;t[a]=e[a]}return t}d.__bit_component=a,r.__bit_component=a,l.__bit_component=a,s.__bit_component=a;var p={},m="wrapper";function c(e){var n=e.components,t=l(e,i);return(0,o.mdx)(m,r({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.mdx)("p",null,"The ",(0,o.mdx)("a",{parentName:"p",href:"https://bit.cloud/teambit/dependencies/dependency-resolver"},"Dependency Resolver")," configures and installs dependencies for components in a Bit workspace. It auto-generates the dependency graph for components to spare us the tedious work of manually configuring it ourselves.\nIt does so by integrating the dependency policies set by various Bit extensions (primarily the workspace) with the components' parsed and analyzed ",(0,o.mdx)("inlineCode",{parentName:"p"},"import"),"/",(0,o.mdx)("inlineCode",{parentName:"p"},"require")," statements.\nIn addition to that, the Dependency Resolver offers an efficient API to manually modify the generated graph using policies that can be applied on groups of components."),(0,o.mdx)("h4",null,"Features"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"Auto-generated dependency graph"),":\nThe Dependency Resolver saves us time and effort by generating the dependency graph for each component handled by the workspace. It does so by parsing out all ",(0,o.mdx)("inlineCode",{parentName:"p"},"import")," \\ ",(0,o.mdx)("inlineCode",{parentName:"p"},"require")," statements in the component's files.\nIt then determines if these dependencies are packages, components or internal implementation files.\nIf they are external components or packages, it goes on to determine their version and dependency-type (",(0,o.mdx)("inlineCode",{parentName:"p"},"dependencies"),", ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies"),", ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies"),").")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"An efficient dependency configuration API:"),"\nThe Dependency Resolver strikes the right balance between automation and customization by offering a simple and efficient configuration API.\nUse it in the workspace configuration file to manually modify the version and dependency type of dependencies in the generated dependency graph.\nWhen used in combination with ",(0,o.mdx)("inlineCode",{parentName:"p"},"@teambit.workspace/variant")," it allows to define, in a cascading (CSS-like) way,\ndifferent dependency policies for different sets of components, and even to add or remove dependencies altogether.")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"Optimized dependency installation:"),"\nThe Dependency Resolver directs the package manager to install the correct packages in the correct location in the workspace file structure.\nWhen a dependency appears in the workspace dependency graph more than once, the Resolver searches for a common version that satisfies ",(0,o.mdx)("em",{parentName:"p"},"most")," dependent\ncomponents and installs it at the workspace root directory, where it can be shared by all relevant components."),(0,o.mdx)("blockquote",{parentName:"li"},(0,o.mdx)("p",{parentName:"blockquote"},"dependency versions that are used by a minority of components will be installed in each component's directory."))),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"A single 'install command for packages and components:"),"\nA single ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit install")," command will not only install packages but will also import components listed in your ",(0,o.mdx)("inlineCode",{parentName:"p"},".bitmap")," file.\nThese components will then be linked to your ",(0,o.mdx)("inlineCode",{parentName:"p"},"node_modules")," directory, to keep the same import pattern for both module types, components and packages.")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("p",{parentName:"li"},(0,o.mdx)("strong",{parentName:"p"},"Programmatic API for extensions and environments"),"\nThe Dependency Resolver provides other extensions and environments with an API that allows them to register their own dependency policies.\nFor example, the 'React environment' uses the Dependency Resolver to set 'react-dom' as a peerDependency for all components using it (in case a component author had either left ",(0,o.mdx)("inlineCode",{parentName:"p"},"react-dom")," out of its dependencies, or even registered it as a regular dependency)."))),(0,o.mdx)("h2",null,"Quickstart & configuration"),(0,o.mdx)("h3",null,"Auto-registered dependency version and type"),(0,o.mdx)("p",null,"Dependency policies define the version and dependency type of each package used by components in the workspace.\nWhen installing a package, the Dependency Resolver registers its version in the dependency configuration (if a version is not specified upon installation, it will default to the latest one)."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// At the root-level of the workspace configuration JSON\n{\n "@teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "lodash": "4.17.0"\n }\n }\n }\n}\n')),(0,o.mdx)("h2",null,"The dependency policies hierarchy"),(0,o.mdx)("p",null,"The Dependency Resolver integrates dependency policies from various sources to determine the component's final dependency graph.\nCases of conflicting policies are resolved according to a hierarchy of source types, where a 'higher' rule in the list overrides lower rules."),(0,o.mdx)("p",null,"The hierarchy in a descending order:"),(0,o.mdx)("ol",null,(0,o.mdx)("li",{parentName:"ol"},"Policies set by Variants (",(0,o.mdx)("inlineCode",{parentName:"li"},"@teambit/variants"),") and the ",(0,o.mdx)("inlineCode",{parentName:"li"},"component.json"),' files of "ejected" components (these two sources are merged by Variants).'),(0,o.mdx)("li",{parentName:"ol"},"Policies set by various extensions/aspects (using ",(0,o.mdx)("inlineCode",{parentName:"li"},"registerDependencyPolicy"),")"),(0,o.mdx)("li",{parentName:"ol"},"Policies set by the environment (using ",(0,o.mdx)("inlineCode",{parentName:"li"},"getDependencies"),")"),(0,o.mdx)("li",{parentName:"ol"},"Bit’s automated dependency detections, and policies set by the Dependency Resolver at the workspace configuration root-level.")),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"Use the ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit dependencies <component-id>")," command to understand the calculations and interactions which resolved to the generated dependency graph of a specific component.")),(0,o.mdx)("h3",null,"Select a package manager"),(0,o.mdx)("p",null,"The Dependency resolver does not replace package managers - it uses them and directs them.\nTo choose between 'Yarn' and 'pnpm', set the ",(0,o.mdx)("inlineCode",{parentName:"p"},"packageManager")," property to either of the following:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},"teambit.dependencies/yarn")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},"teambit.dependencies/pnpm"))),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// At the root-level of the workspace configuration JSON\n{\n "teambit.dependencies/dependency-resolver": {\n "packageManager": "teambit.dependencies/yarn"\n }\n}\n')),(0,o.mdx)("h3",null,"Select the type of node_modules"),(0,o.mdx)("p",null,"By default, pnpm creates a symlinked ",(0,o.mdx)("inlineCode",{parentName:"p"},"node_modules"),' whereas Yarn creates a "classic" hoisted one.\nThis may be changed by setting the ',(0,o.mdx)("inlineCode",{parentName:"p"},"nodeLinker")," configuration option."),(0,o.mdx)("p",null,"Allowed values of ",(0,o.mdx)("inlineCode",{parentName:"p"},"nodeLinker"),":"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"hoisted"')," - create a hoisted (aka flat) ",(0,o.mdx)("inlineCode",{parentName:"li"},"node_modules")," directory without using symlinks. Similar to the one created by npm or Yarn classic."),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"isolated"')," - create a ",(0,o.mdx)("inlineCode",{parentName:"li"},"node_modules")," directory using symlinks. All dependencies are symlinked from a flat storage at ",(0,o.mdx)("inlineCode",{parentName:"li"},"node_modules/.pnpm")," (when using pnpm) or ",(0,o.mdx)("inlineCode",{parentName:"li"},"node_modules/.store")," (when using Yarn).")),(0,o.mdx)("h3",null,"Apply policies on all relevant components"),(0,o.mdx)("p",null,"A dependency policy configured at the root level of the workspace configuration (JSON) will by default affect ",(0,o.mdx)("em",{parentName:"p"},"all")," components that have that package as their dependency (i.e., components that have this module listed in their generated dependency graph).\n",(0,o.mdx)("strong",{parentName:"p"},"Components that do not have this package as a dependency will not be affected.")),(0,o.mdx)("p",null,"For example:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// At the root-level of the workspace configuration JSON\n\n// Every component in the workspace that has \'lodash\' as a dependency will version \'3.0.0\'.\n// This policy will not affect any component that does not have \'lodash\' as a dependency.\n\n{\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "lodash": "3.0.0"\n }\n }\n }\n}\n')),(0,o.mdx)("h3",null,"Apply policies on a selected group of components"),(0,o.mdx)("p",null,"Dependency policies can be applied on a specific group of components. This is done using the ",(0,o.mdx)("inlineCode",{parentName:"p"},"@teambit.workspace/variants")," configuration API."),(0,o.mdx)("p",null,"For example, to set version ",(0,o.mdx)("inlineCode",{parentName:"p"},"1.0.0")," of ",(0,o.mdx)("inlineCode",{parentName:"p"},"classnames")," as a dependency of all components located inside the ",(0,o.mdx)("inlineCode",{parentName:"p"},"./components/react")," directory (or any of its sub-directories):"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.workspace/variants": {\n "components/react": {\n // this creates a variant for all components contained in the components/react directory and it\'s sub-directories\n "teambit.dependencies/dependency-resolver": {\n // this creates dependencies overrides for the current variant\n "policy": {\n "dependencies": {\n "classnames": "1.0.0"\n }\n }\n }\n }\n }\n}\n')),(0,o.mdx)("h3",null,"Remove a dependency"),(0,o.mdx)("p",null,'Dependency policies can also be used to move or remove a dependency. That\'s especially useful when a dependency is defined with an incorrect dependency type.\nFor example, a module can be "moved" from ',(0,o.mdx)("inlineCode",{parentName:"p"},"dependencies")," to ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies")," by removing it from ",(0,o.mdx)("inlineCode",{parentName:"p"},"dependencies")," and listing it under ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies"),"."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},' "teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "enzyme": "-"\n },\n "peerDependencies": {\n "enzyme": "^3.11.0"\n }\n }\n')),(0,o.mdx)("h3",null,"Override cascading policies"),(0,o.mdx)("p",null,"Policies set on a specific group of components will override any conflicting policies that have cascaded from more general configurations."),(0,o.mdx)("p",null,"For example, the following configuration will set ",(0,o.mdx)("inlineCode",{parentName:"p"},"classnames")," version ",(0,o.mdx)("inlineCode",{parentName:"p"},"1.0.0")," on all components using the ",(0,o.mdx)("inlineCode",{parentName:"p"},"react-ui")," namespace. This policy will override the workspace-level policy that uses version ",(0,o.mdx)("inlineCode",{parentName:"p"},"2.0.0")," of that same package."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// All components using the namespace \'react-ui\' will use version 1.0.0 of "classnames"\n// instead of version "2.0.0" which is set as the more general default for all components in the workspace\n{\n "teambit.workspace/workspace": {\n "name": "my-workspace"\n },\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "classnames": "2.0.0"\n }\n }\n },\n "teambit.workspace/variants": {\n "{react-ui/*}": {\n // the {} notation sets the variant grouping via namespace, so in this case any (/*) components whose namespace begins with \'react-ui\'\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "classnames": "1.0.0"\n }\n }\n }\n }\n}\n')),(0,o.mdx)("h3",null,'"Forcibly" add dependencies to a component'),(0,o.mdx)("p",null,'Dependency policies applied on a selected group of components will "forcibly" add the listed packages to any ',"[selected]"," component for whom the Dependency Resolved has not already identified that package as a dependency.\nThis can be useful when a component depends on another module but has no ",(0,o.mdx)("inlineCode",{parentName:"p"},"import"),"/",(0,o.mdx)("inlineCode",{parentName:"p"},"require")," statement to be parsed by the Dependency Resolver (for example, in a Webpack configuration file, or as a peerDependency of a consumed package)."),(0,o.mdx)("p",null,"In the following example, ",(0,o.mdx)("inlineCode",{parentName:"p"},"classnames@1.0.0"),' will be "forcibly" added as a dependency to any component using the ',(0,o.mdx)("inlineCode",{parentName:"p"},"react-ui")," namespace."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},' "teambit.workspace/variants": {\n "{react-ui/*}": {\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "classnames": "1.0.0"\n }\n }\n }\n }\n')),(0,o.mdx)("h3",null,"Set dependency types"),(0,o.mdx)("h4",null,"dev dependencies"),(0,o.mdx)("p",null,"Dev dependencies are determined by the type of file in a component that uses the dependency.\nIf it is a development file (e.g, ",(0,o.mdx)("inlineCode",{parentName:"p"},"doSomething.test.ts"),") then the packages consumed by it are also considered\nto be used for development and will therefore be registered as ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies"),". In cases where a module is consumed by both a runtime file and a development file, the module will be considered as a runtime (regular) dependency."),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies")," that are set by the Dependency Resolver will not be visible in the component's configuration. To validate that a dependency is registered as a dev dependency, use the ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit show <component>")," command.")),(0,o.mdx)("p",null,"The list of file patterns to be considered as development files is determined by the various Bit extensions. For example, the ",(0,o.mdx)("inlineCode",{parentName:"p"},"@teambit.react/react")," environment lists all ",(0,o.mdx)("inlineCode",{parentName:"p"},"*.spec.tsx")," files as dev files.\nAny component using that environment will have its ",(0,o.mdx)("inlineCode",{parentName:"p"},".spec.tsx")," files considered as dev files and all these files' dependencies considered as ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies"),"."),(0,o.mdx)("h5",null,"Register file patterns to be considered as dev files"),(0,o.mdx)("p",null,"Set the ",(0,o.mdx)("inlineCode",{parentName:"p"},"devFilePatterns")," property to add your own list of file extensions to be considered as development files (and to have all their dependencies considered as ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies"),"):"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'// At the root-level of the workspace configuration JSON\n{\n "teambit.dependencies/dependency-resolver": {\n "devFilePatterns": [".spec.ts"]\n }\n}\n')),(0,o.mdx)("h5",null,"Configure specific dependencies as devDependencies"),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"Dependencies can be ",(0,o.mdx)("em",{parentName:"p"},"directly")," configured as ",(0,o.mdx)("inlineCode",{parentName:"p"},"devDependencies")," ",(0,o.mdx)("em",{parentName:"p"},"only")," via the ",(0,o.mdx)("inlineCode",{parentName:"p"},"variants")," config API.")),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.workspace/variants": {\n "*": {\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "devDependencies": {\n "react-test-renderer": "17.0.1"\n }\n }\n }\n }\n }\n}\n')),(0,o.mdx)("h4",null,"peer dependencies"),(0,o.mdx)("p",null,"Setting a package as a peer dependency ensures the package manager installs only a single version of that package. If that is not possible, i.e. if there is no single “agreed upon” version for all components in the workspace, then an error will be thrown."),(0,o.mdx)("p",null,"This can be crucial when different components communicate with each other using shared objects that are instantiated by an installed package (the dependency). If different versions of the same package create different object instances then the “means of communication” is broken. There is no single object to address, no single source of truth. This can turn out to be critical when working with modules that are used as “plugins” of another module (for example, Babel), or when working with components that are coordinated in runtime using a shared library (for example, React)."),(0,o.mdx)("p",null,"To set a package as a peer dependency, place it under the ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies")," entry, like so:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.bit/dependency-resolver": {\n "policy": {\n "dependencies": {},\n "peerDependencies": {\n "react": "^17.0.0",\n "react-dom": "^17.0.0",\n }\n }\n}\n')),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},'Peer dependencies are usually used in the context of a single "hosting code". That could be an application or a single component library.\nBit may generate multiple "hosts", one for each environment being used, to run components of different types.\nThat could translate into multiple versions of the same peer dependency, one for each environment.')),(0,o.mdx)("h2",null,"Enforce the installation of a specific package version"),(0,o.mdx)("p",null,"The dependency resolver determines the package version that best fits the requirements of most components consuming the same package.\nIt then installs it at the root of the workspace to make it available to all components sharing the same package (those that cannot use it will have their dependency installed inside their own directory)."),(0,o.mdx)("p",null,"As a result, a package installed by the Dependency Resolver may not have the same version that was specified in the Dependency Resolver policy.\nTo enforce the installation of the exact version specified in the policy, set the ",(0,o.mdx)("inlineCode",{parentName:"p"},"preserve")," property to ",(0,o.mdx)("inlineCode",{parentName:"p"},"true"),"."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.dependencies/dependency-resolver": {\n "policy": {\n "dependencies": {\n "lodash": {\n "version": "3.0.0",\n "preserve": true\n }\n }\n }\n }\n}\n')),(0,o.mdx)("h2",null,"Set a proxy for outgoing HTTP/HTTPS requests"),(0,o.mdx)("p",null,"The package manager can be configured to use a proxy for outgoing network requests."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"proxy")," - A URL for a proxy to be used in both HTTP and HTTPS requests."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"httpsProxy")," - A URL specific for HTTPS requests (this will override the value set in ",(0,o.mdx)("inlineCode",{parentName:"p"},"proxy")," for HTTPS requests)."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.dependencies/dependency-resolver": {\n "proxy": "http://domain-one.proxy.com:8080",\n "httpsProxy": "http://domain-two.proxy.com:8080"\n }\n}\n')),(0,o.mdx)("h5",null,"A proxy can also be set in NPM's and Bit's global configurations"),(0,o.mdx)("p",null,"To get the value for 'proxy'/'https-proxy':"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit config get proxy\n\nbit config get https-proxy\n")),(0,o.mdx)("p",null,"To set a new 'proxy'/'https-proxy' value:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit config set proxy http://domain-one.proxy.com:8080\n\nbit config set https-proxy http://domain-one.proxy.com:8080\n")),(0,o.mdx)("p",null,"Read about setting a proxy in NPM's global configuration ",(0,o.mdx)("a",{parentName:"p",href:"https://docs.npmjs.com/cli/v6/using-npm/config#https-proxy"},"here")),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"Notice the Dependency Resolver config will override ",(0,o.mdx)("em",{parentName:"p"},"all")," other proxy configurations. The NPM config will override Bit's global proxy configurations.")),(0,o.mdx)("h2",null,"Network settings"),(0,o.mdx)("p",null,"Settings that allow to change how aggressively the package manager is making and retrying network requests. Currently, these settings affect only the behavior of pnpm."),(0,o.mdx)("p",null,"These are settings passed to the aspect configuration. For instance:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "teambit.dependencies/dependency-resolver": {\n "networkConcurrency": 4\n }\n}\n')),(0,o.mdx)("h3",null,"networkConcurrency"),(0,o.mdx)("p",null,"Controls the maximum number of HTTP(S) requests to process simultaneously."),(0,o.mdx)("h3",null,"fetchRetries"),(0,o.mdx)("p",null,"How many times to retry if Bit fails to fetch from the registry."),(0,o.mdx)("h3",null,"fetchRetryFactor"),(0,o.mdx)("p",null,"The exponential factor for retry backoff."),(0,o.mdx)("h3",null,"fetchRetryMintimeout"),(0,o.mdx)("p",null,"The minimum (base) timeout for retrying requests."),(0,o.mdx)("h3",null,"fetchRetryMaxtimeout"),(0,o.mdx)("p",null,"The maximum fallback timeout to ensure the retry factor does not make requests too long."),(0,o.mdx)("h3",null,"fetchTimeout"),(0,o.mdx)("p",null,"The maximum amount of time (in milliseconds) to wait for HTTP requests to complete."),(0,o.mdx)("h3",null,"maxSockets"),(0,o.mdx)("p",null,"The maximum number of connections to use per origin (protocol/host/port combination)."),(0,o.mdx)("h2",null,"Overrides"),(0,o.mdx)("p",null,"This field allows you to instruct Bit to override any dependency in the dependency graph. This is useful to enforce all your packages to use a single version of a dependency, backport a fix, or replace a dependency with a fork."),(0,o.mdx)("p",null,"An example of the ",(0,o.mdx)("inlineCode",{parentName:"p"},'"overrides"')," field:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "overrides": {\n "foo": "^1.0.0",\n "quux": "npm:@myorg/quux@^1.0.0",\n "bar@^2.1.0": "3.0.0",\n "qar@1>zoo": "2"\n }\n }\n}\n')),(0,o.mdx)("p",null,"You may specify the package the overriden dependency belongs to by separating the package selector from the dependency selector with a ",(0,o.mdx)("inlineCode",{parentName:"p"},'">"'),", for example ",(0,o.mdx)("inlineCode",{parentName:"p"},"qar@1>zoo")," will only override the ",(0,o.mdx)("inlineCode",{parentName:"p"},"zoo")," dependency of ",(0,o.mdx)("inlineCode",{parentName:"p"},"qar@1"),", not for any other dependencies."),(0,o.mdx)("h2",null,"Side-Effects cache"),(0,o.mdx)("p",null,"By default, when pnpm is set as the package manager, build artifacts are cached. So when installing a package with pre/postinstall hooks, it is only built the first time it is installed on a computer."),(0,o.mdx)("p",null,"Side-effects cache can be turned off by setting the ",(0,o.mdx)("inlineCode",{parentName:"p"},"sideEffectsCache")," field to ",(0,o.mdx)("inlineCode",{parentName:"p"},"false"),":"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "sideEffectsCache": false\n }\n}\n')),(0,o.mdx)("h2",null,"Node.js engine checks"),(0,o.mdx)("p",null,"If you want to prevent contributors of your project from adding new incompatible dependencies, use ",(0,o.mdx)("inlineCode",{parentName:"p"},"nodeVersion")," and ",(0,o.mdx)("inlineCode",{parentName:"p"},"engineStrict")," in your ",(0,o.mdx)("inlineCode",{parentName:"p"},"workspace.jsonc"),":"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "engineStrict": true,\n "nodeVersion": "12.22.0"\n }\n}\n')),(0,o.mdx)("p",null,"This way, even if someone is using Node.js v16, they will not be able to install a new dependency that doesn't support Node.js v12.22.0."),(0,o.mdx)("p",null,"NOTE: This works only with pnpm currently."),(0,o.mdx)("h2",null,"peerDependencyRules"),(0,o.mdx)("h3",null,"peerDependencyRules.ignoreMissing"),(0,o.mdx)("p",null,"Bit will not print warnings about missing peer dependencies from this list."),(0,o.mdx)("p",null,"For instance, with the following configuration, Bit will not print warnings if a dependency needs ",(0,o.mdx)("inlineCode",{parentName:"p"},"react")," but ",(0,o.mdx)("inlineCode",{parentName:"p"},"react")," is not installed:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "peerDependencyRules": {\n "ignoreMissing": ["react"]\n }\n }\n}\n')),(0,o.mdx)("p",null,"Package name patterns may also be used:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "peerDependencyRules": {\n "ignoreMissing": ["@babel/*", "@eslint/*"]\n }\n }\n}\n')),(0,o.mdx)("h3",null,"peerDependencyRules.allowedVersions"),(0,o.mdx)("p",null,"Unmet peer dependency warnings will not be printed for peer dependencies of the specified range."),(0,o.mdx)("p",null,"For instance, if you have some dependencies that need ",(0,o.mdx)("inlineCode",{parentName:"p"},"react@16")," but you know that they work fine with ",(0,o.mdx)("inlineCode",{parentName:"p"},"react@17"),", then you may use the following configuration:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "peerDependencyRules": {\n "allowedVersions": {\n "react": "17"\n }\n }\n }\n}\n')),(0,o.mdx)("p",null,"This will tell Bit that any dependency that has react in its peer dependencies should allow ",(0,o.mdx)("inlineCode",{parentName:"p"},"react")," v17 to be installed."),(0,o.mdx)("h3",null,"peerDependencyRules.allowAny"),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"allowAny")," is an array of package name patterns, any peer dependency matching the pattern will be resolved from any version, regardless of the range specified in ",(0,o.mdx)("inlineCode",{parentName:"p"},"peerDependencies"),". For instance:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "peerDependencyRules": {\n "allowAny": ["@babel/*", "eslint"]\n }\n }\n}\n')),(0,o.mdx)("p",null,"The above setting will mute any warnings about peer dependency version mismatches related to ",(0,o.mdx)("inlineCode",{parentName:"p"},"@babel/")," packages or ",(0,o.mdx)("inlineCode",{parentName:"p"},"eslint"),"."),(0,o.mdx)("h2",null,"Build"),(0,o.mdx)("h3",null,"neverBuiltDependencies"),(0,o.mdx)("p",null,'This field allows to ignore the builds of specific dependencies. The "preinstall", "install", and "postinstall" scripts of the listed packages will not be executed during installation.'),(0,o.mdx)("p",null,'An example of the "neverBuiltDependencies" field:'),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'{\n "@teambit.dependencies/dependency-resolver": {\n "neverBuiltDependencies": ["fsevents", "level"]\n }\n}\n')),(0,o.mdx)("h2",null,"CLI reference"),(0,o.mdx)("h3",null,"install"),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"By default, the Dependency Resolver installs packages from Bit.dev's registry. The authentication for that registry is via your Bit.dev token, listed under ",(0,o.mdx)("inlineCode",{parentName:"p"},"@bit"),", in your ",(0,o.mdx)("inlineCode",{parentName:"p"},".npmrc")," file.\nIf that token cannot be found in the ",(0,o.mdx)("inlineCode",{parentName:"p"},".npmrc")," file, Bit will look for it in your global Bit configurations (use the ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit config")," command to output your ",(0,o.mdx)("inlineCode",{parentName:"p"},"user.token")," property)."),(0,o.mdx)("br",null),"If your npm is configured to use a registry other than npmjs's, then the Dependency Resolver will use that configured registry, instead."),(0,o.mdx)("blockquote",null,(0,o.mdx)("p",{parentName:"blockquote"},"The 'install' process includes importing components and linking them to the ",(0,o.mdx)("inlineCode",{parentName:"p"},"node_modules")," directory.")),(0,o.mdx)("h5",null,"Install all dependencies listed in the Dependency Resolver configuration:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit install\n")),(0,o.mdx)("h5",null,"Install the latest version of a package:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit install <package>\n\n// For example\nbit install lodash\n")),(0,o.mdx)("h5",null,"Install a specific version of a package:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit install <package>@<version>\n\n// For example\nbit install lodash@1.0.0\n")),(0,o.mdx)("h5",null,"Install packages without importing components"),(0,o.mdx)("p",null,"The 'install' process includes importing components listed in the ",(0,o.mdx)("inlineCode",{parentName:"p"},".bitmap")," file and linking them to the ",(0,o.mdx)("inlineCode",{parentName:"p"},"node_modules")," directory.\nTo disable importing and install all packages and components as standard packages use:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-bash"},"bit install --skip-import\n")))}c.__bit_component=a,c.isMDXComponent=!0},171:(e,n,t)=>{Object.defineProperty(n,"Q",{enumerable:!0,get:function(){return a.default}});var a=o(t(392));function o(e){return e&&e.__esModule?e:{default:e}}o.__bit_component={id:"teambit.dependencies/aspect-docs/dependency-resolver@0.0.181",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/dependency-resolver",exported:!0}},158:(e,n,t)=>{var a={id:"teambit.dependencies/dependency-resolver@1.0.515",homepage:"https://bit.cloud/teambit/dependencies/dependency-resolver",exported:!0};function o(){const e=i(t(594));return o=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,o.__bit_component=a,i.__bit_component=a;const d=()=>o().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},o().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/dependencies.svg"}));d.__bit_component=a,n.Logo=d},16:e=>{e.exports=MdxJsReact},594:e=>{e.exports=React}},n={};function t(a){var o=n[a];if(void 0!==o)return o.exports;var i=n[a]={exports:{}};return e[a](i,i.exports,t),i.exports}t.d=(e,n)=>{for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};t.r(a),t.d(a,{compositions:()=>h,compositions_metadata:()=>y,overview:()=>x});var o={};t.r(o),t.d(o,{default:()=>u});var i=t(158),d=(t(594),t(16));const r=TeambitMdxUiMdxScopeContext;var l=t(171),s=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},p.apply(null,arguments)}var m={},c="wrapper";function u(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,a,o=function(e,n){if(null==e)return{};var t={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(n.includes(a))continue;t[a]=e[a]}return t}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(e,s);return(0,d.mdx)(c,p({},m,t,{components:n,mdxType:"MDXLayout"}),(0,d.mdx)(r.MDXScopeProvider,{components:{DependencyResolver:l.Q},mdxType:"MDXScopeProvider"},(0,d.mdx)(l.Q,{mdxType:"DependencyResolver"})))}u.isMDXComponent=!0;const h=[i],x=[o],y={compositions:[{displayName:"Logo",identifier:"Logo"}]};return a})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -10907,7 +10907,7 @@
|
|
|
10907
10907
|
"line": 1375,
|
|
10908
10908
|
"character": 5
|
|
10909
10909
|
},
|
|
10910
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
10910
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
10911
10911
|
"name": "forceVersionBump",
|
|
10912
10912
|
"type": {
|
|
10913
10913
|
"__schema": "TypeUnionSchema",
|
|
@@ -11165,7 +11165,7 @@
|
|
|
11165
11165
|
"line": 1375,
|
|
11166
11166
|
"character": 5
|
|
11167
11167
|
},
|
|
11168
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
11168
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
11169
11169
|
"name": "forceVersionBump",
|
|
11170
11170
|
"type": {
|
|
11171
11171
|
"__schema": "TypeUnionSchema",
|
|
@@ -11334,7 +11334,7 @@
|
|
|
11334
11334
|
"line": 1433,
|
|
11335
11335
|
"character": 7
|
|
11336
11336
|
},
|
|
11337
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
11337
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
11338
11338
|
"name": "forceVersionBump",
|
|
11339
11339
|
"type": {
|
|
11340
11340
|
"__schema": "TypeUnionSchema",
|
|
@@ -11415,7 +11415,7 @@
|
|
|
11415
11415
|
"line": 1433,
|
|
11416
11416
|
"character": 7
|
|
11417
11417
|
},
|
|
11418
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
11418
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
11419
11419
|
"name": "forceVersionBump",
|
|
11420
11420
|
"type": {
|
|
11421
11421
|
"__schema": "TypeUnionSchema",
|
|
@@ -38676,7 +38676,7 @@
|
|
|
38676
38676
|
"line": 1375,
|
|
38677
38677
|
"character": 5
|
|
38678
38678
|
},
|
|
38679
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
38679
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
38680
38680
|
"name": "forceVersionBump",
|
|
38681
38681
|
"type": {
|
|
38682
38682
|
"__schema": "TypeUnionSchema",
|
|
@@ -38934,7 +38934,7 @@
|
|
|
38934
38934
|
"line": 1375,
|
|
38935
38935
|
"character": 5
|
|
38936
38936
|
},
|
|
38937
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
38937
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
38938
38938
|
"name": "forceVersionBump",
|
|
38939
38939
|
"type": {
|
|
38940
38940
|
"__schema": "TypeUnionSchema",
|
|
@@ -39103,7 +39103,7 @@
|
|
|
39103
39103
|
"line": 1433,
|
|
39104
39104
|
"character": 7
|
|
39105
39105
|
},
|
|
39106
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
39106
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
39107
39107
|
"name": "forceVersionBump",
|
|
39108
39108
|
"type": {
|
|
39109
39109
|
"__schema": "TypeUnionSchema",
|
|
@@ -39184,7 +39184,7 @@
|
|
|
39184
39184
|
"line": 1433,
|
|
39185
39185
|
"character": 7
|
|
39186
39186
|
},
|
|
39187
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
39187
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
39188
39188
|
"name": "forceVersionBump",
|
|
39189
39189
|
"type": {
|
|
39190
39190
|
"__schema": "TypeUnionSchema",
|
|
@@ -40671,7 +40671,7 @@
|
|
|
40671
40671
|
"line": 1694,
|
|
40672
40672
|
"character": 40
|
|
40673
40673
|
},
|
|
40674
|
-
"signature": "(property) forceVersionBump?: \"patch\" | \"
|
|
40674
|
+
"signature": "(property) forceVersionBump?: \"patch\" | \"minor\" | \"major\" | \"compatible\" | undefined",
|
|
40675
40675
|
"name": "forceVersionBump",
|
|
40676
40676
|
"type": {
|
|
40677
40677
|
"__schema": "TypeUnionSchema",
|
|
@@ -50967,7 +50967,7 @@
|
|
|
50967
50967
|
"line": 31,
|
|
50968
50968
|
"character": 1
|
|
50969
50969
|
},
|
|
50970
|
-
"signature": "type EnvJsoncPolicyConfigKey = \"
|
|
50970
|
+
"signature": "type EnvJsoncPolicyConfigKey = \"dev\" | \"peers\" | \"runtime\"",
|
|
50971
50971
|
"name": "EnvJsoncPolicyConfigKey",
|
|
50972
50972
|
"type": {
|
|
50973
50973
|
"__schema": "TypeUnionSchema",
|
|
@@ -57561,7 +57561,7 @@
|
|
|
57561
57561
|
"componentId": {
|
|
57562
57562
|
"scope": "teambit.dependencies",
|
|
57563
57563
|
"name": "dependency-resolver",
|
|
57564
|
-
"version": "1.0.
|
|
57564
|
+
"version": "1.0.515"
|
|
57565
57565
|
},
|
|
57566
57566
|
"taggedModuleExports": []
|
|
57567
57567
|
}
|
|
@@ -244,8 +244,8 @@ class DependencyLinker {
|
|
|
244
244
|
}
|
|
245
245
|
if (mainAspectPath) {
|
|
246
246
|
// the following line links @teambit/legacy to the workspace node_modules. at this point, we removed all
|
|
247
|
-
// @teambit/legacy occurrences
|
|
248
|
-
|
|
247
|
+
// @teambit/legacy occurrences from the repo but others/external repos still have it.
|
|
248
|
+
result.teambitLegacyLink = this.linkNonAspectCorePackages(rootDir, 'legacy', mainAspectPath);
|
|
249
249
|
result.harmonyLink = this.linkNonAspectCorePackages(rootDir, 'harmony', mainAspectPath);
|
|
250
250
|
}
|
|
251
251
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_isBuiltinModule","data","_interopRequireDefault","require","_path","_lodash","_fsExtra","_resolveFrom","_bvm","_pkgModules","_bitError","_aspectLoader","_exceptions","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DEFAULT_LINKING_OPTIONS","rewire","linkTeambitBit","linkCoreAspects","linkDepsResolvedFromEnv","linkNestedDepsInNM","DependencyLinker","constructor","dependencyResolver","aspectLoader","componentAspect","envs","logger","rootDir","linkingOptions","linkingContext","_currentBitDir","findCurrentBvmDir","calculateLinkedDeps","componentDirectoryMap","options","linkResults","_calculateLinks","localLinks","teambitBitLink","linkDetailToLocalDepEntry","linkDetail","coreAspectsLinks","link","harmonyLink","teambitLegacyLink","resolvedFromEnvLinks","linksDetail","linkToDirResults","linkedRootDeps","fromEntries","map","key","packageName","from","outputMessage","inCapsule","setStatusLine","debug","omit","startTime","process","hrtime","result","finalRootDir","linkingOpts","assign","RootDirNotDefined","linkToDir","components","toArray","component","includePeers","_getLinksToPeers","nestedDepsInNmLinks","addSymlinkFromComponentDirNMToWorkspaceDirNM","componentIds","_dir","comp","id","undefined","linkCoreAspectsAndLegacy","consoleSuccess","peers","Set","Promise","all","depList","getDependencies","peerList","byLifecycle","dependency","getPackageName","add","fromDir","path","join","toDir","Array","componentId","to","componentIdsWithoutVersions","toString","ignoreVersion","isBitRepoWorkspace","bitLink","linkBitAspectIfNotExist","mainAspectPath","mainAspect","MainAspectNotLinkable","hasLocalInstallation","linkNonExistingCoreAspects","targetModulesDir","linkNonAspectCorePackages","targetDir","results","componentPackageName","componentIdToPackageName","state","_consumer","rootNodeModules","getPackagesFoldersToLink","dir","parent","folders","fs","readdirSync","withFileTypes","dirent","name","startsWith","isDirectory","isSymbolicLink","dirPath","moduleName","moduleNameToResolve","isBuiltinModule","resolvedModuleFrom","resolveModuleFromDir","origPath","resolveModuleDirFromFile","flatten","linksOfAllComponents","compDirNM","existsSync","innerNMofComponentInNM","isPathSymlink","packagesFoldersToLink","ensureDirSync","oneComponentLinks","folderEntry","linkTarget","linkSrc","info","filteredLinks","compact","componentsNeedLinks","componentsNeedLinksP","policy","getPolicy","resolvedFromEnv","getResolvedFromEnv","env","getEnv","componentNeedLink","envsStringIds","obj","uniqEnvIds","uniq","host","getHost","resolvedEnvIds","resolveMultipleComponentIds","resolvedAspects","resolveAspects","resolvedAspectsIndex","reduce","acc","curr","getId","allLinksP","entry","oneComponentLinksP","entries","depEntry","dependencyId","envDir","aspectPath","resolvedModule","console","depsLinkedToEnvResult","mainAspectId","existing","find","linkBit","aspectId","target","shouldSymlink","removeSymlinkTarget","src","_getPkgPathFromCurrentBitDir","ensureDir","dirname","opts","coreAspectsIds","getCoreAspectIds","filtered","getCoreAspectName","linkCoreAspect","getCoreAspectPackageName","aspectDir","isAspectDirExist","pathExistsSync","getAspectDir","module","resolve","err","CoreAspectLinkError","targetPath","targetStat","lstatSync","distDir","isDistDirExist","newDir","getDistDirForDevEnv","resolvedPath","NonAspectCorePackageLinkError","exports","moduleDirectory","includes","nmDir","__dirname","substring","indexOf","paths","BitError","moduleId","silent","resolveFrom","resolvedModulePath","NM","slice","lastIndexOf","start","end","split","basename","versionStr","head","folderPath","stat"],"sources":["dependency-linker.ts"],"sourcesContent":["import isBuiltinModule from 'is-builtin-module';\nimport path from 'path';\nimport { uniq, compact, flatten, head, omit } from 'lodash';\nimport { Stats } from 'fs';\nimport fs from 'fs-extra';\nimport resolveFrom from 'resolve-from';\nimport { findCurrentBvmDir } from '@teambit/bvm.path';\nimport { ComponentMap, Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { Logger } from '@teambit/logger';\nimport { PathAbsolute } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport { BitError } from '@teambit/bit-error';\nimport { EnvsMain } from '@teambit/envs';\nimport { AspectLoaderMain, getCoreAspectName, getCoreAspectPackageName, getAspectDir } from '@teambit/aspect-loader';\nimport {\n MainAspectNotLinkable,\n RootDirNotDefined,\n CoreAspectLinkError,\n NonAspectCorePackageLinkError,\n} from './exceptions';\nimport { DependencyResolverMain } from './dependency-resolver.main.runtime';\n\n/**\n * context of the linking process.\n */\nexport type DepLinkerContext = {\n inCapsule?: boolean;\n};\n\nexport type LinkingOptions = {\n rewire?: boolean;\n /**\n * Whether to create link to @teambit/bit in the root node modules\n */\n linkTeambitBit?: boolean;\n /**\n * Whether to create links in the root dir node modules to all core aspects\n */\n linkCoreAspects?: boolean;\n\n linkNestedDepsInNM?: boolean;\n\n /**\n * link to another project, so that project could use components from this workspace.\n * similar to npm/yarn link\n */\n linkToDir?: string;\n\n /**\n * Link peer dependencies of the components to the target project.\n * Peer dependencies should be singletons, so the project should use the same\n * version of the peer dependency as the linked in components.\n */\n includePeers?: boolean;\n\n /**\n * whether link should import objects before linking\n */\n fetchObject?: boolean;\n\n /**\n * Link deps which should be linked to the env\n */\n linkDepsResolvedFromEnv?: boolean;\n};\n\nconst DEFAULT_LINKING_OPTIONS: LinkingOptions = {\n rewire: false,\n linkTeambitBit: true,\n linkCoreAspects: true,\n linkDepsResolvedFromEnv: true,\n linkNestedDepsInNM: true,\n};\n\nexport type LinkDetail = { packageName: string; from: string; to: string };\n\nexport type CoreAspectLinkResult = {\n aspectId: string;\n linkDetail: LinkDetail;\n};\n\nexport type DepsLinkedToEnvResult = {\n componentId: string;\n linksDetail: LinkDetail[];\n};\n\nexport type NestedNMDepsLinksResult = {\n componentId: string;\n linksDetail: LinkDetail[];\n};\n\nexport type LinkToDirResult = {\n componentId: string;\n linksDetail: LinkDetail;\n};\n\nexport type LinkResults = {\n teambitBitLink?: CoreAspectLinkResult;\n coreAspectsLinks?: CoreAspectLinkResult[];\n harmonyLink?: LinkDetail;\n teambitLegacyLink?: LinkDetail;\n resolvedFromEnvLinks?: DepsLinkedToEnvResult[];\n nestedDepsInNmLinks?: NestedNMDepsLinksResult[];\n linkToDirResults?: LinkToDirResult[];\n};\n\ntype NestedModuleFolderEntry = {\n moduleName: string;\n path: string;\n origPath?: string;\n};\n\nexport class DependencyLinker {\n private _currentBitDir: string | null;\n\n constructor(\n private dependencyResolver: DependencyResolverMain,\n\n private aspectLoader: AspectLoaderMain,\n\n private componentAspect: ComponentMain,\n\n private envs: EnvsMain,\n\n private logger: Logger,\n\n private rootDir?: string | PathAbsolute,\n\n private linkingOptions?: LinkingOptions,\n\n private linkingContext: DepLinkerContext = {}\n ) {\n this._currentBitDir = findCurrentBvmDir();\n }\n\n async calculateLinkedDeps(\n rootDir: string | undefined,\n componentDirectoryMap: ComponentMap<string>,\n options: LinkingOptions = {}\n ): Promise<{ linkedRootDeps: Record<string, string>; linkResults: LinkResults }> {\n const linkResults = await this._calculateLinks(rootDir, componentDirectoryMap, options);\n const localLinks: Array<[string, string]> = [];\n if (linkResults.teambitBitLink) {\n localLinks.push(this.linkDetailToLocalDepEntry(linkResults.teambitBitLink.linkDetail));\n }\n if (linkResults.coreAspectsLinks) {\n linkResults.coreAspectsLinks.forEach((link) => {\n localLinks.push(this.linkDetailToLocalDepEntry(link.linkDetail));\n });\n }\n if (linkResults.harmonyLink) {\n localLinks.push(this.linkDetailToLocalDepEntry(linkResults.harmonyLink));\n }\n if (linkResults.teambitLegacyLink) {\n localLinks.push(this.linkDetailToLocalDepEntry(linkResults.teambitLegacyLink));\n }\n if (linkResults.resolvedFromEnvLinks) {\n linkResults.resolvedFromEnvLinks.forEach((link) => {\n link.linksDetail.forEach((linkDetail) => {\n localLinks.push(this.linkDetailToLocalDepEntry(linkDetail));\n });\n });\n }\n if (linkResults.linkToDirResults) {\n linkResults.linkToDirResults.forEach((link) => {\n localLinks.push(this.linkDetailToLocalDepEntry(link.linksDetail));\n });\n }\n return {\n linkedRootDeps: Object.fromEntries(localLinks.map(([key, value]) => [key, `link:${value}`])),\n linkResults,\n };\n }\n\n private linkDetailToLocalDepEntry(linkDetail: LinkDetail): [string, string] {\n return [linkDetail.packageName, linkDetail.from];\n }\n\n private async _calculateLinks(\n rootDir: string | undefined,\n componentDirectoryMap: ComponentMap<string>,\n options: LinkingOptions = {}\n ): Promise<LinkResults> {\n const outputMessage = this.linkingContext?.inCapsule\n ? `(capsule) linking components in root dir: ${rootDir || this.rootDir}`\n : 'linking components';\n if (!this.linkingContext?.inCapsule) {\n this.logger.setStatusLine(outputMessage);\n }\n this.logger.debug('linking components with options', omit(options, ['consumer']));\n const startTime = process.hrtime();\n\n let result: LinkResults = {};\n const finalRootDir = rootDir || this.rootDir;\n const linkingOpts = Object.assign({}, DEFAULT_LINKING_OPTIONS, this.linkingOptions || {}, options || {});\n if (!finalRootDir) {\n throw new RootDirNotDefined();\n }\n if (options.linkToDir) {\n const components = componentDirectoryMap.toArray().map(([component]) => component);\n const linkToDirResults = await this.linkToDir(finalRootDir, options.linkToDir, components);\n result.linkToDirResults = linkToDirResults;\n if (options.includePeers) {\n result.linkToDirResults.push(\n ...(await this._getLinksToPeers(componentDirectoryMap, { finalRootDir, linkToDir: options.linkToDir }))\n );\n }\n return result;\n }\n\n // Link deps which should be linked to the env\n if (linkingOpts.linkDepsResolvedFromEnv) {\n result.resolvedFromEnvLinks = await this.linkDepsResolvedFromEnv(componentDirectoryMap);\n }\n if (linkingOpts.linkNestedDepsInNM) {\n result.nestedDepsInNmLinks = this.addSymlinkFromComponentDirNMToWorkspaceDirNM(\n finalRootDir,\n componentDirectoryMap\n );\n }\n\n // We remove the version since it used in order to check if it's core aspects, and the core aspects arrived from aspect loader without versions\n const componentIds: ComponentID[] = [];\n componentDirectoryMap.map((_dir, comp) => {\n componentIds.push(comp.id);\n return undefined;\n });\n result = {\n ...result,\n ...(await this.linkCoreAspectsAndLegacy(finalRootDir, componentIds, linkingOpts)),\n };\n if (!this.linkingContext?.inCapsule) {\n this.logger.consoleSuccess(outputMessage, startTime);\n }\n return result;\n }\n\n async _getLinksToPeers(\n componentDirectoryMap: ComponentMap<string>,\n options: {\n finalRootDir: string;\n linkToDir: string;\n }\n ): Promise<LinkToDirResult[]> {\n const peers = new Set<string>();\n await Promise.all(\n componentDirectoryMap.toArray().map(async ([component]) => {\n const depList = this.dependencyResolver.getDependencies(component);\n const peerList = depList.byLifecycle('peer');\n peerList.forEach((dependency) => {\n if (dependency.getPackageName) {\n peers.add(dependency.getPackageName());\n }\n });\n })\n );\n const fromDir = path.join(options.finalRootDir, 'node_modules');\n const toDir = path.join(options.linkToDir, 'node_modules');\n return Array.from(peers).map((packageName) => ({\n componentId: packageName,\n linksDetail: {\n packageName,\n from: path.join(fromDir, packageName),\n to: path.join(toDir, packageName),\n },\n }));\n }\n\n async linkCoreAspectsAndLegacy(\n rootDir: string,\n componentIds: ComponentID[] = [],\n options: Pick<LinkingOptions, 'linkTeambitBit' | 'linkCoreAspects'> = {}\n ) {\n const result: LinkResults = {};\n const componentIdsWithoutVersions: string[] = [];\n componentIds.map((id) => {\n componentIdsWithoutVersions.push(id.toString({ ignoreVersion: true }));\n return undefined;\n });\n const linkingOpts = Object.assign({}, DEFAULT_LINKING_OPTIONS, this.linkingOptions || {}, options || {});\n if (linkingOpts.linkTeambitBit && !this.isBitRepoWorkspace(rootDir)) {\n const bitLink = await this.linkBitAspectIfNotExist(\n path.join(rootDir, 'node_modules'),\n componentIdsWithoutVersions\n );\n result.teambitBitLink = bitLink;\n }\n\n let mainAspectPath = result.teambitBitLink?.linkDetail.from;\n if (!mainAspectPath && this.aspectLoader.mainAspect) {\n if (!this.aspectLoader.mainAspect.packageName) {\n throw new MainAspectNotLinkable();\n }\n mainAspectPath = path.join(rootDir, 'node_modules', this.aspectLoader.mainAspect.packageName);\n }\n if (linkingOpts.linkCoreAspects && !this.isBitRepoWorkspace(rootDir)) {\n const hasLocalInstallation = !linkingOpts.linkTeambitBit;\n if (mainAspectPath) {\n result.coreAspectsLinks = await this.linkNonExistingCoreAspects(componentIdsWithoutVersions, {\n targetModulesDir: path.join(rootDir, 'node_modules'),\n mainAspectPath,\n hasLocalInstallation,\n });\n } else {\n result.coreAspectsLinks = [];\n }\n }\n\n if (mainAspectPath) {\n // the following line links @teambit/legacy to the workspace node_modules. at this point, we removed all\n // @teambit/legacy occurrences, so it should be okay to skip this link.\n // result.teambitLegacyLink = this.linkNonAspectCorePackages(rootDir, 'legacy', mainAspectPath);\n result.harmonyLink = this.linkNonAspectCorePackages(rootDir, 'harmony', mainAspectPath);\n }\n return result;\n }\n\n private async linkToDir(rootDir: string, targetDir: string, components: Component[]): Promise<LinkToDirResult[]> {\n const results: LinkToDirResult[] = components.map((component) => {\n const componentPackageName = componentIdToPackageName(component.state._consumer);\n return {\n componentId: component.id.toString(),\n linksDetail: {\n packageName: componentPackageName,\n from: path.join(rootDir, 'node_modules', componentPackageName),\n to: path.join(targetDir, 'node_modules', componentPackageName),\n },\n };\n });\n return results;\n }\n\n /**\n * Add symlinks from the node_modules in the component's root-dir to the workspace node_modules\n * of the component. e.g.\n * <ws-root>/node_modules/comp1/node_modules/<dep> -> <ws-root>/components/comp1/node_modules/<dep>\n * This is needed because the component is compiled into the dist folder at <ws-root>/node_modules/comp1/dist,\n * so the files in the dist folder need to find the right dependencies of comp1.\n */\n private addSymlinkFromComponentDirNMToWorkspaceDirNM(\n rootDir: string,\n componentDirectoryMap: ComponentMap<string>\n ): NestedNMDepsLinksResult[] {\n const rootNodeModules = path.join(rootDir, 'node_modules');\n const getPackagesFoldersToLink = (dir: string, parent?: string): NestedModuleFolderEntry[] => {\n const folders = fs\n .readdirSync(dir, { withFileTypes: true })\n .filter((dirent) => {\n if (dirent.name.startsWith('.')) {\n return false;\n }\n return dirent.isDirectory() || dirent.isSymbolicLink();\n })\n .map((dirent) => {\n const dirPath = path.join(dir, dirent.name);\n const moduleName = parent ? `${parent}/${dirent.name}` : dirent.name;\n // If we have a folder with a name of built in module (like events)\n // the resolve from will resolve it from the core, so it will return something like 'events'\n // instead of the path.\n // adding a '/' at the end solve this\n const moduleNameToResolve = isBuiltinModule(moduleName) ? `${moduleName}/` : moduleName;\n // This is a scoped package, need to go inside\n if (dirent.name.startsWith('@')) {\n return getPackagesFoldersToLink(dirPath, dirent.name);\n }\n\n if (dirent.isSymbolicLink()) {\n const resolvedModuleFrom = resolveModuleFromDir(dir, moduleNameToResolve);\n if (!resolvedModuleFrom) {\n return {\n moduleName,\n path: dirPath,\n };\n }\n return {\n origPath: dirPath,\n moduleName,\n path: resolveModuleDirFromFile(resolvedModuleFrom, moduleName),\n };\n }\n return {\n moduleName,\n path: dirPath,\n };\n });\n return flatten(folders);\n };\n const linksOfAllComponents = componentDirectoryMap.toArray().map(([component, dir]) => {\n const compDirNM = path.join(dir, 'node_modules');\n if (!fs.existsSync(compDirNM)) return undefined;\n // TODO: support modules with scoped packages (start with @) - we need to make this logic 2 levels\n\n const componentPackageName = componentIdToPackageName(component.state._consumer);\n const innerNMofComponentInNM = path.join(rootNodeModules, componentPackageName);\n // If the folder itself is a symlink, do not try to symlink inside it\n if (isPathSymlink(innerNMofComponentInNM)) {\n return undefined;\n }\n const packagesFoldersToLink: NestedModuleFolderEntry[] = getPackagesFoldersToLink(compDirNM);\n fs.ensureDirSync(innerNMofComponentInNM);\n\n const oneComponentLinks: LinkDetail[] = packagesFoldersToLink.map((folderEntry: NestedModuleFolderEntry) => {\n const linkTarget = path.join(innerNMofComponentInNM, 'node_modules', folderEntry?.moduleName);\n const linkSrc = folderEntry.path;\n // This works as well, consider using it instead\n // const linkSrc = folderEntry.origPath || folderEntry.path;\n const origPath = folderEntry.origPath ? `(${folderEntry.origPath})` : '';\n const linkDetail: LinkDetail = {\n packageName: folderEntry.moduleName,\n from: `${linkSrc} ${origPath}`,\n to: linkTarget,\n };\n this.logger.info(\n `linking nested dependency ${folderEntry.moduleName} for component ${component}. link src: ${linkSrc} link target: ${linkTarget}`\n );\n return linkDetail;\n });\n\n const filteredLinks = compact(oneComponentLinks);\n return {\n componentId: component.id.toString(),\n linksDetail: filteredLinks,\n };\n });\n const filteredLinks = compact(linksOfAllComponents);\n return filteredLinks;\n }\n\n private async linkDepsResolvedFromEnv(\n componentDirectoryMap: ComponentMap<string>\n ): Promise<Array<DepsLinkedToEnvResult>> {\n const componentsNeedLinks: {\n component: Component;\n dir: string;\n env;\n resolvedFromEnv;\n envId?: string;\n envDir?: string;\n }[] = [];\n\n const componentsNeedLinksP = componentDirectoryMap.toArray().map(async ([component, dir]) => {\n const policy = await this.dependencyResolver.getPolicy(component);\n const resolvedFromEnv = policy.getResolvedFromEnv();\n // Nothing should be resolved from env, do nothing\n if (!resolvedFromEnv.length) {\n return;\n }\n const env = this.envs.getEnv(component);\n const componentNeedLink = {\n component,\n dir,\n env,\n resolvedFromEnv,\n };\n componentsNeedLinks.push(componentNeedLink);\n });\n\n await Promise.all(componentsNeedLinksP);\n // Stop if there are not components needs to be linked\n if (!componentsNeedLinks || !componentsNeedLinks.length) return [];\n const envsStringIds = componentsNeedLinks.map((obj) => obj.env.id);\n const uniqEnvIds = uniq(envsStringIds);\n const host = this.componentAspect.getHost();\n const resolvedEnvIds = await host.resolveMultipleComponentIds(uniqEnvIds);\n const resolvedAspects = await host.resolveAspects(undefined, resolvedEnvIds);\n const resolvedAspectsIndex = resolvedAspects.reduce((acc, curr) => {\n if (curr.getId) {\n acc[curr.getId] = curr;\n }\n return acc;\n }, {});\n const allLinksP = componentsNeedLinks.map(async (entry) => {\n const oneComponentLinksP: Array<LinkDetail | undefined> = entry.resolvedFromEnv.entries.map(async (depEntry) => {\n const linkTarget = path.join(entry.dir, 'node_modules', depEntry.dependencyId);\n const envDir = resolvedAspectsIndex[entry.env.id].aspectPath;\n const resolvedModule = resolveModuleFromDir(envDir, depEntry.dependencyId);\n if (!resolvedModule) {\n this.logger.console(`could not resolve ${depEntry.dependencyId} from env directory ${envDir}`);\n return undefined;\n }\n const linkSrc = resolveModuleDirFromFile(resolvedModule, depEntry.dependencyId);\n const linkDetail: LinkDetail = {\n packageName: depEntry.dependencyId,\n from: linkSrc,\n to: linkTarget,\n };\n this.logger.info(\n `linking dependency ${depEntry.dependencyId} from env directory ${envDir}. link src: ${linkSrc} link target: ${linkTarget}`\n );\n\n return linkDetail;\n });\n const oneComponentLinks = await Promise.all(oneComponentLinksP);\n const filteredLinks = compact(oneComponentLinks);\n const depsLinkedToEnvResult: DepsLinkedToEnvResult = {\n componentId: entry.component.id.toString(),\n linksDetail: filteredLinks,\n };\n return depsLinkedToEnvResult;\n });\n return Promise.all(allLinksP);\n }\n\n private async linkBitAspectIfNotExist(\n dir: string,\n componentIds: string[]\n ): Promise<CoreAspectLinkResult | undefined> {\n if (!this.aspectLoader.mainAspect) return undefined;\n const mainAspectId = this.aspectLoader.mainAspect.id;\n const existing = componentIds.find((id) => {\n return id === mainAspectId;\n });\n\n if (existing) {\n return undefined;\n }\n const linkDetail = await this.linkBit(dir);\n if (!linkDetail) return undefined;\n return {\n aspectId: mainAspectId,\n linkDetail,\n };\n }\n\n async linkBit(dir: string): Promise<LinkDetail | undefined> {\n if (!this.aspectLoader.mainAspect.packageName) {\n throw new MainAspectNotLinkable();\n }\n const target = path.join(dir, this.aspectLoader.mainAspect.packageName);\n const shouldSymlink = this.removeSymlinkTarget(target);\n if (!shouldSymlink) return undefined;\n const src =\n this._getPkgPathFromCurrentBitDir(this.aspectLoader.mainAspect.packageName) ?? this.aspectLoader.mainAspect.path;\n await fs.ensureDir(path.dirname(target));\n return { packageName: this.aspectLoader.mainAspect.packageName, from: src, to: target };\n }\n\n private async linkNonExistingCoreAspects(\n componentIds: string[],\n opts: {\n targetModulesDir: string;\n mainAspectPath: string;\n hasLocalInstallation?: boolean;\n }\n ): Promise<CoreAspectLinkResult[]> {\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const filtered = coreAspectsIds.filter((aspectId) => {\n // Remove bit aspect\n if (aspectId === this.aspectLoader.mainAspect?.id) {\n return false;\n }\n // TODO: use the aspect id once default scope is resolved and the component dir map has the id with scope\n const name = getCoreAspectName(aspectId);\n const existing = componentIds.find((componentId) => {\n return componentId === name || componentId === aspectId;\n });\n if (existing) {\n return false;\n }\n return true;\n });\n\n this.logger.debug(`linkNonExistingCoreAspects: linking the following core aspects ${filtered.join()}`);\n\n const results = filtered.map((id) => this.linkCoreAspect(id, opts));\n return compact(results);\n }\n\n private isBitRepoWorkspace(dir: string) {\n // A special condition to not link core aspects in bit workspace itself\n if (this.aspectLoader.mainAspect?.path.startsWith(dir)) {\n return true;\n }\n return false;\n }\n\n private linkCoreAspect(\n id: string,\n {\n targetModulesDir,\n mainAspectPath,\n hasLocalInstallation,\n }: {\n targetModulesDir: string;\n mainAspectPath: string;\n hasLocalInstallation?: boolean;\n }\n ): CoreAspectLinkResult | undefined {\n const name = getCoreAspectName(id);\n const packageName = getCoreAspectPackageName(id);\n let aspectDir = path.join(mainAspectPath, 'dist', name);\n const target = path.join(targetModulesDir, packageName);\n const fromDir = this._getPkgPathFromCurrentBitDir(packageName);\n if (fromDir) {\n return { aspectId: id, linkDetail: { packageName, from: fromDir, to: target } };\n }\n const shouldSymlink = this.removeSymlinkTarget(target, hasLocalInstallation);\n if (!shouldSymlink) return undefined;\n const isAspectDirExist = fs.pathExistsSync(aspectDir);\n if (!isAspectDirExist) {\n this.logger.debug(`linkCoreAspect: aspectDir ${aspectDir} does not exist, linking it to ${target}`);\n aspectDir = getAspectDir(id);\n return { aspectId: id, linkDetail: { packageName, from: aspectDir, to: target } };\n }\n\n try {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const module = require(aspectDir);\n const aspectPath = path.resolve(path.join(module.path, '..', '..'));\n this.logger.debug(`linkCoreAspect: linking aspectPath ${aspectPath} to ${target}`);\n return { aspectId: id, linkDetail: { packageName, from: aspectPath, to: target } };\n } catch (err: any) {\n throw new CoreAspectLinkError(id, err);\n }\n }\n\n /**\n * returns true if it's safe to symlink it later.\n */\n private removeSymlinkTarget(targetPath: string, hasLocalInstallation = false): boolean {\n // TODO: change to fs.lstatSync(dest, {throwIfNoEntry: false});\n // TODO: this requires to upgrade node to v15.3.0 to have the throwIfNoEntry property (maybe upgrade fs-extra will work as well)\n // TODO: we don't use fs.pathExistsSync since it will return false in case the dest is a symlink which will result error on write\n let targetStat: Stats | undefined;\n try {\n targetStat = fs.lstatSync(targetPath);\n // eslint-disable-next-line no-empty\n } catch {}\n if (targetStat && !hasLocalInstallation) {\n // Do not override links created by other means\n if (!targetStat.isSymbolicLink()) {\n this.logger.debug(`removing link target, target ${targetPath} already exist. skipping it`);\n return false;\n }\n return true;\n }\n return true;\n }\n\n private _getPkgPathFromCurrentBitDir(packageName: string): string | undefined {\n if (!this._currentBitDir) return undefined;\n return path.join(this._currentBitDir, 'node_modules', packageName);\n }\n\n private linkNonAspectCorePackages(rootDir: string, name: string, mainAspectPath: string): LinkDetail | undefined {\n const distDir = path.join(mainAspectPath, 'dist', name);\n\n const packageName = `@teambit/${name}`;\n const target = path.join(rootDir, 'node_modules', packageName);\n const fromDir = this._getPkgPathFromCurrentBitDir(packageName);\n if (fromDir) {\n return { packageName, from: fromDir, to: target };\n }\n const isDistDirExist = fs.pathExistsSync(distDir);\n if (!isDistDirExist) {\n const newDir = getDistDirForDevEnv(packageName);\n return { packageName, from: newDir, to: target };\n }\n\n try {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const module = require(distDir);\n const resolvedPath = path.resolve(path.join(module.path, '..', '..'));\n return { packageName, from: resolvedPath, to: target };\n } catch (err: any) {\n throw new NonAspectCorePackageLinkError(err, packageName);\n }\n }\n}\n\n/**\n * When running dev env (bd) we need to get the harmony/legacy folder from the node_modules of the clone\n */\nfunction getDistDirForDevEnv(packageName: string): string {\n let moduleDirectory = require.resolve(packageName);\n let dirPath;\n if (moduleDirectory.includes(packageName)) {\n dirPath = path.join(moduleDirectory, '../..'); // to remove the \"index.js\" at the end\n } else {\n // This is usually required for the @teambit/legacy, as we re inside the nm so we can't find it in the other way\n const nmDir = __dirname.substring(0, __dirname.indexOf('@teambit'));\n dirPath = path.join(nmDir, packageName);\n moduleDirectory = require.resolve(packageName, { paths: [nmDir] });\n }\n if (!fs.existsSync(dirPath)) {\n throw new BitError(`unable to find ${packageName} in ${dirPath}`);\n }\n\n return dirPath;\n}\n\n// TODO: extract to new component\nfunction resolveModuleFromDir(fromDir: string, moduleId: string, silent = true): string | undefined {\n if (silent) {\n return resolveFrom.silent(fromDir, moduleId);\n }\n return resolveFrom(fromDir, moduleId);\n}\n\n// TODO: extract to new component\nfunction resolveModuleDirFromFile(resolvedModulePath: string, moduleId: string): string {\n const NM = 'node_modules';\n if (resolvedModulePath.includes(NM)) {\n return path.join(resolvedModulePath.slice(0, resolvedModulePath.lastIndexOf(NM) + NM.length), moduleId);\n }\n\n const [start, end] = resolvedModulePath.split('@');\n if (!end) return path.basename(resolvedModulePath);\n const versionStr = head(end.split('/'));\n return `${start}@${versionStr}`;\n}\n\nfunction isPathSymlink(folderPath: string): boolean | undefined {\n // TODO: change to fs.lstatSync(dest, {throwIfNoEntry: false}); once upgrade fs-extra\n try {\n const stat = fs.lstatSync(folderPath);\n return stat.isSymbolicLink();\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC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AAC;EAClD,MAAMQ,UAAU,GAAG,IAAAC,cAAI,EAACJ,GAAG,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC;EACvC,OAAO,GAAGF,KAAK,IAAII,UAAU,EAAE;AACjC;AAEA,SAASrG,aAAaA,CAACuG,UAAkB,EAAuB;EAC9D;EACA,IAAI;IACF,MAAMC,IAAI,GAAG7H,kBAAE,CAAC+F,SAAS,CAAC6B,UAAU,CAAC;IACrC,OAAOC,IAAI,CAACtH,cAAc,CAAC,CAAC;EAC9B,CAAC,CAAC,MAAM;IACN,OAAOpD,SAAS;EAClB;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_isBuiltinModule","data","_interopRequireDefault","require","_path","_lodash","_fsExtra","_resolveFrom","_bvm","_pkgModules","_bitError","_aspectLoader","_exceptions","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DEFAULT_LINKING_OPTIONS","rewire","linkTeambitBit","linkCoreAspects","linkDepsResolvedFromEnv","linkNestedDepsInNM","DependencyLinker","constructor","dependencyResolver","aspectLoader","componentAspect","envs","logger","rootDir","linkingOptions","linkingContext","_currentBitDir","findCurrentBvmDir","calculateLinkedDeps","componentDirectoryMap","options","linkResults","_calculateLinks","localLinks","teambitBitLink","linkDetailToLocalDepEntry","linkDetail","coreAspectsLinks","link","harmonyLink","teambitLegacyLink","resolvedFromEnvLinks","linksDetail","linkToDirResults","linkedRootDeps","fromEntries","map","key","packageName","from","outputMessage","inCapsule","setStatusLine","debug","omit","startTime","process","hrtime","result","finalRootDir","linkingOpts","assign","RootDirNotDefined","linkToDir","components","toArray","component","includePeers","_getLinksToPeers","nestedDepsInNmLinks","addSymlinkFromComponentDirNMToWorkspaceDirNM","componentIds","_dir","comp","id","undefined","linkCoreAspectsAndLegacy","consoleSuccess","peers","Set","Promise","all","depList","getDependencies","peerList","byLifecycle","dependency","getPackageName","add","fromDir","path","join","toDir","Array","componentId","to","componentIdsWithoutVersions","toString","ignoreVersion","isBitRepoWorkspace","bitLink","linkBitAspectIfNotExist","mainAspectPath","mainAspect","MainAspectNotLinkable","hasLocalInstallation","linkNonExistingCoreAspects","targetModulesDir","linkNonAspectCorePackages","targetDir","results","componentPackageName","componentIdToPackageName","state","_consumer","rootNodeModules","getPackagesFoldersToLink","dir","parent","folders","fs","readdirSync","withFileTypes","dirent","name","startsWith","isDirectory","isSymbolicLink","dirPath","moduleName","moduleNameToResolve","isBuiltinModule","resolvedModuleFrom","resolveModuleFromDir","origPath","resolveModuleDirFromFile","flatten","linksOfAllComponents","compDirNM","existsSync","innerNMofComponentInNM","isPathSymlink","packagesFoldersToLink","ensureDirSync","oneComponentLinks","folderEntry","linkTarget","linkSrc","info","filteredLinks","compact","componentsNeedLinks","componentsNeedLinksP","policy","getPolicy","resolvedFromEnv","getResolvedFromEnv","env","getEnv","componentNeedLink","envsStringIds","obj","uniqEnvIds","uniq","host","getHost","resolvedEnvIds","resolveMultipleComponentIds","resolvedAspects","resolveAspects","resolvedAspectsIndex","reduce","acc","curr","getId","allLinksP","entry","oneComponentLinksP","entries","depEntry","dependencyId","envDir","aspectPath","resolvedModule","console","depsLinkedToEnvResult","mainAspectId","existing","find","linkBit","aspectId","target","shouldSymlink","removeSymlinkTarget","src","_getPkgPathFromCurrentBitDir","ensureDir","dirname","opts","coreAspectsIds","getCoreAspectIds","filtered","getCoreAspectName","linkCoreAspect","getCoreAspectPackageName","aspectDir","isAspectDirExist","pathExistsSync","getAspectDir","module","resolve","err","CoreAspectLinkError","targetPath","targetStat","lstatSync","distDir","isDistDirExist","newDir","getDistDirForDevEnv","resolvedPath","NonAspectCorePackageLinkError","exports","moduleDirectory","includes","nmDir","__dirname","substring","indexOf","paths","BitError","moduleId","silent","resolveFrom","resolvedModulePath","NM","slice","lastIndexOf","start","end","split","basename","versionStr","head","folderPath","stat"],"sources":["dependency-linker.ts"],"sourcesContent":["import isBuiltinModule from 'is-builtin-module';\nimport path from 'path';\nimport { uniq, compact, flatten, head, omit } from 'lodash';\nimport { Stats } from 'fs';\nimport fs from 'fs-extra';\nimport resolveFrom from 'resolve-from';\nimport { findCurrentBvmDir } from '@teambit/bvm.path';\nimport { ComponentMap, Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { Logger } from '@teambit/logger';\nimport { PathAbsolute } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport { BitError } from '@teambit/bit-error';\nimport { EnvsMain } from '@teambit/envs';\nimport { AspectLoaderMain, getCoreAspectName, getCoreAspectPackageName, getAspectDir } from '@teambit/aspect-loader';\nimport {\n MainAspectNotLinkable,\n RootDirNotDefined,\n CoreAspectLinkError,\n NonAspectCorePackageLinkError,\n} from './exceptions';\nimport { DependencyResolverMain } from './dependency-resolver.main.runtime';\n\n/**\n * context of the linking process.\n */\nexport type DepLinkerContext = {\n inCapsule?: boolean;\n};\n\nexport type LinkingOptions = {\n rewire?: boolean;\n /**\n * Whether to create link to @teambit/bit in the root node modules\n */\n linkTeambitBit?: boolean;\n /**\n * Whether to create links in the root dir node modules to all core aspects\n */\n linkCoreAspects?: boolean;\n\n linkNestedDepsInNM?: boolean;\n\n /**\n * link to another project, so that project could use components from this workspace.\n * similar to npm/yarn link\n */\n linkToDir?: string;\n\n /**\n * Link peer dependencies of the components to the target project.\n * Peer dependencies should be singletons, so the project should use the same\n * version of the peer dependency as the linked in components.\n */\n includePeers?: boolean;\n\n /**\n * whether link should import objects before linking\n */\n fetchObject?: boolean;\n\n /**\n * Link deps which should be linked to the env\n */\n linkDepsResolvedFromEnv?: boolean;\n};\n\nconst DEFAULT_LINKING_OPTIONS: LinkingOptions = {\n rewire: false,\n linkTeambitBit: true,\n linkCoreAspects: true,\n linkDepsResolvedFromEnv: true,\n linkNestedDepsInNM: true,\n};\n\nexport type LinkDetail = { packageName: string; from: string; to: string };\n\nexport type CoreAspectLinkResult = {\n aspectId: string;\n linkDetail: LinkDetail;\n};\n\nexport type DepsLinkedToEnvResult = {\n componentId: string;\n linksDetail: LinkDetail[];\n};\n\nexport type NestedNMDepsLinksResult = {\n componentId: string;\n linksDetail: LinkDetail[];\n};\n\nexport type LinkToDirResult = {\n componentId: string;\n linksDetail: LinkDetail;\n};\n\nexport type LinkResults = {\n teambitBitLink?: CoreAspectLinkResult;\n coreAspectsLinks?: CoreAspectLinkResult[];\n harmonyLink?: LinkDetail;\n teambitLegacyLink?: LinkDetail;\n resolvedFromEnvLinks?: DepsLinkedToEnvResult[];\n nestedDepsInNmLinks?: NestedNMDepsLinksResult[];\n linkToDirResults?: LinkToDirResult[];\n};\n\ntype NestedModuleFolderEntry = {\n moduleName: string;\n path: string;\n origPath?: string;\n};\n\nexport class DependencyLinker {\n private _currentBitDir: string | null;\n\n constructor(\n private dependencyResolver: DependencyResolverMain,\n\n private aspectLoader: AspectLoaderMain,\n\n private componentAspect: ComponentMain,\n\n private envs: EnvsMain,\n\n private logger: Logger,\n\n private rootDir?: string | PathAbsolute,\n\n private linkingOptions?: LinkingOptions,\n\n private linkingContext: DepLinkerContext = {}\n ) {\n this._currentBitDir = findCurrentBvmDir();\n }\n\n async calculateLinkedDeps(\n rootDir: string | undefined,\n componentDirectoryMap: ComponentMap<string>,\n options: LinkingOptions = {}\n ): Promise<{ linkedRootDeps: Record<string, string>; linkResults: LinkResults }> {\n const linkResults = await this._calculateLinks(rootDir, componentDirectoryMap, options);\n const localLinks: Array<[string, string]> = [];\n if (linkResults.teambitBitLink) {\n localLinks.push(this.linkDetailToLocalDepEntry(linkResults.teambitBitLink.linkDetail));\n }\n if (linkResults.coreAspectsLinks) {\n linkResults.coreAspectsLinks.forEach((link) => {\n localLinks.push(this.linkDetailToLocalDepEntry(link.linkDetail));\n });\n }\n if (linkResults.harmonyLink) {\n localLinks.push(this.linkDetailToLocalDepEntry(linkResults.harmonyLink));\n }\n if (linkResults.teambitLegacyLink) {\n localLinks.push(this.linkDetailToLocalDepEntry(linkResults.teambitLegacyLink));\n }\n if (linkResults.resolvedFromEnvLinks) {\n linkResults.resolvedFromEnvLinks.forEach((link) => {\n link.linksDetail.forEach((linkDetail) => {\n localLinks.push(this.linkDetailToLocalDepEntry(linkDetail));\n });\n });\n }\n if (linkResults.linkToDirResults) {\n linkResults.linkToDirResults.forEach((link) => {\n localLinks.push(this.linkDetailToLocalDepEntry(link.linksDetail));\n });\n }\n return {\n linkedRootDeps: Object.fromEntries(localLinks.map(([key, value]) => [key, `link:${value}`])),\n linkResults,\n };\n }\n\n private linkDetailToLocalDepEntry(linkDetail: LinkDetail): [string, string] {\n return [linkDetail.packageName, linkDetail.from];\n }\n\n private async _calculateLinks(\n rootDir: string | undefined,\n componentDirectoryMap: ComponentMap<string>,\n options: LinkingOptions = {}\n ): Promise<LinkResults> {\n const outputMessage = this.linkingContext?.inCapsule\n ? `(capsule) linking components in root dir: ${rootDir || this.rootDir}`\n : 'linking components';\n if (!this.linkingContext?.inCapsule) {\n this.logger.setStatusLine(outputMessage);\n }\n this.logger.debug('linking components with options', omit(options, ['consumer']));\n const startTime = process.hrtime();\n\n let result: LinkResults = {};\n const finalRootDir = rootDir || this.rootDir;\n const linkingOpts = Object.assign({}, DEFAULT_LINKING_OPTIONS, this.linkingOptions || {}, options || {});\n if (!finalRootDir) {\n throw new RootDirNotDefined();\n }\n if (options.linkToDir) {\n const components = componentDirectoryMap.toArray().map(([component]) => component);\n const linkToDirResults = await this.linkToDir(finalRootDir, options.linkToDir, components);\n result.linkToDirResults = linkToDirResults;\n if (options.includePeers) {\n result.linkToDirResults.push(\n ...(await this._getLinksToPeers(componentDirectoryMap, { finalRootDir, linkToDir: options.linkToDir }))\n );\n }\n return result;\n }\n\n // Link deps which should be linked to the env\n if (linkingOpts.linkDepsResolvedFromEnv) {\n result.resolvedFromEnvLinks = await this.linkDepsResolvedFromEnv(componentDirectoryMap);\n }\n if (linkingOpts.linkNestedDepsInNM) {\n result.nestedDepsInNmLinks = this.addSymlinkFromComponentDirNMToWorkspaceDirNM(\n finalRootDir,\n componentDirectoryMap\n );\n }\n\n // We remove the version since it used in order to check if it's core aspects, and the core aspects arrived from aspect loader without versions\n const componentIds: ComponentID[] = [];\n componentDirectoryMap.map((_dir, comp) => {\n componentIds.push(comp.id);\n return undefined;\n });\n result = {\n ...result,\n ...(await this.linkCoreAspectsAndLegacy(finalRootDir, componentIds, linkingOpts)),\n };\n if (!this.linkingContext?.inCapsule) {\n this.logger.consoleSuccess(outputMessage, startTime);\n }\n return result;\n }\n\n async _getLinksToPeers(\n componentDirectoryMap: ComponentMap<string>,\n options: {\n finalRootDir: string;\n linkToDir: string;\n }\n ): Promise<LinkToDirResult[]> {\n const peers = new Set<string>();\n await Promise.all(\n componentDirectoryMap.toArray().map(async ([component]) => {\n const depList = this.dependencyResolver.getDependencies(component);\n const peerList = depList.byLifecycle('peer');\n peerList.forEach((dependency) => {\n if (dependency.getPackageName) {\n peers.add(dependency.getPackageName());\n }\n });\n })\n );\n const fromDir = path.join(options.finalRootDir, 'node_modules');\n const toDir = path.join(options.linkToDir, 'node_modules');\n return Array.from(peers).map((packageName) => ({\n componentId: packageName,\n linksDetail: {\n packageName,\n from: path.join(fromDir, packageName),\n to: path.join(toDir, packageName),\n },\n }));\n }\n\n async linkCoreAspectsAndLegacy(\n rootDir: string,\n componentIds: ComponentID[] = [],\n options: Pick<LinkingOptions, 'linkTeambitBit' | 'linkCoreAspects'> = {}\n ) {\n const result: LinkResults = {};\n const componentIdsWithoutVersions: string[] = [];\n componentIds.map((id) => {\n componentIdsWithoutVersions.push(id.toString({ ignoreVersion: true }));\n return undefined;\n });\n const linkingOpts = Object.assign({}, DEFAULT_LINKING_OPTIONS, this.linkingOptions || {}, options || {});\n if (linkingOpts.linkTeambitBit && !this.isBitRepoWorkspace(rootDir)) {\n const bitLink = await this.linkBitAspectIfNotExist(\n path.join(rootDir, 'node_modules'),\n componentIdsWithoutVersions\n );\n result.teambitBitLink = bitLink;\n }\n\n let mainAspectPath = result.teambitBitLink?.linkDetail.from;\n if (!mainAspectPath && this.aspectLoader.mainAspect) {\n if (!this.aspectLoader.mainAspect.packageName) {\n throw new MainAspectNotLinkable();\n }\n mainAspectPath = path.join(rootDir, 'node_modules', this.aspectLoader.mainAspect.packageName);\n }\n if (linkingOpts.linkCoreAspects && !this.isBitRepoWorkspace(rootDir)) {\n const hasLocalInstallation = !linkingOpts.linkTeambitBit;\n if (mainAspectPath) {\n result.coreAspectsLinks = await this.linkNonExistingCoreAspects(componentIdsWithoutVersions, {\n targetModulesDir: path.join(rootDir, 'node_modules'),\n mainAspectPath,\n hasLocalInstallation,\n });\n } else {\n result.coreAspectsLinks = [];\n }\n }\n\n if (mainAspectPath) {\n // the following line links @teambit/legacy to the workspace node_modules. at this point, we removed all\n // @teambit/legacy occurrences from the repo but others/external repos still have it.\n result.teambitLegacyLink = this.linkNonAspectCorePackages(rootDir, 'legacy', mainAspectPath);\n result.harmonyLink = this.linkNonAspectCorePackages(rootDir, 'harmony', mainAspectPath);\n }\n return result;\n }\n\n private async linkToDir(rootDir: string, targetDir: string, components: Component[]): Promise<LinkToDirResult[]> {\n const results: LinkToDirResult[] = components.map((component) => {\n const componentPackageName = componentIdToPackageName(component.state._consumer);\n return {\n componentId: component.id.toString(),\n linksDetail: {\n packageName: componentPackageName,\n from: path.join(rootDir, 'node_modules', componentPackageName),\n to: path.join(targetDir, 'node_modules', componentPackageName),\n },\n };\n });\n return results;\n }\n\n /**\n * Add symlinks from the node_modules in the component's root-dir to the workspace node_modules\n * of the component. e.g.\n * <ws-root>/node_modules/comp1/node_modules/<dep> -> <ws-root>/components/comp1/node_modules/<dep>\n * This is needed because the component is compiled into the dist folder at <ws-root>/node_modules/comp1/dist,\n * so the files in the dist folder need to find the right dependencies of comp1.\n */\n private addSymlinkFromComponentDirNMToWorkspaceDirNM(\n rootDir: string,\n componentDirectoryMap: ComponentMap<string>\n ): NestedNMDepsLinksResult[] {\n const rootNodeModules = path.join(rootDir, 'node_modules');\n const getPackagesFoldersToLink = (dir: string, parent?: string): NestedModuleFolderEntry[] => {\n const folders = fs\n .readdirSync(dir, { withFileTypes: true })\n .filter((dirent) => {\n if (dirent.name.startsWith('.')) {\n return false;\n }\n return dirent.isDirectory() || dirent.isSymbolicLink();\n })\n .map((dirent) => {\n const dirPath = path.join(dir, dirent.name);\n const moduleName = parent ? `${parent}/${dirent.name}` : dirent.name;\n // If we have a folder with a name of built in module (like events)\n // the resolve from will resolve it from the core, so it will return something like 'events'\n // instead of the path.\n // adding a '/' at the end solve this\n const moduleNameToResolve = isBuiltinModule(moduleName) ? `${moduleName}/` : moduleName;\n // This is a scoped package, need to go inside\n if (dirent.name.startsWith('@')) {\n return getPackagesFoldersToLink(dirPath, dirent.name);\n }\n\n if (dirent.isSymbolicLink()) {\n const resolvedModuleFrom = resolveModuleFromDir(dir, moduleNameToResolve);\n if (!resolvedModuleFrom) {\n return {\n moduleName,\n path: dirPath,\n };\n }\n return {\n origPath: dirPath,\n moduleName,\n path: resolveModuleDirFromFile(resolvedModuleFrom, moduleName),\n };\n }\n return {\n moduleName,\n path: dirPath,\n };\n });\n return flatten(folders);\n };\n const linksOfAllComponents = componentDirectoryMap.toArray().map(([component, dir]) => {\n const compDirNM = path.join(dir, 'node_modules');\n if (!fs.existsSync(compDirNM)) return undefined;\n // TODO: support modules with scoped packages (start with @) - we need to make this logic 2 levels\n\n const componentPackageName = componentIdToPackageName(component.state._consumer);\n const innerNMofComponentInNM = path.join(rootNodeModules, componentPackageName);\n // If the folder itself is a symlink, do not try to symlink inside it\n if (isPathSymlink(innerNMofComponentInNM)) {\n return undefined;\n }\n const packagesFoldersToLink: NestedModuleFolderEntry[] = getPackagesFoldersToLink(compDirNM);\n fs.ensureDirSync(innerNMofComponentInNM);\n\n const oneComponentLinks: LinkDetail[] = packagesFoldersToLink.map((folderEntry: NestedModuleFolderEntry) => {\n const linkTarget = path.join(innerNMofComponentInNM, 'node_modules', folderEntry?.moduleName);\n const linkSrc = folderEntry.path;\n // This works as well, consider using it instead\n // const linkSrc = folderEntry.origPath || folderEntry.path;\n const origPath = folderEntry.origPath ? `(${folderEntry.origPath})` : '';\n const linkDetail: LinkDetail = {\n packageName: folderEntry.moduleName,\n from: `${linkSrc} ${origPath}`,\n to: linkTarget,\n };\n this.logger.info(\n `linking nested dependency ${folderEntry.moduleName} for component ${component}. link src: ${linkSrc} link target: ${linkTarget}`\n );\n return linkDetail;\n });\n\n const filteredLinks = compact(oneComponentLinks);\n return {\n componentId: component.id.toString(),\n linksDetail: filteredLinks,\n };\n });\n const filteredLinks = compact(linksOfAllComponents);\n return filteredLinks;\n }\n\n private async linkDepsResolvedFromEnv(\n componentDirectoryMap: ComponentMap<string>\n ): Promise<Array<DepsLinkedToEnvResult>> {\n const componentsNeedLinks: {\n component: Component;\n dir: string;\n env;\n resolvedFromEnv;\n envId?: string;\n envDir?: string;\n }[] = [];\n\n const componentsNeedLinksP = componentDirectoryMap.toArray().map(async ([component, dir]) => {\n const policy = await this.dependencyResolver.getPolicy(component);\n const resolvedFromEnv = policy.getResolvedFromEnv();\n // Nothing should be resolved from env, do nothing\n if (!resolvedFromEnv.length) {\n return;\n }\n const env = this.envs.getEnv(component);\n const componentNeedLink = {\n component,\n dir,\n env,\n resolvedFromEnv,\n };\n componentsNeedLinks.push(componentNeedLink);\n });\n\n await Promise.all(componentsNeedLinksP);\n // Stop if there are not components needs to be linked\n if (!componentsNeedLinks || !componentsNeedLinks.length) return [];\n const envsStringIds = componentsNeedLinks.map((obj) => obj.env.id);\n const uniqEnvIds = uniq(envsStringIds);\n const host = this.componentAspect.getHost();\n const resolvedEnvIds = await host.resolveMultipleComponentIds(uniqEnvIds);\n const resolvedAspects = await host.resolveAspects(undefined, resolvedEnvIds);\n const resolvedAspectsIndex = resolvedAspects.reduce((acc, curr) => {\n if (curr.getId) {\n acc[curr.getId] = curr;\n }\n return acc;\n }, {});\n const allLinksP = componentsNeedLinks.map(async (entry) => {\n const oneComponentLinksP: Array<LinkDetail | undefined> = entry.resolvedFromEnv.entries.map(async (depEntry) => {\n const linkTarget = path.join(entry.dir, 'node_modules', depEntry.dependencyId);\n const envDir = resolvedAspectsIndex[entry.env.id].aspectPath;\n const resolvedModule = resolveModuleFromDir(envDir, depEntry.dependencyId);\n if (!resolvedModule) {\n this.logger.console(`could not resolve ${depEntry.dependencyId} from env directory ${envDir}`);\n return undefined;\n }\n const linkSrc = resolveModuleDirFromFile(resolvedModule, depEntry.dependencyId);\n const linkDetail: LinkDetail = {\n packageName: depEntry.dependencyId,\n from: linkSrc,\n to: linkTarget,\n };\n this.logger.info(\n `linking dependency ${depEntry.dependencyId} from env directory ${envDir}. link src: ${linkSrc} link target: ${linkTarget}`\n );\n\n return linkDetail;\n });\n const oneComponentLinks = await Promise.all(oneComponentLinksP);\n const filteredLinks = compact(oneComponentLinks);\n const depsLinkedToEnvResult: DepsLinkedToEnvResult = {\n componentId: entry.component.id.toString(),\n linksDetail: filteredLinks,\n };\n return depsLinkedToEnvResult;\n });\n return Promise.all(allLinksP);\n }\n\n private async linkBitAspectIfNotExist(\n dir: string,\n componentIds: string[]\n ): Promise<CoreAspectLinkResult | undefined> {\n if (!this.aspectLoader.mainAspect) return undefined;\n const mainAspectId = this.aspectLoader.mainAspect.id;\n const existing = componentIds.find((id) => {\n return id === mainAspectId;\n });\n\n if (existing) {\n return undefined;\n }\n const linkDetail = await this.linkBit(dir);\n if (!linkDetail) return undefined;\n return {\n aspectId: mainAspectId,\n linkDetail,\n };\n }\n\n async linkBit(dir: string): Promise<LinkDetail | undefined> {\n if (!this.aspectLoader.mainAspect.packageName) {\n throw new MainAspectNotLinkable();\n }\n const target = path.join(dir, this.aspectLoader.mainAspect.packageName);\n const shouldSymlink = this.removeSymlinkTarget(target);\n if (!shouldSymlink) return undefined;\n const src =\n this._getPkgPathFromCurrentBitDir(this.aspectLoader.mainAspect.packageName) ?? this.aspectLoader.mainAspect.path;\n await fs.ensureDir(path.dirname(target));\n return { packageName: this.aspectLoader.mainAspect.packageName, from: src, to: target };\n }\n\n private async linkNonExistingCoreAspects(\n componentIds: string[],\n opts: {\n targetModulesDir: string;\n mainAspectPath: string;\n hasLocalInstallation?: boolean;\n }\n ): Promise<CoreAspectLinkResult[]> {\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const filtered = coreAspectsIds.filter((aspectId) => {\n // Remove bit aspect\n if (aspectId === this.aspectLoader.mainAspect?.id) {\n return false;\n }\n // TODO: use the aspect id once default scope is resolved and the component dir map has the id with scope\n const name = getCoreAspectName(aspectId);\n const existing = componentIds.find((componentId) => {\n return componentId === name || componentId === aspectId;\n });\n if (existing) {\n return false;\n }\n return true;\n });\n\n this.logger.debug(`linkNonExistingCoreAspects: linking the following core aspects ${filtered.join()}`);\n\n const results = filtered.map((id) => this.linkCoreAspect(id, opts));\n return compact(results);\n }\n\n private isBitRepoWorkspace(dir: string) {\n // A special condition to not link core aspects in bit workspace itself\n if (this.aspectLoader.mainAspect?.path.startsWith(dir)) {\n return true;\n }\n return false;\n }\n\n private linkCoreAspect(\n id: string,\n {\n targetModulesDir,\n mainAspectPath,\n hasLocalInstallation,\n }: {\n targetModulesDir: string;\n mainAspectPath: string;\n hasLocalInstallation?: boolean;\n }\n ): CoreAspectLinkResult | undefined {\n const name = getCoreAspectName(id);\n const packageName = getCoreAspectPackageName(id);\n let aspectDir = path.join(mainAspectPath, 'dist', name);\n const target = path.join(targetModulesDir, packageName);\n const fromDir = this._getPkgPathFromCurrentBitDir(packageName);\n if (fromDir) {\n return { aspectId: id, linkDetail: { packageName, from: fromDir, to: target } };\n }\n const shouldSymlink = this.removeSymlinkTarget(target, hasLocalInstallation);\n if (!shouldSymlink) return undefined;\n const isAspectDirExist = fs.pathExistsSync(aspectDir);\n if (!isAspectDirExist) {\n this.logger.debug(`linkCoreAspect: aspectDir ${aspectDir} does not exist, linking it to ${target}`);\n aspectDir = getAspectDir(id);\n return { aspectId: id, linkDetail: { packageName, from: aspectDir, to: target } };\n }\n\n try {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const module = require(aspectDir);\n const aspectPath = path.resolve(path.join(module.path, '..', '..'));\n this.logger.debug(`linkCoreAspect: linking aspectPath ${aspectPath} to ${target}`);\n return { aspectId: id, linkDetail: { packageName, from: aspectPath, to: target } };\n } catch (err: any) {\n throw new CoreAspectLinkError(id, err);\n }\n }\n\n /**\n * returns true if it's safe to symlink it later.\n */\n private removeSymlinkTarget(targetPath: string, hasLocalInstallation = false): boolean {\n // TODO: change to fs.lstatSync(dest, {throwIfNoEntry: false});\n // TODO: this requires to upgrade node to v15.3.0 to have the throwIfNoEntry property (maybe upgrade fs-extra will work as well)\n // TODO: we don't use fs.pathExistsSync since it will return false in case the dest is a symlink which will result error on write\n let targetStat: Stats | undefined;\n try {\n targetStat = fs.lstatSync(targetPath);\n // eslint-disable-next-line no-empty\n } catch {}\n if (targetStat && !hasLocalInstallation) {\n // Do not override links created by other means\n if (!targetStat.isSymbolicLink()) {\n this.logger.debug(`removing link target, target ${targetPath} already exist. skipping it`);\n return false;\n }\n return true;\n }\n return true;\n }\n\n private _getPkgPathFromCurrentBitDir(packageName: string): string | undefined {\n if (!this._currentBitDir) return undefined;\n return path.join(this._currentBitDir, 'node_modules', packageName);\n }\n\n private linkNonAspectCorePackages(rootDir: string, name: string, mainAspectPath: string): LinkDetail | undefined {\n const distDir = path.join(mainAspectPath, 'dist', name);\n\n const packageName = `@teambit/${name}`;\n const target = path.join(rootDir, 'node_modules', packageName);\n const fromDir = this._getPkgPathFromCurrentBitDir(packageName);\n if (fromDir) {\n return { packageName, from: fromDir, to: target };\n }\n const isDistDirExist = fs.pathExistsSync(distDir);\n if (!isDistDirExist) {\n const newDir = getDistDirForDevEnv(packageName);\n return { packageName, from: newDir, to: target };\n }\n\n try {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const module = require(distDir);\n const resolvedPath = path.resolve(path.join(module.path, '..', '..'));\n return { packageName, from: resolvedPath, to: target };\n } catch (err: any) {\n throw new NonAspectCorePackageLinkError(err, packageName);\n }\n }\n}\n\n/**\n * When running dev env (bd) we need to get the harmony/legacy folder from the node_modules of the clone\n */\nfunction getDistDirForDevEnv(packageName: string): string {\n let moduleDirectory = require.resolve(packageName);\n let dirPath;\n if (moduleDirectory.includes(packageName)) {\n dirPath = path.join(moduleDirectory, '../..'); // to remove the \"index.js\" at the end\n } else {\n // This is usually required for the @teambit/legacy, as we re inside the nm so we can't find it in the other way\n const nmDir = __dirname.substring(0, __dirname.indexOf('@teambit'));\n dirPath = path.join(nmDir, packageName);\n moduleDirectory = require.resolve(packageName, { paths: [nmDir] });\n }\n if (!fs.existsSync(dirPath)) {\n throw new BitError(`unable to find ${packageName} in ${dirPath}`);\n }\n\n return dirPath;\n}\n\n// TODO: extract to new component\nfunction resolveModuleFromDir(fromDir: string, moduleId: string, silent = true): string | undefined {\n if (silent) {\n return resolveFrom.silent(fromDir, moduleId);\n }\n return resolveFrom(fromDir, moduleId);\n}\n\n// TODO: extract to new component\nfunction resolveModuleDirFromFile(resolvedModulePath: string, moduleId: string): string {\n const NM = 'node_modules';\n if (resolvedModulePath.includes(NM)) {\n return path.join(resolvedModulePath.slice(0, resolvedModulePath.lastIndexOf(NM) + NM.length), moduleId);\n }\n\n const [start, end] = resolvedModulePath.split('@');\n if (!end) return path.basename(resolvedModulePath);\n const versionStr = head(end.split('/'));\n return `${start}@${versionStr}`;\n}\n\nfunction isPathSymlink(folderPath: string): boolean | undefined {\n // TODO: change to fs.lstatSync(dest, {throwIfNoEntry: false}); once upgrade fs-extra\n try {\n const stat = fs.lstatSync(folderPath);\n return stat.isSymbolicLink();\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAA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,QAAQ,CAAC;EACzG;EAEA,MAAM,CAACO,KAAK,EAAEC,GAAG,CAAC,GAAGL,kBAAkB,CAACM,KAAK,CAAC,GAAG,CAAC;EAClD,IAAI,CAACD,GAAG,EAAE,OAAOrJ,eAAI,CAACuJ,QAAQ,CAACP,kBAAkB,CAAC;EAClD,MAAMQ,UAAU,GAAG,IAAAC,cAAI,EAACJ,GAAG,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC;EACvC,OAAO,GAAGF,KAAK,IAAII,UAAU,EAAE;AACjC;AAEA,SAASrG,aAAaA,CAACuG,UAAkB,EAAuB;EAC9D;EACA,IAAI;IACF,MAAMC,IAAI,GAAG7H,kBAAE,CAAC+F,SAAS,CAAC6B,UAAU,CAAC;IACrC,OAAOC,IAAI,CAACtH,cAAc,CAAC,CAAC;EAC9B,CAAC,CAAC,MAAM;IACN,OAAOpD,SAAS;EAClB;AACF","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.515/dist/dependency-resolver.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_dependency-resolver@1.0.515/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.515",
|
|
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.515"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -33,26 +33,26 @@
|
|
|
33
33
|
"@teambit/legacy-bit-id": "1.1.1",
|
|
34
34
|
"@teambit/component-version": "1.0.3",
|
|
35
35
|
"@teambit/toolbox.object.sorter": "0.0.2",
|
|
36
|
-
"@teambit/component": "1.0.
|
|
37
|
-
"@teambit/envs": "1.0.
|
|
38
|
-
"@teambit/dependencies": "1.0.
|
|
39
|
-
"@teambit/aspect-loader": "1.0.
|
|
40
|
-
"@teambit/logger": "0.0.
|
|
41
|
-
"@teambit/objects": "0.0.
|
|
36
|
+
"@teambit/component": "1.0.515",
|
|
37
|
+
"@teambit/envs": "1.0.515",
|
|
38
|
+
"@teambit/dependencies": "1.0.515",
|
|
39
|
+
"@teambit/aspect-loader": "1.0.515",
|
|
40
|
+
"@teambit/logger": "0.0.1185",
|
|
41
|
+
"@teambit/objects": "0.0.22",
|
|
42
42
|
"@teambit/toolbox.path.path": "0.0.6",
|
|
43
43
|
"@teambit/pkg.modules.component-package-name": "0.0.27",
|
|
44
|
-
"@teambit/graphql": "1.0.
|
|
45
|
-
"@teambit/cli": "0.0.
|
|
44
|
+
"@teambit/graphql": "1.0.515",
|
|
45
|
+
"@teambit/cli": "0.0.1092",
|
|
46
46
|
"@teambit/component.sources": "0.0.72",
|
|
47
|
-
"@teambit/config": "0.0.
|
|
48
|
-
"@teambit/global-config": "0.0.
|
|
47
|
+
"@teambit/config": "0.0.1266",
|
|
48
|
+
"@teambit/global-config": "0.0.1095",
|
|
49
49
|
"@teambit/harmony.modules.feature-toggle": "0.0.14",
|
|
50
50
|
"@teambit/harmony.modules.requireable-component": "0.0.500",
|
|
51
51
|
"@teambit/legacy.constants": "0.0.6",
|
|
52
52
|
"@teambit/legacy.consumer-component": "0.0.21",
|
|
53
53
|
"@teambit/legacy.extension-data": "0.0.22",
|
|
54
54
|
"@teambit/scope.network": "0.0.20",
|
|
55
|
-
"@teambit/snapping": "1.0.
|
|
55
|
+
"@teambit/snapping": "1.0.515",
|
|
56
56
|
"@teambit/workspace.modules.node-modules-linker": "0.0.248",
|
|
57
57
|
"@teambit/component-issues": "0.0.153",
|
|
58
58
|
"@teambit/component-package-version": "0.0.435",
|