@teambit/dependencies 1.0.1071 → 1.0.1072
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/dist/files-dependency-builder/filing-cabinet/index.js +4 -1
- package/dist/files-dependency-builder/filing-cabinet/index.js.map +1 -1
- package/dist/files-dependency-builder/precinct/index.js +23 -12
- package/dist/files-dependency-builder/precinct/index.js.map +1 -1
- package/files-dependency-builder/filing-cabinet/index.ts +3 -0
- package/files-dependency-builder/precinct/index.ts +15 -10
- package/package.json +9 -8
- /package/dist/{preview-1784819498990.js → preview-1784829406374.js} +0 -0
|
@@ -66,7 +66,10 @@ const defaultLookups = {
|
|
|
66
66
|
'.scss': _stylingDepsLookups().lookupStyling,
|
|
67
67
|
'.sass': _stylingDepsLookups().lookupStyling,
|
|
68
68
|
'.styl': _stylusLookup().default,
|
|
69
|
-
'.less': _stylingDepsLookups().lookupStyling
|
|
69
|
+
'.less': _stylingDepsLookups().lookupStyling,
|
|
70
|
+
// md/mdx docs import components/packages, resolved the same way ts imports are
|
|
71
|
+
'.md': _typescriptDepsLookups().lookupTypeScript,
|
|
72
|
+
'.mdx': _typescriptDepsLookups().lookupTypeScript
|
|
70
73
|
};
|
|
71
74
|
function cabinet(options) {
|
|
72
75
|
const detectorHook = new (_dependencyResolver().DetectorHook)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_path","data","_interopRequireDefault","require","_resolveDependencyPath","_stylusLookup","_typescriptDepsLookups","_stylingDepsLookups","_dependencyResolver","e","__esModule","default","debug","defaultLookups","lookupJavaScript","lookupTypeScript","lookupStyling","stylusLookup","cabinet","options","detectorHook","DetectorHook","dependency","filename","ext","path","extname","resolver","resolveDependencyPath","startsWith","detector","getDetector","dependencyLookup","envDetectors","envDetector","isSupported","name","result","dependencyExt","err","message","module","exports","supportedFileExtensions","Object","keys","register","extension","lookupStrategy","indexOf","push"],"sources":["index.ts"],"sourcesContent":["// @flow\n\n/**\n * this file had been forked from https://github.com/dependents/node-filing-cabinet\n */\nimport path from 'path';\nimport resolveDependencyPath from 'resolve-dependency-path';\nimport stylusLookup from 'stylus-lookup';\n\nimport { lookupJavaScript, lookupTypeScript } from '@teambit/typescript.deps-lookups.lookup-typescript';\nimport { lookupStyling } from '@teambit/styling.deps-lookups.lookup-styling';\n\nimport type { DependencyDetector } from '@teambit/dependency-resolver';\nimport { DetectorHook } from '@teambit/dependency-resolver';\n\nconst debug = require('debug')('cabinet');\n\nconst defaultLookups = {\n '.js': lookupJavaScript,\n '.cjs': lookupJavaScript,\n '.mjs': lookupJavaScript,\n '.jsx': lookupJavaScript,\n '.ts': lookupTypeScript,\n '.tsx': lookupTypeScript,\n '.cts': lookupTypeScript,\n '.mts': lookupTypeScript,\n '.scss': lookupStyling,\n '.sass': lookupStyling,\n '.styl': stylusLookup,\n '.less': lookupStyling,\n};\n\ntype Options = {\n dependency: string; // previous name was \"partial\"\n filename: string;\n directory: string;\n config: Record<string, any>;\n webpackConfig?: Record<string, any>;\n configPath?: string;\n resolveConfig?: Record<string, any>;\n isScript?: boolean; // relevant for Vue files\n ast?: string;\n ext?: string;\n content?: string;\n envDetectors?: DependencyDetector[];\n};\n\nexport default function cabinet(options: Options) {\n const detectorHook = new DetectorHook();\n const { dependency, filename } = options;\n const ext = options.ext || path.extname(filename);\n debug(`working on a dependency \"${dependency}\" of a file \"${filename}\"`);\n\n let resolver = defaultLookups[ext];\n\n if (!resolver) {\n debug('using generic resolver');\n resolver = resolveDependencyPath;\n }\n if (ext === '.css' && dependency.startsWith('~')) resolver = lookupStyling;\n\n const detector = detectorHook.getDetector(ext, filename);\n if (detector) {\n // test if the new detector API has a dependency lookup.\n if (detector.dependencyLookup) {\n resolver = detector.dependencyLookup;\n } else {\n // otherwise use TypeScript as the default resolver.\n resolver = lookupTypeScript;\n }\n }\n\n if (options?.envDetectors) {\n for (const envDetector of options.envDetectors) {\n if (envDetector.isSupported({ ext, filename }) && envDetector.dependencyLookup) {\n resolver = envDetector.dependencyLookup;\n }\n }\n }\n\n debug(`found a resolver ${resolver.name} for ${ext}`);\n\n let result = resolver(options);\n const dependencyExt = path.extname(dependency);\n if (!result && dependencyExt && dependencyExt !== ext) {\n resolver = defaultLookups[dependencyExt];\n if (resolver) {\n // todo: this strategy probably fails often. if, for example, a dependency A.js inside B.ts\n // was not found using the ts resolve, it tries the js resolver, however, parsing the ts file\n // with js parser, won't work most of the time. A better approach would be to fix the\n // original resolver.\n debug(\n `dependency has a different extension (${dependencyExt}) than the original file (${ext}), trying to use its resolver instead`\n );\n try {\n result = resolver(options);\n } catch (err: any) {\n debug(`unable to use the resolver of ${dependencyExt} for ${filename}. got an error ${err.message}`);\n }\n }\n }\n debug(`resolved path for ${dependency}: ${result}`);\n return result;\n}\n\nmodule.exports.supportedFileExtensions = Object.keys(defaultLookups);\n\n/**\n * Register a custom lookup resolver for a file extension\n *\n * @param {String} extension - The file extension that should use the resolver\n * @param {Function} lookupStrategy - A resolver of dependency paths\n */\nmodule.exports.register = function (extension, lookupStrategy) {\n defaultLookups[extension] = lookupStrategy;\n\n if (this.supportedFileExtensions.indexOf(extension) === -1) {\n this.supportedFileExtensions.push(extension);\n }\n};\n"],"mappings":";;;;;;AAKA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,uBAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,sBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,uBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,sBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,oBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,mBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,oBAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,mBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4D,SAAAC,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAb5D;;AAEA;AACA;AACA;;AAWA,MAAMG,KAAK,GAAGT,OAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC;AAEzC,MAAMU,cAAc,GAAG;EACrB,KAAK,EAAEC,yCAAgB;EACvB,MAAM,EAAEA,yCAAgB;EACxB,MAAM,EAAEA,yCAAgB;EACxB,MAAM,EAAEA,yCAAgB;EACxB,KAAK,EAAEC,yCAAgB;EACvB,MAAM,EAAEA,yCAAgB;EACxB,MAAM,EAAEA,yCAAgB;EACxB,MAAM,EAAEA,yCAAgB;EACxB,OAAO,EAAEC,mCAAa;EACtB,OAAO,EAAEA,mCAAa;EACtB,OAAO,EAAEC,uBAAY;EACrB,OAAO,EAAED;
|
|
1
|
+
{"version":3,"names":["_path","data","_interopRequireDefault","require","_resolveDependencyPath","_stylusLookup","_typescriptDepsLookups","_stylingDepsLookups","_dependencyResolver","e","__esModule","default","debug","defaultLookups","lookupJavaScript","lookupTypeScript","lookupStyling","stylusLookup","cabinet","options","detectorHook","DetectorHook","dependency","filename","ext","path","extname","resolver","resolveDependencyPath","startsWith","detector","getDetector","dependencyLookup","envDetectors","envDetector","isSupported","name","result","dependencyExt","err","message","module","exports","supportedFileExtensions","Object","keys","register","extension","lookupStrategy","indexOf","push"],"sources":["index.ts"],"sourcesContent":["// @flow\n\n/**\n * this file had been forked from https://github.com/dependents/node-filing-cabinet\n */\nimport path from 'path';\nimport resolveDependencyPath from 'resolve-dependency-path';\nimport stylusLookup from 'stylus-lookup';\n\nimport { lookupJavaScript, lookupTypeScript } from '@teambit/typescript.deps-lookups.lookup-typescript';\nimport { lookupStyling } from '@teambit/styling.deps-lookups.lookup-styling';\n\nimport type { DependencyDetector } from '@teambit/dependency-resolver';\nimport { DetectorHook } from '@teambit/dependency-resolver';\n\nconst debug = require('debug')('cabinet');\n\nconst defaultLookups = {\n '.js': lookupJavaScript,\n '.cjs': lookupJavaScript,\n '.mjs': lookupJavaScript,\n '.jsx': lookupJavaScript,\n '.ts': lookupTypeScript,\n '.tsx': lookupTypeScript,\n '.cts': lookupTypeScript,\n '.mts': lookupTypeScript,\n '.scss': lookupStyling,\n '.sass': lookupStyling,\n '.styl': stylusLookup,\n '.less': lookupStyling,\n // md/mdx docs import components/packages, resolved the same way ts imports are\n '.md': lookupTypeScript,\n '.mdx': lookupTypeScript,\n};\n\ntype Options = {\n dependency: string; // previous name was \"partial\"\n filename: string;\n directory: string;\n config: Record<string, any>;\n webpackConfig?: Record<string, any>;\n configPath?: string;\n resolveConfig?: Record<string, any>;\n isScript?: boolean; // relevant for Vue files\n ast?: string;\n ext?: string;\n content?: string;\n envDetectors?: DependencyDetector[];\n};\n\nexport default function cabinet(options: Options) {\n const detectorHook = new DetectorHook();\n const { dependency, filename } = options;\n const ext = options.ext || path.extname(filename);\n debug(`working on a dependency \"${dependency}\" of a file \"${filename}\"`);\n\n let resolver = defaultLookups[ext];\n\n if (!resolver) {\n debug('using generic resolver');\n resolver = resolveDependencyPath;\n }\n if (ext === '.css' && dependency.startsWith('~')) resolver = lookupStyling;\n\n const detector = detectorHook.getDetector(ext, filename);\n if (detector) {\n // test if the new detector API has a dependency lookup.\n if (detector.dependencyLookup) {\n resolver = detector.dependencyLookup;\n } else {\n // otherwise use TypeScript as the default resolver.\n resolver = lookupTypeScript;\n }\n }\n\n if (options?.envDetectors) {\n for (const envDetector of options.envDetectors) {\n if (envDetector.isSupported({ ext, filename }) && envDetector.dependencyLookup) {\n resolver = envDetector.dependencyLookup;\n }\n }\n }\n\n debug(`found a resolver ${resolver.name} for ${ext}`);\n\n let result = resolver(options);\n const dependencyExt = path.extname(dependency);\n if (!result && dependencyExt && dependencyExt !== ext) {\n resolver = defaultLookups[dependencyExt];\n if (resolver) {\n // todo: this strategy probably fails often. if, for example, a dependency A.js inside B.ts\n // was not found using the ts resolve, it tries the js resolver, however, parsing the ts file\n // with js parser, won't work most of the time. A better approach would be to fix the\n // original resolver.\n debug(\n `dependency has a different extension (${dependencyExt}) than the original file (${ext}), trying to use its resolver instead`\n );\n try {\n result = resolver(options);\n } catch (err: any) {\n debug(`unable to use the resolver of ${dependencyExt} for ${filename}. got an error ${err.message}`);\n }\n }\n }\n debug(`resolved path for ${dependency}: ${result}`);\n return result;\n}\n\nmodule.exports.supportedFileExtensions = Object.keys(defaultLookups);\n\n/**\n * Register a custom lookup resolver for a file extension\n *\n * @param {String} extension - The file extension that should use the resolver\n * @param {Function} lookupStrategy - A resolver of dependency paths\n */\nmodule.exports.register = function (extension, lookupStrategy) {\n defaultLookups[extension] = lookupStrategy;\n\n if (this.supportedFileExtensions.indexOf(extension) === -1) {\n this.supportedFileExtensions.push(extension);\n }\n};\n"],"mappings":";;;;;;AAKA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,uBAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,sBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAA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a,CAAC;IACxC,IAAIX,QAAQ,EAAE;MACZ;MACA;MACA;MACA;MACAf,KAAK,CACH,yCAAyC0B,aAAa,6BAA6Bd,GAAG,uCACxF,CAAC;MACD,IAAI;QACFa,MAAM,GAAGV,QAAQ,CAACR,OAAO,CAAC;MAC5B,CAAC,CAAC,OAAOoB,GAAQ,EAAE;QACjB3B,KAAK,CAAC,iCAAiC0B,aAAa,QAAQf,QAAQ,kBAAkBgB,GAAG,CAACC,OAAO,EAAE,CAAC;MACtG;IACF;EACF;EACA5B,KAAK,CAAC,qBAAqBU,UAAU,KAAKe,MAAM,EAAE,CAAC;EACnD,OAAOA,MAAM;AACf;AAEAI,MAAM,CAACC,OAAO,CAACC,uBAAuB,GAAGC,MAAM,CAACC,IAAI,CAAChC,cAAc,CAAC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA4B,MAAM,CAACC,OAAO,CAACI,QAAQ,GAAG,UAAUC,SAAS,EAAEC,cAAc,EAAE;EAC7DnC,cAAc,CAACkC,SAAS,CAAC,GAAGC,cAAc;EAE1C,IAAI,IAAI,CAACL,uBAAuB,CAACM,OAAO,CAACF,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;IAC1D,IAAI,CAACJ,uBAAuB,CAACO,IAAI,CAACH,SAAS,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
|
|
@@ -53,6 +53,13 @@ function _detectiveStylus() {
|
|
|
53
53
|
};
|
|
54
54
|
return data;
|
|
55
55
|
}
|
|
56
|
+
function _mdxDepsDetectors() {
|
|
57
|
+
const data = _interopRequireDefault(require("@teambit/mdx.deps-detectors.detective-mdx"));
|
|
58
|
+
_mdxDepsDetectors = function () {
|
|
59
|
+
return data;
|
|
60
|
+
};
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
56
63
|
function _nodeDepsDetectors() {
|
|
57
64
|
const data = _interopRequireDefault(require("@teambit/node.deps-detectors.detective-es6"));
|
|
58
65
|
_nodeDepsDetectors = function () {
|
|
@@ -127,7 +134,9 @@ const extToType = {
|
|
|
127
134
|
'.mts': 'ts',
|
|
128
135
|
'.cts': 'ts',
|
|
129
136
|
'.ts': 'ts',
|
|
130
|
-
'.tsx': 'ts'
|
|
137
|
+
'.tsx': 'ts',
|
|
138
|
+
'.md': 'md',
|
|
139
|
+
'.mdx': 'md'
|
|
131
140
|
};
|
|
132
141
|
const typeToDetective = {
|
|
133
142
|
css: _stylingDepsDetectors().default,
|
|
@@ -138,7 +147,8 @@ const typeToDetective = {
|
|
|
138
147
|
ts: _typescriptDepsDetectors().default,
|
|
139
148
|
commonjs: _nodeDepsDetectors().default,
|
|
140
149
|
es6: _nodeDepsDetectors().default,
|
|
141
|
-
amd: _detectiveAmd().default
|
|
150
|
+
amd: _detectiveAmd().default,
|
|
151
|
+
md: _mdxDepsDetectors().default
|
|
142
152
|
};
|
|
143
153
|
const debug = require('debug')('precinct');
|
|
144
154
|
const detectorHook = new (_dependencyResolver().DetectorHook)();
|
|
@@ -196,6 +206,17 @@ const getDetector = (fileInfo, options) => {
|
|
|
196
206
|
}
|
|
197
207
|
}
|
|
198
208
|
|
|
209
|
+
// from the global detector hook. checked before the builtin detectors so that an
|
|
210
|
+
// aspect-registered detector (e.g. the mdx aspect's compile-based one) takes precedence over a
|
|
211
|
+
// builtin detective for the same extension, same as env detectors do.
|
|
212
|
+
if (detectorHook.isSupported(ext, filename)) {
|
|
213
|
+
const detector = detectorHook.getDetector(ext, filename);
|
|
214
|
+
if (detector) {
|
|
215
|
+
fileInfo.type = ext;
|
|
216
|
+
return detector.detect;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
199
220
|
// from builtin detectors
|
|
200
221
|
// - check `fileInfo.type` first to support `precinct(content, { type })`
|
|
201
222
|
const type = fileInfo.type || extToType[ext];
|
|
@@ -209,16 +230,6 @@ const getDetector = (fileInfo, options) => {
|
|
|
209
230
|
}
|
|
210
231
|
return detective;
|
|
211
232
|
}
|
|
212
|
-
|
|
213
|
-
// from global detector hook (legacy)
|
|
214
|
-
if (detectorHook.isSupported(ext, filename)) {
|
|
215
|
-
const detector = detectorHook.getDetector(ext, filename);
|
|
216
|
-
if (detector) {
|
|
217
|
-
fileInfo.type = ext;
|
|
218
|
-
typeToDetective[ext] = detector.detect;
|
|
219
|
-
return detector.detect;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
233
|
return undefined;
|
|
223
234
|
};
|
|
224
235
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_module","_moduleDefinition","_nodeSourceWalk","_detectiveAmd","_detectiveStylus","_nodeDepsDetectors","_stylingDepsDetectors","_stylingDepsDetectors2","_stylingDepsDetectors3","_stylingDepsDetectors4","_typescriptDepsDetectors","_dependencyResolver","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// @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 type { DependencyDetector } from '@teambit/dependency-resolver';\nimport { DetectorHook } from '@teambit/dependency-resolver';\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 filename: string;\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, 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 filename,\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, filename } = 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, filename })) {\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, filename)) {\n const detector = detectorHook.getDetector(ext, filename);\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 = async (filename: string, options?: Options): Promise<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 = await detective(fileInfo.ast, normalizedOptions[fileInfo.type]);\n\n return normalizeDeps(deps, normalizedOptions?.includeCore);\n};\n\nconst precinct = {\n paperwork: getDepsFromFile,\n};\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;AAEA,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,IAAA;AAAA;AACA,SAAAM,gBAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI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AAQ,CAACF,GAAG,EAAEI,iBAAiB,CAACF,QAAQ,CAACH,IAAI,CAAC,CAAC;EAE5E,OAAOsB,aAAa,CAACC,IAAI,EAAElB,iBAAiB,EAAEmB,WAAW,CAAC;AAC5D,CAAC;AAED,MAAMW,QAAQ,GAAG;EACfC,SAAS,EAAEH;AACb,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAEawE,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_module","_moduleDefinition","_nodeSourceWalk","_detectiveAmd","_detectiveStylus","_mdxDepsDetectors","_nodeDepsDetectors","_stylingDepsDetectors","_stylingDepsDetectors2","_stylingDepsDetectors3","_stylingDepsDetectors4","_typescriptDepsDetectors","_dependencyResolver","e","__esModule","default","jsExt","extToType","typeToDetective","css","detectiveCss","sass","detectiveSass","less","detectiveLess","scss","detectiveScss","stylus","detectiveStylus","ts","detectiveTypeScript","commonjs","detectiveEs6","es6","amd","detectiveAmd","md","detectiveMdx","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// @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 detectiveMdx from '@teambit/mdx.deps-detectors.detective-mdx';\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 type { DependencyDetector } from '@teambit/dependency-resolver';\nimport { DetectorHook } from '@teambit/dependency-resolver';\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 filename: string;\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, 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 '.md': 'md',\n '.mdx': 'md',\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 md: detectiveMdx,\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 filename,\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, filename } = 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, filename })) {\n fileInfo.type = detector.type || '';\n return detector.detect as Detective;\n }\n }\n }\n\n // from the global detector hook. checked before the builtin detectors so that an\n // aspect-registered detector (e.g. the mdx aspect's compile-based one) takes precedence over a\n // builtin detective for the same extension, same as env detectors do.\n if (detectorHook.isSupported(ext, filename)) {\n const detector = detectorHook.getDetector(ext, filename);\n if (detector) {\n fileInfo.type = ext;\n return detector.detect as Detective;\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 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 = async (filename: string, options?: Options): Promise<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 = await detective(fileInfo.ast, normalizedOptions[fileInfo.type]);\n\n return normalizeDeps(deps, normalizedOptions?.includeCore);\n};\n\nconst precinct = {\n paperwork: getDepsFromFile,\n};\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;AAEA,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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AClE,OAAO,EAAE;EACX;EAEA,MAAMiB,SAAS,GAAGR,WAAW,CAACC,QAAQ,EAAEE,iBAAiB,CAAC,IAAIQ,aAAa,CAACV,QAAQ,EAAEE,iBAAiB,CAAC;EACxG,IAAI,CAACK,SAAS,EAAE;IACd1B,KAAK,CAAC,6BAA6BS,QAAQ,EAAE,CAAC;IAC9C,OAAO,EAAE;EACX;EACAT,KAAK,CAAC,eAAe,EAAEmB,QAAQ,CAACH,IAAI,CAAC;EAErC,MAAMuB,IAAI,GAAG,MAAMb,SAAS,CAACP,QAAQ,CAACF,GAAG,EAAEI,iBAAiB,CAACF,QAAQ,CAACH,IAAI,CAAC,CAAC;EAE5E,OAAOsB,aAAa,CAACC,IAAI,EAAElB,iBAAiB,EAAEmB,WAAW,CAAC;AAC5D,CAAC;AAED,MAAMW,QAAQ,GAAG;EACfC,SAAS,EAAEH;AACb,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAA7E,OAAA,GAEa0E,QAAQ","ignoreList":[]}
|
|
@@ -28,6 +28,9 @@ const defaultLookups = {
|
|
|
28
28
|
'.sass': lookupStyling,
|
|
29
29
|
'.styl': stylusLookup,
|
|
30
30
|
'.less': lookupStyling,
|
|
31
|
+
// md/mdx docs import components/packages, resolved the same way ts imports are
|
|
32
|
+
'.md': lookupTypeScript,
|
|
33
|
+
'.mdx': lookupTypeScript,
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
type Options = {
|
|
@@ -12,6 +12,7 @@ import Walker from 'node-source-walk';
|
|
|
12
12
|
import detectiveAmd from 'detective-amd';
|
|
13
13
|
import detectiveStylus from 'detective-stylus';
|
|
14
14
|
|
|
15
|
+
import detectiveMdx from '@teambit/mdx.deps-detectors.detective-mdx';
|
|
15
16
|
import detectiveEs6 from '@teambit/node.deps-detectors.detective-es6';
|
|
16
17
|
import detectiveCss from '@teambit/styling.deps-detectors.detective-css';
|
|
17
18
|
import detectiveLess from '@teambit/styling.deps-detectors.detective-less';
|
|
@@ -60,6 +61,8 @@ const extToType = {
|
|
|
60
61
|
'.cts': 'ts',
|
|
61
62
|
'.ts': 'ts',
|
|
62
63
|
'.tsx': 'ts',
|
|
64
|
+
'.md': 'md',
|
|
65
|
+
'.mdx': 'md',
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
const typeToDetective: Record<string, Detective> = {
|
|
@@ -72,6 +75,7 @@ const typeToDetective: Record<string, Detective> = {
|
|
|
72
75
|
commonjs: detectiveEs6,
|
|
73
76
|
es6: detectiveEs6,
|
|
74
77
|
amd: detectiveAmd,
|
|
78
|
+
md: detectiveMdx,
|
|
75
79
|
};
|
|
76
80
|
|
|
77
81
|
const debug = require('debug')('precinct');
|
|
@@ -127,6 +131,17 @@ const getDetector = (fileInfo: FileInfo, options?: Options): Detective | undefin
|
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
|
|
134
|
+
// from the global detector hook. checked before the builtin detectors so that an
|
|
135
|
+
// aspect-registered detector (e.g. the mdx aspect's compile-based one) takes precedence over a
|
|
136
|
+
// builtin detective for the same extension, same as env detectors do.
|
|
137
|
+
if (detectorHook.isSupported(ext, filename)) {
|
|
138
|
+
const detector = detectorHook.getDetector(ext, filename);
|
|
139
|
+
if (detector) {
|
|
140
|
+
fileInfo.type = ext;
|
|
141
|
+
return detector.detect as Detective;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
130
145
|
// from builtin detectors
|
|
131
146
|
// - check `fileInfo.type` first to support `precinct(content, { type })`
|
|
132
147
|
const type = fileInfo.type || extToType[ext];
|
|
@@ -141,16 +156,6 @@ const getDetector = (fileInfo: FileInfo, options?: Options): Detective | undefin
|
|
|
141
156
|
return detective;
|
|
142
157
|
}
|
|
143
158
|
|
|
144
|
-
// from global detector hook (legacy)
|
|
145
|
-
if (detectorHook.isSupported(ext, filename)) {
|
|
146
|
-
const detector = detectorHook.getDetector(ext, filename);
|
|
147
|
-
if (detector) {
|
|
148
|
-
fileInfo.type = ext;
|
|
149
|
-
typeToDetective[ext] = detector.detect as Detective;
|
|
150
|
-
return detector.detect as Detective;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
159
|
return undefined;
|
|
155
160
|
};
|
|
156
161
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/dependencies",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1072",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/dependencies/dependencies",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.dependencies",
|
|
8
8
|
"name": "dependencies",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1072"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"archy": "1.0.0",
|
|
@@ -55,12 +55,13 @@
|
|
|
55
55
|
"@teambit/styling.deps-detectors.detective-sass": "0.0.9",
|
|
56
56
|
"@teambit/styling.deps-detectors.detective-scss": "0.0.9",
|
|
57
57
|
"@teambit/typescript.deps-detectors.detective-typescript": "0.0.10",
|
|
58
|
-
"@teambit/graph": "1.0.
|
|
59
|
-
"@teambit/workspace": "1.0.
|
|
60
|
-
"@teambit/aspect-loader": "1.0.
|
|
61
|
-
"@teambit/dependency-resolver": "1.0.
|
|
62
|
-
"@teambit/dev-files": "1.0.
|
|
63
|
-
"@teambit/scope": "1.0.
|
|
58
|
+
"@teambit/graph": "1.0.1072",
|
|
59
|
+
"@teambit/workspace": "1.0.1072",
|
|
60
|
+
"@teambit/aspect-loader": "1.0.1072",
|
|
61
|
+
"@teambit/dependency-resolver": "1.0.1072",
|
|
62
|
+
"@teambit/dev-files": "1.0.1072",
|
|
63
|
+
"@teambit/scope": "1.0.1072",
|
|
64
|
+
"@teambit/mdx.deps-detectors.detective-mdx": "0.0.1"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"@types/cli-table": "^0.3.0",
|
|
File without changes
|