@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 @@
|
|
|
1
|
+
{"version":3,"names":["_buildTree","data","require","_precinct","_interopRequireDefault","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import { getDependencyTree } from './build-tree';\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\nimport getDependenciesFromSource from './precinct';\n\nexport { getDependencyTree, getDependenciesFromSource };\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ResolvedPackageData } from '../resolve-pkg-data';
|
|
2
|
+
import { Missing } from './generate-tree-madge';
|
|
3
|
+
export type MissingGroupItem = {
|
|
4
|
+
originFile: string;
|
|
5
|
+
packages?: string[];
|
|
6
|
+
files?: string[];
|
|
7
|
+
};
|
|
8
|
+
export type FoundPackages = {
|
|
9
|
+
packages: {
|
|
10
|
+
[packageName: string]: string;
|
|
11
|
+
};
|
|
12
|
+
components: ResolvedPackageData[];
|
|
13
|
+
};
|
|
14
|
+
export declare class MissingHandler {
|
|
15
|
+
private missing;
|
|
16
|
+
private componentDir;
|
|
17
|
+
private workspacePath;
|
|
18
|
+
constructor(missing: Missing, componentDir: string, workspacePath: string);
|
|
19
|
+
/**
|
|
20
|
+
* Run over each entry in the missing array and transform the missing from list of paths
|
|
21
|
+
* to object with missing types
|
|
22
|
+
*/
|
|
23
|
+
groupAndFindMissing(): {
|
|
24
|
+
missingGroups: MissingGroupItem[];
|
|
25
|
+
foundPackages: FoundPackages;
|
|
26
|
+
};
|
|
27
|
+
private processMissingGroup;
|
|
28
|
+
/**
|
|
29
|
+
* Group missing dependencies by types (files, packages)
|
|
30
|
+
* @param {Array} missing list of missing paths to group
|
|
31
|
+
* @returns {Function} function which group the dependencies
|
|
32
|
+
*/
|
|
33
|
+
private groupMissingByType;
|
|
34
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MissingHandler = void 0;
|
|
7
|
+
function _legacy() {
|
|
8
|
+
const data = require("@teambit/legacy.utils");
|
|
9
|
+
_legacy = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _resolvePkgData() {
|
|
15
|
+
const data = require("../resolve-pkg-data");
|
|
16
|
+
_resolvePkgData = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _generateTreeMadge() {
|
|
22
|
+
const data = require("./generate-tree-madge");
|
|
23
|
+
_generateTreeMadge = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _lodash() {
|
|
29
|
+
const data = require("lodash");
|
|
30
|
+
_lodash = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
class MissingHandler {
|
|
36
|
+
constructor(missing, componentDir, workspacePath) {
|
|
37
|
+
this.missing = missing;
|
|
38
|
+
this.componentDir = componentDir;
|
|
39
|
+
this.workspacePath = workspacePath;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Run over each entry in the missing array and transform the missing from list of paths
|
|
44
|
+
* to object with missing types
|
|
45
|
+
*/
|
|
46
|
+
groupAndFindMissing() {
|
|
47
|
+
const missingGroups = this.groupMissingByType();
|
|
48
|
+
missingGroups.forEach(group => {
|
|
49
|
+
if (group.packages) group.packages = group.packages.map(_legacy().resolvePackageNameByPath);
|
|
50
|
+
});
|
|
51
|
+
// This is a hack to solve problems that madge has with packages for type script files
|
|
52
|
+
// It see them as missing even if they are exists
|
|
53
|
+
const foundPackages = {
|
|
54
|
+
packages: {},
|
|
55
|
+
components: []
|
|
56
|
+
};
|
|
57
|
+
missingGroups.forEach(group => this.processMissingGroup(group, foundPackages));
|
|
58
|
+
return {
|
|
59
|
+
missingGroups,
|
|
60
|
+
foundPackages
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
processMissingGroup(group, foundPackages) {
|
|
64
|
+
if (!group.packages) return;
|
|
65
|
+
const missingPackages = [];
|
|
66
|
+
group.packages.forEach(packageName => {
|
|
67
|
+
// Don't try to resolve the same package twice
|
|
68
|
+
if (missingPackages.includes(packageName)) return;
|
|
69
|
+
const resolvedPath = (0, _legacy().resolvePackagePath)(packageName, this.componentDir, this.workspacePath);
|
|
70
|
+
if (!resolvedPath) {
|
|
71
|
+
missingPackages.push(packageName);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const resolvedPackageData = (0, _resolvePkgData().resolvePackageData)(this.componentDir, resolvedPath);
|
|
75
|
+
if (!resolvedPackageData) {
|
|
76
|
+
missingPackages.push(packageName);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// if the package is actually a component add it to the components list
|
|
80
|
+
if (resolvedPackageData.componentId) {
|
|
81
|
+
foundPackages.components.push(resolvedPackageData);
|
|
82
|
+
} else {
|
|
83
|
+
const version = resolvedPackageData.versionUsedByDependent || resolvedPackageData.concreteVersion;
|
|
84
|
+
if (!version) throw new Error(`unable to find the version for a package ${packageName}`);
|
|
85
|
+
const packageWithVersion = {
|
|
86
|
+
[resolvedPackageData.name]: version
|
|
87
|
+
};
|
|
88
|
+
Object.assign(foundPackages.packages, packageWithVersion);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Group missing dependencies by types (files, packages)
|
|
95
|
+
* @param {Array} missing list of missing paths to group
|
|
96
|
+
* @returns {Function} function which group the dependencies
|
|
97
|
+
*/
|
|
98
|
+
groupMissingByType() {
|
|
99
|
+
const byPathType = item => item.startsWith('.') ? 'files' : 'packages';
|
|
100
|
+
return Object.keys(this.missing).map(key => Object.assign({
|
|
101
|
+
originFile: (0, _generateTreeMadge().processPath)(key, {}, this.componentDir)
|
|
102
|
+
}, (0, _lodash().groupBy)(this.missing[key], byPathType)));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.MissingHandler = MissingHandler;
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=missing-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_legacy","data","require","_resolvePkgData","_generateTreeMadge","_lodash","MissingHandler","constructor","missing","componentDir","workspacePath","groupAndFindMissing","missingGroups","groupMissingByType","forEach","group","packages","map","resolvePackageNameByPath","foundPackages","components","processMissingGroup","missingPackages","packageName","includes","resolvedPath","resolvePackagePath","push","resolvedPackageData","resolvePackageData","componentId","version","versionUsedByDependent","concreteVersion","Error","packageWithVersion","name","Object","assign","byPathType","item","startsWith","keys","key","originFile","processPath","groupBy","exports"],"sources":["missing-handler.ts"],"sourcesContent":["import { resolvePackageNameByPath, resolvePackagePath } from '@teambit/legacy.utils';\nimport { ResolvedPackageData, resolvePackageData } from '../resolve-pkg-data';\nimport { processPath, Missing } from './generate-tree-madge';\nimport { groupBy } from 'lodash';\n\nexport type MissingGroupItem = { originFile: string; packages?: string[]; files?: string[] };\nexport type FoundPackages = {\n packages: { [packageName: string]: string };\n components: ResolvedPackageData[];\n};\n\nexport class MissingHandler {\n constructor(private missing: Missing, private componentDir: string, private workspacePath: string) {}\n\n /**\n * Run over each entry in the missing array and transform the missing from list of paths\n * to object with missing types\n */\n groupAndFindMissing(): { missingGroups: MissingGroupItem[]; foundPackages: FoundPackages } {\n const missingGroups: MissingGroupItem[] = this.groupMissingByType();\n missingGroups.forEach((group: MissingGroupItem) => {\n if (group.packages) group.packages = group.packages.map(resolvePackageNameByPath);\n });\n // This is a hack to solve problems that madge has with packages for type script files\n // It see them as missing even if they are exists\n const foundPackages: FoundPackages = {\n packages: {},\n components: [],\n };\n missingGroups.forEach((group) => this.processMissingGroup(group, foundPackages));\n\n return { missingGroups, foundPackages };\n }\n\n private processMissingGroup(group: MissingGroupItem, foundPackages: FoundPackages) {\n if (!group.packages) return;\n const missingPackages: string[] = [];\n group.packages.forEach((packageName) => {\n // Don't try to resolve the same package twice\n if (missingPackages.includes(packageName)) return;\n const resolvedPath = resolvePackagePath(packageName, this.componentDir, this.workspacePath);\n if (!resolvedPath) {\n missingPackages.push(packageName);\n return;\n }\n const resolvedPackageData = resolvePackageData(this.componentDir, resolvedPath);\n if (!resolvedPackageData) {\n missingPackages.push(packageName);\n return;\n }\n // if the package is actually a component add it to the components list\n if (resolvedPackageData.componentId) {\n foundPackages.components.push(resolvedPackageData);\n } else {\n const version = resolvedPackageData.versionUsedByDependent || resolvedPackageData.concreteVersion;\n if (!version) throw new Error(`unable to find the version for a package ${packageName}`);\n const packageWithVersion = {\n [resolvedPackageData.name]: version,\n };\n Object.assign(foundPackages.packages, packageWithVersion);\n }\n });\n }\n\n /**\n * Group missing dependencies by types (files, packages)\n * @param {Array} missing list of missing paths to group\n * @returns {Function} function which group the dependencies\n */\n private groupMissingByType(): MissingGroupItem[] {\n const byPathType = (item) => (item.startsWith('.') ? 'files' : 'packages');\n return Object.keys(this.missing).map((key) =>\n Object.assign({ originFile: processPath(key, {}, this.componentDir) }, groupBy(this.missing[key], byPathType))\n );\n }\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,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EA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AAG,CAAC,EAAEJ,UAAU,CAAC,CAC/G,CAAC;EACH;AACF;AAACQ,OAAA,CAAAzC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path Map is the extra data about the files and the dependencies, such as ImportSpecifiers and
|
|
3
|
+
* custom-resolve-modules used.
|
|
4
|
+
* The data is retrieved by dependency-tree which collects them from the various detectives.
|
|
5
|
+
* It is used to update the final tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Specifier } from '@teambit/legacy/dist/consumer/component/dependencies/dependency';
|
|
8
|
+
export type PathMapDependency = {
|
|
9
|
+
importSource: string;
|
|
10
|
+
resolvedDep: string;
|
|
11
|
+
importSpecifiers?: Specifier[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* PathMap is used to get the ImportSpecifiers from dependency-tree library
|
|
15
|
+
*/
|
|
16
|
+
export type PathMapItem = {
|
|
17
|
+
file: string;
|
|
18
|
+
dependencies: PathMapDependency[];
|
|
19
|
+
};
|
|
20
|
+
export declare function convertPathMapToRelativePaths(pathMap: PathMapItem[], baseDir: string): PathMapItem[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.convertPathMapToRelativePaths = convertPathMapToRelativePaths;
|
|
7
|
+
function _lodash() {
|
|
8
|
+
const data = require("lodash");
|
|
9
|
+
_lodash = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _generateTreeMadge() {
|
|
15
|
+
const data = require("./generate-tree-madge");
|
|
16
|
+
_generateTreeMadge = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Path Map is the extra data about the files and the dependencies, such as ImportSpecifiers and
|
|
23
|
+
* custom-resolve-modules used.
|
|
24
|
+
* The data is retrieved by dependency-tree which collects them from the various detectives.
|
|
25
|
+
* It is used to update the final tree.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* PathMap is used to get the ImportSpecifiers from dependency-tree library
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
function convertPathMapToRelativePaths(pathMap, baseDir) {
|
|
33
|
+
const pathCache = {};
|
|
34
|
+
return pathMap.map(file => {
|
|
35
|
+
const newFile = (0, _lodash().clone)(file);
|
|
36
|
+
newFile.file = (0, _generateTreeMadge().processPath)(file.file, pathCache, baseDir);
|
|
37
|
+
newFile.dependencies = file.dependencies.map(dependency => {
|
|
38
|
+
const newDependency = (0, _lodash().clone)(dependency);
|
|
39
|
+
newDependency.resolvedDep = (0, _generateTreeMadge().processPath)(dependency.resolvedDep, pathCache, baseDir);
|
|
40
|
+
return newDependency;
|
|
41
|
+
});
|
|
42
|
+
return newFile;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=path-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_generateTreeMadge","convertPathMapToRelativePaths","pathMap","baseDir","pathCache","map","file","newFile","clone","processPath","dependencies","dependency","newDependency","resolvedDep"],"sources":["path-map.ts"],"sourcesContent":["/**\n * Path Map is the extra data about the files and the dependencies, such as ImportSpecifiers and\n * custom-resolve-modules used.\n * The data is retrieved by dependency-tree which collects them from the various detectives.\n * It is used to update the final tree.\n */\n\nimport { clone } from 'lodash';\nimport { processPath } from './generate-tree-madge';\nimport { Specifier } from '@teambit/legacy/dist/consumer/component/dependencies/dependency';\n\nexport type PathMapDependency = {\n importSource: string; // dependency path as it has been received from dependency-tree lib\n resolvedDep: string; // path relative to consumer root (after convertPathMapToRelativePaths() )\n importSpecifiers?: Specifier[]; // relevant for ES6 and TS\n};\n\n/**\n * PathMap is used to get the ImportSpecifiers from dependency-tree library\n */\nexport type PathMapItem = {\n file: string; // path relative to consumer root (after convertPathMapToRelativePaths() )\n dependencies: PathMapDependency[];\n};\n\nexport function convertPathMapToRelativePaths(pathMap: PathMapItem[], baseDir: string): PathMapItem[] {\n const pathCache = {};\n return pathMap.map((file: PathMapItem) => {\n const newFile = clone(file);\n newFile.file = processPath(file.file, pathCache, baseDir);\n newFile.dependencies = file.dependencies.map((dependency) => {\n const newDependency = clone(dependency);\n newDependency.resolvedDep = processPath(dependency.resolvedDep, pathCache, baseDir);\n return newDependency;\n });\n return newFile;\n });\n}\n"],"mappings":";;;;;;AAOA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AARA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;;AAMO,SAASG,6BAA6BA,CAACC,OAAsB,EAAEC,OAAe,EAAiB;EACpG,MAAMC,SAAS,GAAG,CAAC,CAAC;EACpB,OAAOF,OAAO,CAACG,GAAG,CAAEC,IAAiB,IAAK;IACxC,MAAMC,OAAO,GAAG,IAAAC,eAAK,EAACF,IAAI,CAAC;IAC3BC,OAAO,CAACD,IAAI,GAAG,IAAAG,gCAAW,EAACH,IAAI,CAACA,IAAI,EAAEF,SAAS,EAAED,OAAO,CAAC;IACzDI,OAAO,CAACG,YAAY,GAAGJ,IAAI,CAACI,YAAY,CAACL,GAAG,CAAEM,UAAU,IAAK;MAC3D,MAAMC,aAAa,GAAG,IAAAJ,eAAK,EAACG,UAAU,CAAC;MACvCC,aAAa,CAACC,WAAW,GAAG,IAAAJ,gCAAW,EAACE,UAAU,CAACE,WAAW,EAAET,SAAS,EAAED,OAAO,CAAC;MACnF,OAAOS,aAAa;IACtB,CAAC,CAAC;IACF,OAAOL,OAAO;EAChB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DependencyDetector } from '../detector-hook';
|
|
2
|
+
type Options = {
|
|
3
|
+
envDetectors?: DependencyDetector[];
|
|
4
|
+
useContent?: boolean;
|
|
5
|
+
includeCore?: boolean;
|
|
6
|
+
type?: string;
|
|
7
|
+
[lang: string]: any;
|
|
8
|
+
};
|
|
9
|
+
type BuiltinDeps = string[] | Record<string, any>;
|
|
10
|
+
/**
|
|
11
|
+
* Finds the list of dependencies for the given file
|
|
12
|
+
*
|
|
13
|
+
* @param {String|Object} content - File's content or AST
|
|
14
|
+
* @param {Object} [options]
|
|
15
|
+
* @param {String} [options.type] - The type of content being passed in. Useful if you want to use a non-js detective
|
|
16
|
+
* @return {String[]}
|
|
17
|
+
*/
|
|
18
|
+
declare const precinct: {
|
|
19
|
+
(content: string | object, options?: string | Options): BuiltinDeps;
|
|
20
|
+
paperwork: (filename: string, options?: Options) => string[];
|
|
21
|
+
};
|
|
22
|
+
export default precinct;
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _fsExtra() {
|
|
8
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
9
|
+
_fsExtra = 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 _module() {
|
|
22
|
+
const data = require("module");
|
|
23
|
+
_module = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _moduleDefinition() {
|
|
29
|
+
const data = _interopRequireDefault(require("module-definition"));
|
|
30
|
+
_moduleDefinition = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _nodeSourceWalk() {
|
|
36
|
+
const data = _interopRequireDefault(require("node-source-walk"));
|
|
37
|
+
_nodeSourceWalk = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _detectiveAmd() {
|
|
43
|
+
const data = _interopRequireDefault(require("detective-amd"));
|
|
44
|
+
_detectiveAmd = function () {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
function _detectiveStylus() {
|
|
50
|
+
const data = _interopRequireDefault(require("detective-stylus"));
|
|
51
|
+
_detectiveStylus = function () {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
function _nodeDepsDetectors() {
|
|
57
|
+
const data = _interopRequireDefault(require("@teambit/node.deps-detectors.detective-es6"));
|
|
58
|
+
_nodeDepsDetectors = function () {
|
|
59
|
+
return data;
|
|
60
|
+
};
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
function _stylingDepsDetectors() {
|
|
64
|
+
const data = _interopRequireDefault(require("@teambit/styling.deps-detectors.detective-css"));
|
|
65
|
+
_stylingDepsDetectors = function () {
|
|
66
|
+
return data;
|
|
67
|
+
};
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
function _stylingDepsDetectors2() {
|
|
71
|
+
const data = _interopRequireDefault(require("@teambit/styling.deps-detectors.detective-less"));
|
|
72
|
+
_stylingDepsDetectors2 = function () {
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
function _stylingDepsDetectors3() {
|
|
78
|
+
const data = _interopRequireDefault(require("@teambit/styling.deps-detectors.detective-sass"));
|
|
79
|
+
_stylingDepsDetectors3 = function () {
|
|
80
|
+
return data;
|
|
81
|
+
};
|
|
82
|
+
return data;
|
|
83
|
+
}
|
|
84
|
+
function _stylingDepsDetectors4() {
|
|
85
|
+
const data = _interopRequireDefault(require("@teambit/styling.deps-detectors.detective-scss"));
|
|
86
|
+
_stylingDepsDetectors4 = function () {
|
|
87
|
+
return data;
|
|
88
|
+
};
|
|
89
|
+
return data;
|
|
90
|
+
}
|
|
91
|
+
function _typescriptDepsDetectors() {
|
|
92
|
+
const data = _interopRequireDefault(require("@teambit/typescript.deps-detectors.detective-typescript"));
|
|
93
|
+
_typescriptDepsDetectors = function () {
|
|
94
|
+
return data;
|
|
95
|
+
};
|
|
96
|
+
return data;
|
|
97
|
+
}
|
|
98
|
+
function _detectorHook() {
|
|
99
|
+
const data = require("../detector-hook");
|
|
100
|
+
_detectorHook = function () {
|
|
101
|
+
return data;
|
|
102
|
+
};
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
106
|
+
/**
|
|
107
|
+
* this file had been forked from https://github.com/dependents/node-precinct
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
// @ts-ignore we currently have @types/node as v12, and this is available > 16. once updated, remove the ts-ignore
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The file info object.
|
|
114
|
+
* - `ext` is the file extension.
|
|
115
|
+
* - `content` is the input file content.
|
|
116
|
+
* - `type` is the parsed file type from ext or content.
|
|
117
|
+
* - `ast` is the eventually consumed content by the corresponding detective.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
const jsExt = ['.js', '.jsx', '.cjs', '.mjs'];
|
|
121
|
+
const extToType = {
|
|
122
|
+
'.css': 'css',
|
|
123
|
+
'.sass': 'sass',
|
|
124
|
+
'.less': 'less',
|
|
125
|
+
'.scss': 'scss',
|
|
126
|
+
'.styl': 'stylus',
|
|
127
|
+
'.mts': 'ts',
|
|
128
|
+
'.cts': 'ts',
|
|
129
|
+
'.ts': 'ts',
|
|
130
|
+
'.tsx': 'ts'
|
|
131
|
+
};
|
|
132
|
+
const typeToDetective = {
|
|
133
|
+
css: _stylingDepsDetectors().default,
|
|
134
|
+
sass: _stylingDepsDetectors3().default,
|
|
135
|
+
less: _stylingDepsDetectors2().default,
|
|
136
|
+
scss: _stylingDepsDetectors4().default,
|
|
137
|
+
stylus: _detectiveStylus().default,
|
|
138
|
+
ts: _typescriptDepsDetectors().default,
|
|
139
|
+
commonjs: _nodeDepsDetectors().default,
|
|
140
|
+
es6: _nodeDepsDetectors().default,
|
|
141
|
+
amd: _detectiveAmd().default
|
|
142
|
+
};
|
|
143
|
+
const debug = require('debug')('precinct');
|
|
144
|
+
const detectorHook = new (_detectorHook().DetectorHook)();
|
|
145
|
+
const assign = (o1, o2) => {
|
|
146
|
+
// eslint-disable-next-line
|
|
147
|
+
for (const key in o2) {
|
|
148
|
+
// eslint-disable-next-line
|
|
149
|
+
if (o2.hasOwnProperty(key)) {
|
|
150
|
+
o1[key] = o2[key];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return o1;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get file info from the given file path.
|
|
158
|
+
*/
|
|
159
|
+
const getFileInfo = filename => {
|
|
160
|
+
const ext = _path().default.extname(filename);
|
|
161
|
+
const content = _fsExtra().default.readFileSync(filename, 'utf8');
|
|
162
|
+
return {
|
|
163
|
+
ext,
|
|
164
|
+
content,
|
|
165
|
+
// determined later
|
|
166
|
+
type: '',
|
|
167
|
+
// initialized with the content
|
|
168
|
+
ast: content
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Get the non-JS detective for the given file info.
|
|
174
|
+
* The type of the file would be determined as well.
|
|
175
|
+
* Return undefined if no proper detective found, perhaps it's plain
|
|
176
|
+
* JavaScript or unknown content. We can deal with it later.
|
|
177
|
+
*/
|
|
178
|
+
const getDetector = (fileInfo, options) => {
|
|
179
|
+
const {
|
|
180
|
+
ext
|
|
181
|
+
} = fileInfo;
|
|
182
|
+
const normalizedOptions = options || {};
|
|
183
|
+
|
|
184
|
+
// from env detectors
|
|
185
|
+
if (options?.envDetectors) {
|
|
186
|
+
for (const detector of options.envDetectors) {
|
|
187
|
+
if (detector.isSupported({
|
|
188
|
+
ext
|
|
189
|
+
})) {
|
|
190
|
+
fileInfo.type = detector.type || '';
|
|
191
|
+
return detector.detect;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// from builtin detectors
|
|
197
|
+
// - check `fileInfo.type` first to support `precinct(content, { type })`
|
|
198
|
+
const type = fileInfo.type || extToType[ext];
|
|
199
|
+
if (typeToDetective[type]) {
|
|
200
|
+
const detective = typeToDetective[type];
|
|
201
|
+
fileInfo.type = type;
|
|
202
|
+
// special logic for tsx files
|
|
203
|
+
if (ext === '.tsx') {
|
|
204
|
+
if (!normalizedOptions.ts) normalizedOptions.ts = {};
|
|
205
|
+
normalizedOptions.ts.jsx = true;
|
|
206
|
+
}
|
|
207
|
+
return detective;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// from global detector hook (legacy)
|
|
211
|
+
if (detectorHook.isSupported(ext)) {
|
|
212
|
+
const detector = detectorHook.getDetector(ext);
|
|
213
|
+
if (detector) {
|
|
214
|
+
fileInfo.type = ext;
|
|
215
|
+
typeToDetective[ext] = detector.detect;
|
|
216
|
+
return detector.detect;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return undefined;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Get the JS detective (amd/es6/cjs) for the given file info.
|
|
224
|
+
* The type and ast of the file would be determined as well.
|
|
225
|
+
*/
|
|
226
|
+
const getJsDetector = (fileInfo, options) => {
|
|
227
|
+
if (!jsExt.includes(fileInfo.ext)) {
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
if (typeof fileInfo.content !== 'object') {
|
|
231
|
+
const walker = new (_nodeSourceWalk().default)();
|
|
232
|
+
try {
|
|
233
|
+
fileInfo.ast = walker.parse(fileInfo.content);
|
|
234
|
+
} catch (e) {
|
|
235
|
+
debug('could not parse content: %s', e.message);
|
|
236
|
+
throw e;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const useContent = options?.useContent;
|
|
240
|
+
const type = useContent ? _moduleDefinition().default.fromSource(fileInfo.content) : _moduleDefinition().default.fromSource(fileInfo.ast);
|
|
241
|
+
const detector = typeToDetective[type];
|
|
242
|
+
fileInfo.type = type;
|
|
243
|
+
return detector;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Normalize the deps into an array.
|
|
248
|
+
*/
|
|
249
|
+
const normalizeDeps = (deps, includeCore) => {
|
|
250
|
+
const normalizedDeps = Array.isArray(deps) ? deps : Object.keys(deps);
|
|
251
|
+
return includeCore ? normalizedDeps : normalizedDeps.filter(d => !(0, _module().isBuiltin)(d));
|
|
252
|
+
};
|
|
253
|
+
const getDepsFromFile = (filename, options) => {
|
|
254
|
+
const normalizedOptions = assign({
|
|
255
|
+
includeCore: true
|
|
256
|
+
}, options || {});
|
|
257
|
+
const fileInfo = getFileInfo(filename);
|
|
258
|
+
if (typeof fileInfo.content === 'string' && (fileInfo.content.startsWith('// @bit-no-check') || fileInfo.content.startsWith('/* @bit-no-check'))) {
|
|
259
|
+
debug(`skipping file ${filename}, it has a @bit-no-check comment`);
|
|
260
|
+
return [];
|
|
261
|
+
}
|
|
262
|
+
const detective = getDetector(fileInfo, normalizedOptions) || getJsDetector(fileInfo, normalizedOptions);
|
|
263
|
+
if (!detective) {
|
|
264
|
+
debug(`skipping unsupported file ${filename}`);
|
|
265
|
+
return [];
|
|
266
|
+
}
|
|
267
|
+
debug('module type: ', fileInfo.type);
|
|
268
|
+
const deps = detective(fileInfo.ast, normalizedOptions[fileInfo.type]);
|
|
269
|
+
return normalizeDeps(deps, normalizedOptions?.includeCore);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Finds the list of dependencies for the given file
|
|
274
|
+
*
|
|
275
|
+
* @param {String|Object} content - File's content or AST
|
|
276
|
+
* @param {Object} [options]
|
|
277
|
+
* @param {String} [options.type] - The type of content being passed in. Useful if you want to use a non-js detective
|
|
278
|
+
* @return {String[]}
|
|
279
|
+
*/
|
|
280
|
+
// eslint-disable-next-line complexity
|
|
281
|
+
const precinct = (content, options) => {
|
|
282
|
+
// Legacy form backCompat where type was the second parameter
|
|
283
|
+
const normalizedOptions = typeof options === 'string' ? {
|
|
284
|
+
type: options
|
|
285
|
+
} : options || {};
|
|
286
|
+
const type = normalizedOptions.type || '';
|
|
287
|
+
debug('options given: ', normalizedOptions);
|
|
288
|
+
const fileInfo = {
|
|
289
|
+
content,
|
|
290
|
+
ast: content,
|
|
291
|
+
ext: type ? '' : '.js',
|
|
292
|
+
type
|
|
293
|
+
};
|
|
294
|
+
const detective = getDetector(fileInfo, normalizedOptions) || getJsDetector(fileInfo, normalizedOptions);
|
|
295
|
+
if (!detective) {
|
|
296
|
+
return [];
|
|
297
|
+
}
|
|
298
|
+
const deps = detective(fileInfo.ast, normalizedOptions[fileInfo.type]);
|
|
299
|
+
// @ts-ignore
|
|
300
|
+
precinct.ast = detective.ast || fileInfo.ast;
|
|
301
|
+
return deps;
|
|
302
|
+
};
|
|
303
|
+
precinct.paperwork = getDepsFromFile;
|
|
304
|
+
var _default = exports.default = precinct;
|
|
305
|
+
|
|
306
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_module","_moduleDefinition","_nodeSourceWalk","_detectiveAmd","_detectiveStylus","_nodeDepsDetectors","_stylingDepsDetectors","_stylingDepsDetectors2","_stylingDepsDetectors3","_stylingDepsDetectors4","_typescriptDepsDetectors","_detectorHook","e","__esModule","default","jsExt","extToType","typeToDetective","css","detectiveCss","sass","detectiveSass","less","detectiveLess","scss","detectiveScss","stylus","detectiveStylus","ts","detectiveTypeScript","commonjs","detectiveEs6","es6","amd","detectiveAmd","debug","detectorHook","DetectorHook","assign","o1","o2","key","hasOwnProperty","getFileInfo","filename","ext","path","extname","content","fs","readFileSync","type","ast","getDetector","fileInfo","options","normalizedOptions","envDetectors","detector","isSupported","detect","detective","jsx","undefined","getJsDetector","includes","walker","Walker","parse","message","useContent","getModuleType","fromSource","normalizeDeps","deps","includeCore","normalizedDeps","Array","isArray","Object","keys","filter","d","isBuiltin","getDepsFromFile","startsWith","precinct","paperwork","_default","exports"],"sources":["index.ts"],"sourcesContent":["/**\n * this file had been forked from https://github.com/dependents/node-precinct\n */\nimport fs from 'fs-extra';\nimport path from 'path';\n\n// @ts-ignore we currently have @types/node as v12, and this is available > 16. once updated, remove the ts-ignore\nimport { isBuiltin } from 'module';\n\nimport getModuleType from 'module-definition';\nimport Walker from 'node-source-walk';\n\nimport detectiveAmd from 'detective-amd';\nimport detectiveStylus from 'detective-stylus';\n\nimport detectiveEs6 from '@teambit/node.deps-detectors.detective-es6';\nimport detectiveCss from '@teambit/styling.deps-detectors.detective-css';\nimport detectiveLess from '@teambit/styling.deps-detectors.detective-less';\nimport detectiveSass from '@teambit/styling.deps-detectors.detective-sass';\nimport detectiveScss from '@teambit/styling.deps-detectors.detective-scss';\nimport detectiveTypeScript from '@teambit/typescript.deps-detectors.detective-typescript';\n\nimport { DependencyDetector, DetectorHook } from '../detector-hook';\n\n/**\n * The file info object.\n * - `ext` is the file extension.\n * - `content` is the input file content.\n * - `type` is the parsed file type from ext or content.\n * - `ast` is the eventually consumed content by the corresponding detective.\n */\ntype FileInfo = {\n ext: string;\n content: string | object;\n type: string;\n ast: any;\n};\n\ntype Options = {\n envDetectors?: DependencyDetector[];\n useContent?: boolean;\n includeCore?: boolean;\n type?: string;\n [lang: string]: any;\n};\n\ntype BuiltinDeps = string[] | Record<string, any>;\ntype Detective = (fileContent: string | object, options?: any) => BuiltinDeps;\n\nconst jsExt = ['.js', '.jsx', '.cjs', '.mjs'];\n\nconst extToType = {\n '.css': 'css',\n '.sass': 'sass',\n '.less': 'less',\n '.scss': 'scss',\n '.styl': 'stylus',\n '.mts': 'ts',\n '.cts': 'ts',\n '.ts': 'ts',\n '.tsx': 'ts',\n};\n\nconst typeToDetective: Record<string, Detective> = {\n css: detectiveCss,\n sass: detectiveSass,\n less: detectiveLess,\n scss: detectiveScss,\n stylus: detectiveStylus,\n ts: detectiveTypeScript,\n commonjs: detectiveEs6,\n es6: detectiveEs6,\n amd: detectiveAmd,\n};\n\nconst debug = require('debug')('precinct');\n\nconst detectorHook = new DetectorHook();\n\nconst assign = (o1, o2) => {\n // eslint-disable-next-line\n for (const key in o2) {\n // eslint-disable-next-line\n if (o2.hasOwnProperty(key)) {\n o1[key] = o2[key];\n }\n }\n\n return o1;\n};\n\n/**\n * Get file info from the given file path.\n */\nconst getFileInfo = (filename: string): FileInfo => {\n const ext = path.extname(filename);\n const content = fs.readFileSync(filename, 'utf8');\n return {\n ext,\n content,\n // determined later\n type: '',\n // initialized with the content\n ast: content,\n };\n};\n\n/**\n * Get the non-JS detective for the given file info.\n * The type of the file would be determined as well.\n * Return undefined if no proper detective found, perhaps it's plain\n * JavaScript or unknown content. We can deal with it later.\n */\nconst getDetector = (fileInfo: FileInfo, options?: Options): Detective | undefined => {\n const { ext } = fileInfo;\n const normalizedOptions: Options = options || {};\n\n // from env detectors\n if (options?.envDetectors) {\n for (const detector of options.envDetectors) {\n if (detector.isSupported({ ext })) {\n fileInfo.type = detector.type || '';\n return detector.detect as Detective;\n }\n }\n }\n\n // from builtin detectors\n // - check `fileInfo.type` first to support `precinct(content, { type })`\n const type = fileInfo.type || extToType[ext];\n if (typeToDetective[type]) {\n const detective = typeToDetective[type];\n fileInfo.type = type;\n // special logic for tsx files\n if (ext === '.tsx') {\n if (!normalizedOptions.ts) normalizedOptions.ts = {};\n normalizedOptions.ts.jsx = true;\n }\n return detective;\n }\n\n // from global detector hook (legacy)\n if (detectorHook.isSupported(ext)) {\n const detector = detectorHook.getDetector(ext);\n if (detector) {\n fileInfo.type = ext;\n typeToDetective[ext] = detector.detect as Detective;\n return detector.detect as Detective;\n }\n }\n\n return undefined;\n};\n\n/**\n * Get the JS detective (amd/es6/cjs) for the given file info.\n * The type and ast of the file would be determined as well.\n */\nconst getJsDetector = (fileInfo: FileInfo, options?: Options): Detective | undefined => {\n if (!jsExt.includes(fileInfo.ext)) {\n return undefined;\n }\n\n if (typeof fileInfo.content !== 'object') {\n const walker = new Walker();\n try {\n fileInfo.ast = walker.parse(fileInfo.content);\n } catch (e: any) {\n debug('could not parse content: %s', e.message);\n throw e;\n }\n }\n\n const useContent = options?.useContent;\n const type = useContent ? getModuleType.fromSource(fileInfo.content) : getModuleType.fromSource(fileInfo.ast);\n const detector = typeToDetective[type];\n fileInfo.type = type;\n\n return detector;\n};\n\n/**\n * Normalize the deps into an array.\n */\nconst normalizeDeps = (deps: BuiltinDeps, includeCore?: boolean): string[] => {\n const normalizedDeps = Array.isArray(deps) ? deps : Object.keys(deps);\n return includeCore ? normalizedDeps : normalizedDeps.filter((d) => !isBuiltin(d));\n};\n\nconst getDepsFromFile = (filename: string, options?: Options): string[] => {\n const normalizedOptions: Options = assign({ includeCore: true }, options || {});\n const fileInfo = getFileInfo(filename);\n if (\n typeof fileInfo.content === 'string' &&\n (fileInfo.content.startsWith('// @bit-no-check') || fileInfo.content.startsWith('/* @bit-no-check'))\n ) {\n debug(`skipping file ${filename}, it has a @bit-no-check comment`);\n return [];\n }\n\n const detective = getDetector(fileInfo, normalizedOptions) || getJsDetector(fileInfo, normalizedOptions);\n if (!detective) {\n debug(`skipping unsupported file ${filename}`);\n return [];\n }\n debug('module type: ', fileInfo.type);\n\n const deps = detective(fileInfo.ast, normalizedOptions[fileInfo.type]);\n\n return normalizeDeps(deps, normalizedOptions?.includeCore);\n};\n\n/**\n * Finds the list of dependencies for the given file\n *\n * @param {String|Object} content - File's content or AST\n * @param {Object} [options]\n * @param {String} [options.type] - The type of content being passed in. Useful if you want to use a non-js detective\n * @return {String[]}\n */\n// eslint-disable-next-line complexity\nconst precinct = (content: string | object, options?: string | Options): BuiltinDeps => {\n // Legacy form backCompat where type was the second parameter\n const normalizedOptions: Options = typeof options === 'string' ? { type: options } : options || {};\n const type = normalizedOptions.type || '';\n\n debug('options given: ', normalizedOptions);\n\n const fileInfo: FileInfo = {\n content,\n ast: content,\n ext: type ? '' : '.js',\n type,\n };\n\n const detective = getDetector(fileInfo, normalizedOptions) || getJsDetector(fileInfo, normalizedOptions);\n if (!detective) {\n return [];\n }\n\n const deps = detective(fileInfo.ast, normalizedOptions[fileInfo.type]);\n // @ts-ignore\n precinct.ast = detective.ast || fileInfo.ast;\n\n return deps;\n};\n\nprecinct.paperwork = getDepsFromFile;\n\nexport default precinct;\n"],"mappings":";;;;;;AAGA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,kBAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,I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