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/options.js | |
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/options.js')
-rw-r--r-- | node_modules/resolve-dependencies/lib/options.js | 41 |
1 files changed, 41 insertions, 0 deletions
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiI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