rollup 2.62.0 → 2.63.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 +25 -1
- package/dist/bin/rollup +3 -3
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +161 -95
- package/dist/es/shared/watch.js +6 -6
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/mergeOptions.js +12 -5
- package/dist/shared/rollup.js +161 -94
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.63.0
|
|
4
|
+
Tue, 04 Jan 2022 07:30:25 GMT - commit ae674c9edde5efb8ce6d8ef845598a805938178c
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -85,7 +85,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
|
|
|
85
85
|
shimMissingExports: getOption('shimMissingExports'),
|
|
86
86
|
strictDeprecations: getOption('strictDeprecations'),
|
|
87
87
|
treeshake: getObjectOption(config, overrides, 'treeshake', rollup.objectifyOptionWithPresets(rollup.treeshakePresets, 'treeshake', 'false, true, ')),
|
|
88
|
-
watch: getWatch(config, overrides
|
|
88
|
+
watch: getWatch(config, overrides)
|
|
89
89
|
};
|
|
90
90
|
rollup.warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
|
|
91
91
|
return inputOptions;
|
|
@@ -99,7 +99,7 @@ const getExternal = (config, overrides) => {
|
|
|
99
99
|
const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
|
|
100
100
|
? warning => config.onwarn(warning, defaultOnWarnHandler)
|
|
101
101
|
: defaultOnWarnHandler;
|
|
102
|
-
const getObjectOption = (config, overrides, name, objectifyValue =
|
|
102
|
+
const getObjectOption = (config, overrides, name, objectifyValue = rollup.objectifyOption) => {
|
|
103
103
|
const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
|
|
104
104
|
const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
|
|
105
105
|
if (commandOption !== undefined) {
|
|
@@ -107,7 +107,13 @@ const getObjectOption = (config, overrides, name, objectifyValue = value => (typ
|
|
|
107
107
|
}
|
|
108
108
|
return configOption;
|
|
109
109
|
};
|
|
110
|
-
const getWatch = (config, overrides
|
|
110
|
+
const getWatch = (config, overrides) => config.watch !== false && getObjectOption(config, overrides, 'watch');
|
|
111
|
+
const isWatchEnabled = (optionValue) => {
|
|
112
|
+
if (Array.isArray(optionValue)) {
|
|
113
|
+
return optionValue.reduce((result, value) => (typeof value === 'boolean' ? value : result), false);
|
|
114
|
+
}
|
|
115
|
+
return optionValue === true;
|
|
116
|
+
};
|
|
111
117
|
const normalizeObjectOptionValue = (optionValue, objectifyValue) => {
|
|
112
118
|
if (!optionValue) {
|
|
113
119
|
return optionValue;
|
|
@@ -168,5 +174,6 @@ function mergeOutputOptions(config, overrides, warn) {
|
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
exports.commandAliases = commandAliases;
|
|
177
|
+
exports.isWatchEnabled = isWatchEnabled;
|
|
171
178
|
exports.mergeOptions = mergeOptions;
|
|
172
179
|
//# sourceMappingURL=mergeOptions.js.map
|
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.63.0
|
|
4
|
+
Tue, 04 Jan 2022 07:30:25 GMT - commit ae674c9edde5efb8ce6d8ef845598a805938178c
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -26,7 +26,7 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
return n;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
var version$1 = "2.
|
|
29
|
+
var version$1 = "2.63.0";
|
|
30
30
|
|
|
31
31
|
function ensureArray$1(items) {
|
|
32
32
|
if (Array.isArray(items)) {
|
|
@@ -554,6 +554,7 @@ const generatedCodePresets = {
|
|
|
554
554
|
reservedNamesAsProps: true
|
|
555
555
|
}
|
|
556
556
|
};
|
|
557
|
+
const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
|
|
557
558
|
const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (value) => {
|
|
558
559
|
if (typeof value === 'string') {
|
|
559
560
|
const preset = presets[value];
|
|
@@ -562,7 +563,7 @@ const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (v
|
|
|
562
563
|
}
|
|
563
564
|
error(errInvalidOption(optionName, getHashFromObjectOption(optionName), `valid values are ${additionalValues}${printQuotedStringList(Object.keys(presets))}. You can also supply an object for more fine-grained control`, value));
|
|
564
565
|
}
|
|
565
|
-
return value
|
|
566
|
+
return objectifyOption(value);
|
|
566
567
|
};
|
|
567
568
|
const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
|
|
568
569
|
var _a;
|
|
@@ -8626,6 +8627,8 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
8626
8627
|
filter: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8627
8628
|
find: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8628
8629
|
findIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER,
|
|
8630
|
+
findLast: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8631
|
+
findLastIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER,
|
|
8629
8632
|
flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8630
8633
|
flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8631
8634
|
forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
@@ -12835,7 +12838,7 @@ class Module {
|
|
|
12835
12838
|
this.info.syntheticNamedExports = syntheticNamedExports;
|
|
12836
12839
|
}
|
|
12837
12840
|
if (meta != null) {
|
|
12838
|
-
|
|
12841
|
+
Object.assign(this.info.meta, meta);
|
|
12839
12842
|
}
|
|
12840
12843
|
}
|
|
12841
12844
|
warn(props, pos) {
|
|
@@ -21929,7 +21932,7 @@ function getCacheForUncacheablePlugin(pluginName) {
|
|
|
21929
21932
|
};
|
|
21930
21933
|
}
|
|
21931
21934
|
|
|
21932
|
-
function transform(source, module, pluginDriver, warn) {
|
|
21935
|
+
async function transform(source, module, pluginDriver, warn) {
|
|
21933
21936
|
const id = module.id;
|
|
21934
21937
|
const sourcemapChain = [];
|
|
21935
21938
|
let originalSourcemap = source.map === null ? null : decodedSourcemap(source.map);
|
|
@@ -21939,7 +21942,7 @@ function transform(source, module, pluginDriver, warn) {
|
|
|
21939
21942
|
const emittedFiles = [];
|
|
21940
21943
|
let customTransformCache = false;
|
|
21941
21944
|
const useCustomTransformCache = () => (customTransformCache = true);
|
|
21942
|
-
let
|
|
21945
|
+
let pluginName = '';
|
|
21943
21946
|
const curSource = source.code;
|
|
21944
21947
|
function transformReducer(previousCode, result, plugin) {
|
|
21945
21948
|
let code;
|
|
@@ -21970,90 +21973,92 @@ function transform(source, module, pluginDriver, warn) {
|
|
|
21970
21973
|
}
|
|
21971
21974
|
return code;
|
|
21972
21975
|
}
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21986
|
-
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
|
|
21991
|
-
|
|
21992
|
-
|
|
21993
|
-
|
|
21994
|
-
|
|
21995
|
-
|
|
21996
|
-
|
|
21997
|
-
|
|
21998
|
-
|
|
21999
|
-
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
|
|
22006
|
-
|
|
22007
|
-
|
|
22008
|
-
|
|
22009
|
-
|
|
22010
|
-
|
|
22011
|
-
|
|
22012
|
-
|
|
22013
|
-
originalSourcemap
|
|
22014
|
-
|
|
21976
|
+
let code;
|
|
21977
|
+
try {
|
|
21978
|
+
code = await pluginDriver.hookReduceArg0('transform', [curSource, id], transformReducer, (pluginContext, plugin) => {
|
|
21979
|
+
pluginName = plugin.name;
|
|
21980
|
+
return {
|
|
21981
|
+
...pluginContext,
|
|
21982
|
+
addWatchFile(id) {
|
|
21983
|
+
transformDependencies.push(id);
|
|
21984
|
+
pluginContext.addWatchFile(id);
|
|
21985
|
+
},
|
|
21986
|
+
cache: customTransformCache
|
|
21987
|
+
? pluginContext.cache
|
|
21988
|
+
: getTrackedPluginCache(pluginContext.cache, useCustomTransformCache),
|
|
21989
|
+
emitAsset(name, source) {
|
|
21990
|
+
emittedFiles.push({ name, source, type: 'asset' });
|
|
21991
|
+
return pluginContext.emitAsset(name, source);
|
|
21992
|
+
},
|
|
21993
|
+
emitChunk(id, options) {
|
|
21994
|
+
emittedFiles.push({ id, name: options && options.name, type: 'chunk' });
|
|
21995
|
+
return pluginContext.emitChunk(id, options);
|
|
21996
|
+
},
|
|
21997
|
+
emitFile(emittedFile) {
|
|
21998
|
+
emittedFiles.push(emittedFile);
|
|
21999
|
+
return pluginDriver.emitFile(emittedFile);
|
|
22000
|
+
},
|
|
22001
|
+
error(err, pos) {
|
|
22002
|
+
if (typeof err === 'string')
|
|
22003
|
+
err = { message: err };
|
|
22004
|
+
if (pos)
|
|
22005
|
+
augmentCodeLocation(err, pos, curSource, id);
|
|
22006
|
+
err.id = id;
|
|
22007
|
+
err.hook = 'transform';
|
|
22008
|
+
return pluginContext.error(err);
|
|
22009
|
+
},
|
|
22010
|
+
getCombinedSourcemap() {
|
|
22011
|
+
const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn);
|
|
22012
|
+
if (!combinedMap) {
|
|
22013
|
+
const magicString = new MagicString$1(originalCode);
|
|
22014
|
+
return magicString.generateMap({ hires: true, includeContent: true, source: id });
|
|
22015
|
+
}
|
|
22016
|
+
if (originalSourcemap !== combinedMap) {
|
|
22017
|
+
originalSourcemap = combinedMap;
|
|
22018
|
+
sourcemapChain.length = 0;
|
|
22019
|
+
}
|
|
22020
|
+
return new SourceMap({
|
|
22021
|
+
...combinedMap,
|
|
22022
|
+
file: null,
|
|
22023
|
+
sourcesContent: combinedMap.sourcesContent
|
|
22024
|
+
});
|
|
22025
|
+
},
|
|
22026
|
+
setAssetSource() {
|
|
22027
|
+
return this.error({
|
|
22028
|
+
code: 'INVALID_SETASSETSOURCE',
|
|
22029
|
+
message: `setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.`
|
|
22030
|
+
});
|
|
22031
|
+
},
|
|
22032
|
+
warn(warning, pos) {
|
|
22033
|
+
if (typeof warning === 'string')
|
|
22034
|
+
warning = { message: warning };
|
|
22035
|
+
if (pos)
|
|
22036
|
+
augmentCodeLocation(warning, pos, curSource, id);
|
|
22037
|
+
warning.id = id;
|
|
22038
|
+
warning.hook = 'transform';
|
|
22039
|
+
pluginContext.warn(warning);
|
|
22015
22040
|
}
|
|
22016
|
-
|
|
22017
|
-
|
|
22018
|
-
|
|
22019
|
-
|
|
22020
|
-
|
|
22021
|
-
|
|
22022
|
-
|
|
22023
|
-
|
|
22024
|
-
|
|
22025
|
-
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
|
|
22029
|
-
|
|
22030
|
-
|
|
22031
|
-
|
|
22032
|
-
|
|
22033
|
-
|
|
22034
|
-
|
|
22035
|
-
|
|
22036
|
-
|
|
22037
|
-
};
|
|
22038
|
-
})
|
|
22039
|
-
.catch(err => throwPluginError(err, curPlugin.name, { hook: 'transform', id }))
|
|
22040
|
-
.then(code => {
|
|
22041
|
-
if (!customTransformCache) {
|
|
22042
|
-
// files emitted by a transform hook need to be emitted again if the hook is skipped
|
|
22043
|
-
if (emittedFiles.length)
|
|
22044
|
-
module.transformFiles = emittedFiles;
|
|
22045
|
-
}
|
|
22046
|
-
return {
|
|
22047
|
-
ast,
|
|
22048
|
-
code,
|
|
22049
|
-
customTransformCache,
|
|
22050
|
-
meta: module.info.meta,
|
|
22051
|
-
originalCode,
|
|
22052
|
-
originalSourcemap,
|
|
22053
|
-
sourcemapChain,
|
|
22054
|
-
transformDependencies
|
|
22055
|
-
};
|
|
22056
|
-
});
|
|
22041
|
+
};
|
|
22042
|
+
});
|
|
22043
|
+
}
|
|
22044
|
+
catch (err) {
|
|
22045
|
+
throwPluginError(err, pluginName, { hook: 'transform', id });
|
|
22046
|
+
}
|
|
22047
|
+
if (!customTransformCache) {
|
|
22048
|
+
// files emitted by a transform hook need to be emitted again if the hook is skipped
|
|
22049
|
+
if (emittedFiles.length)
|
|
22050
|
+
module.transformFiles = emittedFiles;
|
|
22051
|
+
}
|
|
22052
|
+
return {
|
|
22053
|
+
ast,
|
|
22054
|
+
code,
|
|
22055
|
+
customTransformCache,
|
|
22056
|
+
meta: module.info.meta,
|
|
22057
|
+
originalCode,
|
|
22058
|
+
originalSourcemap,
|
|
22059
|
+
sourcemapChain,
|
|
22060
|
+
transformDependencies
|
|
22061
|
+
};
|
|
22057
22062
|
}
|
|
22058
22063
|
|
|
22059
22064
|
class ModuleLoader {
|
|
@@ -22140,7 +22145,7 @@ class ModuleLoader {
|
|
|
22140
22145
|
return {
|
|
22141
22146
|
external,
|
|
22142
22147
|
id: resolvedId.id,
|
|
22143
|
-
meta: resolvedId.meta ||
|
|
22148
|
+
meta: resolvedId.meta || {},
|
|
22144
22149
|
moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
|
|
22145
22150
|
syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
|
|
22146
22151
|
};
|
|
@@ -22382,7 +22387,7 @@ class ModuleLoader {
|
|
|
22382
22387
|
return {
|
|
22383
22388
|
external: true,
|
|
22384
22389
|
id: source,
|
|
22385
|
-
meta:
|
|
22390
|
+
meta: {},
|
|
22386
22391
|
moduleSideEffects: this.hasModuleSideEffects(source, true),
|
|
22387
22392
|
syntheticNamedExports: false
|
|
22388
22393
|
};
|
|
@@ -22577,6 +22582,40 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22577
22582
|
return context;
|
|
22578
22583
|
}
|
|
22579
22584
|
|
|
22585
|
+
const unfulfilledActions = new Set();
|
|
22586
|
+
function addUnresolvedAction(actionTuple) {
|
|
22587
|
+
unfulfilledActions.add(actionTuple);
|
|
22588
|
+
}
|
|
22589
|
+
function resolveAction(actionTuple) {
|
|
22590
|
+
unfulfilledActions.delete(actionTuple);
|
|
22591
|
+
}
|
|
22592
|
+
function formatAction([pluginName, hookName, args]) {
|
|
22593
|
+
let action = `(${pluginName}) ${hookName}`;
|
|
22594
|
+
const s = JSON.stringify;
|
|
22595
|
+
switch (hookName) {
|
|
22596
|
+
case 'resolveId':
|
|
22597
|
+
action += ` ${s(args[0])} ${s(args[1])}`;
|
|
22598
|
+
break;
|
|
22599
|
+
case 'load':
|
|
22600
|
+
action += ` ${s(args[0])}`;
|
|
22601
|
+
break;
|
|
22602
|
+
case 'transform':
|
|
22603
|
+
action += ` ${s(args[1])}`;
|
|
22604
|
+
break;
|
|
22605
|
+
}
|
|
22606
|
+
return action;
|
|
22607
|
+
}
|
|
22608
|
+
process.on('exit', () => {
|
|
22609
|
+
if (unfulfilledActions.size) {
|
|
22610
|
+
let err = '[!] Error: unfinished hook action(s) on exit:\n';
|
|
22611
|
+
for (const action of unfulfilledActions) {
|
|
22612
|
+
err += formatAction(action) + '\n';
|
|
22613
|
+
}
|
|
22614
|
+
console.error('%s', err);
|
|
22615
|
+
process.exit(1);
|
|
22616
|
+
}
|
|
22617
|
+
});
|
|
22618
|
+
|
|
22580
22619
|
const inputHookNames = {
|
|
22581
22620
|
buildEnd: 1,
|
|
22582
22621
|
buildStart: 1,
|
|
@@ -22728,6 +22767,7 @@ class PluginDriver {
|
|
|
22728
22767
|
if (hookContext) {
|
|
22729
22768
|
context = hookContext(context, plugin);
|
|
22730
22769
|
}
|
|
22770
|
+
let action = null;
|
|
22731
22771
|
return Promise.resolve()
|
|
22732
22772
|
.then(() => {
|
|
22733
22773
|
// permit values allows values to be returned instead of a functional hook
|
|
@@ -22737,9 +22777,35 @@ class PluginDriver {
|
|
|
22737
22777
|
return throwInvalidHookError(hookName, plugin.name);
|
|
22738
22778
|
}
|
|
22739
22779
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22740
|
-
|
|
22780
|
+
const hookResult = hook.apply(context, args);
|
|
22781
|
+
if (!hookResult || !hookResult.then) {
|
|
22782
|
+
// short circuit for non-thenables and non-Promises
|
|
22783
|
+
return hookResult;
|
|
22784
|
+
}
|
|
22785
|
+
// Track pending hook actions to properly error out when
|
|
22786
|
+
// unfulfilled promises cause rollup to abruptly and confusingly
|
|
22787
|
+
// exit with a successful 0 return code but without producing any
|
|
22788
|
+
// output, errors or warnings.
|
|
22789
|
+
action = [plugin.name, hookName, args];
|
|
22790
|
+
addUnresolvedAction(action);
|
|
22791
|
+
// Although it would be more elegant to just return hookResult here
|
|
22792
|
+
// and put the .then() handler just above the .catch() handler below,
|
|
22793
|
+
// doing so would subtly change the defacto async event dispatch order
|
|
22794
|
+
// which at least one test and some plugins in the wild may depend on.
|
|
22795
|
+
const promise = Promise.resolve(hookResult);
|
|
22796
|
+
return promise.then(() => {
|
|
22797
|
+
// action was fulfilled
|
|
22798
|
+
resolveAction(action);
|
|
22799
|
+
return promise;
|
|
22800
|
+
});
|
|
22741
22801
|
})
|
|
22742
|
-
.catch(err =>
|
|
22802
|
+
.catch(err => {
|
|
22803
|
+
if (action !== null) {
|
|
22804
|
+
// action considered to be fulfilled since error being handled
|
|
22805
|
+
resolveAction(action);
|
|
22806
|
+
}
|
|
22807
|
+
return throwPluginError(err, plugin.name, { hook: hookName });
|
|
22808
|
+
});
|
|
22743
22809
|
}
|
|
22744
22810
|
/**
|
|
22745
22811
|
* Run a sync plugin hook and return the result.
|
|
@@ -23649,6 +23715,7 @@ exports.getAliasName = getAliasName;
|
|
|
23649
23715
|
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
23650
23716
|
exports.getOrCreate = getOrCreate;
|
|
23651
23717
|
exports.loadFsEvents = loadFsEvents;
|
|
23718
|
+
exports.objectifyOption = objectifyOption;
|
|
23652
23719
|
exports.objectifyOptionWithPresets = objectifyOptionWithPresets;
|
|
23653
23720
|
exports.picomatch = picomatch;
|
|
23654
23721
|
exports.printQuotedStringList = printQuotedStringList;
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED