rollup 1.29.0 → 1.29.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 +11 -0
- package/dist/bin/rollup +2 -2
- package/dist/rollup.browser.es.js +3 -3
- package/dist/rollup.browser.js +5 -4
- package/dist/rollup.es.js +108 -99
- package/dist/rollup.js +107 -98
- package/dist/shared/index.js +3 -3
- package/package.json +13 -13
package/dist/rollup.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v1.29.
|
|
4
|
-
|
|
3
|
+
Rollup.js v1.29.1
|
|
4
|
+
Tue, 21 Jan 2020 06:50:03 GMT - commit 21a1775a019b45bebfc608c8f58f3691080106e5
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -50,7 +50,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
var version = "1.29.
|
|
53
|
+
var version = "1.29.1";
|
|
54
54
|
|
|
55
55
|
var charToInteger = {};
|
|
56
56
|
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -58,30 +58,28 @@ for (var i = 0; i < chars.length; i++) {
|
|
|
58
58
|
charToInteger[chars.charCodeAt(i)] = i;
|
|
59
59
|
}
|
|
60
60
|
function decode(mappings) {
|
|
61
|
-
var generatedCodeColumn = 0; // first field
|
|
62
|
-
var sourceFileIndex = 0; // second field
|
|
63
|
-
var sourceCodeLine = 0; // third field
|
|
64
|
-
var sourceCodeColumn = 0; // fourth field
|
|
65
|
-
var nameIndex = 0; // fifth field
|
|
66
61
|
var decoded = [];
|
|
67
62
|
var line = [];
|
|
68
|
-
var segment = [
|
|
69
|
-
|
|
63
|
+
var segment = [
|
|
64
|
+
0,
|
|
65
|
+
0,
|
|
66
|
+
0,
|
|
67
|
+
0,
|
|
68
|
+
0,
|
|
69
|
+
];
|
|
70
|
+
var j = 0;
|
|
71
|
+
for (var i = 0, shift = 0, value = 0; i < mappings.length; i++) {
|
|
70
72
|
var c = mappings.charCodeAt(i);
|
|
71
73
|
if (c === 44) { // ","
|
|
72
|
-
|
|
73
|
-
line.push(segment);
|
|
74
|
-
segment = [];
|
|
74
|
+
segmentify(line, segment, j);
|
|
75
75
|
j = 0;
|
|
76
76
|
}
|
|
77
77
|
else if (c === 59) { // ";"
|
|
78
|
-
|
|
79
|
-
line.push(segment);
|
|
80
|
-
segment = [];
|
|
78
|
+
segmentify(line, segment, j);
|
|
81
79
|
j = 0;
|
|
82
80
|
decoded.push(line);
|
|
83
81
|
line = [];
|
|
84
|
-
|
|
82
|
+
segment[0] = 0;
|
|
85
83
|
}
|
|
86
84
|
else {
|
|
87
85
|
var integer = charToInteger[c];
|
|
@@ -98,40 +96,33 @@ function decode(mappings) {
|
|
|
98
96
|
var shouldNegate = value & 1;
|
|
99
97
|
value >>>= 1;
|
|
100
98
|
if (shouldNegate) {
|
|
101
|
-
value = -value;
|
|
102
|
-
if (value === 0)
|
|
103
|
-
value = -0x80000000;
|
|
104
|
-
}
|
|
105
|
-
if (j == 0) {
|
|
106
|
-
generatedCodeColumn += value;
|
|
107
|
-
segment.push(generatedCodeColumn);
|
|
108
|
-
}
|
|
109
|
-
else if (j === 1) {
|
|
110
|
-
sourceFileIndex += value;
|
|
111
|
-
segment.push(sourceFileIndex);
|
|
112
|
-
}
|
|
113
|
-
else if (j === 2) {
|
|
114
|
-
sourceCodeLine += value;
|
|
115
|
-
segment.push(sourceCodeLine);
|
|
116
|
-
}
|
|
117
|
-
else if (j === 3) {
|
|
118
|
-
sourceCodeColumn += value;
|
|
119
|
-
segment.push(sourceCodeColumn);
|
|
120
|
-
}
|
|
121
|
-
else if (j === 4) {
|
|
122
|
-
nameIndex += value;
|
|
123
|
-
segment.push(nameIndex);
|
|
99
|
+
value = value === 0 ? -0x80000000 : -value;
|
|
124
100
|
}
|
|
101
|
+
segment[j] += value;
|
|
125
102
|
j++;
|
|
126
103
|
value = shift = 0; // reset
|
|
127
104
|
}
|
|
128
105
|
}
|
|
129
106
|
}
|
|
130
|
-
|
|
131
|
-
line.push(segment);
|
|
107
|
+
segmentify(line, segment, j);
|
|
132
108
|
decoded.push(line);
|
|
133
109
|
return decoded;
|
|
134
110
|
}
|
|
111
|
+
function segmentify(line, segment, j) {
|
|
112
|
+
// This looks ugly, but we're creating specialized arrays with a specific
|
|
113
|
+
// length. This is much faster than creating a new array (which v8 expands to
|
|
114
|
+
// a capacity of 17 after pushing the first item), or slicing out a subarray
|
|
115
|
+
// (which is slow). Length 4 is assumed to be the most frequent, followed by
|
|
116
|
+
// length 5 (since not everything will have an associated name), followed by
|
|
117
|
+
// length 1 (it's probably rare for a source substring to not have an
|
|
118
|
+
// associated segment data).
|
|
119
|
+
if (j === 4)
|
|
120
|
+
line.push([segment[0], segment[1], segment[2], segment[3]]);
|
|
121
|
+
else if (j === 5)
|
|
122
|
+
line.push([segment[0], segment[1], segment[2], segment[3], segment[4]]);
|
|
123
|
+
else if (j === 1)
|
|
124
|
+
line.push([segment[0]]);
|
|
125
|
+
}
|
|
135
126
|
function encode(decoded) {
|
|
136
127
|
var sourceFileIndex = 0; // second field
|
|
137
128
|
var sourceCodeLine = 0; // third field
|
|
@@ -187,12 +178,11 @@ var BitSet = function BitSet(arg) {
|
|
|
187
178
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
188
179
|
};
|
|
189
180
|
BitSet.prototype.add = function add(n) {
|
|
190
|
-
this.bits[
|
|
181
|
+
this.bits[n >> 5] |= 1 << (n & 31);
|
|
191
182
|
};
|
|
192
183
|
BitSet.prototype.has = function has(n) {
|
|
193
|
-
return !!(this.bits[
|
|
184
|
+
return !!(this.bits[n >> 5] & (1 << (n & 31)));
|
|
194
185
|
};
|
|
195
|
-
var BITS = 32;
|
|
196
186
|
var Chunk = function Chunk(start, end, content) {
|
|
197
187
|
this.start = start;
|
|
198
188
|
this.end = end;
|
|
@@ -4506,7 +4496,7 @@ class Identifier$1 extends NodeBase {
|
|
|
4506
4496
|
}
|
|
4507
4497
|
}
|
|
4508
4498
|
disallowImportReassignment() {
|
|
4509
|
-
this.context.error({
|
|
4499
|
+
return this.context.error({
|
|
4510
4500
|
code: 'ILLEGAL_REASSIGNMENT',
|
|
4511
4501
|
message: `Illegal reassignment to import '${this.name}'`
|
|
4512
4502
|
}, this.start);
|
|
@@ -4864,11 +4854,11 @@ class NamespaceVariable extends Variable {
|
|
|
4864
4854
|
include(context) {
|
|
4865
4855
|
if (!this.included) {
|
|
4866
4856
|
if (this.containsExternalNamespace) {
|
|
4867
|
-
this.context.error({
|
|
4857
|
+
return this.context.error({
|
|
4868
4858
|
code: 'NAMESPACE_CANNOT_CONTAIN_EXTERNAL',
|
|
4869
4859
|
id: this.module.id,
|
|
4870
4860
|
message: `Cannot create an explicit namespace object for module "${this.context.getModuleName()}" because it contains a reexported external namespace`
|
|
4871
|
-
}
|
|
4861
|
+
});
|
|
4872
4862
|
}
|
|
4873
4863
|
this.included = true;
|
|
4874
4864
|
for (const identifier of this.references) {
|
|
@@ -5683,7 +5673,7 @@ function iife(magicString, { dependencies, exports, hasExports, indentString: t,
|
|
|
5683
5673
|
const isNamespaced = name && name.indexOf('.') !== -1;
|
|
5684
5674
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
5685
5675
|
if (name && useVariableAssignment && !isLegal(name)) {
|
|
5686
|
-
error({
|
|
5676
|
+
return error({
|
|
5687
5677
|
code: 'ILLEGAL_IDENTIFIER_AS_NAME',
|
|
5688
5678
|
message: `Given name "${name}" is not a legal JS identifier. If you need this, you can try "output.extend: true".`
|
|
5689
5679
|
});
|
|
@@ -5895,7 +5885,7 @@ function umd(magicString, { dependencies, exports, hasExports, indentString: t,
|
|
|
5895
5885
|
const factoryVar = options.compact ? 'f' : 'factory';
|
|
5896
5886
|
const globalVar = options.compact ? 'g' : 'global';
|
|
5897
5887
|
if (hasExports && !options.name) {
|
|
5898
|
-
error({
|
|
5888
|
+
return error({
|
|
5899
5889
|
code: 'INVALID_OPTION',
|
|
5900
5890
|
message: 'You must supply "output.name" for UMD bundles.'
|
|
5901
5891
|
});
|
|
@@ -6658,7 +6648,7 @@ class MemberExpression extends NodeBase {
|
|
|
6658
6648
|
disallowNamespaceReassignment() {
|
|
6659
6649
|
if (this.object instanceof Identifier$1 &&
|
|
6660
6650
|
this.scope.findVariable(this.object.name).isNamespace) {
|
|
6661
|
-
this.context.error({
|
|
6651
|
+
return this.context.error({
|
|
6662
6652
|
code: 'ILLEGAL_NAMESPACE_REASSIGNMENT',
|
|
6663
6653
|
message: `Illegal reassignment to import '${this.object.name}'`
|
|
6664
6654
|
}, this.start);
|
|
@@ -6711,7 +6701,7 @@ class CallExpression$1 extends NodeBase {
|
|
|
6711
6701
|
if (this.callee instanceof Identifier$1) {
|
|
6712
6702
|
const variable = this.scope.findVariable(this.callee.name);
|
|
6713
6703
|
if (variable.isNamespace) {
|
|
6714
|
-
this.context.error({
|
|
6704
|
+
return this.context.error({
|
|
6715
6705
|
code: 'CANNOT_CALL_NAMESPACE',
|
|
6716
6706
|
message: `Cannot call a namespace ('${this.callee.name}')`
|
|
6717
6707
|
}, this.start);
|
|
@@ -7839,7 +7829,7 @@ function addJsExtensionIfNecessary(file, preserveSymlinks) {
|
|
|
7839
7829
|
function createResolveId(preserveSymlinks) {
|
|
7840
7830
|
return function (source, importer) {
|
|
7841
7831
|
if (typeof process === 'undefined') {
|
|
7842
|
-
error({
|
|
7832
|
+
return error({
|
|
7843
7833
|
code: 'MISSING_PROCESS',
|
|
7844
7834
|
message: `It looks like you're using Rollup in a non-Node.js environment. This means you must supply a plugin with custom resolveId and load functions`,
|
|
7845
7835
|
url: 'https://rollupjs.org/guide/en/#a-simple-example'
|
|
@@ -8681,7 +8671,7 @@ class TaggedTemplateExpression extends NodeBase {
|
|
|
8681
8671
|
const name = this.tag.name;
|
|
8682
8672
|
const variable = this.scope.findVariable(name);
|
|
8683
8673
|
if (variable.isNamespace) {
|
|
8684
|
-
this.context.error({
|
|
8674
|
+
return this.context.error({
|
|
8685
8675
|
code: 'CANNOT_CALL_NAMESPACE',
|
|
8686
8676
|
message: `Cannot call a namespace ('${name}')`
|
|
8687
8677
|
}, this.start);
|
|
@@ -9702,7 +9692,7 @@ function tryParse(module, Parser, acornOptions) {
|
|
|
9702
9692
|
else if (!module.id.endsWith('.js')) {
|
|
9703
9693
|
message += ' (Note that you need plugins to import files that are not JavaScript)';
|
|
9704
9694
|
}
|
|
9705
|
-
module.error({
|
|
9695
|
+
return module.error({
|
|
9706
9696
|
code: 'PARSE_ERROR',
|
|
9707
9697
|
message,
|
|
9708
9698
|
parserError: err
|
|
@@ -9710,7 +9700,7 @@ function tryParse(module, Parser, acornOptions) {
|
|
|
9710
9700
|
}
|
|
9711
9701
|
}
|
|
9712
9702
|
function handleMissingExport(exportName, importingModule, importedModule, importerStart) {
|
|
9713
|
-
importingModule.error({
|
|
9703
|
+
return importingModule.error({
|
|
9714
9704
|
code: 'MISSING_EXPORT',
|
|
9715
9705
|
message: `'${exportName}' is not exported by ${relativeId(importedModule)}`,
|
|
9716
9706
|
url: `https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module`
|
|
@@ -9720,6 +9710,19 @@ const MISSING_EXPORT_SHIM_DESCRIPTION = {
|
|
|
9720
9710
|
identifier: null,
|
|
9721
9711
|
localName: MISSING_EXPORT_SHIM_VARIABLE
|
|
9722
9712
|
};
|
|
9713
|
+
function getVariableForExportNameRecursive(target, name, isExportAllSearch, searchedNamesAndModules = new Map()) {
|
|
9714
|
+
const searchedModules = searchedNamesAndModules.get(name);
|
|
9715
|
+
if (searchedModules) {
|
|
9716
|
+
if (searchedModules.has(target)) {
|
|
9717
|
+
return null;
|
|
9718
|
+
}
|
|
9719
|
+
searchedModules.add(target);
|
|
9720
|
+
}
|
|
9721
|
+
else {
|
|
9722
|
+
searchedNamesAndModules.set(name, new Set([target]));
|
|
9723
|
+
}
|
|
9724
|
+
return target.getVariableForExportName(name, isExportAllSearch, searchedNamesAndModules);
|
|
9725
|
+
}
|
|
9723
9726
|
class Module {
|
|
9724
9727
|
constructor(graph, id, moduleSideEffects, syntheticNamedExports, isEntry) {
|
|
9725
9728
|
this.chunk = null;
|
|
@@ -9771,7 +9774,7 @@ class Module {
|
|
|
9771
9774
|
this.ast.bind();
|
|
9772
9775
|
}
|
|
9773
9776
|
error(props, pos) {
|
|
9774
|
-
if (pos
|
|
9777
|
+
if (typeof pos === 'number') {
|
|
9775
9778
|
props.pos = pos;
|
|
9776
9779
|
let location = locate(this.code, pos, { offsetLine: 1 });
|
|
9777
9780
|
try {
|
|
@@ -9787,7 +9790,7 @@ class Module {
|
|
|
9787
9790
|
},
|
|
9788
9791
|
message: `Error when using sourcemap for reporting an error: ${e.message}`,
|
|
9789
9792
|
pos
|
|
9790
|
-
}
|
|
9793
|
+
});
|
|
9791
9794
|
}
|
|
9792
9795
|
props.loc = {
|
|
9793
9796
|
column: location.column,
|
|
@@ -9796,7 +9799,7 @@ class Module {
|
|
|
9796
9799
|
};
|
|
9797
9800
|
props.frame = getCodeFrame(this.originalCode, location.line, location.column);
|
|
9798
9801
|
}
|
|
9799
|
-
error(props);
|
|
9802
|
+
return error(props);
|
|
9800
9803
|
}
|
|
9801
9804
|
getAllExportNames() {
|
|
9802
9805
|
if (this.allExportNames) {
|
|
@@ -9915,7 +9918,7 @@ class Module {
|
|
|
9915
9918
|
.concat(this.getExports())
|
|
9916
9919
|
.map((exportName) => this.getVariableForExportName(exportName).module));
|
|
9917
9920
|
}
|
|
9918
|
-
getVariableForExportName(name, isExportAllSearch) {
|
|
9921
|
+
getVariableForExportName(name, isExportAllSearch, searchedNamesAndModules) {
|
|
9919
9922
|
if (name[0] === '*') {
|
|
9920
9923
|
if (name.length === 1) {
|
|
9921
9924
|
return this.getOrCreateNamespace();
|
|
@@ -9929,9 +9932,9 @@ class Module {
|
|
|
9929
9932
|
// export { foo } from './other'
|
|
9930
9933
|
const reexportDeclaration = this.reexportDescriptions[name];
|
|
9931
9934
|
if (reexportDeclaration) {
|
|
9932
|
-
const declaration = reexportDeclaration.module
|
|
9935
|
+
const declaration = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, false, searchedNamesAndModules);
|
|
9933
9936
|
if (!declaration) {
|
|
9934
|
-
handleMissingExport(reexportDeclaration.localName, this, reexportDeclaration.module.id, reexportDeclaration.start);
|
|
9937
|
+
return handleMissingExport(reexportDeclaration.localName, this, reexportDeclaration.module.id, reexportDeclaration.start);
|
|
9935
9938
|
}
|
|
9936
9939
|
return declaration;
|
|
9937
9940
|
}
|
|
@@ -9945,7 +9948,7 @@ class Module {
|
|
|
9945
9948
|
}
|
|
9946
9949
|
if (name !== 'default') {
|
|
9947
9950
|
for (const module of this.exportAllModules) {
|
|
9948
|
-
const declaration = module
|
|
9951
|
+
const declaration = getVariableForExportNameRecursive(module, name, true, searchedNamesAndModules);
|
|
9949
9952
|
if (declaration)
|
|
9950
9953
|
return declaration;
|
|
9951
9954
|
}
|
|
@@ -9968,7 +9971,7 @@ class Module {
|
|
|
9968
9971
|
return this.exportShimVariable;
|
|
9969
9972
|
}
|
|
9970
9973
|
}
|
|
9971
|
-
return
|
|
9974
|
+
return null;
|
|
9972
9975
|
}
|
|
9973
9976
|
include() {
|
|
9974
9977
|
const context = createInclusionContext();
|
|
@@ -10135,14 +10138,14 @@ class Module {
|
|
|
10135
10138
|
}
|
|
10136
10139
|
const declaration = otherModule.getVariableForExportName(importDeclaration.name);
|
|
10137
10140
|
if (!declaration) {
|
|
10138
|
-
handleMissingExport(importDeclaration.name, this, otherModule.id, importDeclaration.start);
|
|
10141
|
+
return handleMissingExport(importDeclaration.name, this, otherModule.id, importDeclaration.start);
|
|
10139
10142
|
}
|
|
10140
10143
|
return declaration;
|
|
10141
10144
|
}
|
|
10142
10145
|
return null;
|
|
10143
10146
|
}
|
|
10144
10147
|
warn(warning, pos) {
|
|
10145
|
-
if (pos
|
|
10148
|
+
if (typeof pos === 'number') {
|
|
10146
10149
|
warning.pos = pos;
|
|
10147
10150
|
const { line, column } = locate(this.code, pos, { offsetLine: 1 }); // TODO trace sourcemaps, cf. error()
|
|
10148
10151
|
warning.loc = { file: this.id, line, column };
|
|
@@ -10214,7 +10217,7 @@ class Module {
|
|
|
10214
10217
|
for (const specifier of node.specifiers) {
|
|
10215
10218
|
const localName = specifier.local.name;
|
|
10216
10219
|
if (this.importDescriptions[localName]) {
|
|
10217
|
-
this.error({
|
|
10220
|
+
return this.error({
|
|
10218
10221
|
code: 'DUPLICATE_IMPORT',
|
|
10219
10222
|
message: `Duplicated import '${localName}'`
|
|
10220
10223
|
}, specifier.start);
|
|
@@ -10226,7 +10229,12 @@ class Module {
|
|
|
10226
10229
|
: isNamespace
|
|
10227
10230
|
? '*'
|
|
10228
10231
|
: specifier.imported.name;
|
|
10229
|
-
this.importDescriptions[localName] = {
|
|
10232
|
+
this.importDescriptions[localName] = {
|
|
10233
|
+
module: null,
|
|
10234
|
+
name,
|
|
10235
|
+
source,
|
|
10236
|
+
start: specifier.start
|
|
10237
|
+
};
|
|
10230
10238
|
}
|
|
10231
10239
|
}
|
|
10232
10240
|
addImportMeta(node) {
|
|
@@ -10319,7 +10327,7 @@ class Link {
|
|
|
10319
10327
|
}
|
|
10320
10328
|
else if (traced.source.content != null &&
|
|
10321
10329
|
sourcesContent[sourceIndex] !== traced.source.content) {
|
|
10322
|
-
error({
|
|
10330
|
+
return error({
|
|
10323
10331
|
message: `Multiple conflicting contents for sourcemap source ${traced.source.filename}`
|
|
10324
10332
|
});
|
|
10325
10333
|
}
|
|
@@ -11192,7 +11200,7 @@ class Chunk$1 {
|
|
|
11192
11200
|
}
|
|
11193
11201
|
}
|
|
11194
11202
|
if (usesTopLevelAwait && format !== 'es' && format !== 'system') {
|
|
11195
|
-
error({
|
|
11203
|
+
return error({
|
|
11196
11204
|
code: 'INVALID_TLA_FORMAT',
|
|
11197
11205
|
message: `Module format ${format} does not support top-level await. Use the "es" or "system" output formats rather.`
|
|
11198
11206
|
});
|
|
@@ -12070,7 +12078,7 @@ function transform(graph, source, module) {
|
|
|
12070
12078
|
pluginContext.setAssetSource(assetReferenceId, source);
|
|
12071
12079
|
if (!customTransformCache && !setAssetSourceErr) {
|
|
12072
12080
|
try {
|
|
12073
|
-
this.error({
|
|
12081
|
+
return this.error({
|
|
12074
12082
|
code: 'INVALID_SETASSETSOURCE',
|
|
12075
12083
|
message: `setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.`
|
|
12076
12084
|
});
|
|
@@ -12235,7 +12243,7 @@ class ModuleLoader {
|
|
|
12235
12243
|
}
|
|
12236
12244
|
addModuleToManualChunk(alias, module) {
|
|
12237
12245
|
if (module.manualChunkAlias !== null && module.manualChunkAlias !== alias) {
|
|
12238
|
-
error(errCannotAssignModuleToChunk(module.id, alias, module.manualChunkAlias));
|
|
12246
|
+
return error(errCannotAssignModuleToChunk(module.id, alias, module.manualChunkAlias));
|
|
12239
12247
|
}
|
|
12240
12248
|
module.manualChunkAlias = alias;
|
|
12241
12249
|
if (!this.manualChunkModules[alias]) {
|
|
@@ -12375,7 +12383,7 @@ class ModuleLoader {
|
|
|
12375
12383
|
handleResolveId(resolvedId, source, importer) {
|
|
12376
12384
|
if (resolvedId === null) {
|
|
12377
12385
|
if (isRelative(source)) {
|
|
12378
|
-
error(errUnresolvedImport(source, importer));
|
|
12386
|
+
return error(errUnresolvedImport(source, importer));
|
|
12379
12387
|
}
|
|
12380
12388
|
this.graph.warn(errUnresolvedImportTreatedAsExternal(source, importer));
|
|
12381
12389
|
return {
|
|
@@ -12616,7 +12624,7 @@ class FileEmitter {
|
|
|
12616
12624
|
this.assertAssetsFinalized = () => {
|
|
12617
12625
|
for (const [referenceId, emittedFile] of this.filesByReferenceId.entries()) {
|
|
12618
12626
|
if (emittedFile.type === 'asset' && typeof emittedFile.fileName !== 'string')
|
|
12619
|
-
error(errNoAssetSourceSet(emittedFile.name || referenceId));
|
|
12627
|
+
return error(errNoAssetSourceSet(emittedFile.name || referenceId));
|
|
12620
12628
|
}
|
|
12621
12629
|
};
|
|
12622
12630
|
this.emitFile = (emittedFile) => {
|
|
@@ -12723,7 +12731,7 @@ class FileEmitter {
|
|
|
12723
12731
|
}
|
|
12724
12732
|
emitChunk(emittedChunk) {
|
|
12725
12733
|
if (this.graph.phase > BuildPhase.LOAD_AND_PARSE) {
|
|
12726
|
-
error(errInvalidRollupPhaseForChunkEmission());
|
|
12734
|
+
return error(errInvalidRollupPhaseForChunkEmission());
|
|
12727
12735
|
}
|
|
12728
12736
|
if (typeof emittedChunk.id !== 'string') {
|
|
12729
12737
|
return error(errFailedValidation(`Emitted chunks need to have a valid string id, received "${emittedChunk.id}"`));
|
|
@@ -12822,8 +12830,9 @@ function getPluginContexts(pluginCache, graph, fileEmitter, watcher) {
|
|
|
12822
12830
|
}
|
|
12823
12831
|
const context = {
|
|
12824
12832
|
addWatchFile(id) {
|
|
12825
|
-
if (graph.phase >= BuildPhase.GENERATE)
|
|
12826
|
-
this.error(errInvalidRollupPhaseForAddWatchFile());
|
|
12833
|
+
if (graph.phase >= BuildPhase.GENERATE) {
|
|
12834
|
+
return this.error(errInvalidRollupPhaseForAddWatchFile());
|
|
12835
|
+
}
|
|
12827
12836
|
graph.watchFiles[id] = true;
|
|
12828
12837
|
},
|
|
12829
12838
|
cache: cacheInstance,
|
|
@@ -13031,7 +13040,7 @@ class PluginDriver {
|
|
|
13031
13040
|
if (typeof hook !== 'function') {
|
|
13032
13041
|
if (permitValues)
|
|
13033
13042
|
return hook;
|
|
13034
|
-
error({
|
|
13043
|
+
return error({
|
|
13035
13044
|
code: 'INVALID_PLUGIN_HOOK',
|
|
13036
13045
|
message: `Error running plugin hook ${hookName} for ${plugin.name}, expected a function hook.`
|
|
13037
13046
|
});
|
|
@@ -13053,7 +13062,7 @@ class PluginDriver {
|
|
|
13053
13062
|
try {
|
|
13054
13063
|
// permit values allows values to be returned instead of a functional hook
|
|
13055
13064
|
if (typeof hook !== 'function') {
|
|
13056
|
-
error({
|
|
13065
|
+
return error({
|
|
13057
13066
|
code: 'INVALID_PLUGIN_HOOK',
|
|
13058
13067
|
message: `Error running plugin hook ${hookName} for ${plugin.name}, expected a function hook.`
|
|
13059
13068
|
});
|
|
@@ -13401,7 +13410,7 @@ function createAddons(options, outputPluginDriver) {
|
|
|
13401
13410
|
return { intro, outro, banner, footer };
|
|
13402
13411
|
})
|
|
13403
13412
|
.catch((err) => {
|
|
13404
|
-
error({
|
|
13413
|
+
return error({
|
|
13405
13414
|
code: 'ADDON_ERROR',
|
|
13406
13415
|
message: `Could not retrieve ${err.hook}. Check configuration of plugin ${err.plugin}.
|
|
13407
13416
|
\tError Message: ${err.message}`
|
|
@@ -13455,11 +13464,11 @@ function getExportMode(chunk, { exports: exportMode, name, format }, facadeModul
|
|
|
13455
13464
|
const exportKeys = chunk.getExportNames();
|
|
13456
13465
|
if (exportMode === 'default') {
|
|
13457
13466
|
if (exportKeys.length !== 1 || exportKeys[0] !== 'default') {
|
|
13458
|
-
error(errIncompatibleExportOptionValue('default', exportKeys, facadeModuleId));
|
|
13467
|
+
return error(errIncompatibleExportOptionValue('default', exportKeys, facadeModuleId));
|
|
13459
13468
|
}
|
|
13460
13469
|
}
|
|
13461
13470
|
else if (exportMode === 'none' && exportKeys.length) {
|
|
13462
|
-
error(errIncompatibleExportOptionValue('none', exportKeys, facadeModuleId));
|
|
13471
|
+
return error(errIncompatibleExportOptionValue('none', exportKeys, facadeModuleId));
|
|
13463
13472
|
}
|
|
13464
13473
|
if (!exportMode || exportMode === 'auto') {
|
|
13465
13474
|
if (exportKeys.length === 0) {
|
|
@@ -13672,19 +13681,19 @@ function getOutputOptions(config, command = {}) {
|
|
|
13672
13681
|
|
|
13673
13682
|
function checkOutputOptions(options) {
|
|
13674
13683
|
if (options.format === 'es6') {
|
|
13675
|
-
error(errDeprecation({
|
|
13684
|
+
return error(errDeprecation({
|
|
13676
13685
|
message: 'The "es6" output format is deprecated – use "esm" instead',
|
|
13677
13686
|
url: `https://rollupjs.org/guide/en/#output-format`
|
|
13678
13687
|
}));
|
|
13679
13688
|
}
|
|
13680
13689
|
if (['amd', 'cjs', 'system', 'es', 'iife', 'umd'].indexOf(options.format) < 0) {
|
|
13681
|
-
error({
|
|
13690
|
+
return error({
|
|
13682
13691
|
message: `You must specify "output.format", which can be one of "amd", "cjs", "system", "esm", "iife" or "umd".`,
|
|
13683
13692
|
url: `https://rollupjs.org/guide/en/#output-format`
|
|
13684
13693
|
});
|
|
13685
13694
|
}
|
|
13686
13695
|
if (options.exports && !['default', 'named', 'none', 'auto'].includes(options.exports)) {
|
|
13687
|
-
error(errInvalidExportOptionValue(options.exports));
|
|
13696
|
+
return error(errInvalidExportOptionValue(options.exports));
|
|
13688
13697
|
}
|
|
13689
13698
|
}
|
|
13690
13699
|
function getAbsoluteEntryModulePaths(chunks) {
|
|
@@ -13731,35 +13740,35 @@ function getInputOptions$1(rawInputOptions) {
|
|
|
13731
13740
|
inputOptions.plugins = normalizePlugins(inputOptions.plugins, ANONYMOUS_PLUGIN_PREFIX);
|
|
13732
13741
|
if (inputOptions.inlineDynamicImports) {
|
|
13733
13742
|
if (inputOptions.preserveModules)
|
|
13734
|
-
error({
|
|
13743
|
+
return error({
|
|
13735
13744
|
code: 'INVALID_OPTION',
|
|
13736
13745
|
message: `"preserveModules" does not support the "inlineDynamicImports" option.`
|
|
13737
13746
|
});
|
|
13738
13747
|
if (inputOptions.manualChunks)
|
|
13739
|
-
error({
|
|
13748
|
+
return error({
|
|
13740
13749
|
code: 'INVALID_OPTION',
|
|
13741
13750
|
message: '"manualChunks" option is not supported for "inlineDynamicImports".'
|
|
13742
13751
|
});
|
|
13743
13752
|
if (inputOptions.experimentalOptimizeChunks)
|
|
13744
|
-
error({
|
|
13753
|
+
return error({
|
|
13745
13754
|
code: 'INVALID_OPTION',
|
|
13746
13755
|
message: '"experimentalOptimizeChunks" option is not supported for "inlineDynamicImports".'
|
|
13747
13756
|
});
|
|
13748
13757
|
if ((inputOptions.input instanceof Array && inputOptions.input.length > 1) ||
|
|
13749
13758
|
(typeof inputOptions.input === 'object' && Object.keys(inputOptions.input).length > 1))
|
|
13750
|
-
error({
|
|
13759
|
+
return error({
|
|
13751
13760
|
code: 'INVALID_OPTION',
|
|
13752
13761
|
message: 'Multiple inputs are not supported for "inlineDynamicImports".'
|
|
13753
13762
|
});
|
|
13754
13763
|
}
|
|
13755
13764
|
else if (inputOptions.preserveModules) {
|
|
13756
13765
|
if (inputOptions.manualChunks)
|
|
13757
|
-
error({
|
|
13766
|
+
return error({
|
|
13758
13767
|
code: 'INVALID_OPTION',
|
|
13759
13768
|
message: '"preserveModules" does not support the "manualChunks" option.'
|
|
13760
13769
|
});
|
|
13761
13770
|
if (inputOptions.experimentalOptimizeChunks)
|
|
13762
|
-
error({
|
|
13771
|
+
return error({
|
|
13763
13772
|
code: 'INVALID_OPTION',
|
|
13764
13773
|
message: '"preserveModules" does not support the "experimentalOptimizeChunks" option.'
|
|
13765
13774
|
});
|
|
@@ -13902,7 +13911,7 @@ function rollup(rawInputOptions) {
|
|
|
13902
13911
|
write: ((rawOutputOptions) => {
|
|
13903
13912
|
const { outputOptions, outputPluginDriver } = getOutputOptionsAndPluginDriver(rawOutputOptions);
|
|
13904
13913
|
if (!outputOptions.dir && !outputOptions.file) {
|
|
13905
|
-
error({
|
|
13914
|
+
return error({
|
|
13906
13915
|
code: 'MISSING_OPTION',
|
|
13907
13916
|
message: 'You must specify "output.file" or "output.dir" for the build.'
|
|
13908
13917
|
});
|
|
@@ -13919,12 +13928,12 @@ function rollup(rawInputOptions) {
|
|
|
13919
13928
|
}
|
|
13920
13929
|
if (chunkCount > 1) {
|
|
13921
13930
|
if (outputOptions.sourcemapFile)
|
|
13922
|
-
error({
|
|
13931
|
+
return error({
|
|
13923
13932
|
code: 'INVALID_OPTION',
|
|
13924
13933
|
message: '"output.sourcemapFile" is only supported for single-file builds.'
|
|
13925
13934
|
});
|
|
13926
13935
|
if (typeof outputOptions.file === 'string')
|
|
13927
|
-
error({
|
|
13936
|
+
return error({
|
|
13928
13937
|
code: 'INVALID_OPTION',
|
|
13929
13938
|
message: 'When building multiple chunks, the "output.dir" option must be used, not "output.file".' +
|
|
13930
13939
|
(typeof inputOptions.input !== 'string' ||
|
|
@@ -14022,30 +14031,30 @@ function normalizeOutputOptions(inputOptions, rawOutputOptions, hasMultipleChunk
|
|
|
14022
14031
|
checkOutputOptions(outputOptions);
|
|
14023
14032
|
if (typeof outputOptions.file === 'string') {
|
|
14024
14033
|
if (typeof outputOptions.dir === 'string')
|
|
14025
|
-
error({
|
|
14034
|
+
return error({
|
|
14026
14035
|
code: 'INVALID_OPTION',
|
|
14027
14036
|
message: 'You must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks.'
|
|
14028
14037
|
});
|
|
14029
14038
|
if (inputOptions.preserveModules) {
|
|
14030
|
-
error({
|
|
14039
|
+
return error({
|
|
14031
14040
|
code: 'INVALID_OPTION',
|
|
14032
14041
|
message: 'You must set "output.dir" instead of "output.file" when using the "preserveModules" option.'
|
|
14033
14042
|
});
|
|
14034
14043
|
}
|
|
14035
14044
|
if (typeof inputOptions.input === 'object' && !Array.isArray(inputOptions.input))
|
|
14036
|
-
error({
|
|
14045
|
+
return error({
|
|
14037
14046
|
code: 'INVALID_OPTION',
|
|
14038
14047
|
message: 'You must set "output.dir" instead of "output.file" when providing named inputs.'
|
|
14039
14048
|
});
|
|
14040
14049
|
}
|
|
14041
14050
|
if (hasMultipleChunks) {
|
|
14042
14051
|
if (outputOptions.format === 'umd' || outputOptions.format === 'iife')
|
|
14043
|
-
error({
|
|
14052
|
+
return error({
|
|
14044
14053
|
code: 'INVALID_OPTION',
|
|
14045
14054
|
message: 'UMD and IIFE output formats are not supported for code-splitting builds.'
|
|
14046
14055
|
});
|
|
14047
14056
|
if (typeof outputOptions.file === 'string')
|
|
14048
|
-
error({
|
|
14057
|
+
return error({
|
|
14049
14058
|
code: 'INVALID_OPTION',
|
|
14050
14059
|
message: 'You must set "output.dir" instead of "output.file" when generating multiple chunks.'
|
|
14051
14060
|
});
|