| /* |
| @license |
| Rollup.js v2.3.3 |
| Sat, 04 Apr 2020 22:17:48 GMT - commit d18cb37d7c328a63c36761583ce456275f164462 |
| |
| |
| https://github.com/rollup/rollup |
| |
| Released under the MIT License. |
| */ |
| 'use strict'; |
| |
| var rollup_js = require('./rollup.js'); |
| |
| const commandAliases = { |
| c: 'config', |
| d: 'dir', |
| e: 'external', |
| f: 'format', |
| g: 'globals', |
| h: 'help', |
| i: 'input', |
| m: 'sourcemap', |
| n: 'name', |
| o: 'file', |
| p: 'plugin', |
| v: 'version', |
| w: 'watch', |
| }; |
| function mergeOptions(config, rawCommandOptions = { external: [], globals: undefined }, defaultOnWarnHandler) { |
| const command = getCommandOptions(rawCommandOptions); |
| const inputOptions = rollup_js.parseInputOptions(config, command, defaultOnWarnHandler); |
| const warn = inputOptions.onwarn; |
| if (command.output) { |
| Object.assign(command, command.output); |
| } |
| const outputOptionsArray = rollup_js.ensureArray(config.output); |
| if (outputOptionsArray.length === 0) |
| outputOptionsArray.push({}); |
| const outputOptions = outputOptionsArray.map((singleOutputOptions) => rollup_js.parseOutputOptions(singleOutputOptions, warn, command)); |
| rollup_js.warnUnknownOptions(command, Object.keys(inputOptions).concat(Object.keys(outputOptions[0]).filter((option) => option !== 'sourcemapPathTransform'), Object.keys(commandAliases), 'config', 'environment', 'plugin', 'silent', 'stdin'), 'CLI flags', warn, /^_$|output$|config/); |
| inputOptions.output = outputOptions; |
| return inputOptions; |
| } |
| function getCommandOptions(rawCommandOptions) { |
| const external = rawCommandOptions.external && typeof rawCommandOptions.external === 'string' |
| ? rawCommandOptions.external.split(',') |
| : []; |
| return { |
| ...rawCommandOptions, |
| external, |
| globals: typeof rawCommandOptions.globals === 'string' |
| ? rawCommandOptions.globals.split(',').reduce((globals, globalDefinition) => { |
| const [id, variableName] = globalDefinition.split(':'); |
| globals[id] = variableName; |
| if (external.indexOf(id) === -1) { |
| external.push(id); |
| } |
| return globals; |
| }, Object.create(null)) |
| : undefined, |
| }; |
| } |
| |
| exports.commandAliases = commandAliases; |
| exports.mergeOptions = mergeOptions; |
| //# sourceMappingURL=mergeOptions.js.map |