rollup 2.57.0
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/CHANGELOG.md +5982 -0
- package/LICENSE.md +710 -0
- package/README.md +127 -0
- package/dist/bin/rollup +1783 -0
- package/dist/es/package.json +1 -0
- package/dist/es/rollup.browser.js +11 -0
- package/dist/es/rollup.js +15 -0
- package/dist/es/shared/rollup.js +23502 -0
- package/dist/es/shared/watch.js +4876 -0
- package/dist/loadConfigFile.js +26 -0
- package/dist/rollup.browser.js +12 -0
- package/dist/rollup.browser.js.map +1 -0
- package/dist/rollup.d.ts +909 -0
- package/dist/rollup.js +27 -0
- package/dist/shared/index.js +4457 -0
- package/dist/shared/loadConfigFile.js +596 -0
- package/dist/shared/mergeOptions.js +172 -0
- package/dist/shared/rollup.js +23539 -0
- package/dist/shared/watch-cli.js +455 -0
- package/dist/shared/watch.js +304 -0
- package/package.json +142 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*
|
|
2
|
+
@license
|
|
3
|
+
Rollup.js v2.57.0
|
|
4
|
+
Wed, 22 Sep 2021 04:43:07 GMT - commit b67ef301e8e44f9e0d9b144c0cce441e2a41c3da
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
https://github.com/rollup/rollup
|
|
8
|
+
|
|
9
|
+
Released under the MIT License.
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
var rollup = require('./rollup.js');
|
|
14
|
+
|
|
15
|
+
const commandAliases = {
|
|
16
|
+
c: 'config',
|
|
17
|
+
d: 'dir',
|
|
18
|
+
e: 'external',
|
|
19
|
+
f: 'format',
|
|
20
|
+
g: 'globals',
|
|
21
|
+
h: 'help',
|
|
22
|
+
i: 'input',
|
|
23
|
+
m: 'sourcemap',
|
|
24
|
+
n: 'name',
|
|
25
|
+
o: 'file',
|
|
26
|
+
p: 'plugin',
|
|
27
|
+
v: 'version',
|
|
28
|
+
w: 'watch'
|
|
29
|
+
};
|
|
30
|
+
function mergeOptions(config, rawCommandOptions = { external: [], globals: undefined }, defaultOnWarnHandler = rollup.defaultOnWarn) {
|
|
31
|
+
const command = getCommandOptions(rawCommandOptions);
|
|
32
|
+
const inputOptions = mergeInputOptions(config, command, defaultOnWarnHandler);
|
|
33
|
+
const warn = inputOptions.onwarn;
|
|
34
|
+
if (command.output) {
|
|
35
|
+
Object.assign(command, command.output);
|
|
36
|
+
}
|
|
37
|
+
const outputOptionsArray = rollup.ensureArray(config.output);
|
|
38
|
+
if (outputOptionsArray.length === 0)
|
|
39
|
+
outputOptionsArray.push({});
|
|
40
|
+
const outputOptions = outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, warn));
|
|
41
|
+
rollup.warnUnknownOptions(command, Object.keys(inputOptions).concat(Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'), Object.keys(commandAliases), 'config', 'environment', 'plugin', 'silent', 'failAfterWarnings', 'stdin', 'waitForBundleInput', 'configPlugin'), 'CLI flags', warn, /^_$|output$|config/);
|
|
42
|
+
inputOptions.output = outputOptions;
|
|
43
|
+
return inputOptions;
|
|
44
|
+
}
|
|
45
|
+
function getCommandOptions(rawCommandOptions) {
|
|
46
|
+
const external = rawCommandOptions.external && typeof rawCommandOptions.external === 'string'
|
|
47
|
+
? rawCommandOptions.external.split(',')
|
|
48
|
+
: [];
|
|
49
|
+
return {
|
|
50
|
+
...rawCommandOptions,
|
|
51
|
+
external,
|
|
52
|
+
globals: typeof rawCommandOptions.globals === 'string'
|
|
53
|
+
? rawCommandOptions.globals.split(',').reduce((globals, globalDefinition) => {
|
|
54
|
+
const [id, variableName] = globalDefinition.split(':');
|
|
55
|
+
globals[id] = variableName;
|
|
56
|
+
if (external.indexOf(id) === -1) {
|
|
57
|
+
external.push(id);
|
|
58
|
+
}
|
|
59
|
+
return globals;
|
|
60
|
+
}, Object.create(null))
|
|
61
|
+
: undefined
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
|
|
65
|
+
const getOption = (name) => { var _a; return (_a = overrides[name]) !== null && _a !== void 0 ? _a : config[name]; };
|
|
66
|
+
const inputOptions = {
|
|
67
|
+
acorn: getOption('acorn'),
|
|
68
|
+
acornInjectPlugins: config.acornInjectPlugins,
|
|
69
|
+
cache: config.cache,
|
|
70
|
+
context: getOption('context'),
|
|
71
|
+
experimentalCacheExpiry: getOption('experimentalCacheExpiry'),
|
|
72
|
+
external: getExternal(config, overrides),
|
|
73
|
+
inlineDynamicImports: getOption('inlineDynamicImports'),
|
|
74
|
+
input: getOption('input') || [],
|
|
75
|
+
makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
|
|
76
|
+
manualChunks: getOption('manualChunks'),
|
|
77
|
+
maxParallelFileReads: getOption('maxParallelFileReads'),
|
|
78
|
+
moduleContext: getOption('moduleContext'),
|
|
79
|
+
onwarn: getOnWarn(config, defaultOnWarnHandler),
|
|
80
|
+
perf: getOption('perf'),
|
|
81
|
+
plugins: rollup.ensureArray(config.plugins),
|
|
82
|
+
preserveEntrySignatures: getOption('preserveEntrySignatures'),
|
|
83
|
+
preserveModules: getOption('preserveModules'),
|
|
84
|
+
preserveSymlinks: getOption('preserveSymlinks'),
|
|
85
|
+
shimMissingExports: getOption('shimMissingExports'),
|
|
86
|
+
strictDeprecations: getOption('strictDeprecations'),
|
|
87
|
+
treeshake: getObjectOption(config, overrides, 'treeshake', rollup.objectifyOptionWithPresets(rollup.treeshakePresets, 'treeshake', 'false, true, ')),
|
|
88
|
+
watch: getWatch(config, overrides, 'watch')
|
|
89
|
+
};
|
|
90
|
+
rollup.warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
|
|
91
|
+
return inputOptions;
|
|
92
|
+
}
|
|
93
|
+
const getExternal = (config, overrides) => {
|
|
94
|
+
const configExternal = config.external;
|
|
95
|
+
return typeof configExternal === 'function'
|
|
96
|
+
? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.indexOf(source) !== -1
|
|
97
|
+
: rollup.ensureArray(configExternal).concat(overrides.external);
|
|
98
|
+
};
|
|
99
|
+
const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
|
|
100
|
+
? warning => config.onwarn(warning, defaultOnWarnHandler)
|
|
101
|
+
: defaultOnWarnHandler;
|
|
102
|
+
const getObjectOption = (config, overrides, name, objectifyValue = value => (typeof value === 'object' ? value : {})) => {
|
|
103
|
+
const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
|
|
104
|
+
const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
|
|
105
|
+
if (commandOption !== undefined) {
|
|
106
|
+
return commandOption && { ...configOption, ...commandOption };
|
|
107
|
+
}
|
|
108
|
+
return configOption;
|
|
109
|
+
};
|
|
110
|
+
const getWatch = (config, overrides, name) => config.watch !== false && getObjectOption(config, overrides, name);
|
|
111
|
+
const normalizeObjectOptionValue = (optionValue, objectifyValue) => {
|
|
112
|
+
if (!optionValue) {
|
|
113
|
+
return optionValue;
|
|
114
|
+
}
|
|
115
|
+
if (Array.isArray(optionValue)) {
|
|
116
|
+
return optionValue.reduce((result, value) => value && result && { ...result, ...objectifyValue(value) }, {});
|
|
117
|
+
}
|
|
118
|
+
return objectifyValue(optionValue);
|
|
119
|
+
};
|
|
120
|
+
function mergeOutputOptions(config, overrides, warn) {
|
|
121
|
+
const getOption = (name) => { var _a; return (_a = overrides[name]) !== null && _a !== void 0 ? _a : config[name]; };
|
|
122
|
+
const outputOptions = {
|
|
123
|
+
amd: getObjectOption(config, overrides, 'amd'),
|
|
124
|
+
assetFileNames: getOption('assetFileNames'),
|
|
125
|
+
banner: getOption('banner'),
|
|
126
|
+
chunkFileNames: getOption('chunkFileNames'),
|
|
127
|
+
compact: getOption('compact'),
|
|
128
|
+
dir: getOption('dir'),
|
|
129
|
+
dynamicImportFunction: getOption('dynamicImportFunction'),
|
|
130
|
+
entryFileNames: getOption('entryFileNames'),
|
|
131
|
+
esModule: getOption('esModule'),
|
|
132
|
+
exports: getOption('exports'),
|
|
133
|
+
extend: getOption('extend'),
|
|
134
|
+
externalLiveBindings: getOption('externalLiveBindings'),
|
|
135
|
+
file: getOption('file'),
|
|
136
|
+
footer: getOption('footer'),
|
|
137
|
+
format: getOption('format'),
|
|
138
|
+
freeze: getOption('freeze'),
|
|
139
|
+
generatedCode: getObjectOption(config, overrides, 'generatedCode', rollup.objectifyOptionWithPresets(rollup.generatedCodePresets, 'output.generatedCode', '')),
|
|
140
|
+
globals: getOption('globals'),
|
|
141
|
+
hoistTransitiveImports: getOption('hoistTransitiveImports'),
|
|
142
|
+
indent: getOption('indent'),
|
|
143
|
+
inlineDynamicImports: getOption('inlineDynamicImports'),
|
|
144
|
+
interop: getOption('interop'),
|
|
145
|
+
intro: getOption('intro'),
|
|
146
|
+
manualChunks: getOption('manualChunks'),
|
|
147
|
+
minifyInternalExports: getOption('minifyInternalExports'),
|
|
148
|
+
name: getOption('name'),
|
|
149
|
+
namespaceToStringTag: getOption('namespaceToStringTag'),
|
|
150
|
+
noConflict: getOption('noConflict'),
|
|
151
|
+
outro: getOption('outro'),
|
|
152
|
+
paths: getOption('paths'),
|
|
153
|
+
plugins: rollup.ensureArray(config.plugins),
|
|
154
|
+
preferConst: getOption('preferConst'),
|
|
155
|
+
preserveModules: getOption('preserveModules'),
|
|
156
|
+
preserveModulesRoot: getOption('preserveModulesRoot'),
|
|
157
|
+
sanitizeFileName: getOption('sanitizeFileName'),
|
|
158
|
+
sourcemap: getOption('sourcemap'),
|
|
159
|
+
sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
|
|
160
|
+
sourcemapFile: getOption('sourcemapFile'),
|
|
161
|
+
sourcemapPathTransform: getOption('sourcemapPathTransform'),
|
|
162
|
+
strict: getOption('strict'),
|
|
163
|
+
systemNullSetters: getOption('systemNullSetters'),
|
|
164
|
+
validate: getOption('validate')
|
|
165
|
+
};
|
|
166
|
+
rollup.warnUnknownOptions(config, Object.keys(outputOptions), 'output options', warn);
|
|
167
|
+
return outputOptions;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
exports.commandAliases = commandAliases;
|
|
171
|
+
exports.mergeOptions = mergeOptions;
|
|
172
|
+
//# sourceMappingURL=mergeOptions.js.map
|