rollup 2.77.3 → 2.79.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 +38 -0
- 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 +139 -84
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +73 -79
- 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 +2 -2
- package/dist/shared/rollup.js +139 -84
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.79.0
|
|
4
|
+
Wed, 31 Aug 2022 04:52:13 GMT - commit 8477f8ff1fe80086556021542b22942ad27a0a69
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
|
|
|
27
27
|
return n;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var version$1 = "2.
|
|
30
|
+
var version$1 = "2.79.0";
|
|
31
31
|
|
|
32
32
|
function ensureArray$1(items) {
|
|
33
33
|
if (Array.isArray(items)) {
|
|
@@ -373,6 +373,22 @@ function errInvalidOption(option, urlHash, explanation, value) {
|
|
|
373
373
|
url: `https://rollupjs.org/guide/en/#${urlHash}`
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
|
+
function errInvalidAddonPluginHook(hook, plugin) {
|
|
377
|
+
return {
|
|
378
|
+
code: Errors.INVALID_PLUGIN_HOOK,
|
|
379
|
+
hook,
|
|
380
|
+
message: `Error running plugin hook ${hook} for plugin ${plugin}, expected a string, a function hook or an object with a "handler" string or function.`,
|
|
381
|
+
plugin
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function errInvalidFunctionPluginHook(hook, plugin) {
|
|
385
|
+
return {
|
|
386
|
+
code: Errors.INVALID_PLUGIN_HOOK,
|
|
387
|
+
hook,
|
|
388
|
+
message: `Error running plugin hook ${hook} for plugin ${plugin}, expected a function hook or an object with a "handler" function.`,
|
|
389
|
+
plugin
|
|
390
|
+
};
|
|
391
|
+
}
|
|
376
392
|
function errInvalidRollupPhaseForAddWatchFile() {
|
|
377
393
|
return {
|
|
378
394
|
code: Errors.INVALID_ROLLUP_PHASE,
|
|
@@ -2410,15 +2426,16 @@ const RESERVED_NAMES$1 = RESERVED_NAMES;
|
|
|
2410
2426
|
|
|
2411
2427
|
const illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
2412
2428
|
const startsWithDigit = (str) => /\d/.test(str[0]);
|
|
2429
|
+
const needsEscape = (str) => startsWithDigit(str) || RESERVED_NAMES$1.has(str) || str === 'arguments';
|
|
2413
2430
|
function isLegal(str) {
|
|
2414
|
-
if (
|
|
2431
|
+
if (needsEscape(str)) {
|
|
2415
2432
|
return false;
|
|
2416
2433
|
}
|
|
2417
2434
|
return !illegalCharacters.test(str);
|
|
2418
2435
|
}
|
|
2419
2436
|
function makeLegal(str) {
|
|
2420
2437
|
str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(illegalCharacters, '_');
|
|
2421
|
-
if (
|
|
2438
|
+
if (needsEscape(str))
|
|
2422
2439
|
str = `_${str}`;
|
|
2423
2440
|
return str || '_';
|
|
2424
2441
|
}
|
|
@@ -13429,11 +13446,18 @@ function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, na
|
|
|
13429
13446
|
return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, indent, snippets, externalLiveBindings, freeze, namespaceToStringTag)}${interopStatements.length > 0 ? `${interopStatements.join(n)}${n}${n}` : ''}`;
|
|
13430
13447
|
}
|
|
13431
13448
|
|
|
13449
|
+
function addJsExtension(name) {
|
|
13450
|
+
return name.endsWith('.js') ? name : name + '.js';
|
|
13451
|
+
}
|
|
13452
|
+
|
|
13432
13453
|
// AMD resolution will only respect the AMD baseUrl if the .js extension is omitted.
|
|
13433
13454
|
// The assumption is that this makes sense for all relative ids:
|
|
13434
13455
|
// https://requirejs.org/docs/api.html#jsfiles
|
|
13435
|
-
function
|
|
13436
|
-
|
|
13456
|
+
function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
|
|
13457
|
+
if (id[0] !== '.') {
|
|
13458
|
+
return id;
|
|
13459
|
+
}
|
|
13460
|
+
return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
|
|
13437
13461
|
}
|
|
13438
13462
|
|
|
13439
13463
|
const builtins = {
|
|
@@ -13472,7 +13496,7 @@ function warnOnBuiltins(warn, dependencies) {
|
|
|
13472
13496
|
|
|
13473
13497
|
function amd(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets, warn }, { amd, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
13474
13498
|
warnOnBuiltins(warn, dependencies);
|
|
13475
|
-
const deps = dependencies.map(m => `'${
|
|
13499
|
+
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.id, amd.forceJsExtensionForImports)}'`);
|
|
13476
13500
|
const args = dependencies.map(m => m.name);
|
|
13477
13501
|
const { n, getNonArrowFunctionIntro, _ } = snippets;
|
|
13478
13502
|
if (namedExportsMode && hasExports) {
|
|
@@ -13916,7 +13940,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13916
13940
|
});
|
|
13917
13941
|
}
|
|
13918
13942
|
warnOnBuiltins(warn, dependencies);
|
|
13919
|
-
const amdDeps = dependencies.map(m => `'${
|
|
13943
|
+
const amdDeps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.id, amd.forceJsExtensionForImports)}'`);
|
|
13920
13944
|
const cjsDeps = dependencies.map(m => `require('${m.id}')`);
|
|
13921
13945
|
const trimmedImports = trimEmptyImports(dependencies);
|
|
13922
13946
|
const globalDeps = trimmedImports.map(module => globalProp(module.globalName, globalVar, getPropertyAccess));
|
|
@@ -15123,7 +15147,7 @@ class Chunk {
|
|
|
15123
15147
|
}
|
|
15124
15148
|
}
|
|
15125
15149
|
finaliseDynamicImports(options, snippets) {
|
|
15126
|
-
const stripKnownJsExtensions = options.format === 'amd';
|
|
15150
|
+
const stripKnownJsExtensions = options.format === 'amd' && !options.amd.forceJsExtensionForImports;
|
|
15127
15151
|
for (const [module, code] of this.renderedModuleSources) {
|
|
15128
15152
|
for (const { node, resolution } of module.dynamicImports) {
|
|
15129
15153
|
const chunk = this.chunkByModule.get(resolution);
|
|
@@ -22602,7 +22626,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22602
22626
|
else {
|
|
22603
22627
|
cacheInstance = getCacheForUncacheablePlugin(plugin.name);
|
|
22604
22628
|
}
|
|
22605
|
-
|
|
22629
|
+
return {
|
|
22606
22630
|
addWatchFile(id) {
|
|
22607
22631
|
if (graph.phase >= BuildPhase.GENERATE) {
|
|
22608
22632
|
return this.error(errInvalidRollupPhaseForAddWatchFile());
|
|
@@ -22660,9 +22684,9 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22660
22684
|
options.onwarn(warning);
|
|
22661
22685
|
}
|
|
22662
22686
|
};
|
|
22663
|
-
return context;
|
|
22664
22687
|
}
|
|
22665
22688
|
|
|
22689
|
+
// This will make sure no input hook is omitted
|
|
22666
22690
|
const inputHookNames = {
|
|
22667
22691
|
buildEnd: 1,
|
|
22668
22692
|
buildStart: 1,
|
|
@@ -22678,19 +22702,14 @@ const inputHookNames = {
|
|
|
22678
22702
|
watchChange: 1
|
|
22679
22703
|
};
|
|
22680
22704
|
const inputHooks = Object.keys(inputHookNames);
|
|
22681
|
-
function throwInvalidHookError(hookName, pluginName) {
|
|
22682
|
-
return error({
|
|
22683
|
-
code: 'INVALID_PLUGIN_HOOK',
|
|
22684
|
-
message: `Error running plugin hook ${hookName} for ${pluginName}, expected a function hook.`
|
|
22685
|
-
});
|
|
22686
|
-
}
|
|
22687
22705
|
class PluginDriver {
|
|
22688
22706
|
constructor(graph, options, userPlugins, pluginCache, basePluginDriver) {
|
|
22689
22707
|
this.graph = graph;
|
|
22690
22708
|
this.options = options;
|
|
22709
|
+
this.pluginCache = pluginCache;
|
|
22710
|
+
this.sortedPlugins = new Map();
|
|
22691
22711
|
this.unfulfilledActions = new Set();
|
|
22692
22712
|
warnDeprecatedHooks(userPlugins, options);
|
|
22693
|
-
this.pluginCache = pluginCache;
|
|
22694
22713
|
this.fileEmitter = new FileEmitter(graph, options, basePluginDriver && basePluginDriver.fileEmitter);
|
|
22695
22714
|
this.emitFile = this.fileEmitter.emitFile.bind(this.fileEmitter);
|
|
22696
22715
|
this.getFileName = this.fileEmitter.getFileName.bind(this.fileEmitter);
|
|
@@ -22720,21 +22739,21 @@ class PluginDriver {
|
|
|
22720
22739
|
}
|
|
22721
22740
|
// chains, first non-null result stops and returns
|
|
22722
22741
|
hookFirst(hookName, args, replaceContext, skipped) {
|
|
22723
|
-
let promise = Promise.resolve(
|
|
22724
|
-
for (const plugin of this.
|
|
22742
|
+
let promise = Promise.resolve(null);
|
|
22743
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22725
22744
|
if (skipped && skipped.has(plugin))
|
|
22726
22745
|
continue;
|
|
22727
22746
|
promise = promise.then(result => {
|
|
22728
22747
|
if (result != null)
|
|
22729
22748
|
return result;
|
|
22730
|
-
return this.runHook(hookName, args, plugin,
|
|
22749
|
+
return this.runHook(hookName, args, plugin, replaceContext);
|
|
22731
22750
|
});
|
|
22732
22751
|
}
|
|
22733
22752
|
return promise;
|
|
22734
22753
|
}
|
|
22735
22754
|
// chains synchronously, first non-null result stops and returns
|
|
22736
22755
|
hookFirstSync(hookName, args, replaceContext) {
|
|
22737
|
-
for (const plugin of this.
|
|
22756
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22738
22757
|
const result = this.runHookSync(hookName, args, plugin, replaceContext);
|
|
22739
22758
|
if (result != null)
|
|
22740
22759
|
return result;
|
|
@@ -22742,56 +22761,58 @@ class PluginDriver {
|
|
|
22742
22761
|
return null;
|
|
22743
22762
|
}
|
|
22744
22763
|
// parallel, ignores returns
|
|
22745
|
-
hookParallel(hookName, args, replaceContext) {
|
|
22746
|
-
const
|
|
22747
|
-
for (const plugin of this.
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22764
|
+
async hookParallel(hookName, args, replaceContext) {
|
|
22765
|
+
const parallelPromises = [];
|
|
22766
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22767
|
+
if (plugin[hookName].sequential) {
|
|
22768
|
+
await Promise.all(parallelPromises);
|
|
22769
|
+
parallelPromises.length = 0;
|
|
22770
|
+
await this.runHook(hookName, args, plugin, replaceContext);
|
|
22771
|
+
}
|
|
22772
|
+
else {
|
|
22773
|
+
parallelPromises.push(this.runHook(hookName, args, plugin, replaceContext));
|
|
22774
|
+
}
|
|
22752
22775
|
}
|
|
22753
|
-
|
|
22776
|
+
await Promise.all(parallelPromises);
|
|
22754
22777
|
}
|
|
22755
22778
|
// chains, reduces returned value, handling the reduced value as the first hook argument
|
|
22756
22779
|
hookReduceArg0(hookName, [arg0, ...rest], reduce, replaceContext) {
|
|
22757
22780
|
let promise = Promise.resolve(arg0);
|
|
22758
|
-
for (const plugin of this.
|
|
22759
|
-
promise = promise.then(arg0 =>
|
|
22760
|
-
const args = [arg0, ...rest];
|
|
22761
|
-
const hookPromise = this.runHook(hookName, args, plugin, false, replaceContext);
|
|
22762
|
-
if (!hookPromise)
|
|
22763
|
-
return arg0;
|
|
22764
|
-
return hookPromise.then(result => reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin));
|
|
22765
|
-
});
|
|
22781
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22782
|
+
promise = promise.then(arg0 => this.runHook(hookName, [arg0, ...rest], plugin, replaceContext).then(result => reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin)));
|
|
22766
22783
|
}
|
|
22767
22784
|
return promise;
|
|
22768
22785
|
}
|
|
22769
22786
|
// chains synchronously, reduces returned value, handling the reduced value as the first hook argument
|
|
22770
22787
|
hookReduceArg0Sync(hookName, [arg0, ...rest], reduce, replaceContext) {
|
|
22771
|
-
for (const plugin of this.
|
|
22788
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22772
22789
|
const args = [arg0, ...rest];
|
|
22773
22790
|
const result = this.runHookSync(hookName, args, plugin, replaceContext);
|
|
22774
22791
|
arg0 = reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin);
|
|
22775
22792
|
}
|
|
22776
22793
|
return arg0;
|
|
22777
22794
|
}
|
|
22778
|
-
// chains, reduces returned value to type
|
|
22779
|
-
hookReduceValue(hookName, initialValue, args,
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
}
|
|
22795
|
+
// chains, reduces returned value to type string, handling the reduced value separately. permits hooks as values.
|
|
22796
|
+
async hookReduceValue(hookName, initialValue, args, reducer) {
|
|
22797
|
+
const results = [];
|
|
22798
|
+
const parallelResults = [];
|
|
22799
|
+
for (const plugin of this.getSortedPlugins(hookName, validateAddonPluginHandler)) {
|
|
22800
|
+
if (plugin[hookName].sequential) {
|
|
22801
|
+
results.push(...(await Promise.all(parallelResults)));
|
|
22802
|
+
parallelResults.length = 0;
|
|
22803
|
+
results.push(await this.runHook(hookName, args, plugin));
|
|
22804
|
+
}
|
|
22805
|
+
else {
|
|
22806
|
+
parallelResults.push(this.runHook(hookName, args, plugin));
|
|
22807
|
+
}
|
|
22788
22808
|
}
|
|
22789
|
-
|
|
22809
|
+
results.push(...(await Promise.all(parallelResults)));
|
|
22810
|
+
return results.reduce(reducer, await initialValue);
|
|
22790
22811
|
}
|
|
22791
22812
|
// chains synchronously, reduces returned value to type T, handling the reduced value separately. permits hooks as values.
|
|
22792
22813
|
hookReduceValueSync(hookName, initialValue, args, reduce, replaceContext) {
|
|
22793
22814
|
let acc = initialValue;
|
|
22794
|
-
for (const plugin of this.
|
|
22815
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22795
22816
|
const result = this.runHookSync(hookName, args, plugin, replaceContext);
|
|
22796
22817
|
acc = reduce.call(this.pluginContexts.get(plugin), acc, result, plugin);
|
|
22797
22818
|
}
|
|
@@ -22800,31 +22821,32 @@ class PluginDriver {
|
|
|
22800
22821
|
// chains, ignores returns
|
|
22801
22822
|
hookSeq(hookName, args, replaceContext) {
|
|
22802
22823
|
let promise = Promise.resolve();
|
|
22803
|
-
for (const plugin of this.
|
|
22804
|
-
promise = promise.then(() => this.runHook(hookName, args, plugin,
|
|
22824
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22825
|
+
promise = promise.then(() => this.runHook(hookName, args, plugin, replaceContext));
|
|
22805
22826
|
}
|
|
22806
|
-
return promise;
|
|
22827
|
+
return promise.then(noReturn);
|
|
22807
22828
|
}
|
|
22808
|
-
|
|
22829
|
+
getSortedPlugins(hookName, validateHandler) {
|
|
22830
|
+
return getOrCreate(this.sortedPlugins, hookName, () => getSortedValidatedPlugins(hookName, this.plugins, validateHandler));
|
|
22831
|
+
}
|
|
22832
|
+
// Implementation signature
|
|
22833
|
+
runHook(hookName, args, plugin, replaceContext) {
|
|
22834
|
+
// We always filter for plugins that support the hook before running it
|
|
22809
22835
|
const hook = plugin[hookName];
|
|
22810
|
-
|
|
22811
|
-
return undefined;
|
|
22836
|
+
const handler = typeof hook === 'object' ? hook.handler : hook;
|
|
22812
22837
|
let context = this.pluginContexts.get(plugin);
|
|
22813
|
-
if (
|
|
22814
|
-
context =
|
|
22838
|
+
if (replaceContext) {
|
|
22839
|
+
context = replaceContext(context, plugin);
|
|
22815
22840
|
}
|
|
22816
22841
|
let action = null;
|
|
22817
22842
|
return Promise.resolve()
|
|
22818
22843
|
.then(() => {
|
|
22819
|
-
|
|
22820
|
-
|
|
22821
|
-
if (permitValues)
|
|
22822
|
-
return hook;
|
|
22823
|
-
return throwInvalidHookError(hookName, plugin.name);
|
|
22844
|
+
if (typeof handler !== 'function') {
|
|
22845
|
+
return handler;
|
|
22824
22846
|
}
|
|
22825
22847
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22826
|
-
const hookResult =
|
|
22827
|
-
if (!hookResult ||
|
|
22848
|
+
const hookResult = handler.apply(context, args);
|
|
22849
|
+
if (!(hookResult === null || hookResult === void 0 ? void 0 : hookResult.then)) {
|
|
22828
22850
|
// short circuit for non-thenables and non-Promises
|
|
22829
22851
|
return hookResult;
|
|
22830
22852
|
}
|
|
@@ -22857,29 +22879,61 @@ class PluginDriver {
|
|
|
22857
22879
|
* @param hookName Name of the plugin hook. Must be in `PluginHooks`.
|
|
22858
22880
|
* @param args Arguments passed to the plugin hook.
|
|
22859
22881
|
* @param plugin The acutal plugin
|
|
22860
|
-
* @param
|
|
22882
|
+
* @param replaceContext When passed, the plugin context can be overridden.
|
|
22861
22883
|
*/
|
|
22862
|
-
runHookSync(hookName, args, plugin,
|
|
22884
|
+
runHookSync(hookName, args, plugin, replaceContext) {
|
|
22863
22885
|
const hook = plugin[hookName];
|
|
22864
|
-
|
|
22865
|
-
return undefined;
|
|
22886
|
+
const handler = typeof hook === 'object' ? hook.handler : hook;
|
|
22866
22887
|
let context = this.pluginContexts.get(plugin);
|
|
22867
|
-
if (
|
|
22868
|
-
context =
|
|
22888
|
+
if (replaceContext) {
|
|
22889
|
+
context = replaceContext(context, plugin);
|
|
22869
22890
|
}
|
|
22870
22891
|
try {
|
|
22871
|
-
// permit values allows values to be returned instead of a functional hook
|
|
22872
|
-
if (typeof hook !== 'function') {
|
|
22873
|
-
return throwInvalidHookError(hookName, plugin.name);
|
|
22874
|
-
}
|
|
22875
22892
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22876
|
-
return
|
|
22893
|
+
return handler.apply(context, args);
|
|
22877
22894
|
}
|
|
22878
22895
|
catch (err) {
|
|
22879
22896
|
return throwPluginError(err, plugin.name, { hook: hookName });
|
|
22880
22897
|
}
|
|
22881
22898
|
}
|
|
22882
22899
|
}
|
|
22900
|
+
function getSortedValidatedPlugins(hookName, plugins, validateHandler = validateFunctionPluginHandler) {
|
|
22901
|
+
const pre = [];
|
|
22902
|
+
const normal = [];
|
|
22903
|
+
const post = [];
|
|
22904
|
+
for (const plugin of plugins) {
|
|
22905
|
+
const hook = plugin[hookName];
|
|
22906
|
+
if (hook) {
|
|
22907
|
+
if (typeof hook === 'object') {
|
|
22908
|
+
validateHandler(hook.handler, hookName, plugin);
|
|
22909
|
+
if (hook.order === 'pre') {
|
|
22910
|
+
pre.push(plugin);
|
|
22911
|
+
continue;
|
|
22912
|
+
}
|
|
22913
|
+
if (hook.order === 'post') {
|
|
22914
|
+
post.push(plugin);
|
|
22915
|
+
continue;
|
|
22916
|
+
}
|
|
22917
|
+
}
|
|
22918
|
+
else {
|
|
22919
|
+
validateHandler(hook, hookName, plugin);
|
|
22920
|
+
}
|
|
22921
|
+
normal.push(plugin);
|
|
22922
|
+
}
|
|
22923
|
+
}
|
|
22924
|
+
return [...pre, ...normal, ...post];
|
|
22925
|
+
}
|
|
22926
|
+
function validateFunctionPluginHandler(handler, hookName, plugin) {
|
|
22927
|
+
if (typeof handler !== 'function') {
|
|
22928
|
+
error(errInvalidFunctionPluginHook(hookName, plugin.name));
|
|
22929
|
+
}
|
|
22930
|
+
}
|
|
22931
|
+
function validateAddonPluginHandler(handler, hookName, plugin) {
|
|
22932
|
+
if (typeof handler !== 'string' && typeof handler !== 'function') {
|
|
22933
|
+
return error(errInvalidAddonPluginHook(hookName, plugin.name));
|
|
22934
|
+
}
|
|
22935
|
+
}
|
|
22936
|
+
function noReturn() { }
|
|
22883
22937
|
|
|
22884
22938
|
class Queue {
|
|
22885
22939
|
constructor(maxParallel) {
|
|
@@ -23514,6 +23568,7 @@ const getAmd = (config) => {
|
|
|
23514
23568
|
autoId: false,
|
|
23515
23569
|
basePath: '',
|
|
23516
23570
|
define: 'define',
|
|
23571
|
+
forceJsExtensionForImports: false,
|
|
23517
23572
|
...config.amd
|
|
23518
23573
|
};
|
|
23519
23574
|
if ((mergedOption.autoId || mergedOption.basePath) && mergedOption.id) {
|
|
@@ -23527,13 +23582,15 @@ const getAmd = (config) => {
|
|
|
23527
23582
|
normalized = {
|
|
23528
23583
|
autoId: true,
|
|
23529
23584
|
basePath: mergedOption.basePath,
|
|
23530
|
-
define: mergedOption.define
|
|
23585
|
+
define: mergedOption.define,
|
|
23586
|
+
forceJsExtensionForImports: mergedOption.forceJsExtensionForImports
|
|
23531
23587
|
};
|
|
23532
23588
|
}
|
|
23533
23589
|
else {
|
|
23534
23590
|
normalized = {
|
|
23535
23591
|
autoId: false,
|
|
23536
23592
|
define: mergedOption.define,
|
|
23593
|
+
forceJsExtensionForImports: mergedOption.forceJsExtensionForImports,
|
|
23537
23594
|
id: mergedOption.id
|
|
23538
23595
|
};
|
|
23539
23596
|
}
|
|
@@ -23720,17 +23777,15 @@ async function getInputOptions(rawInputOptions, watchMode) {
|
|
|
23720
23777
|
if (!rawInputOptions) {
|
|
23721
23778
|
throw new Error('You must supply an options object to rollup');
|
|
23722
23779
|
}
|
|
23723
|
-
const rawPlugins = ensureArray$1(rawInputOptions.plugins);
|
|
23780
|
+
const rawPlugins = getSortedValidatedPlugins('options', ensureArray$1(rawInputOptions.plugins));
|
|
23724
23781
|
const { options, unsetOptions } = normalizeInputOptions(await rawPlugins.reduce(applyOptionHook(watchMode), Promise.resolve(rawInputOptions)));
|
|
23725
23782
|
normalizePlugins(options.plugins, ANONYMOUS_PLUGIN_PREFIX);
|
|
23726
23783
|
return { options, unsetOptions };
|
|
23727
23784
|
}
|
|
23728
23785
|
function applyOptionHook(watchMode) {
|
|
23729
23786
|
return async (inputOptions, plugin) => {
|
|
23730
|
-
|
|
23731
|
-
|
|
23732
|
-
}
|
|
23733
|
-
return inputOptions;
|
|
23787
|
+
const handler = 'handler' in plugin.options ? plugin.options.handler : plugin.options;
|
|
23788
|
+
return ((await handler.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions)) || inputOptions);
|
|
23734
23789
|
};
|
|
23735
23790
|
}
|
|
23736
23791
|
function normalizePlugins(plugins, anonymousPrefix) {
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED