rollup 2.39.0 → 2.41.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 +43 -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 +594 -553
- package/dist/es/shared/watch.js +448 -448
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -0
- package/dist/rollup.d.ts +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +442 -442
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +594 -553
- package/dist/shared/watch-cli.js +18 -18
- package/dist/shared/watch.js +2 -2
- package/package.json +3 -2
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.41.1
|
|
4
|
+
Thu, 11 Mar 2021 04:49:46 GMT - commit d053e0da854919998fd8f2f23937703235cd40b8
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -13,12 +13,12 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
13
13
|
import { writeFile as writeFile$1, readdirSync, mkdirSync, readFile as readFile$1, lstatSync, realpathSync } from 'fs';
|
|
14
14
|
import { EventEmitter } from 'events';
|
|
15
15
|
|
|
16
|
-
var version = "2.
|
|
16
|
+
var version$1 = "2.41.1";
|
|
17
17
|
|
|
18
18
|
var charToInteger = {};
|
|
19
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
20
|
-
for (var i = 0; i < chars.length; i++) {
|
|
21
|
-
charToInteger[chars.charCodeAt(i)] = i;
|
|
19
|
+
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
20
|
+
for (var i = 0; i < chars$1.length; i++) {
|
|
21
|
+
charToInteger[chars$1.charCodeAt(i)] = i;
|
|
22
22
|
}
|
|
23
23
|
function decode(mappings) {
|
|
24
24
|
var decoded = [];
|
|
@@ -132,7 +132,7 @@ function encodeInteger(num) {
|
|
|
132
132
|
if (num > 0) {
|
|
133
133
|
clamped |= 32;
|
|
134
134
|
}
|
|
135
|
-
result += chars[clamped];
|
|
135
|
+
result += chars$1[clamped];
|
|
136
136
|
} while (num > 0);
|
|
137
137
|
return result;
|
|
138
138
|
}
|
|
@@ -149,7 +149,7 @@ BitSet.prototype.has = function has (n) {
|
|
|
149
149
|
return !!(this.bits[n >> 5] & (1 << (n & 31)));
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
var Chunk = function Chunk(start, end, content) {
|
|
152
|
+
var Chunk$1 = function Chunk(start, end, content) {
|
|
153
153
|
this.start = start;
|
|
154
154
|
this.end = end;
|
|
155
155
|
this.original = content;
|
|
@@ -168,16 +168,16 @@ var Chunk = function Chunk(start, end, content) {
|
|
|
168
168
|
});
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
Chunk.prototype.appendLeft = function appendLeft (content) {
|
|
171
|
+
Chunk$1.prototype.appendLeft = function appendLeft (content) {
|
|
172
172
|
this.outro += content;
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
-
Chunk.prototype.appendRight = function appendRight (content) {
|
|
175
|
+
Chunk$1.prototype.appendRight = function appendRight (content) {
|
|
176
176
|
this.intro = this.intro + content;
|
|
177
177
|
};
|
|
178
178
|
|
|
179
|
-
Chunk.prototype.clone = function clone () {
|
|
180
|
-
var chunk = new Chunk(this.start, this.end, this.original);
|
|
179
|
+
Chunk$1.prototype.clone = function clone () {
|
|
180
|
+
var chunk = new Chunk$1(this.start, this.end, this.original);
|
|
181
181
|
|
|
182
182
|
chunk.intro = this.intro;
|
|
183
183
|
chunk.outro = this.outro;
|
|
@@ -188,11 +188,11 @@ Chunk.prototype.clone = function clone () {
|
|
|
188
188
|
return chunk;
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
Chunk.prototype.contains = function contains (index) {
|
|
191
|
+
Chunk$1.prototype.contains = function contains (index) {
|
|
192
192
|
return this.start < index && index < this.end;
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
-
Chunk.prototype.eachNext = function eachNext (fn) {
|
|
195
|
+
Chunk$1.prototype.eachNext = function eachNext (fn) {
|
|
196
196
|
var chunk = this;
|
|
197
197
|
while (chunk) {
|
|
198
198
|
fn(chunk);
|
|
@@ -200,7 +200,7 @@ Chunk.prototype.eachNext = function eachNext (fn) {
|
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
Chunk.prototype.eachPrevious = function eachPrevious (fn) {
|
|
203
|
+
Chunk$1.prototype.eachPrevious = function eachPrevious (fn) {
|
|
204
204
|
var chunk = this;
|
|
205
205
|
while (chunk) {
|
|
206
206
|
fn(chunk);
|
|
@@ -208,7 +208,7 @@ Chunk.prototype.eachPrevious = function eachPrevious (fn) {
|
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
-
Chunk.prototype.edit = function edit (content, storeName, contentOnly) {
|
|
211
|
+
Chunk$1.prototype.edit = function edit (content, storeName, contentOnly) {
|
|
212
212
|
this.content = content;
|
|
213
213
|
if (!contentOnly) {
|
|
214
214
|
this.intro = '';
|
|
@@ -221,15 +221,15 @@ Chunk.prototype.edit = function edit (content, storeName, contentOnly) {
|
|
|
221
221
|
return this;
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
-
Chunk.prototype.prependLeft = function prependLeft (content) {
|
|
224
|
+
Chunk$1.prototype.prependLeft = function prependLeft (content) {
|
|
225
225
|
this.outro = content + this.outro;
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
-
Chunk.prototype.prependRight = function prependRight (content) {
|
|
228
|
+
Chunk$1.prototype.prependRight = function prependRight (content) {
|
|
229
229
|
this.intro = content + this.intro;
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
-
Chunk.prototype.split = function split (index) {
|
|
232
|
+
Chunk$1.prototype.split = function split (index) {
|
|
233
233
|
var sliceIndex = index - this.start;
|
|
234
234
|
|
|
235
235
|
var originalBefore = this.original.slice(0, sliceIndex);
|
|
@@ -237,7 +237,7 @@ Chunk.prototype.split = function split (index) {
|
|
|
237
237
|
|
|
238
238
|
this.original = originalBefore;
|
|
239
239
|
|
|
240
|
-
var newChunk = new Chunk(index, this.end, originalAfter);
|
|
240
|
+
var newChunk = new Chunk$1(index, this.end, originalAfter);
|
|
241
241
|
newChunk.outro = this.outro;
|
|
242
242
|
this.outro = '';
|
|
243
243
|
|
|
@@ -259,11 +259,11 @@ Chunk.prototype.split = function split (index) {
|
|
|
259
259
|
return newChunk;
|
|
260
260
|
};
|
|
261
261
|
|
|
262
|
-
Chunk.prototype.toString = function toString () {
|
|
262
|
+
Chunk$1.prototype.toString = function toString () {
|
|
263
263
|
return this.intro + this.content + this.outro;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
-
Chunk.prototype.trimEnd = function trimEnd (rx) {
|
|
266
|
+
Chunk$1.prototype.trimEnd = function trimEnd (rx) {
|
|
267
267
|
this.outro = this.outro.replace(rx, '');
|
|
268
268
|
if (this.outro.length) { return true; }
|
|
269
269
|
|
|
@@ -283,7 +283,7 @@ Chunk.prototype.trimEnd = function trimEnd (rx) {
|
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
285
|
|
|
286
|
-
Chunk.prototype.trimStart = function trimStart (rx) {
|
|
286
|
+
Chunk$1.prototype.trimStart = function trimStart (rx) {
|
|
287
287
|
this.intro = this.intro.replace(rx, '');
|
|
288
288
|
if (this.intro.length) { return true; }
|
|
289
289
|
|
|
@@ -375,13 +375,13 @@ function getRelativePath(from, to) {
|
|
|
375
375
|
return fromParts.concat(toParts).join('/');
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
var toString = Object.prototype.toString;
|
|
378
|
+
var toString$1 = Object.prototype.toString;
|
|
379
379
|
|
|
380
380
|
function isObject(thing) {
|
|
381
|
-
return toString.call(thing) === '[object Object]';
|
|
381
|
+
return toString$1.call(thing) === '[object Object]';
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
function getLocator(source) {
|
|
384
|
+
function getLocator$1(source) {
|
|
385
385
|
var originalLines = source.split('\n');
|
|
386
386
|
var lineOffsets = [];
|
|
387
387
|
|
|
@@ -486,7 +486,7 @@ var warned = {
|
|
|
486
486
|
var MagicString = function MagicString(string, options) {
|
|
487
487
|
if ( options === void 0 ) options = {};
|
|
488
488
|
|
|
489
|
-
var chunk = new Chunk(0, string.length, string);
|
|
489
|
+
var chunk = new Chunk$1(0, string.length, string);
|
|
490
490
|
|
|
491
491
|
Object.defineProperties(this, {
|
|
492
492
|
original: { writable: true, value: string },
|
|
@@ -595,7 +595,7 @@ MagicString.prototype.generateDecodedMap = function generateDecodedMap (options)
|
|
|
595
595
|
var names = Object.keys(this.storedNames);
|
|
596
596
|
var mappings = new Mappings(options.hires);
|
|
597
597
|
|
|
598
|
-
var locate = getLocator(this.original);
|
|
598
|
+
var locate = getLocator$1(this.original);
|
|
599
599
|
|
|
600
600
|
if (this.intro) {
|
|
601
601
|
mappings.advance(this.intro);
|
|
@@ -831,7 +831,7 @@ MagicString.prototype.overwrite = function overwrite (start, end, content, optio
|
|
|
831
831
|
}
|
|
832
832
|
} else {
|
|
833
833
|
// must be inserting at the end
|
|
834
|
-
var newChunk = new Chunk(start, end, '').edit(content, storeName);
|
|
834
|
+
var newChunk = new Chunk$1(start, end, '').edit(content, storeName);
|
|
835
835
|
|
|
836
836
|
// TODO last chunk in the array may not be the last chunk, if it's moved...
|
|
837
837
|
last.next = newChunk;
|
|
@@ -1029,7 +1029,7 @@ MagicString.prototype._split = function _split (index) {
|
|
|
1029
1029
|
MagicString.prototype._splitChunk = function _splitChunk (chunk, index) {
|
|
1030
1030
|
if (chunk.edited && chunk.content.length) {
|
|
1031
1031
|
// zero-length edited chunks are a special case (overlapping replacements)
|
|
1032
|
-
var loc = getLocator(this.original)(index);
|
|
1032
|
+
var loc = getLocator$1(this.original)(index);
|
|
1033
1033
|
throw new Error(
|
|
1034
1034
|
("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
|
|
1035
1035
|
);
|
|
@@ -1156,7 +1156,7 @@ MagicString.prototype.trimStart = function trimStart (charType) {
|
|
|
1156
1156
|
|
|
1157
1157
|
var hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1158
1158
|
|
|
1159
|
-
var Bundle = function Bundle(options) {
|
|
1159
|
+
var Bundle$1 = function Bundle(options) {
|
|
1160
1160
|
if ( options === void 0 ) options = {};
|
|
1161
1161
|
|
|
1162
1162
|
this.intro = options.intro || '';
|
|
@@ -1166,7 +1166,7 @@ var Bundle = function Bundle(options) {
|
|
|
1166
1166
|
this.uniqueSourceIndexByFilename = {};
|
|
1167
1167
|
};
|
|
1168
1168
|
|
|
1169
|
-
Bundle.prototype.addSource = function addSource (source) {
|
|
1169
|
+
Bundle$1.prototype.addSource = function addSource (source) {
|
|
1170
1170
|
if (source instanceof MagicString) {
|
|
1171
1171
|
return this.addSource({
|
|
1172
1172
|
content: source,
|
|
@@ -1204,7 +1204,7 @@ Bundle.prototype.addSource = function addSource (source) {
|
|
|
1204
1204
|
return this;
|
|
1205
1205
|
};
|
|
1206
1206
|
|
|
1207
|
-
Bundle.prototype.append = function append (str, options) {
|
|
1207
|
+
Bundle$1.prototype.append = function append (str, options) {
|
|
1208
1208
|
this.addSource({
|
|
1209
1209
|
content: new MagicString(str),
|
|
1210
1210
|
separator: (options && options.separator) || ''
|
|
@@ -1213,8 +1213,8 @@ Bundle.prototype.append = function append (str, options) {
|
|
|
1213
1213
|
return this;
|
|
1214
1214
|
};
|
|
1215
1215
|
|
|
1216
|
-
Bundle.prototype.clone = function clone () {
|
|
1217
|
-
var bundle = new Bundle({
|
|
1216
|
+
Bundle$1.prototype.clone = function clone () {
|
|
1217
|
+
var bundle = new Bundle$1({
|
|
1218
1218
|
intro: this.intro,
|
|
1219
1219
|
separator: this.separator
|
|
1220
1220
|
});
|
|
@@ -1230,7 +1230,7 @@ Bundle.prototype.clone = function clone () {
|
|
|
1230
1230
|
return bundle;
|
|
1231
1231
|
};
|
|
1232
1232
|
|
|
1233
|
-
Bundle.prototype.generateDecodedMap = function generateDecodedMap (options) {
|
|
1233
|
+
Bundle$1.prototype.generateDecodedMap = function generateDecodedMap (options) {
|
|
1234
1234
|
var this$1 = this;
|
|
1235
1235
|
if ( options === void 0 ) options = {};
|
|
1236
1236
|
|
|
@@ -1254,7 +1254,7 @@ Bundle.prototype.generateDecodedMap = function generateDecodedMap (options) {
|
|
|
1254
1254
|
|
|
1255
1255
|
var sourceIndex = source.filename ? this$1.uniqueSourceIndexByFilename[source.filename] : -1;
|
|
1256
1256
|
var magicString = source.content;
|
|
1257
|
-
var locate = getLocator(magicString.original);
|
|
1257
|
+
var locate = getLocator$1(magicString.original);
|
|
1258
1258
|
|
|
1259
1259
|
if (magicString.intro) {
|
|
1260
1260
|
mappings.advance(magicString.intro);
|
|
@@ -1307,11 +1307,11 @@ Bundle.prototype.generateDecodedMap = function generateDecodedMap (options) {
|
|
|
1307
1307
|
};
|
|
1308
1308
|
};
|
|
1309
1309
|
|
|
1310
|
-
Bundle.prototype.generateMap = function generateMap (options) {
|
|
1310
|
+
Bundle$1.prototype.generateMap = function generateMap (options) {
|
|
1311
1311
|
return new SourceMap(this.generateDecodedMap(options));
|
|
1312
1312
|
};
|
|
1313
1313
|
|
|
1314
|
-
Bundle.prototype.getIndentString = function getIndentString () {
|
|
1314
|
+
Bundle$1.prototype.getIndentString = function getIndentString () {
|
|
1315
1315
|
var indentStringCounts = {};
|
|
1316
1316
|
|
|
1317
1317
|
this.sources.forEach(function (source) {
|
|
@@ -1330,7 +1330,7 @@ Bundle.prototype.getIndentString = function getIndentString () {
|
|
|
1330
1330
|
);
|
|
1331
1331
|
};
|
|
1332
1332
|
|
|
1333
|
-
Bundle.prototype.indent = function indent (indentStr) {
|
|
1333
|
+
Bundle$1.prototype.indent = function indent (indentStr) {
|
|
1334
1334
|
var this$1 = this;
|
|
1335
1335
|
|
|
1336
1336
|
if (!arguments.length) {
|
|
@@ -1364,12 +1364,12 @@ Bundle.prototype.indent = function indent (indentStr) {
|
|
|
1364
1364
|
return this;
|
|
1365
1365
|
};
|
|
1366
1366
|
|
|
1367
|
-
Bundle.prototype.prepend = function prepend (str) {
|
|
1367
|
+
Bundle$1.prototype.prepend = function prepend (str) {
|
|
1368
1368
|
this.intro = str + this.intro;
|
|
1369
1369
|
return this;
|
|
1370
1370
|
};
|
|
1371
1371
|
|
|
1372
|
-
Bundle.prototype.toString = function toString () {
|
|
1372
|
+
Bundle$1.prototype.toString = function toString () {
|
|
1373
1373
|
var this$1 = this;
|
|
1374
1374
|
|
|
1375
1375
|
var body = this.sources
|
|
@@ -1384,7 +1384,7 @@ Bundle.prototype.toString = function toString () {
|
|
|
1384
1384
|
return this.intro + body;
|
|
1385
1385
|
};
|
|
1386
1386
|
|
|
1387
|
-
Bundle.prototype.isEmpty = function isEmpty () {
|
|
1387
|
+
Bundle$1.prototype.isEmpty = function isEmpty () {
|
|
1388
1388
|
if (this.intro.length && this.intro.trim())
|
|
1389
1389
|
{ return false; }
|
|
1390
1390
|
if (this.sources.some(function (source) { return !source.content.isEmpty(); }))
|
|
@@ -1392,19 +1392,19 @@ Bundle.prototype.isEmpty = function isEmpty () {
|
|
|
1392
1392
|
return true;
|
|
1393
1393
|
};
|
|
1394
1394
|
|
|
1395
|
-
Bundle.prototype.length = function length () {
|
|
1395
|
+
Bundle$1.prototype.length = function length () {
|
|
1396
1396
|
return this.sources.reduce(function (length, source) { return length + source.content.length(); }, this.intro.length);
|
|
1397
1397
|
};
|
|
1398
1398
|
|
|
1399
|
-
Bundle.prototype.trimLines = function trimLines () {
|
|
1399
|
+
Bundle$1.prototype.trimLines = function trimLines () {
|
|
1400
1400
|
return this.trim('[\\r\\n]');
|
|
1401
1401
|
};
|
|
1402
1402
|
|
|
1403
|
-
Bundle.prototype.trim = function trim (charType) {
|
|
1403
|
+
Bundle$1.prototype.trim = function trim (charType) {
|
|
1404
1404
|
return this.trimStart(charType).trimEnd(charType);
|
|
1405
1405
|
};
|
|
1406
1406
|
|
|
1407
|
-
Bundle.prototype.trimStart = function trimStart (charType) {
|
|
1407
|
+
Bundle$1.prototype.trimStart = function trimStart (charType) {
|
|
1408
1408
|
var rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
1409
1409
|
this.intro = this.intro.replace(rx, '');
|
|
1410
1410
|
|
|
@@ -1423,7 +1423,7 @@ Bundle.prototype.trimStart = function trimStart (charType) {
|
|
|
1423
1423
|
return this;
|
|
1424
1424
|
};
|
|
1425
1425
|
|
|
1426
|
-
Bundle.prototype.trimEnd = function trimEnd (charType) {
|
|
1426
|
+
Bundle$1.prototype.trimEnd = function trimEnd (charType) {
|
|
1427
1427
|
var rx = new RegExp((charType || '\\s') + '+$');
|
|
1428
1428
|
|
|
1429
1429
|
var source;
|
|
@@ -1461,24 +1461,27 @@ function relative(from, to) {
|
|
|
1461
1461
|
return toParts.join('/');
|
|
1462
1462
|
}
|
|
1463
1463
|
|
|
1464
|
-
const ArrowFunctionExpression = 'ArrowFunctionExpression';
|
|
1465
|
-
const BlockStatement = 'BlockStatement';
|
|
1466
|
-
const CallExpression = 'CallExpression';
|
|
1467
|
-
const ExpressionStatement = 'ExpressionStatement';
|
|
1468
|
-
const Identifier = 'Identifier';
|
|
1469
|
-
const ImportDefaultSpecifier = 'ImportDefaultSpecifier';
|
|
1470
|
-
const ImportNamespaceSpecifier = 'ImportNamespaceSpecifier';
|
|
1471
|
-
const NewExpression = 'NewExpression';
|
|
1472
|
-
const Program = 'Program';
|
|
1473
|
-
const Property = 'Property';
|
|
1474
|
-
const ReturnStatement = 'ReturnStatement';
|
|
1464
|
+
const ArrowFunctionExpression$1 = 'ArrowFunctionExpression';
|
|
1465
|
+
const BlockStatement$1 = 'BlockStatement';
|
|
1466
|
+
const CallExpression$1 = 'CallExpression';
|
|
1467
|
+
const ExpressionStatement$1 = 'ExpressionStatement';
|
|
1468
|
+
const Identifier$1 = 'Identifier';
|
|
1469
|
+
const ImportDefaultSpecifier$1 = 'ImportDefaultSpecifier';
|
|
1470
|
+
const ImportNamespaceSpecifier$1 = 'ImportNamespaceSpecifier';
|
|
1471
|
+
const NewExpression$1 = 'NewExpression';
|
|
1472
|
+
const Program$1 = 'Program';
|
|
1473
|
+
const Property$1 = 'Property';
|
|
1474
|
+
const ReturnStatement$1 = 'ReturnStatement';
|
|
1475
1475
|
|
|
1476
1476
|
function treeshakeNode(node, code, start, end) {
|
|
1477
1477
|
code.remove(start, end);
|
|
1478
1478
|
if (node.annotations) {
|
|
1479
1479
|
for (const annotation of node.annotations) {
|
|
1480
|
-
if (annotation.
|
|
1481
|
-
|
|
1480
|
+
if (!annotation.comment) {
|
|
1481
|
+
continue;
|
|
1482
|
+
}
|
|
1483
|
+
if (annotation.comment.start < start) {
|
|
1484
|
+
code.remove(annotation.comment.start, annotation.comment.end);
|
|
1482
1485
|
}
|
|
1483
1486
|
else {
|
|
1484
1487
|
return;
|
|
@@ -1487,12 +1490,12 @@ function treeshakeNode(node, code, start, end) {
|
|
|
1487
1490
|
}
|
|
1488
1491
|
}
|
|
1489
1492
|
function removeAnnotations(node, code) {
|
|
1490
|
-
if (!node.annotations && node.parent.type === ExpressionStatement) {
|
|
1493
|
+
if (!node.annotations && node.parent.type === ExpressionStatement$1) {
|
|
1491
1494
|
node = node.parent;
|
|
1492
1495
|
}
|
|
1493
1496
|
if (node.annotations) {
|
|
1494
|
-
for (const annotation of node.annotations) {
|
|
1495
|
-
code.remove(annotation.start, annotation.end);
|
|
1497
|
+
for (const annotation of node.annotations.filter((a) => a.comment)) {
|
|
1498
|
+
code.remove(annotation.comment.start, annotation.comment.end);
|
|
1496
1499
|
}
|
|
1497
1500
|
}
|
|
1498
1501
|
}
|
|
@@ -1661,14 +1664,14 @@ function getSystemExportFunctionLeft(exportedVariables, setFromExpression, optio
|
|
|
1661
1664
|
.join(`,${_}`)}${_}}),${_}v${s}${_}}(`;
|
|
1662
1665
|
}
|
|
1663
1666
|
|
|
1664
|
-
const chars
|
|
1665
|
-
const base = 64;
|
|
1667
|
+
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
|
|
1668
|
+
const base$1 = 64;
|
|
1666
1669
|
function toBase64(num) {
|
|
1667
1670
|
let outStr = '';
|
|
1668
1671
|
do {
|
|
1669
|
-
const curDigit = num % base;
|
|
1670
|
-
num = Math.floor(num / base);
|
|
1671
|
-
outStr = chars
|
|
1672
|
+
const curDigit = num % base$1;
|
|
1673
|
+
num = Math.floor(num / base$1);
|
|
1674
|
+
outStr = chars[curDigit] + outStr;
|
|
1672
1675
|
} while (num !== 0);
|
|
1673
1676
|
return outStr;
|
|
1674
1677
|
}
|
|
@@ -2403,7 +2406,7 @@ class LocalVariable extends Variable {
|
|
|
2403
2406
|
// We do not want to properly include parents in case they are part of a dead branch
|
|
2404
2407
|
// in which case .include() might pull in more dead code
|
|
2405
2408
|
node.included = true;
|
|
2406
|
-
if (node.type === Program)
|
|
2409
|
+
if (node.type === Program$1)
|
|
2407
2410
|
break;
|
|
2408
2411
|
node = node.parent;
|
|
2409
2412
|
}
|
|
@@ -2427,7 +2430,7 @@ class LocalVariable extends Variable {
|
|
|
2427
2430
|
}
|
|
2428
2431
|
}
|
|
2429
2432
|
|
|
2430
|
-
class Scope {
|
|
2433
|
+
class Scope$1 {
|
|
2431
2434
|
constructor() {
|
|
2432
2435
|
this.children = [];
|
|
2433
2436
|
this.variables = new Map();
|
|
@@ -2452,7 +2455,7 @@ class Scope {
|
|
|
2452
2455
|
}
|
|
2453
2456
|
}
|
|
2454
2457
|
|
|
2455
|
-
class ChildScope extends Scope {
|
|
2458
|
+
class ChildScope extends Scope$1 {
|
|
2456
2459
|
constructor(parent) {
|
|
2457
2460
|
super();
|
|
2458
2461
|
this.accessedOutsideVariables = new Map();
|
|
@@ -2534,7 +2537,7 @@ class ChildScope extends Scope {
|
|
|
2534
2537
|
}
|
|
2535
2538
|
}
|
|
2536
2539
|
|
|
2537
|
-
function getLocator
|
|
2540
|
+
function getLocator(source, options) {
|
|
2538
2541
|
if (options === void 0) { options = {}; }
|
|
2539
2542
|
var offsetLine = options.offsetLine || 0;
|
|
2540
2543
|
var offsetColumn = options.offsetColumn || 0;
|
|
@@ -2572,7 +2575,7 @@ function locate(source, search, options) {
|
|
|
2572
2575
|
if (typeof options === 'number') {
|
|
2573
2576
|
throw new Error('locate takes a { startIndex, offsetLine, offsetColumn } object as the third argument');
|
|
2574
2577
|
}
|
|
2575
|
-
return getLocator
|
|
2578
|
+
return getLocator(source, options)(search, options && options.startIndex);
|
|
2576
2579
|
}
|
|
2577
2580
|
|
|
2578
2581
|
const keys = {
|
|
@@ -2580,7 +2583,7 @@ const keys = {
|
|
|
2580
2583
|
Program: ['body']
|
|
2581
2584
|
};
|
|
2582
2585
|
function getAndCreateKeys(esTreeNode) {
|
|
2583
|
-
keys[esTreeNode.type] = Object.keys(esTreeNode).filter(key => typeof esTreeNode[key] === 'object');
|
|
2586
|
+
keys[esTreeNode.type] = Object.keys(esTreeNode).filter(key => key !== '_rollupAnnotations' && typeof esTreeNode[key] === 'object');
|
|
2584
2587
|
return keys[esTreeNode.type];
|
|
2585
2588
|
}
|
|
2586
2589
|
|
|
@@ -2606,7 +2609,7 @@ class NodeBase {
|
|
|
2606
2609
|
bind() {
|
|
2607
2610
|
for (const key of this.keys) {
|
|
2608
2611
|
const value = this[key];
|
|
2609
|
-
if (value === null
|
|
2612
|
+
if (value === null)
|
|
2610
2613
|
continue;
|
|
2611
2614
|
if (Array.isArray(value)) {
|
|
2612
2615
|
for (const child of value) {
|
|
@@ -2635,7 +2638,7 @@ class NodeBase {
|
|
|
2635
2638
|
hasEffects(context) {
|
|
2636
2639
|
for (const key of this.keys) {
|
|
2637
2640
|
const value = this[key];
|
|
2638
|
-
if (value === null
|
|
2641
|
+
if (value === null)
|
|
2639
2642
|
continue;
|
|
2640
2643
|
if (Array.isArray(value)) {
|
|
2641
2644
|
for (const child of value) {
|
|
@@ -2661,7 +2664,7 @@ class NodeBase {
|
|
|
2661
2664
|
this.included = true;
|
|
2662
2665
|
for (const key of this.keys) {
|
|
2663
2666
|
const value = this[key];
|
|
2664
|
-
if (value === null
|
|
2667
|
+
if (value === null)
|
|
2665
2668
|
continue;
|
|
2666
2669
|
if (Array.isArray(value)) {
|
|
2667
2670
|
for (const child of value) {
|
|
@@ -2697,7 +2700,10 @@ class NodeBase {
|
|
|
2697
2700
|
if (this.hasOwnProperty(key))
|
|
2698
2701
|
continue;
|
|
2699
2702
|
const value = esTreeNode[key];
|
|
2700
|
-
if (
|
|
2703
|
+
if (key === '_rollupAnnotations') {
|
|
2704
|
+
this.annotations = value;
|
|
2705
|
+
}
|
|
2706
|
+
else if (typeof value !== 'object' || value === null) {
|
|
2701
2707
|
this[key] = value;
|
|
2702
2708
|
}
|
|
2703
2709
|
else if (Array.isArray(value)) {
|
|
@@ -2718,7 +2724,7 @@ class NodeBase {
|
|
|
2718
2724
|
render(code, options) {
|
|
2719
2725
|
for (const key of this.keys) {
|
|
2720
2726
|
const value = this[key];
|
|
2721
|
-
if (value === null
|
|
2727
|
+
if (value === null)
|
|
2722
2728
|
continue;
|
|
2723
2729
|
if (Array.isArray(value)) {
|
|
2724
2730
|
for (const child of value) {
|
|
@@ -3888,7 +3894,7 @@ class GlobalVariable extends Variable {
|
|
|
3888
3894
|
}
|
|
3889
3895
|
}
|
|
3890
3896
|
|
|
3891
|
-
class Identifier
|
|
3897
|
+
class Identifier extends NodeBase {
|
|
3892
3898
|
constructor() {
|
|
3893
3899
|
super(...arguments);
|
|
3894
3900
|
this.variable = null;
|
|
@@ -3995,7 +4001,7 @@ class Identifier$1 extends NodeBase {
|
|
|
3995
4001
|
}
|
|
3996
4002
|
// In strict mode, any variable named "eval" must be the actual "eval" function
|
|
3997
4003
|
if (name === 'eval' &&
|
|
3998
|
-
renderedParentType === CallExpression &&
|
|
4004
|
+
renderedParentType === CallExpression$1 &&
|
|
3999
4005
|
isCalleeOfRenderedParent) {
|
|
4000
4006
|
code.appendRight(this.start, '0, ');
|
|
4001
4007
|
}
|
|
@@ -4107,7 +4113,7 @@ class FunctionNode extends NodeBase {
|
|
|
4107
4113
|
this.id.include();
|
|
4108
4114
|
const hasArguments = this.scope.argumentsVariable.included;
|
|
4109
4115
|
for (const param of this.params) {
|
|
4110
|
-
if (!(param instanceof Identifier
|
|
4116
|
+
if (!(param instanceof Identifier) || hasArguments) {
|
|
4111
4117
|
param.include(context, includeChildrenRecursively);
|
|
4112
4118
|
}
|
|
4113
4119
|
}
|
|
@@ -4197,7 +4203,7 @@ class ExportDefaultDeclaration extends NodeBase {
|
|
|
4197
4203
|
code.remove(this.start, declarationStart);
|
|
4198
4204
|
this.declaration.render(code, options, {
|
|
4199
4205
|
isCalleeOfRenderedParent: false,
|
|
4200
|
-
renderedParentType: ExpressionStatement
|
|
4206
|
+
renderedParentType: ExpressionStatement$1
|
|
4201
4207
|
});
|
|
4202
4208
|
if (code.original[this.end - 1] !== ';') {
|
|
4203
4209
|
code.appendLeft(this.end, ';');
|
|
@@ -4257,7 +4263,7 @@ class ExportDefaultVariable extends LocalVariable {
|
|
|
4257
4263
|
this.hasId = true;
|
|
4258
4264
|
this.originalId = declaration.id;
|
|
4259
4265
|
}
|
|
4260
|
-
else if (declaration instanceof Identifier
|
|
4266
|
+
else if (declaration instanceof Identifier) {
|
|
4261
4267
|
this.originalId = declaration;
|
|
4262
4268
|
}
|
|
4263
4269
|
}
|
|
@@ -4491,9 +4497,9 @@ class ExternalVariable extends Variable {
|
|
|
4491
4497
|
}
|
|
4492
4498
|
}
|
|
4493
4499
|
|
|
4494
|
-
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split(' ');
|
|
4495
|
-
const builtins = 'Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split(' ');
|
|
4496
|
-
const blacklisted = new Set(reservedWords.concat(builtins));
|
|
4500
|
+
const reservedWords$1 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split(' ');
|
|
4501
|
+
const builtins$1 = 'Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split(' ');
|
|
4502
|
+
const blacklisted = new Set(reservedWords$1.concat(builtins$1));
|
|
4497
4503
|
const illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
4498
4504
|
const startsWithDigit = (str) => /\d/.test(str[0]);
|
|
4499
4505
|
function isLegal(str) {
|
|
@@ -4726,7 +4732,7 @@ function getFrozen(fragment, freeze) {
|
|
|
4726
4732
|
}
|
|
4727
4733
|
const HELPER_NAMES = Object.keys(HELPER_GENERATORS);
|
|
4728
4734
|
|
|
4729
|
-
function getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, mechanism = 'return ') {
|
|
4735
|
+
function getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, mechanism = 'return ') {
|
|
4730
4736
|
const _ = compact ? '' : ' ';
|
|
4731
4737
|
const n = compact ? '' : '\n';
|
|
4732
4738
|
if (!namedExportsMode) {
|
|
@@ -4908,7 +4914,7 @@ function removeExtensionFromRelativeAmdId(id) {
|
|
|
4908
4914
|
return id[0] === '.' ? removeJsExtension(id) : id;
|
|
4909
4915
|
}
|
|
4910
4916
|
|
|
4911
|
-
const builtins
|
|
4917
|
+
const builtins = {
|
|
4912
4918
|
assert: true,
|
|
4913
4919
|
buffer: true,
|
|
4914
4920
|
console: true,
|
|
@@ -4932,7 +4938,7 @@ const builtins$1 = {
|
|
|
4932
4938
|
zlib: true
|
|
4933
4939
|
};
|
|
4934
4940
|
function warnOnBuiltins(warn, dependencies) {
|
|
4935
|
-
const externalBuiltins = dependencies.map(({ id }) => id).filter(id => id in builtins
|
|
4941
|
+
const externalBuiltins = dependencies.map(({ id }) => id).filter(id => id in builtins);
|
|
4936
4942
|
if (!externalBuiltins.length)
|
|
4937
4943
|
return;
|
|
4938
4944
|
const detail = externalBuiltins.length === 1
|
|
@@ -4972,7 +4978,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
4972
4978
|
(deps.length ? `[${deps.join(`,${_}`)}],${_}` : ``);
|
|
4973
4979
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
4974
4980
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t)}`);
|
|
4975
|
-
const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
|
|
4981
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
|
|
4976
4982
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, _, n);
|
|
4977
4983
|
if (namespaceMarkers) {
|
|
4978
4984
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -4993,13 +4999,13 @@ function cjs(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
4993
4999
|
if (namespaceMarkers) {
|
|
4994
5000
|
namespaceMarkers += n + n;
|
|
4995
5001
|
}
|
|
4996
|
-
const importBlock = getImportBlock(dependencies, compact, varOrConst, n, _);
|
|
5002
|
+
const importBlock = getImportBlock$1(dependencies, compact, varOrConst, n, _);
|
|
4997
5003
|
const interopBlock = getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t);
|
|
4998
5004
|
magicString.prepend(`${useStrict}${intro}${namespaceMarkers}${importBlock}${interopBlock}`);
|
|
4999
|
-
const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, `module.exports${_}=${_}`);
|
|
5005
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, `module.exports${_}=${_}`);
|
|
5000
5006
|
return magicString.append(`${exportBlock}${outro}`);
|
|
5001
5007
|
}
|
|
5002
|
-
function getImportBlock(dependencies, compact, varOrConst, n, _) {
|
|
5008
|
+
function getImportBlock$1(dependencies, compact, varOrConst, n, _) {
|
|
5003
5009
|
let importBlock = '';
|
|
5004
5010
|
let definingVariable = false;
|
|
5005
5011
|
for (const { id, name, reexports, imports } of dependencies) {
|
|
@@ -5026,19 +5032,19 @@ function getImportBlock(dependencies, compact, varOrConst, n, _) {
|
|
|
5026
5032
|
function es(magicString, { intro, outro, dependencies, exports, varOrConst }, { compact }) {
|
|
5027
5033
|
const _ = compact ? '' : ' ';
|
|
5028
5034
|
const n = compact ? '' : '\n';
|
|
5029
|
-
const importBlock = getImportBlock
|
|
5035
|
+
const importBlock = getImportBlock(dependencies, _);
|
|
5030
5036
|
if (importBlock.length > 0)
|
|
5031
5037
|
intro += importBlock.join(n) + n + n;
|
|
5032
5038
|
if (intro)
|
|
5033
5039
|
magicString.prepend(intro);
|
|
5034
|
-
const exportBlock = getExportBlock
|
|
5040
|
+
const exportBlock = getExportBlock(exports, _, varOrConst);
|
|
5035
5041
|
if (exportBlock.length)
|
|
5036
5042
|
magicString.append(n + n + exportBlock.join(n).trim());
|
|
5037
5043
|
if (outro)
|
|
5038
5044
|
magicString.append(outro);
|
|
5039
5045
|
return magicString.trim();
|
|
5040
5046
|
}
|
|
5041
|
-
function getImportBlock
|
|
5047
|
+
function getImportBlock(dependencies, _) {
|
|
5042
5048
|
const importBlock = [];
|
|
5043
5049
|
for (const { id, reexports, imports, name } of dependencies) {
|
|
5044
5050
|
if (!reexports && !imports) {
|
|
@@ -5122,7 +5128,7 @@ function getImportBlock$1(dependencies, _) {
|
|
|
5122
5128
|
}
|
|
5123
5129
|
return importBlock;
|
|
5124
5130
|
}
|
|
5125
|
-
function getExportBlock
|
|
5131
|
+
function getExportBlock(exports, _, varOrConst) {
|
|
5126
5132
|
const exportBlock = [];
|
|
5127
5133
|
const exportDeclaration = [];
|
|
5128
5134
|
for (const specifier of exports) {
|
|
@@ -5179,7 +5185,11 @@ function getCodeFrame(source, line, column) {
|
|
|
5179
5185
|
}
|
|
5180
5186
|
|
|
5181
5187
|
function sanitizeFileName(name) {
|
|
5182
|
-
|
|
5188
|
+
const match = /^[a-z]:/i.exec(name);
|
|
5189
|
+
const driveLetter = match ? match[0] : "";
|
|
5190
|
+
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
|
|
5191
|
+
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
|
|
5192
|
+
return driveLetter + name.substr(driveLetter.length).replace(/[\0?*:]/g, '_');
|
|
5183
5193
|
}
|
|
5184
5194
|
|
|
5185
5195
|
function getAliasName(id) {
|
|
@@ -5638,7 +5648,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
5638
5648
|
if (hasExports && !extend && namedExportsMode) {
|
|
5639
5649
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
5640
5650
|
}
|
|
5641
|
-
const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
|
|
5651
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
|
|
5642
5652
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, _, n);
|
|
5643
5653
|
if (namespaceMarkers) {
|
|
5644
5654
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -5879,7 +5889,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
5879
5889
|
`}(${globalArg}(function${_}(${factoryArgs.join(', ')})${_}{${useStrict}${n}`;
|
|
5880
5890
|
const wrapperOutro = n + n + '})));';
|
|
5881
5891
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t)}`);
|
|
5882
|
-
const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
|
|
5892
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
|
|
5883
5893
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, _, n);
|
|
5884
5894
|
if (namespaceMarkers) {
|
|
5885
5895
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -6009,11 +6019,11 @@ class BlockScope extends ChildScope {
|
|
|
6009
6019
|
}
|
|
6010
6020
|
}
|
|
6011
6021
|
|
|
6012
|
-
class ExpressionStatement
|
|
6022
|
+
class ExpressionStatement extends NodeBase {
|
|
6013
6023
|
initialise() {
|
|
6014
6024
|
if (this.directive &&
|
|
6015
6025
|
this.directive !== 'use strict' &&
|
|
6016
|
-
this.parent.type === Program) {
|
|
6026
|
+
this.parent.type === Program$1) {
|
|
6017
6027
|
this.context.warn(
|
|
6018
6028
|
// This is necessary, because either way (deleting or not) can lead to errors.
|
|
6019
6029
|
{
|
|
@@ -6029,19 +6039,19 @@ class ExpressionStatement$1 extends NodeBase {
|
|
|
6029
6039
|
}
|
|
6030
6040
|
shouldBeIncluded(context) {
|
|
6031
6041
|
if (this.directive && this.directive !== 'use strict')
|
|
6032
|
-
return this.parent.type !== Program;
|
|
6042
|
+
return this.parent.type !== Program$1;
|
|
6033
6043
|
return super.shouldBeIncluded(context);
|
|
6034
6044
|
}
|
|
6035
6045
|
}
|
|
6036
6046
|
|
|
6037
|
-
class BlockStatement
|
|
6047
|
+
class BlockStatement extends NodeBase {
|
|
6038
6048
|
constructor() {
|
|
6039
6049
|
super(...arguments);
|
|
6040
6050
|
this.directlyIncluded = false;
|
|
6041
6051
|
}
|
|
6042
6052
|
addImplicitReturnExpressionToScope() {
|
|
6043
6053
|
const lastStatement = this.body[this.body.length - 1];
|
|
6044
|
-
if (!lastStatement || lastStatement.type !== ReturnStatement) {
|
|
6054
|
+
if (!lastStatement || lastStatement.type !== ReturnStatement$1) {
|
|
6045
6055
|
this.scope.addReturnExpression(UNKNOWN_EXPRESSION);
|
|
6046
6056
|
}
|
|
6047
6057
|
}
|
|
@@ -6076,7 +6086,7 @@ class BlockStatement$1 extends NodeBase {
|
|
|
6076
6086
|
initialise() {
|
|
6077
6087
|
const firstBodyStatement = this.body[0];
|
|
6078
6088
|
this.deoptimizeBody =
|
|
6079
|
-
firstBodyStatement instanceof ExpressionStatement
|
|
6089
|
+
firstBodyStatement instanceof ExpressionStatement &&
|
|
6080
6090
|
firstBodyStatement.directive === 'use asm';
|
|
6081
6091
|
}
|
|
6082
6092
|
render(code, options) {
|
|
@@ -6089,7 +6099,7 @@ class BlockStatement$1 extends NodeBase {
|
|
|
6089
6099
|
}
|
|
6090
6100
|
}
|
|
6091
6101
|
|
|
6092
|
-
class ArrowFunctionExpression
|
|
6102
|
+
class ArrowFunctionExpression extends NodeBase {
|
|
6093
6103
|
createScope(parentScope) {
|
|
6094
6104
|
this.scope = new ReturnValueScope(parentScope, this.context);
|
|
6095
6105
|
}
|
|
@@ -6135,7 +6145,7 @@ class ArrowFunctionExpression$1 extends NodeBase {
|
|
|
6135
6145
|
include(context, includeChildrenRecursively) {
|
|
6136
6146
|
this.included = true;
|
|
6137
6147
|
for (const param of this.params) {
|
|
6138
|
-
if (!(param instanceof Identifier
|
|
6148
|
+
if (!(param instanceof Identifier)) {
|
|
6139
6149
|
param.include(context, includeChildrenRecursively);
|
|
6140
6150
|
}
|
|
6141
6151
|
}
|
|
@@ -6149,7 +6159,7 @@ class ArrowFunctionExpression$1 extends NodeBase {
|
|
|
6149
6159
|
}
|
|
6150
6160
|
initialise() {
|
|
6151
6161
|
this.scope.addParameterVariables(this.params.map(param => param.declare('parameter', UNKNOWN_EXPRESSION)), this.params[this.params.length - 1] instanceof RestElement);
|
|
6152
|
-
if (this.body instanceof BlockStatement
|
|
6162
|
+
if (this.body instanceof BlockStatement) {
|
|
6153
6163
|
this.body.addImplicitReturnExpressionToScope();
|
|
6154
6164
|
}
|
|
6155
6165
|
else {
|
|
@@ -6157,13 +6167,13 @@ class ArrowFunctionExpression$1 extends NodeBase {
|
|
|
6157
6167
|
}
|
|
6158
6168
|
}
|
|
6159
6169
|
parseNode(esTreeNode) {
|
|
6160
|
-
if (esTreeNode.body.type === BlockStatement) {
|
|
6170
|
+
if (esTreeNode.body.type === BlockStatement$1) {
|
|
6161
6171
|
this.body = new this.context.nodeConstructors.BlockStatement(esTreeNode.body, this, this.scope.hoistedBodyVarScope);
|
|
6162
6172
|
}
|
|
6163
6173
|
super.parseNode(esTreeNode);
|
|
6164
6174
|
}
|
|
6165
6175
|
}
|
|
6166
|
-
ArrowFunctionExpression
|
|
6176
|
+
ArrowFunctionExpression.prototype.preventChildBlockScope = true;
|
|
6167
6177
|
|
|
6168
6178
|
class AssignmentExpression extends NodeBase {
|
|
6169
6179
|
constructor() {
|
|
@@ -6272,7 +6282,7 @@ class AwaitExpression extends NodeBase {
|
|
|
6272
6282
|
checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
|
|
6273
6283
|
let parent = this.parent;
|
|
6274
6284
|
do {
|
|
6275
|
-
if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression
|
|
6285
|
+
if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression)
|
|
6276
6286
|
break checkTopLevelAwait;
|
|
6277
6287
|
} while ((parent = parent.parent));
|
|
6278
6288
|
this.context.usesTopLevelAwait = true;
|
|
@@ -6326,7 +6336,7 @@ class BinaryExpression extends NodeBase {
|
|
|
6326
6336
|
hasEffects(context) {
|
|
6327
6337
|
// support some implicit type coercion runtime errors
|
|
6328
6338
|
if (this.operator === '+' &&
|
|
6329
|
-
this.parent instanceof ExpressionStatement
|
|
6339
|
+
this.parent instanceof ExpressionStatement &&
|
|
6330
6340
|
this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) === '')
|
|
6331
6341
|
return true;
|
|
6332
6342
|
return super.hasEffects(context);
|
|
@@ -6423,7 +6433,7 @@ function getPathIfNotComputed(memberExpression) {
|
|
|
6423
6433
|
const nextPathKey = memberExpression.propertyKey;
|
|
6424
6434
|
const object = memberExpression.object;
|
|
6425
6435
|
if (typeof nextPathKey === 'string') {
|
|
6426
|
-
if (object instanceof Identifier
|
|
6436
|
+
if (object instanceof Identifier) {
|
|
6427
6437
|
return [
|
|
6428
6438
|
{ key: object.name, pos: object.start },
|
|
6429
6439
|
{ key: nextPathKey, pos: memberExpression.property.start }
|
|
@@ -6529,10 +6539,11 @@ class MemberExpression extends NodeBase {
|
|
|
6529
6539
|
return this.object.getReturnExpressionWhenCalledAtPath([this.getPropertyKey(), ...path], recursionTracker, origin);
|
|
6530
6540
|
}
|
|
6531
6541
|
hasEffects(context) {
|
|
6532
|
-
|
|
6542
|
+
const propertyReadSideEffects = this.context.options.treeshake.propertyReadSideEffects;
|
|
6543
|
+
return (propertyReadSideEffects === 'always' ||
|
|
6544
|
+
this.property.hasEffects(context) ||
|
|
6533
6545
|
this.object.hasEffects(context) ||
|
|
6534
|
-
(this.
|
|
6535
|
-
this.object.hasEffectsWhenAccessedAtPath([this.propertyKey], context)));
|
|
6546
|
+
(propertyReadSideEffects && this.object.hasEffectsWhenAccessedAtPath([this.propertyKey], context)));
|
|
6536
6547
|
}
|
|
6537
6548
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
6538
6549
|
if (path.length === 0)
|
|
@@ -6576,7 +6587,7 @@ class MemberExpression extends NodeBase {
|
|
|
6576
6587
|
this.propertyKey = getResolvablePropertyKey(this);
|
|
6577
6588
|
}
|
|
6578
6589
|
render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
|
|
6579
|
-
const isCalleeOfDifferentParent = renderedParentType === CallExpression && isCalleeOfRenderedParent;
|
|
6590
|
+
const isCalleeOfDifferentParent = renderedParentType === CallExpression$1 && isCalleeOfRenderedParent;
|
|
6580
6591
|
if (this.variable || this.replacement) {
|
|
6581
6592
|
let replacement = this.variable ? this.variable.getName() : this.replacement;
|
|
6582
6593
|
if (isCalleeOfDifferentParent)
|
|
@@ -6596,7 +6607,7 @@ class MemberExpression extends NodeBase {
|
|
|
6596
6607
|
}
|
|
6597
6608
|
}
|
|
6598
6609
|
disallowNamespaceReassignment() {
|
|
6599
|
-
if (this.object instanceof Identifier
|
|
6610
|
+
if (this.object instanceof Identifier) {
|
|
6600
6611
|
const variable = this.scope.findVariable(this.object.name);
|
|
6601
6612
|
if (variable.isNamespace) {
|
|
6602
6613
|
if (this.variable) {
|
|
@@ -6644,7 +6655,7 @@ class MemberExpression extends NodeBase {
|
|
|
6644
6655
|
}
|
|
6645
6656
|
}
|
|
6646
6657
|
|
|
6647
|
-
class CallExpression
|
|
6658
|
+
class CallExpression extends NodeBase {
|
|
6648
6659
|
constructor() {
|
|
6649
6660
|
super(...arguments);
|
|
6650
6661
|
this.expressionsToBeDeoptimized = [];
|
|
@@ -6653,7 +6664,7 @@ class CallExpression$1 extends NodeBase {
|
|
|
6653
6664
|
}
|
|
6654
6665
|
bind() {
|
|
6655
6666
|
super.bind();
|
|
6656
|
-
if (this.callee instanceof Identifier
|
|
6667
|
+
if (this.callee instanceof Identifier) {
|
|
6657
6668
|
const variable = this.scope.findVariable(this.callee.name);
|
|
6658
6669
|
if (variable.isNamespace) {
|
|
6659
6670
|
this.context.warn({
|
|
@@ -6743,12 +6754,12 @@ class CallExpression$1 extends NodeBase {
|
|
|
6743
6754
|
return value;
|
|
6744
6755
|
}
|
|
6745
6756
|
hasEffects(context) {
|
|
6757
|
+
var _a;
|
|
6746
6758
|
for (const argument of this.arguments) {
|
|
6747
6759
|
if (argument.hasEffects(context))
|
|
6748
6760
|
return true;
|
|
6749
6761
|
}
|
|
6750
|
-
if (this.context.options.treeshake.annotations &&
|
|
6751
|
-
this.annotatedPure)
|
|
6762
|
+
if (this.context.options.treeshake.annotations && ((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
|
|
6752
6763
|
return false;
|
|
6753
6764
|
return (this.callee.hasEffects(context) ||
|
|
6754
6765
|
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
@@ -6784,7 +6795,7 @@ class CallExpression$1 extends NodeBase {
|
|
|
6784
6795
|
if (includeChildrenRecursively) {
|
|
6785
6796
|
super.include(context, includeChildrenRecursively);
|
|
6786
6797
|
if (includeChildrenRecursively === INCLUDE_PARAMETERS &&
|
|
6787
|
-
this.callee instanceof Identifier
|
|
6798
|
+
this.callee instanceof Identifier &&
|
|
6788
6799
|
this.callee.variable) {
|
|
6789
6800
|
this.callee.variable.markCalledFromTryStatement();
|
|
6790
6801
|
}
|
|
@@ -6909,7 +6920,7 @@ class ClassExpression extends ClassNode {
|
|
|
6909
6920
|
render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
6910
6921
|
super.render(code, options);
|
|
6911
6922
|
const surroundingElement = renderedParentType || renderedSurroundingElement;
|
|
6912
|
-
if (surroundingElement === ExpressionStatement) {
|
|
6923
|
+
if (surroundingElement === ExpressionStatement$1) {
|
|
6913
6924
|
code.appendRight(this.start, '(');
|
|
6914
6925
|
code.prependLeft(this.end, ')');
|
|
6915
6926
|
}
|
|
@@ -7323,7 +7334,7 @@ class FunctionExpression extends FunctionNode {
|
|
|
7323
7334
|
render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
7324
7335
|
super.render(code, options);
|
|
7325
7336
|
const surroundingElement = renderedParentType || renderedSurroundingElement;
|
|
7326
|
-
if (surroundingElement === ExpressionStatement) {
|
|
7337
|
+
if (surroundingElement === ExpressionStatement$1) {
|
|
7327
7338
|
code.appendRight(this.start, '(');
|
|
7328
7339
|
code.prependLeft(this.end, ')');
|
|
7329
7340
|
}
|
|
@@ -7493,7 +7504,7 @@ class IfStatement extends NodeBase {
|
|
|
7493
7504
|
.join(', ');
|
|
7494
7505
|
if (hoistedVars) {
|
|
7495
7506
|
const parentType = this.parent.type;
|
|
7496
|
-
const needsBraces = parentType !== Program && parentType !== BlockStatement;
|
|
7507
|
+
const needsBraces = parentType !== Program$1 && parentType !== BlockStatement$1;
|
|
7497
7508
|
code.prependRight(this.start, `${needsBraces ? '{ ' : ''}var ${hoistedVars}; `);
|
|
7498
7509
|
if (needsBraces) {
|
|
7499
7510
|
code.appendLeft(this.end, ` }`);
|
|
@@ -7506,7 +7517,7 @@ class IfStatement extends NodeBase {
|
|
|
7506
7517
|
if (currentParent instanceof IfStatement && currentParent.alternate) {
|
|
7507
7518
|
return true;
|
|
7508
7519
|
}
|
|
7509
|
-
if (currentParent instanceof BlockStatement
|
|
7520
|
+
if (currentParent instanceof BlockStatement) {
|
|
7510
7521
|
return false;
|
|
7511
7522
|
}
|
|
7512
7523
|
currentParent = currentParent.parent;
|
|
@@ -7529,7 +7540,7 @@ class ImportDeclaration extends NodeBase {
|
|
|
7529
7540
|
}
|
|
7530
7541
|
ImportDeclaration.prototype.needsBoundaries = true;
|
|
7531
7542
|
|
|
7532
|
-
class ImportDefaultSpecifier
|
|
7543
|
+
class ImportDefaultSpecifier extends NodeBase {
|
|
7533
7544
|
}
|
|
7534
7545
|
|
|
7535
7546
|
class ImportExpression extends NodeBase {
|
|
@@ -7671,7 +7682,7 @@ const accessedImportGlobals = {
|
|
|
7671
7682
|
system: ['module']
|
|
7672
7683
|
};
|
|
7673
7684
|
|
|
7674
|
-
class ImportNamespaceSpecifier
|
|
7685
|
+
class ImportNamespaceSpecifier extends NodeBase {
|
|
7675
7686
|
}
|
|
7676
7687
|
|
|
7677
7688
|
class ImportSpecifier extends NodeBase {
|
|
@@ -8024,7 +8035,7 @@ const importMetaMechanisms = {
|
|
|
8024
8035
|
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __filename`, `(require('u' + 'rl').URL)`)} : ${getUrlFromDocument(chunkId)})`)
|
|
8025
8036
|
};
|
|
8026
8037
|
|
|
8027
|
-
class NewExpression
|
|
8038
|
+
class NewExpression extends NodeBase {
|
|
8028
8039
|
bind() {
|
|
8029
8040
|
super.bind();
|
|
8030
8041
|
for (const argument of this.arguments) {
|
|
@@ -8033,12 +8044,12 @@ class NewExpression$1 extends NodeBase {
|
|
|
8033
8044
|
}
|
|
8034
8045
|
}
|
|
8035
8046
|
hasEffects(context) {
|
|
8047
|
+
var _a;
|
|
8036
8048
|
for (const argument of this.arguments) {
|
|
8037
8049
|
if (argument.hasEffects(context))
|
|
8038
8050
|
return true;
|
|
8039
8051
|
}
|
|
8040
|
-
if (this.context.options.treeshake.annotations &&
|
|
8041
|
-
this.annotatedPure)
|
|
8052
|
+
if (this.context.options.treeshake.annotations && ((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
|
|
8042
8053
|
return false;
|
|
8043
8054
|
return (this.callee.hasEffects(context) ||
|
|
8044
8055
|
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
@@ -8223,8 +8234,8 @@ class ObjectExpression extends NodeBase {
|
|
|
8223
8234
|
render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
8224
8235
|
super.render(code, options);
|
|
8225
8236
|
const surroundingElement = renderedParentType || renderedSurroundingElement;
|
|
8226
|
-
if (surroundingElement === ExpressionStatement ||
|
|
8227
|
-
surroundingElement === ArrowFunctionExpression) {
|
|
8237
|
+
if (surroundingElement === ExpressionStatement$1 ||
|
|
8238
|
+
surroundingElement === ArrowFunctionExpression$1) {
|
|
8228
8239
|
code.appendRight(this.start, '(');
|
|
8229
8240
|
code.prependLeft(this.end, ')');
|
|
8230
8241
|
}
|
|
@@ -8267,7 +8278,7 @@ class ObjectExpression extends NodeBase {
|
|
|
8267
8278
|
}
|
|
8268
8279
|
key = String(keyValue);
|
|
8269
8280
|
}
|
|
8270
|
-
else if (property.key instanceof Identifier
|
|
8281
|
+
else if (property.key instanceof Identifier) {
|
|
8271
8282
|
key = property.key.name;
|
|
8272
8283
|
}
|
|
8273
8284
|
else {
|
|
@@ -8299,7 +8310,7 @@ class ObjectExpression extends NodeBase {
|
|
|
8299
8310
|
class ObjectPattern extends NodeBase {
|
|
8300
8311
|
addExportedVariables(variables, exportNamesByVariable) {
|
|
8301
8312
|
for (const property of this.properties) {
|
|
8302
|
-
if (property.type === Property) {
|
|
8313
|
+
if (property.type === Property$1) {
|
|
8303
8314
|
property.value.addExportedVariables(variables, exportNamesByVariable);
|
|
8304
8315
|
}
|
|
8305
8316
|
else {
|
|
@@ -8335,7 +8346,7 @@ class ObjectPattern extends NodeBase {
|
|
|
8335
8346
|
class PrivateIdentifier extends NodeBase {
|
|
8336
8347
|
}
|
|
8337
8348
|
|
|
8338
|
-
class Program
|
|
8349
|
+
class Program extends NodeBase {
|
|
8339
8350
|
constructor() {
|
|
8340
8351
|
super(...arguments);
|
|
8341
8352
|
this.hasCachedEffect = false;
|
|
@@ -8369,7 +8380,7 @@ class Program$1 extends NodeBase {
|
|
|
8369
8380
|
}
|
|
8370
8381
|
}
|
|
8371
8382
|
|
|
8372
|
-
class Property
|
|
8383
|
+
class Property extends NodeBase {
|
|
8373
8384
|
constructor() {
|
|
8374
8385
|
super(...arguments);
|
|
8375
8386
|
this.declarationInit = null;
|
|
@@ -8413,7 +8424,10 @@ class Property$1 extends NodeBase {
|
|
|
8413
8424
|
return this.value.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
|
|
8414
8425
|
}
|
|
8415
8426
|
hasEffects(context) {
|
|
8416
|
-
|
|
8427
|
+
const propertyReadSideEffects = this.context.options.treeshake.propertyReadSideEffects;
|
|
8428
|
+
return this.parent.type === 'ObjectPattern' && propertyReadSideEffects === 'always' ||
|
|
8429
|
+
this.key.hasEffects(context) ||
|
|
8430
|
+
this.value.hasEffects(context);
|
|
8417
8431
|
}
|
|
8418
8432
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
8419
8433
|
if (this.kind === 'get') {
|
|
@@ -8483,7 +8497,7 @@ class PropertyDefinition extends NodeBase {
|
|
|
8483
8497
|
}
|
|
8484
8498
|
}
|
|
8485
8499
|
|
|
8486
|
-
class ReturnStatement
|
|
8500
|
+
class ReturnStatement extends NodeBase {
|
|
8487
8501
|
hasEffects(context) {
|
|
8488
8502
|
if (!context.ignore.returnAwaitYield ||
|
|
8489
8503
|
(this.argument !== null && this.argument.hasEffects(context)))
|
|
@@ -8686,7 +8700,7 @@ class SwitchStatement extends NodeBase {
|
|
|
8686
8700
|
class TaggedTemplateExpression extends NodeBase {
|
|
8687
8701
|
bind() {
|
|
8688
8702
|
super.bind();
|
|
8689
|
-
if (this.tag.type === Identifier) {
|
|
8703
|
+
if (this.tag.type === Identifier$1) {
|
|
8690
8704
|
const name = this.tag.name;
|
|
8691
8705
|
const variable = this.scope.findVariable(name);
|
|
8692
8706
|
if (variable.isNamespace) {
|
|
@@ -8891,7 +8905,7 @@ class UnaryExpression extends NodeBase {
|
|
|
8891
8905
|
return unaryOperators[this.operator](argumentValue);
|
|
8892
8906
|
}
|
|
8893
8907
|
hasEffects(context) {
|
|
8894
|
-
if (this.operator === 'typeof' && this.argument instanceof Identifier
|
|
8908
|
+
if (this.operator === 'typeof' && this.argument instanceof Identifier)
|
|
8895
8909
|
return false;
|
|
8896
8910
|
return (this.argument.hasEffects(context) ||
|
|
8897
8911
|
(this.operator === 'delete' &&
|
|
@@ -8918,7 +8932,7 @@ class UpdateExpression extends NodeBase {
|
|
|
8918
8932
|
bind() {
|
|
8919
8933
|
super.bind();
|
|
8920
8934
|
this.argument.deoptimizePath(EMPTY_PATH);
|
|
8921
|
-
if (this.argument instanceof Identifier
|
|
8935
|
+
if (this.argument instanceof Identifier) {
|
|
8922
8936
|
const variable = this.scope.findVariable(this.argument.name);
|
|
8923
8937
|
variable.isReassigned = true;
|
|
8924
8938
|
}
|
|
@@ -8974,7 +8988,7 @@ function areAllDeclarationsIncludedAndNotExported(declarations, exportNamesByVar
|
|
|
8974
8988
|
for (const declarator of declarations) {
|
|
8975
8989
|
if (!declarator.id.included)
|
|
8976
8990
|
return false;
|
|
8977
|
-
if (declarator.id.type === Identifier) {
|
|
8991
|
+
if (declarator.id.type === Identifier$1) {
|
|
8978
8992
|
if (exportNamesByVariable.has(declarator.id.variable))
|
|
8979
8993
|
return false;
|
|
8980
8994
|
}
|
|
@@ -9080,7 +9094,7 @@ class VariableDeclaration extends NodeBase {
|
|
|
9080
9094
|
leadingString = '';
|
|
9081
9095
|
nextSeparatorString = '';
|
|
9082
9096
|
if (!node.id.included ||
|
|
9083
|
-
(node.id instanceof Identifier
|
|
9097
|
+
(node.id instanceof Identifier &&
|
|
9084
9098
|
isReassignedExportsMember(node.id.variable, options.exportNamesByVariable))) {
|
|
9085
9099
|
if (hasRenderedContent) {
|
|
9086
9100
|
separatorString += ';';
|
|
@@ -9089,7 +9103,7 @@ class VariableDeclaration extends NodeBase {
|
|
|
9089
9103
|
}
|
|
9090
9104
|
else {
|
|
9091
9105
|
if (options.format === 'system' && node.init !== null) {
|
|
9092
|
-
if (node.id.type !== Identifier) {
|
|
9106
|
+
if (node.id.type !== Identifier$1) {
|
|
9093
9107
|
node.id.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
|
|
9094
9108
|
}
|
|
9095
9109
|
else {
|
|
@@ -9162,9 +9176,9 @@ class VariableDeclarator extends NodeBase {
|
|
|
9162
9176
|
code.remove(this.start, findNonWhiteSpace(code.original, operatorPos + 1));
|
|
9163
9177
|
}
|
|
9164
9178
|
if (this.init) {
|
|
9165
|
-
this.init.render(code, options, renderId ? BLANK : { renderedParentType: ExpressionStatement });
|
|
9179
|
+
this.init.render(code, options, renderId ? BLANK : { renderedParentType: ExpressionStatement$1 });
|
|
9166
9180
|
}
|
|
9167
|
-
else if (this.id instanceof Identifier
|
|
9181
|
+
else if (this.id instanceof Identifier &&
|
|
9168
9182
|
isReassignedExportsMember(this.id.variable, options.exportNamesByVariable)) {
|
|
9169
9183
|
const _ = options.compact ? '' : ' ';
|
|
9170
9184
|
code.appendLeft(this.end, `${_}=${_}void 0`);
|
|
@@ -9219,14 +9233,14 @@ class YieldExpression extends NodeBase {
|
|
|
9219
9233
|
const nodeConstructors = {
|
|
9220
9234
|
ArrayExpression,
|
|
9221
9235
|
ArrayPattern,
|
|
9222
|
-
ArrowFunctionExpression
|
|
9236
|
+
ArrowFunctionExpression,
|
|
9223
9237
|
AssignmentExpression,
|
|
9224
9238
|
AssignmentPattern,
|
|
9225
9239
|
AwaitExpression,
|
|
9226
9240
|
BinaryExpression,
|
|
9227
|
-
BlockStatement
|
|
9241
|
+
BlockStatement,
|
|
9228
9242
|
BreakStatement,
|
|
9229
|
-
CallExpression
|
|
9243
|
+
CallExpression,
|
|
9230
9244
|
CatchClause,
|
|
9231
9245
|
ChainExpression,
|
|
9232
9246
|
ClassBody,
|
|
@@ -9240,18 +9254,18 @@ const nodeConstructors = {
|
|
|
9240
9254
|
ExportDefaultDeclaration,
|
|
9241
9255
|
ExportNamedDeclaration,
|
|
9242
9256
|
ExportSpecifier,
|
|
9243
|
-
ExpressionStatement
|
|
9257
|
+
ExpressionStatement,
|
|
9244
9258
|
ForInStatement,
|
|
9245
9259
|
ForOfStatement,
|
|
9246
9260
|
ForStatement,
|
|
9247
9261
|
FunctionDeclaration,
|
|
9248
9262
|
FunctionExpression,
|
|
9249
|
-
Identifier
|
|
9263
|
+
Identifier,
|
|
9250
9264
|
IfStatement,
|
|
9251
9265
|
ImportDeclaration,
|
|
9252
|
-
ImportDefaultSpecifier
|
|
9266
|
+
ImportDefaultSpecifier,
|
|
9253
9267
|
ImportExpression,
|
|
9254
|
-
ImportNamespaceSpecifier
|
|
9268
|
+
ImportNamespaceSpecifier,
|
|
9255
9269
|
ImportSpecifier,
|
|
9256
9270
|
LabeledStatement,
|
|
9257
9271
|
Literal,
|
|
@@ -9259,15 +9273,15 @@ const nodeConstructors = {
|
|
|
9259
9273
|
MemberExpression,
|
|
9260
9274
|
MetaProperty,
|
|
9261
9275
|
MethodDefinition,
|
|
9262
|
-
NewExpression
|
|
9276
|
+
NewExpression,
|
|
9263
9277
|
ObjectExpression,
|
|
9264
9278
|
ObjectPattern,
|
|
9265
9279
|
PrivateIdentifier,
|
|
9266
|
-
Program
|
|
9267
|
-
Property
|
|
9280
|
+
Program,
|
|
9281
|
+
Property,
|
|
9268
9282
|
PropertyDefinition,
|
|
9269
9283
|
RestElement,
|
|
9270
|
-
ReturnStatement
|
|
9284
|
+
ReturnStatement,
|
|
9271
9285
|
SequenceExpression,
|
|
9272
9286
|
SpreadElement,
|
|
9273
9287
|
Super,
|
|
@@ -9322,313 +9336,6 @@ function getOriginalLocation(sourcemapChain, location) {
|
|
|
9322
9336
|
return location;
|
|
9323
9337
|
}
|
|
9324
9338
|
|
|
9325
|
-
// AST walker module for Mozilla Parser API compatible trees
|
|
9326
|
-
|
|
9327
|
-
function skipThrough(node, st, c) { c(node, st); }
|
|
9328
|
-
function ignore(_node, _st, _c) {}
|
|
9329
|
-
|
|
9330
|
-
// Node walkers.
|
|
9331
|
-
|
|
9332
|
-
var base$1 = {};
|
|
9333
|
-
|
|
9334
|
-
base$1.Program = base$1.BlockStatement = function (node, st, c) {
|
|
9335
|
-
for (var i = 0, list = node.body; i < list.length; i += 1)
|
|
9336
|
-
{
|
|
9337
|
-
var stmt = list[i];
|
|
9338
|
-
|
|
9339
|
-
c(stmt, st, "Statement");
|
|
9340
|
-
}
|
|
9341
|
-
};
|
|
9342
|
-
base$1.Statement = skipThrough;
|
|
9343
|
-
base$1.EmptyStatement = ignore;
|
|
9344
|
-
base$1.ExpressionStatement = base$1.ParenthesizedExpression = base$1.ChainExpression =
|
|
9345
|
-
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
|
9346
|
-
base$1.IfStatement = function (node, st, c) {
|
|
9347
|
-
c(node.test, st, "Expression");
|
|
9348
|
-
c(node.consequent, st, "Statement");
|
|
9349
|
-
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
|
9350
|
-
};
|
|
9351
|
-
base$1.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
|
9352
|
-
base$1.BreakStatement = base$1.ContinueStatement = ignore;
|
|
9353
|
-
base$1.WithStatement = function (node, st, c) {
|
|
9354
|
-
c(node.object, st, "Expression");
|
|
9355
|
-
c(node.body, st, "Statement");
|
|
9356
|
-
};
|
|
9357
|
-
base$1.SwitchStatement = function (node, st, c) {
|
|
9358
|
-
c(node.discriminant, st, "Expression");
|
|
9359
|
-
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
|
|
9360
|
-
var cs = list$1[i$1];
|
|
9361
|
-
|
|
9362
|
-
if (cs.test) { c(cs.test, st, "Expression"); }
|
|
9363
|
-
for (var i = 0, list = cs.consequent; i < list.length; i += 1)
|
|
9364
|
-
{
|
|
9365
|
-
var cons = list[i];
|
|
9366
|
-
|
|
9367
|
-
c(cons, st, "Statement");
|
|
9368
|
-
}
|
|
9369
|
-
}
|
|
9370
|
-
};
|
|
9371
|
-
base$1.SwitchCase = function (node, st, c) {
|
|
9372
|
-
if (node.test) { c(node.test, st, "Expression"); }
|
|
9373
|
-
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
|
9374
|
-
{
|
|
9375
|
-
var cons = list[i];
|
|
9376
|
-
|
|
9377
|
-
c(cons, st, "Statement");
|
|
9378
|
-
}
|
|
9379
|
-
};
|
|
9380
|
-
base$1.ReturnStatement = base$1.YieldExpression = base$1.AwaitExpression = function (node, st, c) {
|
|
9381
|
-
if (node.argument) { c(node.argument, st, "Expression"); }
|
|
9382
|
-
};
|
|
9383
|
-
base$1.ThrowStatement = base$1.SpreadElement =
|
|
9384
|
-
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
|
9385
|
-
base$1.TryStatement = function (node, st, c) {
|
|
9386
|
-
c(node.block, st, "Statement");
|
|
9387
|
-
if (node.handler) { c(node.handler, st); }
|
|
9388
|
-
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
|
9389
|
-
};
|
|
9390
|
-
base$1.CatchClause = function (node, st, c) {
|
|
9391
|
-
if (node.param) { c(node.param, st, "Pattern"); }
|
|
9392
|
-
c(node.body, st, "Statement");
|
|
9393
|
-
};
|
|
9394
|
-
base$1.WhileStatement = base$1.DoWhileStatement = function (node, st, c) {
|
|
9395
|
-
c(node.test, st, "Expression");
|
|
9396
|
-
c(node.body, st, "Statement");
|
|
9397
|
-
};
|
|
9398
|
-
base$1.ForStatement = function (node, st, c) {
|
|
9399
|
-
if (node.init) { c(node.init, st, "ForInit"); }
|
|
9400
|
-
if (node.test) { c(node.test, st, "Expression"); }
|
|
9401
|
-
if (node.update) { c(node.update, st, "Expression"); }
|
|
9402
|
-
c(node.body, st, "Statement");
|
|
9403
|
-
};
|
|
9404
|
-
base$1.ForInStatement = base$1.ForOfStatement = function (node, st, c) {
|
|
9405
|
-
c(node.left, st, "ForInit");
|
|
9406
|
-
c(node.right, st, "Expression");
|
|
9407
|
-
c(node.body, st, "Statement");
|
|
9408
|
-
};
|
|
9409
|
-
base$1.ForInit = function (node, st, c) {
|
|
9410
|
-
if (node.type === "VariableDeclaration") { c(node, st); }
|
|
9411
|
-
else { c(node, st, "Expression"); }
|
|
9412
|
-
};
|
|
9413
|
-
base$1.DebuggerStatement = ignore;
|
|
9414
|
-
|
|
9415
|
-
base$1.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
|
9416
|
-
base$1.VariableDeclaration = function (node, st, c) {
|
|
9417
|
-
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
|
9418
|
-
{
|
|
9419
|
-
var decl = list[i];
|
|
9420
|
-
|
|
9421
|
-
c(decl, st);
|
|
9422
|
-
}
|
|
9423
|
-
};
|
|
9424
|
-
base$1.VariableDeclarator = function (node, st, c) {
|
|
9425
|
-
c(node.id, st, "Pattern");
|
|
9426
|
-
if (node.init) { c(node.init, st, "Expression"); }
|
|
9427
|
-
};
|
|
9428
|
-
|
|
9429
|
-
base$1.Function = function (node, st, c) {
|
|
9430
|
-
if (node.id) { c(node.id, st, "Pattern"); }
|
|
9431
|
-
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
9432
|
-
{
|
|
9433
|
-
var param = list[i];
|
|
9434
|
-
|
|
9435
|
-
c(param, st, "Pattern");
|
|
9436
|
-
}
|
|
9437
|
-
c(node.body, st, node.expression ? "Expression" : "Statement");
|
|
9438
|
-
};
|
|
9439
|
-
|
|
9440
|
-
base$1.Pattern = function (node, st, c) {
|
|
9441
|
-
if (node.type === "Identifier")
|
|
9442
|
-
{ c(node, st, "VariablePattern"); }
|
|
9443
|
-
else if (node.type === "MemberExpression")
|
|
9444
|
-
{ c(node, st, "MemberPattern"); }
|
|
9445
|
-
else
|
|
9446
|
-
{ c(node, st); }
|
|
9447
|
-
};
|
|
9448
|
-
base$1.VariablePattern = ignore;
|
|
9449
|
-
base$1.MemberPattern = skipThrough;
|
|
9450
|
-
base$1.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
|
9451
|
-
base$1.ArrayPattern = function (node, st, c) {
|
|
9452
|
-
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
|
9453
|
-
var elt = list[i];
|
|
9454
|
-
|
|
9455
|
-
if (elt) { c(elt, st, "Pattern"); }
|
|
9456
|
-
}
|
|
9457
|
-
};
|
|
9458
|
-
base$1.ObjectPattern = function (node, st, c) {
|
|
9459
|
-
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
|
9460
|
-
var prop = list[i];
|
|
9461
|
-
|
|
9462
|
-
if (prop.type === "Property") {
|
|
9463
|
-
if (prop.computed) { c(prop.key, st, "Expression"); }
|
|
9464
|
-
c(prop.value, st, "Pattern");
|
|
9465
|
-
} else if (prop.type === "RestElement") {
|
|
9466
|
-
c(prop.argument, st, "Pattern");
|
|
9467
|
-
}
|
|
9468
|
-
}
|
|
9469
|
-
};
|
|
9470
|
-
|
|
9471
|
-
base$1.Expression = skipThrough;
|
|
9472
|
-
base$1.ThisExpression = base$1.Super = base$1.MetaProperty = ignore;
|
|
9473
|
-
base$1.ArrayExpression = function (node, st, c) {
|
|
9474
|
-
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
|
9475
|
-
var elt = list[i];
|
|
9476
|
-
|
|
9477
|
-
if (elt) { c(elt, st, "Expression"); }
|
|
9478
|
-
}
|
|
9479
|
-
};
|
|
9480
|
-
base$1.ObjectExpression = function (node, st, c) {
|
|
9481
|
-
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
|
9482
|
-
{
|
|
9483
|
-
var prop = list[i];
|
|
9484
|
-
|
|
9485
|
-
c(prop, st);
|
|
9486
|
-
}
|
|
9487
|
-
};
|
|
9488
|
-
base$1.FunctionExpression = base$1.ArrowFunctionExpression = base$1.FunctionDeclaration;
|
|
9489
|
-
base$1.SequenceExpression = function (node, st, c) {
|
|
9490
|
-
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
|
9491
|
-
{
|
|
9492
|
-
var expr = list[i];
|
|
9493
|
-
|
|
9494
|
-
c(expr, st, "Expression");
|
|
9495
|
-
}
|
|
9496
|
-
};
|
|
9497
|
-
base$1.TemplateLiteral = function (node, st, c) {
|
|
9498
|
-
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
|
9499
|
-
{
|
|
9500
|
-
var quasi = list[i];
|
|
9501
|
-
|
|
9502
|
-
c(quasi, st);
|
|
9503
|
-
}
|
|
9504
|
-
|
|
9505
|
-
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
|
9506
|
-
{
|
|
9507
|
-
var expr = list$1[i$1];
|
|
9508
|
-
|
|
9509
|
-
c(expr, st, "Expression");
|
|
9510
|
-
}
|
|
9511
|
-
};
|
|
9512
|
-
base$1.TemplateElement = ignore;
|
|
9513
|
-
base$1.UnaryExpression = base$1.UpdateExpression = function (node, st, c) {
|
|
9514
|
-
c(node.argument, st, "Expression");
|
|
9515
|
-
};
|
|
9516
|
-
base$1.BinaryExpression = base$1.LogicalExpression = function (node, st, c) {
|
|
9517
|
-
c(node.left, st, "Expression");
|
|
9518
|
-
c(node.right, st, "Expression");
|
|
9519
|
-
};
|
|
9520
|
-
base$1.AssignmentExpression = base$1.AssignmentPattern = function (node, st, c) {
|
|
9521
|
-
c(node.left, st, "Pattern");
|
|
9522
|
-
c(node.right, st, "Expression");
|
|
9523
|
-
};
|
|
9524
|
-
base$1.ConditionalExpression = function (node, st, c) {
|
|
9525
|
-
c(node.test, st, "Expression");
|
|
9526
|
-
c(node.consequent, st, "Expression");
|
|
9527
|
-
c(node.alternate, st, "Expression");
|
|
9528
|
-
};
|
|
9529
|
-
base$1.NewExpression = base$1.CallExpression = function (node, st, c) {
|
|
9530
|
-
c(node.callee, st, "Expression");
|
|
9531
|
-
if (node.arguments)
|
|
9532
|
-
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
|
9533
|
-
{
|
|
9534
|
-
var arg = list[i];
|
|
9535
|
-
|
|
9536
|
-
c(arg, st, "Expression");
|
|
9537
|
-
} }
|
|
9538
|
-
};
|
|
9539
|
-
base$1.MemberExpression = function (node, st, c) {
|
|
9540
|
-
c(node.object, st, "Expression");
|
|
9541
|
-
if (node.computed) { c(node.property, st, "Expression"); }
|
|
9542
|
-
};
|
|
9543
|
-
base$1.ExportNamedDeclaration = base$1.ExportDefaultDeclaration = function (node, st, c) {
|
|
9544
|
-
if (node.declaration)
|
|
9545
|
-
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
|
9546
|
-
if (node.source) { c(node.source, st, "Expression"); }
|
|
9547
|
-
};
|
|
9548
|
-
base$1.ExportAllDeclaration = function (node, st, c) {
|
|
9549
|
-
if (node.exported)
|
|
9550
|
-
{ c(node.exported, st); }
|
|
9551
|
-
c(node.source, st, "Expression");
|
|
9552
|
-
};
|
|
9553
|
-
base$1.ImportDeclaration = function (node, st, c) {
|
|
9554
|
-
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
|
9555
|
-
{
|
|
9556
|
-
var spec = list[i];
|
|
9557
|
-
|
|
9558
|
-
c(spec, st);
|
|
9559
|
-
}
|
|
9560
|
-
c(node.source, st, "Expression");
|
|
9561
|
-
};
|
|
9562
|
-
base$1.ImportExpression = function (node, st, c) {
|
|
9563
|
-
c(node.source, st, "Expression");
|
|
9564
|
-
};
|
|
9565
|
-
base$1.ImportSpecifier = base$1.ImportDefaultSpecifier = base$1.ImportNamespaceSpecifier = base$1.Identifier = base$1.Literal = ignore;
|
|
9566
|
-
|
|
9567
|
-
base$1.TaggedTemplateExpression = function (node, st, c) {
|
|
9568
|
-
c(node.tag, st, "Expression");
|
|
9569
|
-
c(node.quasi, st, "Expression");
|
|
9570
|
-
};
|
|
9571
|
-
base$1.ClassDeclaration = base$1.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
|
9572
|
-
base$1.Class = function (node, st, c) {
|
|
9573
|
-
if (node.id) { c(node.id, st, "Pattern"); }
|
|
9574
|
-
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
|
9575
|
-
c(node.body, st);
|
|
9576
|
-
};
|
|
9577
|
-
base$1.ClassBody = function (node, st, c) {
|
|
9578
|
-
for (var i = 0, list = node.body; i < list.length; i += 1)
|
|
9579
|
-
{
|
|
9580
|
-
var elt = list[i];
|
|
9581
|
-
|
|
9582
|
-
c(elt, st);
|
|
9583
|
-
}
|
|
9584
|
-
};
|
|
9585
|
-
base$1.MethodDefinition = base$1.Property = function (node, st, c) {
|
|
9586
|
-
if (node.computed) { c(node.key, st, "Expression"); }
|
|
9587
|
-
c(node.value, st, "Expression");
|
|
9588
|
-
};
|
|
9589
|
-
|
|
9590
|
-
// patch up acorn-walk until class-fields are officially supported
|
|
9591
|
-
base$1.PropertyDefinition = function (node, st, c) {
|
|
9592
|
-
if (node.computed) {
|
|
9593
|
-
c(node.key, st, 'Expression');
|
|
9594
|
-
}
|
|
9595
|
-
if (node.value) {
|
|
9596
|
-
c(node.value, st, 'Expression');
|
|
9597
|
-
}
|
|
9598
|
-
};
|
|
9599
|
-
function handlePureAnnotationsOfNode(node, state, type = node.type) {
|
|
9600
|
-
let commentNode = state.commentNodes[state.commentIndex];
|
|
9601
|
-
while (commentNode && node.start >= commentNode.end) {
|
|
9602
|
-
markPureNode(node, commentNode);
|
|
9603
|
-
commentNode = state.commentNodes[++state.commentIndex];
|
|
9604
|
-
}
|
|
9605
|
-
if (commentNode && commentNode.end <= node.end) {
|
|
9606
|
-
base$1[type](node, state, handlePureAnnotationsOfNode);
|
|
9607
|
-
}
|
|
9608
|
-
}
|
|
9609
|
-
function markPureNode(node, comment) {
|
|
9610
|
-
if (node.annotations) {
|
|
9611
|
-
node.annotations.push(comment);
|
|
9612
|
-
}
|
|
9613
|
-
else {
|
|
9614
|
-
node.annotations = [comment];
|
|
9615
|
-
}
|
|
9616
|
-
if (node.type === ExpressionStatement) {
|
|
9617
|
-
node = node.expression;
|
|
9618
|
-
}
|
|
9619
|
-
if (node.type === CallExpression || node.type === NewExpression) {
|
|
9620
|
-
node.annotatedPure = true;
|
|
9621
|
-
}
|
|
9622
|
-
}
|
|
9623
|
-
const pureCommentRegex = /[@#]__PURE__/;
|
|
9624
|
-
const isPureComment = (comment) => pureCommentRegex.test(comment.text);
|
|
9625
|
-
function markPureCallExpressions(comments, esTreeAst) {
|
|
9626
|
-
handlePureAnnotationsOfNode(esTreeAst, {
|
|
9627
|
-
commentIndex: 0,
|
|
9628
|
-
commentNodes: comments.filter(isPureComment)
|
|
9629
|
-
});
|
|
9630
|
-
}
|
|
9631
|
-
|
|
9632
9339
|
// this looks ridiculous, but it prevents sourcemap tooling from mistaking
|
|
9633
9340
|
// this for an actual sourceMappingURL
|
|
9634
9341
|
let SOURCEMAPPING_URL = 'sourceMa';
|
|
@@ -9762,28 +9469,6 @@ function markModuleAndImpureDependenciesAsExecuted(baseModule) {
|
|
|
9762
9469
|
}
|
|
9763
9470
|
}
|
|
9764
9471
|
|
|
9765
|
-
function tryParse(module, Parser, acornOptions) {
|
|
9766
|
-
try {
|
|
9767
|
-
return Parser.parse(module.info.code, {
|
|
9768
|
-
...acornOptions,
|
|
9769
|
-
onComment: (block, text, start, end) => module.comments.push({ block, text, start, end })
|
|
9770
|
-
});
|
|
9771
|
-
}
|
|
9772
|
-
catch (err) {
|
|
9773
|
-
let message = err.message.replace(/ \(\d+:\d+\)$/, '');
|
|
9774
|
-
if (module.id.endsWith('.json')) {
|
|
9775
|
-
message += ' (Note that you need @rollup/plugin-json to import JSON files)';
|
|
9776
|
-
}
|
|
9777
|
-
else if (!module.id.endsWith('.js')) {
|
|
9778
|
-
message += ' (Note that you need plugins to import files that are not JavaScript)';
|
|
9779
|
-
}
|
|
9780
|
-
return module.error({
|
|
9781
|
-
code: 'PARSE_ERROR',
|
|
9782
|
-
message,
|
|
9783
|
-
parserError: err
|
|
9784
|
-
}, err.pos);
|
|
9785
|
-
}
|
|
9786
|
-
}
|
|
9787
9472
|
const MISSING_EXPORT_SHIM_DESCRIPTION = {
|
|
9788
9473
|
identifier: null,
|
|
9789
9474
|
localName: MISSING_EXPORT_SHIM_VARIABLE
|
|
@@ -10225,13 +9910,12 @@ class Module {
|
|
|
10225
9910
|
timeStart('generate ast', 3);
|
|
10226
9911
|
this.alwaysRemovedCode = alwaysRemovedCode || [];
|
|
10227
9912
|
if (!ast) {
|
|
10228
|
-
ast = tryParse(
|
|
9913
|
+
ast = this.tryParse();
|
|
10229
9914
|
for (const comment of this.comments) {
|
|
10230
|
-
if (
|
|
9915
|
+
if (comment.type != "Block" && SOURCEMAPPING_URL_RE.test(comment.value)) {
|
|
10231
9916
|
this.alwaysRemovedCode.push([comment.start, comment.end]);
|
|
10232
9917
|
}
|
|
10233
9918
|
}
|
|
10234
|
-
markPureCallExpressions(this.comments, ast);
|
|
10235
9919
|
}
|
|
10236
9920
|
timeEnd('generate ast', 3);
|
|
10237
9921
|
this.resolvedIds = resolvedIds || Object.create(null);
|
|
@@ -10275,7 +9959,7 @@ class Module {
|
|
|
10275
9959
|
};
|
|
10276
9960
|
this.scope = new ModuleScope(this.graph.scope, this.astContext);
|
|
10277
9961
|
this.namespace = new NamespaceVariable(this.astContext, this.info.syntheticNamedExports);
|
|
10278
|
-
this.ast = new Program
|
|
9962
|
+
this.ast = new Program(ast, { type: 'Module', context: this.astContext }, this.scope);
|
|
10279
9963
|
this.info.ast = ast;
|
|
10280
9964
|
timeEnd('analyse ast', 3);
|
|
10281
9965
|
}
|
|
@@ -10317,6 +10001,27 @@ class Module {
|
|
|
10317
10001
|
}
|
|
10318
10002
|
return null;
|
|
10319
10003
|
}
|
|
10004
|
+
tryParse() {
|
|
10005
|
+
try {
|
|
10006
|
+
return this.graph.contextParse(this.info.code, {
|
|
10007
|
+
onComment: (block, text, start, end) => this.comments.push({ type: block ? "Block" : "Line", value: text, start, end })
|
|
10008
|
+
});
|
|
10009
|
+
}
|
|
10010
|
+
catch (err) {
|
|
10011
|
+
let message = err.message.replace(/ \(\d+:\d+\)$/, '');
|
|
10012
|
+
if (this.id.endsWith('.json')) {
|
|
10013
|
+
message += ' (Note that you need @rollup/plugin-json to import JSON files)';
|
|
10014
|
+
}
|
|
10015
|
+
else if (!this.id.endsWith('.js')) {
|
|
10016
|
+
message += ' (Note that you need plugins to import files that are not JavaScript)';
|
|
10017
|
+
}
|
|
10018
|
+
return this.error({
|
|
10019
|
+
code: 'PARSE_ERROR',
|
|
10020
|
+
message,
|
|
10021
|
+
parserError: err
|
|
10022
|
+
}, err.pos);
|
|
10023
|
+
}
|
|
10024
|
+
}
|
|
10320
10025
|
updateOptions({ meta, moduleSideEffects, syntheticNamedExports }) {
|
|
10321
10026
|
if (moduleSideEffects != null) {
|
|
10322
10027
|
this.info.hasModuleSideEffects = moduleSideEffects;
|
|
@@ -10414,8 +10119,8 @@ class Module {
|
|
|
10414
10119
|
const source = node.source.value;
|
|
10415
10120
|
this.sources.add(source);
|
|
10416
10121
|
for (const specifier of node.specifiers) {
|
|
10417
|
-
const isDefault = specifier.type === ImportDefaultSpecifier;
|
|
10418
|
-
const isNamespace = specifier.type === ImportNamespaceSpecifier;
|
|
10122
|
+
const isDefault = specifier.type === ImportDefaultSpecifier$1;
|
|
10123
|
+
const isNamespace = specifier.type === ImportNamespaceSpecifier$1;
|
|
10419
10124
|
const name = isDefault
|
|
10420
10125
|
? 'default'
|
|
10421
10126
|
: isNamespace
|
|
@@ -10736,12 +10441,13 @@ const DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT = {
|
|
|
10736
10441
|
umd: deconflictImportsOther
|
|
10737
10442
|
};
|
|
10738
10443
|
function deconflictChunk(modules, dependenciesToBeDeconflicted, imports, usedNames, format, interop, preserveModules, externalLiveBindings, chunkByModule, syntheticExports, exportNamesByVariable, accessedGlobalsByScope, includedNamespaces) {
|
|
10739
|
-
|
|
10444
|
+
const reversedModules = modules.slice().reverse();
|
|
10445
|
+
for (const module of reversedModules) {
|
|
10740
10446
|
module.scope.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope);
|
|
10741
10447
|
}
|
|
10742
|
-
deconflictTopLevelVariables(usedNames,
|
|
10448
|
+
deconflictTopLevelVariables(usedNames, reversedModules, includedNamespaces);
|
|
10743
10449
|
DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT[format](usedNames, imports, dependenciesToBeDeconflicted, interop, preserveModules, externalLiveBindings, chunkByModule, syntheticExports);
|
|
10744
|
-
for (const module of
|
|
10450
|
+
for (const module of reversedModules) {
|
|
10745
10451
|
module.scope.deconflict(format, exportNamesByVariable, accessedGlobalsByScope);
|
|
10746
10452
|
}
|
|
10747
10453
|
}
|
|
@@ -11066,7 +10772,7 @@ function getGlobalName(module, globals, hasExports, warn) {
|
|
|
11066
10772
|
return module.variableName;
|
|
11067
10773
|
}
|
|
11068
10774
|
}
|
|
11069
|
-
class Chunk
|
|
10775
|
+
class Chunk {
|
|
11070
10776
|
constructor(orderedModules, inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, manualChunkAlias) {
|
|
11071
10777
|
this.orderedModules = orderedModules;
|
|
11072
10778
|
this.inputOptions = inputOptions;
|
|
@@ -11137,7 +10843,7 @@ class Chunk$1 {
|
|
|
11137
10843
|
this.suggestedVariableName = makeLegal(this.generateVariableName());
|
|
11138
10844
|
}
|
|
11139
10845
|
static generateFacade(inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, facadedModule, facadeName) {
|
|
11140
|
-
const chunk = new Chunk
|
|
10846
|
+
const chunk = new Chunk([], inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, null);
|
|
11141
10847
|
chunk.assignFacadeName(facadeName, facadedModule);
|
|
11142
10848
|
if (!facadeChunkByModule.has(facadedModule)) {
|
|
11143
10849
|
facadeChunkByModule.set(facadedModule, chunk);
|
|
@@ -11242,7 +10948,7 @@ class Chunk$1 {
|
|
|
11242
10948
|
}
|
|
11243
10949
|
}
|
|
11244
10950
|
for (const facadeName of requiredFacades) {
|
|
11245
|
-
facades.push(Chunk
|
|
10951
|
+
facades.push(Chunk.generateFacade(this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.modulesById, this.chunkByModule, this.facadeChunkByModule, this.includedNamespaces, module, facadeName));
|
|
11246
10952
|
}
|
|
11247
10953
|
}
|
|
11248
10954
|
for (const module of this.dynamicEntryModules) {
|
|
@@ -11383,7 +11089,7 @@ class Chunk$1 {
|
|
|
11383
11089
|
}
|
|
11384
11090
|
// prerender allows chunk hashes and names to be generated before finalizing
|
|
11385
11091
|
preRender(options, inputBase) {
|
|
11386
|
-
const magicString = new Bundle({ separator: options.compact ? '' : '\n\n' });
|
|
11092
|
+
const magicString = new Bundle$1({ separator: options.compact ? '' : '\n\n' });
|
|
11387
11093
|
this.usedModules = [];
|
|
11388
11094
|
this.indentString = getIndentString(this.orderedModules, options);
|
|
11389
11095
|
const n = options.compact ? '' : '\n';
|
|
@@ -11404,7 +11110,7 @@ class Chunk$1 {
|
|
|
11404
11110
|
!this.outputOptions.preserveModules &&
|
|
11405
11111
|
this.facadeModule !== null) {
|
|
11406
11112
|
for (const dep of this.dependencies) {
|
|
11407
|
-
if (dep instanceof Chunk
|
|
11113
|
+
if (dep instanceof Chunk)
|
|
11408
11114
|
this.inlineChunkDependencies(dep);
|
|
11409
11115
|
}
|
|
11410
11116
|
}
|
|
@@ -11716,7 +11422,7 @@ class Chunk$1 {
|
|
|
11716
11422
|
getGlobalName(dep, options.globals, (imports || reexports) !== null, this.inputOptions.onwarn)),
|
|
11717
11423
|
id: undefined,
|
|
11718
11424
|
imports,
|
|
11719
|
-
isChunk: dep instanceof Chunk
|
|
11425
|
+
isChunk: dep instanceof Chunk,
|
|
11720
11426
|
name: dep.variableName,
|
|
11721
11427
|
namedExportsMode,
|
|
11722
11428
|
namespaceVariableName: dep.namespaceVariableName,
|
|
@@ -11938,7 +11644,7 @@ class Chunk$1 {
|
|
|
11938
11644
|
if (this.dependencies.has(dep))
|
|
11939
11645
|
continue;
|
|
11940
11646
|
this.dependencies.add(dep);
|
|
11941
|
-
if (dep instanceof Chunk
|
|
11647
|
+
if (dep instanceof Chunk) {
|
|
11942
11648
|
this.inlineChunkDependencies(dep);
|
|
11943
11649
|
}
|
|
11944
11650
|
}
|
|
@@ -11975,7 +11681,7 @@ class Chunk$1 {
|
|
|
11975
11681
|
}
|
|
11976
11682
|
}
|
|
11977
11683
|
}
|
|
11978
|
-
setIdentifierRenderResolutions({ format, interop }) {
|
|
11684
|
+
setIdentifierRenderResolutions({ format, interop, namespaceToStringTag }) {
|
|
11979
11685
|
const syntheticExports = new Set();
|
|
11980
11686
|
for (const exportName of this.getExportNames()) {
|
|
11981
11687
|
const exportVariable = this.exportsByName[exportName];
|
|
@@ -11995,10 +11701,13 @@ class Chunk$1 {
|
|
|
11995
11701
|
exportVariable.setRenderNames(null, null);
|
|
11996
11702
|
}
|
|
11997
11703
|
}
|
|
11998
|
-
const usedNames = new Set();
|
|
11704
|
+
const usedNames = new Set(['Object', 'Promise']);
|
|
11999
11705
|
if (this.needsExportsShim) {
|
|
12000
11706
|
usedNames.add(MISSING_EXPORT_SHIM_VARIABLE);
|
|
12001
11707
|
}
|
|
11708
|
+
if (namespaceToStringTag) {
|
|
11709
|
+
usedNames.add('Symbol');
|
|
11710
|
+
}
|
|
12002
11711
|
switch (format) {
|
|
12003
11712
|
case 'system':
|
|
12004
11713
|
usedNames.add('module').add('exports');
|
|
@@ -12555,7 +12264,7 @@ function areSourcesEqual(sourceA, sourceB) {
|
|
|
12555
12264
|
return true;
|
|
12556
12265
|
}
|
|
12557
12266
|
|
|
12558
|
-
class Bundle
|
|
12267
|
+
class Bundle {
|
|
12559
12268
|
constructor(outputOptions, unsetOptions, inputOptions, pluginDriver, graph) {
|
|
12560
12269
|
this.outputOptions = outputOptions;
|
|
12561
12270
|
this.unsetOptions = unsetOptions;
|
|
@@ -12698,7 +12407,7 @@ class Bundle$1 {
|
|
|
12698
12407
|
}))
|
|
12699
12408
|
: getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry)) {
|
|
12700
12409
|
sortByExecutionOrder(modules);
|
|
12701
|
-
const chunk = new Chunk
|
|
12410
|
+
const chunk = new Chunk(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, this.facadeChunkByModule, this.includedNamespaces, alias);
|
|
12702
12411
|
chunks.push(chunk);
|
|
12703
12412
|
for (const module of modules) {
|
|
12704
12413
|
chunkByModule.set(module, chunk);
|
|
@@ -12770,7 +12479,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
|
12770
12479
|
|
|
12771
12480
|
// Reserved word lists for various dialects of the language
|
|
12772
12481
|
|
|
12773
|
-
var reservedWords
|
|
12482
|
+
var reservedWords = {
|
|
12774
12483
|
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
|
|
12775
12484
|
5: "class enum extends super const export import",
|
|
12776
12485
|
6: "enum",
|
|
@@ -13025,7 +12734,7 @@ var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
|
13025
12734
|
|
|
13026
12735
|
var ref = Object.prototype;
|
|
13027
12736
|
var hasOwnProperty = ref.hasOwnProperty;
|
|
13028
|
-
var toString
|
|
12737
|
+
var toString = ref.toString;
|
|
13029
12738
|
|
|
13030
12739
|
// Checks if an object has a property.
|
|
13031
12740
|
|
|
@@ -13034,7 +12743,7 @@ function has(obj, propName) {
|
|
|
13034
12743
|
}
|
|
13035
12744
|
|
|
13036
12745
|
var isArray = Array.isArray || (function (obj) { return (
|
|
13037
|
-
toString
|
|
12746
|
+
toString.call(obj) === "[object Array]"
|
|
13038
12747
|
); });
|
|
13039
12748
|
|
|
13040
12749
|
function wordsRegexp(words) {
|
|
@@ -13248,13 +12957,13 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
13248
12957
|
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
13249
12958
|
var reserved = "";
|
|
13250
12959
|
if (options.allowReserved !== true) {
|
|
13251
|
-
reserved = reservedWords
|
|
12960
|
+
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
13252
12961
|
if (options.sourceType === "module") { reserved += " await"; }
|
|
13253
12962
|
}
|
|
13254
12963
|
this.reservedWords = wordsRegexp(reserved);
|
|
13255
|
-
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords
|
|
12964
|
+
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
|
|
13256
12965
|
this.reservedWordsStrict = wordsRegexp(reservedStrict);
|
|
13257
|
-
this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords
|
|
12966
|
+
this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
|
|
13258
12967
|
this.input = String(input);
|
|
13259
12968
|
|
|
13260
12969
|
// Used to signal to callers of `readWord1` whether the word
|
|
@@ -15790,7 +15499,7 @@ pp$4.curPosition = function() {
|
|
|
15790
15499
|
|
|
15791
15500
|
var pp$5 = Parser.prototype;
|
|
15792
15501
|
|
|
15793
|
-
var Scope
|
|
15502
|
+
var Scope = function Scope(flags) {
|
|
15794
15503
|
this.flags = flags;
|
|
15795
15504
|
// A list of var-declared names in the current lexical scope
|
|
15796
15505
|
this.var = [];
|
|
@@ -15803,7 +15512,7 @@ var Scope$1 = function Scope(flags) {
|
|
|
15803
15512
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
15804
15513
|
|
|
15805
15514
|
pp$5.enterScope = function(flags) {
|
|
15806
|
-
this.scopeStack.push(new Scope
|
|
15515
|
+
this.scopeStack.push(new Scope(flags));
|
|
15807
15516
|
};
|
|
15808
15517
|
|
|
15809
15518
|
pp$5.exitScope = function() {
|
|
@@ -17977,11 +17686,11 @@ pp$9.readWord = function() {
|
|
|
17977
17686
|
|
|
17978
17687
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
17979
17688
|
|
|
17980
|
-
var version
|
|
17689
|
+
var version = "8.0.5";
|
|
17981
17690
|
|
|
17982
17691
|
Parser.acorn = {
|
|
17983
17692
|
Parser: Parser,
|
|
17984
|
-
version: version
|
|
17693
|
+
version: version,
|
|
17985
17694
|
defaultOptions: defaultOptions,
|
|
17986
17695
|
Position: Position,
|
|
17987
17696
|
SourceLocation: SourceLocation,
|
|
@@ -18050,10 +17759,10 @@ var acorn = {
|
|
|
18050
17759
|
tokContexts: types$1,
|
|
18051
17760
|
tokTypes: types,
|
|
18052
17761
|
tokenizer: tokenizer,
|
|
18053
|
-
version: version
|
|
17762
|
+
version: version
|
|
18054
17763
|
};
|
|
18055
17764
|
|
|
18056
|
-
class GlobalScope extends Scope {
|
|
17765
|
+
class GlobalScope extends Scope$1 {
|
|
18057
17766
|
constructor() {
|
|
18058
17767
|
super();
|
|
18059
17768
|
this.variables.set('undefined', new UndefinedVariable());
|
|
@@ -18775,7 +18484,7 @@ function getPluginContexts(pluginCache, graph, options, fileEmitter) {
|
|
|
18775
18484
|
getWatchFiles: () => Object.keys(graph.watchFiles),
|
|
18776
18485
|
isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => options.external(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, options),
|
|
18777
18486
|
meta: {
|
|
18778
|
-
rollupVersion: version,
|
|
18487
|
+
rollupVersion: version$1,
|
|
18779
18488
|
watchMode: graph.watchMode
|
|
18780
18489
|
},
|
|
18781
18490
|
get moduleIds() {
|
|
@@ -18789,7 +18498,7 @@ function getPluginContexts(pluginCache, graph, options, fileEmitter) {
|
|
|
18789
18498
|
const moduleIds = graph.modulesById.keys();
|
|
18790
18499
|
return wrappedModuleIds();
|
|
18791
18500
|
},
|
|
18792
|
-
parse: graph.contextParse,
|
|
18501
|
+
parse: graph.contextParse.bind(graph),
|
|
18793
18502
|
resolve(source, importer, { custom, skipSelf } = BLANK) {
|
|
18794
18503
|
return graph.moduleLoader.resolveId(source, importer, custom, skipSelf ? pidx : null);
|
|
18795
18504
|
},
|
|
@@ -19000,6 +18709,318 @@ class PluginDriver {
|
|
|
19000
18709
|
}
|
|
19001
18710
|
}
|
|
19002
18711
|
|
|
18712
|
+
// AST walker module for Mozilla Parser API compatible trees
|
|
18713
|
+
|
|
18714
|
+
function skipThrough(node, st, c) { c(node, st); }
|
|
18715
|
+
function ignore(_node, _st, _c) {}
|
|
18716
|
+
|
|
18717
|
+
// Node walkers.
|
|
18718
|
+
|
|
18719
|
+
var base = {};
|
|
18720
|
+
|
|
18721
|
+
base.Program = base.BlockStatement = function (node, st, c) {
|
|
18722
|
+
for (var i = 0, list = node.body; i < list.length; i += 1)
|
|
18723
|
+
{
|
|
18724
|
+
var stmt = list[i];
|
|
18725
|
+
|
|
18726
|
+
c(stmt, st, "Statement");
|
|
18727
|
+
}
|
|
18728
|
+
};
|
|
18729
|
+
base.Statement = skipThrough;
|
|
18730
|
+
base.EmptyStatement = ignore;
|
|
18731
|
+
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
|
|
18732
|
+
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
|
18733
|
+
base.IfStatement = function (node, st, c) {
|
|
18734
|
+
c(node.test, st, "Expression");
|
|
18735
|
+
c(node.consequent, st, "Statement");
|
|
18736
|
+
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
|
18737
|
+
};
|
|
18738
|
+
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
|
18739
|
+
base.BreakStatement = base.ContinueStatement = ignore;
|
|
18740
|
+
base.WithStatement = function (node, st, c) {
|
|
18741
|
+
c(node.object, st, "Expression");
|
|
18742
|
+
c(node.body, st, "Statement");
|
|
18743
|
+
};
|
|
18744
|
+
base.SwitchStatement = function (node, st, c) {
|
|
18745
|
+
c(node.discriminant, st, "Expression");
|
|
18746
|
+
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
|
|
18747
|
+
var cs = list$1[i$1];
|
|
18748
|
+
|
|
18749
|
+
if (cs.test) { c(cs.test, st, "Expression"); }
|
|
18750
|
+
for (var i = 0, list = cs.consequent; i < list.length; i += 1)
|
|
18751
|
+
{
|
|
18752
|
+
var cons = list[i];
|
|
18753
|
+
|
|
18754
|
+
c(cons, st, "Statement");
|
|
18755
|
+
}
|
|
18756
|
+
}
|
|
18757
|
+
};
|
|
18758
|
+
base.SwitchCase = function (node, st, c) {
|
|
18759
|
+
if (node.test) { c(node.test, st, "Expression"); }
|
|
18760
|
+
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
|
18761
|
+
{
|
|
18762
|
+
var cons = list[i];
|
|
18763
|
+
|
|
18764
|
+
c(cons, st, "Statement");
|
|
18765
|
+
}
|
|
18766
|
+
};
|
|
18767
|
+
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
|
18768
|
+
if (node.argument) { c(node.argument, st, "Expression"); }
|
|
18769
|
+
};
|
|
18770
|
+
base.ThrowStatement = base.SpreadElement =
|
|
18771
|
+
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
|
18772
|
+
base.TryStatement = function (node, st, c) {
|
|
18773
|
+
c(node.block, st, "Statement");
|
|
18774
|
+
if (node.handler) { c(node.handler, st); }
|
|
18775
|
+
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
|
18776
|
+
};
|
|
18777
|
+
base.CatchClause = function (node, st, c) {
|
|
18778
|
+
if (node.param) { c(node.param, st, "Pattern"); }
|
|
18779
|
+
c(node.body, st, "Statement");
|
|
18780
|
+
};
|
|
18781
|
+
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
|
18782
|
+
c(node.test, st, "Expression");
|
|
18783
|
+
c(node.body, st, "Statement");
|
|
18784
|
+
};
|
|
18785
|
+
base.ForStatement = function (node, st, c) {
|
|
18786
|
+
if (node.init) { c(node.init, st, "ForInit"); }
|
|
18787
|
+
if (node.test) { c(node.test, st, "Expression"); }
|
|
18788
|
+
if (node.update) { c(node.update, st, "Expression"); }
|
|
18789
|
+
c(node.body, st, "Statement");
|
|
18790
|
+
};
|
|
18791
|
+
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
|
18792
|
+
c(node.left, st, "ForInit");
|
|
18793
|
+
c(node.right, st, "Expression");
|
|
18794
|
+
c(node.body, st, "Statement");
|
|
18795
|
+
};
|
|
18796
|
+
base.ForInit = function (node, st, c) {
|
|
18797
|
+
if (node.type === "VariableDeclaration") { c(node, st); }
|
|
18798
|
+
else { c(node, st, "Expression"); }
|
|
18799
|
+
};
|
|
18800
|
+
base.DebuggerStatement = ignore;
|
|
18801
|
+
|
|
18802
|
+
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
|
18803
|
+
base.VariableDeclaration = function (node, st, c) {
|
|
18804
|
+
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
|
18805
|
+
{
|
|
18806
|
+
var decl = list[i];
|
|
18807
|
+
|
|
18808
|
+
c(decl, st);
|
|
18809
|
+
}
|
|
18810
|
+
};
|
|
18811
|
+
base.VariableDeclarator = function (node, st, c) {
|
|
18812
|
+
c(node.id, st, "Pattern");
|
|
18813
|
+
if (node.init) { c(node.init, st, "Expression"); }
|
|
18814
|
+
};
|
|
18815
|
+
|
|
18816
|
+
base.Function = function (node, st, c) {
|
|
18817
|
+
if (node.id) { c(node.id, st, "Pattern"); }
|
|
18818
|
+
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
18819
|
+
{
|
|
18820
|
+
var param = list[i];
|
|
18821
|
+
|
|
18822
|
+
c(param, st, "Pattern");
|
|
18823
|
+
}
|
|
18824
|
+
c(node.body, st, node.expression ? "Expression" : "Statement");
|
|
18825
|
+
};
|
|
18826
|
+
|
|
18827
|
+
base.Pattern = function (node, st, c) {
|
|
18828
|
+
if (node.type === "Identifier")
|
|
18829
|
+
{ c(node, st, "VariablePattern"); }
|
|
18830
|
+
else if (node.type === "MemberExpression")
|
|
18831
|
+
{ c(node, st, "MemberPattern"); }
|
|
18832
|
+
else
|
|
18833
|
+
{ c(node, st); }
|
|
18834
|
+
};
|
|
18835
|
+
base.VariablePattern = ignore;
|
|
18836
|
+
base.MemberPattern = skipThrough;
|
|
18837
|
+
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
|
18838
|
+
base.ArrayPattern = function (node, st, c) {
|
|
18839
|
+
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
|
18840
|
+
var elt = list[i];
|
|
18841
|
+
|
|
18842
|
+
if (elt) { c(elt, st, "Pattern"); }
|
|
18843
|
+
}
|
|
18844
|
+
};
|
|
18845
|
+
base.ObjectPattern = function (node, st, c) {
|
|
18846
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
|
18847
|
+
var prop = list[i];
|
|
18848
|
+
|
|
18849
|
+
if (prop.type === "Property") {
|
|
18850
|
+
if (prop.computed) { c(prop.key, st, "Expression"); }
|
|
18851
|
+
c(prop.value, st, "Pattern");
|
|
18852
|
+
} else if (prop.type === "RestElement") {
|
|
18853
|
+
c(prop.argument, st, "Pattern");
|
|
18854
|
+
}
|
|
18855
|
+
}
|
|
18856
|
+
};
|
|
18857
|
+
|
|
18858
|
+
base.Expression = skipThrough;
|
|
18859
|
+
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
|
18860
|
+
base.ArrayExpression = function (node, st, c) {
|
|
18861
|
+
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
|
18862
|
+
var elt = list[i];
|
|
18863
|
+
|
|
18864
|
+
if (elt) { c(elt, st, "Expression"); }
|
|
18865
|
+
}
|
|
18866
|
+
};
|
|
18867
|
+
base.ObjectExpression = function (node, st, c) {
|
|
18868
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
|
18869
|
+
{
|
|
18870
|
+
var prop = list[i];
|
|
18871
|
+
|
|
18872
|
+
c(prop, st);
|
|
18873
|
+
}
|
|
18874
|
+
};
|
|
18875
|
+
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
|
18876
|
+
base.SequenceExpression = function (node, st, c) {
|
|
18877
|
+
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
|
18878
|
+
{
|
|
18879
|
+
var expr = list[i];
|
|
18880
|
+
|
|
18881
|
+
c(expr, st, "Expression");
|
|
18882
|
+
}
|
|
18883
|
+
};
|
|
18884
|
+
base.TemplateLiteral = function (node, st, c) {
|
|
18885
|
+
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
|
18886
|
+
{
|
|
18887
|
+
var quasi = list[i];
|
|
18888
|
+
|
|
18889
|
+
c(quasi, st);
|
|
18890
|
+
}
|
|
18891
|
+
|
|
18892
|
+
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
|
18893
|
+
{
|
|
18894
|
+
var expr = list$1[i$1];
|
|
18895
|
+
|
|
18896
|
+
c(expr, st, "Expression");
|
|
18897
|
+
}
|
|
18898
|
+
};
|
|
18899
|
+
base.TemplateElement = ignore;
|
|
18900
|
+
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
|
18901
|
+
c(node.argument, st, "Expression");
|
|
18902
|
+
};
|
|
18903
|
+
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
|
18904
|
+
c(node.left, st, "Expression");
|
|
18905
|
+
c(node.right, st, "Expression");
|
|
18906
|
+
};
|
|
18907
|
+
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
|
18908
|
+
c(node.left, st, "Pattern");
|
|
18909
|
+
c(node.right, st, "Expression");
|
|
18910
|
+
};
|
|
18911
|
+
base.ConditionalExpression = function (node, st, c) {
|
|
18912
|
+
c(node.test, st, "Expression");
|
|
18913
|
+
c(node.consequent, st, "Expression");
|
|
18914
|
+
c(node.alternate, st, "Expression");
|
|
18915
|
+
};
|
|
18916
|
+
base.NewExpression = base.CallExpression = function (node, st, c) {
|
|
18917
|
+
c(node.callee, st, "Expression");
|
|
18918
|
+
if (node.arguments)
|
|
18919
|
+
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
|
18920
|
+
{
|
|
18921
|
+
var arg = list[i];
|
|
18922
|
+
|
|
18923
|
+
c(arg, st, "Expression");
|
|
18924
|
+
} }
|
|
18925
|
+
};
|
|
18926
|
+
base.MemberExpression = function (node, st, c) {
|
|
18927
|
+
c(node.object, st, "Expression");
|
|
18928
|
+
if (node.computed) { c(node.property, st, "Expression"); }
|
|
18929
|
+
};
|
|
18930
|
+
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
|
18931
|
+
if (node.declaration)
|
|
18932
|
+
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
|
18933
|
+
if (node.source) { c(node.source, st, "Expression"); }
|
|
18934
|
+
};
|
|
18935
|
+
base.ExportAllDeclaration = function (node, st, c) {
|
|
18936
|
+
if (node.exported)
|
|
18937
|
+
{ c(node.exported, st); }
|
|
18938
|
+
c(node.source, st, "Expression");
|
|
18939
|
+
};
|
|
18940
|
+
base.ImportDeclaration = function (node, st, c) {
|
|
18941
|
+
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
|
18942
|
+
{
|
|
18943
|
+
var spec = list[i];
|
|
18944
|
+
|
|
18945
|
+
c(spec, st);
|
|
18946
|
+
}
|
|
18947
|
+
c(node.source, st, "Expression");
|
|
18948
|
+
};
|
|
18949
|
+
base.ImportExpression = function (node, st, c) {
|
|
18950
|
+
c(node.source, st, "Expression");
|
|
18951
|
+
};
|
|
18952
|
+
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
|
18953
|
+
|
|
18954
|
+
base.TaggedTemplateExpression = function (node, st, c) {
|
|
18955
|
+
c(node.tag, st, "Expression");
|
|
18956
|
+
c(node.quasi, st, "Expression");
|
|
18957
|
+
};
|
|
18958
|
+
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
|
18959
|
+
base.Class = function (node, st, c) {
|
|
18960
|
+
if (node.id) { c(node.id, st, "Pattern"); }
|
|
18961
|
+
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
|
18962
|
+
c(node.body, st);
|
|
18963
|
+
};
|
|
18964
|
+
base.ClassBody = function (node, st, c) {
|
|
18965
|
+
for (var i = 0, list = node.body; i < list.length; i += 1)
|
|
18966
|
+
{
|
|
18967
|
+
var elt = list[i];
|
|
18968
|
+
|
|
18969
|
+
c(elt, st);
|
|
18970
|
+
}
|
|
18971
|
+
};
|
|
18972
|
+
base.MethodDefinition = base.Property = function (node, st, c) {
|
|
18973
|
+
if (node.computed) { c(node.key, st, "Expression"); }
|
|
18974
|
+
c(node.value, st, "Expression");
|
|
18975
|
+
};
|
|
18976
|
+
|
|
18977
|
+
// patch up acorn-walk until class-fields are officially supported
|
|
18978
|
+
base.PropertyDefinition = function (node, st, c) {
|
|
18979
|
+
if (node.computed) {
|
|
18980
|
+
c(node.key, st, 'Expression');
|
|
18981
|
+
}
|
|
18982
|
+
if (node.value) {
|
|
18983
|
+
c(node.value, st, 'Expression');
|
|
18984
|
+
}
|
|
18985
|
+
};
|
|
18986
|
+
function handlePureAnnotationsOfNode(node, state, type = node.type) {
|
|
18987
|
+
let commentNode = state.commentNodes[state.commentIndex];
|
|
18988
|
+
while (commentNode && node.start >= commentNode.end) {
|
|
18989
|
+
markPureNode(node, commentNode);
|
|
18990
|
+
commentNode = state.commentNodes[++state.commentIndex];
|
|
18991
|
+
}
|
|
18992
|
+
if (commentNode && commentNode.end <= node.end) {
|
|
18993
|
+
base[type](node, state, handlePureAnnotationsOfNode);
|
|
18994
|
+
}
|
|
18995
|
+
}
|
|
18996
|
+
function markPureNode(node, comment) {
|
|
18997
|
+
if (node._rollupAnnotations) {
|
|
18998
|
+
node._rollupAnnotations.push({ comment });
|
|
18999
|
+
}
|
|
19000
|
+
else {
|
|
19001
|
+
node._rollupAnnotations = [{ comment }];
|
|
19002
|
+
}
|
|
19003
|
+
if (node.type === ExpressionStatement$1) {
|
|
19004
|
+
node = node.expression;
|
|
19005
|
+
}
|
|
19006
|
+
if (node.type === CallExpression$1 || node.type === NewExpression$1) {
|
|
19007
|
+
if (node._rollupAnnotations) {
|
|
19008
|
+
node._rollupAnnotations.push({ pure: true });
|
|
19009
|
+
}
|
|
19010
|
+
else {
|
|
19011
|
+
node._rollupAnnotations = [{ pure: true }];
|
|
19012
|
+
}
|
|
19013
|
+
}
|
|
19014
|
+
}
|
|
19015
|
+
const pureCommentRegex = /[@#]__PURE__/;
|
|
19016
|
+
const isPureComment = (comment) => pureCommentRegex.test(comment.value);
|
|
19017
|
+
function markPureCallExpressions(comments, esTreeAst) {
|
|
19018
|
+
handlePureAnnotationsOfNode(esTreeAst, {
|
|
19019
|
+
commentIndex: 0,
|
|
19020
|
+
commentNodes: comments.filter(isPureComment)
|
|
19021
|
+
});
|
|
19022
|
+
}
|
|
19023
|
+
|
|
19003
19024
|
function normalizeEntryModules(entryModules) {
|
|
19004
19025
|
if (Array.isArray(entryModules)) {
|
|
19005
19026
|
return entryModules.map(id => ({
|
|
@@ -19052,10 +19073,6 @@ class Graph {
|
|
|
19052
19073
|
cache[key][0]++;
|
|
19053
19074
|
}
|
|
19054
19075
|
}
|
|
19055
|
-
this.contextParse = (code, options = {}) => this.acornParser.parse(code, {
|
|
19056
|
-
...this.options.acorn,
|
|
19057
|
-
...options
|
|
19058
|
-
});
|
|
19059
19076
|
if (watcher) {
|
|
19060
19077
|
this.watchMode = true;
|
|
19061
19078
|
const handleChange = (...args) => this.pluginDriver.hookSeqSync('watchChange', args);
|
|
@@ -19085,6 +19102,29 @@ class Graph {
|
|
|
19085
19102
|
timeEnd('mark included statements', 2);
|
|
19086
19103
|
this.phase = BuildPhase.GENERATE;
|
|
19087
19104
|
}
|
|
19105
|
+
contextParse(code, options = {}) {
|
|
19106
|
+
const onCommentOrig = options.onComment;
|
|
19107
|
+
const comments = [];
|
|
19108
|
+
if (onCommentOrig && typeof onCommentOrig == 'function') {
|
|
19109
|
+
options.onComment = (block, text, start, end, ...args) => {
|
|
19110
|
+
comments.push({ type: block ? "Block" : "Line", value: text, start, end });
|
|
19111
|
+
return onCommentOrig.call(options, block, text, start, end, ...args);
|
|
19112
|
+
};
|
|
19113
|
+
}
|
|
19114
|
+
else {
|
|
19115
|
+
options.onComment = comments;
|
|
19116
|
+
}
|
|
19117
|
+
const ast = this.acornParser.parse(code, {
|
|
19118
|
+
...this.options.acorn,
|
|
19119
|
+
...options
|
|
19120
|
+
});
|
|
19121
|
+
if (typeof onCommentOrig == 'object') {
|
|
19122
|
+
onCommentOrig.push(...comments);
|
|
19123
|
+
}
|
|
19124
|
+
options.onComment = onCommentOrig;
|
|
19125
|
+
markPureCallExpressions(comments, ast);
|
|
19126
|
+
return ast;
|
|
19127
|
+
}
|
|
19088
19128
|
getCache() {
|
|
19089
19129
|
// handle plugin cache eviction
|
|
19090
19130
|
for (const name in this.pluginCache) {
|
|
@@ -19225,7 +19265,7 @@ var require$$1 = /*@__PURE__*/getAugmentedNamespace(acorn);
|
|
|
19225
19265
|
|
|
19226
19266
|
const getPrototype = Object.getPrototypeOf || (o => o.__proto__);
|
|
19227
19267
|
|
|
19228
|
-
const getAcorn = Parser => {
|
|
19268
|
+
const getAcorn$1 = Parser => {
|
|
19229
19269
|
if (Parser.acorn) return Parser.acorn
|
|
19230
19270
|
|
|
19231
19271
|
const acorn = require$$1;
|
|
@@ -19250,7 +19290,7 @@ var acornPrivateClassElements = function(Parser) {
|
|
|
19250
19290
|
return Parser
|
|
19251
19291
|
}
|
|
19252
19292
|
|
|
19253
|
-
const acorn = getAcorn(Parser);
|
|
19293
|
+
const acorn = getAcorn$1(Parser);
|
|
19254
19294
|
|
|
19255
19295
|
Parser = class extends Parser {
|
|
19256
19296
|
_branch() {
|
|
@@ -19387,13 +19427,13 @@ var acornPrivateClassElements = function(Parser) {
|
|
|
19387
19427
|
return Parser
|
|
19388
19428
|
};
|
|
19389
19429
|
|
|
19390
|
-
const privateClassElements = acornPrivateClassElements;
|
|
19430
|
+
const privateClassElements$1 = acornPrivateClassElements;
|
|
19391
19431
|
|
|
19392
19432
|
var acornClassFields = function(Parser) {
|
|
19393
19433
|
const acorn = Parser.acorn || require$$1;
|
|
19394
19434
|
const tt = acorn.tokTypes;
|
|
19395
19435
|
|
|
19396
|
-
Parser = privateClassElements(Parser);
|
|
19436
|
+
Parser = privateClassElements$1(Parser);
|
|
19397
19437
|
return class extends Parser {
|
|
19398
19438
|
_maybeParseFieldValue(field) {
|
|
19399
19439
|
if (this.eat(tt.eq)) {
|
|
@@ -19454,10 +19494,10 @@ var acornClassFields = function(Parser) {
|
|
|
19454
19494
|
}
|
|
19455
19495
|
};
|
|
19456
19496
|
|
|
19457
|
-
const privateClassElements
|
|
19497
|
+
const privateClassElements = acornPrivateClassElements;
|
|
19458
19498
|
|
|
19459
19499
|
var acornStaticClassFeatures = function(Parser) {
|
|
19460
|
-
const ExtendedParser = privateClassElements
|
|
19500
|
+
const ExtendedParser = privateClassElements(Parser);
|
|
19461
19501
|
|
|
19462
19502
|
const acorn = Parser.acorn || require$$1;
|
|
19463
19503
|
const tt = acorn.tokTypes;
|
|
@@ -19563,21 +19603,21 @@ function normalizeInputOptions(config) {
|
|
|
19563
19603
|
const onwarn = getOnwarn(config);
|
|
19564
19604
|
const strictDeprecations = config.strictDeprecations || false;
|
|
19565
19605
|
const options = {
|
|
19566
|
-
acorn: getAcorn
|
|
19606
|
+
acorn: getAcorn(config),
|
|
19567
19607
|
acornInjectPlugins: getAcornInjectPlugins(config),
|
|
19568
19608
|
cache: getCache(config),
|
|
19569
19609
|
context,
|
|
19570
19610
|
experimentalCacheExpiry: (_b = config.experimentalCacheExpiry) !== null && _b !== void 0 ? _b : 10,
|
|
19571
19611
|
external: getIdMatcher(config.external),
|
|
19572
|
-
inlineDynamicImports: getInlineDynamicImports(config, onwarn, strictDeprecations),
|
|
19612
|
+
inlineDynamicImports: getInlineDynamicImports$1(config, onwarn, strictDeprecations),
|
|
19573
19613
|
input: getInput(config),
|
|
19574
|
-
manualChunks: getManualChunks(config, onwarn, strictDeprecations),
|
|
19614
|
+
manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
|
|
19575
19615
|
moduleContext: getModuleContext(config, context),
|
|
19576
19616
|
onwarn,
|
|
19577
19617
|
perf: config.perf || false,
|
|
19578
19618
|
plugins: ensureArray(config.plugins),
|
|
19579
19619
|
preserveEntrySignatures: getPreserveEntrySignatures(config, unsetOptions),
|
|
19580
|
-
preserveModules: getPreserveModules(config, onwarn, strictDeprecations),
|
|
19620
|
+
preserveModules: getPreserveModules$1(config, onwarn, strictDeprecations),
|
|
19581
19621
|
preserveSymlinks: config.preserveSymlinks || false,
|
|
19582
19622
|
shimMissingExports: config.shimMissingExports || false,
|
|
19583
19623
|
strictDeprecations,
|
|
@@ -19602,7 +19642,7 @@ const getOnwarn = (config) => {
|
|
|
19602
19642
|
}
|
|
19603
19643
|
: defaultOnWarn;
|
|
19604
19644
|
};
|
|
19605
|
-
const getAcorn
|
|
19645
|
+
const getAcorn = (config) => ({
|
|
19606
19646
|
allowAwaitOutsideFunction: true,
|
|
19607
19647
|
ecmaVersion: 'latest',
|
|
19608
19648
|
preserveParens: false,
|
|
@@ -19640,7 +19680,7 @@ const getIdMatcher = (option) => {
|
|
|
19640
19680
|
}
|
|
19641
19681
|
return () => false;
|
|
19642
19682
|
};
|
|
19643
|
-
const getInlineDynamicImports = (config, warn, strictDeprecations) => {
|
|
19683
|
+
const getInlineDynamicImports$1 = (config, warn, strictDeprecations) => {
|
|
19644
19684
|
const configInlineDynamicImports = config.inlineDynamicImports;
|
|
19645
19685
|
if (configInlineDynamicImports) {
|
|
19646
19686
|
warnDeprecationWithOptions('The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.', false, warn, strictDeprecations);
|
|
@@ -19651,7 +19691,7 @@ const getInput = (config) => {
|
|
|
19651
19691
|
const configInput = config.input;
|
|
19652
19692
|
return configInput == null ? [] : typeof configInput === 'string' ? [configInput] : configInput;
|
|
19653
19693
|
};
|
|
19654
|
-
const getManualChunks = (config, warn, strictDeprecations) => {
|
|
19694
|
+
const getManualChunks$1 = (config, warn, strictDeprecations) => {
|
|
19655
19695
|
const configManualChunks = config.manualChunks;
|
|
19656
19696
|
if (configManualChunks) {
|
|
19657
19697
|
warnDeprecationWithOptions('The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.', false, warn, strictDeprecations);
|
|
@@ -19679,7 +19719,7 @@ const getPreserveEntrySignatures = (config, unsetOptions) => {
|
|
|
19679
19719
|
}
|
|
19680
19720
|
return configPreserveEntrySignatures !== null && configPreserveEntrySignatures !== void 0 ? configPreserveEntrySignatures : 'strict';
|
|
19681
19721
|
};
|
|
19682
|
-
const getPreserveModules = (config, warn, strictDeprecations) => {
|
|
19722
|
+
const getPreserveModules$1 = (config, warn, strictDeprecations) => {
|
|
19683
19723
|
const configPreserveModules = config.preserveModules;
|
|
19684
19724
|
if (configPreserveModules) {
|
|
19685
19725
|
warnDeprecationWithOptions('The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.', false, warn, strictDeprecations);
|
|
@@ -19698,7 +19738,8 @@ const getTreeshake = (config, warn, strictDeprecations) => {
|
|
|
19698
19738
|
return {
|
|
19699
19739
|
annotations: configTreeshake.annotations !== false,
|
|
19700
19740
|
moduleSideEffects: getHasModuleSideEffects(configTreeshake.moduleSideEffects, configTreeshake.pureExternalModules, warn),
|
|
19701
|
-
propertyReadSideEffects: configTreeshake.propertyReadSideEffects
|
|
19741
|
+
propertyReadSideEffects: configTreeshake.propertyReadSideEffects === 'always' && 'always' ||
|
|
19742
|
+
configTreeshake.propertyReadSideEffects !== false,
|
|
19702
19743
|
tryCatchDeoptimization: configTreeshake.tryCatchDeoptimization !== false,
|
|
19703
19744
|
unknownGlobalSideEffects: configTreeshake.unknownGlobalSideEffects !== false
|
|
19704
19745
|
};
|
|
@@ -19739,8 +19780,8 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
19739
19780
|
const unsetOptions = new Set(unsetInputOptions);
|
|
19740
19781
|
const compact = config.compact || false;
|
|
19741
19782
|
const format = getFormat(config);
|
|
19742
|
-
const inlineDynamicImports = getInlineDynamicImports
|
|
19743
|
-
const preserveModules = getPreserveModules
|
|
19783
|
+
const inlineDynamicImports = getInlineDynamicImports(config, inputOptions);
|
|
19784
|
+
const preserveModules = getPreserveModules(config, inlineDynamicImports, inputOptions);
|
|
19744
19785
|
const file = getFile(config, preserveModules, inputOptions);
|
|
19745
19786
|
const outputOptions = {
|
|
19746
19787
|
amd: getAmd(config),
|
|
@@ -19765,7 +19806,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
19765
19806
|
inlineDynamicImports,
|
|
19766
19807
|
interop: getInterop(config, inputOptions),
|
|
19767
19808
|
intro: getAddon(config, 'intro'),
|
|
19768
|
-
manualChunks: getManualChunks
|
|
19809
|
+
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules, inputOptions),
|
|
19769
19810
|
minifyInternalExports: getMinifyInternalExports(config, format, compact),
|
|
19770
19811
|
name: config.name,
|
|
19771
19812
|
namespaceToStringTag: config.namespaceToStringTag || false,
|
|
@@ -19829,7 +19870,7 @@ const getFormat = (config) => {
|
|
|
19829
19870
|
});
|
|
19830
19871
|
}
|
|
19831
19872
|
};
|
|
19832
|
-
const getInlineDynamicImports
|
|
19873
|
+
const getInlineDynamicImports = (config, inputOptions) => {
|
|
19833
19874
|
var _a;
|
|
19834
19875
|
const inlineDynamicImports = ((_a = config.inlineDynamicImports) !== null && _a !== void 0 ? _a : inputOptions.inlineDynamicImports) ||
|
|
19835
19876
|
false;
|
|
@@ -19842,7 +19883,7 @@ const getInlineDynamicImports$1 = (config, inputOptions) => {
|
|
|
19842
19883
|
}
|
|
19843
19884
|
return inlineDynamicImports;
|
|
19844
19885
|
};
|
|
19845
|
-
const getPreserveModules
|
|
19886
|
+
const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
|
|
19846
19887
|
var _a;
|
|
19847
19888
|
const preserveModules = ((_a = config.preserveModules) !== null && _a !== void 0 ? _a : inputOptions.preserveModules) || false;
|
|
19848
19889
|
if (preserveModules) {
|
|
@@ -19986,7 +20027,7 @@ const getInterop = (config, inputOptions) => {
|
|
|
19986
20027
|
}
|
|
19987
20028
|
return configInterop === undefined ? () => true : () => validateInterop(configInterop);
|
|
19988
20029
|
};
|
|
19989
|
-
const getManualChunks
|
|
20030
|
+
const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOptions) => {
|
|
19990
20031
|
const configManualChunks = config.manualChunks || inputOptions.manualChunks;
|
|
19991
20032
|
if (configManualChunks) {
|
|
19992
20033
|
if (inlineDynamicImports) {
|
|
@@ -20070,7 +20111,7 @@ async function getInputOptions(rawInputOptions, watchMode) {
|
|
|
20070
20111
|
function applyOptionHook(watchMode) {
|
|
20071
20112
|
return async (inputOptions, plugin) => {
|
|
20072
20113
|
if (plugin.options)
|
|
20073
|
-
return (plugin.options.call({ meta: { rollupVersion: version, watchMode } }, await inputOptions) || inputOptions);
|
|
20114
|
+
return (plugin.options.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions) || inputOptions);
|
|
20074
20115
|
return inputOptions;
|
|
20075
20116
|
};
|
|
20076
20117
|
}
|
|
@@ -20084,7 +20125,7 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
20084
20125
|
}
|
|
20085
20126
|
async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutputOptions, graph) {
|
|
20086
20127
|
const { options: outputOptions, outputPluginDriver, unsetOptions } = getOutputOptionsAndPluginDriver(rawOutputOptions, graph.pluginDriver, inputOptions, unsetInputOptions);
|
|
20087
|
-
const bundle = new Bundle
|
|
20128
|
+
const bundle = new Bundle(outputOptions, unsetOptions, inputOptions, outputPluginDriver, graph);
|
|
20088
20129
|
const generated = await bundle.generate(isWrite);
|
|
20089
20130
|
if (isWrite) {
|
|
20090
20131
|
if (!outputOptions.dir && !outputOptions.file) {
|
|
@@ -20220,4 +20261,4 @@ function watch(configs) {
|
|
|
20220
20261
|
return emitter;
|
|
20221
20262
|
}
|
|
20222
20263
|
|
|
20223
|
-
export { defaultOnWarn, ensureArray, fseventsImporter, getAugmentedNamespace, rollup, rollupInternal, version, warnUnknownOptions, watch };
|
|
20264
|
+
export { defaultOnWarn, ensureArray, fseventsImporter, getAugmentedNamespace, rollup, rollupInternal, version$1 as version, warnUnknownOptions, watch };
|