@teambit/dependencies 1.0.494 → 1.0.495

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.
@@ -1,10 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="141" failures="0" errors="0" skipped="31">
3
- <testsuite name="teambit.dependencies/dependencies@1.0.494" tests="141" failures="0" errors="0" skipped="31">
3
+ <testsuite name="teambit.dependencies/dependencies@1.0.495" tests="141" failures="0" errors="0" skipped="31">
4
4
  <testcase classname="dist/dependencies.spec.js" name="should add the snap prefix" time="0.001"/>
5
5
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/testing-library__jest-dom" time="0.001"/>
6
- <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/chai"/>
7
- <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/mocha" time="0.001"/>
6
+ <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/chai" time="0.001"/>
7
+ <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/mocha"/>
8
8
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/classnames"/>
9
9
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/cors"/>
10
10
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/cross-spawn"/>
@@ -27,9 +27,9 @@
27
27
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/node"/>
28
28
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/puppeteer"/>
29
29
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/react"/>
30
- <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/react-dom" time="0.001"/>
30
+ <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/react-dom"/>
31
31
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/react-router-dom"/>
32
- <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/react-tabs"/>
32
+ <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/react-tabs" time="0.001"/>
33
33
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/react-tooltip"/>
34
34
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/socket.io-client"/>
35
35
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/ua-parser-js"/>
@@ -38,9 +38,9 @@
38
38
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/webpack"/>
39
39
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/webpack-dev-server"/>
40
40
  <testcase classname="dist/dependencies-loader/package-to-definetly-typed.spec.js" name="should map to @types/webpack-merge"/>
41
- <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="when no files are passed should return an empty tree"/>
42
- <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="when unsupported files are passed should return them with no dependencies"/>
43
- <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="when supported and unsupported files are passed should return them all" time="0.06"/>
41
+ <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="when no files are passed should return an empty tree" time="0.001"/>
42
+ <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="when unsupported files are passed should return them with no dependencies" time="0.001"/>
43
+ <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="when supported and unsupported files are passed should return them all" time="0.08"/>
44
44
  <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="when a js file has parsing error it should add the file to the tree with the error instance">
45
45
  <skipped/>
46
46
  </testcase>
@@ -62,44 +62,44 @@
62
62
  <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="it should add the missing package to the missing section in the tree">
63
63
  <skipped/>
64
64
  </testcase>
65
- <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="should not throw an error and should remove itself from the dependencies files"/>
65
+ <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="should not throw an error and should remove itself from the dependencies files" time="0.001"/>
66
66
  <testcase classname="dist/files-dependency-builder/build-tree.spec.js" name="should not recognize the cycle dependencies as link files">
67
67
  <skipped/>
68
68
  </testcase>
69
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an empty object for a non-existent filename" time="0.001"/>
69
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an empty object for a non-existent filename" time="0.002"/>
70
70
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="handles nested tree structures" time="0.006"/>
71
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="does not include files that are not real (#13)" time="0.002"/>
72
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="does not choke on cyclic dependencies" time="0.004"/>
71
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="does not include files that are not real (#13)" time="0.001"/>
72
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="does not choke on cyclic dependencies" time="0.107"/>
73
73
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="excludes Nodejs core modules by default" time="0.001"/>
74
74
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns a list of absolutely pathed files"/>
75
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="passes it through to precinct" time="0.041"/>
76
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="stores the invalid partials" time="0.001"/>
75
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="passes it through to precinct" time="0.044"/>
76
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="stores the invalid partials" time="0.002"/>
77
77
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="does not store anything" time="0.002"/>
78
78
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="stores the invalid ones" time="0.002"/>
79
79
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should include the non-existent partial per file" time="0.002"/>
80
80
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="throws if the filename is missing"/>
81
81
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="throws if the root is missing"/>
82
82
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="throws if a supplied filter is not a function"/>
83
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="does not throw on the legacy `root` option" time="0.001"/>
83
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="does not throw on the legacy `root` option"/>
84
84
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="does not throw"/>
85
85
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns no dependencies"/>
86
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns the precomputed list of a cached entry point"/>
87
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.001"/>
86
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns the precomputed list of a cached entry point" time="0.001"/>
87
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.002"/>
88
88
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.002"/>
89
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="resolves files that have jsx" time="0.001"/>
90
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="resolves files with a jsx extension" time="0.001"/>
89
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="resolves files that have jsx" time="0.002"/>
90
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="resolves files with a jsx extension" time="0.002"/>
91
91
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="resolves files that have es7" time="0.001"/>
92
92
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.006"/>
93
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file"/>
94
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.005"/>
95
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.018"/>
93
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.001"/>
94
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.003"/>
95
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="returns an object form of the dependency tree for a file" time="0.017"/>
96
96
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="resolves unaliased modules">
97
97
  <skipped/>
98
98
  </testcase>
99
99
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="uses the filter to determine if a file should be included in the results" time="0.002"/>
100
100
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="includes the lazy dependency" time="0.001"/>
101
101
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="includes the lazy dependency" time="0.001"/>
102
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="includes the dynamic import" time="0.001"/>
102
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="includes the dynamic import"/>
103
103
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should include it as a dependency and not throw an error" time="0.001"/>
104
104
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="it includes the module entry as dependency">
105
105
  <skipped/>
@@ -107,48 +107,48 @@
107
107
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="retains the detective config in the clone" time="0.001"/>
108
108
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should not override the cache with wrong packages" time="0.003"/>
109
109
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should not crash with &quot;RangeError: Maximum call stack size exceeded&quot; error" time="0.001"/>
110
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should not show missing dependencies"/>
111
- <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should not show missing dependencies when importing from https"/>
110
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should not show missing dependencies" time="0.001"/>
111
+ <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should not show missing dependencies when importing from https" time="0.001"/>
112
112
  <testcase classname="dist/files-dependency-builder/dependency-tree/index.spec.js" name="should not show missing dependencies when importing from http"/>
113
113
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="uses a generic resolve for unsupported file extensions" time="0.002"/>
114
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="reuses the ast when trying to determine the module type"/>
114
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="reuses the ast when trying to determine the module type" time="0.001"/>
115
115
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves the dependency successfully" time="0.001"/>
116
116
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="uses the filename to look for the module type"/>
117
117
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="assumes commonjs for es6 modules with no requirejs/webpack config">
118
118
  <skipped/>
119
119
  </testcase>
120
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves files with the .jsx extension"/>
120
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves files with the .jsx extension" time="0.001"/>
121
121
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="uses require's resolver">
122
122
  <skipped/>
123
123
  </testcase>
124
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="returns an empty string for an unresolved module" time="0.001"/>
125
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="adds the directory to the require resolution paths" time="0.001"/>
124
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="returns an empty string for an unresolved module"/>
125
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="adds the directory to the require resolution paths" time="0.002"/>
126
126
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves a relative dependency about the filename"/>
127
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves a .. dependency to its parent directory's index.js file"/>
127
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves a .. dependency to its parent directory's index.js file" time="0.001"/>
128
128
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves a dependency within a directory outside of the given file">
129
129
  <skipped/>
130
130
  </testcase>
131
131
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves a node module with module entry in package.json">
132
132
  <skipped/>
133
133
  </testcase>
134
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves a nested module"/>
135
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves to the index.js file of a directory" time="0.001"/>
134
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves a nested module" time="0.001"/>
135
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves to the index.js file of a directory"/>
136
136
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves implicit .jsx requires"/>
137
137
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves implicit .scss requires" time="0.001"/>
138
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves implicit .json requires" time="0.001"/>
139
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves an import"/>
138
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves implicit .json requires"/>
139
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves an import" time="0.001"/>
140
140
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="returns an empty result" time="0.001"/>
141
141
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="uses the sass resolver for .scss files"/>
142
142
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="uses the sass resolver for .sass files"/>
143
143
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="uses the stylus resolver"/>
144
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves extensionless dependencies"/>
144
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves extensionless dependencies" time="0.001"/>
145
145
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves dependencies with a less extension"/>
146
146
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="resolves dependencies with a css extension"/>
147
147
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="uses a generic resolve for unsupported file extensions"/>
148
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="supports passing env detectors"/>
149
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="registers a custom resolver for a given extension" time="0.001"/>
150
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="allows does not break default resolvers"/>
151
- <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="can be called multiple times" time="0.001"/>
148
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="supports passing env detectors" time="0.001"/>
149
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="registers a custom resolver for a given extension" time="0.002"/>
150
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="allows does not break default resolvers" time="0.001"/>
151
+ <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="can be called multiple times"/>
152
152
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="does not add redundant extensions to supportedFileExtensions"/>
153
153
  <testcase classname="dist/files-dependency-builder/filing-cabinet/index.spec.js" name="should resolve the dependency to a node_module package (using webpack under the hood)">
154
154
  <skipped/>
@@ -834,7 +834,7 @@
834
834
  "componentId": {
835
835
  "scope": "teambit.legacy",
836
836
  "name": "consumer-component",
837
- "version": "0.0.7"
837
+ "version": "0.0.8"
838
838
  }
839
839
  },
840
840
  "isOptional": false,
@@ -859,7 +859,7 @@
859
859
  "componentId": {
860
860
  "scope": "teambit.legacy",
861
861
  "name": "consumer-component",
862
- "version": "0.0.7"
862
+ "version": "0.0.8"
863
863
  }
864
864
  },
865
865
  "isOptional": false,
@@ -919,7 +919,7 @@
919
919
  "componentId": {
920
920
  "scope": "teambit.legacy",
921
921
  "name": "consumer-component",
922
- "version": "0.0.7"
922
+ "version": "0.0.8"
923
923
  }
924
924
  },
925
925
  "isOptional": false,
@@ -3458,7 +3458,7 @@
3458
3458
  "componentId": {
3459
3459
  "scope": "teambit.legacy",
3460
3460
  "name": "consumer-component",
3461
- "version": "0.0.7"
3461
+ "version": "0.0.8"
3462
3462
  }
3463
3463
  },
3464
3464
  "isOptional": false,
@@ -3483,7 +3483,7 @@
3483
3483
  "componentId": {
3484
3484
  "scope": "teambit.legacy",
3485
3485
  "name": "consumer-component",
3486
- "version": "0.0.7"
3486
+ "version": "0.0.8"
3487
3487
  }
3488
3488
  },
3489
3489
  "isOptional": false,
@@ -3543,7 +3543,7 @@
3543
3543
  "componentId": {
3544
3544
  "scope": "teambit.legacy",
3545
3545
  "name": "consumer-component",
3546
- "version": "0.0.7"
3546
+ "version": "0.0.8"
3547
3547
  }
3548
3548
  },
3549
3549
  "isOptional": false,
@@ -4896,7 +4896,7 @@
4896
4896
  "componentId": {
4897
4897
  "scope": "teambit.dependencies",
4898
4898
  "name": "dependencies",
4899
- "version": "1.0.494"
4899
+ "version": "1.0.495"
4900
4900
  },
4901
4901
  "taggedModuleExports": []
4902
4902
  }
@@ -3,7 +3,7 @@ import { ComponentID, ComponentIdList } from '@teambit/component-id';
3
3
  import { cloneDeep, difference, forEach, isEmpty, pick, pickBy, uniq } from 'lodash';
4
4
  import { IssuesList, IssuesClasses, MissingPackagesData } from '@teambit/component-issues';
5
5
  import { DEPENDENCIES_FIELDS, MANUALLY_REMOVE_DEPENDENCY } from '@teambit/legacy.constants';
6
- import { ConsumerComponent as Component, Dependency } from '@teambit/legacy.consumer-component';
6
+ import { ConsumerComponent as Component, Dependency, Dependencies } from '@teambit/legacy.consumer-component';
7
7
  import { PackageJsonFile } from '@teambit/component.sources';
8
8
  import { PathLinux, resolvePackagePath } from '@teambit/legacy.utils';
9
9
  import { ResolvedPackageData, resolvePackageData } from '../resolve-pkg-data';
@@ -11,10 +11,11 @@ import { Workspace } from '@teambit/workspace';
11
11
  import { DependencyResolverMain } from '@teambit/dependency-resolver';
12
12
  import { Consumer } from '@teambit/legacy.consumer';
13
13
  import { ComponentMap } from '@teambit/legacy.bit-map';
14
+ import { Logger } from '@teambit/logger';
15
+ import { ComponentOverrides } from '@teambit/legacy.consumer-config';
14
16
  import OverridesDependencies from './overrides-dependencies';
15
17
  import { DependenciesData } from './dependencies-data';
16
18
  import { DebugDependencies, FileType } from './auto-detect-deps';
17
- import { Logger } from '@teambit/logger';
18
19
 
19
20
  export type AllDependencies = {
20
21
  dependencies: Dependency[];
@@ -76,6 +77,26 @@ export class ApplyOverrides {
76
77
  this.debugDependenciesData = { components: [] };
77
78
  }
78
79
 
80
+ private async setOverridesDependencies() {
81
+ const overrides = await this.getOverridesData();
82
+ this.component.overrides = overrides;
83
+ }
84
+
85
+ private getEnvExtendsDeps() {
86
+ const wsDeps = this.allDependencies.dependencies || [];
87
+ const modelDeps = this.component.componentFromModel?.dependencies.dependencies || [];
88
+ const merged = Dependencies.merge([wsDeps, modelDeps]);
89
+ return merged.get();
90
+ }
91
+
92
+ private async getOverridesData() {
93
+ if (this.component.overrides) return this.component.overrides;
94
+
95
+ const overrides = await ComponentOverrides.loadFromConsumer(this.component, this.getEnvExtendsDeps());
96
+
97
+ return overrides;
98
+ }
99
+
79
100
  get consumer(): Consumer | undefined {
80
101
  return this.workspace?.consumer;
81
102
  }
@@ -85,6 +106,7 @@ export class ApplyOverrides {
85
106
  overridesDependencies: OverridesDependencies;
86
107
  autoDetectOverrides?: Record<string, any>;
87
108
  }> {
109
+ await this.setOverridesDependencies();
88
110
  await this.populateDependencies();
89
111
  const dependenciesData = new DependenciesData(
90
112
  this.allDependencies,
@@ -187,7 +209,8 @@ export class ApplyOverrides {
187
209
  this.autoDetectOverrides = await this.workspace?.getAutoDetectOverrides(
188
210
  this.component.extensions,
189
211
  this.component.id,
190
- this.component.files
212
+ this.component.files,
213
+ this.getEnvExtendsDeps()
191
214
  );
192
215
  }
193
216
 
@@ -581,7 +604,11 @@ export class ApplyOverrides {
581
604
  }
582
605
 
583
606
  private async applyAutoDetectedPeersFromEnvOnEnvItSelf(): Promise<void> {
584
- const envPolicy = await this.depsResolver.getEnvPolicyFromEnvId(this.component.id, this.component.files);
607
+ const envPolicy = await this.depsResolver.getEnvPolicyFromEnvId(
608
+ this.component.id,
609
+ this.component.files,
610
+ this.getEnvExtendsDeps()
611
+ );
585
612
  if (!envPolicy) return;
586
613
  const envPolicyManifest = envPolicy.selfPolicy.toVersionManifest();
587
614
 
@@ -153,7 +153,13 @@ export class AutoDetectDeps {
153
153
  // we have the files dependencies, these files should be components that are registered in bit.map. Otherwise,
154
154
  // they are referred as "untracked components" and the user should add them later on in order to tag
155
155
  this.setTree(dependenciesTree.tree);
156
- const devFiles = await this.devFiles.getDevFilesForConsumerComp(this.component);
156
+ if (dependenciesTree.tree['env.jsonc']?.components.length > 0) {
157
+ await this.populateDependencies(['env.jsonc'], []);
158
+ }
159
+ const envExtendsDeps = this.allDependencies.dependencies.length
160
+ ? this.allDependencies.dependencies
161
+ : this.component.componentFromModel?.dependencies.dependencies;
162
+ const devFiles = await this.devFiles.getDevFilesForConsumerComp(this.component, envExtendsDeps);
157
163
  await this.populateDependencies(allFiles, devFiles);
158
164
  return {
159
165
  dependenciesData: new DependenciesData(
@@ -390,6 +396,9 @@ export class AutoDetectDeps {
390
396
  componentIdResolvedFrom: 'DependencyPkgJson',
391
397
  packageName: compDep.name,
392
398
  };
399
+ if (originFile === 'env.jsonc') {
400
+ depDebug.importSource = 'env.jsonc';
401
+ }
393
402
  const getVersionFromPkgJson = (): string | null => {
394
403
  const versionFromDependencyPkgJson = getValidVersion(compDep.concreteVersion);
395
404
  if (versionFromDependencyPkgJson) {
@@ -4,10 +4,10 @@ import { ConsumerComponent as Component, Dependency } from '@teambit/legacy.cons
4
4
  import { Workspace } from '@teambit/workspace';
5
5
  import { DependencyResolverMain } from '@teambit/dependency-resolver';
6
6
  import { Consumer } from '@teambit/legacy.consumer';
7
+ import { Logger } from '@teambit/logger';
7
8
  import OverridesDependencies from './overrides-dependencies';
8
9
  import { DependenciesData } from './dependencies-data';
9
10
  import { DebugDependencies } from './auto-detect-deps';
10
- import { Logger } from '@teambit/logger';
11
11
  export type AllDependencies = {
12
12
  dependencies: Dependency[];
13
13
  devDependencies: Dependency[];
@@ -39,6 +39,9 @@ export declare class ApplyOverrides {
39
39
  debugDependenciesData: DebugDependencies;
40
40
  autoDetectOverrides: Record<string, any> | undefined;
41
41
  constructor(component: Component, depsResolver: DependencyResolverMain, logger: Logger, workspace?: Workspace | undefined);
42
+ private setOverridesDependencies;
43
+ private getEnvExtendsDeps;
44
+ private getOverridesData;
42
45
  get consumer(): Consumer | undefined;
43
46
  getDependenciesData(): Promise<{
44
47
  dependenciesData: DependenciesData;
@@ -67,6 +67,13 @@ function _resolvePkgData() {
67
67
  };
68
68
  return data;
69
69
  }
70
+ function _legacy4() {
71
+ const data = require("@teambit/legacy.consumer-config");
72
+ _legacy4 = function () {
73
+ return data;
74
+ };
75
+ return data;
76
+ }
70
77
  function _overridesDependencies() {
71
78
  const data = _interopRequireDefault(require("./overrides-dependencies"));
72
79
  _overridesDependencies = function () {
@@ -132,10 +139,26 @@ class ApplyOverrides {
132
139
  components: []
133
140
  };
134
141
  }
142
+ async setOverridesDependencies() {
143
+ const overrides = await this.getOverridesData();
144
+ this.component.overrides = overrides;
145
+ }
146
+ getEnvExtendsDeps() {
147
+ const wsDeps = this.allDependencies.dependencies || [];
148
+ const modelDeps = this.component.componentFromModel?.dependencies.dependencies || [];
149
+ const merged = _legacy2().Dependencies.merge([wsDeps, modelDeps]);
150
+ return merged.get();
151
+ }
152
+ async getOverridesData() {
153
+ if (this.component.overrides) return this.component.overrides;
154
+ const overrides = await _legacy4().ComponentOverrides.loadFromConsumer(this.component, this.getEnvExtendsDeps());
155
+ return overrides;
156
+ }
135
157
  get consumer() {
136
158
  return this.workspace?.consumer;
137
159
  }
138
160
  async getDependenciesData() {
161
+ await this.setOverridesDependencies();
139
162
  await this.populateDependencies();
140
163
  const dependenciesData = new (_dependenciesData().DependenciesData)(this.allDependencies, this.allPackagesDependencies, this.issues, this.coreAspects);
141
164
  return {
@@ -226,7 +249,7 @@ class ApplyOverrides {
226
249
  if (!missingIssue.data.length) this.issues.delete(_componentIssues().IssuesClasses.MissingPackagesDependenciesOnFs);
227
250
  }
228
251
  async loadAutoDetectOverrides() {
229
- this.autoDetectOverrides = await this.workspace?.getAutoDetectOverrides(this.component.extensions, this.component.id, this.component.files);
252
+ this.autoDetectOverrides = await this.workspace?.getAutoDetectOverrides(this.component.extensions, this.component.id, this.component.files, this.getEnvExtendsDeps());
230
253
  }
231
254
  cloneAllPackagesDependencies() {
232
255
  this.originAllPackagesDependencies = (0, _lodash().cloneDeep)(this.allPackagesDependencies);
@@ -562,7 +585,7 @@ class ApplyOverrides {
562
585
  });
563
586
  }
564
587
  async applyAutoDetectedPeersFromEnvOnEnvItSelf() {
565
- const envPolicy = await this.depsResolver.getEnvPolicyFromEnvId(this.component.id, this.component.files);
588
+ const envPolicy = await this.depsResolver.getEnvPolicyFromEnvId(this.component.id, this.component.files, this.getEnvExtendsDeps());
566
589
  if (!envPolicy) return;
567
590
  const envPolicyManifest = envPolicy.selfPolicy.toVersionManifest();
568
591
  if (!envPolicyManifest || !Object.keys(envPolicyManifest).length) {
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","_interopRequireDefault","require","_componentId","_lodash","_componentIssues","_legacy","_legacy2","_component","_legacy3","_resolvePkgData","_overridesDependencies","_dependenciesData","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DepsKeysToAllPackagesDepsKeys","dependencies","devDependencies","peerDependencies","ApplyOverrides","constructor","component","depsResolver","logger","workspace","componentId","componentFromModel","allDependencies","allPackagesDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","processedFiles","issues","setLegacyInsideHarmonyIssue","overridesDependencies","OverridesDependencies","debugDependenciesData","components","consumer","getDependenciesData","populateDependencies","dependenciesData","DependenciesData","coreAspects","autoDetectOverrides","loadAutoDetectOverrides","removeIgnoredComponentsByOverrides","cloneAllPackagesDependencies","removeIgnoredPackagesByOverrides","removeDevAndEnvDepsIfTheyAlsoRegulars","applyPeersFromComponentModel","applyPackageJson","applyWorkspacePolicy","makeLegacyAsPeer","applyAutoDetectOverridesOnComponent","applyAutoDetectedPeersFromEnvOnEnvItSelf","manuallyAddDependencies","removeCompDepsFromPackages","uniq","shouldBeIncluded","dep","fileType","shouldIgnorePackage","packageName","filter","isTestFile","missingIssue","getIssueByName","missingData","forEach","m","missingPackages","pkg","isDevFile","length","delete","IssuesClasses","MissingPackagesDependenciesOnFs","getAutoDetectOverrides","extensions","id","files","originAllPackagesDependencies","cloneDeep","pkgVersion","pkgName","shouldIgnorePackageByType","shouldBeIncludedDev","pickBy","_resolvePackageData","undefined","componentMap","rootDir","consumerPath","getPath","basePath","path","join","modulePath","resolvePackagePath","packageObject","resolvePackageData","_getComponentIdToAdd","dependency","versionRange","packageData","name","getDependenciesToAddManually","packageJson","existingDependencies","overrides","packages","DEPENDENCIES_FIELDS","depField","keys","dependencyValue","componentData","isEqualWithoutVersion","warn","toString","dependencyExist","find","d","_addManuallyAddedDep","push","addedPkg","_manuallyAddPackage","assign","missingPackageDependencies","_getPackageJson","depData","Dependency","isEmpty","_pkgFieldMapping","peerName","componentPeers","Set","map","has","currPackagesKeys","reduce","acc","field","includes","getNotRegularPackages","difference","pick","componentDepsIds","ComponentIdList","c","getPeerDependencies","_getPackageJsonFromComponentModel","projectPeerDependencies","peerPackages","shouldIgnorePeerPackage","pkgJsonPeer","pkgJsonRegularDeps","peerDeps","_pkgVal","peerVersionFromPkgJson","regularVersionFromPkgJson","wsPolicy","getWorkspacePolicyManifest","wsPeer","wsRegular","peerPackageDeps","peerVersionFromWsPolicy","regularVersionFromWsPolicy","version","isNaN","originallyExists","flat","pkgVal","existsInCompsDeps","existsInCompsDevDeps","existsInCompsPeerDeps","key","MANUALLY_REMOVE_DEPENDENCY","comp","envPolicy","getEnvPolicyFromEnvId","envPolicyManifest","selfPolicy","toVersionManifest","deps","peerVersionFromEnvPolicy","packageJsonObject","PackageJsonFile","createFromComponent","isLegacy","getOrCreate","LegacyInsideHarmony","Error","exports"],"sources":["apply-overrides.ts"],"sourcesContent":["import path from 'path';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { cloneDeep, difference, forEach, isEmpty, pick, pickBy, uniq } from 'lodash';\nimport { IssuesList, IssuesClasses, MissingPackagesData } from '@teambit/component-issues';\nimport { DEPENDENCIES_FIELDS, MANUALLY_REMOVE_DEPENDENCY } from '@teambit/legacy.constants';\nimport { ConsumerComponent as Component, Dependency } from '@teambit/legacy.consumer-component';\nimport { PackageJsonFile } from '@teambit/component.sources';\nimport { PathLinux, resolvePackagePath } from '@teambit/legacy.utils';\nimport { ResolvedPackageData, resolvePackageData } from '../resolve-pkg-data';\nimport { Workspace } from '@teambit/workspace';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\nimport OverridesDependencies from './overrides-dependencies';\nimport { DependenciesData } from './dependencies-data';\nimport { DebugDependencies, FileType } from './auto-detect-deps';\nimport { Logger } from '@teambit/logger';\n\nexport type AllDependencies = {\n dependencies: Dependency[];\n devDependencies: Dependency[];\n peerDependencies: Dependency[];\n};\n\nexport type AllPackagesDependencies = {\n packageDependencies: Record<string, string>;\n devPackageDependencies: Record<string, string>;\n peerPackageDependencies: Record<string, string>;\n};\n\nconst DepsKeysToAllPackagesDepsKeys = {\n dependencies: 'packageDependencies',\n devDependencies: 'devPackageDependencies',\n peerDependencies: 'peerPackageDependencies',\n};\n\nexport class ApplyOverrides {\n componentId: ComponentID;\n componentFromModel: Component;\n allDependencies: AllDependencies;\n allPackagesDependencies: AllPackagesDependencies;\n /**\n * This will store a copy of the package deps before removal\n * in order to apply auto detected rules that are running after the removal\n */\n originAllPackagesDependencies: AllPackagesDependencies;\n issues: IssuesList;\n coreAspects: string[] = [];\n processedFiles: string[];\n overridesDependencies: OverridesDependencies;\n debugDependenciesData: DebugDependencies;\n autoDetectOverrides: Record<string, any> | undefined;\n constructor(\n private component: Component,\n private depsResolver: DependencyResolverMain,\n private logger: Logger,\n private workspace?: Workspace\n ) {\n this.componentId = component.componentId;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.componentFromModel = this.component.componentFromModel;\n this.allDependencies = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n this.allPackagesDependencies = {\n packageDependencies: {},\n devPackageDependencies: {},\n peerPackageDependencies: {},\n };\n this.processedFiles = [];\n this.issues = component.issues;\n this.setLegacyInsideHarmonyIssue();\n this.overridesDependencies = new OverridesDependencies(component);\n this.debugDependenciesData = { components: [] };\n }\n\n get consumer(): Consumer | undefined {\n return this.workspace?.consumer;\n }\n\n async getDependenciesData(): Promise<{\n dependenciesData: DependenciesData;\n overridesDependencies: OverridesDependencies;\n autoDetectOverrides?: Record<string, any>;\n }> {\n await this.populateDependencies();\n const dependenciesData = new DependenciesData(\n this.allDependencies,\n this.allPackagesDependencies,\n this.issues,\n this.coreAspects\n );\n return {\n dependenciesData,\n overridesDependencies: this.overridesDependencies,\n autoDetectOverrides: this.autoDetectOverrides,\n };\n }\n\n /**\n * Given the tree of file dependencies from the driver, find the components of these files.\n * Each dependency file has a path, use bit.map to search for the component name by that path.\n * If the component is found, add it to \"this.allDependencies.dependencies\". Otherwise, add it to \"this.issues.untrackedDependencies\".\n *\n * For the found components, add their sourceRelativePath and destinationRelativePath, they are being used for\n * generating links upon import:\n * sourceRelativePath - location of the link file.\n * destinationRelativePath - destination written inside the link file.\n *\n * When a dependency is found in a regular (implementation) file, it goes to `dependencies`. If\n * it found on a test file, it goes to `devDependencies`.\n * Similarly, when a package is found in a regular file, it goes to `packageDependencies`. When\n * if found in a test file, it goes to `devPackageDependencies`.\n * An exception for the above is when a package is required in a regular or test file but is also\n * mentioned in the `package.json` file as a peerDependency, in that case, the package is added\n * to `peerPackageDependencies` and removed from other places. Unless this package is overridden\n * and marked as ignored in the consumer or component config file.\n */\n private async populateDependencies() {\n await this.loadAutoDetectOverrides();\n this.removeIgnoredComponentsByOverrides();\n this.cloneAllPackagesDependencies();\n this.removeIgnoredPackagesByOverrides();\n this.removeDevAndEnvDepsIfTheyAlsoRegulars();\n this.applyPeersFromComponentModel();\n this.applyPackageJson();\n this.applyWorkspacePolicy();\n this.makeLegacyAsPeer();\n await this.applyAutoDetectOverridesOnComponent();\n // This was moved here (it used to be after this.manuallyAddDependencies) to fix an issue with a case where\n // an env define the same dependency defined by its own env, in both places:\n // its env.jsonc, and via bit deps set, with different versions.\n // before this fix the env.jsonc version was taken, and the deps set version was ignored for - bit show and\n // package.json\n // but it was taken into account for the actual dependency installation.\n // now we take the version from the deps set in both cases.\n // It make more sense to have it here before manually add dependencies, but the reason it wasn't like this is\n // because (pasting the original comment here):\n // ------ORIGINAL COMMENT------\n // Doing this here (after manuallyAddDependencies) because usually the env of the env is adding dependencies as peer of the env\n // which will make this not work if it come before\n // example:\n // custom react has peers with react 16.4.0.\n // the custom react uses the \"teambit.envs/env\" env, which will add react ^17.0.0 to every component that uses it\n // we want to make sure that the custom react is using 16.4.0 not 17.\n // ------END OF ORIGINAL COMMENT------\n // Since we did a massive refactor to the way we handle dependencies, we can now move it here now, as the original\n // issue doesn't seems like an issue any more.\n await this.applyAutoDetectedPeersFromEnvOnEnvItSelf();\n this.manuallyAddDependencies();\n // Ensuring component dependencies are not part of the package dependencies to prevent duplications\n this.removeCompDepsFromPackages();\n // Doing this here (after manuallyAddDependencies) because usually the env of the env is adding dependencies as peer of the env\n // which will make this not work if it come before\n // example:\n // custom react has peers with react 16.4.0.\n // the custom react uses the \"teambit.envs/env\" env, which will add react ^17.0.0 to every component that uses it\n // we want to make sure that the custom react is using 16.4.0 not 17.\n this.coreAspects = uniq(this.coreAspects);\n }\n\n private removeIgnoredComponentsByOverrides() {\n const shouldBeIncluded = (dep: Dependency, fileType: FileType) =>\n !this.overridesDependencies.shouldIgnorePackage(dep.packageName as string, fileType);\n this.allDependencies.dependencies = this.allDependencies.dependencies.filter((dep) =>\n shouldBeIncluded(dep, { isTestFile: false })\n );\n this.allDependencies.devDependencies = this.allDependencies.devDependencies.filter((dep) =>\n shouldBeIncluded(dep, { isTestFile: true })\n );\n\n const missingIssue = this.issues.getIssueByName('MissingPackagesDependenciesOnFs');\n if (!missingIssue) return;\n const missingData = missingIssue.data as MissingPackagesData[];\n missingData.forEach((m) => {\n m.missingPackages = m.missingPackages.filter(\n (pkg) => !this.overridesDependencies.shouldIgnorePackage(pkg, { isTestFile: m.isDevFile })\n );\n });\n missingIssue.data = missingData.filter((m) => m.missingPackages.length);\n if (!missingIssue.data.length) this.issues.delete(IssuesClasses.MissingPackagesDependenciesOnFs);\n }\n\n private async loadAutoDetectOverrides() {\n this.autoDetectOverrides = await this.workspace?.getAutoDetectOverrides(\n this.component.extensions,\n this.component.id,\n this.component.files\n );\n }\n\n private cloneAllPackagesDependencies() {\n this.originAllPackagesDependencies = cloneDeep(this.allPackagesDependencies);\n }\n\n private removeIgnoredPackagesByOverrides() {\n const shouldBeIncluded = (pkgVersion, pkgName) =>\n !this.overridesDependencies.shouldIgnorePackageByType(pkgName, 'dependencies');\n const shouldBeIncludedDev = (pkgVersion, pkgName) =>\n !this.overridesDependencies.shouldIgnorePackageByType(pkgName, 'devDependencies');\n\n this.allPackagesDependencies.packageDependencies = pickBy(\n this.allPackagesDependencies.packageDependencies,\n shouldBeIncluded\n );\n this.allPackagesDependencies.devPackageDependencies = pickBy(\n this.allPackagesDependencies.devPackageDependencies,\n shouldBeIncludedDev\n );\n }\n\n // TODO: maybe cache those results??\n private _resolvePackageData(packageName: string): ResolvedPackageData | undefined {\n const consumer = this.consumer;\n if (!consumer) return undefined;\n // if consumer is defined, then it has componentMap prop.\n const componentMap = this.component.componentMap as ComponentMap;\n const rootDir: PathLinux | null | undefined = componentMap.rootDir as string;\n const consumerPath = consumer.getPath();\n const basePath = rootDir ? path.join(consumerPath, rootDir) : consumerPath;\n const modulePath = resolvePackagePath(packageName, basePath, consumerPath);\n if (!modulePath) return undefined; // e.g. it's author and wasn't exported yet, so there's no node_modules of that component\n const packageObject = resolvePackageData(basePath, modulePath);\n return packageObject;\n }\n\n private _getComponentIdToAdd(\n dependency: string,\n versionRange: string\n ): { componentId?: ComponentID; packageName?: string; versionRange: string } {\n const packageData = this._resolvePackageData(dependency);\n return { componentId: packageData?.componentId, packageName: packageData?.name, versionRange };\n }\n\n getDependenciesToAddManually(\n packageJson: Record<string, any> | null | undefined,\n existingDependencies: AllDependencies\n ): { components: Record<string, any>; packages: Record<string, any> } | undefined {\n const overrides = this.overridesDependencies.getDependenciesToAddManually();\n if (!overrides) return undefined;\n const components = {};\n const packages = {};\n DEPENDENCIES_FIELDS.forEach((depField) => {\n if (!overrides[depField]) return;\n Object.keys(overrides[depField]).forEach((dependency) => {\n const dependencyValue = overrides[depField][dependency];\n const componentData = this._getComponentIdToAdd(dependency, dependencyValue);\n if (componentData?.componentId) {\n if (componentData.componentId.isEqualWithoutVersion(this.componentId)) {\n this.logger.warn(\n `component ${this.componentId.toString()} depends on itself ${componentData.componentId.toString()}. ignoring it.`\n );\n return;\n }\n const dependencyExist = existingDependencies[depField].find((d) =>\n d.id.isEqualWithoutVersion(componentData.componentId)\n );\n if (!dependencyExist) {\n this.overridesDependencies._addManuallyAddedDep(depField, componentData.componentId.toString());\n components[depField] ? components[depField].push(componentData) : (components[depField] = [componentData]);\n }\n return;\n }\n const addedPkg = this.overridesDependencies._manuallyAddPackage(\n depField,\n dependency,\n dependencyValue,\n packageJson\n );\n if (addedPkg) {\n packages[depField] = Object.assign(packages[depField] || {}, addedPkg);\n if (componentData && !componentData.packageName) {\n this.overridesDependencies.missingPackageDependencies.push(dependency);\n }\n }\n });\n });\n return { components, packages };\n }\n\n private manuallyAddDependencies() {\n const packageJson = this._getPackageJson();\n const dependencies = this.getDependenciesToAddManually(packageJson, this.allDependencies);\n if (!dependencies) return;\n const { components, packages } = dependencies;\n DEPENDENCIES_FIELDS.forEach((depField) => {\n if (components[depField] && components[depField].length) {\n components[depField].forEach((depData) => {\n this.allDependencies[depField].push(\n new Dependency(depData.componentId, [], depData.packageName, depData.versionRange)\n );\n });\n }\n if (packages[depField] && !isEmpty(packages[depField])) {\n Object.assign(this.allPackagesDependencies[this._pkgFieldMapping(depField)], packages[depField]);\n }\n });\n // The automatic dependency detector considers all found dependencies to be runtime dependencies.\n // But this breaks proper installation of injected subdependencies that are resolved from workspace components.\n if (this.allPackagesDependencies.packageDependencies && packages.peerDependencies) {\n for (const peerName of Object.keys(packages.peerDependencies)) {\n delete this.allPackagesDependencies.packageDependencies[peerName];\n }\n }\n if (this.allPackagesDependencies.packageDependencies && packages.peerPackageDependencies) {\n for (const peerName of Object.keys(packages.peerPackageDependencies)) {\n delete this.allPackagesDependencies.packageDependencies[peerName];\n }\n }\n if (components.peerDependencies) {\n const componentPeers = new Set(components.peerDependencies.map(({ packageName }) => packageName));\n this.allDependencies.dependencies = this.allDependencies.dependencies.filter(\n (dep) => !dep.packageName || !componentPeers.has(dep.packageName)\n );\n }\n }\n\n /**\n * The function `removeCompDepsFromPackages` removes component dependencies from different package dependency fields\n * based on certain conditions.\n */\n private removeCompDepsFromPackages() {\n const currPackagesKeys = ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].reduce(\n (acc, field) => {\n acc[field] = Object.keys(this.allPackagesDependencies[field]);\n return acc;\n },\n {}\n );\n\n DEPENDENCIES_FIELDS.forEach((depField) => {\n if (this.allDependencies[depField].length) {\n this.allDependencies[depField].forEach((dep) => {\n ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].forEach((field) => {\n const keys = currPackagesKeys[field];\n if (keys.includes(dep.packageName)) {\n delete this.allPackagesDependencies[field][dep.packageName];\n }\n });\n });\n }\n });\n }\n\n /**\n * Remove the dependencies which appear both in dev and regular deps from the dev\n * Because if a dependency is both dev dependency and regular dependency it should be treated as regular one\n * Apply for both packages and components dependencies\n */\n private removeDevAndEnvDepsIfTheyAlsoRegulars() {\n // remove dev and env packages that are also regular packages\n const getNotRegularPackages = (packages) =>\n difference(Object.keys(packages), Object.keys(this.allPackagesDependencies.packageDependencies));\n this.allPackagesDependencies.devPackageDependencies = pick(\n this.allPackagesDependencies.devPackageDependencies,\n getNotRegularPackages(this.allPackagesDependencies.devPackageDependencies)\n );\n // remove dev dependencies that are also regular dependencies\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const componentDepsIds = new ComponentIdList(...this.allDependencies.dependencies.map((c) => c.id));\n this.allDependencies.devDependencies = this.allDependencies.devDependencies.filter(\n (d) => !componentDepsIds.has(d.id)\n );\n }\n\n private applyPeersFromComponentModel(): void {\n const getPeerDependencies = (): Record<string, any> => {\n const packageJson = this._getPackageJsonFromComponentModel();\n if (packageJson && packageJson.peerDependencies) return packageJson.peerDependencies;\n return {};\n };\n const projectPeerDependencies = getPeerDependencies();\n const peerPackages = {};\n if (isEmpty(projectPeerDependencies)) return;\n\n // check whether the peer-dependencies was actually require in the code. if so, remove it from\n // the packages/dev-packages and add it as a peer-package.\n // if it was not required in the code, don't add it to the peerPackages\n Object.keys(projectPeerDependencies).forEach((pkg) => {\n if (this.overridesDependencies.shouldIgnorePeerPackage(pkg)) return;\n ['packageDependencies', 'devPackageDependencies'].forEach((field) => {\n if (Object.keys(this.allPackagesDependencies[field]).includes(pkg)) {\n delete this.allPackagesDependencies[field][pkg];\n peerPackages[pkg] = projectPeerDependencies[pkg];\n }\n });\n });\n this.allPackagesDependencies.peerPackageDependencies = peerPackages;\n }\n\n private applyPackageJson(): void {\n const packageJson = this._getPackageJson();\n if (!packageJson) return;\n const pkgJsonPeer = packageJson.peerDependencies || {};\n const pkgJsonRegularDeps = packageJson.dependencies || {};\n const peerDeps = this.allPackagesDependencies.peerPackageDependencies || {};\n ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].forEach((field) => {\n forEach(this.allPackagesDependencies[field], (_pkgVal, pkgName) => {\n const peerVersionFromPkgJson = pkgJsonPeer[pkgName];\n const regularVersionFromPkgJson = pkgJsonRegularDeps[pkgName];\n if (peerVersionFromPkgJson) {\n delete this.allPackagesDependencies[field][pkgName];\n peerDeps[pkgName] = peerVersionFromPkgJson;\n } else if (regularVersionFromPkgJson) {\n delete this.allPackagesDependencies.peerPackageDependencies?.[pkgName];\n this.allPackagesDependencies[field][pkgName] = regularVersionFromPkgJson;\n }\n });\n });\n this.allPackagesDependencies.peerPackageDependencies = peerDeps;\n }\n\n private applyWorkspacePolicy(): void {\n const wsPolicy = this.depsResolver.getWorkspacePolicyManifest();\n if (!wsPolicy) return;\n const wsPeer = wsPolicy.peerDependencies || {};\n const wsRegular = wsPolicy.dependencies || {};\n const peerPackageDeps = this.allPackagesDependencies.peerPackageDependencies || {};\n // we are not iterate component deps since they are resolved from what actually installed\n // the policy used for installation only in that case\n ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].forEach((field) => {\n forEach(this.allPackagesDependencies[field], (_pkgVal, pkgName) => {\n const peerVersionFromWsPolicy = wsPeer[pkgName];\n const regularVersionFromWsPolicy = wsRegular[pkgName];\n if (peerVersionFromWsPolicy) {\n delete this.allPackagesDependencies[field][pkgName];\n peerPackageDeps[pkgName] = peerVersionFromWsPolicy;\n } else if (regularVersionFromWsPolicy) {\n delete this.allPackagesDependencies.peerPackageDependencies?.[pkgName];\n this.allPackagesDependencies[field][pkgName] = regularVersionFromWsPolicy;\n }\n });\n });\n this.allPackagesDependencies.peerPackageDependencies = peerPackageDeps;\n\n const peerDeps = this.allDependencies.peerDependencies ?? [];\n ['dependencies', 'devDependencies'].forEach((field) => {\n for (const dep of this.allDependencies[field]) {\n const pkgName = dep.packageName;\n const peerVersionFromWsPolicy = wsPeer[pkgName];\n const regularVersionFromWsPolicy = wsRegular[pkgName];\n if (peerVersionFromWsPolicy) {\n dep.versionRange = peerVersionFromWsPolicy;\n peerDeps.push(dep);\n } else if (regularVersionFromWsPolicy) {\n dep.versionRange = regularVersionFromWsPolicy;\n }\n }\n this.allDependencies[field] = this.allDependencies[field].filter(({ packageName }) => !wsPeer[packageName]);\n });\n this.allDependencies.peerDependencies = peerDeps;\n }\n\n /**\n * It removes the @teambit/legacy dependency from the dependencies/devDeps and adds it as a peer dependency with ^.\n */\n private makeLegacyAsPeer(): void {\n let version;\n if (this.allPackagesDependencies.packageDependencies['@teambit/legacy']) {\n version = this.allPackagesDependencies.packageDependencies['@teambit/legacy'];\n delete this.allPackagesDependencies.packageDependencies['@teambit/legacy'];\n }\n if (this.allPackagesDependencies.devPackageDependencies['@teambit/legacy']) {\n if (!version) version = this.allPackagesDependencies.devPackageDependencies['@teambit/legacy'];\n delete this.allPackagesDependencies.devPackageDependencies['@teambit/legacy'];\n }\n if (version) {\n if (!Number.isNaN(version[0])) version = `^${version}`;\n this.allPackagesDependencies.peerPackageDependencies['@teambit/legacy'] = version;\n }\n }\n\n private async applyAutoDetectOverridesOnComponent(): Promise<void> {\n const autoDetectOverrides = this.autoDetectOverrides;\n\n if (!autoDetectOverrides || !Object.keys(autoDetectOverrides).length) {\n return;\n }\n\n const originallyExists: string[] = [];\n let missingPackages: string[] = [];\n // We want to also add missing packages to the peer list as we know to resolve the version from the env anyway\n const missingData = this.issues.getIssueByName('MissingPackagesDependenciesOnFs')?.data as\n | MissingPackagesData[]\n | undefined;\n if (missingData) {\n missingPackages = uniq(missingData.map((d) => d.missingPackages).flat());\n }\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((field) => {\n forEach(autoDetectOverrides[field], (pkgVal, pkgName) => {\n if (this.overridesDependencies.shouldIgnorePeerPackage(pkgName)) return;\n // Validate it was auto detected, we only affect stuff that were detected\n const existsInCompsDeps = this.allDependencies.dependencies.find((dep) => {\n return dep.packageName === pkgName;\n });\n\n const existsInCompsDevDeps = this.allDependencies.devDependencies.find((dep) => {\n return dep.packageName === pkgName;\n });\n\n const existsInCompsPeerDeps = this.allDependencies.peerDependencies.find((dep) => {\n return dep.packageName === pkgName;\n });\n\n if (\n // We are checking originAllPackagesDependencies instead of allPackagesDependencies\n // as it might be already removed from allPackagesDependencies at this point if it was set with\n // \"-\" in runtime/dev\n // in such case we still want to apply it here\n !this.originAllPackagesDependencies.packageDependencies[pkgName] &&\n !this.originAllPackagesDependencies.devPackageDependencies[pkgName] &&\n !this.originAllPackagesDependencies.peerPackageDependencies[pkgName] &&\n !existsInCompsDeps &&\n !existsInCompsDevDeps &&\n !existsInCompsPeerDeps &&\n // Check if it was orignally exists in the component\n // as we might have a policy which looks like this:\n // \"components\": {\n // \"dependencies\": {\n // \"my-dep\": \"-\"\n // },\n // \"devDependencies\": {\n // \"my-dep\": \"1.0.0\"\n // },\n // }\n // in that case we might remove it before getting to the devDeps then we will think that it wasn't required in the component\n // which is incorrect\n !originallyExists.includes(pkgName) &&\n !missingPackages.includes(pkgName)\n ) {\n return;\n }\n originallyExists.push(pkgName);\n const key = DepsKeysToAllPackagesDepsKeys[field];\n\n delete this.allPackagesDependencies[key][pkgName];\n // When changing peer dependency we want it to be stronger than the other types\n if (field === 'peerDependencies') {\n delete this.allPackagesDependencies.devPackageDependencies[pkgName];\n delete this.allPackagesDependencies.packageDependencies[pkgName];\n if (existsInCompsDeps) {\n this.allDependencies.dependencies = this.allDependencies.dependencies.filter(\n (dep) => dep.packageName !== pkgName\n );\n }\n if (existsInCompsDevDeps) {\n this.allDependencies.devDependencies = this.allDependencies.devDependencies.filter(\n (dep) => dep.packageName !== pkgName\n );\n }\n }\n // delete this.allPackagesDependencies.packageDependencies[pkgName];\n // delete this.allPackagesDependencies.devPackageDependencies[pkgName];\n // delete this.allPackagesDependencies.peerPackageDependencies[pkgName];\n\n // If it exists in comps deps / comp dev deps, we don't want to add it to the allPackagesDependencies\n // as it will make the same dep both a dev and runtime dep\n // since we are here only for auto detected deps, it means we already resolved the version correctly\n // so we don't need to really modify the version\n // also the version here might have a range (^ or ~ for example) so we can't\n // just put it as is, as it is not valid for component deps to have range\n if (\n pkgVal !== MANUALLY_REMOVE_DEPENDENCY &&\n ((!existsInCompsDeps && !existsInCompsDevDeps) || field === 'peerDependencies')\n ) {\n if ((existsInCompsDeps || existsInCompsDevDeps) && field === 'peerDependencies') {\n const comp = (existsInCompsDeps ?? existsInCompsDevDeps) as Dependency;\n comp.versionRange = pkgVal;\n this.allDependencies.peerDependencies.push(comp);\n } else {\n this.allPackagesDependencies[key][pkgName] = pkgVal;\n }\n if (existsInCompsPeerDeps) {\n existsInCompsPeerDeps.versionRange = pkgVal;\n }\n }\n });\n });\n }\n\n private async applyAutoDetectedPeersFromEnvOnEnvItSelf(): Promise<void> {\n const envPolicy = await this.depsResolver.getEnvPolicyFromEnvId(this.component.id, this.component.files);\n if (!envPolicy) return;\n const envPolicyManifest = envPolicy.selfPolicy.toVersionManifest();\n\n if (!envPolicyManifest || !Object.keys(envPolicyManifest).length) {\n return;\n }\n const deps = this.allPackagesDependencies.packageDependencies || {};\n // we are not iterate component deps since they are resolved from what actually installed\n // the policy used for installation only in that case\n ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].forEach((field) => {\n forEach(this.allPackagesDependencies[field], (_pkgVal, pkgName) => {\n const peerVersionFromEnvPolicy = envPolicyManifest[pkgName];\n if (peerVersionFromEnvPolicy) {\n delete this.allPackagesDependencies[field][pkgName];\n }\n });\n });\n Object.assign(deps, envPolicyManifest);\n // TODO: handle component deps once we support peers between components\n this.allPackagesDependencies.packageDependencies = deps;\n }\n\n /**\n * returns `package.json` of the component when it's imported, or `package.json` of the workspace\n * when it's authored.\n */\n private _getPackageJson(): Record<string, any> | undefined {\n return this.consumer?.packageJson.packageJsonObject;\n }\n\n private _getPackageJsonFromComponentModel(): Record<string, any> | undefined {\n if (this.componentFromModel && this.component.componentMap) {\n // a component is imported but the package.json file is missing or never written\n // read the values from the model\n const packageJson = PackageJsonFile.createFromComponent(\n this.component.componentMap.rootDir,\n this.componentFromModel\n );\n return packageJson.packageJsonObject;\n }\n return undefined;\n }\n\n private setLegacyInsideHarmonyIssue() {\n if (this.componentFromModel && this.componentFromModel.isLegacy) {\n this.issues.getOrCreate(IssuesClasses.LegacyInsideHarmony).data = true;\n }\n }\n\n private _pkgFieldMapping(field: string) {\n switch (field) {\n case 'dependencies':\n return 'packageDependencies';\n case 'devDependencies':\n return 'devPackageDependencies';\n case 'peerDependencies':\n return 'peerPackageDependencies';\n default:\n throw new Error(`${field} is not recognized`);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,s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;IACFrF,MAAM,CAAC+H,MAAM,CAACyD,IAAI,EAAEH,iBAAiB,CAAC;IACtC;IACA,IAAI,CAAC1J,uBAAuB,CAACC,mBAAmB,GAAG4J,IAAI;EACzD;;EAEA;AACF;AACA;AACA;EACUvD,eAAeA,CAAA,EAAoC;IACzD,OAAO,IAAI,CAAC3F,QAAQ,EAAEsE,WAAW,CAAC8E,iBAAiB;EACrD;EAEQnC,iCAAiCA,CAAA,EAAoC;IAC3E,IAAI,IAAI,CAAC9H,kBAAkB,IAAI,IAAI,CAACL,SAAS,CAACuE,YAAY,EAAE;MAC1D;MACA;MACA,MAAMiB,WAAW,GAAG+E,4BAAe,CAACC,mBAAmB,CACrD,IAAI,CAACxK,SAAS,CAACuE,YAAY,CAACC,OAAO,EACnC,IAAI,CAACnE,kBACP,CAAC;MACD,OAAOmF,WAAW,CAAC8E,iBAAiB;IACtC;IACA,OAAOhG,SAAS;EAClB;EAEQzD,2BAA2BA,CAAA,EAAG;IACpC,IAAI,IAAI,CAACR,kBAAkB,IAAI,IAAI,CAACA,kBAAkB,CAACoK,QAAQ,EAAE;MAC/D,IAAI,CAAC7J,MAAM,CAAC8J,WAAW,CAAClH,gCAAa,CAACmH,mBAAmB,CAAC,CAACnN,IAAI,GAAG,IAAI;IACxE;EACF;EAEQyJ,gBAAgBA,CAACS,KAAa,EAAE;IACtC,QAAQA,KAAK;MACX,KAAK,cAAc;QACjB,OAAO,qBAAqB;MAC9B,KAAK,iBAAiB;QACpB,OAAO,wBAAwB;MACjC,KAAK,kBAAkB;QACrB,OAAO,yBAAyB;MAClC;QACE,MAAM,IAAIkD,KAAK,CAAC,GAAGlD,KAAK,oBAAoB,CAAC;IACjD;EACF;AACF;AAACmD,OAAA,CAAA/K,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","_interopRequireDefault","require","_componentId","_lodash","_componentIssues","_legacy","_legacy2","_component","_legacy3","_resolvePkgData","_legacy4","_overridesDependencies","_dependenciesData","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DepsKeysToAllPackagesDepsKeys","dependencies","devDependencies","peerDependencies","ApplyOverrides","constructor","component","depsResolver","logger","workspace","componentId","componentFromModel","allDependencies","allPackagesDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","processedFiles","issues","setLegacyInsideHarmonyIssue","overridesDependencies","OverridesDependencies","debugDependenciesData","components","setOverridesDependencies","overrides","getOverridesData","getEnvExtendsDeps","wsDeps","modelDeps","merged","Dependencies","merge","get","ComponentOverrides","loadFromConsumer","consumer","getDependenciesData","populateDependencies","dependenciesData","DependenciesData","coreAspects","autoDetectOverrides","loadAutoDetectOverrides","removeIgnoredComponentsByOverrides","cloneAllPackagesDependencies","removeIgnoredPackagesByOverrides","removeDevAndEnvDepsIfTheyAlsoRegulars","applyPeersFromComponentModel","applyPackageJson","applyWorkspacePolicy","makeLegacyAsPeer","applyAutoDetectOverridesOnComponent","applyAutoDetectedPeersFromEnvOnEnvItSelf","manuallyAddDependencies","removeCompDepsFromPackages","uniq","shouldBeIncluded","dep","fileType","shouldIgnorePackage","packageName","filter","isTestFile","missingIssue","getIssueByName","missingData","forEach","m","missingPackages","pkg","isDevFile","length","delete","IssuesClasses","MissingPackagesDependenciesOnFs","getAutoDetectOverrides","extensions","id","files","originAllPackagesDependencies","cloneDeep","pkgVersion","pkgName","shouldIgnorePackageByType","shouldBeIncludedDev","pickBy","_resolvePackageData","undefined","componentMap","rootDir","consumerPath","getPath","basePath","path","join","modulePath","resolvePackagePath","packageObject","resolvePackageData","_getComponentIdToAdd","dependency","versionRange","packageData","name","getDependenciesToAddManually","packageJson","existingDependencies","packages","DEPENDENCIES_FIELDS","depField","keys","dependencyValue","componentData","isEqualWithoutVersion","warn","toString","dependencyExist","find","d","_addManuallyAddedDep","push","addedPkg","_manuallyAddPackage","assign","missingPackageDependencies","_getPackageJson","depData","Dependency","isEmpty","_pkgFieldMapping","peerName","componentPeers","Set","map","has","currPackagesKeys","reduce","acc","field","includes","getNotRegularPackages","difference","pick","componentDepsIds","ComponentIdList","c","getPeerDependencies","_getPackageJsonFromComponentModel","projectPeerDependencies","peerPackages","shouldIgnorePeerPackage","pkgJsonPeer","pkgJsonRegularDeps","peerDeps","_pkgVal","peerVersionFromPkgJson","regularVersionFromPkgJson","wsPolicy","getWorkspacePolicyManifest","wsPeer","wsRegular","peerPackageDeps","peerVersionFromWsPolicy","regularVersionFromWsPolicy","version","isNaN","originallyExists","flat","pkgVal","existsInCompsDeps","existsInCompsDevDeps","existsInCompsPeerDeps","key","MANUALLY_REMOVE_DEPENDENCY","comp","envPolicy","getEnvPolicyFromEnvId","envPolicyManifest","selfPolicy","toVersionManifest","deps","peerVersionFromEnvPolicy","packageJsonObject","PackageJsonFile","createFromComponent","isLegacy","getOrCreate","LegacyInsideHarmony","Error","exports"],"sources":["apply-overrides.ts"],"sourcesContent":["import path from 'path';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { cloneDeep, difference, forEach, isEmpty, pick, pickBy, uniq } from 'lodash';\nimport { IssuesList, IssuesClasses, MissingPackagesData } from '@teambit/component-issues';\nimport { DEPENDENCIES_FIELDS, MANUALLY_REMOVE_DEPENDENCY } from '@teambit/legacy.constants';\nimport { ConsumerComponent as Component, Dependency, Dependencies } from '@teambit/legacy.consumer-component';\nimport { PackageJsonFile } from '@teambit/component.sources';\nimport { PathLinux, resolvePackagePath } from '@teambit/legacy.utils';\nimport { ResolvedPackageData, resolvePackageData } from '../resolve-pkg-data';\nimport { Workspace } from '@teambit/workspace';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\nimport { Logger } from '@teambit/logger';\nimport { ComponentOverrides } from '@teambit/legacy.consumer-config';\nimport OverridesDependencies from './overrides-dependencies';\nimport { DependenciesData } from './dependencies-data';\nimport { DebugDependencies, FileType } from './auto-detect-deps';\n\nexport type AllDependencies = {\n dependencies: Dependency[];\n devDependencies: Dependency[];\n peerDependencies: Dependency[];\n};\n\nexport type AllPackagesDependencies = {\n packageDependencies: Record<string, string>;\n devPackageDependencies: Record<string, string>;\n peerPackageDependencies: Record<string, string>;\n};\n\nconst DepsKeysToAllPackagesDepsKeys = {\n dependencies: 'packageDependencies',\n devDependencies: 'devPackageDependencies',\n peerDependencies: 'peerPackageDependencies',\n};\n\nexport class ApplyOverrides {\n componentId: ComponentID;\n componentFromModel: Component;\n allDependencies: AllDependencies;\n allPackagesDependencies: AllPackagesDependencies;\n /**\n * This will store a copy of the package deps before removal\n * in order to apply auto detected rules that are running after the removal\n */\n originAllPackagesDependencies: AllPackagesDependencies;\n issues: IssuesList;\n coreAspects: string[] = [];\n processedFiles: string[];\n overridesDependencies: OverridesDependencies;\n debugDependenciesData: DebugDependencies;\n autoDetectOverrides: Record<string, any> | undefined;\n constructor(\n private component: Component,\n private depsResolver: DependencyResolverMain,\n private logger: Logger,\n private workspace?: Workspace\n ) {\n this.componentId = component.componentId;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.componentFromModel = this.component.componentFromModel;\n this.allDependencies = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n this.allPackagesDependencies = {\n packageDependencies: {},\n devPackageDependencies: {},\n peerPackageDependencies: {},\n };\n this.processedFiles = [];\n this.issues = component.issues;\n this.setLegacyInsideHarmonyIssue();\n this.overridesDependencies = new OverridesDependencies(component);\n this.debugDependenciesData = { components: [] };\n }\n\n private async setOverridesDependencies() {\n const overrides = await this.getOverridesData();\n this.component.overrides = overrides;\n }\n\n private getEnvExtendsDeps() {\n const wsDeps = this.allDependencies.dependencies || [];\n const modelDeps = this.component.componentFromModel?.dependencies.dependencies || [];\n const merged = Dependencies.merge([wsDeps, modelDeps]);\n return merged.get();\n }\n\n private async getOverridesData() {\n if (this.component.overrides) return this.component.overrides;\n\n const overrides = await ComponentOverrides.loadFromConsumer(this.component, this.getEnvExtendsDeps());\n\n return overrides;\n }\n\n get consumer(): Consumer | undefined {\n return this.workspace?.consumer;\n }\n\n async getDependenciesData(): Promise<{\n dependenciesData: DependenciesData;\n overridesDependencies: OverridesDependencies;\n autoDetectOverrides?: Record<string, any>;\n }> {\n await this.setOverridesDependencies();\n await this.populateDependencies();\n const dependenciesData = new DependenciesData(\n this.allDependencies,\n this.allPackagesDependencies,\n this.issues,\n this.coreAspects\n );\n return {\n dependenciesData,\n overridesDependencies: this.overridesDependencies,\n autoDetectOverrides: this.autoDetectOverrides,\n };\n }\n\n /**\n * Given the tree of file dependencies from the driver, find the components of these files.\n * Each dependency file has a path, use bit.map to search for the component name by that path.\n * If the component is found, add it to \"this.allDependencies.dependencies\". Otherwise, add it to \"this.issues.untrackedDependencies\".\n *\n * For the found components, add their sourceRelativePath and destinationRelativePath, they are being used for\n * generating links upon import:\n * sourceRelativePath - location of the link file.\n * destinationRelativePath - destination written inside the link file.\n *\n * When a dependency is found in a regular (implementation) file, it goes to `dependencies`. If\n * it found on a test file, it goes to `devDependencies`.\n * Similarly, when a package is found in a regular file, it goes to `packageDependencies`. When\n * if found in a test file, it goes to `devPackageDependencies`.\n * An exception for the above is when a package is required in a regular or test file but is also\n * mentioned in the `package.json` file as a peerDependency, in that case, the package is added\n * to `peerPackageDependencies` and removed from other places. Unless this package is overridden\n * and marked as ignored in the consumer or component config file.\n */\n private async populateDependencies() {\n await this.loadAutoDetectOverrides();\n this.removeIgnoredComponentsByOverrides();\n this.cloneAllPackagesDependencies();\n this.removeIgnoredPackagesByOverrides();\n this.removeDevAndEnvDepsIfTheyAlsoRegulars();\n this.applyPeersFromComponentModel();\n this.applyPackageJson();\n this.applyWorkspacePolicy();\n this.makeLegacyAsPeer();\n await this.applyAutoDetectOverridesOnComponent();\n // This was moved here (it used to be after this.manuallyAddDependencies) to fix an issue with a case where\n // an env define the same dependency defined by its own env, in both places:\n // its env.jsonc, and via bit deps set, with different versions.\n // before this fix the env.jsonc version was taken, and the deps set version was ignored for - bit show and\n // package.json\n // but it was taken into account for the actual dependency installation.\n // now we take the version from the deps set in both cases.\n // It make more sense to have it here before manually add dependencies, but the reason it wasn't like this is\n // because (pasting the original comment here):\n // ------ORIGINAL COMMENT------\n // Doing this here (after manuallyAddDependencies) because usually the env of the env is adding dependencies as peer of the env\n // which will make this not work if it come before\n // example:\n // custom react has peers with react 16.4.0.\n // the custom react uses the \"teambit.envs/env\" env, which will add react ^17.0.0 to every component that uses it\n // we want to make sure that the custom react is using 16.4.0 not 17.\n // ------END OF ORIGINAL COMMENT------\n // Since we did a massive refactor to the way we handle dependencies, we can now move it here now, as the original\n // issue doesn't seems like an issue any more.\n await this.applyAutoDetectedPeersFromEnvOnEnvItSelf();\n this.manuallyAddDependencies();\n // Ensuring component dependencies are not part of the package dependencies to prevent duplications\n this.removeCompDepsFromPackages();\n // Doing this here (after manuallyAddDependencies) because usually the env of the env is adding dependencies as peer of the env\n // which will make this not work if it come before\n // example:\n // custom react has peers with react 16.4.0.\n // the custom react uses the \"teambit.envs/env\" env, which will add react ^17.0.0 to every component that uses it\n // we want to make sure that the custom react is using 16.4.0 not 17.\n this.coreAspects = uniq(this.coreAspects);\n }\n\n private removeIgnoredComponentsByOverrides() {\n const shouldBeIncluded = (dep: Dependency, fileType: FileType) =>\n !this.overridesDependencies.shouldIgnorePackage(dep.packageName as string, fileType);\n this.allDependencies.dependencies = this.allDependencies.dependencies.filter((dep) =>\n shouldBeIncluded(dep, { isTestFile: false })\n );\n this.allDependencies.devDependencies = this.allDependencies.devDependencies.filter((dep) =>\n shouldBeIncluded(dep, { isTestFile: true })\n );\n\n const missingIssue = this.issues.getIssueByName('MissingPackagesDependenciesOnFs');\n if (!missingIssue) return;\n const missingData = missingIssue.data as MissingPackagesData[];\n missingData.forEach((m) => {\n m.missingPackages = m.missingPackages.filter(\n (pkg) => !this.overridesDependencies.shouldIgnorePackage(pkg, { isTestFile: m.isDevFile })\n );\n });\n missingIssue.data = missingData.filter((m) => m.missingPackages.length);\n if (!missingIssue.data.length) this.issues.delete(IssuesClasses.MissingPackagesDependenciesOnFs);\n }\n\n private async loadAutoDetectOverrides() {\n this.autoDetectOverrides = await this.workspace?.getAutoDetectOverrides(\n this.component.extensions,\n this.component.id,\n this.component.files,\n this.getEnvExtendsDeps()\n );\n }\n\n private cloneAllPackagesDependencies() {\n this.originAllPackagesDependencies = cloneDeep(this.allPackagesDependencies);\n }\n\n private removeIgnoredPackagesByOverrides() {\n const shouldBeIncluded = (pkgVersion, pkgName) =>\n !this.overridesDependencies.shouldIgnorePackageByType(pkgName, 'dependencies');\n const shouldBeIncludedDev = (pkgVersion, pkgName) =>\n !this.overridesDependencies.shouldIgnorePackageByType(pkgName, 'devDependencies');\n\n this.allPackagesDependencies.packageDependencies = pickBy(\n this.allPackagesDependencies.packageDependencies,\n shouldBeIncluded\n );\n this.allPackagesDependencies.devPackageDependencies = pickBy(\n this.allPackagesDependencies.devPackageDependencies,\n shouldBeIncludedDev\n );\n }\n\n // TODO: maybe cache those results??\n private _resolvePackageData(packageName: string): ResolvedPackageData | undefined {\n const consumer = this.consumer;\n if (!consumer) return undefined;\n // if consumer is defined, then it has componentMap prop.\n const componentMap = this.component.componentMap as ComponentMap;\n const rootDir: PathLinux | null | undefined = componentMap.rootDir as string;\n const consumerPath = consumer.getPath();\n const basePath = rootDir ? path.join(consumerPath, rootDir) : consumerPath;\n const modulePath = resolvePackagePath(packageName, basePath, consumerPath);\n if (!modulePath) return undefined; // e.g. it's author and wasn't exported yet, so there's no node_modules of that component\n const packageObject = resolvePackageData(basePath, modulePath);\n return packageObject;\n }\n\n private _getComponentIdToAdd(\n dependency: string,\n versionRange: string\n ): { componentId?: ComponentID; packageName?: string; versionRange: string } {\n const packageData = this._resolvePackageData(dependency);\n return { componentId: packageData?.componentId, packageName: packageData?.name, versionRange };\n }\n\n getDependenciesToAddManually(\n packageJson: Record<string, any> | null | undefined,\n existingDependencies: AllDependencies\n ): { components: Record<string, any>; packages: Record<string, any> } | undefined {\n const overrides = this.overridesDependencies.getDependenciesToAddManually();\n if (!overrides) return undefined;\n const components = {};\n const packages = {};\n DEPENDENCIES_FIELDS.forEach((depField) => {\n if (!overrides[depField]) return;\n Object.keys(overrides[depField]).forEach((dependency) => {\n const dependencyValue = overrides[depField][dependency];\n const componentData = this._getComponentIdToAdd(dependency, dependencyValue);\n if (componentData?.componentId) {\n if (componentData.componentId.isEqualWithoutVersion(this.componentId)) {\n this.logger.warn(\n `component ${this.componentId.toString()} depends on itself ${componentData.componentId.toString()}. ignoring it.`\n );\n return;\n }\n const dependencyExist = existingDependencies[depField].find((d) =>\n d.id.isEqualWithoutVersion(componentData.componentId)\n );\n if (!dependencyExist) {\n this.overridesDependencies._addManuallyAddedDep(depField, componentData.componentId.toString());\n components[depField] ? components[depField].push(componentData) : (components[depField] = [componentData]);\n }\n return;\n }\n const addedPkg = this.overridesDependencies._manuallyAddPackage(\n depField,\n dependency,\n dependencyValue,\n packageJson\n );\n if (addedPkg) {\n packages[depField] = Object.assign(packages[depField] || {}, addedPkg);\n if (componentData && !componentData.packageName) {\n this.overridesDependencies.missingPackageDependencies.push(dependency);\n }\n }\n });\n });\n return { components, packages };\n }\n\n private manuallyAddDependencies() {\n const packageJson = this._getPackageJson();\n const dependencies = this.getDependenciesToAddManually(packageJson, this.allDependencies);\n if (!dependencies) return;\n const { components, packages } = dependencies;\n DEPENDENCIES_FIELDS.forEach((depField) => {\n if (components[depField] && components[depField].length) {\n components[depField].forEach((depData) => {\n this.allDependencies[depField].push(\n new Dependency(depData.componentId, [], depData.packageName, depData.versionRange)\n );\n });\n }\n if (packages[depField] && !isEmpty(packages[depField])) {\n Object.assign(this.allPackagesDependencies[this._pkgFieldMapping(depField)], packages[depField]);\n }\n });\n // The automatic dependency detector considers all found dependencies to be runtime dependencies.\n // But this breaks proper installation of injected subdependencies that are resolved from workspace components.\n if (this.allPackagesDependencies.packageDependencies && packages.peerDependencies) {\n for (const peerName of Object.keys(packages.peerDependencies)) {\n delete this.allPackagesDependencies.packageDependencies[peerName];\n }\n }\n if (this.allPackagesDependencies.packageDependencies && packages.peerPackageDependencies) {\n for (const peerName of Object.keys(packages.peerPackageDependencies)) {\n delete this.allPackagesDependencies.packageDependencies[peerName];\n }\n }\n if (components.peerDependencies) {\n const componentPeers = new Set(components.peerDependencies.map(({ packageName }) => packageName));\n this.allDependencies.dependencies = this.allDependencies.dependencies.filter(\n (dep) => !dep.packageName || !componentPeers.has(dep.packageName)\n );\n }\n }\n\n /**\n * The function `removeCompDepsFromPackages` removes component dependencies from different package dependency fields\n * based on certain conditions.\n */\n private removeCompDepsFromPackages() {\n const currPackagesKeys = ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].reduce(\n (acc, field) => {\n acc[field] = Object.keys(this.allPackagesDependencies[field]);\n return acc;\n },\n {}\n );\n\n DEPENDENCIES_FIELDS.forEach((depField) => {\n if (this.allDependencies[depField].length) {\n this.allDependencies[depField].forEach((dep) => {\n ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].forEach((field) => {\n const keys = currPackagesKeys[field];\n if (keys.includes(dep.packageName)) {\n delete this.allPackagesDependencies[field][dep.packageName];\n }\n });\n });\n }\n });\n }\n\n /**\n * Remove the dependencies which appear both in dev and regular deps from the dev\n * Because if a dependency is both dev dependency and regular dependency it should be treated as regular one\n * Apply for both packages and components dependencies\n */\n private removeDevAndEnvDepsIfTheyAlsoRegulars() {\n // remove dev and env packages that are also regular packages\n const getNotRegularPackages = (packages) =>\n difference(Object.keys(packages), Object.keys(this.allPackagesDependencies.packageDependencies));\n this.allPackagesDependencies.devPackageDependencies = pick(\n this.allPackagesDependencies.devPackageDependencies,\n getNotRegularPackages(this.allPackagesDependencies.devPackageDependencies)\n );\n // remove dev dependencies that are also regular dependencies\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const componentDepsIds = new ComponentIdList(...this.allDependencies.dependencies.map((c) => c.id));\n this.allDependencies.devDependencies = this.allDependencies.devDependencies.filter(\n (d) => !componentDepsIds.has(d.id)\n );\n }\n\n private applyPeersFromComponentModel(): void {\n const getPeerDependencies = (): Record<string, any> => {\n const packageJson = this._getPackageJsonFromComponentModel();\n if (packageJson && packageJson.peerDependencies) return packageJson.peerDependencies;\n return {};\n };\n const projectPeerDependencies = getPeerDependencies();\n const peerPackages = {};\n if (isEmpty(projectPeerDependencies)) return;\n\n // check whether the peer-dependencies was actually require in the code. if so, remove it from\n // the packages/dev-packages and add it as a peer-package.\n // if it was not required in the code, don't add it to the peerPackages\n Object.keys(projectPeerDependencies).forEach((pkg) => {\n if (this.overridesDependencies.shouldIgnorePeerPackage(pkg)) return;\n ['packageDependencies', 'devPackageDependencies'].forEach((field) => {\n if (Object.keys(this.allPackagesDependencies[field]).includes(pkg)) {\n delete this.allPackagesDependencies[field][pkg];\n peerPackages[pkg] = projectPeerDependencies[pkg];\n }\n });\n });\n this.allPackagesDependencies.peerPackageDependencies = peerPackages;\n }\n\n private applyPackageJson(): void {\n const packageJson = this._getPackageJson();\n if (!packageJson) return;\n const pkgJsonPeer = packageJson.peerDependencies || {};\n const pkgJsonRegularDeps = packageJson.dependencies || {};\n const peerDeps = this.allPackagesDependencies.peerPackageDependencies || {};\n ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].forEach((field) => {\n forEach(this.allPackagesDependencies[field], (_pkgVal, pkgName) => {\n const peerVersionFromPkgJson = pkgJsonPeer[pkgName];\n const regularVersionFromPkgJson = pkgJsonRegularDeps[pkgName];\n if (peerVersionFromPkgJson) {\n delete this.allPackagesDependencies[field][pkgName];\n peerDeps[pkgName] = peerVersionFromPkgJson;\n } else if (regularVersionFromPkgJson) {\n delete this.allPackagesDependencies.peerPackageDependencies?.[pkgName];\n this.allPackagesDependencies[field][pkgName] = regularVersionFromPkgJson;\n }\n });\n });\n this.allPackagesDependencies.peerPackageDependencies = peerDeps;\n }\n\n private applyWorkspacePolicy(): void {\n const wsPolicy = this.depsResolver.getWorkspacePolicyManifest();\n if (!wsPolicy) return;\n const wsPeer = wsPolicy.peerDependencies || {};\n const wsRegular = wsPolicy.dependencies || {};\n const peerPackageDeps = this.allPackagesDependencies.peerPackageDependencies || {};\n // we are not iterate component deps since they are resolved from what actually installed\n // the policy used for installation only in that case\n ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].forEach((field) => {\n forEach(this.allPackagesDependencies[field], (_pkgVal, pkgName) => {\n const peerVersionFromWsPolicy = wsPeer[pkgName];\n const regularVersionFromWsPolicy = wsRegular[pkgName];\n if (peerVersionFromWsPolicy) {\n delete this.allPackagesDependencies[field][pkgName];\n peerPackageDeps[pkgName] = peerVersionFromWsPolicy;\n } else if (regularVersionFromWsPolicy) {\n delete this.allPackagesDependencies.peerPackageDependencies?.[pkgName];\n this.allPackagesDependencies[field][pkgName] = regularVersionFromWsPolicy;\n }\n });\n });\n this.allPackagesDependencies.peerPackageDependencies = peerPackageDeps;\n\n const peerDeps = this.allDependencies.peerDependencies ?? [];\n ['dependencies', 'devDependencies'].forEach((field) => {\n for (const dep of this.allDependencies[field]) {\n const pkgName = dep.packageName;\n const peerVersionFromWsPolicy = wsPeer[pkgName];\n const regularVersionFromWsPolicy = wsRegular[pkgName];\n if (peerVersionFromWsPolicy) {\n dep.versionRange = peerVersionFromWsPolicy;\n peerDeps.push(dep);\n } else if (regularVersionFromWsPolicy) {\n dep.versionRange = regularVersionFromWsPolicy;\n }\n }\n this.allDependencies[field] = this.allDependencies[field].filter(({ packageName }) => !wsPeer[packageName]);\n });\n this.allDependencies.peerDependencies = peerDeps;\n }\n\n /**\n * It removes the @teambit/legacy dependency from the dependencies/devDeps and adds it as a peer dependency with ^.\n */\n private makeLegacyAsPeer(): void {\n let version;\n if (this.allPackagesDependencies.packageDependencies['@teambit/legacy']) {\n version = this.allPackagesDependencies.packageDependencies['@teambit/legacy'];\n delete this.allPackagesDependencies.packageDependencies['@teambit/legacy'];\n }\n if (this.allPackagesDependencies.devPackageDependencies['@teambit/legacy']) {\n if (!version) version = this.allPackagesDependencies.devPackageDependencies['@teambit/legacy'];\n delete this.allPackagesDependencies.devPackageDependencies['@teambit/legacy'];\n }\n if (version) {\n if (!Number.isNaN(version[0])) version = `^${version}`;\n this.allPackagesDependencies.peerPackageDependencies['@teambit/legacy'] = version;\n }\n }\n\n private async applyAutoDetectOverridesOnComponent(): Promise<void> {\n const autoDetectOverrides = this.autoDetectOverrides;\n\n if (!autoDetectOverrides || !Object.keys(autoDetectOverrides).length) {\n return;\n }\n\n const originallyExists: string[] = [];\n let missingPackages: string[] = [];\n // We want to also add missing packages to the peer list as we know to resolve the version from the env anyway\n const missingData = this.issues.getIssueByName('MissingPackagesDependenciesOnFs')?.data as\n | MissingPackagesData[]\n | undefined;\n if (missingData) {\n missingPackages = uniq(missingData.map((d) => d.missingPackages).flat());\n }\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((field) => {\n forEach(autoDetectOverrides[field], (pkgVal, pkgName) => {\n if (this.overridesDependencies.shouldIgnorePeerPackage(pkgName)) return;\n // Validate it was auto detected, we only affect stuff that were detected\n const existsInCompsDeps = this.allDependencies.dependencies.find((dep) => {\n return dep.packageName === pkgName;\n });\n\n const existsInCompsDevDeps = this.allDependencies.devDependencies.find((dep) => {\n return dep.packageName === pkgName;\n });\n\n const existsInCompsPeerDeps = this.allDependencies.peerDependencies.find((dep) => {\n return dep.packageName === pkgName;\n });\n\n if (\n // We are checking originAllPackagesDependencies instead of allPackagesDependencies\n // as it might be already removed from allPackagesDependencies at this point if it was set with\n // \"-\" in runtime/dev\n // in such case we still want to apply it here\n !this.originAllPackagesDependencies.packageDependencies[pkgName] &&\n !this.originAllPackagesDependencies.devPackageDependencies[pkgName] &&\n !this.originAllPackagesDependencies.peerPackageDependencies[pkgName] &&\n !existsInCompsDeps &&\n !existsInCompsDevDeps &&\n !existsInCompsPeerDeps &&\n // Check if it was orignally exists in the component\n // as we might have a policy which looks like this:\n // \"components\": {\n // \"dependencies\": {\n // \"my-dep\": \"-\"\n // },\n // \"devDependencies\": {\n // \"my-dep\": \"1.0.0\"\n // },\n // }\n // in that case we might remove it before getting to the devDeps then we will think that it wasn't required in the component\n // which is incorrect\n !originallyExists.includes(pkgName) &&\n !missingPackages.includes(pkgName)\n ) {\n return;\n }\n originallyExists.push(pkgName);\n const key = DepsKeysToAllPackagesDepsKeys[field];\n\n delete this.allPackagesDependencies[key][pkgName];\n // When changing peer dependency we want it to be stronger than the other types\n if (field === 'peerDependencies') {\n delete this.allPackagesDependencies.devPackageDependencies[pkgName];\n delete this.allPackagesDependencies.packageDependencies[pkgName];\n if (existsInCompsDeps) {\n this.allDependencies.dependencies = this.allDependencies.dependencies.filter(\n (dep) => dep.packageName !== pkgName\n );\n }\n if (existsInCompsDevDeps) {\n this.allDependencies.devDependencies = this.allDependencies.devDependencies.filter(\n (dep) => dep.packageName !== pkgName\n );\n }\n }\n // delete this.allPackagesDependencies.packageDependencies[pkgName];\n // delete this.allPackagesDependencies.devPackageDependencies[pkgName];\n // delete this.allPackagesDependencies.peerPackageDependencies[pkgName];\n\n // If it exists in comps deps / comp dev deps, we don't want to add it to the allPackagesDependencies\n // as it will make the same dep both a dev and runtime dep\n // since we are here only for auto detected deps, it means we already resolved the version correctly\n // so we don't need to really modify the version\n // also the version here might have a range (^ or ~ for example) so we can't\n // just put it as is, as it is not valid for component deps to have range\n if (\n pkgVal !== MANUALLY_REMOVE_DEPENDENCY &&\n ((!existsInCompsDeps && !existsInCompsDevDeps) || field === 'peerDependencies')\n ) {\n if ((existsInCompsDeps || existsInCompsDevDeps) && field === 'peerDependencies') {\n const comp = (existsInCompsDeps ?? existsInCompsDevDeps) as Dependency;\n comp.versionRange = pkgVal;\n this.allDependencies.peerDependencies.push(comp);\n } else {\n this.allPackagesDependencies[key][pkgName] = pkgVal;\n }\n if (existsInCompsPeerDeps) {\n existsInCompsPeerDeps.versionRange = pkgVal;\n }\n }\n });\n });\n }\n\n private async applyAutoDetectedPeersFromEnvOnEnvItSelf(): Promise<void> {\n const envPolicy = await this.depsResolver.getEnvPolicyFromEnvId(\n this.component.id,\n this.component.files,\n this.getEnvExtendsDeps()\n );\n if (!envPolicy) return;\n const envPolicyManifest = envPolicy.selfPolicy.toVersionManifest();\n\n if (!envPolicyManifest || !Object.keys(envPolicyManifest).length) {\n return;\n }\n const deps = this.allPackagesDependencies.packageDependencies || {};\n // we are not iterate component deps since they are resolved from what actually installed\n // the policy used for installation only in that case\n ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'].forEach((field) => {\n forEach(this.allPackagesDependencies[field], (_pkgVal, pkgName) => {\n const peerVersionFromEnvPolicy = envPolicyManifest[pkgName];\n if (peerVersionFromEnvPolicy) {\n delete this.allPackagesDependencies[field][pkgName];\n }\n });\n });\n Object.assign(deps, envPolicyManifest);\n // TODO: handle component deps once we support peers between components\n this.allPackagesDependencies.packageDependencies = deps;\n }\n\n /**\n * returns `package.json` of the component when it's imported, or `package.json` of the workspace\n * when it's authored.\n */\n private _getPackageJson(): Record<string, any> | undefined {\n return this.consumer?.packageJson.packageJsonObject;\n }\n\n private _getPackageJsonFromComponentModel(): Record<string, any> | undefined {\n if (this.componentFromModel && this.component.componentMap) {\n // a component is imported but the package.json file is missing or never written\n // read the values from the model\n const packageJson = PackageJsonFile.createFromComponent(\n this.component.componentMap.rootDir,\n this.componentFromModel\n );\n return packageJson.packageJsonObject;\n }\n return undefined;\n }\n\n private setLegacyInsideHarmonyIssue() {\n if (this.componentFromModel && this.componentFromModel.isLegacy) {\n this.issues.getOrCreate(IssuesClasses.LegacyInsideHarmony).data = true;\n }\n }\n\n private _pkgFieldMapping(field: string) {\n switch (field) {\n case 'dependencies':\n return 'packageDependencies';\n case 'devDependencies':\n return 'devPackageDependencies';\n case 'peerDependencies':\n return 'peerPackageDependencies';\n default:\n throw new Error(`${field} is not recognized`);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBA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AI,CAAC1F,QAAQ,EAAEsE,WAAW,CAAC6E,iBAAiB;EACrD;EAEQnC,iCAAiCA,CAAA,EAAoC;IAC3E,IAAI,IAAI,CAACzI,kBAAkB,IAAI,IAAI,CAACL,SAAS,CAACmF,YAAY,EAAE;MAC1D;MACA;MACA,MAAMiB,WAAW,GAAG8E,4BAAe,CAACC,mBAAmB,CACrD,IAAI,CAACnL,SAAS,CAACmF,YAAY,CAACC,OAAO,EACnC,IAAI,CAAC/E,kBACP,CAAC;MACD,OAAO+F,WAAW,CAAC6E,iBAAiB;IACtC;IACA,OAAO/F,SAAS;EAClB;EAEQrE,2BAA2BA,CAAA,EAAG;IACpC,IAAI,IAAI,CAACR,kBAAkB,IAAI,IAAI,CAACA,kBAAkB,CAAC+K,QAAQ,EAAE;MAC/D,IAAI,CAACxK,MAAM,CAACyK,WAAW,CAACjH,gCAAa,CAACkH,mBAAmB,CAAC,CAAC/N,IAAI,GAAG,IAAI;IACxE;EACF;EAEQqK,gBAAgBA,CAACS,KAAa,EAAE;IACtC,QAAQA,KAAK;MACX,KAAK,cAAc;QACjB,OAAO,qBAAqB;MAC9B,KAAK,iBAAiB;QACpB,OAAO,wBAAwB;MACjC,KAAK,kBAAkB;QACrB,OAAO,yBAAyB;MAClC;QACE,MAAM,IAAIkD,KAAK,CAAC,GAAGlD,KAAK,oBAAoB,CAAC;IACjD;EACF;AACF;AAACmD,OAAA,CAAA1L,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -204,7 +204,11 @@ class AutoDetectDeps {
204
204
  // we have the files dependencies, these files should be components that are registered in bit.map. Otherwise,
205
205
  // they are referred as "untracked components" and the user should add them later on in order to tag
206
206
  this.setTree(dependenciesTree.tree);
207
- const devFiles = await this.devFiles.getDevFilesForConsumerComp(this.component);
207
+ if (dependenciesTree.tree['env.jsonc']?.components.length > 0) {
208
+ await this.populateDependencies(['env.jsonc'], []);
209
+ }
210
+ const envExtendsDeps = this.allDependencies.dependencies.length ? this.allDependencies.dependencies : this.component.componentFromModel?.dependencies.dependencies;
211
+ const devFiles = await this.devFiles.getDevFilesForConsumerComp(this.component, envExtendsDeps);
208
212
  await this.populateDependencies(allFiles, devFiles);
209
213
  return {
210
214
  dependenciesData: new (_dependenciesData().DependenciesData)(this.allDependencies, this.allPackagesDependencies, this.issues, this.coreAspects),
@@ -409,6 +413,9 @@ class AutoDetectDeps {
409
413
  componentIdResolvedFrom: 'DependencyPkgJson',
410
414
  packageName: compDep.name
411
415
  };
416
+ if (originFile === 'env.jsonc') {
417
+ depDebug.importSource = 'env.jsonc';
418
+ }
412
419
  const getVersionFromPkgJson = () => {
413
420
  const versionFromDependencyPkgJson = getValidVersion(compDep.concreteVersion);
414
421
  if (versionFromDependencyPkgJson) {
@@ -1 +1 @@
1
- {"version":3,"names":["path","data","_interopRequireWildcard","require","_fsExtra","_interopRequireDefault","_semver","_componentVersion","_lodash","_componentIssues","_legacy","_legacy2","_legacy3","_toolboxFs","_legacy4","_componentPackageVersion","_filesDependencyBuilder","_packageToDefinetlyTyped","_dependenciesData","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","AutoDetectDeps","constructor","component","workspace","devFiles","depsResolver","aspectLoader","componentId","componentMap","componentFromModel","consumerPath","consumer","getPath","allDependencies","dependencies","devDependencies","peerDependencies","allPackagesDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","processedFiles","issues","debugDependenciesData","components","setTree","tree","getDependenciesData","cacheResolvedDependencies","cacheProjectAst","componentDir","join","rootDir","nonTestsFiles","testsFiles","getFilesGroupedByBeingTests","allFiles","envDetectors","getEnvDetectors","dependenciesTree","getDependencyTree","workspacePath","filePaths","visited","getDevFilesForConsumerComp","populateDependencies","dependenciesData","DependenciesData","coreAspects","calcComponentEnvDepDetectors","extensions","files","forEach","file","fileType","isTestFile","includes","throwForNonExistFile","processCoreAspects","processMissing","processErrors","processPackages","processComponents","processDepFiles","processUnidentifiedPackages","Error","getComponentIdByResolvedPackageData","bit","getComponentIdByDepFile","depFile","depFileRelative","destination","rootDirFullPath","fullDepFile","resolve","pathNormalizeToLinux","relative","bitMap","getComponentIdByPath","originFile","nested","push","allDepsFiles","isEmpty","isDepFileUntracked","processOneDepFile","importSpecifiers","dummyFileType","depFileObject","importSource","_pushToUntrackDependenciesIssues","isEqual","ignoreVersion","endsWith","getOrCreate","IssuesClasses","ImportFromDirectory","depComponentMap","getComponentIfExist","depRootDir","undefined","destinationRelativePath","startsWith","pathRelativeLinux","sourceRelativePath","depsPaths","importSpecifier","mainFile","exported","currentComponentsDeps","Dependency","_pushToRelativeComponentsAuthoredIssues","existingDependency","getExistingDependency","existingDepRelativePaths","getExistingDepRelativePaths","relativePaths","nonExistingImportSpecifiers","getDiffSpecifiers","depDebug","id","pushToDependenciesArray","compDep","SelfReference","name","dependencyPackageJsonPath","packageJsonPath","dependentPackageJsonPath","componentIdResolvedFrom","packageName","getVersionFromPkgJson","versionFromDependencyPkgJson","getValidVersion","concreteVersion","versionResolvedFrom","versionFromDependentPkgJson","versionUsedByDependent","version","changeVersion","existingId","addImportNonMainIssueIfNeeded","isPeer","packageJsonContent","peer","peerVersionRange","defaultPeerRange","semver","valid","_pushToDependenciesIfNotExist","isPkgInWorkspacePolicies","pkgName","getWorkspacePolicyManifest","filePath","dependencyPkgData","depMain","main","depFullPath","fullPath","extDisallowNonMain","extname","pkgRootDir","dirname","fs","existsSync","DEFAULT_DIST_DIRNAME","nonMainFileSplit","split","nonMainFileShort","ImportNonMainFiles","packages","modelDeps","getAllPackageDependencies","keys","packageNames","concat","missing","_addTypesPackagesForTypeScript","assign","processMissingFiles","missingFiles","filter","hasExtension","Boolean","rootDirAbs","toAbsolutePath","filePathAbs","relativeToCompDir","relativeToCompDirWithoutExt","removeFileExtension","compFilesWithoutExt","getAllFilesPaths","map","f","existWithDifferentExt","some","_pushToMissingDependenciesOnFs","processMissingPackages","missingPackages","_pushToMissingPackagesDependenciesIssues","error","logger","errorAndAddBreadCrumb","code","location","lineNumber","column","ParseErrors","message","ResolveErrors","getCoreAspectsPackagesAndIds","coreAspectIds","values","toStringWithoutVersion","coreAspectsPackages","unidentifiedPackages","usedCoreAspects","findMatchingCoreAspect","find","coreAspectName","unidentifiedPackagesFiltered","matchingCoreAspectPackageName","bitsFiltered","packageInfo","uniq","length","dependency","opts","existingDevDependency","d","isEqualWithoutVersion","relativePath","paths","originSpecifiers","targetSpecifiers","cmp","specifier1","specifier2","differenceWith","isTypeScript","getExt","depsHost","addFromConfig","DEPENDENCIES_FIELDS","depField","typesPackage","packageToDefinetlyTyped","addFromModel","typedPackageFromModel","added","findExisting","result","getIssue","UntrackedDependencies","currentUntracked","found","untrackedFiles","existing","newUntrackedFile","untrackIssue","untrackedCurrentFile","RelativeComponentsAuthored","MissingDependenciesOnFs","MissingPackagesDependenciesOnFs","foundFile","isDevFile","exports","SNAP_VERSION_PREFIX","versionWithoutSnapPrefix","replace","isSnap","validRange","coerced","coerce"],"sources":["auto-detect-deps.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport semver from 'semver';\nimport { isSnap } from '@teambit/component-version';\nimport { ComponentID } from '@teambit/component-id';\nimport { uniq, isEmpty, forEach, differenceWith } from 'lodash';\nimport { IssuesList, IssuesClasses } from '@teambit/component-issues';\nimport {\n Dependency,\n RelativePath,\n ImportSpecifier,\n ConsumerComponent as Component,\n} from '@teambit/legacy.consumer-component';\nimport { DEFAULT_DIST_DIRNAME, DEPENDENCIES_FIELDS } from '@teambit/legacy.constants';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport { getExt } from '@teambit/toolbox.fs.extension-getter';\nimport {\n pathNormalizeToLinux,\n pathRelativeLinux,\n PathLinux,\n PathLinuxRelative,\n PathOsBased,\n removeFileExtension,\n} from '@teambit/legacy.utils';\nimport { ResolvedPackageData } from '../resolve-pkg-data';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\nimport { SNAP_VERSION_PREFIX } from '@teambit/component-package-version';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { getDependencyTree } from '../files-dependency-builder';\nimport { FileObject, DependenciesTree } from '../files-dependency-builder/types/dependency-tree-type';\nimport { DevFilesMain } from '@teambit/dev-files';\nimport { Workspace } from '@teambit/workspace';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { DependencyDetector } from '../files-dependency-builder/detector-hook';\nimport { packageToDefinetlyTyped } from './package-to-definetly-typed';\nimport { DependenciesData } from './dependencies-data';\nimport { AllDependencies, AllPackagesDependencies } from './apply-overrides';\n\nexport type FileType = {\n isTestFile: boolean;\n};\n\nexport type DebugDependencies = {\n components: DebugComponentsDependency[];\n unidentifiedPackages?: string[];\n};\n\nexport type DebugComponentsDependency = {\n id: ComponentID;\n importSource?: string;\n dependencyPackageJsonPath?: string;\n dependentPackageJsonPath?: string;\n // can be resolved here or can be any one of the strategies in dependencies-version-resolver\n versionResolvedFrom?: 'DependencyPkgJson' | 'DependentPkgJson' | 'BitMap' | 'Model' | 'MergeConfig' | string;\n version?: string;\n componentIdResolvedFrom?: 'DependencyPkgJson' | 'DependencyPath';\n packageName?: string;\n};\n\ntype PushToDepsArrayOpts = {\n fileType: FileType;\n depDebug: DebugComponentsDependency;\n isPeer?: boolean;\n};\n\nexport class AutoDetectDeps {\n componentId: ComponentID;\n componentMap: ComponentMap;\n componentFromModel: Component;\n consumerPath: PathOsBased;\n tree: DependenciesTree;\n allDependencies: AllDependencies;\n allPackagesDependencies: AllPackagesDependencies;\n issues: IssuesList;\n coreAspects: string[] = [];\n processedFiles: string[];\n debugDependenciesData: DebugDependencies;\n autoDetectConfigMerge: Record<string, any>;\n constructor(\n private component: Component,\n private workspace: Workspace,\n private devFiles: DevFilesMain,\n private depsResolver: DependencyResolverMain,\n private aspectLoader: AspectLoaderMain\n ) {\n this.componentId = component.componentId;\n // the consumerComponent is coming from the workspace, so it must have the componentMap prop\n this.componentMap = this.component.componentMap as ComponentMap;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.componentFromModel = this.component.componentFromModel;\n this.consumerPath = this.consumer.getPath();\n this.allDependencies = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n this.allPackagesDependencies = {\n packageDependencies: {},\n devPackageDependencies: {},\n peerPackageDependencies: {},\n };\n this.processedFiles = [];\n this.issues = component.issues;\n this.debugDependenciesData = { components: [] };\n }\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n private setTree(tree: DependenciesTree) {\n this.tree = tree;\n // console.log(JSON.stringify(tree, null, 4)); // uncomment to easily watch the tree received from bit-javascript\n }\n\n /**\n * Resolve components and packages dependencies for a component.\n * This method should NOT have any side-effect on the component. the DependenciesLoader class is\n * responsible for saving this data on the component object.\n *\n * The process is as follows:\n * 1) Use the language driver to parse the component files and find for each file its dependencies.\n * 2) The results we get from the driver per file tells us what are the files and packages that depend on our file.\n * and also whether there are missing packages and files.\n * 3) Using the information from the driver, we go over each one of the dependencies files and find its counterpart\n * component. The way how we find it, is by using the bit.map file which has a mapping between the component name and\n * the file paths.\n * 4) If we find a component to the file dependency, we add it to component.dependencies. Otherwise, it's added to\n * component.issues.untrackedDependencies\n * 5) Similarly, when we find the packages dependencies, they are added to component.packageDependencies. Otherwise,\n * they're added to component.issues.missingPackagesDependenciesOnFs\n * 6) In case the driver found a file dependency that is not on the file-system, we add that file to\n * component.issues.missingDependenciesOnFs\n */\n async getDependenciesData(\n cacheResolvedDependencies: Record<string, any>,\n cacheProjectAst: Record<string, any> | undefined\n ): Promise<{ dependenciesData: DependenciesData; debugDependenciesData: DebugDependencies }> {\n const componentDir = path.join(this.consumerPath, this.componentMap.rootDir);\n const { nonTestsFiles, testsFiles } = this.componentMap.getFilesGroupedByBeingTests();\n const allFiles = [...nonTestsFiles, ...testsFiles];\n const envDetectors = await this.getEnvDetectors();\n // find the dependencies (internal files and packages) through automatic dependency resolution\n const dependenciesTree = await getDependencyTree({\n componentDir,\n workspacePath: this.consumerPath,\n filePaths: allFiles,\n visited: cacheResolvedDependencies,\n cacheProjectAst,\n envDetectors,\n });\n // we have the files dependencies, these files should be components that are registered in bit.map. Otherwise,\n // they are referred as \"untracked components\" and the user should add them later on in order to tag\n this.setTree(dependenciesTree.tree);\n const devFiles = await this.devFiles.getDevFilesForConsumerComp(this.component);\n await this.populateDependencies(allFiles, devFiles);\n return {\n dependenciesData: new DependenciesData(\n this.allDependencies,\n this.allPackagesDependencies,\n this.issues,\n this.coreAspects\n ),\n debugDependenciesData: this.debugDependenciesData,\n };\n }\n\n async getEnvDetectors(): Promise<DependencyDetector[] | null> {\n return this.depsResolver.calcComponentEnvDepDetectors(this.component.extensions);\n }\n\n /**\n * Given the tree of file dependencies from the driver, find the components of these files.\n * Each dependency file has a path, use bit.map to search for the component name by that path.\n * If the component is found, add it to \"this.allDependencies.dependencies\". Otherwise, add it to \"this.issues.untrackedDependencies\".\n *\n * For the found components, add their sourceRelativePath and destinationRelativePath, they are being used for\n * generating links upon import:\n * sourceRelativePath - location of the link file.\n * destinationRelativePath - destination written inside the link file.\n *\n * When a dependency is found in a regular (implementation) file, it goes to `dependencies`. If\n * it found on a test file, it goes to `devDependencies`.\n * Similarly, when a package is found in a regular file, it goes to `packageDependencies`. When\n * if found in a test file, it goes to `devPackageDependencies`.\n * An exception for the above is when a package is required in a regular or test file but is also\n * mentioned in the `package.json` file as a peerDependency, in that case, the package is added\n * to `peerPackageDependencies` and removed from other places. Unless this package is overridden\n * and marked as ignored in the consumer or component config file.\n */\n private async populateDependencies(files: string[], testsFiles: string[]) {\n files.forEach((file) => {\n const fileType: FileType = {\n isTestFile: testsFiles.includes(file),\n };\n this.throwForNonExistFile(file);\n this.processCoreAspects(file);\n this.processMissing(file, fileType);\n this.processErrors(file);\n this.processPackages(file, fileType);\n this.processComponents(file, fileType);\n this.processDepFiles(file, fileType);\n this.processUnidentifiedPackages(file);\n });\n }\n\n private throwForNonExistFile(file: string) {\n if (!this.tree[file]) {\n throw new Error(\n `DependencyResolver: a file \"${file}\" was not returned from the driver, its dependencies are unknown`\n );\n }\n }\n\n private getComponentIdByResolvedPackageData(bit: ResolvedPackageData): ComponentID {\n if (!bit.componentId) {\n throw new Error(`resolved Bit component must have componentId prop in the package.json file`);\n }\n return bit.componentId;\n }\n\n /**\n * this happens when using relative paths between components, which is allowed on Legacy only.\n * on Harmony, during the execution of this function, it recognizes the use of relative-paths, enter\n * it to the \"issues\", then, later, it shows a warning on bit-status and block tagging.\n */\n private getComponentIdByDepFile(depFile: PathLinux): {\n componentId: ComponentID | undefined;\n depFileRelative: PathLinux;\n destination: string | null | undefined;\n } {\n let depFileRelative: PathLinux = depFile; // dependency file path relative to consumer root\n let destination: string | null | undefined;\n const rootDir = this.componentMap.rootDir;\n // The depFileRelative is relative to rootDir, change it to be relative to current consumer.\n // We can't use path.resolve(rootDir, fileDep) because this might not work when running\n // bit commands not from root, because resolve take by default the process.cwd\n const rootDirFullPath = path.join(this.consumerPath, rootDir);\n const fullDepFile = path.resolve(rootDirFullPath, depFile);\n depFileRelative = pathNormalizeToLinux(path.relative(this.consumerPath, fullDepFile));\n\n const componentId = this.consumer.bitMap.getComponentIdByPath(depFileRelative);\n\n return { componentId, depFileRelative, destination };\n }\n\n private processDepFiles(originFile: PathLinuxRelative, fileType: FileType, nested = false) {\n // We don't just return because different files of the component might import different things from the depFile\n // See more info here: https://github.com/teambit/bit/issues/1796\n if (!this.processedFiles.includes(originFile)) {\n this.processedFiles.push(originFile);\n // We don't want to calculate nested files again after they calculated as direct files\n } else if (nested) {\n return;\n }\n const allDepsFiles = this.tree[originFile].files;\n if (!allDepsFiles || isEmpty(allDepsFiles)) return;\n allDepsFiles.forEach((depFile: FileObject) => {\n const isDepFileUntracked = this.processOneDepFile(\n originFile,\n depFile.file,\n depFile.importSpecifiers,\n fileType,\n depFile,\n nested\n );\n // Only continue recursively if the dep file is untracked\n // for tracked deps if they have untracked deps they will be shown under their own components\n if (isDepFileUntracked) {\n // Recursively check for untracked files (to show them all in bit status)\n // for nested files we don't really care about the file types since we won't do all the checking\n const dummyFileType: FileType = {\n isTestFile: false,\n };\n this.processDepFiles(depFile.file, dummyFileType, true);\n }\n });\n }\n\n // return true if the dep file is untracked\n private processOneDepFile(\n originFile: PathLinuxRelative,\n depFile: string,\n importSpecifiers: ImportSpecifier[] | undefined,\n fileType: FileType,\n depFileObject: FileObject,\n nested = false\n ): boolean {\n const { componentId, depFileRelative, destination } = this.getComponentIdByDepFile(depFile);\n const importSource: string = depFileObject.importSource as string;\n // the file dependency doesn't have any counterpart component. Add it to this.issues.untrackedDependencies\n if (!componentId) {\n this._pushToUntrackDependenciesIssues(originFile, depFileRelative, nested);\n return true;\n }\n // happens when in the same component one file requires another one. In this case, there is\n // noting to do regarding the dependencies\n if (componentId.isEqual(this.componentId, { ignoreVersion: true })) {\n if (importSource === '.' || importSource.endsWith('/..')) {\n (this.issues.getOrCreate(IssuesClasses.ImportFromDirectory).data[originFile] ||= []).push(importSource);\n }\n return false;\n }\n\n const depComponentMap = this.consumer.bitMap.getComponentIfExist(componentId);\n // found a dependency component. Add it to this.allDependencies.dependencies\n const depRootDir = depComponentMap ? depComponentMap.rootDir : undefined;\n const destinationRelativePath =\n destination ||\n (depRootDir && depFileRelative.startsWith(depRootDir)\n ? pathRelativeLinux(depRootDir, depFileRelative)\n : depFileRelative);\n\n // when there is no rootDir for the current dependency (it happens when it's AUTHORED), keep the original path\n const sourceRelativePath = depRootDir ? depFileRelative : depFile;\n\n const depsPaths: RelativePath = {\n sourceRelativePath,\n destinationRelativePath,\n };\n if (importSpecifiers) {\n importSpecifiers.forEach((importSpecifier) => {\n if (importSpecifier.mainFile) delete importSpecifier.mainFile.exported;\n });\n depsPaths.importSpecifiers = importSpecifiers;\n }\n const currentComponentsDeps = new Dependency(componentId, [depsPaths]);\n this._pushToRelativeComponentsAuthoredIssues(originFile, componentId, importSource, depsPaths);\n\n const allDependencies: Dependency[] = [\n ...this.allDependencies.dependencies,\n ...this.allDependencies.devDependencies,\n ];\n const existingDependency = this.getExistingDependency(allDependencies, componentId);\n if (existingDependency) {\n const existingDepRelativePaths = this.getExistingDepRelativePaths(existingDependency, depsPaths);\n if (!existingDepRelativePaths) {\n // it is another file of an already existing component. Just add the new path\n existingDependency.relativePaths.push(depsPaths);\n return false;\n }\n // The dep path already exists but maybe this dep-file has more importSpecifiers\n if (depsPaths.importSpecifiers) {\n // add them to the existing dep\n if (!existingDepRelativePaths.importSpecifiers) {\n existingDepRelativePaths.importSpecifiers = [...depsPaths.importSpecifiers];\n } else {\n // both have importSpecifiers\n const nonExistingImportSpecifiers = this.getDiffSpecifiers(\n existingDepRelativePaths.importSpecifiers,\n depsPaths.importSpecifiers\n );\n existingDepRelativePaths.importSpecifiers.push(...nonExistingImportSpecifiers);\n }\n }\n\n if (depsPaths.importSource && !existingDepRelativePaths.importSource) {\n existingDepRelativePaths.importSource = depsPaths.importSource;\n }\n } else {\n const depDebug: DebugComponentsDependency = {\n id: currentComponentsDeps.id,\n importSource,\n };\n this.pushToDependenciesArray(currentComponentsDeps, { fileType, depDebug });\n }\n return false;\n }\n\n /**\n * process require/import of Bit components where the require statement is not a relative path\n * but a module path, such as `require('@bit/bit.envs/compiler/babel');`\n */\n private processComponents(originFile: PathLinuxRelative, fileType: FileType) {\n const components = this.tree[originFile].components;\n if (!components || isEmpty(components)) return;\n components.forEach((compDep) => {\n let componentId = this.getComponentIdByResolvedPackageData(compDep);\n if (componentId.isEqual(this.componentId)) {\n this.issues.getOrCreate(IssuesClasses.SelfReference).data[originFile] = compDep.name;\n // the component is importing itself, so ignore it. although currently it doesn't cause any issues, (probably\n // because it filtered out later), it's better to remove it as soon as possible, for less-confusing debugging.\n return;\n }\n const depDebug: DebugComponentsDependency = {\n id: componentId,\n dependencyPackageJsonPath: compDep.packageJsonPath,\n dependentPackageJsonPath: compDep.dependentPackageJsonPath,\n componentIdResolvedFrom: 'DependencyPkgJson',\n packageName: compDep.name,\n };\n const getVersionFromPkgJson = (): string | null => {\n const versionFromDependencyPkgJson = getValidVersion(compDep.concreteVersion);\n if (versionFromDependencyPkgJson) {\n depDebug.versionResolvedFrom = 'DependencyPkgJson';\n return versionFromDependencyPkgJson;\n }\n const versionFromDependentPkgJson = getValidVersion(compDep.versionUsedByDependent);\n if (versionFromDependentPkgJson) {\n depDebug.versionResolvedFrom = 'DependentPkgJson';\n return versionFromDependentPkgJson;\n }\n return null;\n };\n const version = getVersionFromPkgJson();\n if (version) {\n componentId = componentId.changeVersion(version);\n }\n const existingId = componentId;\n if (existingId.isEqual(this.componentId)) {\n // happens when one of the component files requires another using module path\n // no need to enter anything to the dependencies\n return;\n }\n this.addImportNonMainIssueIfNeeded(originFile, compDep);\n const isPeer = compDep.packageJsonContent?.bit?.peer;\n let peerVersionRange: string | undefined;\n if (isPeer) {\n const defaultPeerRange = compDep.packageJsonContent?.bit?.defaultPeerRange;\n if (!defaultPeerRange) {\n peerVersionRange = '*';\n } else if (['~', '^', '>='].includes(defaultPeerRange)) {\n if (semver.valid(compDep.concreteVersion)) {\n peerVersionRange = `${defaultPeerRange}${compDep.concreteVersion}`;\n } else {\n peerVersionRange = `${defaultPeerRange}0.0.0-${compDep.concreteVersion}`;\n }\n } else {\n peerVersionRange = defaultPeerRange;\n }\n }\n const currentComponentsDeps = new Dependency(existingId, [], compDep.name, peerVersionRange);\n this._pushToDependenciesIfNotExist(currentComponentsDeps, {\n fileType,\n depDebug,\n isPeer,\n });\n });\n }\n\n private isPkgInWorkspacePolicies(pkgName: string) {\n return this.depsResolver.getWorkspacePolicyManifest().dependencies?.[pkgName];\n }\n\n private addImportNonMainIssueIfNeeded(filePath: PathLinuxRelative, dependencyPkgData: ResolvedPackageData) {\n const depMain: PathLinuxRelative | undefined = dependencyPkgData.packageJsonContent?.main;\n if (!depMain) {\n return;\n }\n const depFullPath = pathNormalizeToLinux(dependencyPkgData.fullPath);\n\n if (depFullPath.endsWith(depMain)) {\n // it requires the main-file. all is good.\n return;\n }\n const extDisallowNonMain = ['.ts', '.tsx', '.js', '.jsx'];\n if (!extDisallowNonMain.includes(path.extname(depFullPath))) {\n // some files such as scss/json are needed to be imported as non-main\n return;\n }\n const pkgRootDir = dependencyPkgData.packageJsonPath && path.dirname(dependencyPkgData.packageJsonPath);\n if (pkgRootDir && !fs.existsSync(path.join(pkgRootDir, DEFAULT_DIST_DIRNAME))) {\n // the dependency wasn't compiled yet. the issue is probably because depMain points to the dist\n // and depFullPath is in the source.\n return;\n }\n const nonMainFileSplit = depFullPath.split(`node_modules/`);\n const nonMainFileShort = nonMainFileSplit[1] || nonMainFileSplit[0];\n if (nonMainFileShort.includes('eslintrc')) {\n // a temporary workaround for envs that don't expose eslintrc config in their index file.\n // this is needed for a future change of detecting require.resolve syntax\n return;\n }\n (this.issues.getOrCreate(IssuesClasses.ImportNonMainFiles).data[filePath] ||= []).push(nonMainFileShort);\n }\n\n private processPackages(originFile: PathLinuxRelative, fileType: FileType) {\n const packages = this.tree[originFile].packages;\n if (this.componentFromModel) {\n const modelDeps = this.componentFromModel.getAllPackageDependencies();\n // If a package is not in the policies, then we resolve the package from the model.\n for (const pkgName of Object.keys(packages)) {\n if (!this.isPkgInWorkspacePolicies(pkgName) && modelDeps[pkgName]) {\n packages[pkgName] = modelDeps[pkgName];\n }\n }\n }\n const packageNames = Object.keys(packages).concat(this.tree[originFile].missing?.packages ?? []);\n this._addTypesPackagesForTypeScript(packageNames, originFile);\n if (!packages || isEmpty(packages)) return;\n if (fileType.isTestFile) {\n Object.assign(this.allPackagesDependencies.devPackageDependencies, packages);\n } else {\n Object.assign(this.allPackagesDependencies.packageDependencies, packages);\n }\n }\n\n private processMissing(originFile: PathLinuxRelative, fileType: FileType) {\n const missing = this.tree[originFile].missing;\n if (!missing) return;\n const processMissingFiles = () => {\n if (isEmpty(missing.files)) return;\n const missingFiles = missing.files.filter((file) => {\n const hasExtension = Boolean(path.extname(file));\n if (!hasExtension) return true;\n // the missing file has extension, e.g. \"index.js\". It's possible that this file doesn't exist in the source\n // but will be available in the dists. so if found same filename without the extension, we assume it's fine.\n const rootDirAbs = this.consumer.toAbsolutePath(this.componentMap.rootDir);\n const filePathAbs = path.resolve(rootDirAbs, file);\n const relativeToCompDir = path.relative(rootDirAbs, filePathAbs);\n const relativeToCompDirWithoutExt = removeFileExtension(relativeToCompDir);\n const compFilesWithoutExt = this.componentMap.getAllFilesPaths().map((f) => removeFileExtension(f));\n const existWithDifferentExt = compFilesWithoutExt.some((f) => f === relativeToCompDirWithoutExt);\n return !existWithDifferentExt;\n });\n if (isEmpty(missingFiles)) return;\n this._pushToMissingDependenciesOnFs(originFile, missingFiles);\n };\n const processMissingPackages = () => {\n if (isEmpty(missing.packages)) return;\n const missingPackages = missing.packages;\n if (!isEmpty(missingPackages)) {\n this._pushToMissingPackagesDependenciesIssues(originFile, missingPackages, fileType);\n }\n };\n processMissingFiles();\n processMissingPackages();\n }\n\n private processErrors(originFile: PathLinuxRelative) {\n const error: any = this.tree[originFile].error;\n if (!error) return;\n logger.errorAndAddBreadCrumb(\n 'dependency-resolver.processErrors',\n `got an error from the driver while resolving dependencies from \"${originFile}\"`\n );\n logger.error('dependency-resolver.processErrors', error);\n if (error.code === 'PARSING_ERROR') {\n const location = error.lineNumber && error.column ? ` (line: ${error.lineNumber}, column: ${error.column})` : '';\n this.issues.getOrCreate(IssuesClasses.ParseErrors).data[originFile] = error.message + location;\n } else this.issues.getOrCreate(IssuesClasses.ResolveErrors).data[originFile] = error.message;\n }\n\n /**\n * when a user uses core-extensions these core-extensions should not be dependencies.\n * here, we filter them out from all places they could entered as dependencies.\n * an exception is when running this method on bit-core-extensions themselves (dogfooding), in\n * which case we recognizes that the current originFile is a core-extension and avoid filtering.\n */\n private processCoreAspects(originFile: PathLinuxRelative) {\n const coreAspects = this.aspectLoader.getCoreAspectsPackagesAndIds();\n\n // const scopes = coreAspects.map((id) => {\n // const id = id.split()\n // });\n\n const coreAspectIds = Object.values(coreAspects);\n if (coreAspectIds.includes(this.component.id.toStringWithoutVersion())) {\n return;\n }\n\n const coreAspectsPackages = Object.keys(coreAspects);\n\n const components = this.tree[originFile].components;\n const unidentifiedPackages = this.tree[originFile].unidentifiedPackages;\n const usedCoreAspects: string[] = [];\n\n const findMatchingCoreAspect = (packageName: string) => {\n return coreAspectsPackages.find((coreAspectName) => packageName === coreAspectName);\n };\n const unidentifiedPackagesFiltered = unidentifiedPackages?.filter((packageName) => {\n const matchingCoreAspectPackageName = findMatchingCoreAspect(packageName);\n if (matchingCoreAspectPackageName) {\n usedCoreAspects.push(coreAspects[matchingCoreAspectPackageName]);\n }\n return !matchingCoreAspectPackageName;\n });\n const bitsFiltered = components?.filter((packageInfo) => {\n const matchingCoreAspectPackageName = findMatchingCoreAspect(packageInfo.name);\n if (matchingCoreAspectPackageName) {\n usedCoreAspects.push(coreAspects[matchingCoreAspectPackageName]);\n }\n return !matchingCoreAspectPackageName;\n });\n\n this.tree[originFile].unidentifiedPackages = unidentifiedPackagesFiltered;\n this.tree[originFile].components = bitsFiltered;\n this.coreAspects.push(...uniq(usedCoreAspects));\n }\n\n /**\n * ** LEGACY ONLY **\n * This is related to a legacy feature \"custom-module-resolution\". the code was removed, only the debug is still there, just in case.\n *\n * ** OLD COMMENT **\n * currently the only unidentified packages being process are the ones coming from custom-modules-resolution.\n * assuming the author used custom-resolution, which enable using non-relative import syntax,\n * for example, requiring the file 'src/utils/is-string' from anywhere as require('utils/is-string');\n * now, when the component is imported, the driver recognizes 'utils/is-string' as a package,\n * because it's not relative.\n * the goal here is to use the 'package' the driver found and match it with one of the\n * dependencies from the model. In the example above, we might find in the model, a dependency\n * is-string with importSource of 'utils/is-string'.\n * Once a match is found, copy the relativePaths from the model.\n *\n * keep in mind that this custom-modules-resolution supported on legacy components only.\n * as such, no need to find the packageName to pass to _pushToDependenciesIfNotExist method.\n */\n private processUnidentifiedPackages(originFile: PathLinuxRelative) {\n const unidentifiedPackages = this.tree[originFile].unidentifiedPackages;\n if (!unidentifiedPackages || !unidentifiedPackages.length) return;\n this.debugDependenciesData.unidentifiedPackages = unidentifiedPackages;\n }\n\n private _pushToDependenciesIfNotExist(dependency: Dependency, opts: PushToDepsArrayOpts) {\n const existingDependency = this.getExistingDependency(this.allDependencies.dependencies, dependency.id);\n const existingDevDependency = this.getExistingDependency(this.allDependencies.devDependencies, dependency.id);\n // no need to enter dev dependency to devDependencies if it exists already in dependencies\n if (existingDependency || (existingDevDependency && opts.fileType.isTestFile)) {\n return;\n }\n // at this point, either, it doesn't exist at all and should be entered.\n // or it exists in devDependencies but now it comes from non-dev file, which should be entered\n // as non-dev.\n this.pushToDependenciesArray(dependency, opts);\n }\n\n private pushToDependenciesArray(currentComponentsDeps: Dependency, opts: PushToDepsArrayOpts) {\n if (opts.fileType.isTestFile) {\n this.allDependencies.devDependencies.push(currentComponentsDeps);\n } else if (opts.isPeer) {\n this.allDependencies.peerDependencies.push(currentComponentsDeps);\n } else {\n this.allDependencies.dependencies.push(currentComponentsDeps);\n }\n this.debugDependenciesData.components.push(opts.depDebug);\n }\n\n private getExistingDependency(dependencies: Dependency[], id: ComponentID): Dependency | null | undefined {\n return dependencies.find((d) => d.id.isEqualWithoutVersion(id));\n }\n\n private getExistingDepRelativePaths(dependency: Dependency, relativePath: RelativePath) {\n if (!dependency.relativePaths || isEmpty(dependency.relativePaths)) return null;\n return dependency.relativePaths.find(\n (paths) =>\n paths.sourceRelativePath === relativePath.sourceRelativePath &&\n paths.destinationRelativePath === relativePath.destinationRelativePath\n );\n }\n\n private getDiffSpecifiers(originSpecifiers: ImportSpecifier[], targetSpecifiers: ImportSpecifier[]) {\n const cmp = (specifier1, specifier2) => specifier1.mainFile.name === specifier2.mainFile.name;\n return differenceWith(targetSpecifiers, originSpecifiers, cmp);\n }\n\n /**\n * when requiring packages in typescript, sometimes there are the types packages with the same\n * name, which the user probably wants as well. for example, requiring `foo` package, will also\n * add `@types/foo` to the devDependencies if it has been found in the user `package.json` file.\n *\n * ideally this should be in bit-javascript. however, the decision where to put these `@types`\n * packages (dependencies/devDependencies) is done here according to the user `package.json`\n * and can't be done there because the `Tree` we get from bit-javascript doesn't have this\n * distinction.\n */\n private _addTypesPackagesForTypeScript(packageNames: string[], originFile: PathLinuxRelative): void {\n if (packageNames.length === 0) return;\n const isTypeScript = getExt(originFile) === 'ts' || getExt(originFile) === 'tsx';\n if (!isTypeScript) return;\n const depsHost = this.depsResolver.getWorkspacePolicyManifest();\n const addFromConfig = (packageName: string): boolean => {\n if (!depsHost) return false;\n return DEPENDENCIES_FIELDS.some((depField) => {\n if (!depsHost[depField]) return false;\n const typesPackage = packageToDefinetlyTyped(packageName);\n if (!depsHost[depField][typesPackage]) return false;\n Object.assign(this.allPackagesDependencies.devPackageDependencies, {\n [typesPackage]: depsHost[depField][typesPackage],\n });\n return true;\n });\n };\n const addFromModel = (packageName: string) => {\n if (!this.componentFromModel) return;\n const typesPackage = packageToDefinetlyTyped(packageName);\n const typedPackageFromModel = this.componentFromModel.devPackageDependencies[typesPackage];\n if (!typedPackageFromModel) return;\n Object.assign(this.allPackagesDependencies.devPackageDependencies, {\n [typesPackage]: typedPackageFromModel,\n });\n };\n\n packageNames.forEach((packageName) => {\n const added = addFromConfig(packageName);\n if (!added) addFromModel(packageName);\n });\n }\n\n private _pushToUntrackDependenciesIssues(originFile: PathLinuxRelative, depFileRelative, nested = false) {\n const findExisting = () => {\n let result;\n forEach(this.issues.getIssue(IssuesClasses.UntrackedDependencies)?.data || {}, (currentUntracked) => {\n const found = currentUntracked.untrackedFiles.find((file) => {\n return file.relativePath === depFileRelative;\n });\n if (found) {\n result = found;\n }\n });\n return result;\n };\n const existing = findExisting();\n const newUntrackedFile = { relativePath: depFileRelative, existing: false };\n // If it's already found mark them both as existing\n if (existing) {\n newUntrackedFile.existing = true;\n existing.existing = true;\n }\n const untrackIssue = this.issues.getOrCreate(IssuesClasses.UntrackedDependencies);\n const untrackedCurrentFile = untrackIssue?.data[originFile];\n if (untrackedCurrentFile) {\n untrackedCurrentFile.untrackedFiles.push(newUntrackedFile);\n } else {\n untrackIssue.data[originFile] = { nested, untrackedFiles: [newUntrackedFile] };\n }\n }\n private _pushToRelativeComponentsAuthoredIssues(\n originFile,\n componentId: ComponentID,\n importSource: string,\n relativePath: RelativePath\n ) {\n (this.issues.getOrCreate(IssuesClasses.RelativeComponentsAuthored).data[originFile] ||= []).push({\n importSource,\n componentId,\n relativePath,\n });\n }\n private _pushToMissingDependenciesOnFs(originFile: PathLinuxRelative, missingFiles: string[]) {\n (this.issues.getOrCreate(IssuesClasses.MissingDependenciesOnFs).data[originFile] ||= []).push(...missingFiles);\n }\n private _pushToMissingPackagesDependenciesIssues(\n originFile: PathLinuxRelative,\n missingPackages: string[],\n fileType: FileType\n ) {\n const data = this.issues.getOrCreate(IssuesClasses.MissingPackagesDependenciesOnFs).data;\n const foundFile = data.find((file) => file.filePath === originFile);\n if (foundFile) {\n foundFile.missingPackages = uniq([...missingPackages, ...foundFile.missingPackages]);\n } else {\n data.push({ filePath: originFile, missingPackages, isDevFile: fileType.isTestFile });\n }\n }\n}\n\nexport function getValidVersion(version: string | undefined) {\n if (!version) {\n return null;\n }\n if (version.startsWith(SNAP_VERSION_PREFIX)) {\n const versionWithoutSnapPrefix = version.replace(SNAP_VERSION_PREFIX, '');\n if (isSnap(versionWithoutSnapPrefix)) {\n return versionWithoutSnapPrefix;\n }\n }\n if (semver.valid(version)) {\n // this takes care of pre-releases as well, as they're considered valid semver.\n return version;\n }\n if (semver.validRange(version)) {\n // if this is a range, e.g. ^1.0.0, return a valid version: 1.0.0.\n const coerced = semver.coerce(version);\n if (coerced) {\n return coerced.version;\n }\n }\n if (isSnap(version)) {\n return version;\n }\n // it's probably a relative path to the component\n return null;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,YA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ACF;EACA,IAAIzH,iBAAM,CAACC,KAAK,CAACV,OAAO,CAAC,EAAE;IACzB;IACA,OAAOA,OAAO;EAChB;EACA,IAAIS,iBAAM,CAAC4H,UAAU,CAACrI,OAAO,CAAC,EAAE;IAC9B;IACA,MAAMsI,OAAO,GAAG7H,iBAAM,CAAC8H,MAAM,CAACvI,OAAO,CAAC;IACtC,IAAIsI,OAAO,EAAE;MACX,OAAOA,OAAO,CAACtI,OAAO;IACxB;EACF;EACA,IAAI,IAAAoI,0BAAM,EAACpI,OAAO,CAAC,EAAE;IACnB,OAAOA,OAAO;EAChB;EACA;EACA,OAAO,IAAI;AACb","ignoreList":[]}
1
+ {"version":3,"names":["path","data","_interopRequireWildcard","require","_fsExtra","_interopRequireDefault","_semver","_componentVersion","_lodash","_componentIssues","_legacy","_legacy2","_legacy3","_toolboxFs","_legacy4","_componentPackageVersion","_filesDependencyBuilder","_packageToDefinetlyTyped","_dependenciesData","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","AutoDetectDeps","constructor","component","workspace","devFiles","depsResolver","aspectLoader","componentId","componentMap","componentFromModel","consumerPath","consumer","getPath","allDependencies","dependencies","devDependencies","peerDependencies","allPackagesDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","processedFiles","issues","debugDependenciesData","components","setTree","tree","getDependenciesData","cacheResolvedDependencies","cacheProjectAst","componentDir","join","rootDir","nonTestsFiles","testsFiles","getFilesGroupedByBeingTests","allFiles","envDetectors","getEnvDetectors","dependenciesTree","getDependencyTree","workspacePath","filePaths","visited","length","populateDependencies","envExtendsDeps","getDevFilesForConsumerComp","dependenciesData","DependenciesData","coreAspects","calcComponentEnvDepDetectors","extensions","files","forEach","file","fileType","isTestFile","includes","throwForNonExistFile","processCoreAspects","processMissing","processErrors","processPackages","processComponents","processDepFiles","processUnidentifiedPackages","Error","getComponentIdByResolvedPackageData","bit","getComponentIdByDepFile","depFile","depFileRelative","destination","rootDirFullPath","fullDepFile","resolve","pathNormalizeToLinux","relative","bitMap","getComponentIdByPath","originFile","nested","push","allDepsFiles","isEmpty","isDepFileUntracked","processOneDepFile","importSpecifiers","dummyFileType","depFileObject","importSource","_pushToUntrackDependenciesIssues","isEqual","ignoreVersion","endsWith","getOrCreate","IssuesClasses","ImportFromDirectory","depComponentMap","getComponentIfExist","depRootDir","undefined","destinationRelativePath","startsWith","pathRelativeLinux","sourceRelativePath","depsPaths","importSpecifier","mainFile","exported","currentComponentsDeps","Dependency","_pushToRelativeComponentsAuthoredIssues","existingDependency","getExistingDependency","existingDepRelativePaths","getExistingDepRelativePaths","relativePaths","nonExistingImportSpecifiers","getDiffSpecifiers","depDebug","id","pushToDependenciesArray","compDep","SelfReference","name","dependencyPackageJsonPath","packageJsonPath","dependentPackageJsonPath","componentIdResolvedFrom","packageName","getVersionFromPkgJson","versionFromDependencyPkgJson","getValidVersion","concreteVersion","versionResolvedFrom","versionFromDependentPkgJson","versionUsedByDependent","version","changeVersion","existingId","addImportNonMainIssueIfNeeded","isPeer","packageJsonContent","peer","peerVersionRange","defaultPeerRange","semver","valid","_pushToDependenciesIfNotExist","isPkgInWorkspacePolicies","pkgName","getWorkspacePolicyManifest","filePath","dependencyPkgData","depMain","main","depFullPath","fullPath","extDisallowNonMain","extname","pkgRootDir","dirname","fs","existsSync","DEFAULT_DIST_DIRNAME","nonMainFileSplit","split","nonMainFileShort","ImportNonMainFiles","packages","modelDeps","getAllPackageDependencies","keys","packageNames","concat","missing","_addTypesPackagesForTypeScript","assign","processMissingFiles","missingFiles","filter","hasExtension","Boolean","rootDirAbs","toAbsolutePath","filePathAbs","relativeToCompDir","relativeToCompDirWithoutExt","removeFileExtension","compFilesWithoutExt","getAllFilesPaths","map","f","existWithDifferentExt","some","_pushToMissingDependenciesOnFs","processMissingPackages","missingPackages","_pushToMissingPackagesDependenciesIssues","error","logger","errorAndAddBreadCrumb","code","location","lineNumber","column","ParseErrors","message","ResolveErrors","getCoreAspectsPackagesAndIds","coreAspectIds","values","toStringWithoutVersion","coreAspectsPackages","unidentifiedPackages","usedCoreAspects","findMatchingCoreAspect","find","coreAspectName","unidentifiedPackagesFiltered","matchingCoreAspectPackageName","bitsFiltered","packageInfo","uniq","dependency","opts","existingDevDependency","d","isEqualWithoutVersion","relativePath","paths","originSpecifiers","targetSpecifiers","cmp","specifier1","specifier2","differenceWith","isTypeScript","getExt","depsHost","addFromConfig","DEPENDENCIES_FIELDS","depField","typesPackage","packageToDefinetlyTyped","addFromModel","typedPackageFromModel","added","findExisting","result","getIssue","UntrackedDependencies","currentUntracked","found","untrackedFiles","existing","newUntrackedFile","untrackIssue","untrackedCurrentFile","RelativeComponentsAuthored","MissingDependenciesOnFs","MissingPackagesDependenciesOnFs","foundFile","isDevFile","exports","SNAP_VERSION_PREFIX","versionWithoutSnapPrefix","replace","isSnap","validRange","coerced","coerce"],"sources":["auto-detect-deps.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport semver from 'semver';\nimport { isSnap } from '@teambit/component-version';\nimport { ComponentID } from '@teambit/component-id';\nimport { uniq, isEmpty, forEach, differenceWith } from 'lodash';\nimport { IssuesList, IssuesClasses } from '@teambit/component-issues';\nimport {\n Dependency,\n RelativePath,\n ImportSpecifier,\n ConsumerComponent as Component,\n} from '@teambit/legacy.consumer-component';\nimport { DEFAULT_DIST_DIRNAME, DEPENDENCIES_FIELDS } from '@teambit/legacy.constants';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport { getExt } from '@teambit/toolbox.fs.extension-getter';\nimport {\n pathNormalizeToLinux,\n pathRelativeLinux,\n PathLinux,\n PathLinuxRelative,\n PathOsBased,\n removeFileExtension,\n} from '@teambit/legacy.utils';\nimport { ResolvedPackageData } from '../resolve-pkg-data';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\nimport { SNAP_VERSION_PREFIX } from '@teambit/component-package-version';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { getDependencyTree } from '../files-dependency-builder';\nimport { FileObject, DependenciesTree } from '../files-dependency-builder/types/dependency-tree-type';\nimport { DevFilesMain } from '@teambit/dev-files';\nimport { Workspace } from '@teambit/workspace';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { DependencyDetector } from '../files-dependency-builder/detector-hook';\nimport { packageToDefinetlyTyped } from './package-to-definetly-typed';\nimport { DependenciesData } from './dependencies-data';\nimport { AllDependencies, AllPackagesDependencies } from './apply-overrides';\n\nexport type FileType = {\n isTestFile: boolean;\n};\n\nexport type DebugDependencies = {\n components: DebugComponentsDependency[];\n unidentifiedPackages?: string[];\n};\n\nexport type DebugComponentsDependency = {\n id: ComponentID;\n importSource?: string;\n dependencyPackageJsonPath?: string;\n dependentPackageJsonPath?: string;\n // can be resolved here or can be any one of the strategies in dependencies-version-resolver\n versionResolvedFrom?: 'DependencyPkgJson' | 'DependentPkgJson' | 'BitMap' | 'Model' | 'MergeConfig' | string;\n version?: string;\n componentIdResolvedFrom?: 'DependencyPkgJson' | 'DependencyPath';\n packageName?: string;\n};\n\ntype PushToDepsArrayOpts = {\n fileType: FileType;\n depDebug: DebugComponentsDependency;\n isPeer?: boolean;\n};\n\nexport class AutoDetectDeps {\n componentId: ComponentID;\n componentMap: ComponentMap;\n componentFromModel: Component;\n consumerPath: PathOsBased;\n tree: DependenciesTree;\n allDependencies: AllDependencies;\n allPackagesDependencies: AllPackagesDependencies;\n issues: IssuesList;\n coreAspects: string[] = [];\n processedFiles: string[];\n debugDependenciesData: DebugDependencies;\n autoDetectConfigMerge: Record<string, any>;\n constructor(\n private component: Component,\n private workspace: Workspace,\n private devFiles: DevFilesMain,\n private depsResolver: DependencyResolverMain,\n private aspectLoader: AspectLoaderMain\n ) {\n this.componentId = component.componentId;\n // the consumerComponent is coming from the workspace, so it must have the componentMap prop\n this.componentMap = this.component.componentMap as ComponentMap;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.componentFromModel = this.component.componentFromModel;\n this.consumerPath = this.consumer.getPath();\n this.allDependencies = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n this.allPackagesDependencies = {\n packageDependencies: {},\n devPackageDependencies: {},\n peerPackageDependencies: {},\n };\n this.processedFiles = [];\n this.issues = component.issues;\n this.debugDependenciesData = { components: [] };\n }\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n private setTree(tree: DependenciesTree) {\n this.tree = tree;\n // console.log(JSON.stringify(tree, null, 4)); // uncomment to easily watch the tree received from bit-javascript\n }\n\n /**\n * Resolve components and packages dependencies for a component.\n * This method should NOT have any side-effect on the component. the DependenciesLoader class is\n * responsible for saving this data on the component object.\n *\n * The process is as follows:\n * 1) Use the language driver to parse the component files and find for each file its dependencies.\n * 2) The results we get from the driver per file tells us what are the files and packages that depend on our file.\n * and also whether there are missing packages and files.\n * 3) Using the information from the driver, we go over each one of the dependencies files and find its counterpart\n * component. The way how we find it, is by using the bit.map file which has a mapping between the component name and\n * the file paths.\n * 4) If we find a component to the file dependency, we add it to component.dependencies. Otherwise, it's added to\n * component.issues.untrackedDependencies\n * 5) Similarly, when we find the packages dependencies, they are added to component.packageDependencies. Otherwise,\n * they're added to component.issues.missingPackagesDependenciesOnFs\n * 6) In case the driver found a file dependency that is not on the file-system, we add that file to\n * component.issues.missingDependenciesOnFs\n */\n async getDependenciesData(\n cacheResolvedDependencies: Record<string, any>,\n cacheProjectAst: Record<string, any> | undefined\n ): Promise<{ dependenciesData: DependenciesData; debugDependenciesData: DebugDependencies }> {\n const componentDir = path.join(this.consumerPath, this.componentMap.rootDir);\n const { nonTestsFiles, testsFiles } = this.componentMap.getFilesGroupedByBeingTests();\n const allFiles = [...nonTestsFiles, ...testsFiles];\n const envDetectors = await this.getEnvDetectors();\n // find the dependencies (internal files and packages) through automatic dependency resolution\n const dependenciesTree = await getDependencyTree({\n componentDir,\n workspacePath: this.consumerPath,\n filePaths: allFiles,\n visited: cacheResolvedDependencies,\n cacheProjectAst,\n envDetectors,\n });\n // we have the files dependencies, these files should be components that are registered in bit.map. Otherwise,\n // they are referred as \"untracked components\" and the user should add them later on in order to tag\n this.setTree(dependenciesTree.tree);\n if (dependenciesTree.tree['env.jsonc']?.components.length > 0) {\n await this.populateDependencies(['env.jsonc'], []);\n }\n const envExtendsDeps = this.allDependencies.dependencies.length\n ? this.allDependencies.dependencies\n : this.component.componentFromModel?.dependencies.dependencies;\n const devFiles = await this.devFiles.getDevFilesForConsumerComp(this.component, envExtendsDeps);\n await this.populateDependencies(allFiles, devFiles);\n return {\n dependenciesData: new DependenciesData(\n this.allDependencies,\n this.allPackagesDependencies,\n this.issues,\n this.coreAspects\n ),\n debugDependenciesData: this.debugDependenciesData,\n };\n }\n\n async getEnvDetectors(): Promise<DependencyDetector[] | null> {\n return this.depsResolver.calcComponentEnvDepDetectors(this.component.extensions);\n }\n\n /**\n * Given the tree of file dependencies from the driver, find the components of these files.\n * Each dependency file has a path, use bit.map to search for the component name by that path.\n * If the component is found, add it to \"this.allDependencies.dependencies\". Otherwise, add it to \"this.issues.untrackedDependencies\".\n *\n * For the found components, add their sourceRelativePath and destinationRelativePath, they are being used for\n * generating links upon import:\n * sourceRelativePath - location of the link file.\n * destinationRelativePath - destination written inside the link file.\n *\n * When a dependency is found in a regular (implementation) file, it goes to `dependencies`. If\n * it found on a test file, it goes to `devDependencies`.\n * Similarly, when a package is found in a regular file, it goes to `packageDependencies`. When\n * if found in a test file, it goes to `devPackageDependencies`.\n * An exception for the above is when a package is required in a regular or test file but is also\n * mentioned in the `package.json` file as a peerDependency, in that case, the package is added\n * to `peerPackageDependencies` and removed from other places. Unless this package is overridden\n * and marked as ignored in the consumer or component config file.\n */\n private async populateDependencies(files: string[], testsFiles: string[]) {\n files.forEach((file) => {\n const fileType: FileType = {\n isTestFile: testsFiles.includes(file),\n };\n this.throwForNonExistFile(file);\n this.processCoreAspects(file);\n this.processMissing(file, fileType);\n this.processErrors(file);\n this.processPackages(file, fileType);\n this.processComponents(file, fileType);\n this.processDepFiles(file, fileType);\n this.processUnidentifiedPackages(file);\n });\n }\n\n private throwForNonExistFile(file: string) {\n if (!this.tree[file]) {\n throw new Error(\n `DependencyResolver: a file \"${file}\" was not returned from the driver, its dependencies are unknown`\n );\n }\n }\n\n private getComponentIdByResolvedPackageData(bit: ResolvedPackageData): ComponentID {\n if (!bit.componentId) {\n throw new Error(`resolved Bit component must have componentId prop in the package.json file`);\n }\n return bit.componentId;\n }\n\n /**\n * this happens when using relative paths between components, which is allowed on Legacy only.\n * on Harmony, during the execution of this function, it recognizes the use of relative-paths, enter\n * it to the \"issues\", then, later, it shows a warning on bit-status and block tagging.\n */\n private getComponentIdByDepFile(depFile: PathLinux): {\n componentId: ComponentID | undefined;\n depFileRelative: PathLinux;\n destination: string | null | undefined;\n } {\n let depFileRelative: PathLinux = depFile; // dependency file path relative to consumer root\n let destination: string | null | undefined;\n const rootDir = this.componentMap.rootDir;\n // The depFileRelative is relative to rootDir, change it to be relative to current consumer.\n // We can't use path.resolve(rootDir, fileDep) because this might not work when running\n // bit commands not from root, because resolve take by default the process.cwd\n const rootDirFullPath = path.join(this.consumerPath, rootDir);\n const fullDepFile = path.resolve(rootDirFullPath, depFile);\n depFileRelative = pathNormalizeToLinux(path.relative(this.consumerPath, fullDepFile));\n\n const componentId = this.consumer.bitMap.getComponentIdByPath(depFileRelative);\n\n return { componentId, depFileRelative, destination };\n }\n\n private processDepFiles(originFile: PathLinuxRelative, fileType: FileType, nested = false) {\n // We don't just return because different files of the component might import different things from the depFile\n // See more info here: https://github.com/teambit/bit/issues/1796\n if (!this.processedFiles.includes(originFile)) {\n this.processedFiles.push(originFile);\n // We don't want to calculate nested files again after they calculated as direct files\n } else if (nested) {\n return;\n }\n const allDepsFiles = this.tree[originFile].files;\n if (!allDepsFiles || isEmpty(allDepsFiles)) return;\n allDepsFiles.forEach((depFile: FileObject) => {\n const isDepFileUntracked = this.processOneDepFile(\n originFile,\n depFile.file,\n depFile.importSpecifiers,\n fileType,\n depFile,\n nested\n );\n // Only continue recursively if the dep file is untracked\n // for tracked deps if they have untracked deps they will be shown under their own components\n if (isDepFileUntracked) {\n // Recursively check for untracked files (to show them all in bit status)\n // for nested files we don't really care about the file types since we won't do all the checking\n const dummyFileType: FileType = {\n isTestFile: false,\n };\n this.processDepFiles(depFile.file, dummyFileType, true);\n }\n });\n }\n\n // return true if the dep file is untracked\n private processOneDepFile(\n originFile: PathLinuxRelative,\n depFile: string,\n importSpecifiers: ImportSpecifier[] | undefined,\n fileType: FileType,\n depFileObject: FileObject,\n nested = false\n ): boolean {\n const { componentId, depFileRelative, destination } = this.getComponentIdByDepFile(depFile);\n const importSource: string = depFileObject.importSource as string;\n // the file dependency doesn't have any counterpart component. Add it to this.issues.untrackedDependencies\n if (!componentId) {\n this._pushToUntrackDependenciesIssues(originFile, depFileRelative, nested);\n return true;\n }\n // happens when in the same component one file requires another one. In this case, there is\n // noting to do regarding the dependencies\n if (componentId.isEqual(this.componentId, { ignoreVersion: true })) {\n if (importSource === '.' || importSource.endsWith('/..')) {\n (this.issues.getOrCreate(IssuesClasses.ImportFromDirectory).data[originFile] ||= []).push(importSource);\n }\n return false;\n }\n\n const depComponentMap = this.consumer.bitMap.getComponentIfExist(componentId);\n // found a dependency component. Add it to this.allDependencies.dependencies\n const depRootDir = depComponentMap ? depComponentMap.rootDir : undefined;\n const destinationRelativePath =\n destination ||\n (depRootDir && depFileRelative.startsWith(depRootDir)\n ? pathRelativeLinux(depRootDir, depFileRelative)\n : depFileRelative);\n\n // when there is no rootDir for the current dependency (it happens when it's AUTHORED), keep the original path\n const sourceRelativePath = depRootDir ? depFileRelative : depFile;\n\n const depsPaths: RelativePath = {\n sourceRelativePath,\n destinationRelativePath,\n };\n if (importSpecifiers) {\n importSpecifiers.forEach((importSpecifier) => {\n if (importSpecifier.mainFile) delete importSpecifier.mainFile.exported;\n });\n depsPaths.importSpecifiers = importSpecifiers;\n }\n const currentComponentsDeps = new Dependency(componentId, [depsPaths]);\n this._pushToRelativeComponentsAuthoredIssues(originFile, componentId, importSource, depsPaths);\n\n const allDependencies: Dependency[] = [\n ...this.allDependencies.dependencies,\n ...this.allDependencies.devDependencies,\n ];\n const existingDependency = this.getExistingDependency(allDependencies, componentId);\n if (existingDependency) {\n const existingDepRelativePaths = this.getExistingDepRelativePaths(existingDependency, depsPaths);\n if (!existingDepRelativePaths) {\n // it is another file of an already existing component. Just add the new path\n existingDependency.relativePaths.push(depsPaths);\n return false;\n }\n // The dep path already exists but maybe this dep-file has more importSpecifiers\n if (depsPaths.importSpecifiers) {\n // add them to the existing dep\n if (!existingDepRelativePaths.importSpecifiers) {\n existingDepRelativePaths.importSpecifiers = [...depsPaths.importSpecifiers];\n } else {\n // both have importSpecifiers\n const nonExistingImportSpecifiers = this.getDiffSpecifiers(\n existingDepRelativePaths.importSpecifiers,\n depsPaths.importSpecifiers\n );\n existingDepRelativePaths.importSpecifiers.push(...nonExistingImportSpecifiers);\n }\n }\n\n if (depsPaths.importSource && !existingDepRelativePaths.importSource) {\n existingDepRelativePaths.importSource = depsPaths.importSource;\n }\n } else {\n const depDebug: DebugComponentsDependency = {\n id: currentComponentsDeps.id,\n importSource,\n };\n this.pushToDependenciesArray(currentComponentsDeps, { fileType, depDebug });\n }\n return false;\n }\n\n /**\n * process require/import of Bit components where the require statement is not a relative path\n * but a module path, such as `require('@bit/bit.envs/compiler/babel');`\n */\n private processComponents(originFile: PathLinuxRelative, fileType: FileType) {\n const components = this.tree[originFile].components;\n if (!components || isEmpty(components)) return;\n components.forEach((compDep) => {\n let componentId = this.getComponentIdByResolvedPackageData(compDep);\n if (componentId.isEqual(this.componentId)) {\n this.issues.getOrCreate(IssuesClasses.SelfReference).data[originFile] = compDep.name;\n // the component is importing itself, so ignore it. although currently it doesn't cause any issues, (probably\n // because it filtered out later), it's better to remove it as soon as possible, for less-confusing debugging.\n return;\n }\n const depDebug: DebugComponentsDependency = {\n id: componentId,\n dependencyPackageJsonPath: compDep.packageJsonPath,\n dependentPackageJsonPath: compDep.dependentPackageJsonPath,\n componentIdResolvedFrom: 'DependencyPkgJson',\n packageName: compDep.name,\n };\n if (originFile === 'env.jsonc') {\n depDebug.importSource = 'env.jsonc';\n }\n const getVersionFromPkgJson = (): string | null => {\n const versionFromDependencyPkgJson = getValidVersion(compDep.concreteVersion);\n if (versionFromDependencyPkgJson) {\n depDebug.versionResolvedFrom = 'DependencyPkgJson';\n return versionFromDependencyPkgJson;\n }\n const versionFromDependentPkgJson = getValidVersion(compDep.versionUsedByDependent);\n if (versionFromDependentPkgJson) {\n depDebug.versionResolvedFrom = 'DependentPkgJson';\n return versionFromDependentPkgJson;\n }\n return null;\n };\n const version = getVersionFromPkgJson();\n if (version) {\n componentId = componentId.changeVersion(version);\n }\n const existingId = componentId;\n if (existingId.isEqual(this.componentId)) {\n // happens when one of the component files requires another using module path\n // no need to enter anything to the dependencies\n return;\n }\n this.addImportNonMainIssueIfNeeded(originFile, compDep);\n const isPeer = compDep.packageJsonContent?.bit?.peer;\n let peerVersionRange: string | undefined;\n if (isPeer) {\n const defaultPeerRange = compDep.packageJsonContent?.bit?.defaultPeerRange;\n if (!defaultPeerRange) {\n peerVersionRange = '*';\n } else if (['~', '^', '>='].includes(defaultPeerRange)) {\n if (semver.valid(compDep.concreteVersion)) {\n peerVersionRange = `${defaultPeerRange}${compDep.concreteVersion}`;\n } else {\n peerVersionRange = `${defaultPeerRange}0.0.0-${compDep.concreteVersion}`;\n }\n } else {\n peerVersionRange = defaultPeerRange;\n }\n }\n const currentComponentsDeps = new Dependency(existingId, [], compDep.name, peerVersionRange);\n this._pushToDependenciesIfNotExist(currentComponentsDeps, {\n fileType,\n depDebug,\n isPeer,\n });\n });\n }\n\n private isPkgInWorkspacePolicies(pkgName: string) {\n return this.depsResolver.getWorkspacePolicyManifest().dependencies?.[pkgName];\n }\n\n private addImportNonMainIssueIfNeeded(filePath: PathLinuxRelative, dependencyPkgData: ResolvedPackageData) {\n const depMain: PathLinuxRelative | undefined = dependencyPkgData.packageJsonContent?.main;\n if (!depMain) {\n return;\n }\n const depFullPath = pathNormalizeToLinux(dependencyPkgData.fullPath);\n\n if (depFullPath.endsWith(depMain)) {\n // it requires the main-file. all is good.\n return;\n }\n const extDisallowNonMain = ['.ts', '.tsx', '.js', '.jsx'];\n if (!extDisallowNonMain.includes(path.extname(depFullPath))) {\n // some files such as scss/json are needed to be imported as non-main\n return;\n }\n const pkgRootDir = dependencyPkgData.packageJsonPath && path.dirname(dependencyPkgData.packageJsonPath);\n if (pkgRootDir && !fs.existsSync(path.join(pkgRootDir, DEFAULT_DIST_DIRNAME))) {\n // the dependency wasn't compiled yet. the issue is probably because depMain points to the dist\n // and depFullPath is in the source.\n return;\n }\n const nonMainFileSplit = depFullPath.split(`node_modules/`);\n const nonMainFileShort = nonMainFileSplit[1] || nonMainFileSplit[0];\n if (nonMainFileShort.includes('eslintrc')) {\n // a temporary workaround for envs that don't expose eslintrc config in their index file.\n // this is needed for a future change of detecting require.resolve syntax\n return;\n }\n (this.issues.getOrCreate(IssuesClasses.ImportNonMainFiles).data[filePath] ||= []).push(nonMainFileShort);\n }\n\n private processPackages(originFile: PathLinuxRelative, fileType: FileType) {\n const packages = this.tree[originFile].packages;\n if (this.componentFromModel) {\n const modelDeps = this.componentFromModel.getAllPackageDependencies();\n // If a package is not in the policies, then we resolve the package from the model.\n for (const pkgName of Object.keys(packages)) {\n if (!this.isPkgInWorkspacePolicies(pkgName) && modelDeps[pkgName]) {\n packages[pkgName] = modelDeps[pkgName];\n }\n }\n }\n const packageNames = Object.keys(packages).concat(this.tree[originFile].missing?.packages ?? []);\n this._addTypesPackagesForTypeScript(packageNames, originFile);\n if (!packages || isEmpty(packages)) return;\n if (fileType.isTestFile) {\n Object.assign(this.allPackagesDependencies.devPackageDependencies, packages);\n } else {\n Object.assign(this.allPackagesDependencies.packageDependencies, packages);\n }\n }\n\n private processMissing(originFile: PathLinuxRelative, fileType: FileType) {\n const missing = this.tree[originFile].missing;\n if (!missing) return;\n const processMissingFiles = () => {\n if (isEmpty(missing.files)) return;\n const missingFiles = missing.files.filter((file) => {\n const hasExtension = Boolean(path.extname(file));\n if (!hasExtension) return true;\n // the missing file has extension, e.g. \"index.js\". It's possible that this file doesn't exist in the source\n // but will be available in the dists. so if found same filename without the extension, we assume it's fine.\n const rootDirAbs = this.consumer.toAbsolutePath(this.componentMap.rootDir);\n const filePathAbs = path.resolve(rootDirAbs, file);\n const relativeToCompDir = path.relative(rootDirAbs, filePathAbs);\n const relativeToCompDirWithoutExt = removeFileExtension(relativeToCompDir);\n const compFilesWithoutExt = this.componentMap.getAllFilesPaths().map((f) => removeFileExtension(f));\n const existWithDifferentExt = compFilesWithoutExt.some((f) => f === relativeToCompDirWithoutExt);\n return !existWithDifferentExt;\n });\n if (isEmpty(missingFiles)) return;\n this._pushToMissingDependenciesOnFs(originFile, missingFiles);\n };\n const processMissingPackages = () => {\n if (isEmpty(missing.packages)) return;\n const missingPackages = missing.packages;\n if (!isEmpty(missingPackages)) {\n this._pushToMissingPackagesDependenciesIssues(originFile, missingPackages, fileType);\n }\n };\n processMissingFiles();\n processMissingPackages();\n }\n\n private processErrors(originFile: PathLinuxRelative) {\n const error: any = this.tree[originFile].error;\n if (!error) return;\n logger.errorAndAddBreadCrumb(\n 'dependency-resolver.processErrors',\n `got an error from the driver while resolving dependencies from \"${originFile}\"`\n );\n logger.error('dependency-resolver.processErrors', error);\n if (error.code === 'PARSING_ERROR') {\n const location = error.lineNumber && error.column ? ` (line: ${error.lineNumber}, column: ${error.column})` : '';\n this.issues.getOrCreate(IssuesClasses.ParseErrors).data[originFile] = error.message + location;\n } else this.issues.getOrCreate(IssuesClasses.ResolveErrors).data[originFile] = error.message;\n }\n\n /**\n * when a user uses core-extensions these core-extensions should not be dependencies.\n * here, we filter them out from all places they could entered as dependencies.\n * an exception is when running this method on bit-core-extensions themselves (dogfooding), in\n * which case we recognizes that the current originFile is a core-extension and avoid filtering.\n */\n private processCoreAspects(originFile: PathLinuxRelative) {\n const coreAspects = this.aspectLoader.getCoreAspectsPackagesAndIds();\n\n // const scopes = coreAspects.map((id) => {\n // const id = id.split()\n // });\n\n const coreAspectIds = Object.values(coreAspects);\n if (coreAspectIds.includes(this.component.id.toStringWithoutVersion())) {\n return;\n }\n\n const coreAspectsPackages = Object.keys(coreAspects);\n\n const components = this.tree[originFile].components;\n const unidentifiedPackages = this.tree[originFile].unidentifiedPackages;\n const usedCoreAspects: string[] = [];\n\n const findMatchingCoreAspect = (packageName: string) => {\n return coreAspectsPackages.find((coreAspectName) => packageName === coreAspectName);\n };\n const unidentifiedPackagesFiltered = unidentifiedPackages?.filter((packageName) => {\n const matchingCoreAspectPackageName = findMatchingCoreAspect(packageName);\n if (matchingCoreAspectPackageName) {\n usedCoreAspects.push(coreAspects[matchingCoreAspectPackageName]);\n }\n return !matchingCoreAspectPackageName;\n });\n const bitsFiltered = components?.filter((packageInfo) => {\n const matchingCoreAspectPackageName = findMatchingCoreAspect(packageInfo.name);\n if (matchingCoreAspectPackageName) {\n usedCoreAspects.push(coreAspects[matchingCoreAspectPackageName]);\n }\n return !matchingCoreAspectPackageName;\n });\n\n this.tree[originFile].unidentifiedPackages = unidentifiedPackagesFiltered;\n this.tree[originFile].components = bitsFiltered;\n this.coreAspects.push(...uniq(usedCoreAspects));\n }\n\n /**\n * ** LEGACY ONLY **\n * This is related to a legacy feature \"custom-module-resolution\". the code was removed, only the debug is still there, just in case.\n *\n * ** OLD COMMENT **\n * currently the only unidentified packages being process are the ones coming from custom-modules-resolution.\n * assuming the author used custom-resolution, which enable using non-relative import syntax,\n * for example, requiring the file 'src/utils/is-string' from anywhere as require('utils/is-string');\n * now, when the component is imported, the driver recognizes 'utils/is-string' as a package,\n * because it's not relative.\n * the goal here is to use the 'package' the driver found and match it with one of the\n * dependencies from the model. In the example above, we might find in the model, a dependency\n * is-string with importSource of 'utils/is-string'.\n * Once a match is found, copy the relativePaths from the model.\n *\n * keep in mind that this custom-modules-resolution supported on legacy components only.\n * as such, no need to find the packageName to pass to _pushToDependenciesIfNotExist method.\n */\n private processUnidentifiedPackages(originFile: PathLinuxRelative) {\n const unidentifiedPackages = this.tree[originFile].unidentifiedPackages;\n if (!unidentifiedPackages || !unidentifiedPackages.length) return;\n this.debugDependenciesData.unidentifiedPackages = unidentifiedPackages;\n }\n\n private _pushToDependenciesIfNotExist(dependency: Dependency, opts: PushToDepsArrayOpts) {\n const existingDependency = this.getExistingDependency(this.allDependencies.dependencies, dependency.id);\n const existingDevDependency = this.getExistingDependency(this.allDependencies.devDependencies, dependency.id);\n // no need to enter dev dependency to devDependencies if it exists already in dependencies\n if (existingDependency || (existingDevDependency && opts.fileType.isTestFile)) {\n return;\n }\n // at this point, either, it doesn't exist at all and should be entered.\n // or it exists in devDependencies but now it comes from non-dev file, which should be entered\n // as non-dev.\n this.pushToDependenciesArray(dependency, opts);\n }\n\n private pushToDependenciesArray(currentComponentsDeps: Dependency, opts: PushToDepsArrayOpts) {\n if (opts.fileType.isTestFile) {\n this.allDependencies.devDependencies.push(currentComponentsDeps);\n } else if (opts.isPeer) {\n this.allDependencies.peerDependencies.push(currentComponentsDeps);\n } else {\n this.allDependencies.dependencies.push(currentComponentsDeps);\n }\n this.debugDependenciesData.components.push(opts.depDebug);\n }\n\n private getExistingDependency(dependencies: Dependency[], id: ComponentID): Dependency | null | undefined {\n return dependencies.find((d) => d.id.isEqualWithoutVersion(id));\n }\n\n private getExistingDepRelativePaths(dependency: Dependency, relativePath: RelativePath) {\n if (!dependency.relativePaths || isEmpty(dependency.relativePaths)) return null;\n return dependency.relativePaths.find(\n (paths) =>\n paths.sourceRelativePath === relativePath.sourceRelativePath &&\n paths.destinationRelativePath === relativePath.destinationRelativePath\n );\n }\n\n private getDiffSpecifiers(originSpecifiers: ImportSpecifier[], targetSpecifiers: ImportSpecifier[]) {\n const cmp = (specifier1, specifier2) => specifier1.mainFile.name === specifier2.mainFile.name;\n return differenceWith(targetSpecifiers, originSpecifiers, cmp);\n }\n\n /**\n * when requiring packages in typescript, sometimes there are the types packages with the same\n * name, which the user probably wants as well. for example, requiring `foo` package, will also\n * add `@types/foo` to the devDependencies if it has been found in the user `package.json` file.\n *\n * ideally this should be in bit-javascript. however, the decision where to put these `@types`\n * packages (dependencies/devDependencies) is done here according to the user `package.json`\n * and can't be done there because the `Tree` we get from bit-javascript doesn't have this\n * distinction.\n */\n private _addTypesPackagesForTypeScript(packageNames: string[], originFile: PathLinuxRelative): void {\n if (packageNames.length === 0) return;\n const isTypeScript = getExt(originFile) === 'ts' || getExt(originFile) === 'tsx';\n if (!isTypeScript) return;\n const depsHost = this.depsResolver.getWorkspacePolicyManifest();\n const addFromConfig = (packageName: string): boolean => {\n if (!depsHost) return false;\n return DEPENDENCIES_FIELDS.some((depField) => {\n if (!depsHost[depField]) return false;\n const typesPackage = packageToDefinetlyTyped(packageName);\n if (!depsHost[depField][typesPackage]) return false;\n Object.assign(this.allPackagesDependencies.devPackageDependencies, {\n [typesPackage]: depsHost[depField][typesPackage],\n });\n return true;\n });\n };\n const addFromModel = (packageName: string) => {\n if (!this.componentFromModel) return;\n const typesPackage = packageToDefinetlyTyped(packageName);\n const typedPackageFromModel = this.componentFromModel.devPackageDependencies[typesPackage];\n if (!typedPackageFromModel) return;\n Object.assign(this.allPackagesDependencies.devPackageDependencies, {\n [typesPackage]: typedPackageFromModel,\n });\n };\n\n packageNames.forEach((packageName) => {\n const added = addFromConfig(packageName);\n if (!added) addFromModel(packageName);\n });\n }\n\n private _pushToUntrackDependenciesIssues(originFile: PathLinuxRelative, depFileRelative, nested = false) {\n const findExisting = () => {\n let result;\n forEach(this.issues.getIssue(IssuesClasses.UntrackedDependencies)?.data || {}, (currentUntracked) => {\n const found = currentUntracked.untrackedFiles.find((file) => {\n return file.relativePath === depFileRelative;\n });\n if (found) {\n result = found;\n }\n });\n return result;\n };\n const existing = findExisting();\n const newUntrackedFile = { relativePath: depFileRelative, existing: false };\n // If it's already found mark them both as existing\n if (existing) {\n newUntrackedFile.existing = true;\n existing.existing = true;\n }\n const untrackIssue = this.issues.getOrCreate(IssuesClasses.UntrackedDependencies);\n const untrackedCurrentFile = untrackIssue?.data[originFile];\n if (untrackedCurrentFile) {\n untrackedCurrentFile.untrackedFiles.push(newUntrackedFile);\n } else {\n untrackIssue.data[originFile] = { nested, untrackedFiles: [newUntrackedFile] };\n }\n }\n private _pushToRelativeComponentsAuthoredIssues(\n originFile,\n componentId: ComponentID,\n importSource: string,\n relativePath: RelativePath\n ) {\n (this.issues.getOrCreate(IssuesClasses.RelativeComponentsAuthored).data[originFile] ||= []).push({\n importSource,\n componentId,\n relativePath,\n });\n }\n private _pushToMissingDependenciesOnFs(originFile: PathLinuxRelative, missingFiles: string[]) {\n (this.issues.getOrCreate(IssuesClasses.MissingDependenciesOnFs).data[originFile] ||= []).push(...missingFiles);\n }\n private _pushToMissingPackagesDependenciesIssues(\n originFile: PathLinuxRelative,\n missingPackages: string[],\n fileType: FileType\n ) {\n const data = this.issues.getOrCreate(IssuesClasses.MissingPackagesDependenciesOnFs).data;\n const foundFile = data.find((file) => file.filePath === originFile);\n if (foundFile) {\n foundFile.missingPackages = uniq([...missingPackages, ...foundFile.missingPackages]);\n } else {\n data.push({ filePath: originFile, missingPackages, isDevFile: fileType.isTestFile });\n }\n }\n}\n\nexport function getValidVersion(version: string | undefined) {\n if (!version) {\n return null;\n }\n if (version.startsWith(SNAP_VERSION_PREFIX)) {\n const versionWithoutSnapPrefix = version.replace(SNAP_VERSION_PREFIX, '');\n if (isSnap(versionWithoutSnapPrefix)) {\n return versionWithoutSnapPrefix;\n }\n }\n if (semver.valid(version)) {\n // this takes care of pre-releases as well, as they're considered valid semver.\n return version;\n }\n if (semver.validRange(version)) {\n // if this is a range, e.g. ^1.0.0, return a valid version: 1.0.0.\n const coerced = semver.coerce(version);\n if (coerced) {\n return coerced.version;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AAS,CAACjE,eAAe,GAAG,IAAA0B,cAAI,EAAC,CAAC,GAAG1B,eAAe,EAAE,GAAGiE,SAAS,CAACjE,eAAe,CAAC,CAAC;IACtF,CAAC,MAAM;MACLzP,IAAI,CAACqI,IAAI,CAAC;QAAEuE,QAAQ,EAAEzE,UAAU;QAAEsH,eAAe;QAAEkE,SAAS,EAAEjN,QAAQ,CAACC;MAAW,CAAC,CAAC;IACtF;EACF;AACF;AAACiN,OAAA,CAAA1Q,cAAA,GAAAA,cAAA;AAEM,SAASsI,eAAeA,CAACK,OAA2B,EAAE;EAC3D,IAAI,CAACA,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EACA,IAAIA,OAAO,CAACnC,UAAU,CAACmK,8CAAmB,CAAC,EAAE;IAC3C,MAAMC,wBAAwB,GAAGjI,OAAO,CAACkI,OAAO,CAACF,8CAAmB,EAAE,EAAE,CAAC;IACzE,IAAI,IAAAG,0BAAM,EAACF,wBAAwB,CAAC,EAAE;MACpC,OAAOA,wBAAwB;IACjC;EACF;EACA,IAAIxH,iBAAM,CAACC,KAAK,CAACV,OAAO,CAAC,EAAE;IACzB;IACA,OAAOA,OAAO;EAChB;EACA,IAAIS,iBAAM,CAAC2H,UAAU,CAACpI,OAAO,CAAC,EAAE;IAC9B;IACA,MAAMqI,OAAO,GAAG5H,iBAAM,CAAC6H,MAAM,CAACtI,OAAO,CAAC;IACtC,IAAIqI,OAAO,EAAE;MACX,OAAOA,OAAO,CAACrI,OAAO;IACxB;EACF;EACA,IAAI,IAAAmI,0BAAM,EAACnI,OAAO,CAAC,EAAE;IACnB,OAAOA,OAAO;EAChB;EACA;EACA,OAAO,IAAI;AACb","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/dependencies",
3
- "version": "1.0.494",
3
+ "version": "1.0.495",
4
4
  "homepage": "https://bit.cloud/teambit/dependencies/dependencies",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.dependencies",
8
8
  "name": "dependencies",
9
- "version": "1.0.494"
9
+ "version": "1.0.495"
10
10
  },
11
11
  "dependencies": {
12
12
  "archy": "1.0.0",
@@ -38,27 +38,28 @@
38
38
  "@teambit/styling.deps-detectors.detective-sass": "0.0.9",
39
39
  "@teambit/styling.deps-detectors.detective-scss": "0.0.9",
40
40
  "@teambit/typescript.deps-detectors.detective-typescript": "0.0.8",
41
- "@teambit/cli": "0.0.1071",
42
- "@teambit/graph": "1.0.494",
41
+ "@teambit/cli": "0.0.1072",
42
+ "@teambit/graph": "1.0.495",
43
43
  "@teambit/legacy.constants": "0.0.3",
44
- "@teambit/aspect-loader": "1.0.494",
44
+ "@teambit/aspect-loader": "1.0.495",
45
45
  "@teambit/component-package-version": "0.0.434",
46
- "@teambit/dependency-resolver": "1.0.494",
47
- "@teambit/dev-files": "1.0.494",
48
- "@teambit/legacy.consumer-component": "0.0.7",
49
- "@teambit/logger": "0.0.1164",
50
- "@teambit/scope": "1.0.494",
51
- "@teambit/workspace": "1.0.494",
52
- "@teambit/legacy.consumer": "0.0.6",
53
- "@teambit/legacy.dependency-graph": "0.0.9",
54
- "@teambit/component.sources": "0.0.58",
46
+ "@teambit/dependency-resolver": "1.0.495",
47
+ "@teambit/dev-files": "1.0.495",
48
+ "@teambit/legacy.consumer-component": "0.0.8",
49
+ "@teambit/logger": "0.0.1165",
50
+ "@teambit/scope": "1.0.495",
51
+ "@teambit/workspace": "1.0.495",
52
+ "@teambit/legacy.consumer": "0.0.7",
53
+ "@teambit/legacy.dependency-graph": "0.0.10",
54
+ "@teambit/component.sources": "0.0.59",
55
55
  "@teambit/legacy.utils": "0.0.11",
56
56
  "@teambit/toolbox.path.path": "0.0.5",
57
57
  "@teambit/component-issues": "0.0.152",
58
- "@teambit/legacy.bit-map": "0.0.63",
58
+ "@teambit/legacy.bit-map": "0.0.64",
59
+ "@teambit/legacy.consumer-config": "0.0.7",
59
60
  "@teambit/legacy.logger": "0.0.4",
60
61
  "@teambit/toolbox.fs.extension-getter": "0.0.2",
61
- "@teambit/legacy.extension-data": "0.0.8",
62
+ "@teambit/legacy.extension-data": "0.0.9",
62
63
  "@teambit/toolbox.fs.last-modified": "0.0.2"
63
64
  },
64
65
  "devDependencies": {
@@ -72,9 +73,9 @@
72
73
  "@types/mocha": "9.1.0",
73
74
  "@teambit/defender.fs.global-bit-temp-dir": "0.0.1",
74
75
  "@teambit/harmony.envs.core-aspect-env": "0.0.63",
75
- "@teambit/component.testing.mock-components": "0.0.265",
76
- "@teambit/harmony.testing.load-aspect": "0.0.260",
77
- "@teambit/workspace.testing.mock-workspace": "0.0.33"
76
+ "@teambit/component.testing.mock-components": "0.0.266",
77
+ "@teambit/harmony.testing.load-aspect": "0.0.261",
78
+ "@teambit/workspace.testing.mock-workspace": "0.0.34"
78
79
  },
79
80
  "peerDependencies": {
80
81
  "@types/chai": "4.3.19"