diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
commit | d25e11bee6ca5ca523884da132d18e1400e077b9 (patch) | |
tree | 8af39fde19f7ed640a60fb397c7edd647dff1c4c /node_modules/resolve-dependencies/lib | |
download | kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.gz kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.bz2 kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.zip |
Initial commit
Diffstat (limited to 'node_modules/resolve-dependencies/lib')
15 files changed, 518 insertions, 0 deletions
diff --git a/node_modules/resolve-dependencies/lib/file.d.ts b/node_modules/resolve-dependencies/lib/file.d.ts new file mode 100644 index 0000000..86db9a6 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/file.d.ts @@ -0,0 +1,39 @@ +export declare function isScript(code: string): boolean; +export declare function hasModuleGlobs(file: Pick<File, 'package' | 'belongsTo'>): boolean; +export declare function extraGlobs(file: Pick<File, 'package' | 'belongsTo'>): string[]; +export declare function nodeModuleGlobs(file: Pick<File, 'package' | 'belongsTo'>, useDefault?: boolean): string[]; +export declare type JsLoaderOptions = { + loadContent: boolean; + isEntry: boolean; + type: 'module' | 'commonjs'; + context?: { + moduleRoot: string; + package: any; + expanded?: boolean; + globs?: string[]; + }; + expand: 'all' | 'variable' | 'none'; +}; +export declare type FileMap = { + [key: string]: File | null; +}; +export declare type Files = { + [key: string]: File; +}; +export interface File { + deps: FileMap; + belongsTo?: File; + realSize?: number; + realPath?: string; + size: number; + absPath: string; + moduleType: 'module' | 'commonjs'; + contents: string | null; + contextExpanded?: boolean; + variableImports?: boolean; + moduleRoot?: string; + package?: any; +} +export declare function isNodeModule(request: string): boolean; +export declare function ensureDottedRelative(from: string, to: string): string; +export declare function createFile(absPath: string): File; diff --git a/node_modules/resolve-dependencies/lib/file.js b/node_modules/resolve-dependencies/lib/file.js new file mode 100644 index 0000000..73448b3 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/file.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createFile = exports.ensureDottedRelative = exports.isNodeModule = exports.nodeModuleGlobs = exports.extraGlobs = exports.hasModuleGlobs = exports.isScript = void 0; +const path_1 = require("path"); +const esmRegex = /(^\s*|[}\);\n]\s*)(import\s*(['"]|(\*\s+as\s+)?(?!type)([^"'\(\)\n; ]+)\s*from\s*['"]|\{)|export\s+\*\s+from\s+["']|export\s*(\{|default|function|class|var|const|let|async\s+function))/, moduleGlob = ['**/*', '!node_modules', '!test', '!**/*.d.ts']; +function isScript(code) { + return !Boolean(code.match(esmRegex)); +} +exports.isScript = isScript; +function hasModuleGlobs(file) { + return nodeModuleGlobs(file) !== moduleGlob; +} +exports.hasModuleGlobs = hasModuleGlobs; +function extraGlobs(file) { + var _a, _b, _c, _d; + const globs = []; + return globs + .concat(...[((_b = (_a = file.package) === null || _a === void 0 ? void 0 : _a.pkg) === null || _b === void 0 ? void 0 : _b.scripts) || []]) + .concat(...[((_d = (_c = file.package) === null || _c === void 0 ? void 0 : _c.pkg) === null || _d === void 0 ? void 0 : _d.assets) || []]); +} +exports.extraGlobs = extraGlobs; +function nodeModuleGlobs(file, useDefault = true) { + var _a; + const normalGlobs = [].concat(...(((_a = file.package) === null || _a === void 0 ? void 0 : _a.files) || [])); + if (useDefault && !normalGlobs.length) { + return moduleGlob; + } + return normalGlobs; +} +exports.nodeModuleGlobs = nodeModuleGlobs; +const notNodeModule = /^\.|^\//; +function isNodeModule(request) { + return !notNodeModule.test(request); +} +exports.isNodeModule = isNodeModule; +function ensureDottedRelative(from, to) { + let rel = path_1.relative(from, to); + if (!rel.startsWith('.' + path_1.sep)) { + rel = './' + rel; + } + return rel.split(path_1.sep).join('/'); +} +exports.ensureDottedRelative = ensureDottedRelative; +function createFile(absPath) { + return { + size: 0, + deps: {}, + absPath, + moduleType: 'commonjs', + contents: null, + variableImports: false, + }; +} +exports.createFile = createFile; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9maWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFvQztBQUVwQyxNQUFNLFFBQVEsR0FDViwwTEFBMEwsRUFDNUwsVUFBVSxHQUFHLENBQUMsTUFBTSxFQUFFLGVBQWUsRUFBRSxPQUFPLEVBQUUsWUFBWSxDQUFDLENBQUE7QUFFL0QsU0FBZ0IsUUFBUSxDQUFDLElBQVk7SUFDbkMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUE7QUFDdkMsQ0FBQztBQUZELDRCQUVDO0FBRUQsU0FBZ0IsY0FBYyxDQUFDLElBQXlDO0lBQ3RFLE9BQU8sZUFBZSxDQUFDLElBQUksQ0FBQyxLQUFLLFVBQVUsQ0FBQTtBQUM3QyxDQUFDO0FBRkQsd0NBRUM7QUFFRCxTQUFnQixVQUFVLENBQUMsSUFBeUM7O0lBQ2xFLE1BQU0sS0FBSyxHQUFhLEVBQUUsQ0FBQTtJQUMxQixPQUFPLEtBQUs7U0FDVCxNQUFNLENBQUMsR0FBRyxDQUFDLENBQUEsTUFBQSxNQUFBLElBQUksQ0FBQyxPQUFPLDBDQUFFLEdBQUcsMENBQUUsT0FBTyxLQUFJLEVBQUUsQ0FBQyxDQUFDO1NBQzdDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQSxNQUFBLE1BQUEsSUFBSSxDQUFDLE9BQU8sMENBQUUsR0FBRywwQ0FBRSxNQUFNLEtBQUksRUFBRSxDQUFDLENBQUMsQ0FBQTtBQUNqRCxDQUFDO0FBTEQsZ0NBS0M7QUFFRCxTQUFnQixlQUFlLENBQzd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BQVU7UUFDdEIsUUFBUSxFQUFFLElBQUk7UUFDZCxlQUFlLEVBQUUsS0FBSztLQUN2QixDQUFBO0FBQ0gsQ0FBQztBQVRELGdDQVNDIn0=
\ No newline at end of file diff --git a/node_modules/resolve-dependencies/lib/gather-deps.d.ts b/node_modules/resolve-dependencies/lib/gather-deps.d.ts new file mode 100644 index 0000000..3622934 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/gather-deps.d.ts @@ -0,0 +1,6 @@ +export declare function gatherDependencies(code: string | null, isModule: boolean): { + variable: boolean; + deps: { + [key: string]: any; + }; +}; diff --git a/node_modules/resolve-dependencies/lib/gather-deps.js b/node_modules/resolve-dependencies/lib/gather-deps.js new file mode 100644 index 0000000..cc45f2a --- /dev/null +++ b/node_modules/resolve-dependencies/lib/gather-deps.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.gatherDependencies = void 0; +const meriyah_1 = require("meriyah"); +function isNodeAString(node) { + return Boolean(node && (node.type === 'Literal' || node.type === 'StringLiteral')); +} +function isRequire(node) { + return node.callee.type === 'Identifier' && node.callee.name === 'require'; +} +function isImport(node) { + return node.callee.type === 'Import'; +} +function walk(node, visit) { + if (!node || typeof node.type !== 'string' || node._visited) { + return; + } + visit(node); + node._visited = true; + for (const childNode in node) { + const child = node[childNode]; + if (Array.isArray(child)) { + for (let i = 0; i < child.length; i++) { + walk(child[i], visit); + } + } + else { + walk(child, visit); + } + } +} +function gatherDependencies(code, isModule) { + const result = { + variable: false, + deps: {}, + }; + if (!code) { + return result; + } + const visit = (node) => { + if (node.type === 'CallExpression' && + (isRequire(node) || isImport(node) || node.type === 'ImportExpression')) { + const request = node.arguments[0]; + if (isNodeAString(request)) { + result.deps[request.value] = null; + } + else { + result.variable = true; + } + } + if (node.type === 'ImportDeclaration' && isNodeAString(node.source)) { + result.deps[node.source.value] = null; + } + }, options = { + globalReturn: true, + next: true, + module: isModule, + specDeviation: true, + }; + walk(meriyah_1.parse(code, options), visit); + return result; +} +exports.gatherDependencies = gatherDependencies; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2F0aGVyLWRlcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZ2F0aGVyLWRlcHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscUNBQStCO0FBRy9CLFNBQVMsYUFBYSxDQUFDLElBQVM7SUFDOUIsT0FBTyxPQUFPLENBQUMsSUFBSSxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksS0FBSyxTQUFTLElBQUksSUFBSSxDQUFDLElBQUksS0FBSyxlQUFlLENBQUMsQ0FBQyxDQUFBO0FBQ3BGLENBQUM7QUFFRCxTQUFTLFNBQVMsQ0FBQyxJQUFTO0lBQzFCLE9BQU8sSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLEtBQUssWUFBWSxJQUFJLElBQUksQ0FBQyxNQUFNLENBQUMsSUFBSSxLQUFLLFNBQVMsQ0FBQTtBQUM1RSxDQUFDO0FBRUQsU0FBUyxRQUFRLENBQUMsSUFBUztJQUN6QixPQUFPLElBQUksQ0FBQyxNQUFNLENBQUMsSUFBSSxLQUFLLFFBQVEsQ0FBQTtBQUN0QyxDQUFDO0FBRUQsU0FBUyxJQUFJLENBQUMsSUFBUyxFQUFFLEtBQTBCO0lBQ2pELElBQUksQ0FBQyxJQUFJLElBQUksT0FBTyxJQUFJLENBQUMsSUFBSSxLQUFLLFFBQVEsSUFBSSxJQUFJLENBQUMsUUFBUSxFQUFFO1FBQzNELE9BQU07S0FDUDtJQUNELEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQTtJQUNYLElBQUksQ0FBQyxRQUFRLEdBQUcsSUFBSSxDQUFBO0lBQ3BCLEtBQUssTUFBTSxTQUFTLElBQUksSUFBSSxFQUFFO1FBQzVCLE1BQU0sS0FBSyxHQUFHLElBQUksQ0FBQyxTQUF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xNQUFNLENBQUMsUUFBUSxHQUFHLElBQUksQ0FBQTthQUN2QjtTQUNGO1FBQ0QsSUFBSSxJQUFJLENBQUMsSUFBSSxLQUFLLG1CQUFtQixJQUFJLGFBQWEsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLEVBQUU7WUFDbkUsTUFBTSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxHQUFHLElBQUksQ0FBQTtTQUN0QztJQUNILENBQUMsRUFDRCxPQUFPLEdBQUc7UUFDUixZQUFZLEVBQUUsSUFBSTtRQUNsQixJQUFJLEVBQUUsSUFBSTtRQUNWLE1BQU0sRUFBRSxRQUFRO1FBQ2hCLGFBQWEsRUFBRSxJQUFJO0tBQ3BCLENBQUE7SUFFSCxJQUFJLENBQUMsZUFBSyxDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsRUFBRSxLQUFLLENBQUMsQ0FBQTtJQUVqQyxPQUFPLE1BQU0sQ0FBQTtBQUNmLENBQUM7QUFyQ0QsZ0RBcUNDIn0=
\ No newline at end of file diff --git a/node_modules/resolve-dependencies/lib/loader.d.ts b/node_modules/resolve-dependencies/lib/loader.d.ts new file mode 100644 index 0000000..c3ea941 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/loader.d.ts @@ -0,0 +1,12 @@ +import { ResolveDepOptions } from './options'; +import { File, FileMap } from './file'; +export declare class Loader { + private options; + constructor(options: ResolveDepOptions); + loadEntry(workingDirectory: string, request: string, files?: FileMap, warnings?: never[]): { + entry: File; + files: FileMap; + warnings: string[]; + }; + private load; +} diff --git a/node_modules/resolve-dependencies/lib/loader.js b/node_modules/resolve-dependencies/lib/loader.js new file mode 100644 index 0000000..b27b52b --- /dev/null +++ b/node_modules/resolve-dependencies/lib/loader.js @@ -0,0 +1,88 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Loader = void 0; +const path_1 = require("path"); +const node_builtins_1 = __importDefault(require("./node-builtins")); +const loader = __importStar(require("./node-loader")); +const file_1 = require("./file"); +class Loader { + constructor(options) { + this.options = options; + } + loadEntry(workingDirectory, request, files = {}, warnings = []) { + const mainFile = file_1.ensureDottedRelative(workingDirectory, path_1.resolve(workingDirectory, request)); + const entry = this.load(workingDirectory, mainFile, files, warnings); + return { entry: entry, files, warnings }; + } + load(cd, request, files = {}, warnings, context) { + var _a; + const options = { ...this.options }; + if (context) { + Object.assign(options, { context }); + } + const file = loader.load(cd, request, options); + if ('warning' in file) { + warnings.push(file.warning); + return null; + } + if (files[file.absPath] !== undefined) { + return files[file.absPath]; + } + else { + files[file.absPath] = file; + } + const packageGlobs = []; + if (file.moduleRoot && file_1.hasModuleGlobs(file)) { + packageGlobs.push(...file_1.nodeModuleGlobs(file, false)); + } + if (!packageGlobs.length && file_1.hasModuleGlobs((file === null || file === void 0 ? void 0 : file.belongsTo) || {})) { + packageGlobs.push(...file_1.nodeModuleGlobs(file.belongsTo || {}, false)); + } + const fileDir = path_1.dirname(file.absPath), ctx = { + moduleRoot: file.moduleRoot || ((_a = file.belongsTo) === null || _a === void 0 ? void 0 : _a.moduleRoot) || undefined, + package: file.package, + expanded: Boolean(file.contextExpanded), + globs: packageGlobs, + }, rejectBuiltins = (req) => { + if (~node_builtins_1.default.indexOf(req)) { + file.deps[req] = null; + return false; + } + return true; + }; + Object.keys(file.deps) + .sort() + .filter(rejectBuiltins) + .map((req) => { + const dep = (file.deps[req] = this.load(fileDir, req, files, warnings, ctx)); + if (dep) { + dep.belongsTo = file.moduleRoot ? file : file.belongsTo; + } + }); + return file; + } +} +exports.Loader = Loader; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2xvYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsK0JBQXVDO0FBQ3ZDLG9FQUFzQztBQUN0QyxzREFBdUM7QUFFdkMsaUNBQTZGO0FBRTdGLE1BQWEsTUFBTTtJQUNqQixZQUFvQixPQUEwQjtRQUExQixZQUFPLEdBQVAsT0FBTyxDQUFtQjtJQUFHLENBQUM7SUFDbEQsU0FBUyxDQUNQLGdCQUF3QixFQUN4QixPQUFlLEVBQ2YsUUFBaUIsRUFBRSxFQUNuQixRQUFRLEdBQUcsRUFBRTtRQUViLE1BQU0sUUFBUSxHQUFHLDJCQUFvQixDQUFDLGdCQUFnQixFQUFFLGNBQU8sQ0FBQyxnQkFBZ0IsRUFBRSxPQUFPLENBQUMsQ0FBQyxDQUFBO1FBQzNGLE1BQU0sS0FBSyxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLEVBQUUsUUFBUSxFQUFFLEtBQUssRUFBRSxRQUFRLENBQUMsQ0FBQTtRQUNwRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQWEsRUFBRSxLQUFLLEVBQUUsUUFBUSxFQUFFLENBQUE7SUFDbEQsQ0FBQztJQUVPLElBQUksQ0FDVixFQUFVLEVBQ1YsT0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TyxFQUFFLEdBQUcsRUFBRSxLQUFLLEVBQUUsUUFBUSxFQUFFLEdBQUcsQ0FBQyxDQUFDLENBQUE7WUFDNUUsSUFBSSxHQUFHLEVBQUU7Z0JBQ1AsR0FBRyxDQUFDLFNBQVMsR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUE7YUFDeEQ7UUFDSCxDQUFDLENBQUMsQ0FBQTtRQUNKLE9BQU8sSUFBSSxDQUFBO0lBQ2IsQ0FBQztDQUNGO0FBdkVELHdCQXVFQyJ9
\ No newline at end of file diff --git a/node_modules/resolve-dependencies/lib/node-builtins.d.ts b/node_modules/resolve-dependencies/lib/node-builtins.d.ts new file mode 100644 index 0000000..8c52e40 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/node-builtins.d.ts @@ -0,0 +1,2 @@ +declare const builtins: any; +export default builtins; diff --git a/node_modules/resolve-dependencies/lib/node-builtins.js b/node_modules/resolve-dependencies/lib/node-builtins.js new file mode 100644 index 0000000..756d0bb --- /dev/null +++ b/node_modules/resolve-dependencies/lib/node-builtins.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const builtins = require('module').builtinModules || + Object.keys(process.binding('natives')) + .filter((x) => !/^_|^internal|\//.test(x)) + .sort(); +exports.default = builtins; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS1idWlsdGlucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9ub2RlLWJ1aWx0aW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsTUFBTSxRQUFRLEdBQ1osT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDLGNBQWM7SUFDaEMsTUFBTSxDQUFDLElBQUksQ0FBRSxPQUFlLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO1NBQzdDLE1BQU0sQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQyxpQkFBaUIsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7U0FDekMsSUFBSSxFQUFFLENBQUE7QUFFWCxrQkFBZSxRQUFRLENBQUEifQ==
\ No newline at end of file diff --git a/node_modules/resolve-dependencies/lib/node-loader.d.ts b/node_modules/resolve-dependencies/lib/node-loader.d.ts new file mode 100644 index 0000000..81663d3 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/node-loader.d.ts @@ -0,0 +1,15 @@ +import { File, JsLoaderOptions } from './file'; +interface Resolver { + resolve: (context: any, path: string, request: string, resolveContext: any, callback: any) => void; +} +export declare type Resolved = { + absPath: string; + pkgPath: string; + pkg: any; + warning: string; +}; +export declare function resolveSync(from: string, request: string, resolver?: Resolver): Resolved; +export declare function load(workingDirectory: string, request: string, options?: Partial<JsLoaderOptions>): File | { + warning: string; +}; +export {}; diff --git a/node_modules/resolve-dependencies/lib/node-loader.js b/node_modules/resolve-dependencies/lib/node-loader.js new file mode 100644 index 0000000..1877de4 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/node-loader.js @@ -0,0 +1,148 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.load = exports.resolveSync = void 0; +const fs = __importStar(require("fs")); +const globby_1 = require("globby"); +const path_1 = require("path"); +const gather_deps_1 = require("./gather-deps"); +const file_1 = require("./file"); +const enhanced_resolve_1 = require("enhanced-resolve"); +const { readFileSync, lstatSync, statSync, realpathSync } = fs; +const supportedJsExtensions = ['.js', '.cjs', '.mjs']; +const fileSystem = new enhanced_resolve_1.CachedInputFileSystem(fs, 4000), esmResolver = enhanced_resolve_1.ResolverFactory.createResolver({ + extensions: [], + conditionNames: ['node', 'import', 'require', 'default'], + useSyncFileSystemCalls: true, + symlinks: false, + fileSystem, +}), cjsResolver = enhanced_resolve_1.ResolverFactory.createResolver({ + extensions: ['.js', '.cjs', '.mjs', '.json', '.node'], + conditionNames: ['node', 'require', 'default'], + useSyncFileSystemCalls: true, + symlinks: false, + fileSystem, +}), defaultOptions = { + loadContent: true, + expand: 'none', + isEntry: false, + type: 'commonjs', +}; +function stripControlCharacters(path) { + return path && path.replace(/[\u0000-\u001F\u007F-\u009F]/g, ''); +} +const emptyContext = {}, emptyResolveContext = {}; +function resolveSync(from, request, resolver = cjsResolver) { + const result = { + absPath: '', + pkgPath: '', + pkg: null, + warning: '', + }; + resolver.resolve(emptyContext, from, request, emptyResolveContext, (err, path, data) => { + if (err) { + result.warning = err.message; + return; + } + result.absPath = stripControlCharacters(path); + result.pkgPath = stripControlCharacters(data.descriptionFilePath); + result.pkg = data.descriptionFileData; + return; + }); + return result; +} +exports.resolveSync = resolveSync; +async function expand(file, fileDir, baseDir, globs) { + const files = globby_1.sync(globs, { + cwd: baseDir, + followSymbolicLinks: false, + }); + files + .sort() //glob search is width first and not deterministic + .map((dep) => file_1.ensureDottedRelative(fileDir, path_1.join(baseDir, dep))) + .filter((relDep) => file.absPath !== path_1.join(baseDir, relDep)) + .forEach((relDep) => { + file.deps[relDep] = file.deps[relDep] || null; + }); + const currentDeps = Object.keys(file.deps); + file.package && + file.package.dependencies && + Object.keys(file.package.dependencies || {}).forEach((dependency) => { + if (!currentDeps.some((curDep) => curDep.startsWith(dependency))) { + file.deps[dependency] = file.deps[dependency] || null; + } + }); +} +function load(workingDirectory, request, options = defaultOptions) { + var _a; + const resolver = options.type === 'module' ? esmResolver : cjsResolver, { absPath, pkg, pkgPath, warning } = resolveSync(workingDirectory, request, resolver); + if (!absPath) { + return { warning: warning }; + } + const file = file_1.createFile(absPath), isJs = options.isEntry || supportedJsExtensions.some((x) => absPath.endsWith(x)); + file.absPath = absPath; + if (isJs || absPath.endsWith('json')) { + file.contents = readFileSync(absPath, 'utf-8'); + } + if (isJs) { + try { + const isModule = absPath.endsWith('.mjs') || !file_1.isScript(file.contents); + const parseResult = gather_deps_1.gatherDependencies(file.contents, isModule); + Object.assign(file.deps, parseResult.deps); + file.moduleType = isModule ? 'module' : 'commonjs'; + file.variableImports = parseResult.variable; + } + catch (e) { + return { warning: `Error parsing file: "${file.absPath}"\n${e.stack}` }; + } + } + const fileDir = path_1.dirname(file.absPath), expandVariable = Boolean(options.expand === 'variable' && file.variableImports); + if (file_1.isNodeModule(request) && pkg && pkgPath) { + file.package = pkg; + file.deps[file_1.ensureDottedRelative(fileDir, pkgPath)] = null; + const pkgDir = (file.moduleRoot = path_1.dirname(pkgPath)), expandAll = options.expand === 'all'; + if (expandVariable || expandAll) { + expand(file, fileDir, pkgDir, file_1.nodeModuleGlobs(file)); + file.contextExpanded = true; + } + if (file_1.extraGlobs(file).length) { + expand(file, fileDir, pkgDir, file_1.extraGlobs(file)); + } + } + else if (expandVariable && ((_a = options.context) === null || _a === void 0 ? void 0 : _a.moduleRoot) && !options.context.expanded) { + expand(file, fileDir, options.context.moduleRoot, file_1.nodeModuleGlobs({ package: { files: options.context.globs } })); + file.contextExpanded = true; + } + if (!options.loadContent) { + file.contents = null; + } + const stats = lstatSync(file.absPath); + if (stats.isSymbolicLink()) { + const path = realpathSync(file.absPath); + const absStat = statSync(file.absPath); + file.realPath = path; + file.realSize = abs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VBQ1AsT0FBTyxDQUFDLE9BQU8sQ0FBQyxVQUFVLEVBQzFCLHNCQUFlLENBQUMsRUFBRSxPQUFPLEVBQUUsRUFBRSxLQUFLLEVBQUUsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQy9ELENBQUE7UUFDRCxJQUFJLENBQUMsZUFBZSxHQUFHLElBQUksQ0FBQTtLQUM1QjtJQUVELElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUFFO1FBQ3hCLElBQUksQ0FBQyxRQUFRLEdBQUcsSUFBSSxDQUFBO0tBQ3JCO0lBQ0QsTUFBTSxLQUFLLEdBQUcsU0FBUyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQTtJQUNyQyxJQUFJLEtBQUssQ0FBQyxjQUFjLEVBQUUsRUFBRTtRQUMxQixNQUFNLElBQUksR0FBRyxZQUFZLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFBO1FBQ3ZDLE1BQU0sT0FBTyxHQUFHLFFBQVEsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDdEMsSUFBSSxDQUFDLFFBQVEsR0FBRyxJQUFJLENBQUE7UUFDcEIsSUFBSSxDQUFDLFFBQVEsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFBO0tBQzdCO0lBQ0QsSUFBSSxDQUFDLElBQUksR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFBO0lBQ3RCLE9BQU8sSUFBSSxDQUFBO0FBQ2IsQ0FBQztBQXJFRCxvQkFxRUMifQ==
\ No newline at end of file diff --git a/node_modules/resolve-dependencies/lib/options.d.ts b/node_modules/resolve-dependencies/lib/options.d.ts new file mode 100644 index 0000000..fbb399b --- /dev/null +++ b/node_modules/resolve-dependencies/lib/options.d.ts @@ -0,0 +1,12 @@ +import { FileMap } from './file'; +declare type Expansion = 'all' | 'variable' | 'none'; +export declare type ResolveDepOptions = { + entries: string[]; + cwd: string; + type: 'module' | 'commonjs'; + expand: Expansion; + loadContent: boolean; + files: FileMap; +}; +export declare function normalizeOptions(args: Partial<ResolveDepOptions | string>[]): ResolveDepOptions; +export {}; diff --git a/node_modules/resolve-dependencies/lib/options.js b/node_modules/resolve-dependencies/lib/options.js new file mode 100644 index 0000000..3e47115 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/options.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeOptions = void 0; +function normalizeOptions(args) { + const options = { + entries: [], + cwd: process.cwd(), + loadContent: true, + expand: 'none', + files: {}, + type: 'commonjs', + }; + args.forEach((x) => { + if (typeof x === 'string') + return options.entries.push(x); + if (x.cwd) + options.cwd = x.cwd; + if (Array.isArray(x.entries)) + options.entries.push(...x.entries); + if ('expand' in x) + options.expand = x.expand || 'none'; + if ('loadContent' in x) + options.loadContent = Boolean(x.loadContent); + if ('files' in x) + Object.assign(options.files, x.files); + if ('type' in x) + options.type = x.type || 'commonjs'; + }); + options.entries = Array.from(new Set(options.entries)); + if (!options.entries.length) { + try { + options.entries.push(require.resolve(options.cwd)); + } + catch (e) { + throw new Error('No entry file found'); + } + } + return options; +} +exports.normalizeOptions = normalizeOptions; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9vcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWFBLFNBQWdCLGdCQUFnQixDQUFDLElBQTJDO0lBQzFFLE1BQU0sT0FBTyxHQUFzQjtRQUNqQyxPQUFPLEVBQUUsRUFBYztRQUN2QixHQUFHLEVBQUUsT0FBTyxDQUFDLEdBQUcsRUFBRTtRQUNsQixXQUFXLEVBQUUsSUFBSTtRQUNqQixNQUFNLEVBQUUsTUFBbUI7UUFDM0IsS0FBSyxFQUFFLEVBQ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8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFBO0lBRXRELElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLE1BQU0sRUFBRTtRQUMzQixJQUFJO1lBQ0YsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQTtTQUNuRDtRQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQ1YsTUFBTSxJQUFJLEtBQUssQ0FBQyxxQkFBcUIsQ0FBQyxDQUFBO1NBQ3ZDO0tBQ0Y7SUFDRCxPQUFPLE9BQU8sQ0FBQTtBQUNoQixDQUFDO0FBOUJELDRDQThCQyJ9
\ No newline at end of file diff --git a/node_modules/resolve-dependencies/lib/resolve.d.ts b/node_modules/resolve-dependencies/lib/resolve.d.ts new file mode 100644 index 0000000..715ada9 --- /dev/null +++ b/node_modules/resolve-dependencies/lib/resolve.d.ts @@ -0,0 +1,9 @@ +import { File, Files } from './file'; +import { ResolveDepOptions } from './options'; +import { resolveSync } from './node-loader'; +export default function resolveEntries(...options: (Partial<ResolveDepOptions> | string)[]): { + entries: Files; + files: Files; + warnings: string[]; +}; +export { File, Files, resolveSync, resolveEntries }; diff --git a/node_modules/resolve-dependencies/lib/resolve.js b/node_modules/resolve-dependencies/lib/resolve.js new file mode 100644 index 0000000..58acc1f --- /dev/null +++ b/node_modules/resolve-dependencies/lib/resolve.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveEntries = exports.resolveSync = void 0; +const loader_1 = require("./loader"); +const options_1 = require("./options"); +const node_loader_1 = require("./node-loader"); +Object.defineProperty(exports, "resolveSync", { enumerable: true, get: function () { return node_loader_1.resolveSync; } }); +function resolveEntries(...options) { + const opts = options_1.normalizeOptions(options), loader = new loader_1.Loader(opts), res = opts.entries.map((request) => loader.loadEntry(opts.cwd, request, opts.files)), warnings = [], entries = opts.entries.sort().reduce((entryMap, entry, i) => { + entryMap[entry] = res[i].entry; + warnings.push(...res[i].warnings); + return entryMap; + }, {}), files = opts.files; + return { files: files, entries, warnings }; +} +exports.default = resolveEntries; +exports.resolveEntries = resolveEntries; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb2x2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9yZXNvbHZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHFDQUFpQztBQUVqQyx1Q0FBK0Q7QUFDL0QsK0NBQTJDO0FBcUJyQiw0RkFyQmIseUJBQVcsT0FxQmE7QUFuQmpDLFNBQXdCLGNBQWMsQ0FBQyxHQUFHLE9BQWdEO0lBS3hGLE1BQU0sSUFBSSxHQUFHLDBCQUFnQixDQUFDLE9BQU8sQ0FBQyxFQUNwQyxNQUFNLEdBQUcsSUFBSSxlQUFNLENBQUMsSUFBSSxDQUFDLEVBQ3pCLEdBQUcsR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDLE9BQU8sRUFBRSxFQUFFLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFLE9BQU8sRUFBRSxJQUFJLENBQUMsS0FBSyxDQUFDLENBQUMsRUFDcEYsUUFBUSxHQUFhLEVBQUUsRUFDdkIsT0FBTyxHQUFHLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLENBQUMsUUFBUSxFQUFFLEtBQUssRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUMxRCxRQUFRLENBQUMsS0FBSyxDQUFDLEdBQUcsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQWEsQ0FBQTtRQUN0QyxRQUFRLENBQUMsSUFBSSxDQUFDLEdBQUcsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxDQUFBO1FBQ2pDLE9BQU8sUUFBUSxDQUFBO0lBQ2pCLENBQUMsRUFBRSxFQUEwQixDQUFDLEVBQzlCLEtBQUssR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFBO0lBRXBCLE9BQU8sRUFBRSxLQUFLLEVBQUUsS0FBYyxFQUFFLE9BQU8sRUFBRSxRQUFRLEVBQUUsQ0FBQTtBQUNyRCxDQUFDO0FBakJELGlDQWlCQztBQUVrQyx3Q0FBYyJ9
\ No newline at end of file diff --git a/node_modules/resolve-dependencies/lib/resolve.spec.d.ts b/node_modules/resolve-dependencies/lib/resolve.spec.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/resolve-dependencies/lib/resolve.spec.d.ts @@ -0,0 +1 @@ +export {}; |