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/es/rollup.js
CHANGED
package/dist/es/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
|
|
|
@@ -14,7 +14,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
14
14
|
import { promises } from 'fs';
|
|
15
15
|
import { EventEmitter } from 'events';
|
|
16
16
|
|
|
17
|
-
var version$1 = "2.
|
|
17
|
+
var version$1 = "2.79.0";
|
|
18
18
|
|
|
19
19
|
var charToInteger = {};
|
|
20
20
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -2033,6 +2033,22 @@ function errInvalidOption(option, urlHash, explanation, value) {
|
|
|
2033
2033
|
url: `https://rollupjs.org/guide/en/#${urlHash}`
|
|
2034
2034
|
};
|
|
2035
2035
|
}
|
|
2036
|
+
function errInvalidAddonPluginHook(hook, plugin) {
|
|
2037
|
+
return {
|
|
2038
|
+
code: Errors.INVALID_PLUGIN_HOOK,
|
|
2039
|
+
hook,
|
|
2040
|
+
message: `Error running plugin hook ${hook} for plugin ${plugin}, expected a string, a function hook or an object with a "handler" string or function.`,
|
|
2041
|
+
plugin
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
function errInvalidFunctionPluginHook(hook, plugin) {
|
|
2045
|
+
return {
|
|
2046
|
+
code: Errors.INVALID_PLUGIN_HOOK,
|
|
2047
|
+
hook,
|
|
2048
|
+
message: `Error running plugin hook ${hook} for plugin ${plugin}, expected a function hook or an object with a "handler" function.`,
|
|
2049
|
+
plugin
|
|
2050
|
+
};
|
|
2051
|
+
}
|
|
2036
2052
|
function errInvalidRollupPhaseForAddWatchFile() {
|
|
2037
2053
|
return {
|
|
2038
2054
|
code: Errors.INVALID_ROLLUP_PHASE,
|
|
@@ -2254,15 +2270,16 @@ const RESERVED_NAMES$1 = RESERVED_NAMES;
|
|
|
2254
2270
|
|
|
2255
2271
|
const illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
2256
2272
|
const startsWithDigit = (str) => /\d/.test(str[0]);
|
|
2273
|
+
const needsEscape = (str) => startsWithDigit(str) || RESERVED_NAMES$1.has(str) || str === 'arguments';
|
|
2257
2274
|
function isLegal(str) {
|
|
2258
|
-
if (
|
|
2275
|
+
if (needsEscape(str)) {
|
|
2259
2276
|
return false;
|
|
2260
2277
|
}
|
|
2261
2278
|
return !illegalCharacters.test(str);
|
|
2262
2279
|
}
|
|
2263
2280
|
function makeLegal(str) {
|
|
2264
2281
|
str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(illegalCharacters, '_');
|
|
2265
|
-
if (
|
|
2282
|
+
if (needsEscape(str))
|
|
2266
2283
|
str = `_${str}`;
|
|
2267
2284
|
return str || '_';
|
|
2268
2285
|
}
|
|
@@ -13298,11 +13315,18 @@ function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, na
|
|
|
13298
13315
|
return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, indent, snippets, externalLiveBindings, freeze, namespaceToStringTag)}${interopStatements.length > 0 ? `${interopStatements.join(n)}${n}${n}` : ''}`;
|
|
13299
13316
|
}
|
|
13300
13317
|
|
|
13318
|
+
function addJsExtension(name) {
|
|
13319
|
+
return name.endsWith('.js') ? name : name + '.js';
|
|
13320
|
+
}
|
|
13321
|
+
|
|
13301
13322
|
// AMD resolution will only respect the AMD baseUrl if the .js extension is omitted.
|
|
13302
13323
|
// The assumption is that this makes sense for all relative ids:
|
|
13303
13324
|
// https://requirejs.org/docs/api.html#jsfiles
|
|
13304
|
-
function
|
|
13305
|
-
|
|
13325
|
+
function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
|
|
13326
|
+
if (id[0] !== '.') {
|
|
13327
|
+
return id;
|
|
13328
|
+
}
|
|
13329
|
+
return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
|
|
13306
13330
|
}
|
|
13307
13331
|
|
|
13308
13332
|
const builtins = {
|
|
@@ -13341,7 +13365,7 @@ function warnOnBuiltins(warn, dependencies) {
|
|
|
13341
13365
|
|
|
13342
13366
|
function amd(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets, warn }, { amd, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
13343
13367
|
warnOnBuiltins(warn, dependencies);
|
|
13344
|
-
const deps = dependencies.map(m => `'${
|
|
13368
|
+
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.id, amd.forceJsExtensionForImports)}'`);
|
|
13345
13369
|
const args = dependencies.map(m => m.name);
|
|
13346
13370
|
const { n, getNonArrowFunctionIntro, _ } = snippets;
|
|
13347
13371
|
if (namedExportsMode && hasExports) {
|
|
@@ -13785,7 +13809,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13785
13809
|
});
|
|
13786
13810
|
}
|
|
13787
13811
|
warnOnBuiltins(warn, dependencies);
|
|
13788
|
-
const amdDeps = dependencies.map(m => `'${
|
|
13812
|
+
const amdDeps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.id, amd.forceJsExtensionForImports)}'`);
|
|
13789
13813
|
const cjsDeps = dependencies.map(m => `require('${m.id}')`);
|
|
13790
13814
|
const trimmedImports = trimEmptyImports(dependencies);
|
|
13791
13815
|
const globalDeps = trimmedImports.map(module => globalProp(module.globalName, globalVar, getPropertyAccess));
|
|
@@ -14992,7 +15016,7 @@ class Chunk {
|
|
|
14992
15016
|
}
|
|
14993
15017
|
}
|
|
14994
15018
|
finaliseDynamicImports(options, snippets) {
|
|
14995
|
-
const stripKnownJsExtensions = options.format === 'amd';
|
|
15019
|
+
const stripKnownJsExtensions = options.format === 'amd' && !options.amd.forceJsExtensionForImports;
|
|
14996
15020
|
for (const [module, code] of this.renderedModuleSources) {
|
|
14997
15021
|
for (const { node, resolution } of module.dynamicImports) {
|
|
14998
15022
|
const chunk = this.chunkByModule.get(resolution);
|
|
@@ -22471,7 +22495,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22471
22495
|
else {
|
|
22472
22496
|
cacheInstance = getCacheForUncacheablePlugin(plugin.name);
|
|
22473
22497
|
}
|
|
22474
|
-
|
|
22498
|
+
return {
|
|
22475
22499
|
addWatchFile(id) {
|
|
22476
22500
|
if (graph.phase >= BuildPhase.GENERATE) {
|
|
22477
22501
|
return this.error(errInvalidRollupPhaseForAddWatchFile());
|
|
@@ -22529,9 +22553,9 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22529
22553
|
options.onwarn(warning);
|
|
22530
22554
|
}
|
|
22531
22555
|
};
|
|
22532
|
-
return context;
|
|
22533
22556
|
}
|
|
22534
22557
|
|
|
22558
|
+
// This will make sure no input hook is omitted
|
|
22535
22559
|
const inputHookNames = {
|
|
22536
22560
|
buildEnd: 1,
|
|
22537
22561
|
buildStart: 1,
|
|
@@ -22547,19 +22571,14 @@ const inputHookNames = {
|
|
|
22547
22571
|
watchChange: 1
|
|
22548
22572
|
};
|
|
22549
22573
|
const inputHooks = Object.keys(inputHookNames);
|
|
22550
|
-
function throwInvalidHookError(hookName, pluginName) {
|
|
22551
|
-
return error({
|
|
22552
|
-
code: 'INVALID_PLUGIN_HOOK',
|
|
22553
|
-
message: `Error running plugin hook ${hookName} for ${pluginName}, expected a function hook.`
|
|
22554
|
-
});
|
|
22555
|
-
}
|
|
22556
22574
|
class PluginDriver {
|
|
22557
22575
|
constructor(graph, options, userPlugins, pluginCache, basePluginDriver) {
|
|
22558
22576
|
this.graph = graph;
|
|
22559
22577
|
this.options = options;
|
|
22578
|
+
this.pluginCache = pluginCache;
|
|
22579
|
+
this.sortedPlugins = new Map();
|
|
22560
22580
|
this.unfulfilledActions = new Set();
|
|
22561
22581
|
warnDeprecatedHooks(userPlugins, options);
|
|
22562
|
-
this.pluginCache = pluginCache;
|
|
22563
22582
|
this.fileEmitter = new FileEmitter(graph, options, basePluginDriver && basePluginDriver.fileEmitter);
|
|
22564
22583
|
this.emitFile = this.fileEmitter.emitFile.bind(this.fileEmitter);
|
|
22565
22584
|
this.getFileName = this.fileEmitter.getFileName.bind(this.fileEmitter);
|
|
@@ -22589,21 +22608,21 @@ class PluginDriver {
|
|
|
22589
22608
|
}
|
|
22590
22609
|
// chains, first non-null result stops and returns
|
|
22591
22610
|
hookFirst(hookName, args, replaceContext, skipped) {
|
|
22592
|
-
let promise = Promise.resolve(
|
|
22593
|
-
for (const plugin of this.
|
|
22611
|
+
let promise = Promise.resolve(null);
|
|
22612
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22594
22613
|
if (skipped && skipped.has(plugin))
|
|
22595
22614
|
continue;
|
|
22596
22615
|
promise = promise.then(result => {
|
|
22597
22616
|
if (result != null)
|
|
22598
22617
|
return result;
|
|
22599
|
-
return this.runHook(hookName, args, plugin,
|
|
22618
|
+
return this.runHook(hookName, args, plugin, replaceContext);
|
|
22600
22619
|
});
|
|
22601
22620
|
}
|
|
22602
22621
|
return promise;
|
|
22603
22622
|
}
|
|
22604
22623
|
// chains synchronously, first non-null result stops and returns
|
|
22605
22624
|
hookFirstSync(hookName, args, replaceContext) {
|
|
22606
|
-
for (const plugin of this.
|
|
22625
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22607
22626
|
const result = this.runHookSync(hookName, args, plugin, replaceContext);
|
|
22608
22627
|
if (result != null)
|
|
22609
22628
|
return result;
|
|
@@ -22611,56 +22630,58 @@ class PluginDriver {
|
|
|
22611
22630
|
return null;
|
|
22612
22631
|
}
|
|
22613
22632
|
// parallel, ignores returns
|
|
22614
|
-
hookParallel(hookName, args, replaceContext) {
|
|
22615
|
-
const
|
|
22616
|
-
for (const plugin of this.
|
|
22617
|
-
|
|
22618
|
-
|
|
22619
|
-
|
|
22620
|
-
|
|
22633
|
+
async hookParallel(hookName, args, replaceContext) {
|
|
22634
|
+
const parallelPromises = [];
|
|
22635
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22636
|
+
if (plugin[hookName].sequential) {
|
|
22637
|
+
await Promise.all(parallelPromises);
|
|
22638
|
+
parallelPromises.length = 0;
|
|
22639
|
+
await this.runHook(hookName, args, plugin, replaceContext);
|
|
22640
|
+
}
|
|
22641
|
+
else {
|
|
22642
|
+
parallelPromises.push(this.runHook(hookName, args, plugin, replaceContext));
|
|
22643
|
+
}
|
|
22621
22644
|
}
|
|
22622
|
-
|
|
22645
|
+
await Promise.all(parallelPromises);
|
|
22623
22646
|
}
|
|
22624
22647
|
// chains, reduces returned value, handling the reduced value as the first hook argument
|
|
22625
22648
|
hookReduceArg0(hookName, [arg0, ...rest], reduce, replaceContext) {
|
|
22626
22649
|
let promise = Promise.resolve(arg0);
|
|
22627
|
-
for (const plugin of this.
|
|
22628
|
-
promise = promise.then(arg0 =>
|
|
22629
|
-
const args = [arg0, ...rest];
|
|
22630
|
-
const hookPromise = this.runHook(hookName, args, plugin, false, replaceContext);
|
|
22631
|
-
if (!hookPromise)
|
|
22632
|
-
return arg0;
|
|
22633
|
-
return hookPromise.then(result => reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin));
|
|
22634
|
-
});
|
|
22650
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22651
|
+
promise = promise.then(arg0 => this.runHook(hookName, [arg0, ...rest], plugin, replaceContext).then(result => reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin)));
|
|
22635
22652
|
}
|
|
22636
22653
|
return promise;
|
|
22637
22654
|
}
|
|
22638
22655
|
// chains synchronously, reduces returned value, handling the reduced value as the first hook argument
|
|
22639
22656
|
hookReduceArg0Sync(hookName, [arg0, ...rest], reduce, replaceContext) {
|
|
22640
|
-
for (const plugin of this.
|
|
22657
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22641
22658
|
const args = [arg0, ...rest];
|
|
22642
22659
|
const result = this.runHookSync(hookName, args, plugin, replaceContext);
|
|
22643
22660
|
arg0 = reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin);
|
|
22644
22661
|
}
|
|
22645
22662
|
return arg0;
|
|
22646
22663
|
}
|
|
22647
|
-
// chains, reduces returned value to type
|
|
22648
|
-
hookReduceValue(hookName, initialValue, args,
|
|
22649
|
-
|
|
22650
|
-
|
|
22651
|
-
|
|
22652
|
-
|
|
22653
|
-
|
|
22654
|
-
|
|
22655
|
-
|
|
22656
|
-
}
|
|
22664
|
+
// chains, reduces returned value to type string, handling the reduced value separately. permits hooks as values.
|
|
22665
|
+
async hookReduceValue(hookName, initialValue, args, reducer) {
|
|
22666
|
+
const results = [];
|
|
22667
|
+
const parallelResults = [];
|
|
22668
|
+
for (const plugin of this.getSortedPlugins(hookName, validateAddonPluginHandler)) {
|
|
22669
|
+
if (plugin[hookName].sequential) {
|
|
22670
|
+
results.push(...(await Promise.all(parallelResults)));
|
|
22671
|
+
parallelResults.length = 0;
|
|
22672
|
+
results.push(await this.runHook(hookName, args, plugin));
|
|
22673
|
+
}
|
|
22674
|
+
else {
|
|
22675
|
+
parallelResults.push(this.runHook(hookName, args, plugin));
|
|
22676
|
+
}
|
|
22657
22677
|
}
|
|
22658
|
-
|
|
22678
|
+
results.push(...(await Promise.all(parallelResults)));
|
|
22679
|
+
return results.reduce(reducer, await initialValue);
|
|
22659
22680
|
}
|
|
22660
22681
|
// chains synchronously, reduces returned value to type T, handling the reduced value separately. permits hooks as values.
|
|
22661
22682
|
hookReduceValueSync(hookName, initialValue, args, reduce, replaceContext) {
|
|
22662
22683
|
let acc = initialValue;
|
|
22663
|
-
for (const plugin of this.
|
|
22684
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22664
22685
|
const result = this.runHookSync(hookName, args, plugin, replaceContext);
|
|
22665
22686
|
acc = reduce.call(this.pluginContexts.get(plugin), acc, result, plugin);
|
|
22666
22687
|
}
|
|
@@ -22669,31 +22690,32 @@ class PluginDriver {
|
|
|
22669
22690
|
// chains, ignores returns
|
|
22670
22691
|
hookSeq(hookName, args, replaceContext) {
|
|
22671
22692
|
let promise = Promise.resolve();
|
|
22672
|
-
for (const plugin of this.
|
|
22673
|
-
promise = promise.then(() => this.runHook(hookName, args, plugin,
|
|
22693
|
+
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
22694
|
+
promise = promise.then(() => this.runHook(hookName, args, plugin, replaceContext));
|
|
22674
22695
|
}
|
|
22675
|
-
return promise;
|
|
22696
|
+
return promise.then(noReturn);
|
|
22676
22697
|
}
|
|
22677
|
-
|
|
22698
|
+
getSortedPlugins(hookName, validateHandler) {
|
|
22699
|
+
return getOrCreate(this.sortedPlugins, hookName, () => getSortedValidatedPlugins(hookName, this.plugins, validateHandler));
|
|
22700
|
+
}
|
|
22701
|
+
// Implementation signature
|
|
22702
|
+
runHook(hookName, args, plugin, replaceContext) {
|
|
22703
|
+
// We always filter for plugins that support the hook before running it
|
|
22678
22704
|
const hook = plugin[hookName];
|
|
22679
|
-
|
|
22680
|
-
return undefined;
|
|
22705
|
+
const handler = typeof hook === 'object' ? hook.handler : hook;
|
|
22681
22706
|
let context = this.pluginContexts.get(plugin);
|
|
22682
|
-
if (
|
|
22683
|
-
context =
|
|
22707
|
+
if (replaceContext) {
|
|
22708
|
+
context = replaceContext(context, plugin);
|
|
22684
22709
|
}
|
|
22685
22710
|
let action = null;
|
|
22686
22711
|
return Promise.resolve()
|
|
22687
22712
|
.then(() => {
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
if (permitValues)
|
|
22691
|
-
return hook;
|
|
22692
|
-
return throwInvalidHookError(hookName, plugin.name);
|
|
22713
|
+
if (typeof handler !== 'function') {
|
|
22714
|
+
return handler;
|
|
22693
22715
|
}
|
|
22694
22716
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22695
|
-
const hookResult =
|
|
22696
|
-
if (!hookResult ||
|
|
22717
|
+
const hookResult = handler.apply(context, args);
|
|
22718
|
+
if (!(hookResult === null || hookResult === void 0 ? void 0 : hookResult.then)) {
|
|
22697
22719
|
// short circuit for non-thenables and non-Promises
|
|
22698
22720
|
return hookResult;
|
|
22699
22721
|
}
|
|
@@ -22726,29 +22748,61 @@ class PluginDriver {
|
|
|
22726
22748
|
* @param hookName Name of the plugin hook. Must be in `PluginHooks`.
|
|
22727
22749
|
* @param args Arguments passed to the plugin hook.
|
|
22728
22750
|
* @param plugin The acutal plugin
|
|
22729
|
-
* @param
|
|
22751
|
+
* @param replaceContext When passed, the plugin context can be overridden.
|
|
22730
22752
|
*/
|
|
22731
|
-
runHookSync(hookName, args, plugin,
|
|
22753
|
+
runHookSync(hookName, args, plugin, replaceContext) {
|
|
22732
22754
|
const hook = plugin[hookName];
|
|
22733
|
-
|
|
22734
|
-
return undefined;
|
|
22755
|
+
const handler = typeof hook === 'object' ? hook.handler : hook;
|
|
22735
22756
|
let context = this.pluginContexts.get(plugin);
|
|
22736
|
-
if (
|
|
22737
|
-
context =
|
|
22757
|
+
if (replaceContext) {
|
|
22758
|
+
context = replaceContext(context, plugin);
|
|
22738
22759
|
}
|
|
22739
22760
|
try {
|
|
22740
|
-
// permit values allows values to be returned instead of a functional hook
|
|
22741
|
-
if (typeof hook !== 'function') {
|
|
22742
|
-
return throwInvalidHookError(hookName, plugin.name);
|
|
22743
|
-
}
|
|
22744
22761
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22745
|
-
return
|
|
22762
|
+
return handler.apply(context, args);
|
|
22746
22763
|
}
|
|
22747
22764
|
catch (err) {
|
|
22748
22765
|
return throwPluginError(err, plugin.name, { hook: hookName });
|
|
22749
22766
|
}
|
|
22750
22767
|
}
|
|
22751
22768
|
}
|
|
22769
|
+
function getSortedValidatedPlugins(hookName, plugins, validateHandler = validateFunctionPluginHandler) {
|
|
22770
|
+
const pre = [];
|
|
22771
|
+
const normal = [];
|
|
22772
|
+
const post = [];
|
|
22773
|
+
for (const plugin of plugins) {
|
|
22774
|
+
const hook = plugin[hookName];
|
|
22775
|
+
if (hook) {
|
|
22776
|
+
if (typeof hook === 'object') {
|
|
22777
|
+
validateHandler(hook.handler, hookName, plugin);
|
|
22778
|
+
if (hook.order === 'pre') {
|
|
22779
|
+
pre.push(plugin);
|
|
22780
|
+
continue;
|
|
22781
|
+
}
|
|
22782
|
+
if (hook.order === 'post') {
|
|
22783
|
+
post.push(plugin);
|
|
22784
|
+
continue;
|
|
22785
|
+
}
|
|
22786
|
+
}
|
|
22787
|
+
else {
|
|
22788
|
+
validateHandler(hook, hookName, plugin);
|
|
22789
|
+
}
|
|
22790
|
+
normal.push(plugin);
|
|
22791
|
+
}
|
|
22792
|
+
}
|
|
22793
|
+
return [...pre, ...normal, ...post];
|
|
22794
|
+
}
|
|
22795
|
+
function validateFunctionPluginHandler(handler, hookName, plugin) {
|
|
22796
|
+
if (typeof handler !== 'function') {
|
|
22797
|
+
error(errInvalidFunctionPluginHook(hookName, plugin.name));
|
|
22798
|
+
}
|
|
22799
|
+
}
|
|
22800
|
+
function validateAddonPluginHandler(handler, hookName, plugin) {
|
|
22801
|
+
if (typeof handler !== 'string' && typeof handler !== 'function') {
|
|
22802
|
+
return error(errInvalidAddonPluginHook(hookName, plugin.name));
|
|
22803
|
+
}
|
|
22804
|
+
}
|
|
22805
|
+
function noReturn() { }
|
|
22752
22806
|
|
|
22753
22807
|
class Queue {
|
|
22754
22808
|
constructor(maxParallel) {
|
|
@@ -23476,6 +23530,7 @@ const getAmd = (config) => {
|
|
|
23476
23530
|
autoId: false,
|
|
23477
23531
|
basePath: '',
|
|
23478
23532
|
define: 'define',
|
|
23533
|
+
forceJsExtensionForImports: false,
|
|
23479
23534
|
...config.amd
|
|
23480
23535
|
};
|
|
23481
23536
|
if ((mergedOption.autoId || mergedOption.basePath) && mergedOption.id) {
|
|
@@ -23489,13 +23544,15 @@ const getAmd = (config) => {
|
|
|
23489
23544
|
normalized = {
|
|
23490
23545
|
autoId: true,
|
|
23491
23546
|
basePath: mergedOption.basePath,
|
|
23492
|
-
define: mergedOption.define
|
|
23547
|
+
define: mergedOption.define,
|
|
23548
|
+
forceJsExtensionForImports: mergedOption.forceJsExtensionForImports
|
|
23493
23549
|
};
|
|
23494
23550
|
}
|
|
23495
23551
|
else {
|
|
23496
23552
|
normalized = {
|
|
23497
23553
|
autoId: false,
|
|
23498
23554
|
define: mergedOption.define,
|
|
23555
|
+
forceJsExtensionForImports: mergedOption.forceJsExtensionForImports,
|
|
23499
23556
|
id: mergedOption.id
|
|
23500
23557
|
};
|
|
23501
23558
|
}
|
|
@@ -23682,17 +23739,15 @@ async function getInputOptions(rawInputOptions, watchMode) {
|
|
|
23682
23739
|
if (!rawInputOptions) {
|
|
23683
23740
|
throw new Error('You must supply an options object to rollup');
|
|
23684
23741
|
}
|
|
23685
|
-
const rawPlugins = ensureArray(rawInputOptions.plugins);
|
|
23742
|
+
const rawPlugins = getSortedValidatedPlugins('options', ensureArray(rawInputOptions.plugins));
|
|
23686
23743
|
const { options, unsetOptions } = normalizeInputOptions(await rawPlugins.reduce(applyOptionHook(watchMode), Promise.resolve(rawInputOptions)));
|
|
23687
23744
|
normalizePlugins(options.plugins, ANONYMOUS_PLUGIN_PREFIX);
|
|
23688
23745
|
return { options, unsetOptions };
|
|
23689
23746
|
}
|
|
23690
23747
|
function applyOptionHook(watchMode) {
|
|
23691
23748
|
return async (inputOptions, plugin) => {
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
}
|
|
23695
|
-
return inputOptions;
|
|
23749
|
+
const handler = 'handler' in plugin.options ? plugin.options.handler : plugin.options;
|
|
23750
|
+
return ((await handler.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions)) || inputOptions);
|
|
23696
23751
|
};
|
|
23697
23752
|
}
|
|
23698
23753
|
function normalizePlugins(plugins, anonymousPrefix) {
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED