@teambit/dependency-resolver 1.0.447 → 1.0.448
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +32 -32
- package/artifacts/preview/teambit_dependencies_dependency_resolver-preview.js +1 -1
- package/artifacts/schema.json +45 -45
- package/dist/dependency-installer.js +2 -1
- package/dist/dependency-installer.js.map +1 -1
- package/dist/{preview-1729999303301.js → preview-1730330697064.js} +2 -2
- package/package.json +16 -16
|
@@ -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.
|
|
4
|
-
<testcase classname="
|
|
5
|
-
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer supportedRange is
|
|
6
|
-
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer
|
|
7
|
-
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer version is
|
|
8
|
-
<testcase classname="
|
|
9
|
-
<testcase classname="
|
|
10
|
-
<testcase classname="get-all-policy-pkgs.spec.js" name="should deduplicate dependencies that are present in root policies" time="0.088"/>
|
|
11
|
-
<testcase classname="apply-updates.spec.js" name="should apply updates on root dependencies" time="0.083"/>
|
|
3
|
+
<testsuite name="teambit.dependencies/dependency-resolver@1.0.448" timestamp="2024-10-31T00:00:31.959Z" tests="50" failures="0" errors="0" skipped="0">
|
|
4
|
+
<testcase classname="update-dependency-version.spec.js" name="should pick version from root policy, when no variation policy is present" time="0.03"/>
|
|
5
|
+
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer supportedRange is empty" time="0.068"/>
|
|
6
|
+
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer supportedRange is null"/>
|
|
7
|
+
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer version is empty" time="0.001"/>
|
|
8
|
+
<testcase classname="validate-env-policy.spec.js" name="should throw an exception if peer version is null"/>
|
|
9
|
+
<testcase classname="apply-updates.spec.js" name="should apply updates on root dependencies" time="0.087"/>
|
|
12
10
|
<testcase classname="apply-updates.spec.js" name="should apply updates on variant dependencies" time="0.001"/>
|
|
13
|
-
<testcase classname="apply-updates.spec.js" name="should apply updates on component dependencies" time="0.
|
|
14
|
-
<testcase classname="
|
|
15
|
-
<testcase classname="
|
|
11
|
+
<testcase classname="apply-updates.spec.js" name="should apply updates on component dependencies" time="0.14"/>
|
|
12
|
+
<testcase classname="get-all-policy-pkgs.spec.js" name="should read the version from a version object" time="0.181"/>
|
|
13
|
+
<testcase classname="get-all-policy-pkgs.spec.js" name="should deduplicate dependencies that are present in root policies" time="0.156"/>
|
|
14
|
+
<testcase classname="hoist-dependencies.spec.js" name="the root manifest should have the preserved version" time="0.132"/>
|
|
15
|
+
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies which intersects with the preserved should be empty" time="0.002"/>
|
|
16
16
|
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies which not intersects with the preserved to have a proper version" time="0.001"/>
|
|
17
|
-
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies should be empty"/>
|
|
17
|
+
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies should be empty" time="0.001"/>
|
|
18
18
|
<testcase classname="hoist-dependencies.spec.js" name="should hoist the dependency to the root" time="0.001"/>
|
|
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"/>
|
|
21
|
-
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies should be empty" time="0.
|
|
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.018"/>
|
|
21
|
+
<testcase classname="hoist-dependencies.spec.js" name="the component dependencies should be empty" time="0.001"/>
|
|
24
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.027"/>
|
|
24
|
+
<testcase classname="hoist-dependencies.spec.js" name="should not hoist the dependency to the root" time="0.001"/>
|
|
25
25
|
<testcase classname="hoist-dependencies.spec.js" name="should not report about peer conflicts"/>
|
|
26
26
|
<testcase classname="hoist-dependencies.spec.js" name="should have the peers in each component" time="0.001"/>
|
|
27
27
|
<testcase classname="hoist-dependencies.spec.js" name="should not hoist the dependency to the root" time="0.001"/>
|
|
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.
|
|
29
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the most common version to the root" time="0.058"/>
|
|
30
30
|
<testcase classname="hoist-dependencies.spec.js" name="should not put the most common version in the components that has it" time="0.001"/>
|
|
31
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.
|
|
32
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.005"/>
|
|
33
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.
|
|
35
|
-
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best version to the root" time="0.
|
|
34
|
+
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.003"/>
|
|
35
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best version to the root" time="0.002"/>
|
|
36
36
|
<testcase classname="hoist-dependencies.spec.js" name="should not put the dependency in components that matches the best version" time="0.001"/>
|
|
37
37
|
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.001"/>
|
|
38
|
-
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.
|
|
39
|
-
<testcase classname="hoist-dependencies.spec.js" name="should not put the dependency in components that matches the best range" time="0.
|
|
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.
|
|
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.
|
|
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.
|
|
45
|
-
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return settings from package manager config"/>
|
|
38
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.002"/>
|
|
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.002"/>
|
|
41
|
+
<testcase classname="hoist-dependencies.spec.js" name="should hoist the best range to the root" time="0.054"/>
|
|
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.04"/>
|
|
43
|
+
<testcase classname="hoist-dependencies.spec.js" name="should put other ranges in the components" time="0.034"/>
|
|
44
|
+
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return settings from global config" time="0.011"/>
|
|
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" time="0.001"/>
|
|
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.006"/>
|
|
49
|
+
<testcase classname="dependency-resolver.main.runtime.spec.js" name="should return outdated dependencies" time="0.081"/>
|
|
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
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.
|
|
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.108"/>
|
|
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={843:(e,n,t)=>{var a={id:"teambit.dependencies/aspect-docs/dependency-resolver@0.0.178",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},748:(e,n,t)=>{Object.defineProperty(n,"Q",{enumerable:!0,get:function(){return a.default}});var a=o(t(843));function o(e){return e&&e.__esModule?e:{default:e}}o.__bit_component={id:"teambit.dependencies/aspect-docs/dependency-resolver@0.0.178",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/dependency-resolver",exported:!0}},77:(e,n,t)=>{var a={id:"teambit.dependencies/dependency-resolver@1.0.447",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(77),d=(t(594),t(16));const r=TeambitMdxUiMdxScopeContext;var l=t(748),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={843:(e,n,t)=>{var a={id:"teambit.dependencies/aspect-docs/dependency-resolver@0.0.178",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},748:(e,n,t)=>{Object.defineProperty(n,"Q",{enumerable:!0,get:function(){return a.default}});var a=o(t(843));function o(e){return e&&e.__esModule?e:{default:e}}o.__bit_component={id:"teambit.dependencies/aspect-docs/dependency-resolver@0.0.178",homepage:"https://bit.cloud/teambit/dependencies/aspect-docs/dependency-resolver",exported:!0}},954:(e,n,t)=>{var a={id:"teambit.dependencies/dependency-resolver@1.0.448",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(954),d=(t(594),t(16));const r=TeambitMdxUiMdxScopeContext;var l=t(748),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
|
@@ -22602,7 +22602,7 @@
|
|
|
22602
22602
|
"__schema": "FunctionLikeSchema",
|
|
22603
22603
|
"location": {
|
|
22604
22604
|
"filePath": "dependency-installer.ts",
|
|
22605
|
-
"line":
|
|
22605
|
+
"line": 266,
|
|
22606
22606
|
"character": 3
|
|
22607
22607
|
},
|
|
22608
22608
|
"signature": "(method) DependencyInstaller.pruneModules(rootDir: string): Promise<void>",
|
|
@@ -22612,7 +22612,7 @@
|
|
|
22612
22612
|
"__schema": "ParameterSchema",
|
|
22613
22613
|
"location": {
|
|
22614
22614
|
"filePath": "dependency-installer.ts",
|
|
22615
|
-
"line":
|
|
22615
|
+
"line": 266,
|
|
22616
22616
|
"character": 29
|
|
22617
22617
|
},
|
|
22618
22618
|
"name": "rootDir",
|
|
@@ -22620,7 +22620,7 @@
|
|
|
22620
22620
|
"__schema": "KeywordTypeSchema",
|
|
22621
22621
|
"location": {
|
|
22622
22622
|
"filePath": "dependency-installer.ts",
|
|
22623
|
-
"line":
|
|
22623
|
+
"line": 266,
|
|
22624
22624
|
"character": 38
|
|
22625
22625
|
},
|
|
22626
22626
|
"name": "string"
|
|
@@ -22633,7 +22633,7 @@
|
|
|
22633
22633
|
"__schema": "TypeRefSchema",
|
|
22634
22634
|
"location": {
|
|
22635
22635
|
"filePath": "dependency-installer.ts",
|
|
22636
|
-
"line":
|
|
22636
|
+
"line": 266,
|
|
22637
22637
|
"character": 47
|
|
22638
22638
|
},
|
|
22639
22639
|
"name": "Promise",
|
|
@@ -22642,7 +22642,7 @@
|
|
|
22642
22642
|
"__schema": "KeywordTypeSchema",
|
|
22643
22643
|
"location": {
|
|
22644
22644
|
"filePath": "dependency-installer.ts",
|
|
22645
|
-
"line":
|
|
22645
|
+
"line": 266,
|
|
22646
22646
|
"character": 55
|
|
22647
22647
|
},
|
|
22648
22648
|
"name": "void"
|
|
@@ -22658,14 +22658,14 @@
|
|
|
22658
22658
|
"__schema": "FunctionLikeSchema",
|
|
22659
22659
|
"location": {
|
|
22660
22660
|
"filePath": "dependency-installer.ts",
|
|
22661
|
-
"line":
|
|
22661
|
+
"line": 277,
|
|
22662
22662
|
"character": 3
|
|
22663
22663
|
},
|
|
22664
22664
|
"doc": {
|
|
22665
22665
|
"__schema": "DocSchema",
|
|
22666
22666
|
"location": {
|
|
22667
22667
|
"filePath": "dependency-installer.ts",
|
|
22668
|
-
"line":
|
|
22668
|
+
"line": 273,
|
|
22669
22669
|
"character": 3
|
|
22670
22670
|
},
|
|
22671
22671
|
"raw": "/**\n * Compute all the component manifests (a.k.a. package.json files) that should be passed to the package manager\n * in order to install the dependencies.\n */",
|
|
@@ -22679,7 +22679,7 @@
|
|
|
22679
22679
|
"__schema": "ParameterSchema",
|
|
22680
22680
|
"location": {
|
|
22681
22681
|
"filePath": "dependency-installer.ts",
|
|
22682
|
-
"line":
|
|
22682
|
+
"line": 277,
|
|
22683
22683
|
"character": 38
|
|
22684
22684
|
},
|
|
22685
22685
|
"name": "{ componentDirectoryMap, rootPolicy, rootDir, dedupe, dependencyFilterFn, copyPeerToRuntimeOnComponents, copyPeerToRuntimeOnRoot, installPeersFromEnvs, resolveVersionsFromDependenciesOnly, referenceLocalPackages, hasRootComponents, excludeExtensionsDependencies }",
|
|
@@ -22687,7 +22687,7 @@
|
|
|
22687
22687
|
"__schema": "TypeRefSchema",
|
|
22688
22688
|
"location": {
|
|
22689
22689
|
"filePath": "dependency-installer.ts",
|
|
22690
|
-
"line":
|
|
22690
|
+
"line": 290,
|
|
22691
22691
|
"character": 6
|
|
22692
22692
|
},
|
|
22693
22693
|
"name": "GetComponentManifestsOptions"
|
|
@@ -22698,7 +22698,7 @@
|
|
|
22698
22698
|
"__schema": "InferenceTypeSchema",
|
|
22699
22699
|
"location": {
|
|
22700
22700
|
"filePath": "dependency-installer.ts",
|
|
22701
|
-
"line":
|
|
22701
|
+
"line": 278,
|
|
22702
22702
|
"character": 5
|
|
22703
22703
|
},
|
|
22704
22704
|
"name": "componentDirectoryMap",
|
|
@@ -22709,7 +22709,7 @@
|
|
|
22709
22709
|
"__schema": "InferenceTypeSchema",
|
|
22710
22710
|
"location": {
|
|
22711
22711
|
"filePath": "dependency-installer.ts",
|
|
22712
|
-
"line":
|
|
22712
|
+
"line": 279,
|
|
22713
22713
|
"character": 5
|
|
22714
22714
|
},
|
|
22715
22715
|
"name": "rootPolicy",
|
|
@@ -22720,7 +22720,7 @@
|
|
|
22720
22720
|
"__schema": "InferenceTypeSchema",
|
|
22721
22721
|
"location": {
|
|
22722
22722
|
"filePath": "dependency-installer.ts",
|
|
22723
|
-
"line":
|
|
22723
|
+
"line": 280,
|
|
22724
22724
|
"character": 5
|
|
22725
22725
|
},
|
|
22726
22726
|
"name": "rootDir",
|
|
@@ -22731,7 +22731,7 @@
|
|
|
22731
22731
|
"__schema": "InferenceTypeSchema",
|
|
22732
22732
|
"location": {
|
|
22733
22733
|
"filePath": "dependency-installer.ts",
|
|
22734
|
-
"line":
|
|
22734
|
+
"line": 281,
|
|
22735
22735
|
"character": 5
|
|
22736
22736
|
},
|
|
22737
22737
|
"name": "dedupe",
|
|
@@ -22742,7 +22742,7 @@
|
|
|
22742
22742
|
"__schema": "InferenceTypeSchema",
|
|
22743
22743
|
"location": {
|
|
22744
22744
|
"filePath": "dependency-installer.ts",
|
|
22745
|
-
"line":
|
|
22745
|
+
"line": 282,
|
|
22746
22746
|
"character": 5
|
|
22747
22747
|
},
|
|
22748
22748
|
"name": "dependencyFilterFn",
|
|
@@ -22753,7 +22753,7 @@
|
|
|
22753
22753
|
"__schema": "InferenceTypeSchema",
|
|
22754
22754
|
"location": {
|
|
22755
22755
|
"filePath": "dependency-installer.ts",
|
|
22756
|
-
"line":
|
|
22756
|
+
"line": 283,
|
|
22757
22757
|
"character": 5
|
|
22758
22758
|
},
|
|
22759
22759
|
"name": "copyPeerToRuntimeOnComponents",
|
|
@@ -22764,7 +22764,7 @@
|
|
|
22764
22764
|
"__schema": "InferenceTypeSchema",
|
|
22765
22765
|
"location": {
|
|
22766
22766
|
"filePath": "dependency-installer.ts",
|
|
22767
|
-
"line":
|
|
22767
|
+
"line": 284,
|
|
22768
22768
|
"character": 5
|
|
22769
22769
|
},
|
|
22770
22770
|
"name": "copyPeerToRuntimeOnRoot",
|
|
@@ -22775,7 +22775,7 @@
|
|
|
22775
22775
|
"__schema": "InferenceTypeSchema",
|
|
22776
22776
|
"location": {
|
|
22777
22777
|
"filePath": "dependency-installer.ts",
|
|
22778
|
-
"line":
|
|
22778
|
+
"line": 285,
|
|
22779
22779
|
"character": 5
|
|
22780
22780
|
},
|
|
22781
22781
|
"name": "installPeersFromEnvs",
|
|
@@ -22786,7 +22786,7 @@
|
|
|
22786
22786
|
"__schema": "InferenceTypeSchema",
|
|
22787
22787
|
"location": {
|
|
22788
22788
|
"filePath": "dependency-installer.ts",
|
|
22789
|
-
"line":
|
|
22789
|
+
"line": 286,
|
|
22790
22790
|
"character": 5
|
|
22791
22791
|
},
|
|
22792
22792
|
"name": "resolveVersionsFromDependenciesOnly",
|
|
@@ -22797,7 +22797,7 @@
|
|
|
22797
22797
|
"__schema": "InferenceTypeSchema",
|
|
22798
22798
|
"location": {
|
|
22799
22799
|
"filePath": "dependency-installer.ts",
|
|
22800
|
-
"line":
|
|
22800
|
+
"line": 287,
|
|
22801
22801
|
"character": 5
|
|
22802
22802
|
},
|
|
22803
22803
|
"name": "referenceLocalPackages",
|
|
@@ -22808,7 +22808,7 @@
|
|
|
22808
22808
|
"__schema": "InferenceTypeSchema",
|
|
22809
22809
|
"location": {
|
|
22810
22810
|
"filePath": "dependency-installer.ts",
|
|
22811
|
-
"line":
|
|
22811
|
+
"line": 288,
|
|
22812
22812
|
"character": 5
|
|
22813
22813
|
},
|
|
22814
22814
|
"name": "hasRootComponents",
|
|
@@ -22819,7 +22819,7 @@
|
|
|
22819
22819
|
"__schema": "InferenceTypeSchema",
|
|
22820
22820
|
"location": {
|
|
22821
22821
|
"filePath": "dependency-installer.ts",
|
|
22822
|
-
"line":
|
|
22822
|
+
"line": 289,
|
|
22823
22823
|
"character": 5
|
|
22824
22824
|
},
|
|
22825
22825
|
"name": "excludeExtensionsDependencies",
|
|
@@ -22834,7 +22834,7 @@
|
|
|
22834
22834
|
"__schema": "InferenceTypeSchema",
|
|
22835
22835
|
"location": {
|
|
22836
22836
|
"filePath": "dependency-installer.ts",
|
|
22837
|
-
"line":
|
|
22837
|
+
"line": 277,
|
|
22838
22838
|
"character": 3
|
|
22839
22839
|
},
|
|
22840
22840
|
"type": "Promise<Record<string, ProjectManifest>>"
|
|
@@ -54769,7 +54769,7 @@
|
|
|
54769
54769
|
"__schema": "FunctionLikeSchema",
|
|
54770
54770
|
"location": {
|
|
54771
54771
|
"filePath": "dependency-installer.ts",
|
|
54772
|
-
"line":
|
|
54772
|
+
"line": 266,
|
|
54773
54773
|
"character": 3
|
|
54774
54774
|
},
|
|
54775
54775
|
"signature": "(method) DependencyInstaller.pruneModules(rootDir: string): Promise<void>",
|
|
@@ -54779,7 +54779,7 @@
|
|
|
54779
54779
|
"__schema": "ParameterSchema",
|
|
54780
54780
|
"location": {
|
|
54781
54781
|
"filePath": "dependency-installer.ts",
|
|
54782
|
-
"line":
|
|
54782
|
+
"line": 266,
|
|
54783
54783
|
"character": 29
|
|
54784
54784
|
},
|
|
54785
54785
|
"name": "rootDir",
|
|
@@ -54787,7 +54787,7 @@
|
|
|
54787
54787
|
"__schema": "KeywordTypeSchema",
|
|
54788
54788
|
"location": {
|
|
54789
54789
|
"filePath": "dependency-installer.ts",
|
|
54790
|
-
"line":
|
|
54790
|
+
"line": 266,
|
|
54791
54791
|
"character": 38
|
|
54792
54792
|
},
|
|
54793
54793
|
"name": "string"
|
|
@@ -54800,7 +54800,7 @@
|
|
|
54800
54800
|
"__schema": "TypeRefSchema",
|
|
54801
54801
|
"location": {
|
|
54802
54802
|
"filePath": "dependency-installer.ts",
|
|
54803
|
-
"line":
|
|
54803
|
+
"line": 266,
|
|
54804
54804
|
"character": 47
|
|
54805
54805
|
},
|
|
54806
54806
|
"name": "Promise",
|
|
@@ -54809,7 +54809,7 @@
|
|
|
54809
54809
|
"__schema": "KeywordTypeSchema",
|
|
54810
54810
|
"location": {
|
|
54811
54811
|
"filePath": "dependency-installer.ts",
|
|
54812
|
-
"line":
|
|
54812
|
+
"line": 266,
|
|
54813
54813
|
"character": 55
|
|
54814
54814
|
},
|
|
54815
54815
|
"name": "void"
|
|
@@ -54825,14 +54825,14 @@
|
|
|
54825
54825
|
"__schema": "FunctionLikeSchema",
|
|
54826
54826
|
"location": {
|
|
54827
54827
|
"filePath": "dependency-installer.ts",
|
|
54828
|
-
"line":
|
|
54828
|
+
"line": 277,
|
|
54829
54829
|
"character": 3
|
|
54830
54830
|
},
|
|
54831
54831
|
"doc": {
|
|
54832
54832
|
"__schema": "DocSchema",
|
|
54833
54833
|
"location": {
|
|
54834
54834
|
"filePath": "dependency-installer.ts",
|
|
54835
|
-
"line":
|
|
54835
|
+
"line": 273,
|
|
54836
54836
|
"character": 3
|
|
54837
54837
|
},
|
|
54838
54838
|
"raw": "/**\n * Compute all the component manifests (a.k.a. package.json files) that should be passed to the package manager\n * in order to install the dependencies.\n */",
|
|
@@ -54846,7 +54846,7 @@
|
|
|
54846
54846
|
"__schema": "ParameterSchema",
|
|
54847
54847
|
"location": {
|
|
54848
54848
|
"filePath": "dependency-installer.ts",
|
|
54849
|
-
"line":
|
|
54849
|
+
"line": 277,
|
|
54850
54850
|
"character": 38
|
|
54851
54851
|
},
|
|
54852
54852
|
"name": "{ componentDirectoryMap, rootPolicy, rootDir, dedupe, dependencyFilterFn, copyPeerToRuntimeOnComponents, copyPeerToRuntimeOnRoot, installPeersFromEnvs, resolveVersionsFromDependenciesOnly, referenceLocalPackages, hasRootComponents, excludeExtensionsDependencies }",
|
|
@@ -54854,7 +54854,7 @@
|
|
|
54854
54854
|
"__schema": "TypeRefSchema",
|
|
54855
54855
|
"location": {
|
|
54856
54856
|
"filePath": "dependency-installer.ts",
|
|
54857
|
-
"line":
|
|
54857
|
+
"line": 290,
|
|
54858
54858
|
"character": 6
|
|
54859
54859
|
},
|
|
54860
54860
|
"name": "GetComponentManifestsOptions"
|
|
@@ -54865,7 +54865,7 @@
|
|
|
54865
54865
|
"__schema": "InferenceTypeSchema",
|
|
54866
54866
|
"location": {
|
|
54867
54867
|
"filePath": "dependency-installer.ts",
|
|
54868
|
-
"line":
|
|
54868
|
+
"line": 278,
|
|
54869
54869
|
"character": 5
|
|
54870
54870
|
},
|
|
54871
54871
|
"name": "componentDirectoryMap",
|
|
@@ -54876,7 +54876,7 @@
|
|
|
54876
54876
|
"__schema": "InferenceTypeSchema",
|
|
54877
54877
|
"location": {
|
|
54878
54878
|
"filePath": "dependency-installer.ts",
|
|
54879
|
-
"line":
|
|
54879
|
+
"line": 279,
|
|
54880
54880
|
"character": 5
|
|
54881
54881
|
},
|
|
54882
54882
|
"name": "rootPolicy",
|
|
@@ -54887,7 +54887,7 @@
|
|
|
54887
54887
|
"__schema": "InferenceTypeSchema",
|
|
54888
54888
|
"location": {
|
|
54889
54889
|
"filePath": "dependency-installer.ts",
|
|
54890
|
-
"line":
|
|
54890
|
+
"line": 280,
|
|
54891
54891
|
"character": 5
|
|
54892
54892
|
},
|
|
54893
54893
|
"name": "rootDir",
|
|
@@ -54898,7 +54898,7 @@
|
|
|
54898
54898
|
"__schema": "InferenceTypeSchema",
|
|
54899
54899
|
"location": {
|
|
54900
54900
|
"filePath": "dependency-installer.ts",
|
|
54901
|
-
"line":
|
|
54901
|
+
"line": 281,
|
|
54902
54902
|
"character": 5
|
|
54903
54903
|
},
|
|
54904
54904
|
"name": "dedupe",
|
|
@@ -54909,7 +54909,7 @@
|
|
|
54909
54909
|
"__schema": "InferenceTypeSchema",
|
|
54910
54910
|
"location": {
|
|
54911
54911
|
"filePath": "dependency-installer.ts",
|
|
54912
|
-
"line":
|
|
54912
|
+
"line": 282,
|
|
54913
54913
|
"character": 5
|
|
54914
54914
|
},
|
|
54915
54915
|
"name": "dependencyFilterFn",
|
|
@@ -54920,7 +54920,7 @@
|
|
|
54920
54920
|
"__schema": "InferenceTypeSchema",
|
|
54921
54921
|
"location": {
|
|
54922
54922
|
"filePath": "dependency-installer.ts",
|
|
54923
|
-
"line":
|
|
54923
|
+
"line": 283,
|
|
54924
54924
|
"character": 5
|
|
54925
54925
|
},
|
|
54926
54926
|
"name": "copyPeerToRuntimeOnComponents",
|
|
@@ -54931,7 +54931,7 @@
|
|
|
54931
54931
|
"__schema": "InferenceTypeSchema",
|
|
54932
54932
|
"location": {
|
|
54933
54933
|
"filePath": "dependency-installer.ts",
|
|
54934
|
-
"line":
|
|
54934
|
+
"line": 284,
|
|
54935
54935
|
"character": 5
|
|
54936
54936
|
},
|
|
54937
54937
|
"name": "copyPeerToRuntimeOnRoot",
|
|
@@ -54942,7 +54942,7 @@
|
|
|
54942
54942
|
"__schema": "InferenceTypeSchema",
|
|
54943
54943
|
"location": {
|
|
54944
54944
|
"filePath": "dependency-installer.ts",
|
|
54945
|
-
"line":
|
|
54945
|
+
"line": 285,
|
|
54946
54946
|
"character": 5
|
|
54947
54947
|
},
|
|
54948
54948
|
"name": "installPeersFromEnvs",
|
|
@@ -54953,7 +54953,7 @@
|
|
|
54953
54953
|
"__schema": "InferenceTypeSchema",
|
|
54954
54954
|
"location": {
|
|
54955
54955
|
"filePath": "dependency-installer.ts",
|
|
54956
|
-
"line":
|
|
54956
|
+
"line": 286,
|
|
54957
54957
|
"character": 5
|
|
54958
54958
|
},
|
|
54959
54959
|
"name": "resolveVersionsFromDependenciesOnly",
|
|
@@ -54964,7 +54964,7 @@
|
|
|
54964
54964
|
"__schema": "InferenceTypeSchema",
|
|
54965
54965
|
"location": {
|
|
54966
54966
|
"filePath": "dependency-installer.ts",
|
|
54967
|
-
"line":
|
|
54967
|
+
"line": 287,
|
|
54968
54968
|
"character": 5
|
|
54969
54969
|
},
|
|
54970
54970
|
"name": "referenceLocalPackages",
|
|
@@ -54975,7 +54975,7 @@
|
|
|
54975
54975
|
"__schema": "InferenceTypeSchema",
|
|
54976
54976
|
"location": {
|
|
54977
54977
|
"filePath": "dependency-installer.ts",
|
|
54978
|
-
"line":
|
|
54978
|
+
"line": 288,
|
|
54979
54979
|
"character": 5
|
|
54980
54980
|
},
|
|
54981
54981
|
"name": "hasRootComponents",
|
|
@@ -54986,7 +54986,7 @@
|
|
|
54986
54986
|
"__schema": "InferenceTypeSchema",
|
|
54987
54987
|
"location": {
|
|
54988
54988
|
"filePath": "dependency-installer.ts",
|
|
54989
|
-
"line":
|
|
54989
|
+
"line": 289,
|
|
54990
54990
|
"character": 5
|
|
54991
54991
|
},
|
|
54992
54992
|
"name": "excludeExtensionsDependencies",
|
|
@@ -55001,7 +55001,7 @@
|
|
|
55001
55001
|
"__schema": "InferenceTypeSchema",
|
|
55002
55002
|
"location": {
|
|
55003
55003
|
"filePath": "dependency-installer.ts",
|
|
55004
|
-
"line":
|
|
55004
|
+
"line": 277,
|
|
55005
55005
|
"character": 3
|
|
55006
55006
|
},
|
|
55007
55007
|
"type": "Promise<Record<string, ProjectManifest>>"
|
|
@@ -55207,7 +55207,7 @@
|
|
|
55207
55207
|
"componentId": {
|
|
55208
55208
|
"scope": "teambit.dependencies",
|
|
55209
55209
|
"name": "dependency-resolver",
|
|
55210
|
-
"version": "1.0.
|
|
55210
|
+
"version": "1.0.448"
|
|
55211
55211
|
},
|
|
55212
55212
|
"taggedModuleExports": []
|
|
55213
55213
|
}
|
|
@@ -128,7 +128,8 @@ class DependencyInstaller {
|
|
|
128
128
|
manifests[dir].dependencies = _objectSpread(_objectSpread({}, linkedDeps), manifests[dir].dependencies);
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
const
|
|
131
|
+
const isJsonCmd = process.argv.includes('--json') || process.argv.includes('-j');
|
|
132
|
+
const hidePackageManagerOutput = Boolean(this.installingContext.inCapsule && process.env.VERBOSE_PM_OUTPUT !== 'true') || isJsonCmd;
|
|
132
133
|
|
|
133
134
|
// Make sure to take other default if passed options with only one option
|
|
134
135
|
const calculatedPmOpts = _objectSpread(_objectSpread({}, DEFAULT_PM_INSTALL_OPTIONS), {}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_path","_fsExtra","_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_PM_INSTALL_OPTIONS","dedupe","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","installPeersFromEnvs","DEFAULT_INSTALL_OPTIONS","installTeambitBit","excludeExtensionsDependencies","DependencyInstaller","constructor","packageManager","aspectLoader","logger","dependencyResolver","rootDir","cacheRootDir","preInstallSubscriberList","postInstallSubscriberList","nodeLinker","packageImportMethod","sideEffectsCache","nodeVersion","engineStrict","peerDependencyRules","neverBuiltDependencies","preferOffline","installingContext","install","rootPolicy","componentDirectoryMap","options","packageManagerOptions","finalRootDir","RootDirNotDefined","manifests","getComponentManifests","resolveVersionsFromDependenciesOnly","referenceLocalPackages","rootComponentsForCapsules","installComponents","args","runPrePostSubscribers","mainAspect","linkedDependencies","JSON","parse","stringify","directDeps","Set","values","manifest","depName","dependencies","devDependencies","add","name","has","forceTeambitHarmonyLink","entries","dir","linkedDeps","hidePackageManagerOutput","inCapsule","process","env","VERBOSE_PM_OUTPUT","calculatedPmOpts","packageManagerConfigRootDir","dedupeInjectedDeps","version","packageName","MainAspectNotInstallable","dependencyId","lifecycleType","rootComponents","keepExistingModulesDir","cleanCompsNodeModules","err","debug","messagePrefix","messageSuffix","message","setStatusLine","startTime","hrtime","installResult","consoleSuccess","pruneModules","dependencyFilterFn","hasRootComponents","filterComponentsFromManifests","createManifestForComponentsWithoutDependencies","workspaceManifest","getWorkspaceManifest","undefined","components","toArray","reduce","acc","component","getPackageName","componentsManifestsMap","get","toJson","copyPeerToRuntime","promises","map","nmDir","path","join","fs","remove","Promise","all","subscribers","type","mapSeries","subscriber","exports"],"sources":["dependency-installer.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport { MainAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { ComponentMap } from '@teambit/component';\nimport { Logger } from '@teambit/logger';\nimport { PathAbsolute } from '@teambit/toolbox.path.path';\nimport { PeerDependencyRules, ProjectManifest } from '@pnpm/types';\nimport { MainAspectNotInstallable, RootDirNotDefined } from './exceptions';\nimport { PackageManager, PackageManagerInstallOptions, PackageImportMethod } from './package-manager';\nimport { WorkspacePolicy } from './policy';\nimport { CreateFromComponentsOptions } from './manifest';\nimport { DependencyResolverMain } from './dependency-resolver.main.runtime';\n\nconst DEFAULT_PM_INSTALL_OPTIONS: PackageManagerInstallOptions = {\n dedupe: true,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n installPeersFromEnvs: false,\n};\n\nconst DEFAULT_INSTALL_OPTIONS: InstallOptions = {\n installTeambitBit: false,\n excludeExtensionsDependencies: false,\n};\n\nexport type DepInstallerContext = {\n inCapsule?: boolean;\n};\n\nexport type InstallArgs = {\n rootDir: string | undefined;\n rootPolicy: WorkspacePolicy;\n componentDirectoryMap: ComponentMap<string>;\n options: InstallOptions;\n packageManagerOptions: PackageManagerInstallOptions;\n};\n\nexport type InstallOptions = {\n installTeambitBit: boolean;\n packageManagerConfigRootDir?: string;\n resolveVersionsFromDependenciesOnly?: boolean;\n linkedDependencies?: Record<string, Record<string, string>>;\n forceTeambitHarmonyLink?: boolean;\n excludeExtensionsDependencies?: boolean;\n dedupeInjectedDeps?: boolean;\n};\n\nexport type GetComponentManifestsOptions = {\n componentDirectoryMap: ComponentMap<string>;\n rootPolicy: WorkspacePolicy;\n rootDir: string;\n resolveVersionsFromDependenciesOnly?: boolean;\n referenceLocalPackages?: boolean;\n hasRootComponents?: boolean;\n excludeExtensionsDependencies?: boolean;\n} & Pick<\n PackageManagerInstallOptions,\n 'dedupe' | 'dependencyFilterFn' | 'copyPeerToRuntimeOnComponents' | 'copyPeerToRuntimeOnRoot' | 'installPeersFromEnvs'\n>;\n\nexport type PreInstallSubscriber = (installer: DependencyInstaller, installArgs: InstallArgs) => Promise<void>;\nexport type PreInstallSubscriberList = Array<PreInstallSubscriber>;\n\nexport type PostInstallSubscriber = (installer: DependencyInstaller, installArgs: InstallArgs) => Promise<void>;\nexport type PostInstallSubscriberList = Array<PostInstallSubscriber>;\n\nexport class DependencyInstaller {\n constructor(\n /**\n * package manager instance.\n */\n private packageManager: PackageManager,\n\n private aspectLoader: AspectLoaderMain,\n\n private logger: Logger,\n\n private dependencyResolver: DependencyResolverMain,\n\n private rootDir?: string | PathAbsolute,\n\n private cacheRootDir?: string | PathAbsolute,\n\n private preInstallSubscriberList?: PreInstallSubscriberList,\n\n private postInstallSubscriberList?: PostInstallSubscriberList,\n\n private nodeLinker?: 'hoisted' | 'isolated',\n\n private packageImportMethod?: PackageImportMethod,\n\n private sideEffectsCache?: boolean,\n\n private nodeVersion?: string,\n\n private engineStrict?: boolean,\n\n private peerDependencyRules?: PeerDependencyRules,\n\n private neverBuiltDependencies?: string[],\n\n private preferOffline?: boolean,\n\n private installingContext: DepInstallerContext = {},\n ) {}\n\n async install(\n rootDir: string | undefined,\n rootPolicy: WorkspacePolicy,\n componentDirectoryMap: ComponentMap<string>,\n options: InstallOptions = DEFAULT_INSTALL_OPTIONS,\n packageManagerOptions: PackageManagerInstallOptions = DEFAULT_PM_INSTALL_OPTIONS,\n ) {\n const finalRootDir = rootDir ?? this.rootDir;\n if (!finalRootDir) {\n throw new RootDirNotDefined();\n }\n const manifests = await this.getComponentManifests({\n ...packageManagerOptions,\n componentDirectoryMap,\n rootPolicy,\n rootDir: finalRootDir,\n resolveVersionsFromDependenciesOnly: options.resolveVersionsFromDependenciesOnly,\n referenceLocalPackages: packageManagerOptions.rootComponentsForCapsules,\n excludeExtensionsDependencies: options.excludeExtensionsDependencies,\n });\n return this.installComponents(\n finalRootDir,\n manifests,\n rootPolicy,\n componentDirectoryMap,\n options,\n packageManagerOptions,\n );\n }\n\n async installComponents(\n rootDir: string | undefined,\n manifests: Record<string, ProjectManifest>,\n rootPolicy: WorkspacePolicy,\n componentDirectoryMap: ComponentMap<string>,\n options: InstallOptions = DEFAULT_INSTALL_OPTIONS,\n packageManagerOptions: PackageManagerInstallOptions = DEFAULT_PM_INSTALL_OPTIONS,\n ): Promise<{ dependenciesChanged: boolean }> {\n const args = {\n componentDirectoryMap,\n options,\n packageManagerOptions,\n rootDir,\n rootPolicy,\n };\n await this.runPrePostSubscribers(this.preInstallSubscriberList, 'pre', args);\n const mainAspect: MainAspect = this.aspectLoader.mainAspect;\n const finalRootDir = rootDir || this.rootDir;\n if (!finalRootDir) {\n throw new RootDirNotDefined();\n }\n if (options.linkedDependencies) {\n manifests = JSON.parse(JSON.stringify(manifests));\n const linkedDependencies = JSON.parse(\n JSON.stringify(options.linkedDependencies),\n ) as typeof options.linkedDependencies;\n if (linkedDependencies[finalRootDir]) {\n const directDeps = new Set<string>();\n Object.values(manifests).forEach((manifest) => {\n for (const depName of Object.keys({ ...manifest.dependencies, ...manifest.devDependencies })) {\n directDeps.add(depName);\n }\n });\n for (const manifest of Object.values(manifests)) {\n if (manifest.name && directDeps.has(manifest.name)) {\n delete linkedDependencies[finalRootDir][manifest.name];\n }\n }\n if (options.forceTeambitHarmonyLink && manifests[finalRootDir].dependencies?.['@teambit/harmony']) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n delete manifests[finalRootDir].dependencies!['@teambit/harmony'];\n }\n }\n Object.entries(linkedDependencies).forEach(([dir, linkedDeps]) => {\n if (!manifests[dir]) {\n manifests[dir] = {};\n }\n manifests[dir].dependencies = {\n ...linkedDeps,\n ...manifests[dir].dependencies,\n };\n });\n }\n const hidePackageManagerOutput = !!(this.installingContext.inCapsule && process.env.VERBOSE_PM_OUTPUT !== 'true');\n\n // Make sure to take other default if passed options with only one option\n const calculatedPmOpts = {\n ...DEFAULT_PM_INSTALL_OPTIONS,\n cacheRootDir: this.cacheRootDir,\n nodeLinker: this.nodeLinker,\n packageImportMethod: this.packageImportMethod,\n sideEffectsCache: this.sideEffectsCache,\n nodeVersion: this.nodeVersion,\n engineStrict: this.engineStrict,\n packageManagerConfigRootDir: options.packageManagerConfigRootDir,\n peerDependencyRules: this.peerDependencyRules,\n hidePackageManagerOutput,\n neverBuiltDependencies: ['core-js', ...(this.neverBuiltDependencies ?? [])],\n preferOffline: this.preferOffline,\n dedupeInjectedDeps: options.dedupeInjectedDeps,\n ...packageManagerOptions,\n };\n if (options.installTeambitBit) {\n if (!mainAspect.version || !mainAspect.packageName) {\n throw new MainAspectNotInstallable();\n }\n const version = mainAspect.version;\n rootPolicy.add({\n dependencyId: mainAspect.packageName,\n lifecycleType: 'runtime',\n value: {\n version,\n },\n });\n }\n\n if (!packageManagerOptions.rootComponents && !packageManagerOptions.keepExistingModulesDir) {\n try {\n // Remove node modules dir for all components dirs, since it might contain left overs from previous install.\n //\n // This is not needed when \"rootComponents\" are used, as in that case the package manager handles the node_modules\n // and it never leaves node_modules in a broken state.\n // Removing node_modules in that case would delete useful state information that is used by Yarn or pnpm.\n await this.cleanCompsNodeModules(componentDirectoryMap);\n } catch (err) {\n this.logger.debug('failed to remove node_modules directories from components', err);\n // A failure to remove the node_modules directory should not cause the process to fail\n }\n }\n\n const messagePrefix = 'running package installation';\n const messageSuffix = `using ${this.packageManager.name}`;\n const message = this.installingContext?.inCapsule\n ? `(capsule) ${messagePrefix} in root dir ${this.rootDir} ${messageSuffix}`\n : `${messagePrefix} ${messageSuffix}`;\n if (!hidePackageManagerOutput) {\n this.logger.setStatusLine(message);\n }\n const startTime = process.hrtime();\n\n // TODO: the cache should be probably passed to the package manager constructor not to the install function\n const installResult = await this.packageManager.install(\n {\n rootDir: finalRootDir,\n manifests,\n componentDirectoryMap,\n },\n calculatedPmOpts,\n );\n if (!hidePackageManagerOutput) {\n this.logger.consoleSuccess(`done ${message}`, startTime);\n }\n await this.runPrePostSubscribers(this.postInstallSubscriberList, 'post', args);\n return installResult;\n }\n\n public async pruneModules(rootDir: string): Promise<void> {\n if (!this.packageManager.pruneModules) {\n return;\n }\n await this.packageManager.pruneModules(rootDir);\n }\n\n /**\n * Compute all the component manifests (a.k.a. package.json files) that should be passed to the package manager\n * in order to install the dependencies.\n */\n public async getComponentManifests({\n componentDirectoryMap,\n rootPolicy,\n rootDir,\n dedupe,\n dependencyFilterFn,\n copyPeerToRuntimeOnComponents,\n copyPeerToRuntimeOnRoot,\n installPeersFromEnvs,\n resolveVersionsFromDependenciesOnly,\n referenceLocalPackages,\n hasRootComponents,\n excludeExtensionsDependencies,\n }: GetComponentManifestsOptions) {\n const options: CreateFromComponentsOptions = {\n filterComponentsFromManifests: true,\n createManifestForComponentsWithoutDependencies: true,\n dedupe,\n dependencyFilterFn,\n resolveVersionsFromDependenciesOnly,\n referenceLocalPackages,\n hasRootComponents,\n excludeExtensionsDependencies,\n };\n const workspaceManifest = await this.dependencyResolver.getWorkspaceManifest(\n undefined,\n undefined,\n rootPolicy,\n rootDir,\n componentDirectoryMap.components,\n options,\n this.installingContext,\n );\n const manifests: Record<string, ProjectManifest> = componentDirectoryMap\n .toArray()\n .reduce((acc, [component, dir]) => {\n const packageName = this.dependencyResolver.getPackageName(component);\n const manifest = workspaceManifest.componentsManifestsMap.get(packageName);\n if (manifest) {\n acc[dir] = manifest.toJson({ copyPeerToRuntime: copyPeerToRuntimeOnComponents });\n }\n return acc;\n }, {});\n if (!manifests[rootDir]) {\n manifests[rootDir] = workspaceManifest.toJson({\n copyPeerToRuntime: copyPeerToRuntimeOnRoot,\n installPeersFromEnvs,\n });\n }\n return manifests;\n }\n\n private async cleanCompsNodeModules(componentDirectoryMap: ComponentMap<string>) {\n const promises = componentDirectoryMap.toArray().map(([, dir]) => {\n const nmDir = path.join(dir, 'node_modules');\n return fs.remove(nmDir);\n });\n return Promise.all(promises);\n }\n\n private async runPrePostSubscribers(\n subscribers: PreInstallSubscriberList | PostInstallSubscriberList = [],\n type: 'pre' | 'post',\n args: InstallArgs,\n ): Promise<void> {\n const message = this.installingContext?.inCapsule\n ? `(capsule) running ${type} install subscribers in root dir ${this.rootDir}`\n : `running ${type} install subscribers`;\n if (!this.installingContext?.inCapsule) {\n this.logger.setStatusLine(message);\n }\n await mapSeries(subscribers, async (subscriber) => {\n return subscriber(this, args);\n });\n if (!this.installingContext?.inCapsule) {\n this.logger.consoleSuccess(message);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAA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/C,GAAG,CAAC,KAAK;MAChE,MAAMgD,KAAK,GAAGC,eAAI,CAACC,IAAI,CAAClD,GAAG,EAAE,cAAc,CAAC;MAC5C,OAAOmD,kBAAE,CAACC,MAAM,CAACJ,KAAK,CAAC;IACzB,CAAC,CAAC;IACF,OAAOK,OAAO,CAACC,GAAG,CAACR,QAAQ,CAAC;EAC9B;EAEA,MAAchE,qBAAqBA,CACjCyE,WAAiE,GAAG,EAAE,EACtEC,IAAoB,EACpB3E,IAAiB,EACF;IACf,MAAMyC,OAAO,GAAG,IAAI,CAACvD,iBAAiB,EAAEoC,SAAS,GAC7C,qBAAqBqD,IAAI,oCAAoC,IAAI,CAACrG,OAAO,EAAE,GAC3E,WAAWqG,IAAI,sBAAsB;IACzC,IAAI,CAAC,IAAI,CAACzF,iBAAiB,EAAEoC,SAAS,EAAE;MACtC,IAAI,CAAClD,MAAM,CAACsE,aAAa,CAACD,OAAO,CAAC;IACpC;IACA,MAAM,IAAAmC,qBAAS,EAACF,WAAW,EAAE,MAAOG,UAAU,IAAK;MACjD,OAAOA,UAAU,CAAC,IAAI,EAAE7E,IAAI,CAAC;IAC/B,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAACd,iBAAiB,EAAEoC,SAAS,EAAE;MACtC,IAAI,CAAClD,MAAM,CAAC0E,cAAc,CAACL,OAAO,CAAC;IACrC;EACF;AACF;AAACqC,OAAA,CAAA9G,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_path","_fsExtra","_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_PM_INSTALL_OPTIONS","dedupe","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","installPeersFromEnvs","DEFAULT_INSTALL_OPTIONS","installTeambitBit","excludeExtensionsDependencies","DependencyInstaller","constructor","packageManager","aspectLoader","logger","dependencyResolver","rootDir","cacheRootDir","preInstallSubscriberList","postInstallSubscriberList","nodeLinker","packageImportMethod","sideEffectsCache","nodeVersion","engineStrict","peerDependencyRules","neverBuiltDependencies","preferOffline","installingContext","install","rootPolicy","componentDirectoryMap","options","packageManagerOptions","finalRootDir","RootDirNotDefined","manifests","getComponentManifests","resolveVersionsFromDependenciesOnly","referenceLocalPackages","rootComponentsForCapsules","installComponents","args","runPrePostSubscribers","mainAspect","linkedDependencies","JSON","parse","stringify","directDeps","Set","values","manifest","depName","dependencies","devDependencies","add","name","has","forceTeambitHarmonyLink","entries","dir","linkedDeps","isJsonCmd","process","argv","includes","hidePackageManagerOutput","Boolean","inCapsule","env","VERBOSE_PM_OUTPUT","calculatedPmOpts","packageManagerConfigRootDir","dedupeInjectedDeps","version","packageName","MainAspectNotInstallable","dependencyId","lifecycleType","rootComponents","keepExistingModulesDir","cleanCompsNodeModules","err","debug","messagePrefix","messageSuffix","message","setStatusLine","startTime","hrtime","installResult","consoleSuccess","pruneModules","dependencyFilterFn","hasRootComponents","filterComponentsFromManifests","createManifestForComponentsWithoutDependencies","workspaceManifest","getWorkspaceManifest","undefined","components","toArray","reduce","acc","component","getPackageName","componentsManifestsMap","get","toJson","copyPeerToRuntime","promises","map","nmDir","path","join","fs","remove","Promise","all","subscribers","type","mapSeries","subscriber","exports"],"sources":["dependency-installer.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport { MainAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { ComponentMap } from '@teambit/component';\nimport { Logger } from '@teambit/logger';\nimport { PathAbsolute } from '@teambit/toolbox.path.path';\nimport { PeerDependencyRules, ProjectManifest } from '@pnpm/types';\nimport { MainAspectNotInstallable, RootDirNotDefined } from './exceptions';\nimport { PackageManager, PackageManagerInstallOptions, PackageImportMethod } from './package-manager';\nimport { WorkspacePolicy } from './policy';\nimport { CreateFromComponentsOptions } from './manifest';\nimport { DependencyResolverMain } from './dependency-resolver.main.runtime';\n\nconst DEFAULT_PM_INSTALL_OPTIONS: PackageManagerInstallOptions = {\n dedupe: true,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n installPeersFromEnvs: false,\n};\n\nconst DEFAULT_INSTALL_OPTIONS: InstallOptions = {\n installTeambitBit: false,\n excludeExtensionsDependencies: false,\n};\n\nexport type DepInstallerContext = {\n inCapsule?: boolean;\n};\n\nexport type InstallArgs = {\n rootDir: string | undefined;\n rootPolicy: WorkspacePolicy;\n componentDirectoryMap: ComponentMap<string>;\n options: InstallOptions;\n packageManagerOptions: PackageManagerInstallOptions;\n};\n\nexport type InstallOptions = {\n installTeambitBit: boolean;\n packageManagerConfigRootDir?: string;\n resolveVersionsFromDependenciesOnly?: boolean;\n linkedDependencies?: Record<string, Record<string, string>>;\n forceTeambitHarmonyLink?: boolean;\n excludeExtensionsDependencies?: boolean;\n dedupeInjectedDeps?: boolean;\n};\n\nexport type GetComponentManifestsOptions = {\n componentDirectoryMap: ComponentMap<string>;\n rootPolicy: WorkspacePolicy;\n rootDir: string;\n resolveVersionsFromDependenciesOnly?: boolean;\n referenceLocalPackages?: boolean;\n hasRootComponents?: boolean;\n excludeExtensionsDependencies?: boolean;\n} & Pick<\n PackageManagerInstallOptions,\n 'dedupe' | 'dependencyFilterFn' | 'copyPeerToRuntimeOnComponents' | 'copyPeerToRuntimeOnRoot' | 'installPeersFromEnvs'\n>;\n\nexport type PreInstallSubscriber = (installer: DependencyInstaller, installArgs: InstallArgs) => Promise<void>;\nexport type PreInstallSubscriberList = Array<PreInstallSubscriber>;\n\nexport type PostInstallSubscriber = (installer: DependencyInstaller, installArgs: InstallArgs) => Promise<void>;\nexport type PostInstallSubscriberList = Array<PostInstallSubscriber>;\n\nexport class DependencyInstaller {\n constructor(\n /**\n * package manager instance.\n */\n private packageManager: PackageManager,\n\n private aspectLoader: AspectLoaderMain,\n\n private logger: Logger,\n\n private dependencyResolver: DependencyResolverMain,\n\n private rootDir?: string | PathAbsolute,\n\n private cacheRootDir?: string | PathAbsolute,\n\n private preInstallSubscriberList?: PreInstallSubscriberList,\n\n private postInstallSubscriberList?: PostInstallSubscriberList,\n\n private nodeLinker?: 'hoisted' | 'isolated',\n\n private packageImportMethod?: PackageImportMethod,\n\n private sideEffectsCache?: boolean,\n\n private nodeVersion?: string,\n\n private engineStrict?: boolean,\n\n private peerDependencyRules?: PeerDependencyRules,\n\n private neverBuiltDependencies?: string[],\n\n private preferOffline?: boolean,\n\n private installingContext: DepInstallerContext = {}\n ) {}\n\n async install(\n rootDir: string | undefined,\n rootPolicy: WorkspacePolicy,\n componentDirectoryMap: ComponentMap<string>,\n options: InstallOptions = DEFAULT_INSTALL_OPTIONS,\n packageManagerOptions: PackageManagerInstallOptions = DEFAULT_PM_INSTALL_OPTIONS\n ) {\n const finalRootDir = rootDir ?? this.rootDir;\n if (!finalRootDir) {\n throw new RootDirNotDefined();\n }\n const manifests = await this.getComponentManifests({\n ...packageManagerOptions,\n componentDirectoryMap,\n rootPolicy,\n rootDir: finalRootDir,\n resolveVersionsFromDependenciesOnly: options.resolveVersionsFromDependenciesOnly,\n referenceLocalPackages: packageManagerOptions.rootComponentsForCapsules,\n excludeExtensionsDependencies: options.excludeExtensionsDependencies,\n });\n return this.installComponents(\n finalRootDir,\n manifests,\n rootPolicy,\n componentDirectoryMap,\n options,\n packageManagerOptions\n );\n }\n\n async installComponents(\n rootDir: string | undefined,\n manifests: Record<string, ProjectManifest>,\n rootPolicy: WorkspacePolicy,\n componentDirectoryMap: ComponentMap<string>,\n options: InstallOptions = DEFAULT_INSTALL_OPTIONS,\n packageManagerOptions: PackageManagerInstallOptions = DEFAULT_PM_INSTALL_OPTIONS\n ): Promise<{ dependenciesChanged: boolean }> {\n const args = {\n componentDirectoryMap,\n options,\n packageManagerOptions,\n rootDir,\n rootPolicy,\n };\n await this.runPrePostSubscribers(this.preInstallSubscriberList, 'pre', args);\n const mainAspect: MainAspect = this.aspectLoader.mainAspect;\n const finalRootDir = rootDir || this.rootDir;\n if (!finalRootDir) {\n throw new RootDirNotDefined();\n }\n if (options.linkedDependencies) {\n manifests = JSON.parse(JSON.stringify(manifests));\n const linkedDependencies = JSON.parse(\n JSON.stringify(options.linkedDependencies)\n ) as typeof options.linkedDependencies;\n if (linkedDependencies[finalRootDir]) {\n const directDeps = new Set<string>();\n Object.values(manifests).forEach((manifest) => {\n for (const depName of Object.keys({ ...manifest.dependencies, ...manifest.devDependencies })) {\n directDeps.add(depName);\n }\n });\n for (const manifest of Object.values(manifests)) {\n if (manifest.name && directDeps.has(manifest.name)) {\n delete linkedDependencies[finalRootDir][manifest.name];\n }\n }\n if (options.forceTeambitHarmonyLink && manifests[finalRootDir].dependencies?.['@teambit/harmony']) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n delete manifests[finalRootDir].dependencies!['@teambit/harmony'];\n }\n }\n Object.entries(linkedDependencies).forEach(([dir, linkedDeps]) => {\n if (!manifests[dir]) {\n manifests[dir] = {};\n }\n manifests[dir].dependencies = {\n ...linkedDeps,\n ...manifests[dir].dependencies,\n };\n });\n }\n const isJsonCmd = process.argv.includes('--json') || process.argv.includes('-j');\n const hidePackageManagerOutput =\n Boolean(this.installingContext.inCapsule && process.env.VERBOSE_PM_OUTPUT !== 'true') || isJsonCmd;\n\n // Make sure to take other default if passed options with only one option\n const calculatedPmOpts = {\n ...DEFAULT_PM_INSTALL_OPTIONS,\n cacheRootDir: this.cacheRootDir,\n nodeLinker: this.nodeLinker,\n packageImportMethod: this.packageImportMethod,\n sideEffectsCache: this.sideEffectsCache,\n nodeVersion: this.nodeVersion,\n engineStrict: this.engineStrict,\n packageManagerConfigRootDir: options.packageManagerConfigRootDir,\n peerDependencyRules: this.peerDependencyRules,\n hidePackageManagerOutput,\n neverBuiltDependencies: ['core-js', ...(this.neverBuiltDependencies ?? [])],\n preferOffline: this.preferOffline,\n dedupeInjectedDeps: options.dedupeInjectedDeps,\n ...packageManagerOptions,\n };\n if (options.installTeambitBit) {\n if (!mainAspect.version || !mainAspect.packageName) {\n throw new MainAspectNotInstallable();\n }\n const version = mainAspect.version;\n rootPolicy.add({\n dependencyId: mainAspect.packageName,\n lifecycleType: 'runtime',\n value: {\n version,\n },\n });\n }\n\n if (!packageManagerOptions.rootComponents && !packageManagerOptions.keepExistingModulesDir) {\n try {\n // Remove node modules dir for all components dirs, since it might contain left overs from previous install.\n //\n // This is not needed when \"rootComponents\" are used, as in that case the package manager handles the node_modules\n // and it never leaves node_modules in a broken state.\n // Removing node_modules in that case would delete useful state information that is used by Yarn or pnpm.\n await this.cleanCompsNodeModules(componentDirectoryMap);\n } catch (err) {\n this.logger.debug('failed to remove node_modules directories from components', err);\n // A failure to remove the node_modules directory should not cause the process to fail\n }\n }\n\n const messagePrefix = 'running package installation';\n const messageSuffix = `using ${this.packageManager.name}`;\n const message = this.installingContext?.inCapsule\n ? `(capsule) ${messagePrefix} in root dir ${this.rootDir} ${messageSuffix}`\n : `${messagePrefix} ${messageSuffix}`;\n if (!hidePackageManagerOutput) {\n this.logger.setStatusLine(message);\n }\n const startTime = process.hrtime();\n\n // TODO: the cache should be probably passed to the package manager constructor not to the install function\n const installResult = await this.packageManager.install(\n {\n rootDir: finalRootDir,\n manifests,\n componentDirectoryMap,\n },\n calculatedPmOpts\n );\n if (!hidePackageManagerOutput) {\n this.logger.consoleSuccess(`done ${message}`, startTime);\n }\n await this.runPrePostSubscribers(this.postInstallSubscriberList, 'post', args);\n return installResult;\n }\n\n public async pruneModules(rootDir: string): Promise<void> {\n if (!this.packageManager.pruneModules) {\n return;\n }\n await this.packageManager.pruneModules(rootDir);\n }\n\n /**\n * Compute all the component manifests (a.k.a. package.json files) that should be passed to the package manager\n * in order to install the dependencies.\n */\n public async getComponentManifests({\n componentDirectoryMap,\n rootPolicy,\n rootDir,\n dedupe,\n dependencyFilterFn,\n copyPeerToRuntimeOnComponents,\n copyPeerToRuntimeOnRoot,\n installPeersFromEnvs,\n resolveVersionsFromDependenciesOnly,\n referenceLocalPackages,\n hasRootComponents,\n excludeExtensionsDependencies,\n }: GetComponentManifestsOptions) {\n const options: CreateFromComponentsOptions = {\n filterComponentsFromManifests: true,\n createManifestForComponentsWithoutDependencies: true,\n dedupe,\n dependencyFilterFn,\n resolveVersionsFromDependenciesOnly,\n referenceLocalPackages,\n hasRootComponents,\n excludeExtensionsDependencies,\n };\n const workspaceManifest = await this.dependencyResolver.getWorkspaceManifest(\n undefined,\n undefined,\n rootPolicy,\n rootDir,\n componentDirectoryMap.components,\n options,\n this.installingContext\n );\n const manifests: Record<string, ProjectManifest> = componentDirectoryMap\n .toArray()\n .reduce((acc, [component, dir]) => {\n const packageName = this.dependencyResolver.getPackageName(component);\n const manifest = workspaceManifest.componentsManifestsMap.get(packageName);\n if (manifest) {\n acc[dir] = manifest.toJson({ copyPeerToRuntime: copyPeerToRuntimeOnComponents });\n }\n return acc;\n }, {});\n if (!manifests[rootDir]) {\n manifests[rootDir] = workspaceManifest.toJson({\n copyPeerToRuntime: copyPeerToRuntimeOnRoot,\n installPeersFromEnvs,\n });\n }\n return manifests;\n }\n\n private async cleanCompsNodeModules(componentDirectoryMap: ComponentMap<string>) {\n const promises = componentDirectoryMap.toArray().map(([, dir]) => {\n const nmDir = path.join(dir, 'node_modules');\n return fs.remove(nmDir);\n });\n return Promise.all(promises);\n }\n\n private async runPrePostSubscribers(\n subscribers: PreInstallSubscriberList | PostInstallSubscriberList = [],\n type: 'pre' | 'post',\n args: InstallArgs\n ): Promise<void> {\n const message = this.installingContext?.inCapsule\n ? `(capsule) running ${type} install subscribers in root dir ${this.rootDir}`\n : `running ${type} install subscribers`;\n if (!this.installingContext?.inCapsule) {\n this.logger.setStatusLine(message);\n }\n await mapSeries(subscribers, async (subscriber) => {\n return subscriber(this, args);\n });\n if (!this.install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AAAmC,qBAAS,EAACF,WAAW,EAAE,MAAOG,UAAU,IAAK;MACjD,OAAOA,UAAU,CAAC,IAAI,EAAEjF,IAAI,CAAC;IAC/B,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAACd,iBAAiB,EAAEyC,SAAS,EAAE;MACtC,IAAI,CAACvD,MAAM,CAAC8E,cAAc,CAACL,OAAO,CAAC;IACrC;EACF;AACF;AAACqC,OAAA,CAAAlH,mBAAA,GAAAA,mBAAA","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.448/dist/dependency-resolver.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_dependency-resolver@1.0.448/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.448",
|
|
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.448"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"@teambit/legacy-bit-id": "1.1.1",
|
|
35
35
|
"@teambit/component-version": "1.0.3",
|
|
36
36
|
"@teambit/toolbox.object.sorter": "0.0.2",
|
|
37
|
-
"@teambit/component": "1.0.
|
|
38
|
-
"@teambit/envs": "1.0.
|
|
39
|
-
"@teambit/dependencies": "1.0.
|
|
40
|
-
"@teambit/aspect-loader": "1.0.
|
|
41
|
-
"@teambit/logger": "0.0.
|
|
37
|
+
"@teambit/component": "1.0.448",
|
|
38
|
+
"@teambit/envs": "1.0.448",
|
|
39
|
+
"@teambit/dependencies": "1.0.448",
|
|
40
|
+
"@teambit/aspect-loader": "1.0.448",
|
|
41
|
+
"@teambit/logger": "0.0.1118",
|
|
42
42
|
"@teambit/toolbox.path.path": "0.0.4",
|
|
43
43
|
"@teambit/pkg.modules.component-package-name": "0.0.5",
|
|
44
|
-
"@teambit/graphql": "1.0.
|
|
45
|
-
"@teambit/bit": "1.8.
|
|
46
|
-
"@teambit/cli": "0.0.
|
|
47
|
-
"@teambit/component.sources": "0.0.
|
|
48
|
-
"@teambit/config": "0.0.
|
|
49
|
-
"@teambit/global-config": "0.0.
|
|
44
|
+
"@teambit/graphql": "1.0.448",
|
|
45
|
+
"@teambit/bit": "1.8.99",
|
|
46
|
+
"@teambit/cli": "0.0.1025",
|
|
47
|
+
"@teambit/component.sources": "0.0.41",
|
|
48
|
+
"@teambit/config": "0.0.1199",
|
|
49
|
+
"@teambit/global-config": "0.0.1028",
|
|
50
50
|
"@teambit/harmony.modules.requireable-component": "0.0.498",
|
|
51
|
-
"@teambit/snapping": "1.0.
|
|
52
|
-
"@teambit/workspace.modules.node-modules-linker": "0.0.
|
|
53
|
-
"@teambit/isolator": "1.0.
|
|
51
|
+
"@teambit/snapping": "1.0.448",
|
|
52
|
+
"@teambit/workspace.modules.node-modules-linker": "0.0.216",
|
|
53
|
+
"@teambit/isolator": "1.0.448",
|
|
54
54
|
"@teambit/toolbox.fs.link-or-symlink": "0.0.1",
|
|
55
55
|
"@teambit/component-issues": "0.0.151",
|
|
56
56
|
"@teambit/component-package-version": "0.0.434",
|