rollup 2.70.0 → 2.70.1
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 +14 -0
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +74 -70
- 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.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 +74 -70
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +2 -2
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.70.
|
|
4
|
-
Mon,
|
|
3
|
+
Rollup.js v2.70.1
|
|
4
|
+
Mon, 14 Mar 2022 05:50:08 GMT - commit b8315e03f9790d610a413316fbf6d565f9340cab
|
|
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.70.
|
|
30
|
+
var version$1 = "2.70.1";
|
|
31
31
|
|
|
32
32
|
function ensureArray$1(items) {
|
|
33
33
|
if (Array.isArray(items)) {
|
|
@@ -22616,41 +22616,6 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22616
22616
|
return context;
|
|
22617
22617
|
}
|
|
22618
22618
|
|
|
22619
|
-
const unfulfilledActions = new Set();
|
|
22620
|
-
function addUnresolvedAction(actionTuple) {
|
|
22621
|
-
unfulfilledActions.add(actionTuple);
|
|
22622
|
-
}
|
|
22623
|
-
function resolveAction(actionTuple) {
|
|
22624
|
-
unfulfilledActions.delete(actionTuple);
|
|
22625
|
-
}
|
|
22626
|
-
function formatAction([pluginName, hookName, args]) {
|
|
22627
|
-
const action = `(${pluginName}) ${hookName}`;
|
|
22628
|
-
const s = JSON.stringify;
|
|
22629
|
-
switch (hookName) {
|
|
22630
|
-
case 'resolveId':
|
|
22631
|
-
return `${action} ${s(args[0])} ${s(args[1])}`;
|
|
22632
|
-
case 'load':
|
|
22633
|
-
return `${action} ${s(args[0])}`;
|
|
22634
|
-
case 'transform':
|
|
22635
|
-
return `${action} ${s(args[1])}`;
|
|
22636
|
-
case 'shouldTransformCachedModule':
|
|
22637
|
-
return `${action} ${s(args[0].id)}`;
|
|
22638
|
-
case 'moduleParsed':
|
|
22639
|
-
return `${action} ${s(args[0].id)}`;
|
|
22640
|
-
}
|
|
22641
|
-
return action;
|
|
22642
|
-
}
|
|
22643
|
-
process$1.on('exit', () => {
|
|
22644
|
-
if (unfulfilledActions.size) {
|
|
22645
|
-
let err = '[!] Error: unfinished hook action(s) on exit:\n';
|
|
22646
|
-
for (const action of unfulfilledActions) {
|
|
22647
|
-
err += formatAction(action) + '\n';
|
|
22648
|
-
}
|
|
22649
|
-
console.error('%s', err);
|
|
22650
|
-
process$1.exitCode = 1;
|
|
22651
|
-
}
|
|
22652
|
-
});
|
|
22653
|
-
|
|
22654
22619
|
const inputHookNames = {
|
|
22655
22620
|
buildEnd: 1,
|
|
22656
22621
|
buildStart: 1,
|
|
@@ -22676,6 +22641,7 @@ class PluginDriver {
|
|
|
22676
22641
|
constructor(graph, options, userPlugins, pluginCache, basePluginDriver) {
|
|
22677
22642
|
this.graph = graph;
|
|
22678
22643
|
this.options = options;
|
|
22644
|
+
this.unfulfilledActions = new Set();
|
|
22679
22645
|
warnDeprecatedHooks(userPlugins, options);
|
|
22680
22646
|
this.pluginCache = pluginCache;
|
|
22681
22647
|
this.fileEmitter = new FileEmitter(graph, options, basePluginDriver && basePluginDriver.fileEmitter);
|
|
@@ -22702,6 +22668,9 @@ class PluginDriver {
|
|
|
22702
22668
|
createOutputPluginDriver(plugins) {
|
|
22703
22669
|
return new PluginDriver(this.graph, this.options, plugins, this.pluginCache, this);
|
|
22704
22670
|
}
|
|
22671
|
+
getUnfulfilledHookActions() {
|
|
22672
|
+
return this.unfulfilledActions;
|
|
22673
|
+
}
|
|
22705
22674
|
// chains, first non-null result stops and returns
|
|
22706
22675
|
hookFirst(hookName, args, replaceContext, skipped) {
|
|
22707
22676
|
let promise = Promise.resolve(undefined);
|
|
@@ -22817,22 +22786,21 @@ class PluginDriver {
|
|
|
22817
22786
|
// exit with a successful 0 return code but without producing any
|
|
22818
22787
|
// output, errors or warnings.
|
|
22819
22788
|
action = [plugin.name, hookName, args];
|
|
22820
|
-
|
|
22789
|
+
this.unfulfilledActions.add(action);
|
|
22821
22790
|
// Although it would be more elegant to just return hookResult here
|
|
22822
22791
|
// and put the .then() handler just above the .catch() handler below,
|
|
22823
22792
|
// doing so would subtly change the defacto async event dispatch order
|
|
22824
22793
|
// which at least one test and some plugins in the wild may depend on.
|
|
22825
|
-
|
|
22826
|
-
return promise.then(() => {
|
|
22794
|
+
return Promise.resolve(hookResult).then(result => {
|
|
22827
22795
|
// action was fulfilled
|
|
22828
|
-
|
|
22829
|
-
return
|
|
22796
|
+
this.unfulfilledActions.delete(action);
|
|
22797
|
+
return result;
|
|
22830
22798
|
});
|
|
22831
22799
|
})
|
|
22832
22800
|
.catch(err => {
|
|
22833
22801
|
if (action !== null) {
|
|
22834
22802
|
// action considered to be fulfilled since error being handled
|
|
22835
|
-
|
|
22803
|
+
this.unfulfilledActions.delete(action);
|
|
22836
22804
|
}
|
|
22837
22805
|
return throwPluginError(err, plugin.name, { hook: hookName });
|
|
22838
22806
|
});
|
|
@@ -23079,6 +23047,38 @@ class Graph {
|
|
|
23079
23047
|
}
|
|
23080
23048
|
}
|
|
23081
23049
|
|
|
23050
|
+
function formatAction([pluginName, hookName, args]) {
|
|
23051
|
+
const action = `(${pluginName}) ${hookName}`;
|
|
23052
|
+
const s = JSON.stringify;
|
|
23053
|
+
switch (hookName) {
|
|
23054
|
+
case 'resolveId':
|
|
23055
|
+
return `${action} ${s(args[0])} ${s(args[1])}`;
|
|
23056
|
+
case 'load':
|
|
23057
|
+
return `${action} ${s(args[0])}`;
|
|
23058
|
+
case 'transform':
|
|
23059
|
+
return `${action} ${s(args[1])}`;
|
|
23060
|
+
case 'shouldTransformCachedModule':
|
|
23061
|
+
return `${action} ${s(args[0].id)}`;
|
|
23062
|
+
case 'moduleParsed':
|
|
23063
|
+
return `${action} ${s(args[0].id)}`;
|
|
23064
|
+
}
|
|
23065
|
+
return action;
|
|
23066
|
+
}
|
|
23067
|
+
async function catchUnfinishedHookActions(pluginDriver, callback) {
|
|
23068
|
+
let handleEmptyEventLoop;
|
|
23069
|
+
const emptyEventLoopPromise = new Promise((_, reject) => {
|
|
23070
|
+
handleEmptyEventLoop = () => {
|
|
23071
|
+
const unfulfilledActions = pluginDriver.getUnfulfilledHookActions();
|
|
23072
|
+
reject(new Error(`Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:\n` +
|
|
23073
|
+
[...unfulfilledActions].map(formatAction).join('\n')));
|
|
23074
|
+
};
|
|
23075
|
+
process$1.once('beforeExit', handleEmptyEventLoop);
|
|
23076
|
+
});
|
|
23077
|
+
const result = await Promise.race([callback(), emptyEventLoopPromise]);
|
|
23078
|
+
process$1.off('beforeExit', handleEmptyEventLoop);
|
|
23079
|
+
return result;
|
|
23080
|
+
}
|
|
23081
|
+
|
|
23082
23082
|
function normalizeInputOptions(config) {
|
|
23083
23083
|
var _a, _b, _c;
|
|
23084
23084
|
// These are options that may trigger special warnings or behaviour later
|
|
@@ -23562,20 +23562,22 @@ async function rollupInternal(rawInputOptions, watcher) {
|
|
|
23562
23562
|
delete inputOptions.cache;
|
|
23563
23563
|
delete rawInputOptions.cache;
|
|
23564
23564
|
timeStart('BUILD', 1);
|
|
23565
|
-
|
|
23566
|
-
|
|
23567
|
-
|
|
23568
|
-
|
|
23569
|
-
catch (err) {
|
|
23570
|
-
const watchFiles = Object.keys(graph.watchFiles);
|
|
23571
|
-
if (watchFiles.length > 0) {
|
|
23572
|
-
err.watchFiles = watchFiles;
|
|
23565
|
+
await catchUnfinishedHookActions(graph.pluginDriver, async () => {
|
|
23566
|
+
try {
|
|
23567
|
+
await graph.pluginDriver.hookParallel('buildStart', [inputOptions]);
|
|
23568
|
+
await graph.build();
|
|
23573
23569
|
}
|
|
23574
|
-
|
|
23575
|
-
|
|
23576
|
-
|
|
23577
|
-
|
|
23578
|
-
|
|
23570
|
+
catch (err) {
|
|
23571
|
+
const watchFiles = Object.keys(graph.watchFiles);
|
|
23572
|
+
if (watchFiles.length > 0) {
|
|
23573
|
+
err.watchFiles = watchFiles;
|
|
23574
|
+
}
|
|
23575
|
+
await graph.pluginDriver.hookParallel('buildEnd', [err]);
|
|
23576
|
+
await graph.pluginDriver.hookParallel('closeBundle', []);
|
|
23577
|
+
throw err;
|
|
23578
|
+
}
|
|
23579
|
+
await graph.pluginDriver.hookParallel('buildEnd', []);
|
|
23580
|
+
});
|
|
23579
23581
|
timeEnd('BUILD', 1);
|
|
23580
23582
|
const result = {
|
|
23581
23583
|
cache: useCache ? graph.getCache() : undefined,
|
|
@@ -23626,21 +23628,23 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
23626
23628
|
}
|
|
23627
23629
|
});
|
|
23628
23630
|
}
|
|
23629
|
-
|
|
23631
|
+
function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutputOptions, graph) {
|
|
23630
23632
|
const { options: outputOptions, outputPluginDriver, unsetOptions } = getOutputOptionsAndPluginDriver(rawOutputOptions, graph.pluginDriver, inputOptions, unsetInputOptions);
|
|
23631
|
-
|
|
23632
|
-
|
|
23633
|
-
|
|
23634
|
-
if (
|
|
23635
|
-
|
|
23636
|
-
|
|
23637
|
-
|
|
23638
|
-
|
|
23633
|
+
return catchUnfinishedHookActions(outputPluginDriver, async () => {
|
|
23634
|
+
const bundle = new Bundle(outputOptions, unsetOptions, inputOptions, outputPluginDriver, graph);
|
|
23635
|
+
const generated = await bundle.generate(isWrite);
|
|
23636
|
+
if (isWrite) {
|
|
23637
|
+
if (!outputOptions.dir && !outputOptions.file) {
|
|
23638
|
+
return error({
|
|
23639
|
+
code: 'MISSING_OPTION',
|
|
23640
|
+
message: 'You must specify "output.file" or "output.dir" for the build.'
|
|
23641
|
+
});
|
|
23642
|
+
}
|
|
23643
|
+
await Promise.all(Object.values(generated).map(chunk => writeOutputFile(chunk, outputOptions)));
|
|
23644
|
+
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
23639
23645
|
}
|
|
23640
|
-
|
|
23641
|
-
|
|
23642
|
-
}
|
|
23643
|
-
return createOutput(generated);
|
|
23646
|
+
return createOutput(generated);
|
|
23647
|
+
});
|
|
23644
23648
|
}
|
|
23645
23649
|
function getOutputOptionsAndPluginDriver(rawOutputOptions, inputPluginDriver, inputOptions, unsetInputOptions) {
|
|
23646
23650
|
if (!rawOutputOptions) {
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup",
|
|
3
|
-
"version": "2.70.
|
|
3
|
+
"version": "2.70.1",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -136,6 +136,6 @@
|
|
|
136
136
|
},
|
|
137
137
|
"default": "./dist/es/rollup.browser.js"
|
|
138
138
|
},
|
|
139
|
-
"./dist
|
|
139
|
+
"./dist/*": "./dist/*"
|
|
140
140
|
}
|
|
141
141
|
}
|