@teambit/dependencies 1.0.330 → 1.0.331
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +203 -5
- package/artifacts/schema.json +2016 -1173
- package/dependencies-loader/apply-overrides.ts +3 -3
- package/dependencies-loader/auto-detect-deps.ts +16 -13
- package/dependencies-loader/dependencies-loader.ts +1 -1
- package/dist/dependencies-loader/apply-overrides.js +12 -5
- package/dist/dependencies-loader/apply-overrides.js.map +1 -1
- package/dist/dependencies-loader/auto-detect-deps.d.ts +4 -4
- package/dist/dependencies-loader/auto-detect-deps.js +14 -14
- package/dist/dependencies-loader/auto-detect-deps.js.map +1 -1
- package/dist/dependencies-loader/dependencies-loader.js +4 -4
- package/dist/dependencies-loader/dependencies-loader.js.map +1 -1
- package/dist/files-dependency-builder/build-tree.d.ts +11 -0
- package/dist/files-dependency-builder/build-tree.js +233 -0
- package/dist/files-dependency-builder/build-tree.js.map +1 -0
- package/dist/files-dependency-builder/build-tree.spec.d.ts +1 -0
- package/dist/files-dependency-builder/build-tree.spec.js +154 -0
- package/dist/files-dependency-builder/build-tree.spec.js.map +1 -0
- package/dist/files-dependency-builder/dependency-tree/Config.d.ts +4 -0
- package/dist/files-dependency-builder/dependency-tree/Config.js +74 -0
- package/dist/files-dependency-builder/dependency-tree/Config.js.map +1 -0
- package/dist/files-dependency-builder/dependency-tree/index.d.ts +15 -0
- package/dist/files-dependency-builder/dependency-tree/index.js +272 -0
- package/dist/files-dependency-builder/dependency-tree/index.js.map +1 -0
- package/dist/files-dependency-builder/dependency-tree/index.spec.d.ts +1 -0
- package/dist/files-dependency-builder/dependency-tree/index.spec.js +877 -0
- package/dist/files-dependency-builder/dependency-tree/index.spec.js.map +1 -0
- package/dist/files-dependency-builder/detectives/detective-css/index.d.ts +1 -0
- package/dist/files-dependency-builder/detectives/detective-css/index.js +18 -0
- package/dist/files-dependency-builder/detectives/detective-css/index.js.map +1 -0
- package/dist/files-dependency-builder/detectives/detective-es6/index.d.ts +1 -0
- package/dist/files-dependency-builder/detectives/detective-es6/index.js +18 -0
- package/dist/files-dependency-builder/detectives/detective-es6/index.js.map +1 -0
- package/dist/files-dependency-builder/detectives/detective-less/index.d.ts +1 -0
- package/dist/files-dependency-builder/detectives/detective-less/index.js +18 -0
- package/dist/files-dependency-builder/detectives/detective-less/index.js.map +1 -0
- package/dist/files-dependency-builder/detectives/detective-sass/index.d.ts +1 -0
- package/dist/files-dependency-builder/detectives/detective-sass/index.js +18 -0
- package/dist/files-dependency-builder/detectives/detective-sass/index.js.map +1 -0
- package/dist/files-dependency-builder/detectives/detective-scss/index.d.ts +1 -0
- package/dist/files-dependency-builder/detectives/detective-scss/index.js +18 -0
- package/dist/files-dependency-builder/detectives/detective-scss/index.js.map +1 -0
- package/dist/files-dependency-builder/detectives/detective-typescript/index.d.ts +1 -0
- package/dist/files-dependency-builder/detectives/detective-typescript/index.js +18 -0
- package/dist/files-dependency-builder/detectives/detective-typescript/index.js.map +1 -0
- package/dist/files-dependency-builder/detector-hook.d.ts +47 -0
- package/dist/files-dependency-builder/detector-hook.js +29 -0
- package/dist/files-dependency-builder/detector-hook.js.map +1 -0
- package/dist/files-dependency-builder/filing-cabinet/index.d.ts +17 -0
- package/dist/files-dependency-builder/filing-cabinet/index.js +140 -0
- package/dist/files-dependency-builder/filing-cabinet/index.js.map +1 -0
- package/dist/files-dependency-builder/filing-cabinet/index.spec.d.ts +1 -0
- package/dist/files-dependency-builder/filing-cabinet/index.spec.js +651 -0
- package/dist/files-dependency-builder/filing-cabinet/index.spec.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/a.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/a.js +6 -0
- package/dist/files-dependency-builder/fixtures/build-tree/a.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/b.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/b.js +6 -0
- package/dist/files-dependency-builder/fixtures/build-tree/b.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-a.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-a.js +3 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-a.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-b.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-b.js +3 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-b.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-c.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-c.js +10 -0
- package/dist/files-dependency-builder/fixtures/build-tree/not-link-file/file-c.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/foo.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/foo.js +3 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/foo.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/index.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/index.js +21 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/index.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/is-string.d.ts +2 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/is-string.js +18 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/is-string.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/self-cycle.d.ts +2 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/self-cycle.js +20 -0
- package/dist/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/self-cycle.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/build-tree/unparsed.d.ts +0 -0
- package/dist/files-dependency-builder/fixtures/build-tree/unparsed.js +5 -0
- package/dist/files-dependency-builder/fixtures/build-tree/unparsed.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/a.d.ts +0 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/a.js +10 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/a.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/b.d.ts +0 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/b.js +10 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/b.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/c.d.ts +0 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/c.js +6 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/amd/c.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/a.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/a.js +6 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/a.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/b.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/b.js +6 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/b.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/c.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/c.js +6 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/commonjs/c.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/onlyRealDeps/a.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/onlyRealDeps/a.js +8 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/onlyRealDeps/a.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/webpack/aliased.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/webpack/aliased.js +6 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/webpack/aliased.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/webpack/unaliased.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/webpack/unaliased.js +6 -0
- package/dist/files-dependency-builder/fixtures/dependency-tree/webpack/unaliased.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/ast.d.ts +221 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/ast.js +259 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/ast.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/foo.d.ts +2 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/foo.js +12 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/foo.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/foo.scss +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/foo2.scss +0 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/mockedJSFiles.d.ts +59 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/mockedJSFiles.js +65 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/mockedJSFiles.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/root1/mod1.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/root1/mod1.js +5 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/root1/mod1.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/root2/mod2.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/root2/mod2.js +5 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/root2/mod2.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/webpack.config.d.ts +6 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/webpack.config.js +12 -0
- package/dist/files-dependency-builder/fixtures/filing-cabinet/webpack.config.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/missing-deps.d.ts +0 -0
- package/dist/files-dependency-builder/fixtures/missing-deps.js +5 -0
- package/dist/files-dependency-builder/fixtures/missing-deps.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/Gruntfile.d.ts +2 -0
- package/dist/files-dependency-builder/fixtures/precinct/Gruntfile.js +24 -0
- package/dist/files-dependency-builder/fixtures/precinct/Gruntfile.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/amd.d.ts +0 -0
- package/dist/files-dependency-builder/fixtures/precinct/amd.js +6 -0
- package/dist/files-dependency-builder/fixtures/precinct/amd.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/bar.foo +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/cjsExportLazy.d.ts +6 -0
- package/dist/files-dependency-builder/fixtures/precinct/cjsExportLazy.js +11 -0
- package/dist/files-dependency-builder/fixtures/precinct/cjsExportLazy.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/commonjs.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/commonjs.js +7 -0
- package/dist/files-dependency-builder/fixtures/precinct/commonjs.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/coreModules.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/coreModules.js +9 -0
- package/dist/files-dependency-builder/fixtures/precinct/coreModules.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/es6.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/es6.js +15 -0
- package/dist/files-dependency-builder/fixtures/precinct/es6.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/es6MixedExportLazy.d.ts +5 -0
- package/dist/files-dependency-builder/fixtures/precinct/es6MixedExportLazy.js +15 -0
- package/dist/files-dependency-builder/fixtures/precinct/es6MixedExportLazy.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/es7.d.ts +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/es7.js +7 -0
- package/dist/files-dependency-builder/fixtures/precinct/es7.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/exampleAST.d.ts +24 -0
- package/dist/files-dependency-builder/fixtures/precinct/exampleAST.js +30 -0
- package/dist/files-dependency-builder/fixtures/precinct/exampleAST.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/foo.foo +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/styles.css +6 -0
- package/dist/files-dependency-builder/fixtures/precinct/styles.less +4 -0
- package/dist/files-dependency-builder/fixtures/precinct/styles.sass +2 -0
- package/dist/files-dependency-builder/fixtures/precinct/styles.scss +3 -0
- package/dist/files-dependency-builder/fixtures/precinct/styles.styl +5 -0
- package/dist/files-dependency-builder/fixtures/precinct/typescript.d.ts +0 -0
- package/dist/files-dependency-builder/fixtures/precinct/typescript.js +11 -0
- package/dist/files-dependency-builder/fixtures/precinct/typescript.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/precinct/unparseable.d.ts +0 -0
- package/dist/files-dependency-builder/fixtures/precinct/unparseable.js +9 -0
- package/dist/files-dependency-builder/fixtures/precinct/unparseable.js.map +1 -0
- package/dist/files-dependency-builder/fixtures/unsupported-file.pdf +0 -0
- package/dist/files-dependency-builder/generate-tree-madge.d.ts +31 -0
- package/dist/files-dependency-builder/generate-tree-madge.js +196 -0
- package/dist/files-dependency-builder/generate-tree-madge.js.map +1 -0
- package/dist/files-dependency-builder/index.d.ts +3 -0
- package/dist/files-dependency-builder/index.js +34 -0
- package/dist/files-dependency-builder/index.js.map +1 -0
- package/dist/files-dependency-builder/missing-handler.d.ts +34 -0
- package/dist/files-dependency-builder/missing-handler.js +107 -0
- package/dist/files-dependency-builder/missing-handler.js.map +1 -0
- package/dist/files-dependency-builder/path-map.d.ts +20 -0
- package/dist/files-dependency-builder/path-map.js +46 -0
- package/dist/files-dependency-builder/path-map.js.map +1 -0
- package/dist/files-dependency-builder/precinct/index.d.ts +22 -0
- package/dist/files-dependency-builder/precinct/index.js +306 -0
- package/dist/files-dependency-builder/precinct/index.js.map +1 -0
- package/dist/files-dependency-builder/precinct/index.spec.d.ts +1 -0
- package/dist/files-dependency-builder/precinct/index.spec.js +300 -0
- package/dist/files-dependency-builder/precinct/index.spec.js.map +1 -0
- package/dist/files-dependency-builder/types/dependency-tree-type.d.ts +35 -0
- package/dist/files-dependency-builder/types/dependency-tree-type.js +34 -0
- package/dist/files-dependency-builder/types/dependency-tree-type.js.map +1 -0
- package/dist/files-dependency-builder/types/index.d.ts +0 -0
- package/dist/files-dependency-builder/types/index.js +7 -0
- package/dist/files-dependency-builder/types/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/dist/resolve-pkg-data.d.ts +23 -0
- package/dist/resolve-pkg-data.js +157 -0
- package/dist/resolve-pkg-data.js.map +1 -0
- package/files-dependency-builder/build-tree.spec.ts +130 -0
- package/files-dependency-builder/build-tree.ts +185 -0
- package/files-dependency-builder/dependency-tree/Config.ts +68 -0
- package/files-dependency-builder/dependency-tree/index.spec.ts +893 -0
- package/files-dependency-builder/dependency-tree/index.ts +244 -0
- package/files-dependency-builder/detectives/detective-css/index.ts +1 -0
- package/files-dependency-builder/detectives/detective-es6/index.ts +1 -0
- package/files-dependency-builder/detectives/detective-less/index.ts +1 -0
- package/files-dependency-builder/detectives/detective-sass/index.ts +1 -0
- package/files-dependency-builder/detectives/detective-scss/index.ts +1 -0
- package/files-dependency-builder/detectives/detective-typescript/index.ts +1 -0
- package/files-dependency-builder/detector-hook.ts +69 -0
- package/files-dependency-builder/filing-cabinet/index.spec.ts +718 -0
- package/files-dependency-builder/filing-cabinet/index.ts +119 -0
- package/files-dependency-builder/fixtures/build-tree/a.js +2 -0
- package/files-dependency-builder/fixtures/build-tree/b.js +2 -0
- package/files-dependency-builder/fixtures/build-tree/not-link-file/file-a.js +2 -0
- package/files-dependency-builder/fixtures/build-tree/not-link-file/file-b.js +4 -0
- package/files-dependency-builder/fixtures/build-tree/not-link-file/file-c.js +3 -0
- package/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/foo.js +2 -0
- package/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/index.js +2 -0
- package/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/is-string.js +3 -0
- package/files-dependency-builder/fixtures/build-tree/tree-shaking-cycle/self-cycle.js +3 -0
- package/files-dependency-builder/fixtures/build-tree/unparsed.js +2 -0
- package/files-dependency-builder/fixtures/dependency-tree/amd/a.js +6 -0
- package/files-dependency-builder/fixtures/dependency-tree/amd/b.js +6 -0
- package/files-dependency-builder/fixtures/dependency-tree/amd/c.js +2 -0
- package/files-dependency-builder/fixtures/dependency-tree/commonjs/a.js +2 -0
- package/files-dependency-builder/fixtures/dependency-tree/commonjs/b.js +3 -0
- package/files-dependency-builder/fixtures/dependency-tree/commonjs/c.js +3 -0
- package/files-dependency-builder/fixtures/dependency-tree/onlyRealDeps/a.js +4 -0
- package/files-dependency-builder/fixtures/dependency-tree/webpack/aliased.js +2 -0
- package/files-dependency-builder/fixtures/dependency-tree/webpack/unaliased.js +2 -0
- package/files-dependency-builder/fixtures/filing-cabinet/ast.js +266 -0
- package/files-dependency-builder/fixtures/filing-cabinet/foo.jsx +3 -0
- package/files-dependency-builder/fixtures/filing-cabinet/foo.scss +1 -0
- package/files-dependency-builder/fixtures/filing-cabinet/foo2.scss +0 -0
- package/files-dependency-builder/fixtures/filing-cabinet/mockedJSFiles.js +61 -0
- package/files-dependency-builder/fixtures/filing-cabinet/root1/mod1.js +1 -0
- package/files-dependency-builder/fixtures/filing-cabinet/root2/mod2.js +1 -0
- package/files-dependency-builder/fixtures/filing-cabinet/webpack.config.js +8 -0
- package/files-dependency-builder/fixtures/missing-deps.js +2 -0
- package/files-dependency-builder/fixtures/precinct/Gruntfile.js +22 -0
- package/files-dependency-builder/fixtures/precinct/amd.js +2 -0
- package/files-dependency-builder/fixtures/precinct/bar.foo +1 -0
- package/files-dependency-builder/fixtures/precinct/cjsExportLazy.js +7 -0
- package/files-dependency-builder/fixtures/precinct/commonjs.js +3 -0
- package/files-dependency-builder/fixtures/precinct/coreModules.js +5 -0
- package/files-dependency-builder/fixtures/precinct/es6.js +4 -0
- package/files-dependency-builder/fixtures/precinct/es6MixedExportLazy.js +7 -0
- package/files-dependency-builder/fixtures/precinct/es7.js +3 -0
- package/files-dependency-builder/fixtures/precinct/exampleAST.js +32 -0
- package/files-dependency-builder/fixtures/precinct/foo.foo +1 -0
- package/files-dependency-builder/fixtures/precinct/styles.css +6 -0
- package/files-dependency-builder/fixtures/precinct/styles.less +4 -0
- package/files-dependency-builder/fixtures/precinct/styles.sass +2 -0
- package/files-dependency-builder/fixtures/precinct/styles.scss +3 -0
- package/files-dependency-builder/fixtures/precinct/styles.styl +5 -0
- package/files-dependency-builder/fixtures/precinct/typescript.ts +8 -0
- package/files-dependency-builder/fixtures/precinct/unparseable.js +6 -0
- package/files-dependency-builder/fixtures/unsupported-file.pdf +0 -0
- package/files-dependency-builder/generate-tree-madge.ts +200 -0
- package/files-dependency-builder/index.ts +5 -0
- package/files-dependency-builder/missing-handler.ts +76 -0
- package/files-dependency-builder/path-map.ts +38 -0
- package/files-dependency-builder/precinct/index.spec.ts +342 -0
- package/files-dependency-builder/precinct/index.ts +250 -0
- package/files-dependency-builder/types/dependency-tree-type.ts +46 -0
- package/files-dependency-builder/types/index.ts +3 -0
- package/package.json +37 -13
- /package/dist/{preview-1720513025675.js → preview-1720667996237.js} +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolvePackageData = resolvePackageData;
|
|
7
|
+
function _componentId() {
|
|
8
|
+
const data = require("@teambit/component-id");
|
|
9
|
+
_componentId = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _path() {
|
|
15
|
+
const data = _interopRequireDefault(require("path"));
|
|
16
|
+
_path = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _readPkgUp() {
|
|
22
|
+
const data = _interopRequireDefault(require("read-pkg-up"));
|
|
23
|
+
_readPkgUp = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _constants() {
|
|
29
|
+
const data = require("@teambit/legacy/dist/constants");
|
|
30
|
+
_constants = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _packageJsonFile() {
|
|
36
|
+
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/package-json-file"));
|
|
37
|
+
_packageJsonFile = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _legacy() {
|
|
43
|
+
const data = require("@teambit/legacy.utils");
|
|
44
|
+
_legacy = function () {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
|
+
/**
|
|
51
|
+
* find data such as name/version/component-id from the package.json of a component and its dependent.
|
|
52
|
+
* the version from the dependent may have range (such as ~ or ^).
|
|
53
|
+
* the version from the dependency is an exact version.
|
|
54
|
+
* for a package that is not bit-component, we're interested in the range because that's how it was
|
|
55
|
+
* set in the first place and changing it to an exact version result in the component modified.
|
|
56
|
+
* for a bit-component, we're interested in the exact version because this is the version that gets
|
|
57
|
+
* entered into "dependency" field, which not supports range. (when a component is installed via
|
|
58
|
+
* npm, it can be saved into the package.json with range: ^, ~).
|
|
59
|
+
*/
|
|
60
|
+
function resolvePackageData(dependentDir, packageFullPath) {
|
|
61
|
+
const packageData = {
|
|
62
|
+
fullPath: packageFullPath,
|
|
63
|
+
name: '',
|
|
64
|
+
componentId: undefined
|
|
65
|
+
};
|
|
66
|
+
enrichDataFromDependent(packageData, dependentDir);
|
|
67
|
+
enrichDataFromDependency(packageData);
|
|
68
|
+
if (!packageData.name) {
|
|
69
|
+
// data was not found in dependent nor in dependency
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
return packageData;
|
|
73
|
+
}
|
|
74
|
+
function enrichDataFromDependent(packageData, dependentDir) {
|
|
75
|
+
const NODE_MODULES = 'node_modules';
|
|
76
|
+
// @todo: currently, the "normalize" makes sure that the package.json is valid, however, due to a
|
|
77
|
+
// bug, when importing snaps not from hub, it saves them in .dependencies and generate pkg.json
|
|
78
|
+
// with version that has the hash, which is invalid. later, this .dependencies will be gone.
|
|
79
|
+
const packageJsonInfo = _readPkgUp().default.sync({
|
|
80
|
+
cwd: dependentDir,
|
|
81
|
+
normalize: false
|
|
82
|
+
});
|
|
83
|
+
if (!packageJsonInfo) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const dependentPackageJson = packageJsonInfo.packageJson;
|
|
87
|
+
const packageFullPath = packageData.fullPath;
|
|
88
|
+
// The +1 is for the / after the node_modules, we didn't enter it into the NODE_MODULES const because it makes problems on windows
|
|
89
|
+
const packageRelativePath = packageFullPath.substring(packageFullPath.lastIndexOf(NODE_MODULES) + NODE_MODULES.length + 1, packageFullPath.length);
|
|
90
|
+
const packageName = (0, _legacy().resolvePackageNameByPath)(packageRelativePath);
|
|
91
|
+
const packageVersion = dependentPackageJson.dependencies?.packageName || dependentPackageJson.devDependencies?.packageName || dependentPackageJson.peerDependencies?.packageName;
|
|
92
|
+
if (packageVersion) {
|
|
93
|
+
packageData.dependentPackageJsonPath = packageJsonInfo.path;
|
|
94
|
+
packageData.name = packageName;
|
|
95
|
+
packageData.versionUsedByDependent = packageVersion;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function enrichDataFromDependency(packageData) {
|
|
99
|
+
// Get the package relative path to the node_modules dir
|
|
100
|
+
const packageDir = resolvePackageDirFromFilePath(packageData.fullPath);
|
|
101
|
+
|
|
102
|
+
// don't propagate here since loading a package.json of another folder and taking the version from it will result wrong version
|
|
103
|
+
// This for example happen in the following case:
|
|
104
|
+
// if you have 2 authored component which one dependent on the other
|
|
105
|
+
// we will look for the package.json on the dependency but won't find it
|
|
106
|
+
// if we propagate we will take the version from the root's package json which has nothing with the component version
|
|
107
|
+
const packageJsonFile = _packageJsonFile().default.loadSync(packageDir);
|
|
108
|
+
const packageInfo = packageJsonFile.packageJsonObject;
|
|
109
|
+
|
|
110
|
+
// the version can be empty when creating the package.json for author, or when using custom-module-resolution
|
|
111
|
+
// that's fine, we still need the component-id in this case.
|
|
112
|
+
if (!packageInfo || !packageInfo.name) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
packageData.packageJsonPath = _path().default.join(packageDir, _constants().PACKAGE_JSON);
|
|
116
|
+
packageData.packageJsonContent = packageInfo;
|
|
117
|
+
packageData.name = packageInfo.name;
|
|
118
|
+
packageData.concreteVersion = packageInfo.version;
|
|
119
|
+
if (packageInfo.componentId) {
|
|
120
|
+
const scope = packageInfo.componentId.scope;
|
|
121
|
+
if (packageInfo.exported === false) {
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
delete packageInfo.componentId.scope;
|
|
124
|
+
}
|
|
125
|
+
const componentId = _componentId().ComponentID.fromObject(packageInfo.componentId, scope);
|
|
126
|
+
packageData.componentId = componentId;
|
|
127
|
+
if (packageData.componentId.hasVersion() && packageInfo.version) {
|
|
128
|
+
// if packageInfo.version is not defined, it's coming from the workspace and the package.json is auto-generated
|
|
129
|
+
// during bit-link. ignore the componentId.version in this case, it's not up do date.
|
|
130
|
+
// otherwise, use it, because if it's a snap, the component-version is the snap. the pkg version is 0.0.0-snap.
|
|
131
|
+
packageData.concreteVersion = packageData.componentId.version;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* given the full path of a package file, returns the root dir of the package, so then we could
|
|
138
|
+
* find the package.json in that directory.
|
|
139
|
+
*
|
|
140
|
+
* example of a normal package:
|
|
141
|
+
* absolutePackageFilePath: /user/workspace/node_modules/lodash.isboolean/index.js
|
|
142
|
+
* returns: /user/workspace/node_modules/lodash.isboolean
|
|
143
|
+
*
|
|
144
|
+
* example of a scoped package:
|
|
145
|
+
* absolutePackageFilePath: /user/workspace/node_modules/@babel/core/lib/index.js
|
|
146
|
+
* returns: /user/workspace/node_modules/@babel/core
|
|
147
|
+
*/
|
|
148
|
+
function resolvePackageDirFromFilePath(absolutePackageFilePath) {
|
|
149
|
+
const NODE_MODULES = 'node_modules';
|
|
150
|
+
const indexOfLastNodeModules = absolutePackageFilePath.lastIndexOf(NODE_MODULES) + NODE_MODULES.length + 1;
|
|
151
|
+
const pathInsideNodeModules = absolutePackageFilePath.substring(indexOfLastNodeModules);
|
|
152
|
+
const packageName = (0, _legacy().resolvePackageNameByPath)(pathInsideNodeModules);
|
|
153
|
+
const pathUntilNodeModules = absolutePackageFilePath.substring(0, indexOfLastNodeModules);
|
|
154
|
+
return pathUntilNodeModules + packageName;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=resolve-pkg-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_componentId","data","require","_path","_interopRequireDefault","_readPkgUp","_constants","_packageJsonFile","_legacy","e","__esModule","default","resolvePackageData","dependentDir","packageFullPath","packageData","fullPath","name","componentId","undefined","enrichDataFromDependent","enrichDataFromDependency","NODE_MODULES","packageJsonInfo","readPkgUp","sync","cwd","normalize","dependentPackageJson","packageJson","packageRelativePath","substring","lastIndexOf","length","packageName","resolvePackageNameByPath","packageVersion","dependencies","devDependencies","peerDependencies","dependentPackageJsonPath","path","versionUsedByDependent","packageDir","resolvePackageDirFromFilePath","packageJsonFile","PackageJsonFile","loadSync","packageInfo","packageJsonObject","packageJsonPath","join","PACKAGE_JSON","packageJsonContent","concreteVersion","version","scope","exported","ComponentID","fromObject","hasVersion","absolutePackageFilePath","indexOfLastNodeModules","pathInsideNodeModules","pathUntilNodeModules"],"sources":["resolve-pkg-data.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport path from 'path';\nimport readPkgUp from 'read-pkg-up';\nimport { PACKAGE_JSON } from '@teambit/legacy/dist/constants';\nimport PackageJsonFile from '@teambit/legacy/dist/consumer/component/package-json-file';\nimport { PathLinuxAbsolute, PathOsBased, PathOsBasedAbsolute } from '@teambit/toolbox.path.path';\nimport { resolvePackageNameByPath } from '@teambit/legacy.utils';\n\nexport interface ResolvedPackageData {\n fullPath: PathOsBasedAbsolute; // package path\n packageJsonPath?: PathOsBased;\n packageJsonContent?: Record<string, any>;\n dependentPackageJsonPath?: PathOsBased;\n name: string; // package name\n concreteVersion?: string; // version from the package.json of the package itself\n versionUsedByDependent?: string; // version from the dependent package.json\n componentId?: ComponentID; // component id in case it's a bit component\n}\n\n/**\n * find data such as name/version/component-id from the package.json of a component and its dependent.\n * the version from the dependent may have range (such as ~ or ^).\n * the version from the dependency is an exact version.\n * for a package that is not bit-component, we're interested in the range because that's how it was\n * set in the first place and changing it to an exact version result in the component modified.\n * for a bit-component, we're interested in the exact version because this is the version that gets\n * entered into \"dependency\" field, which not supports range. (when a component is installed via\n * npm, it can be saved into the package.json with range: ^, ~).\n */\nexport function resolvePackageData(\n dependentDir: string,\n packageFullPath: PathLinuxAbsolute\n): ResolvedPackageData | undefined {\n const packageData: ResolvedPackageData = {\n fullPath: packageFullPath,\n name: '',\n componentId: undefined,\n };\n enrichDataFromDependent(packageData, dependentDir);\n enrichDataFromDependency(packageData);\n if (!packageData.name) {\n // data was not found in dependent nor in dependency\n return undefined;\n }\n return packageData;\n}\n\nfunction enrichDataFromDependent(packageData: ResolvedPackageData, dependentDir: string) {\n const NODE_MODULES = 'node_modules';\n // @todo: currently, the \"normalize\" makes sure that the package.json is valid, however, due to a\n // bug, when importing snaps not from hub, it saves them in .dependencies and generate pkg.json\n // with version that has the hash, which is invalid. later, this .dependencies will be gone.\n const packageJsonInfo = readPkgUp.sync({ cwd: dependentDir, normalize: false });\n if (!packageJsonInfo) {\n return;\n }\n const dependentPackageJson = packageJsonInfo.packageJson;\n const packageFullPath = packageData.fullPath;\n // The +1 is for the / after the node_modules, we didn't enter it into the NODE_MODULES const because it makes problems on windows\n const packageRelativePath = packageFullPath.substring(\n packageFullPath.lastIndexOf(NODE_MODULES) + NODE_MODULES.length + 1,\n packageFullPath.length\n );\n\n const packageName = resolvePackageNameByPath(packageRelativePath);\n const packageVersion =\n dependentPackageJson.dependencies?.packageName ||\n dependentPackageJson.devDependencies?.packageName ||\n dependentPackageJson.peerDependencies?.packageName;\n if (packageVersion) {\n packageData.dependentPackageJsonPath = packageJsonInfo.path;\n packageData.name = packageName;\n packageData.versionUsedByDependent = packageVersion;\n }\n}\n\nfunction enrichDataFromDependency(packageData: ResolvedPackageData) {\n // Get the package relative path to the node_modules dir\n const packageDir = resolvePackageDirFromFilePath(packageData.fullPath);\n\n // don't propagate here since loading a package.json of another folder and taking the version from it will result wrong version\n // This for example happen in the following case:\n // if you have 2 authored component which one dependent on the other\n // we will look for the package.json on the dependency but won't find it\n // if we propagate we will take the version from the root's package json which has nothing with the component version\n const packageJsonFile = PackageJsonFile.loadSync(packageDir);\n const packageInfo = packageJsonFile.packageJsonObject;\n\n // the version can be empty when creating the package.json for author, or when using custom-module-resolution\n // that's fine, we still need the component-id in this case.\n if (!packageInfo || !packageInfo.name) {\n return;\n }\n packageData.packageJsonPath = path.join(packageDir, PACKAGE_JSON);\n packageData.packageJsonContent = packageInfo;\n packageData.name = packageInfo.name;\n packageData.concreteVersion = packageInfo.version;\n if (packageInfo.componentId) {\n const scope = packageInfo.componentId.scope as string;\n if (packageInfo.exported === false) {\n // @ts-ignore\n delete packageInfo.componentId.scope;\n }\n const componentId = ComponentID.fromObject(packageInfo.componentId, scope);\n packageData.componentId = componentId;\n if (packageData.componentId.hasVersion() && packageInfo.version) {\n // if packageInfo.version is not defined, it's coming from the workspace and the package.json is auto-generated\n // during bit-link. ignore the componentId.version in this case, it's not up do date.\n // otherwise, use it, because if it's a snap, the component-version is the snap. the pkg version is 0.0.0-snap.\n packageData.concreteVersion = packageData.componentId.version;\n }\n }\n}\n\n/**\n * given the full path of a package file, returns the root dir of the package, so then we could\n * find the package.json in that directory.\n *\n * example of a normal package:\n * absolutePackageFilePath: /user/workspace/node_modules/lodash.isboolean/index.js\n * returns: /user/workspace/node_modules/lodash.isboolean\n *\n * example of a scoped package:\n * absolutePackageFilePath: /user/workspace/node_modules/@babel/core/lib/index.js\n * returns: /user/workspace/node_modules/@babel/core\n */\nfunction resolvePackageDirFromFilePath(absolutePackageFilePath: string): string {\n const NODE_MODULES = 'node_modules';\n const indexOfLastNodeModules = absolutePackageFilePath.lastIndexOf(NODE_MODULES) + NODE_MODULES.length + 1;\n const pathInsideNodeModules = absolutePackageFilePath.substring(indexOfLastNodeModules);\n const packageName = resolvePackageNameByPath(pathInsideNodeModules);\n const pathUntilNodeModules = absolutePackageFilePath.substring(0, indexOfLastNodeModules);\n return pathUntilNodeModules + packageName;\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import * as buildTree from './build-tree';
|
|
5
|
+
|
|
6
|
+
const fixtures = `fixtures`;
|
|
7
|
+
const precinctFixtures = path.join(fixtures, 'precinct');
|
|
8
|
+
const buildTreeFixtures = path.join(fixtures, 'build-tree');
|
|
9
|
+
|
|
10
|
+
describe('buildTree', () => {
|
|
11
|
+
describe('getDependencyTree', () => {
|
|
12
|
+
const filePaths: string[] = [];
|
|
13
|
+
let visited: any;
|
|
14
|
+
const dependencyTreeParams = {
|
|
15
|
+
componentDir: __dirname,
|
|
16
|
+
workspacePath: __dirname,
|
|
17
|
+
filePaths,
|
|
18
|
+
visited,
|
|
19
|
+
};
|
|
20
|
+
it('when no files are passed should return an empty tree', async () => {
|
|
21
|
+
const results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
22
|
+
expect(results).to.deep.equal({ tree: {} });
|
|
23
|
+
});
|
|
24
|
+
it('when unsupported files are passed should return them with no dependencies', async () => {
|
|
25
|
+
dependencyTreeParams.filePaths = [`${fixtures}/unsupported-file.pdf`];
|
|
26
|
+
const results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
27
|
+
expect(results.tree[`${fixtures}/unsupported-file.pdf`].isEmpty()).to.be.true;
|
|
28
|
+
});
|
|
29
|
+
it('when supported and unsupported files are passed should return them all', async () => {
|
|
30
|
+
dependencyTreeParams.filePaths = [`${fixtures}/unsupported-file.pdf`, `${precinctFixtures}/es6.js`];
|
|
31
|
+
const results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
32
|
+
expect(results.tree).to.have.property(`${fixtures}/unsupported-file.pdf`);
|
|
33
|
+
expect(results.tree).to.have.property(`${fixtures}/precinct/es6.js`);
|
|
34
|
+
});
|
|
35
|
+
// todo: fix this one and one below once we have a way to ignore some component files from compiling/parsing altogether
|
|
36
|
+
// uncomment unparseable.js
|
|
37
|
+
it.skip('when a js file has parsing error it should add the file to the tree with the error instance', async () => {
|
|
38
|
+
dependencyTreeParams.filePaths = [`${precinctFixtures}/unparseable.js`];
|
|
39
|
+
const results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
40
|
+
const unParsedFile = `${fixtures}/precinct/unparseable.js`;
|
|
41
|
+
expect(results.tree).to.have.property(unParsedFile);
|
|
42
|
+
expect(results.tree[unParsedFile]).to.have.property('error');
|
|
43
|
+
expect(results.tree[unParsedFile].error).to.be.instanceof(Error);
|
|
44
|
+
});
|
|
45
|
+
it.skip('when a js file has parsing error and it retrieved from the cache it should add the file to the tree with the error instance', async () => {
|
|
46
|
+
dependencyTreeParams.filePaths = [`${precinctFixtures}/unparseable.js`];
|
|
47
|
+
dependencyTreeParams.visited = {};
|
|
48
|
+
const results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
49
|
+
const unParsedFile = `${fixtures}/precinct/unparseable.js`;
|
|
50
|
+
expect(results.tree).to.have.property(unParsedFile);
|
|
51
|
+
expect(results.tree[unParsedFile]).to.have.property('error');
|
|
52
|
+
expect(results.tree[unParsedFile].error).to.be.instanceof(Error);
|
|
53
|
+
|
|
54
|
+
// second time, this time it fetches from the cache (visited object)
|
|
55
|
+
const resultsCached = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
56
|
+
expect(resultsCached.tree).to.have.property(unParsedFile);
|
|
57
|
+
expect(resultsCached.tree[unParsedFile]).to.have.property('error');
|
|
58
|
+
expect(resultsCached.tree[unParsedFile].error).to.be.instanceof(Error);
|
|
59
|
+
});
|
|
60
|
+
// todo: fix this one once we have a way to ignore some component files from compiling/parsing altogether
|
|
61
|
+
// uncomment fixtures/build-tree/unparsed.js file
|
|
62
|
+
describe.skip('when a dependency of dependency has parsing error', () => {
|
|
63
|
+
let results;
|
|
64
|
+
before(async () => {
|
|
65
|
+
dependencyTreeParams.filePaths = [`${buildTreeFixtures}/a.js`, `${buildTreeFixtures}/b.js`];
|
|
66
|
+
results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
67
|
+
});
|
|
68
|
+
it('should add all the files to the tree', async () => {
|
|
69
|
+
expect(results.tree).to.have.property(`${fixtures}/build-tree/a.js`);
|
|
70
|
+
expect(results.tree).to.have.property(`${fixtures}/build-tree/b.js`);
|
|
71
|
+
expect(results.tree).to.have.property(`${fixtures}/build-tree/unparsed.js`);
|
|
72
|
+
});
|
|
73
|
+
it('should not add the error to the files without parsing error', () => {
|
|
74
|
+
expect(results.tree[`${fixtures}/build-tree/a.js`].error).to.be.undefined;
|
|
75
|
+
expect(results.tree[`${fixtures}/build-tree/b.js`].error).to.be.undefined;
|
|
76
|
+
});
|
|
77
|
+
it('should add the parsing error to the un-parsed file', () => {
|
|
78
|
+
expect(results.tree[`${fixtures}/build-tree/unparsed.js`]).to.have.property('error');
|
|
79
|
+
expect(results.tree[`${fixtures}/build-tree/unparsed.js`].error).to.be.instanceof(Error);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
// todo: fix this one once we have a way to ignore some component files from compiling/parsing altogether
|
|
83
|
+
// uncomment fixtures/missing-deps.js file
|
|
84
|
+
describe.skip('missing dependencies', () => {
|
|
85
|
+
let results;
|
|
86
|
+
const missingDepsFile = 'fixtures/missing-deps.js';
|
|
87
|
+
before(async () => {
|
|
88
|
+
dependencyTreeParams.filePaths = [missingDepsFile];
|
|
89
|
+
results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
90
|
+
expect(results.tree).to.have.property(`${fixtures}/missing-deps.js`);
|
|
91
|
+
expect(results.tree[`${fixtures}/missing-deps.js`]).to.have.property('missing');
|
|
92
|
+
});
|
|
93
|
+
it('it should add the missing dependency to the missing section in the tree', async () => {
|
|
94
|
+
expect(results.tree[`${fixtures}/missing-deps.js`].missing).to.have.property('files');
|
|
95
|
+
expect(results.tree[`${fixtures}/missing-deps.js`].missing.files[0]).to.equal('../non-exist-dep');
|
|
96
|
+
});
|
|
97
|
+
it('it should add the missing package to the missing section in the tree', async () => {
|
|
98
|
+
expect(results.tree[`${fixtures}/missing-deps.js`].missing).to.have.property('packages');
|
|
99
|
+
expect(results.tree[`${fixtures}/missing-deps.js`].missing.packages[0]).to.equal('non-exist-package');
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
describe('tree shaking with cycle', () => {
|
|
103
|
+
describe('when a file imports from itself', () => {
|
|
104
|
+
let results;
|
|
105
|
+
before(async () => {
|
|
106
|
+
dependencyTreeParams.filePaths = [`${buildTreeFixtures}/tree-shaking-cycle/self-cycle.js`];
|
|
107
|
+
results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
108
|
+
});
|
|
109
|
+
it('should not throw an error and should remove itself from the dependencies files', () => {
|
|
110
|
+
const file = `${fixtures}/build-tree/tree-shaking-cycle/self-cycle.js`;
|
|
111
|
+
expect(results.tree[file].files).to.be.an('array').and.empty;
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
// probably not relevant anymore.
|
|
115
|
+
describe.skip('cycle with multiple files', () => {
|
|
116
|
+
let results;
|
|
117
|
+
before(async () => {
|
|
118
|
+
dependencyTreeParams.filePaths = [`${buildTreeFixtures}/tree-shaking-cycle/foo.js`];
|
|
119
|
+
results = await buildTree.getDependencyTree(dependencyTreeParams);
|
|
120
|
+
});
|
|
121
|
+
it('should not recognize the cycle dependencies as link files', () => {
|
|
122
|
+
const file = `${fixtures}/build-tree/tree-shaking-cycle/foo.js`;
|
|
123
|
+
expect(results.tree[file].files).to.be.an('array').and.have.lengthOf(1);
|
|
124
|
+
const indexDep = results.tree[file].files[0];
|
|
125
|
+
expect(indexDep.file).to.equal(`${fixtures}/build-tree/tree-shaking-cycle/index.js`);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { clone, isEmpty, set } from 'lodash';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { resolvePackageData } from '../resolve-pkg-data';
|
|
4
|
+
import generateTree, { MadgeTree } from './generate-tree-madge';
|
|
5
|
+
import { FoundPackages, MissingGroupItem, MissingHandler } from './missing-handler';
|
|
6
|
+
import { convertPathMapToRelativePaths, PathMapItem } from './path-map';
|
|
7
|
+
import { DependencyTreeParams, FileObject, DependenciesTree, DependenciesTreeItem } from './types/dependency-tree-type';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Gets a list of dependencies and group them by types (files, components, packages)
|
|
11
|
+
* It's also transform the node package dependencies from array of paths to object in this format:
|
|
12
|
+
* {dependencyName: version} (like in package.json)
|
|
13
|
+
*
|
|
14
|
+
* componentDir is the root of working directory (used for node packages version calculation)
|
|
15
|
+
*/
|
|
16
|
+
function groupDependencyList(dependenciesPaths: string[], componentDir: string): DependenciesTreeItem {
|
|
17
|
+
const resultGroups = new DependenciesTreeItem();
|
|
18
|
+
const isPackage = (str: string) => str.includes('node_modules/');
|
|
19
|
+
dependenciesPaths.forEach((dependencyPath) => {
|
|
20
|
+
if (!isPackage(dependencyPath)) {
|
|
21
|
+
resultGroups.files.push({ file: dependencyPath });
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const resolvedPackage = resolvePackageData(componentDir, path.join(componentDir, dependencyPath));
|
|
25
|
+
if (!resolvedPackage) {
|
|
26
|
+
// package doesn't have package.json, probably it's a custom-resolve-module dep file
|
|
27
|
+
resultGroups.unidentifiedPackages.push(dependencyPath);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// If the package is a component add it to the components list
|
|
32
|
+
if (resolvedPackage.componentId) {
|
|
33
|
+
resultGroups.components.push(resolvedPackage);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const version = resolvedPackage.versionUsedByDependent || resolvedPackage.concreteVersion;
|
|
37
|
+
const packageWithVersion = {
|
|
38
|
+
[resolvedPackage.name]: version,
|
|
39
|
+
};
|
|
40
|
+
Object.assign(resultGroups.packages, packageWithVersion);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return resultGroups;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Run over each entry in the tree and transform the dependencies from list of paths
|
|
48
|
+
* to object with dependencies types
|
|
49
|
+
*
|
|
50
|
+
* @returns new tree with grouped dependencies
|
|
51
|
+
*/
|
|
52
|
+
function MadgeTreeToDependenciesTree(tree: MadgeTree, componentDir: string): DependenciesTree {
|
|
53
|
+
const result: DependenciesTree = {};
|
|
54
|
+
Object.keys(tree).forEach((filePath) => {
|
|
55
|
+
if (tree[filePath] && !isEmpty(tree[filePath])) {
|
|
56
|
+
result[filePath] = groupDependencyList(tree[filePath], componentDir);
|
|
57
|
+
} else {
|
|
58
|
+
result[filePath] = new DependenciesTreeItem();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* add extra data such as custom-resolve and link-files from pathMap
|
|
67
|
+
*/
|
|
68
|
+
function updateTreeWithPathMap(tree: DependenciesTree, pathMapAbsolute: PathMapItem[], baseDir: string): void {
|
|
69
|
+
if (!pathMapAbsolute.length) return;
|
|
70
|
+
const pathMap = convertPathMapToRelativePaths(pathMapAbsolute, baseDir);
|
|
71
|
+
Object.keys(tree).forEach((filePath: string) => {
|
|
72
|
+
const treeFiles = tree[filePath].files;
|
|
73
|
+
if (!treeFiles.length) return; // file has no dependency
|
|
74
|
+
const mainFilePathMap = pathMap.find((file) => file.file === filePath);
|
|
75
|
+
if (!mainFilePathMap) throw new Error(`updateTreeWithPathMap: PathMap is missing for ${filePath}`);
|
|
76
|
+
// a file might have a cycle dependency with itself, remove it from the dependencies.
|
|
77
|
+
tree[filePath].files = treeFiles.filter((dependency) => dependency.file !== filePath);
|
|
78
|
+
tree[filePath].files.forEach((fileObject: FileObject) => {
|
|
79
|
+
const dependencyPathMap = mainFilePathMap.dependencies.find((file) => file.resolvedDep === fileObject.file);
|
|
80
|
+
if (!dependencyPathMap) {
|
|
81
|
+
throw new Error(`updateTreeWithPathMap: dependencyPathMap is missing for ${fileObject.file}`);
|
|
82
|
+
}
|
|
83
|
+
fileObject.importSource = dependencyPathMap.importSource;
|
|
84
|
+
if (dependencyPathMap.importSpecifiers && dependencyPathMap.importSpecifiers.length) {
|
|
85
|
+
const depImportSpecifiers = dependencyPathMap.importSpecifiers.map((importSpecifier) => {
|
|
86
|
+
return {
|
|
87
|
+
mainFile: importSpecifier,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
fileObject.importSpecifiers = depImportSpecifiers;
|
|
91
|
+
}
|
|
92
|
+
return fileObject;
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function mergeManuallyFoundPackagesToTree(
|
|
98
|
+
foundPackages: FoundPackages,
|
|
99
|
+
missingGroups: MissingGroupItem[],
|
|
100
|
+
tree: DependenciesTree
|
|
101
|
+
) {
|
|
102
|
+
if (isEmpty(foundPackages.components) && isEmpty(foundPackages.packages)) return;
|
|
103
|
+
// Merge manually found packages (by groupMissing()) with the packages found by Madge (generate-tree-madge)
|
|
104
|
+
Object.keys(foundPackages.packages).forEach((pkg) => {
|
|
105
|
+
// locate package in groups(contains missing)
|
|
106
|
+
missingGroups.forEach((fileDep: MissingGroupItem) => {
|
|
107
|
+
if (fileDep.packages && fileDep.packages.includes(pkg)) {
|
|
108
|
+
fileDep.packages = fileDep.packages.filter((packageName) => packageName !== pkg);
|
|
109
|
+
set(tree[fileDep.originFile], ['packages', pkg], foundPackages.packages[pkg]);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
foundPackages.components.forEach((component) => {
|
|
114
|
+
missingGroups.forEach((fileDep: MissingGroupItem) => {
|
|
115
|
+
if (fileDep.packages && fileDep.packages.includes(component.name)) {
|
|
116
|
+
fileDep.packages = fileDep.packages.filter((packageName) => packageName !== component.name);
|
|
117
|
+
(tree[fileDep.originFile] ||= new DependenciesTreeItem()).components.push(component);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function mergeMissingToTree(missingGroups, tree: DependenciesTree) {
|
|
124
|
+
if (isEmpty(missingGroups)) return;
|
|
125
|
+
missingGroups.forEach((missing) => {
|
|
126
|
+
const missingCloned = clone(missing);
|
|
127
|
+
delete missingCloned.originFile;
|
|
128
|
+
(tree[missing.originFile] ||= new DependenciesTreeItem()).missing = missingCloned;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function mergeErrorsToTree(errors, tree: DependenciesTree) {
|
|
133
|
+
if (isEmpty(errors)) return;
|
|
134
|
+
Object.keys(errors).forEach((file) => {
|
|
135
|
+
(tree[file] ||= new DependenciesTreeItem()).error = errors[file];
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Function for fetching dependency tree of file or dir
|
|
141
|
+
* @param baseDir working directory
|
|
142
|
+
* @param workspacePath
|
|
143
|
+
* @param filePaths path of the file to calculate the dependencies
|
|
144
|
+
*/
|
|
145
|
+
export async function getDependencyTree({
|
|
146
|
+
componentDir, // component rootDir
|
|
147
|
+
workspacePath,
|
|
148
|
+
filePaths,
|
|
149
|
+
visited = {},
|
|
150
|
+
cacheProjectAst,
|
|
151
|
+
envDetectors,
|
|
152
|
+
}: DependencyTreeParams): Promise<{ tree: DependenciesTree }> {
|
|
153
|
+
const config = {
|
|
154
|
+
baseDir: componentDir,
|
|
155
|
+
includeNpm: true,
|
|
156
|
+
requireConfig: null,
|
|
157
|
+
webpackConfig: null,
|
|
158
|
+
visited,
|
|
159
|
+
nonExistent: [],
|
|
160
|
+
cacheProjectAst,
|
|
161
|
+
envDetectors,
|
|
162
|
+
};
|
|
163
|
+
// This is important because without this, madge won't know to resolve files if we run the
|
|
164
|
+
// CMD not from the root dir
|
|
165
|
+
const fullPaths = filePaths.map((filePath) => {
|
|
166
|
+
if (filePath.startsWith(componentDir)) {
|
|
167
|
+
return filePath;
|
|
168
|
+
}
|
|
169
|
+
return path.resolve(componentDir, filePath);
|
|
170
|
+
});
|
|
171
|
+
const { madgeTree, skipped, pathMap, errors } = generateTree(fullPaths, config);
|
|
172
|
+
const tree: DependenciesTree = MadgeTreeToDependenciesTree(madgeTree, componentDir);
|
|
173
|
+
const { missingGroups, foundPackages } = new MissingHandler(
|
|
174
|
+
skipped,
|
|
175
|
+
componentDir,
|
|
176
|
+
workspacePath
|
|
177
|
+
).groupAndFindMissing();
|
|
178
|
+
|
|
179
|
+
if (foundPackages) mergeManuallyFoundPackagesToTree(foundPackages, missingGroups, tree);
|
|
180
|
+
if (errors) mergeErrorsToTree(errors, tree);
|
|
181
|
+
if (missingGroups) mergeMissingToTree(missingGroups, tree);
|
|
182
|
+
if (pathMap) updateTreeWithPathMap(tree, pathMap, componentDir);
|
|
183
|
+
|
|
184
|
+
return { tree };
|
|
185
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* this file had been forked from https://github.com/dependents/node-dependency-tree
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const debug = require('debug')('tree');
|
|
7
|
+
|
|
8
|
+
export default function Config(options) {
|
|
9
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
10
|
+
this.filename = options.filename;
|
|
11
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
12
|
+
this.directory = options.directory || options.root;
|
|
13
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
14
|
+
this.visited = options.visited || {};
|
|
15
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
16
|
+
this.errors = options.errors || {};
|
|
17
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
18
|
+
this.nonExistent = options.nonExistent || [];
|
|
19
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
20
|
+
this.isListForm = options.isListForm;
|
|
21
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
22
|
+
this.requireConfig = options.config || options.requireConfig;
|
|
23
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
24
|
+
this.webpackConfig = options.webpackConfig;
|
|
25
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
26
|
+
this.detectiveConfig = options.detective || options.detectiveConfig || {};
|
|
27
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
28
|
+
this.pathMap = options.pathMap || [];
|
|
29
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
30
|
+
this.resolveConfig = options.resolveConfig;
|
|
31
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
32
|
+
this.cacheProjectAst = options.cacheProjectAst;
|
|
33
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
34
|
+
this.envDetectors = options.envDetectors;
|
|
35
|
+
|
|
36
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
37
|
+
this.filter = options.filter;
|
|
38
|
+
|
|
39
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
40
|
+
if (!this.filename) {
|
|
41
|
+
throw new Error('filename not given');
|
|
42
|
+
}
|
|
43
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
44
|
+
if (!this.directory) {
|
|
45
|
+
throw new Error('directory not given');
|
|
46
|
+
}
|
|
47
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
48
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
49
|
+
if (this.filter && typeof this.filter !== 'function') {
|
|
50
|
+
throw new Error('filter must be a function');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
54
|
+
debug(`given filename: ${this.filename}`);
|
|
55
|
+
|
|
56
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
57
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
58
|
+
this.filename = path.resolve(process.cwd(), this.filename);
|
|
59
|
+
|
|
60
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
61
|
+
debug(`resolved filename: ${this.filename}`);
|
|
62
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
63
|
+
debug('visited: ', this.visited);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Config.prototype.clone = function () {
|
|
67
|
+
return new Config(this);
|
|
68
|
+
};
|