@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,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDependencyTree = getDependencyTree;
|
|
7
|
+
function _lodash() {
|
|
8
|
+
const data = require("lodash");
|
|
9
|
+
_lodash = 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 _resolvePkgData() {
|
|
22
|
+
const data = require("../resolve-pkg-data");
|
|
23
|
+
_resolvePkgData = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _generateTreeMadge() {
|
|
29
|
+
const data = _interopRequireDefault(require("./generate-tree-madge"));
|
|
30
|
+
_generateTreeMadge = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _missingHandler() {
|
|
36
|
+
const data = require("./missing-handler");
|
|
37
|
+
_missingHandler = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _pathMap() {
|
|
43
|
+
const data = require("./path-map");
|
|
44
|
+
_pathMap = function () {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
function _dependencyTreeType() {
|
|
50
|
+
const data = require("./types/dependency-tree-type");
|
|
51
|
+
_dependencyTreeType = function () {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
57
|
+
/**
|
|
58
|
+
* Gets a list of dependencies and group them by types (files, components, packages)
|
|
59
|
+
* It's also transform the node package dependencies from array of paths to object in this format:
|
|
60
|
+
* {dependencyName: version} (like in package.json)
|
|
61
|
+
*
|
|
62
|
+
* componentDir is the root of working directory (used for node packages version calculation)
|
|
63
|
+
*/
|
|
64
|
+
function groupDependencyList(dependenciesPaths, componentDir) {
|
|
65
|
+
const resultGroups = new (_dependencyTreeType().DependenciesTreeItem)();
|
|
66
|
+
const isPackage = str => str.includes('node_modules/');
|
|
67
|
+
dependenciesPaths.forEach(dependencyPath => {
|
|
68
|
+
if (!isPackage(dependencyPath)) {
|
|
69
|
+
resultGroups.files.push({
|
|
70
|
+
file: dependencyPath
|
|
71
|
+
});
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const resolvedPackage = (0, _resolvePkgData().resolvePackageData)(componentDir, _path().default.join(componentDir, dependencyPath));
|
|
75
|
+
if (!resolvedPackage) {
|
|
76
|
+
// package doesn't have package.json, probably it's a custom-resolve-module dep file
|
|
77
|
+
resultGroups.unidentifiedPackages.push(dependencyPath);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// If the package is a component add it to the components list
|
|
82
|
+
if (resolvedPackage.componentId) {
|
|
83
|
+
resultGroups.components.push(resolvedPackage);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const version = resolvedPackage.versionUsedByDependent || resolvedPackage.concreteVersion;
|
|
87
|
+
const packageWithVersion = {
|
|
88
|
+
[resolvedPackage.name]: version
|
|
89
|
+
};
|
|
90
|
+
Object.assign(resultGroups.packages, packageWithVersion);
|
|
91
|
+
});
|
|
92
|
+
return resultGroups;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Run over each entry in the tree and transform the dependencies from list of paths
|
|
97
|
+
* to object with dependencies types
|
|
98
|
+
*
|
|
99
|
+
* @returns new tree with grouped dependencies
|
|
100
|
+
*/
|
|
101
|
+
function MadgeTreeToDependenciesTree(tree, componentDir) {
|
|
102
|
+
const result = {};
|
|
103
|
+
Object.keys(tree).forEach(filePath => {
|
|
104
|
+
if (tree[filePath] && !(0, _lodash().isEmpty)(tree[filePath])) {
|
|
105
|
+
result[filePath] = groupDependencyList(tree[filePath], componentDir);
|
|
106
|
+
} else {
|
|
107
|
+
result[filePath] = new (_dependencyTreeType().DependenciesTreeItem)();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* add extra data such as custom-resolve and link-files from pathMap
|
|
115
|
+
*/
|
|
116
|
+
function updateTreeWithPathMap(tree, pathMapAbsolute, baseDir) {
|
|
117
|
+
if (!pathMapAbsolute.length) return;
|
|
118
|
+
const pathMap = (0, _pathMap().convertPathMapToRelativePaths)(pathMapAbsolute, baseDir);
|
|
119
|
+
Object.keys(tree).forEach(filePath => {
|
|
120
|
+
const treeFiles = tree[filePath].files;
|
|
121
|
+
if (!treeFiles.length) return; // file has no dependency
|
|
122
|
+
const mainFilePathMap = pathMap.find(file => file.file === filePath);
|
|
123
|
+
if (!mainFilePathMap) throw new Error(`updateTreeWithPathMap: PathMap is missing for ${filePath}`);
|
|
124
|
+
// a file might have a cycle dependency with itself, remove it from the dependencies.
|
|
125
|
+
tree[filePath].files = treeFiles.filter(dependency => dependency.file !== filePath);
|
|
126
|
+
tree[filePath].files.forEach(fileObject => {
|
|
127
|
+
const dependencyPathMap = mainFilePathMap.dependencies.find(file => file.resolvedDep === fileObject.file);
|
|
128
|
+
if (!dependencyPathMap) {
|
|
129
|
+
throw new Error(`updateTreeWithPathMap: dependencyPathMap is missing for ${fileObject.file}`);
|
|
130
|
+
}
|
|
131
|
+
fileObject.importSource = dependencyPathMap.importSource;
|
|
132
|
+
if (dependencyPathMap.importSpecifiers && dependencyPathMap.importSpecifiers.length) {
|
|
133
|
+
const depImportSpecifiers = dependencyPathMap.importSpecifiers.map(importSpecifier => {
|
|
134
|
+
return {
|
|
135
|
+
mainFile: importSpecifier
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
fileObject.importSpecifiers = depImportSpecifiers;
|
|
139
|
+
}
|
|
140
|
+
return fileObject;
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function mergeManuallyFoundPackagesToTree(foundPackages, missingGroups, tree) {
|
|
145
|
+
if ((0, _lodash().isEmpty)(foundPackages.components) && (0, _lodash().isEmpty)(foundPackages.packages)) return;
|
|
146
|
+
// Merge manually found packages (by groupMissing()) with the packages found by Madge (generate-tree-madge)
|
|
147
|
+
Object.keys(foundPackages.packages).forEach(pkg => {
|
|
148
|
+
// locate package in groups(contains missing)
|
|
149
|
+
missingGroups.forEach(fileDep => {
|
|
150
|
+
if (fileDep.packages && fileDep.packages.includes(pkg)) {
|
|
151
|
+
fileDep.packages = fileDep.packages.filter(packageName => packageName !== pkg);
|
|
152
|
+
(0, _lodash().set)(tree[fileDep.originFile], ['packages', pkg], foundPackages.packages[pkg]);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
foundPackages.components.forEach(component => {
|
|
157
|
+
missingGroups.forEach(fileDep => {
|
|
158
|
+
if (fileDep.packages && fileDep.packages.includes(component.name)) {
|
|
159
|
+
fileDep.packages = fileDep.packages.filter(packageName => packageName !== component.name);
|
|
160
|
+
(tree[fileDep.originFile] ||= new (_dependencyTreeType().DependenciesTreeItem)()).components.push(component);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function mergeMissingToTree(missingGroups, tree) {
|
|
166
|
+
if ((0, _lodash().isEmpty)(missingGroups)) return;
|
|
167
|
+
missingGroups.forEach(missing => {
|
|
168
|
+
const missingCloned = (0, _lodash().clone)(missing);
|
|
169
|
+
delete missingCloned.originFile;
|
|
170
|
+
(tree[missing.originFile] ||= new (_dependencyTreeType().DependenciesTreeItem)()).missing = missingCloned;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function mergeErrorsToTree(errors, tree) {
|
|
174
|
+
if ((0, _lodash().isEmpty)(errors)) return;
|
|
175
|
+
Object.keys(errors).forEach(file => {
|
|
176
|
+
(tree[file] ||= new (_dependencyTreeType().DependenciesTreeItem)()).error = errors[file];
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Function for fetching dependency tree of file or dir
|
|
182
|
+
* @param baseDir working directory
|
|
183
|
+
* @param workspacePath
|
|
184
|
+
* @param filePaths path of the file to calculate the dependencies
|
|
185
|
+
*/
|
|
186
|
+
async function getDependencyTree({
|
|
187
|
+
componentDir,
|
|
188
|
+
// component rootDir
|
|
189
|
+
workspacePath,
|
|
190
|
+
filePaths,
|
|
191
|
+
visited = {},
|
|
192
|
+
cacheProjectAst,
|
|
193
|
+
envDetectors
|
|
194
|
+
}) {
|
|
195
|
+
const config = {
|
|
196
|
+
baseDir: componentDir,
|
|
197
|
+
includeNpm: true,
|
|
198
|
+
requireConfig: null,
|
|
199
|
+
webpackConfig: null,
|
|
200
|
+
visited,
|
|
201
|
+
nonExistent: [],
|
|
202
|
+
cacheProjectAst,
|
|
203
|
+
envDetectors
|
|
204
|
+
};
|
|
205
|
+
// This is important because without this, madge won't know to resolve files if we run the
|
|
206
|
+
// CMD not from the root dir
|
|
207
|
+
const fullPaths = filePaths.map(filePath => {
|
|
208
|
+
if (filePath.startsWith(componentDir)) {
|
|
209
|
+
return filePath;
|
|
210
|
+
}
|
|
211
|
+
return _path().default.resolve(componentDir, filePath);
|
|
212
|
+
});
|
|
213
|
+
const {
|
|
214
|
+
madgeTree,
|
|
215
|
+
skipped,
|
|
216
|
+
pathMap,
|
|
217
|
+
errors
|
|
218
|
+
} = (0, _generateTreeMadge().default)(fullPaths, config);
|
|
219
|
+
const tree = MadgeTreeToDependenciesTree(madgeTree, componentDir);
|
|
220
|
+
const {
|
|
221
|
+
missingGroups,
|
|
222
|
+
foundPackages
|
|
223
|
+
} = new (_missingHandler().MissingHandler)(skipped, componentDir, workspacePath).groupAndFindMissing();
|
|
224
|
+
if (foundPackages) mergeManuallyFoundPackagesToTree(foundPackages, missingGroups, tree);
|
|
225
|
+
if (errors) mergeErrorsToTree(errors, tree);
|
|
226
|
+
if (missingGroups) mergeMissingToTree(missingGroups, tree);
|
|
227
|
+
if (pathMap) updateTreeWithPathMap(tree, pathMap, componentDir);
|
|
228
|
+
return {
|
|
229
|
+
tree
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
//# sourceMappingURL=build-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_path","_interopRequireDefault","_resolvePkgData","_generateTreeMadge","_missingHandler","_pathMap","_dependencyTreeType","e","__esModule","default","groupDependencyList","dependenciesPaths","componentDir","resultGroups","DependenciesTreeItem","isPackage","str","includes","forEach","dependencyPath","files","push","file","resolvedPackage","resolvePackageData","path","join","unidentifiedPackages","componentId","components","version","versionUsedByDependent","concreteVersion","packageWithVersion","name","Object","assign","packages","MadgeTreeToDependenciesTree","tree","result","keys","filePath","isEmpty","updateTreeWithPathMap","pathMapAbsolute","baseDir","length","pathMap","convertPathMapToRelativePaths","treeFiles","mainFilePathMap","find","Error","filter","dependency","fileObject","dependencyPathMap","dependencies","resolvedDep","importSource","importSpecifiers","depImportSpecifiers","map","importSpecifier","mainFile","mergeManuallyFoundPackagesToTree","foundPackages","missingGroups","pkg","fileDep","packageName","set","originFile","component","mergeMissingToTree","missing","missingCloned","clone","mergeErrorsToTree","errors","error","getDependencyTree","workspacePath","filePaths","visited","cacheProjectAst","envDetectors","config","includeNpm","requireConfig","webpackConfig","nonExistent","fullPaths","startsWith","resolve","madgeTree","skipped","generateTree","MissingHandler","groupAndFindMissing"],"sources":["build-tree.ts"],"sourcesContent":["import { clone, isEmpty, set } from 'lodash';\nimport path from 'path';\nimport { resolvePackageData } from '../resolve-pkg-data';\nimport generateTree, { MadgeTree } from './generate-tree-madge';\nimport { FoundPackages, MissingGroupItem, MissingHandler } from './missing-handler';\nimport { convertPathMapToRelativePaths, PathMapItem } from './path-map';\nimport { DependencyTreeParams, FileObject, DependenciesTree, DependenciesTreeItem } from './types/dependency-tree-type';\n\n/**\n * Gets a list of dependencies and group them by types (files, components, packages)\n * It's also transform the node package dependencies from array of paths to object in this format:\n * {dependencyName: version} (like in package.json)\n *\n * componentDir is the root of working directory (used for node packages version calculation)\n */\nfunction groupDependencyList(dependenciesPaths: string[], componentDir: string): DependenciesTreeItem {\n const resultGroups = new DependenciesTreeItem();\n const isPackage = (str: string) => str.includes('node_modules/');\n dependenciesPaths.forEach((dependencyPath) => {\n if (!isPackage(dependencyPath)) {\n resultGroups.files.push({ file: dependencyPath });\n return;\n }\n const resolvedPackage = resolvePackageData(componentDir, path.join(componentDir, dependencyPath));\n if (!resolvedPackage) {\n // package doesn't have package.json, probably it's a custom-resolve-module dep file\n resultGroups.unidentifiedPackages.push(dependencyPath);\n return;\n }\n\n // If the package is a component add it to the components list\n if (resolvedPackage.componentId) {\n resultGroups.components.push(resolvedPackage);\n return;\n }\n const version = resolvedPackage.versionUsedByDependent || resolvedPackage.concreteVersion;\n const packageWithVersion = {\n [resolvedPackage.name]: version,\n };\n Object.assign(resultGroups.packages, packageWithVersion);\n });\n\n return resultGroups;\n}\n\n/**\n * Run over each entry in the tree and transform the dependencies from list of paths\n * to object with dependencies types\n *\n * @returns new tree with grouped dependencies\n */\nfunction MadgeTreeToDependenciesTree(tree: MadgeTree, componentDir: string): DependenciesTree {\n const result: DependenciesTree = {};\n Object.keys(tree).forEach((filePath) => {\n if (tree[filePath] && !isEmpty(tree[filePath])) {\n result[filePath] = groupDependencyList(tree[filePath], componentDir);\n } else {\n result[filePath] = new DependenciesTreeItem();\n }\n });\n\n return result;\n}\n\n/**\n * add extra data such as custom-resolve and link-files from pathMap\n */\nfunction updateTreeWithPathMap(tree: DependenciesTree, pathMapAbsolute: PathMapItem[], baseDir: string): void {\n if (!pathMapAbsolute.length) return;\n const pathMap = convertPathMapToRelativePaths(pathMapAbsolute, baseDir);\n Object.keys(tree).forEach((filePath: string) => {\n const treeFiles = tree[filePath].files;\n if (!treeFiles.length) return; // file has no dependency\n const mainFilePathMap = pathMap.find((file) => file.file === filePath);\n if (!mainFilePathMap) throw new Error(`updateTreeWithPathMap: PathMap is missing for ${filePath}`);\n // a file might have a cycle dependency with itself, remove it from the dependencies.\n tree[filePath].files = treeFiles.filter((dependency) => dependency.file !== filePath);\n tree[filePath].files.forEach((fileObject: FileObject) => {\n const dependencyPathMap = mainFilePathMap.dependencies.find((file) => file.resolvedDep === fileObject.file);\n if (!dependencyPathMap) {\n throw new Error(`updateTreeWithPathMap: dependencyPathMap is missing for ${fileObject.file}`);\n }\n fileObject.importSource = dependencyPathMap.importSource;\n if (dependencyPathMap.importSpecifiers && dependencyPathMap.importSpecifiers.length) {\n const depImportSpecifiers = dependencyPathMap.importSpecifiers.map((importSpecifier) => {\n return {\n mainFile: importSpecifier,\n };\n });\n fileObject.importSpecifiers = depImportSpecifiers;\n }\n return fileObject;\n });\n });\n}\n\nfunction mergeManuallyFoundPackagesToTree(\n foundPackages: FoundPackages,\n missingGroups: MissingGroupItem[],\n tree: DependenciesTree\n) {\n if (isEmpty(foundPackages.components) && isEmpty(foundPackages.packages)) return;\n // Merge manually found packages (by groupMissing()) with the packages found by Madge (generate-tree-madge)\n Object.keys(foundPackages.packages).forEach((pkg) => {\n // locate package in groups(contains missing)\n missingGroups.forEach((fileDep: MissingGroupItem) => {\n if (fileDep.packages && fileDep.packages.includes(pkg)) {\n fileDep.packages = fileDep.packages.filter((packageName) => packageName !== pkg);\n set(tree[fileDep.originFile], ['packages', pkg], foundPackages.packages[pkg]);\n }\n });\n });\n foundPackages.components.forEach((component) => {\n missingGroups.forEach((fileDep: MissingGroupItem) => {\n if (fileDep.packages && fileDep.packages.includes(component.name)) {\n fileDep.packages = fileDep.packages.filter((packageName) => packageName !== component.name);\n (tree[fileDep.originFile] ||= new DependenciesTreeItem()).components.push(component);\n }\n });\n });\n}\n\nfunction mergeMissingToTree(missingGroups, tree: DependenciesTree) {\n if (isEmpty(missingGroups)) return;\n missingGroups.forEach((missing) => {\n const missingCloned = clone(missing);\n delete missingCloned.originFile;\n (tree[missing.originFile] ||= new DependenciesTreeItem()).missing = missingCloned;\n });\n}\n\nfunction mergeErrorsToTree(errors, tree: DependenciesTree) {\n if (isEmpty(errors)) return;\n Object.keys(errors).forEach((file) => {\n (tree[file] ||= new DependenciesTreeItem()).error = errors[file];\n });\n}\n\n/**\n * Function for fetching dependency tree of file or dir\n * @param baseDir working directory\n * @param workspacePath\n * @param filePaths path of the file to calculate the dependencies\n */\nexport async function getDependencyTree({\n componentDir, // component rootDir\n workspacePath,\n filePaths,\n visited = {},\n cacheProjectAst,\n envDetectors,\n}: DependencyTreeParams): Promise<{ tree: DependenciesTree }> {\n const config = {\n baseDir: componentDir,\n includeNpm: true,\n requireConfig: null,\n webpackConfig: null,\n visited,\n nonExistent: [],\n cacheProjectAst,\n envDetectors,\n };\n // This is important because without this, madge won't know to resolve files if we run the\n // CMD not from the root dir\n const fullPaths = filePaths.map((filePath) => {\n if (filePath.startsWith(componentDir)) {\n return filePath;\n }\n return path.resolve(componentDir, filePath);\n });\n const { madgeTree, skipped, pathMap, errors } = generateTree(fullPaths, config);\n const tree: DependenciesTree = MadgeTreeToDependenciesTree(madgeTree, componentDir);\n const { missingGroups, foundPackages } = new MissingHandler(\n skipped,\n componentDir,\n workspacePath\n ).groupAndFindMissing();\n\n if (foundPackages) mergeManuallyFoundPackagesToTree(foundPackages, missingGroups, tree);\n if (errors) mergeErrorsToTree(errors, tree);\n if (missingGroups) mergeMissingToTree(missingGroups, tree);\n if (pathMap) updateTreeWithPathMap(tree, pathMap, componentDir);\n\n return { tree };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAA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AAS,CAACrB,GAAG,CAAErB,QAAQ,IAAK;IAC5C,IAAIA,QAAQ,CAACoD,UAAU,CAAClF,YAAY,CAAC,EAAE;MACrC,OAAO8B,QAAQ;IACjB;IACA,OAAOjB,eAAI,CAACsE,OAAO,CAACnF,YAAY,EAAE8B,QAAQ,CAAC;EAC7C,CAAC,CAAC;EACF,MAAM;IAAEsD,SAAS;IAAEC,OAAO;IAAEjD,OAAO;IAAEgC;EAAO,CAAC,GAAG,IAAAkB,4BAAY,EAACL,SAAS,EAAEL,MAAM,CAAC;EAC/E,MAAMjD,IAAsB,GAAGD,2BAA2B,CAAC0D,SAAS,EAAEpF,YAAY,CAAC;EACnF,MAAM;IAAEwD,aAAa;IAAED;EAAc,CAAC,GAAG,KAAIgC,gCAAc,EACzDF,OAAO,EACPrF,YAAY,EACZuE,aACF,CAAC,CAACiB,mBAAmB,CAAC,CAAC;EAEvB,IAAIjC,aAAa,EAAED,gCAAgC,CAACC,aAAa,EAAEC,aAAa,EAAE7B,IAAI,CAAC;EACvF,IAAIyC,MAAM,EAAED,iBAAiB,CAACC,MAAM,EAAEzC,IAAI,CAAC;EAC3C,IAAI6B,aAAa,EAAEO,kBAAkB,CAACP,aAAa,EAAE7B,IAAI,CAAC;EAC1D,IAAIS,OAAO,EAAEJ,qBAAqB,CAACL,IAAI,EAAES,OAAO,EAAEpC,YAAY,CAAC;EAE/D,OAAO;IAAE2B;EAAK,CAAC;AACjB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _chai() {
|
|
4
|
+
const data = require("chai");
|
|
5
|
+
_chai = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _path() {
|
|
11
|
+
const data = _interopRequireDefault(require("path"));
|
|
12
|
+
_path = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function buildTree() {
|
|
18
|
+
const data = _interopRequireWildcard(require("./build-tree"));
|
|
19
|
+
buildTree = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
|
+
const fixtures = `fixtures`;
|
|
28
|
+
const precinctFixtures = _path().default.join(fixtures, 'precinct');
|
|
29
|
+
const buildTreeFixtures = _path().default.join(fixtures, 'build-tree');
|
|
30
|
+
describe('buildTree', () => {
|
|
31
|
+
describe('getDependencyTree', () => {
|
|
32
|
+
const filePaths = [];
|
|
33
|
+
let visited;
|
|
34
|
+
const dependencyTreeParams = {
|
|
35
|
+
componentDir: __dirname,
|
|
36
|
+
workspacePath: __dirname,
|
|
37
|
+
filePaths,
|
|
38
|
+
visited
|
|
39
|
+
};
|
|
40
|
+
it('when no files are passed should return an empty tree', async () => {
|
|
41
|
+
const results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
42
|
+
(0, _chai().expect)(results).to.deep.equal({
|
|
43
|
+
tree: {}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
it('when unsupported files are passed should return them with no dependencies', async () => {
|
|
47
|
+
dependencyTreeParams.filePaths = [`${fixtures}/unsupported-file.pdf`];
|
|
48
|
+
const results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
49
|
+
(0, _chai().expect)(results.tree[`${fixtures}/unsupported-file.pdf`].isEmpty()).to.be.true;
|
|
50
|
+
});
|
|
51
|
+
it('when supported and unsupported files are passed should return them all', async () => {
|
|
52
|
+
dependencyTreeParams.filePaths = [`${fixtures}/unsupported-file.pdf`, `${precinctFixtures}/es6.js`];
|
|
53
|
+
const results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
54
|
+
(0, _chai().expect)(results.tree).to.have.property(`${fixtures}/unsupported-file.pdf`);
|
|
55
|
+
(0, _chai().expect)(results.tree).to.have.property(`${fixtures}/precinct/es6.js`);
|
|
56
|
+
});
|
|
57
|
+
// todo: fix this one and one below once we have a way to ignore some component files from compiling/parsing altogether
|
|
58
|
+
// uncomment unparseable.js
|
|
59
|
+
it.skip('when a js file has parsing error it should add the file to the tree with the error instance', async () => {
|
|
60
|
+
dependencyTreeParams.filePaths = [`${precinctFixtures}/unparseable.js`];
|
|
61
|
+
const results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
62
|
+
const unParsedFile = `${fixtures}/precinct/unparseable.js`;
|
|
63
|
+
(0, _chai().expect)(results.tree).to.have.property(unParsedFile);
|
|
64
|
+
(0, _chai().expect)(results.tree[unParsedFile]).to.have.property('error');
|
|
65
|
+
(0, _chai().expect)(results.tree[unParsedFile].error).to.be.instanceof(Error);
|
|
66
|
+
});
|
|
67
|
+
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 () => {
|
|
68
|
+
dependencyTreeParams.filePaths = [`${precinctFixtures}/unparseable.js`];
|
|
69
|
+
dependencyTreeParams.visited = {};
|
|
70
|
+
const results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
71
|
+
const unParsedFile = `${fixtures}/precinct/unparseable.js`;
|
|
72
|
+
(0, _chai().expect)(results.tree).to.have.property(unParsedFile);
|
|
73
|
+
(0, _chai().expect)(results.tree[unParsedFile]).to.have.property('error');
|
|
74
|
+
(0, _chai().expect)(results.tree[unParsedFile].error).to.be.instanceof(Error);
|
|
75
|
+
|
|
76
|
+
// second time, this time it fetches from the cache (visited object)
|
|
77
|
+
const resultsCached = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
78
|
+
(0, _chai().expect)(resultsCached.tree).to.have.property(unParsedFile);
|
|
79
|
+
(0, _chai().expect)(resultsCached.tree[unParsedFile]).to.have.property('error');
|
|
80
|
+
(0, _chai().expect)(resultsCached.tree[unParsedFile].error).to.be.instanceof(Error);
|
|
81
|
+
});
|
|
82
|
+
// todo: fix this one once we have a way to ignore some component files from compiling/parsing altogether
|
|
83
|
+
// uncomment fixtures/build-tree/unparsed.js file
|
|
84
|
+
describe.skip('when a dependency of dependency has parsing error', () => {
|
|
85
|
+
let results;
|
|
86
|
+
before(async () => {
|
|
87
|
+
dependencyTreeParams.filePaths = [`${buildTreeFixtures}/a.js`, `${buildTreeFixtures}/b.js`];
|
|
88
|
+
results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
89
|
+
});
|
|
90
|
+
it('should add all the files to the tree', async () => {
|
|
91
|
+
(0, _chai().expect)(results.tree).to.have.property(`${fixtures}/build-tree/a.js`);
|
|
92
|
+
(0, _chai().expect)(results.tree).to.have.property(`${fixtures}/build-tree/b.js`);
|
|
93
|
+
(0, _chai().expect)(results.tree).to.have.property(`${fixtures}/build-tree/unparsed.js`);
|
|
94
|
+
});
|
|
95
|
+
it('should not add the error to the files without parsing error', () => {
|
|
96
|
+
(0, _chai().expect)(results.tree[`${fixtures}/build-tree/a.js`].error).to.be.undefined;
|
|
97
|
+
(0, _chai().expect)(results.tree[`${fixtures}/build-tree/b.js`].error).to.be.undefined;
|
|
98
|
+
});
|
|
99
|
+
it('should add the parsing error to the un-parsed file', () => {
|
|
100
|
+
(0, _chai().expect)(results.tree[`${fixtures}/build-tree/unparsed.js`]).to.have.property('error');
|
|
101
|
+
(0, _chai().expect)(results.tree[`${fixtures}/build-tree/unparsed.js`].error).to.be.instanceof(Error);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
// todo: fix this one once we have a way to ignore some component files from compiling/parsing altogether
|
|
105
|
+
// uncomment fixtures/missing-deps.js file
|
|
106
|
+
describe.skip('missing dependencies', () => {
|
|
107
|
+
let results;
|
|
108
|
+
const missingDepsFile = 'fixtures/missing-deps.js';
|
|
109
|
+
before(async () => {
|
|
110
|
+
dependencyTreeParams.filePaths = [missingDepsFile];
|
|
111
|
+
results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
112
|
+
(0, _chai().expect)(results.tree).to.have.property(`${fixtures}/missing-deps.js`);
|
|
113
|
+
(0, _chai().expect)(results.tree[`${fixtures}/missing-deps.js`]).to.have.property('missing');
|
|
114
|
+
});
|
|
115
|
+
it('it should add the missing dependency to the missing section in the tree', async () => {
|
|
116
|
+
(0, _chai().expect)(results.tree[`${fixtures}/missing-deps.js`].missing).to.have.property('files');
|
|
117
|
+
(0, _chai().expect)(results.tree[`${fixtures}/missing-deps.js`].missing.files[0]).to.equal('../non-exist-dep');
|
|
118
|
+
});
|
|
119
|
+
it('it should add the missing package to the missing section in the tree', async () => {
|
|
120
|
+
(0, _chai().expect)(results.tree[`${fixtures}/missing-deps.js`].missing).to.have.property('packages');
|
|
121
|
+
(0, _chai().expect)(results.tree[`${fixtures}/missing-deps.js`].missing.packages[0]).to.equal('non-exist-package');
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
describe('tree shaking with cycle', () => {
|
|
125
|
+
describe('when a file imports from itself', () => {
|
|
126
|
+
let results;
|
|
127
|
+
before(async () => {
|
|
128
|
+
dependencyTreeParams.filePaths = [`${buildTreeFixtures}/tree-shaking-cycle/self-cycle.js`];
|
|
129
|
+
results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
130
|
+
});
|
|
131
|
+
it('should not throw an error and should remove itself from the dependencies files', () => {
|
|
132
|
+
const file = `${fixtures}/build-tree/tree-shaking-cycle/self-cycle.js`;
|
|
133
|
+
(0, _chai().expect)(results.tree[file].files).to.be.an('array').and.empty;
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
// probably not relevant anymore.
|
|
137
|
+
describe.skip('cycle with multiple files', () => {
|
|
138
|
+
let results;
|
|
139
|
+
before(async () => {
|
|
140
|
+
dependencyTreeParams.filePaths = [`${buildTreeFixtures}/tree-shaking-cycle/foo.js`];
|
|
141
|
+
results = await buildTree().getDependencyTree(dependencyTreeParams);
|
|
142
|
+
});
|
|
143
|
+
it('should not recognize the cycle dependencies as link files', () => {
|
|
144
|
+
const file = `${fixtures}/build-tree/tree-shaking-cycle/foo.js`;
|
|
145
|
+
(0, _chai().expect)(results.tree[file].files).to.be.an('array').and.have.lengthOf(1);
|
|
146
|
+
const indexDep = results.tree[file].files[0];
|
|
147
|
+
(0, _chai().expect)(indexDep.file).to.equal(`${fixtures}/build-tree/tree-shaking-cycle/index.js`);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
//# sourceMappingURL=build-tree.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_path","_interopRequireDefault","buildTree","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","fixtures","precinctFixtures","path","join","buildTreeFixtures","describe","filePaths","visited","dependencyTreeParams","componentDir","__dirname","workspacePath","it","results","getDependencyTree","expect","to","deep","equal","tree","isEmpty","be","true","have","property","skip","unParsedFile","error","instanceof","Error","resultsCached","before","undefined","missingDepsFile","missing","files","packages","file","an","and","empty","lengthOf","indexDep"],"sources":["build-tree.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport path from 'path';\n\nimport * as buildTree from './build-tree';\n\nconst fixtures = `fixtures`;\nconst precinctFixtures = path.join(fixtures, 'precinct');\nconst buildTreeFixtures = path.join(fixtures, 'build-tree');\n\ndescribe('buildTree', () => {\n describe('getDependencyTree', () => {\n const filePaths: string[] = [];\n let visited: any;\n const dependencyTreeParams = {\n componentDir: __dirname,\n workspacePath: __dirname,\n filePaths,\n visited,\n };\n it('when no files are passed should return an empty tree', async () => {\n const results = await buildTree.getDependencyTree(dependencyTreeParams);\n expect(results).to.deep.equal({ tree: {} });\n });\n it('when unsupported files are passed should return them with no dependencies', async () => {\n dependencyTreeParams.filePaths = [`${fixtures}/unsupported-file.pdf`];\n const results = await buildTree.getDependencyTree(dependencyTreeParams);\n expect(results.tree[`${fixtures}/unsupported-file.pdf`].isEmpty()).to.be.true;\n });\n it('when supported and unsupported files are passed should return them all', async () => {\n dependencyTreeParams.filePaths = [`${fixtures}/unsupported-file.pdf`, `${precinctFixtures}/es6.js`];\n const results = await buildTree.getDependencyTree(dependencyTreeParams);\n expect(results.tree).to.have.property(`${fixtures}/unsupported-file.pdf`);\n expect(results.tree).to.have.property(`${fixtures}/precinct/es6.js`);\n });\n // todo: fix this one and one below once we have a way to ignore some component files from compiling/parsing altogether\n // uncomment unparseable.js\n it.skip('when a js file has parsing error it should add the file to the tree with the error instance', async () => {\n dependencyTreeParams.filePaths = [`${precinctFixtures}/unparseable.js`];\n const results = await buildTree.getDependencyTree(dependencyTreeParams);\n const unParsedFile = `${fixtures}/precinct/unparseable.js`;\n expect(results.tree).to.have.property(unParsedFile);\n expect(results.tree[unParsedFile]).to.have.property('error');\n expect(results.tree[unParsedFile].error).to.be.instanceof(Error);\n });\n 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 () => {\n dependencyTreeParams.filePaths = [`${precinctFixtures}/unparseable.js`];\n dependencyTreeParams.visited = {};\n const results = await buildTree.getDependencyTree(dependencyTreeParams);\n const unParsedFile = `${fixtures}/precinct/unparseable.js`;\n expect(results.tree).to.have.property(unParsedFile);\n expect(results.tree[unParsedFile]).to.have.property('error');\n expect(results.tree[unParsedFile].error).to.be.instanceof(Error);\n\n // second time, this time it fetches from the cache (visited object)\n const resultsCached = await buildTree.getDependencyTree(dependencyTreeParams);\n expect(resultsCached.tree).to.have.property(unParsedFile);\n expect(resultsCached.tree[unParsedFile]).to.have.property('error');\n expect(resultsCached.tree[unParsedFile].error).to.be.instanceof(Error);\n });\n // todo: fix this one once we have a way to ignore some component files from compiling/parsing altogether\n // uncomment fixtures/build-tree/unparsed.js file\n describe.skip('when a dependency of dependency has parsing error', () => {\n let results;\n before(async () => {\n dependencyTreeParams.filePaths = [`${buildTreeFixtures}/a.js`, `${buildTreeFixtures}/b.js`];\n results = await buildTree.getDependencyTree(dependencyTreeParams);\n });\n it('should add all the files to the tree', async () => {\n expect(results.tree).to.have.property(`${fixtures}/build-tree/a.js`);\n expect(results.tree).to.have.property(`${fixtures}/build-tree/b.js`);\n expect(results.tree).to.have.property(`${fixtures}/build-tree/unparsed.js`);\n });\n it('should not add the error to the files without parsing error', () => {\n expect(results.tree[`${fixtures}/build-tree/a.js`].error).to.be.undefined;\n expect(results.tree[`${fixtures}/build-tree/b.js`].error).to.be.undefined;\n });\n it('should add the parsing error to the un-parsed file', () => {\n expect(results.tree[`${fixtures}/build-tree/unparsed.js`]).to.have.property('error');\n expect(results.tree[`${fixtures}/build-tree/unparsed.js`].error).to.be.instanceof(Error);\n });\n });\n // todo: fix this one once we have a way to ignore some component files from compiling/parsing altogether\n // uncomment fixtures/missing-deps.js file\n describe.skip('missing dependencies', () => {\n let results;\n const missingDepsFile = 'fixtures/missing-deps.js';\n before(async () => {\n dependencyTreeParams.filePaths = [missingDepsFile];\n results = await buildTree.getDependencyTree(dependencyTreeParams);\n expect(results.tree).to.have.property(`${fixtures}/missing-deps.js`);\n expect(results.tree[`${fixtures}/missing-deps.js`]).to.have.property('missing');\n });\n it('it should add the missing dependency to the missing section in the tree', async () => {\n expect(results.tree[`${fixtures}/missing-deps.js`].missing).to.have.property('files');\n expect(results.tree[`${fixtures}/missing-deps.js`].missing.files[0]).to.equal('../non-exist-dep');\n });\n it('it should add the missing package to the missing section in the tree', async () => {\n expect(results.tree[`${fixtures}/missing-deps.js`].missing).to.have.property('packages');\n expect(results.tree[`${fixtures}/missing-deps.js`].missing.packages[0]).to.equal('non-exist-package');\n });\n });\n describe('tree shaking with cycle', () => {\n describe('when a file imports from itself', () => {\n let results;\n before(async () => {\n dependencyTreeParams.filePaths = [`${buildTreeFixtures}/tree-shaking-cycle/self-cycle.js`];\n results = await buildTree.getDependencyTree(dependencyTreeParams);\n });\n it('should not throw an error and should remove itself from the dependencies files', () => {\n const file = `${fixtures}/build-tree/tree-shaking-cycle/self-cycle.js`;\n expect(results.tree[file].files).to.be.an('array').and.empty;\n });\n });\n // probably not relevant anymore.\n describe.skip('cycle with multiple files', () => {\n let results;\n before(async () => {\n dependencyTreeParams.filePaths = [`${buildTreeFixtures}/tree-shaking-cycle/foo.js`];\n results = await buildTree.getDependencyTree(dependencyTreeParams);\n });\n it('should not recognize the cycle dependencies as link files', () => {\n const file = `${fixtures}/build-tree/tree-shaking-cycle/foo.js`;\n expect(results.tree[file].files).to.be.an('array').and.have.lengthOf(1);\n const indexDep = results.tree[file].files[0];\n expect(indexDep.file).to.equal(`${fixtures}/build-tree/tree-shaking-cycle/index.js`);\n });\n });\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAK,uBAAA,CAAAJ,OAAA;EAAAG,SAAA,YAAAA,CAA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AAC,CAAC;UAC5C,IAAApB,cAAM,EAAC2B,QAAQ,CAACL,IAAI,CAAC,CAACrB,EAAE,CAACE,KAAK,CAAC,GAAGlB,QAAQ,yCAAyC,CAAC;QACtF,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Config;
|
|
7
|
+
/**
|
|
8
|
+
* this file had been forked from https://github.com/dependents/node-dependency-tree
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const debug = require('debug')('tree');
|
|
13
|
+
function Config(options) {
|
|
14
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
15
|
+
this.filename = options.filename;
|
|
16
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
17
|
+
this.directory = options.directory || options.root;
|
|
18
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
19
|
+
this.visited = options.visited || {};
|
|
20
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
21
|
+
this.errors = options.errors || {};
|
|
22
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
23
|
+
this.nonExistent = options.nonExistent || [];
|
|
24
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
25
|
+
this.isListForm = options.isListForm;
|
|
26
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
27
|
+
this.requireConfig = options.config || options.requireConfig;
|
|
28
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
29
|
+
this.webpackConfig = options.webpackConfig;
|
|
30
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
31
|
+
this.detectiveConfig = options.detective || options.detectiveConfig || {};
|
|
32
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
33
|
+
this.pathMap = options.pathMap || [];
|
|
34
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
35
|
+
this.resolveConfig = options.resolveConfig;
|
|
36
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
37
|
+
this.cacheProjectAst = options.cacheProjectAst;
|
|
38
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
39
|
+
this.envDetectors = options.envDetectors;
|
|
40
|
+
|
|
41
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
42
|
+
this.filter = options.filter;
|
|
43
|
+
|
|
44
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
45
|
+
if (!this.filename) {
|
|
46
|
+
throw new Error('filename not given');
|
|
47
|
+
}
|
|
48
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
49
|
+
if (!this.directory) {
|
|
50
|
+
throw new Error('directory not given');
|
|
51
|
+
}
|
|
52
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
53
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
54
|
+
if (this.filter && typeof this.filter !== 'function') {
|
|
55
|
+
throw new Error('filter must be a function');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
59
|
+
debug(`given filename: ${this.filename}`);
|
|
60
|
+
|
|
61
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
62
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
63
|
+
this.filename = path.resolve(process.cwd(), this.filename);
|
|
64
|
+
|
|
65
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
66
|
+
debug(`resolved filename: ${this.filename}`);
|
|
67
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
68
|
+
debug('visited: ', this.visited);
|
|
69
|
+
}
|
|
70
|
+
Config.prototype.clone = function () {
|
|
71
|
+
return new Config(this);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=Config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["path","require","debug","Config","options","filename","directory","root","visited","errors","nonExistent","isListForm","requireConfig","config","webpackConfig","detectiveConfig","detective","pathMap","resolveConfig","cacheProjectAst","envDetectors","filter","Error","resolve","process","cwd","prototype","clone"],"sources":["Config.ts"],"sourcesContent":["/**\n * this file had been forked from https://github.com/dependents/node-dependency-tree\n */\n\nconst path = require('path');\nconst debug = require('debug')('tree');\n\nexport default function Config(options) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.filename = options.filename;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.directory = options.directory || options.root;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.visited = options.visited || {};\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.errors = options.errors || {};\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.nonExistent = options.nonExistent || [];\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.isListForm = options.isListForm;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.requireConfig = options.config || options.requireConfig;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.webpackConfig = options.webpackConfig;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.detectiveConfig = options.detective || options.detectiveConfig || {};\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.pathMap = options.pathMap || [];\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.resolveConfig = options.resolveConfig;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.cacheProjectAst = options.cacheProjectAst;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.envDetectors = options.envDetectors;\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.filter = options.filter;\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (!this.filename) {\n throw new Error('filename not given');\n }\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (!this.directory) {\n throw new Error('directory not given');\n }\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.filter && typeof this.filter !== 'function') {\n throw new Error('filter must be a function');\n }\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n debug(`given filename: ${this.filename}`);\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.filename = path.resolve(process.cwd(), this.filename);\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n debug(`resolved filename: ${this.filename}`);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n debug('visited: ', this.visited);\n}\n\nConfig.prototype.clone = function () {\n return new Config(this);\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAMC,KAAK,GAAGD,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AAEvB,SAASE,MAAMA,CAACC,OAAO,EAAE;EACtC;EACA,IAAI,CAACC,QAAQ,GAAGD,OAAO,CAACC,QAAQ;EAChC;EACA,IAAI,CAACC,SAAS,GAAGF,OAAO,CAACE,SAAS,IAAIF,OAAO,CAACG,IAAI;EAClD;EACA,IAAI,CAACC,OAAO,GAAGJ,OAAO,CAACI,OAAO,IAAI,CAAC,CAAC;EACpC;EACA,IAAI,CAACC,MAAM,GAAGL,OAAO,CAACK,MAAM,IAAI,CAAC,CAAC;EAClC;EACA,IAAI,CAACC,WAAW,GAAGN,OAAO,CAACM,WAAW,IAAI,EAAE;EAC5C;EACA,IAAI,CAACC,UAAU,GAAGP,OAAO,CAACO,UAAU;EACpC;EACA,IAAI,CAACC,aAAa,GAAGR,OAAO,CAACS,MAAM,IAAIT,OAAO,CAACQ,aAAa;EAC5D;EACA,IAAI,CAACE,aAAa,GAAGV,OAAO,CAACU,aAAa;EAC1C;EACA,IAAI,CAACC,eAAe,GAAGX,OAAO,CAACY,SAAS,IAAIZ,OAAO,CAACW,eAAe,IAAI,CAAC,CAAC;EACzE;EACA,IAAI,CAACE,OAAO,GAAGb,OAAO,CAACa,OAAO,IAAI,EAAE;EACpC;EACA,IAAI,CAACC,aAAa,GAAGd,OAAO,CAACc,aAAa;EAC1C;EACA,IAAI,CAACC,eAAe,GAAGf,OAAO,CAACe,eAAe;EAC9C;EACA,IAAI,CAACC,YAAY,GAAGhB,OAAO,CAACgB,YAAY;;EAExC;EACA,IAAI,CAACC,MAAM,GAAGjB,OAAO,CAACiB,MAAM;;EAE5B;EACA,IAAI,CAAC,IAAI,CAAChB,QAAQ,EAAE;IAClB,MAAM,IAAIiB,KAAK,CAAC,oBAAoB,CAAC;EACvC;EACA;EACA,IAAI,CAAC,IAAI,CAAChB,SAAS,EAAE;IACnB,MAAM,IAAIgB,KAAK,CAAC,qBAAqB,CAAC;EACxC;EACA;EACA;EACA,IAAI,IAAI,CAACD,MAAM,IAAI,OAAO,IAAI,CAACA,MAAM,KAAK,UAAU,EAAE;IACpD,MAAM,IAAIC,KAAK,CAAC,2BAA2B,CAAC;EAC9C;;EAEA;EACApB,KAAK,CAAC,mBAAmB,IAAI,CAACG,QAAQ,EAAE,CAAC;;EAEzC;EACA;EACA,IAAI,CAACA,QAAQ,GAAGL,IAAI,CAACuB,OAAO,CAACC,OAAO,CAACC,GAAG,CAAC,CAAC,EAAE,IAAI,CAACpB,QAAQ,CAAC;;EAE1D;EACAH,KAAK,CAAC,sBAAsB,IAAI,CAACG,QAAQ,EAAE,CAAC;EAC5C;EACAH,KAAK,CAAC,WAAW,EAAE,IAAI,CAACM,OAAO,CAAC;AAClC;AAEAL,MAAM,CAACuB,SAAS,CAACC,KAAK,GAAG,YAAY;EACnC,OAAO,IAAIxB,MAAM,CAAC,IAAI,CAAC;AACzB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively find all dependencies (avoiding circular) traversing the entire dependency tree
|
|
3
|
+
* and returns a flat list of all unique, visited nodes
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} options
|
|
6
|
+
* @param {String} options.filename - The path of the module whose tree to traverse
|
|
7
|
+
* @param {String} options.directory - The directory containing all JS files
|
|
8
|
+
* @param {String} [options.requireConfig] - The path to a requirejs config
|
|
9
|
+
* @param {String} [options.webpackConfig] - The path to a webpack config
|
|
10
|
+
* @param {Object} [options.visited] - Cache of visited, absolutely pathed files that should not be reprocessed.
|
|
11
|
+
* Format is a filename -> tree as list lookup table
|
|
12
|
+
* @param {Array} [options.nonExistent] - List of partials that do not exist
|
|
13
|
+
* @return {Object}
|
|
14
|
+
*/
|
|
15
|
+
export default function (options: any): {};
|