rollup 2.38.4 → 2.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.38.4
4
- Tue, 02 Feb 2021 05:54:38 GMT - commit 991bb98fad1f3f76226bfe6243fd6cc45a19a39b
3
+ Rollup.js v2.40.0
4
+ Fri, 26 Feb 2021 14:39:44 GMT - commit 0a0958ff926554abe9916178f56762ba71301ddd
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -10,16 +10,16 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
- var sysPath = require('path');
13
+ var path = require('path');
14
14
  var crypto = require('crypto');
15
15
  var fs = require('fs');
16
- var require$$0$1 = require('events');
16
+ var require$$0 = require('events');
17
17
 
18
18
  function _interopNamespaceDefaultOnly(e) {
19
19
  return {__proto__: null, 'default': e};
20
20
  }
21
21
 
22
- var version = "2.38.4";
22
+ var version$1 = "2.40.0";
23
23
 
24
24
  function ensureArray(items) {
25
25
  if (Array.isArray(items)) {
@@ -62,17 +62,21 @@ function normalize(path) {
62
62
  }
63
63
 
64
64
  function sanitizeFileName(name) {
65
- return name.replace(/[\0?*]/g, '_');
65
+ const match = /^[a-z]:/i.exec(name);
66
+ const driveLetter = match ? match[0] : "";
67
+ // A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
68
+ // Otherwise, avoid them because they can refer to NTFS alternate data streams.
69
+ return driveLetter + name.substr(driveLetter.length).replace(/[\0?*:]/g, '_');
66
70
  }
67
71
 
68
72
  function getAliasName(id) {
69
- const base = sysPath.basename(id);
70
- return base.substr(0, base.length - sysPath.extname(id).length);
73
+ const base = path.basename(id);
74
+ return base.substr(0, base.length - path.extname(id).length);
71
75
  }
72
76
  function relativeId(id) {
73
77
  if (!isAbsolute(id))
74
78
  return id;
75
- return sysPath.relative(sysPath.resolve(), id);
79
+ return path.relative(path.resolve(), id);
76
80
  }
77
81
  function isPlainPathFragment(name) {
78
82
  // not starting with "/", "./", "../"
@@ -106,10 +110,25 @@ var fseventsImporter = {
106
110
  getFsEvents: getFsEvents
107
111
  };
108
112
 
113
+ function getAugmentedNamespace(n) {
114
+ if (n.__esModule) return n;
115
+ var a = Object.defineProperty({}, '__esModule', {value: true});
116
+ Object.keys(n).forEach(function (k) {
117
+ var d = Object.getOwnPropertyDescriptor(n, k);
118
+ Object.defineProperty(a, k, d.get ? d : {
119
+ enumerable: true,
120
+ get: function () {
121
+ return n[k];
122
+ }
123
+ });
124
+ });
125
+ return a;
126
+ }
127
+
109
128
  var charToInteger = {};
110
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
111
- for (var i = 0; i < chars.length; i++) {
112
- charToInteger[chars.charCodeAt(i)] = i;
129
+ var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
130
+ for (var i = 0; i < chars$1.length; i++) {
131
+ charToInteger[chars$1.charCodeAt(i)] = i;
113
132
  }
114
133
  function decode(mappings) {
115
134
  var decoded = [];
@@ -223,7 +242,7 @@ function encodeInteger(num) {
223
242
  if (num > 0) {
224
243
  clamped |= 32;
225
244
  }
226
- result += chars[clamped];
245
+ result += chars$1[clamped];
227
246
  } while (num > 0);
228
247
  return result;
229
248
  }
@@ -240,7 +259,7 @@ BitSet.prototype.has = function has (n) {
240
259
  return !!(this.bits[n >> 5] & (1 << (n & 31)));
241
260
  };
242
261
 
243
- var Chunk = function Chunk(start, end, content) {
262
+ var Chunk$1 = function Chunk(start, end, content) {
244
263
  this.start = start;
245
264
  this.end = end;
246
265
  this.original = content;
@@ -259,16 +278,16 @@ var Chunk = function Chunk(start, end, content) {
259
278
  });
260
279
  };
261
280
 
262
- Chunk.prototype.appendLeft = function appendLeft (content) {
281
+ Chunk$1.prototype.appendLeft = function appendLeft (content) {
263
282
  this.outro += content;
264
283
  };
265
284
 
266
- Chunk.prototype.appendRight = function appendRight (content) {
285
+ Chunk$1.prototype.appendRight = function appendRight (content) {
267
286
  this.intro = this.intro + content;
268
287
  };
269
288
 
270
- Chunk.prototype.clone = function clone () {
271
- var chunk = new Chunk(this.start, this.end, this.original);
289
+ Chunk$1.prototype.clone = function clone () {
290
+ var chunk = new Chunk$1(this.start, this.end, this.original);
272
291
 
273
292
  chunk.intro = this.intro;
274
293
  chunk.outro = this.outro;
@@ -279,11 +298,11 @@ Chunk.prototype.clone = function clone () {
279
298
  return chunk;
280
299
  };
281
300
 
282
- Chunk.prototype.contains = function contains (index) {
301
+ Chunk$1.prototype.contains = function contains (index) {
283
302
  return this.start < index && index < this.end;
284
303
  };
285
304
 
286
- Chunk.prototype.eachNext = function eachNext (fn) {
305
+ Chunk$1.prototype.eachNext = function eachNext (fn) {
287
306
  var chunk = this;
288
307
  while (chunk) {
289
308
  fn(chunk);
@@ -291,7 +310,7 @@ Chunk.prototype.eachNext = function eachNext (fn) {
291
310
  }
292
311
  };
293
312
 
294
- Chunk.prototype.eachPrevious = function eachPrevious (fn) {
313
+ Chunk$1.prototype.eachPrevious = function eachPrevious (fn) {
295
314
  var chunk = this;
296
315
  while (chunk) {
297
316
  fn(chunk);
@@ -299,7 +318,7 @@ Chunk.prototype.eachPrevious = function eachPrevious (fn) {
299
318
  }
300
319
  };
301
320
 
302
- Chunk.prototype.edit = function edit (content, storeName, contentOnly) {
321
+ Chunk$1.prototype.edit = function edit (content, storeName, contentOnly) {
303
322
  this.content = content;
304
323
  if (!contentOnly) {
305
324
  this.intro = '';
@@ -312,15 +331,15 @@ Chunk.prototype.edit = function edit (content, storeName, contentOnly) {
312
331
  return this;
313
332
  };
314
333
 
315
- Chunk.prototype.prependLeft = function prependLeft (content) {
334
+ Chunk$1.prototype.prependLeft = function prependLeft (content) {
316
335
  this.outro = content + this.outro;
317
336
  };
318
337
 
319
- Chunk.prototype.prependRight = function prependRight (content) {
338
+ Chunk$1.prototype.prependRight = function prependRight (content) {
320
339
  this.intro = content + this.intro;
321
340
  };
322
341
 
323
- Chunk.prototype.split = function split (index) {
342
+ Chunk$1.prototype.split = function split (index) {
324
343
  var sliceIndex = index - this.start;
325
344
 
326
345
  var originalBefore = this.original.slice(0, sliceIndex);
@@ -328,7 +347,7 @@ Chunk.prototype.split = function split (index) {
328
347
 
329
348
  this.original = originalBefore;
330
349
 
331
- var newChunk = new Chunk(index, this.end, originalAfter);
350
+ var newChunk = new Chunk$1(index, this.end, originalAfter);
332
351
  newChunk.outro = this.outro;
333
352
  this.outro = '';
334
353
 
@@ -350,11 +369,11 @@ Chunk.prototype.split = function split (index) {
350
369
  return newChunk;
351
370
  };
352
371
 
353
- Chunk.prototype.toString = function toString () {
372
+ Chunk$1.prototype.toString = function toString () {
354
373
  return this.intro + this.content + this.outro;
355
374
  };
356
375
 
357
- Chunk.prototype.trimEnd = function trimEnd (rx) {
376
+ Chunk$1.prototype.trimEnd = function trimEnd (rx) {
358
377
  this.outro = this.outro.replace(rx, '');
359
378
  if (this.outro.length) { return true; }
360
379
 
@@ -374,7 +393,7 @@ Chunk.prototype.trimEnd = function trimEnd (rx) {
374
393
  }
375
394
  };
376
395
 
377
- Chunk.prototype.trimStart = function trimStart (rx) {
396
+ Chunk$1.prototype.trimStart = function trimStart (rx) {
378
397
  this.intro = this.intro.replace(rx, '');
379
398
  if (this.intro.length) { return true; }
380
399
 
@@ -466,13 +485,13 @@ function getRelativePath(from, to) {
466
485
  return fromParts.concat(toParts).join('/');
467
486
  }
468
487
 
469
- var toString = Object.prototype.toString;
488
+ var toString$1 = Object.prototype.toString;
470
489
 
471
490
  function isObject(thing) {
472
- return toString.call(thing) === '[object Object]';
491
+ return toString$1.call(thing) === '[object Object]';
473
492
  }
474
493
 
475
- function getLocator(source) {
494
+ function getLocator$1(source) {
476
495
  var originalLines = source.split('\n');
477
496
  var lineOffsets = [];
478
497
 
@@ -577,7 +596,7 @@ var warned = {
577
596
  var MagicString = function MagicString(string, options) {
578
597
  if ( options === void 0 ) options = {};
579
598
 
580
- var chunk = new Chunk(0, string.length, string);
599
+ var chunk = new Chunk$1(0, string.length, string);
581
600
 
582
601
  Object.defineProperties(this, {
583
602
  original: { writable: true, value: string },
@@ -686,7 +705,7 @@ MagicString.prototype.generateDecodedMap = function generateDecodedMap (options)
686
705
  var names = Object.keys(this.storedNames);
687
706
  var mappings = new Mappings(options.hires);
688
707
 
689
- var locate = getLocator(this.original);
708
+ var locate = getLocator$1(this.original);
690
709
 
691
710
  if (this.intro) {
692
711
  mappings.advance(this.intro);
@@ -922,7 +941,7 @@ MagicString.prototype.overwrite = function overwrite (start, end, content, optio
922
941
  }
923
942
  } else {
924
943
  // must be inserting at the end
925
- var newChunk = new Chunk(start, end, '').edit(content, storeName);
944
+ var newChunk = new Chunk$1(start, end, '').edit(content, storeName);
926
945
 
927
946
  // TODO last chunk in the array may not be the last chunk, if it's moved...
928
947
  last.next = newChunk;
@@ -1120,7 +1139,7 @@ MagicString.prototype._split = function _split (index) {
1120
1139
  MagicString.prototype._splitChunk = function _splitChunk (chunk, index) {
1121
1140
  if (chunk.edited && chunk.content.length) {
1122
1141
  // zero-length edited chunks are a special case (overlapping replacements)
1123
- var loc = getLocator(this.original)(index);
1142
+ var loc = getLocator$1(this.original)(index);
1124
1143
  throw new Error(
1125
1144
  ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
1126
1145
  );
@@ -1247,7 +1266,7 @@ MagicString.prototype.trimStart = function trimStart (charType) {
1247
1266
 
1248
1267
  var hasOwnProp = Object.prototype.hasOwnProperty;
1249
1268
 
1250
- var Bundle = function Bundle(options) {
1269
+ var Bundle$1 = function Bundle(options) {
1251
1270
  if ( options === void 0 ) options = {};
1252
1271
 
1253
1272
  this.intro = options.intro || '';
@@ -1257,7 +1276,7 @@ var Bundle = function Bundle(options) {
1257
1276
  this.uniqueSourceIndexByFilename = {};
1258
1277
  };
1259
1278
 
1260
- Bundle.prototype.addSource = function addSource (source) {
1279
+ Bundle$1.prototype.addSource = function addSource (source) {
1261
1280
  if (source instanceof MagicString) {
1262
1281
  return this.addSource({
1263
1282
  content: source,
@@ -1295,7 +1314,7 @@ Bundle.prototype.addSource = function addSource (source) {
1295
1314
  return this;
1296
1315
  };
1297
1316
 
1298
- Bundle.prototype.append = function append (str, options) {
1317
+ Bundle$1.prototype.append = function append (str, options) {
1299
1318
  this.addSource({
1300
1319
  content: new MagicString(str),
1301
1320
  separator: (options && options.separator) || ''
@@ -1304,8 +1323,8 @@ Bundle.prototype.append = function append (str, options) {
1304
1323
  return this;
1305
1324
  };
1306
1325
 
1307
- Bundle.prototype.clone = function clone () {
1308
- var bundle = new Bundle({
1326
+ Bundle$1.prototype.clone = function clone () {
1327
+ var bundle = new Bundle$1({
1309
1328
  intro: this.intro,
1310
1329
  separator: this.separator
1311
1330
  });
@@ -1321,7 +1340,7 @@ Bundle.prototype.clone = function clone () {
1321
1340
  return bundle;
1322
1341
  };
1323
1342
 
1324
- Bundle.prototype.generateDecodedMap = function generateDecodedMap (options) {
1343
+ Bundle$1.prototype.generateDecodedMap = function generateDecodedMap (options) {
1325
1344
  var this$1 = this;
1326
1345
  if ( options === void 0 ) options = {};
1327
1346
 
@@ -1345,7 +1364,7 @@ Bundle.prototype.generateDecodedMap = function generateDecodedMap (options) {
1345
1364
 
1346
1365
  var sourceIndex = source.filename ? this$1.uniqueSourceIndexByFilename[source.filename] : -1;
1347
1366
  var magicString = source.content;
1348
- var locate = getLocator(magicString.original);
1367
+ var locate = getLocator$1(magicString.original);
1349
1368
 
1350
1369
  if (magicString.intro) {
1351
1370
  mappings.advance(magicString.intro);
@@ -1398,11 +1417,11 @@ Bundle.prototype.generateDecodedMap = function generateDecodedMap (options) {
1398
1417
  };
1399
1418
  };
1400
1419
 
1401
- Bundle.prototype.generateMap = function generateMap (options) {
1420
+ Bundle$1.prototype.generateMap = function generateMap (options) {
1402
1421
  return new SourceMap(this.generateDecodedMap(options));
1403
1422
  };
1404
1423
 
1405
- Bundle.prototype.getIndentString = function getIndentString () {
1424
+ Bundle$1.prototype.getIndentString = function getIndentString () {
1406
1425
  var indentStringCounts = {};
1407
1426
 
1408
1427
  this.sources.forEach(function (source) {
@@ -1421,7 +1440,7 @@ Bundle.prototype.getIndentString = function getIndentString () {
1421
1440
  );
1422
1441
  };
1423
1442
 
1424
- Bundle.prototype.indent = function indent (indentStr) {
1443
+ Bundle$1.prototype.indent = function indent (indentStr) {
1425
1444
  var this$1 = this;
1426
1445
 
1427
1446
  if (!arguments.length) {
@@ -1455,12 +1474,12 @@ Bundle.prototype.indent = function indent (indentStr) {
1455
1474
  return this;
1456
1475
  };
1457
1476
 
1458
- Bundle.prototype.prepend = function prepend (str) {
1477
+ Bundle$1.prototype.prepend = function prepend (str) {
1459
1478
  this.intro = str + this.intro;
1460
1479
  return this;
1461
1480
  };
1462
1481
 
1463
- Bundle.prototype.toString = function toString () {
1482
+ Bundle$1.prototype.toString = function toString () {
1464
1483
  var this$1 = this;
1465
1484
 
1466
1485
  var body = this.sources
@@ -1475,7 +1494,7 @@ Bundle.prototype.toString = function toString () {
1475
1494
  return this.intro + body;
1476
1495
  };
1477
1496
 
1478
- Bundle.prototype.isEmpty = function isEmpty () {
1497
+ Bundle$1.prototype.isEmpty = function isEmpty () {
1479
1498
  if (this.intro.length && this.intro.trim())
1480
1499
  { return false; }
1481
1500
  if (this.sources.some(function (source) { return !source.content.isEmpty(); }))
@@ -1483,19 +1502,19 @@ Bundle.prototype.isEmpty = function isEmpty () {
1483
1502
  return true;
1484
1503
  };
1485
1504
 
1486
- Bundle.prototype.length = function length () {
1505
+ Bundle$1.prototype.length = function length () {
1487
1506
  return this.sources.reduce(function (length, source) { return length + source.content.length(); }, this.intro.length);
1488
1507
  };
1489
1508
 
1490
- Bundle.prototype.trimLines = function trimLines () {
1509
+ Bundle$1.prototype.trimLines = function trimLines () {
1491
1510
  return this.trim('[\\r\\n]');
1492
1511
  };
1493
1512
 
1494
- Bundle.prototype.trim = function trim (charType) {
1513
+ Bundle$1.prototype.trim = function trim (charType) {
1495
1514
  return this.trimStart(charType).trimEnd(charType);
1496
1515
  };
1497
1516
 
1498
- Bundle.prototype.trimStart = function trimStart (charType) {
1517
+ Bundle$1.prototype.trimStart = function trimStart (charType) {
1499
1518
  var rx = new RegExp('^' + (charType || '\\s') + '+');
1500
1519
  this.intro = this.intro.replace(rx, '');
1501
1520
 
@@ -1514,7 +1533,7 @@ Bundle.prototype.trimStart = function trimStart (charType) {
1514
1533
  return this;
1515
1534
  };
1516
1535
 
1517
- Bundle.prototype.trimEnd = function trimEnd (charType) {
1536
+ Bundle$1.prototype.trimEnd = function trimEnd (charType) {
1518
1537
  var rx = new RegExp((charType || '\\s') + '+$');
1519
1538
 
1520
1539
  var source;
@@ -1552,17 +1571,17 @@ function relative(from, to) {
1552
1571
  return toParts.join('/');
1553
1572
  }
1554
1573
 
1555
- const ArrowFunctionExpression = 'ArrowFunctionExpression';
1556
- const BlockStatement = 'BlockStatement';
1557
- const CallExpression = 'CallExpression';
1558
- const ExpressionStatement = 'ExpressionStatement';
1559
- const FunctionExpression = 'FunctionExpression';
1560
- const Identifier = 'Identifier';
1561
- const ImportDefaultSpecifier = 'ImportDefaultSpecifier';
1562
- const ImportNamespaceSpecifier = 'ImportNamespaceSpecifier';
1563
- const Program = 'Program';
1564
- const Property = 'Property';
1565
- const ReturnStatement = 'ReturnStatement';
1574
+ const ArrowFunctionExpression$1 = 'ArrowFunctionExpression';
1575
+ const BlockStatement$1 = 'BlockStatement';
1576
+ const CallExpression$1 = 'CallExpression';
1577
+ const ExpressionStatement$1 = 'ExpressionStatement';
1578
+ const Identifier$1 = 'Identifier';
1579
+ const ImportDefaultSpecifier$1 = 'ImportDefaultSpecifier';
1580
+ const ImportNamespaceSpecifier$1 = 'ImportNamespaceSpecifier';
1581
+ const NewExpression$1 = 'NewExpression';
1582
+ const Program$1 = 'Program';
1583
+ const Property$1 = 'Property';
1584
+ const ReturnStatement$1 = 'ReturnStatement';
1566
1585
 
1567
1586
  function treeshakeNode(node, code, start, end) {
1568
1587
  code.remove(start, end);
@@ -1578,7 +1597,7 @@ function treeshakeNode(node, code, start, end) {
1578
1597
  }
1579
1598
  }
1580
1599
  function removeAnnotations(node, code) {
1581
- if (!node.annotations && node.parent.type === ExpressionStatement) {
1600
+ if (!node.annotations && node.parent.type === ExpressionStatement$1) {
1582
1601
  node = node.parent;
1583
1602
  }
1584
1603
  if (node.annotations) {
@@ -1752,14 +1771,14 @@ function getSystemExportFunctionLeft(exportedVariables, setFromExpression, optio
1752
1771
  .join(`,${_}`)}${_}}),${_}v${s}${_}}(`;
1753
1772
  }
1754
1773
 
1755
- const chars$1 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
1756
- const base = 64;
1774
+ const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
1775
+ const base$1 = 64;
1757
1776
  function toBase64(num) {
1758
1777
  let outStr = '';
1759
1778
  do {
1760
- const curDigit = num % base;
1761
- num = Math.floor(num / base);
1762
- outStr = chars$1[curDigit] + outStr;
1779
+ const curDigit = num % base$1;
1780
+ num = Math.floor(num / base$1);
1781
+ outStr = chars[curDigit] + outStr;
1763
1782
  } while (num !== 0);
1764
1783
  return outStr;
1765
1784
  }
@@ -2494,7 +2513,7 @@ class LocalVariable extends Variable {
2494
2513
  // We do not want to properly include parents in case they are part of a dead branch
2495
2514
  // in which case .include() might pull in more dead code
2496
2515
  node.included = true;
2497
- if (node.type === Program)
2516
+ if (node.type === Program$1)
2498
2517
  break;
2499
2518
  node = node.parent;
2500
2519
  }
@@ -2518,7 +2537,7 @@ class LocalVariable extends Variable {
2518
2537
  }
2519
2538
  }
2520
2539
 
2521
- class Scope {
2540
+ class Scope$1 {
2522
2541
  constructor() {
2523
2542
  this.children = [];
2524
2543
  this.variables = new Map();
@@ -2543,7 +2562,7 @@ class Scope {
2543
2562
  }
2544
2563
  }
2545
2564
 
2546
- class ChildScope extends Scope {
2565
+ class ChildScope extends Scope$1 {
2547
2566
  constructor(parent) {
2548
2567
  super();
2549
2568
  this.accessedOutsideVariables = new Map();
@@ -2625,7 +2644,7 @@ class ChildScope extends Scope {
2625
2644
  }
2626
2645
  }
2627
2646
 
2628
- function getLocator$1(source, options) {
2647
+ function getLocator(source, options) {
2629
2648
  if (options === void 0) { options = {}; }
2630
2649
  var offsetLine = options.offsetLine || 0;
2631
2650
  var offsetColumn = options.offsetColumn || 0;
@@ -2663,7 +2682,7 @@ function locate(source, search, options) {
2663
2682
  if (typeof options === 'number') {
2664
2683
  throw new Error('locate takes a { startIndex, offsetLine, offsetColumn } object as the third argument');
2665
2684
  }
2666
- return getLocator$1(source, options)(search, options && options.startIndex);
2685
+ return getLocator(source, options)(search, options && options.startIndex);
2667
2686
  }
2668
2687
 
2669
2688
  const keys = {
@@ -3043,34 +3062,55 @@ class FunctionScope extends ReturnValueScope {
3043
3062
  }
3044
3063
  }
3045
3064
 
3046
- function isReference(node, parent) {
3047
- if (node.type === 'MemberExpression') {
3048
- return !node.computed && isReference(node.object, node);
3049
- }
3050
- if (node.type === 'Identifier') {
3051
- if (!parent)
3052
- return true;
3053
- switch (parent.type) {
3054
- // disregard `bar` in `foo.bar`
3055
- case 'MemberExpression': return parent.computed || node === parent.object;
3056
- // disregard the `foo` in `class {foo(){}}` but keep it in `class {[foo](){}}`
3057
- case 'MethodDefinition': return parent.computed;
3058
- // disregard the `foo` in `class {foo=bar}` but keep it in `class {[foo]=bar}` and `class {bar=foo}`
3059
- case 'FieldDefinition': return parent.computed || node === parent.value;
3060
- // disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }`
3061
- case 'Property': return parent.computed || node === parent.value;
3062
- // disregard the `bar` in `export { foo as bar }` or
3063
- // the foo in `import { foo as bar }`
3064
- case 'ExportSpecifier':
3065
- case 'ImportSpecifier': return node === parent.local;
3066
- // disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}`
3067
- case 'LabeledStatement':
3068
- case 'BreakStatement':
3069
- case 'ContinueStatement': return false;
3070
- default: return true;
3071
- }
3072
- }
3073
- return false;
3065
+ //@ts-check
3066
+ /** @typedef { import('estree').Node} Node */
3067
+ /** @typedef {Node | {
3068
+ * type: 'PropertyDefinition';
3069
+ * computed: boolean;
3070
+ * value: Node
3071
+ * }} NodeWithPropertyDefinition */
3072
+
3073
+ /**
3074
+ *
3075
+ * @param {NodeWithPropertyDefinition} node
3076
+ * @param {NodeWithPropertyDefinition} parent
3077
+ * @returns boolean
3078
+ */
3079
+ function is_reference (node, parent) {
3080
+ if (node.type === 'MemberExpression') {
3081
+ return !node.computed && is_reference(node.object, node);
3082
+ }
3083
+
3084
+ if (node.type === 'Identifier') {
3085
+ if (!parent) return true;
3086
+
3087
+ switch (parent.type) {
3088
+ // disregard `bar` in `foo.bar`
3089
+ case 'MemberExpression': return parent.computed || node === parent.object;
3090
+
3091
+ // disregard the `foo` in `class {foo(){}}` but keep it in `class {[foo](){}}`
3092
+ case 'MethodDefinition': return parent.computed;
3093
+
3094
+ // disregard the `foo` in `class {foo=bar}` but keep it in `class {[foo]=bar}` and `class {bar=foo}`
3095
+ case 'PropertyDefinition': return parent.computed || node === parent.value;
3096
+
3097
+ // disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }`
3098
+ case 'Property': return parent.computed || node === parent.value;
3099
+
3100
+ // disregard the `bar` in `export { foo as bar }` or
3101
+ // the foo in `import { foo as bar }`
3102
+ case 'ExportSpecifier':
3103
+ case 'ImportSpecifier': return node === parent.local;
3104
+
3105
+ // disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}`
3106
+ case 'LabeledStatement':
3107
+ case 'BreakStatement':
3108
+ case 'ContinueStatement': return false;
3109
+ default: return true;
3110
+ }
3111
+ }
3112
+
3113
+ return false;
3074
3114
  }
3075
3115
 
3076
3116
  const BLANK = Object.freeze(Object.create(null));
@@ -3958,7 +3998,7 @@ class GlobalVariable extends Variable {
3958
3998
  }
3959
3999
  }
3960
4000
 
3961
- class Identifier$1 extends NodeBase {
4001
+ class Identifier extends NodeBase {
3962
4002
  constructor() {
3963
4003
  super(...arguments);
3964
4004
  this.variable = null;
@@ -3973,7 +4013,7 @@ class Identifier$1 extends NodeBase {
3973
4013
  if (this.bound)
3974
4014
  return;
3975
4015
  this.bound = true;
3976
- if (this.variable === null && isReference(this, this.parent)) {
4016
+ if (this.variable === null && is_reference(this, this.parent)) {
3977
4017
  this.variable = this.scope.findVariable(this.name);
3978
4018
  this.variable.addReference(this);
3979
4019
  }
@@ -4065,7 +4105,7 @@ class Identifier$1 extends NodeBase {
4065
4105
  }
4066
4106
  // In strict mode, any variable named "eval" must be the actual "eval" function
4067
4107
  if (name === 'eval' &&
4068
- renderedParentType === CallExpression &&
4108
+ renderedParentType === CallExpression$1 &&
4069
4109
  isCalleeOfRenderedParent) {
4070
4110
  code.appendRight(this.start, '0, ');
4071
4111
  }
@@ -4177,7 +4217,7 @@ class FunctionNode extends NodeBase {
4177
4217
  this.id.include();
4178
4218
  const hasArguments = this.scope.argumentsVariable.included;
4179
4219
  for (const param of this.params) {
4180
- if (!(param instanceof Identifier$1) || hasArguments) {
4220
+ if (!(param instanceof Identifier) || hasArguments) {
4181
4221
  param.include(context, includeChildrenRecursively);
4182
4222
  }
4183
4223
  }
@@ -4267,7 +4307,7 @@ class ExportDefaultDeclaration extends NodeBase {
4267
4307
  code.remove(this.start, declarationStart);
4268
4308
  this.declaration.render(code, options, {
4269
4309
  isCalleeOfRenderedParent: false,
4270
- renderedParentType: ExpressionStatement
4310
+ renderedParentType: ExpressionStatement$1
4271
4311
  });
4272
4312
  if (code.original[this.end - 1] !== ';') {
4273
4313
  code.appendLeft(this.end, ';');
@@ -4327,7 +4367,7 @@ class ExportDefaultVariable extends LocalVariable {
4327
4367
  this.hasId = true;
4328
4368
  this.originalId = declaration.id;
4329
4369
  }
4330
- else if (declaration instanceof Identifier$1) {
4370
+ else if (declaration instanceof Identifier) {
4331
4371
  this.originalId = declaration;
4332
4372
  }
4333
4373
  }
@@ -4561,9 +4601,9 @@ class ExternalVariable extends Variable {
4561
4601
  }
4562
4602
  }
4563
4603
 
4564
- 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(' ');
4565
- 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(' ');
4566
- const blacklisted = new Set(reservedWords.concat(builtins));
4604
+ 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(' ');
4605
+ 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(' ');
4606
+ const blacklisted = new Set(reservedWords$1.concat(builtins$1));
4567
4607
  const illegalCharacters = /[^$_a-zA-Z0-9]/g;
4568
4608
  const startsWithDigit = (str) => /\d/.test(str[0]);
4569
4609
  function isLegal(str) {
@@ -4636,7 +4676,7 @@ class ExternalModule {
4636
4676
  this.renderPath = this.id;
4637
4677
  }
4638
4678
  else {
4639
- this.renderPath = normalize(sysPath.relative(inputBase, this.id));
4679
+ this.renderPath = normalize(path.relative(inputBase, this.id));
4640
4680
  this.renormalizeRenderPath = true;
4641
4681
  }
4642
4682
  }
@@ -4782,38 +4822,13 @@ function getFrozen(fragment, freeze) {
4782
4822
  }
4783
4823
  const HELPER_NAMES = Object.keys(HELPER_GENERATORS);
4784
4824
 
4785
- function getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, mechanism = 'return ') {
4825
+ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, mechanism = 'return ') {
4786
4826
  const _ = compact ? '' : ' ';
4787
4827
  const n = compact ? '' : '\n';
4788
4828
  if (!namedExportsMode) {
4789
4829
  return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings)};`;
4790
4830
  }
4791
4831
  let exportBlock = '';
4792
- // star exports must always output first for precedence
4793
- for (const { name, reexports } of dependencies) {
4794
- if (reexports && namedExportsMode) {
4795
- for (const specifier of reexports) {
4796
- if (specifier.reexported === '*') {
4797
- if (exportBlock)
4798
- exportBlock += n;
4799
- if (specifier.needsLiveBinding) {
4800
- exportBlock +=
4801
- `Object.keys(${name}).forEach(function${_}(k)${_}{${n}` +
4802
- `${t}if${_}(k${_}!==${_}'default')${_}Object.defineProperty(exports,${_}k,${_}{${n}` +
4803
- `${t}${t}enumerable:${_}true,${n}` +
4804
- `${t}${t}get:${_}function${_}()${_}{${n}` +
4805
- `${t}${t}${t}return ${name}[k];${n}` +
4806
- `${t}${t}}${n}${t}});${n}});`;
4807
- }
4808
- else {
4809
- exportBlock +=
4810
- `Object.keys(${name}).forEach(function${_}(k)${_}{${n}` +
4811
- `${t}if${_}(k${_}!==${_}'default')${_}exports[k]${_}=${_}${name}[k];${n}});`;
4812
- }
4813
- }
4814
- }
4815
- }
4816
- }
4817
4832
  for (const { defaultVariableName, id, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
4818
4833
  if (reexports && namedExportsMode) {
4819
4834
  for (const specifier of reexports) {
@@ -4841,6 +4856,30 @@ function getExportBlock(exports, dependencies, namedExportsMode, interop, compac
4841
4856
  exportBlock += `${lhs}${_}=${_}${rhs};`;
4842
4857
  }
4843
4858
  }
4859
+ for (const { name, reexports } of dependencies) {
4860
+ if (reexports && namedExportsMode) {
4861
+ for (const specifier of reexports) {
4862
+ if (specifier.reexported === '*') {
4863
+ if (exportBlock)
4864
+ exportBlock += n;
4865
+ if (specifier.needsLiveBinding) {
4866
+ exportBlock +=
4867
+ `Object.keys(${name}).forEach(function${_}(k)${_}{${n}` +
4868
+ `${t}if${_}(k${_}!==${_}'default'${_}&&${_}!exports.hasOwnProperty(k))${_}Object.defineProperty(exports,${_}k,${_}{${n}` +
4869
+ `${t}${t}enumerable:${_}true,${n}` +
4870
+ `${t}${t}get:${_}function${_}()${_}{${n}` +
4871
+ `${t}${t}${t}return ${name}[k];${n}` +
4872
+ `${t}${t}}${n}${t}});${n}});`;
4873
+ }
4874
+ else {
4875
+ exportBlock +=
4876
+ `Object.keys(${name}).forEach(function${_}(k)${_}{${n}` +
4877
+ `${t}if${_}(k${_}!==${_}'default'${_}&&${_}!exports.hasOwnProperty(k))${_}exports[k]${_}=${_}${name}[k];${n}});`;
4878
+ }
4879
+ }
4880
+ }
4881
+ }
4882
+ }
4844
4883
  if (exportBlock) {
4845
4884
  return `${n}${n}${exportBlock}`;
4846
4885
  }
@@ -4965,7 +5004,7 @@ function removeExtensionFromRelativeAmdId(id) {
4965
5004
  return id[0] === '.' ? removeJsExtension(id) : id;
4966
5005
  }
4967
5006
 
4968
- const builtins$1 = {
5007
+ const builtins = {
4969
5008
  assert: true,
4970
5009
  buffer: true,
4971
5010
  console: true,
@@ -4989,7 +5028,7 @@ const builtins$1 = {
4989
5028
  zlib: true
4990
5029
  };
4991
5030
  function warnOnBuiltins(warn, dependencies) {
4992
- const externalBuiltins = dependencies.map(({ id }) => id).filter(id => id in builtins$1);
5031
+ const externalBuiltins = dependencies.map(({ id }) => id).filter(id => id in builtins);
4993
5032
  if (!externalBuiltins.length)
4994
5033
  return;
4995
5034
  const detail = externalBuiltins.length === 1
@@ -5029,7 +5068,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
5029
5068
  (deps.length ? `[${deps.join(`,${_}`)}],${_}` : ``);
5030
5069
  const useStrict = strict ? `${_}'use strict';` : '';
5031
5070
  magicString.prepend(`${intro}${getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t)}`);
5032
- const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
5071
+ const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
5033
5072
  let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, _, n);
5034
5073
  if (namespaceMarkers) {
5035
5074
  namespaceMarkers = n + n + namespaceMarkers;
@@ -5050,13 +5089,13 @@ function cjs(magicString, { accessedGlobals, dependencies, exports, hasExports,
5050
5089
  if (namespaceMarkers) {
5051
5090
  namespaceMarkers += n + n;
5052
5091
  }
5053
- const importBlock = getImportBlock(dependencies, compact, varOrConst, n, _);
5092
+ const importBlock = getImportBlock$1(dependencies, compact, varOrConst, n, _);
5054
5093
  const interopBlock = getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t);
5055
5094
  magicString.prepend(`${useStrict}${intro}${namespaceMarkers}${importBlock}${interopBlock}`);
5056
- const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, `module.exports${_}=${_}`);
5095
+ const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, `module.exports${_}=${_}`);
5057
5096
  return magicString.append(`${exportBlock}${outro}`);
5058
5097
  }
5059
- function getImportBlock(dependencies, compact, varOrConst, n, _) {
5098
+ function getImportBlock$1(dependencies, compact, varOrConst, n, _) {
5060
5099
  let importBlock = '';
5061
5100
  let definingVariable = false;
5062
5101
  for (const { id, name, reexports, imports } of dependencies) {
@@ -5083,19 +5122,19 @@ function getImportBlock(dependencies, compact, varOrConst, n, _) {
5083
5122
  function es(magicString, { intro, outro, dependencies, exports, varOrConst }, { compact }) {
5084
5123
  const _ = compact ? '' : ' ';
5085
5124
  const n = compact ? '' : '\n';
5086
- const importBlock = getImportBlock$1(dependencies, _);
5125
+ const importBlock = getImportBlock(dependencies, _);
5087
5126
  if (importBlock.length > 0)
5088
5127
  intro += importBlock.join(n) + n + n;
5089
5128
  if (intro)
5090
5129
  magicString.prepend(intro);
5091
- const exportBlock = getExportBlock$1(exports, _, varOrConst);
5130
+ const exportBlock = getExportBlock(exports, _, varOrConst);
5092
5131
  if (exportBlock.length)
5093
5132
  magicString.append(n + n + exportBlock.join(n).trim());
5094
5133
  if (outro)
5095
5134
  magicString.append(outro);
5096
5135
  return magicString.trim();
5097
5136
  }
5098
- function getImportBlock$1(dependencies, _) {
5137
+ function getImportBlock(dependencies, _) {
5099
5138
  const importBlock = [];
5100
5139
  for (const { id, reexports, imports, name } of dependencies) {
5101
5140
  if (!reexports && !imports) {
@@ -5179,7 +5218,7 @@ function getImportBlock$1(dependencies, _) {
5179
5218
  }
5180
5219
  return importBlock;
5181
5220
  }
5182
- function getExportBlock$1(exports, _, varOrConst) {
5221
+ function getExportBlock(exports, _, varOrConst) {
5183
5222
  const exportBlock = [];
5184
5223
  const exportDeclaration = [];
5185
5224
  for (const specifier of exports) {
@@ -5265,6 +5304,7 @@ var Errors;
5265
5304
  Errors["BAD_LOADER"] = "BAD_LOADER";
5266
5305
  Errors["CANNOT_EMIT_FROM_OPTIONS_HOOK"] = "CANNOT_EMIT_FROM_OPTIONS_HOOK";
5267
5306
  Errors["CHUNK_NOT_GENERATED"] = "CHUNK_NOT_GENERATED";
5307
+ Errors["CHUNK_INVALID"] = "CHUNK_INVALID";
5268
5308
  Errors["CIRCULAR_REEXPORT"] = "CIRCULAR_REEXPORT";
5269
5309
  Errors["CYCLIC_CROSS_CHUNK_REEXPORT"] = "CYCLIC_CROSS_CHUNK_REEXPORT";
5270
5310
  Errors["DEPRECATED_FEATURE"] = "DEPRECATED_FEATURE";
@@ -5309,6 +5349,14 @@ function errChunkNotGeneratedForFileName(name) {
5309
5349
  message: `Plugin error - Unable to get file name for chunk "${name}". Ensure that generate is called first.`
5310
5350
  };
5311
5351
  }
5352
+ function errChunkInvalid({ fileName, code }, exception) {
5353
+ const errorProps = {
5354
+ code: Errors.CHUNK_INVALID,
5355
+ message: `Chunk "${fileName}" is not valid JavaScript: ${exception.message}.`
5356
+ };
5357
+ augmentCodeLocation(errorProps, exception.loc, code, fileName);
5358
+ return errorProps;
5359
+ }
5312
5360
  function errCircularReexport(exportName, importedModule) {
5313
5361
  return {
5314
5362
  code: Errors.CIRCULAR_REEXPORT,
@@ -5665,7 +5713,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
5665
5713
  if (hasExports && !extend && namedExportsMode) {
5666
5714
  wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
5667
5715
  }
5668
- const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
5716
+ const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
5669
5717
  let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, _, n);
5670
5718
  if (namespaceMarkers) {
5671
5719
  namespaceMarkers = n + n + namespaceMarkers;
@@ -5906,7 +5954,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
5906
5954
  `}(${globalArg}(function${_}(${factoryArgs.join(', ')})${_}{${useStrict}${n}`;
5907
5955
  const wrapperOutro = n + n + '})));';
5908
5956
  magicString.prepend(`${intro}${getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t)}`);
5909
- const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
5957
+ const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
5910
5958
  let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, _, n);
5911
5959
  if (namespaceMarkers) {
5912
5960
  namespaceMarkers = n + n + namespaceMarkers;
@@ -6036,11 +6084,11 @@ class BlockScope extends ChildScope {
6036
6084
  }
6037
6085
  }
6038
6086
 
6039
- class ExpressionStatement$1 extends NodeBase {
6087
+ class ExpressionStatement extends NodeBase {
6040
6088
  initialise() {
6041
6089
  if (this.directive &&
6042
6090
  this.directive !== 'use strict' &&
6043
- this.parent.type === Program) {
6091
+ this.parent.type === Program$1) {
6044
6092
  this.context.warn(
6045
6093
  // This is necessary, because either way (deleting or not) can lead to errors.
6046
6094
  {
@@ -6056,19 +6104,19 @@ class ExpressionStatement$1 extends NodeBase {
6056
6104
  }
6057
6105
  shouldBeIncluded(context) {
6058
6106
  if (this.directive && this.directive !== 'use strict')
6059
- return this.parent.type !== Program;
6107
+ return this.parent.type !== Program$1;
6060
6108
  return super.shouldBeIncluded(context);
6061
6109
  }
6062
6110
  }
6063
6111
 
6064
- class BlockStatement$1 extends NodeBase {
6112
+ class BlockStatement extends NodeBase {
6065
6113
  constructor() {
6066
6114
  super(...arguments);
6067
6115
  this.directlyIncluded = false;
6068
6116
  }
6069
6117
  addImplicitReturnExpressionToScope() {
6070
6118
  const lastStatement = this.body[this.body.length - 1];
6071
- if (!lastStatement || lastStatement.type !== ReturnStatement) {
6119
+ if (!lastStatement || lastStatement.type !== ReturnStatement$1) {
6072
6120
  this.scope.addReturnExpression(UNKNOWN_EXPRESSION);
6073
6121
  }
6074
6122
  }
@@ -6103,7 +6151,7 @@ class BlockStatement$1 extends NodeBase {
6103
6151
  initialise() {
6104
6152
  const firstBodyStatement = this.body[0];
6105
6153
  this.deoptimizeBody =
6106
- firstBodyStatement instanceof ExpressionStatement$1 &&
6154
+ firstBodyStatement instanceof ExpressionStatement &&
6107
6155
  firstBodyStatement.directive === 'use asm';
6108
6156
  }
6109
6157
  render(code, options) {
@@ -6116,7 +6164,7 @@ class BlockStatement$1 extends NodeBase {
6116
6164
  }
6117
6165
  }
6118
6166
 
6119
- class ArrowFunctionExpression$1 extends NodeBase {
6167
+ class ArrowFunctionExpression extends NodeBase {
6120
6168
  createScope(parentScope) {
6121
6169
  this.scope = new ReturnValueScope(parentScope, this.context);
6122
6170
  }
@@ -6162,7 +6210,7 @@ class ArrowFunctionExpression$1 extends NodeBase {
6162
6210
  include(context, includeChildrenRecursively) {
6163
6211
  this.included = true;
6164
6212
  for (const param of this.params) {
6165
- if (!(param instanceof Identifier$1)) {
6213
+ if (!(param instanceof Identifier)) {
6166
6214
  param.include(context, includeChildrenRecursively);
6167
6215
  }
6168
6216
  }
@@ -6176,7 +6224,7 @@ class ArrowFunctionExpression$1 extends NodeBase {
6176
6224
  }
6177
6225
  initialise() {
6178
6226
  this.scope.addParameterVariables(this.params.map(param => param.declare('parameter', UNKNOWN_EXPRESSION)), this.params[this.params.length - 1] instanceof RestElement);
6179
- if (this.body instanceof BlockStatement$1) {
6227
+ if (this.body instanceof BlockStatement) {
6180
6228
  this.body.addImplicitReturnExpressionToScope();
6181
6229
  }
6182
6230
  else {
@@ -6184,13 +6232,13 @@ class ArrowFunctionExpression$1 extends NodeBase {
6184
6232
  }
6185
6233
  }
6186
6234
  parseNode(esTreeNode) {
6187
- if (esTreeNode.body.type === BlockStatement) {
6235
+ if (esTreeNode.body.type === BlockStatement$1) {
6188
6236
  this.body = new this.context.nodeConstructors.BlockStatement(esTreeNode.body, this, this.scope.hoistedBodyVarScope);
6189
6237
  }
6190
6238
  super.parseNode(esTreeNode);
6191
6239
  }
6192
6240
  }
6193
- ArrowFunctionExpression$1.prototype.preventChildBlockScope = true;
6241
+ ArrowFunctionExpression.prototype.preventChildBlockScope = true;
6194
6242
 
6195
6243
  class AssignmentExpression extends NodeBase {
6196
6244
  constructor() {
@@ -6222,17 +6270,20 @@ class AssignmentExpression extends NodeBase {
6222
6270
  }
6223
6271
  this.right.include(context, includeChildrenRecursively);
6224
6272
  }
6225
- render(code, options, { renderedParentType } = BLANK) {
6273
+ render(code, options, { preventASI, renderedParentType } = BLANK) {
6226
6274
  if (this.left.included) {
6227
6275
  this.left.render(code, options);
6228
6276
  this.right.render(code, options);
6229
6277
  }
6230
6278
  else {
6279
+ const inclusionStart = findNonWhiteSpace(code.original, findFirstOccurrenceOutsideComment(code.original, '=', this.left.end) + 1);
6280
+ code.remove(this.start, inclusionStart);
6281
+ if (preventASI) {
6282
+ removeLineBreaks(code, inclusionStart, this.right.start);
6283
+ }
6231
6284
  this.right.render(code, options, {
6232
6285
  renderedParentType: renderedParentType || this.parent.type
6233
6286
  });
6234
- const operatorPos = findFirstOccurrenceOutsideComment(code.original, '=', this.left.end);
6235
- code.remove(this.start, findNonWhiteSpace(code.original, operatorPos + 1));
6236
6287
  }
6237
6288
  if (options.format === 'system') {
6238
6289
  const exportNames = this.left.variable && options.exportNamesByVariable.get(this.left.variable);
@@ -6249,8 +6300,8 @@ class AssignmentExpression extends NodeBase {
6249
6300
  const systemPatternExports = [];
6250
6301
  this.left.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
6251
6302
  if (systemPatternExports.length > 0) {
6252
- code.prependRight(this.start, getSystemExportFunctionLeft(systemPatternExports, true, options));
6253
- code.appendLeft(this.end, ')');
6303
+ code.prependRight(this.start, `(${getSystemExportFunctionLeft(systemPatternExports, true, options)}`);
6304
+ code.appendLeft(this.end, '))');
6254
6305
  }
6255
6306
  }
6256
6307
  }
@@ -6296,7 +6347,7 @@ class AwaitExpression extends NodeBase {
6296
6347
  checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
6297
6348
  let parent = this.parent;
6298
6349
  do {
6299
- if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression$1)
6350
+ if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression)
6300
6351
  break checkTopLevelAwait;
6301
6352
  } while ((parent = parent.parent));
6302
6353
  this.context.usesTopLevelAwait = true;
@@ -6350,7 +6401,7 @@ class BinaryExpression extends NodeBase {
6350
6401
  hasEffects(context) {
6351
6402
  // support some implicit type coercion runtime errors
6352
6403
  if (this.operator === '+' &&
6353
- this.parent instanceof ExpressionStatement$1 &&
6404
+ this.parent instanceof ExpressionStatement &&
6354
6405
  this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) === '')
6355
6406
  return true;
6356
6407
  return super.hasEffects(context);
@@ -6447,7 +6498,7 @@ function getPathIfNotComputed(memberExpression) {
6447
6498
  const nextPathKey = memberExpression.propertyKey;
6448
6499
  const object = memberExpression.object;
6449
6500
  if (typeof nextPathKey === 'string') {
6450
- if (object instanceof Identifier$1) {
6501
+ if (object instanceof Identifier) {
6451
6502
  return [
6452
6503
  { key: object.name, pos: object.start },
6453
6504
  { key: nextPathKey, pos: memberExpression.property.start }
@@ -6599,8 +6650,8 @@ class MemberExpression extends NodeBase {
6599
6650
  initialise() {
6600
6651
  this.propertyKey = getResolvablePropertyKey(this);
6601
6652
  }
6602
- render(code, options, { renderedParentType, isCalleeOfRenderedParent } = BLANK) {
6603
- const isCalleeOfDifferentParent = renderedParentType === CallExpression && isCalleeOfRenderedParent;
6653
+ render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
6654
+ const isCalleeOfDifferentParent = renderedParentType === CallExpression$1 && isCalleeOfRenderedParent;
6604
6655
  if (this.variable || this.replacement) {
6605
6656
  let replacement = this.variable ? this.variable.getName() : this.replacement;
6606
6657
  if (isCalleeOfDifferentParent)
@@ -6614,11 +6665,13 @@ class MemberExpression extends NodeBase {
6614
6665
  if (isCalleeOfDifferentParent) {
6615
6666
  code.appendRight(this.start, '0, ');
6616
6667
  }
6617
- super.render(code, options);
6668
+ const surroundingElement = renderedParentType || renderedSurroundingElement;
6669
+ this.object.render(code, options, surroundingElement ? { renderedSurroundingElement: surroundingElement } : BLANK);
6670
+ this.property.render(code, options);
6618
6671
  }
6619
6672
  }
6620
6673
  disallowNamespaceReassignment() {
6621
- if (this.object instanceof Identifier$1) {
6674
+ if (this.object instanceof Identifier) {
6622
6675
  const variable = this.scope.findVariable(this.object.name);
6623
6676
  if (variable.isNamespace) {
6624
6677
  if (this.variable) {
@@ -6666,7 +6719,7 @@ class MemberExpression extends NodeBase {
6666
6719
  }
6667
6720
  }
6668
6721
 
6669
- class CallExpression$1 extends NodeBase {
6722
+ class CallExpression extends NodeBase {
6670
6723
  constructor() {
6671
6724
  super(...arguments);
6672
6725
  this.expressionsToBeDeoptimized = [];
@@ -6675,7 +6728,7 @@ class CallExpression$1 extends NodeBase {
6675
6728
  }
6676
6729
  bind() {
6677
6730
  super.bind();
6678
- if (this.callee instanceof Identifier$1) {
6731
+ if (this.callee instanceof Identifier) {
6679
6732
  const variable = this.scope.findVariable(this.callee.name);
6680
6733
  if (variable.isNamespace) {
6681
6734
  this.context.warn({
@@ -6806,7 +6859,7 @@ class CallExpression$1 extends NodeBase {
6806
6859
  if (includeChildrenRecursively) {
6807
6860
  super.include(context, includeChildrenRecursively);
6808
6861
  if (includeChildrenRecursively === INCLUDE_PARAMETERS &&
6809
- this.callee instanceof Identifier$1 &&
6862
+ this.callee instanceof Identifier &&
6810
6863
  this.callee.variable) {
6811
6864
  this.callee.variable.markCalledFromTryStatement();
6812
6865
  }
@@ -6826,8 +6879,9 @@ class CallExpression$1 extends NodeBase {
6826
6879
  withNew: false
6827
6880
  };
6828
6881
  }
6829
- render(code, options, { renderedParentType } = BLANK) {
6830
- this.callee.render(code, options);
6882
+ render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
6883
+ const surroundingELement = renderedParentType || renderedSurroundingElement;
6884
+ this.callee.render(code, options, surroundingELement ? { renderedSurroundingElement: surroundingELement } : BLANK);
6831
6885
  if (this.arguments.length > 0) {
6832
6886
  if (this.arguments[this.arguments.length - 1].included) {
6833
6887
  for (const arg of this.arguments) {
@@ -6850,11 +6904,6 @@ class CallExpression$1 extends NodeBase {
6850
6904
  }
6851
6905
  }
6852
6906
  }
6853
- if (renderedParentType === ExpressionStatement &&
6854
- this.callee.type === FunctionExpression) {
6855
- code.appendRight(this.start, '(');
6856
- code.prependLeft(this.end, ')');
6857
- }
6858
6907
  }
6859
6908
  getReturnExpression(recursionTracker) {
6860
6909
  if (this.returnExpression === null) {
@@ -6932,6 +6981,14 @@ class ClassBody extends NodeBase {
6932
6981
  }
6933
6982
 
6934
6983
  class ClassExpression extends ClassNode {
6984
+ render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
6985
+ super.render(code, options);
6986
+ const surroundingElement = renderedParentType || renderedSurroundingElement;
6987
+ if (surroundingElement === ExpressionStatement$1) {
6988
+ code.appendRight(this.start, '(');
6989
+ code.prependLeft(this.end, ')');
6990
+ }
6991
+ }
6935
6992
  }
6936
6993
 
6937
6994
  class MultiExpression {
@@ -7098,9 +7155,9 @@ class ConditionalExpression extends NodeBase {
7098
7155
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, preventASI } = BLANK) {
7099
7156
  if (!this.test.included) {
7100
7157
  const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
7101
- const inclusionStart = (this.consequent.included
7158
+ const inclusionStart = findNonWhiteSpace(code.original, (this.consequent.included
7102
7159
  ? findFirstOccurrenceOutsideComment(code.original, '?', this.test.end)
7103
- : colonPos) + 1;
7160
+ : colonPos) + 1);
7104
7161
  if (preventASI) {
7105
7162
  removeLineBreaks(code, inclusionStart, this.usedBranch.start);
7106
7163
  }
@@ -7215,13 +7272,6 @@ ExportNamedDeclaration.prototype.needsBoundaries = true;
7215
7272
  class ExportSpecifier extends NodeBase {
7216
7273
  }
7217
7274
 
7218
- class FieldDefinition extends NodeBase {
7219
- hasEffects(context) {
7220
- return (this.key.hasEffects(context) ||
7221
- (this.static && this.value !== null && this.value.hasEffects(context)));
7222
- }
7223
- }
7224
-
7225
7275
  class ForInStatement extends NodeBase {
7226
7276
  bind() {
7227
7277
  this.left.bind();
@@ -7344,7 +7394,15 @@ class ForStatement extends NodeBase {
7344
7394
  }
7345
7395
  }
7346
7396
 
7347
- class FunctionExpression$1 extends FunctionNode {
7397
+ class FunctionExpression extends FunctionNode {
7398
+ render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
7399
+ super.render(code, options);
7400
+ const surroundingElement = renderedParentType || renderedSurroundingElement;
7401
+ if (surroundingElement === ExpressionStatement$1) {
7402
+ code.appendRight(this.start, '(');
7403
+ code.prependLeft(this.end, ')');
7404
+ }
7405
+ }
7348
7406
  }
7349
7407
 
7350
7408
  class TrackingScope extends BlockScope {
@@ -7510,7 +7568,7 @@ class IfStatement extends NodeBase {
7510
7568
  .join(', ');
7511
7569
  if (hoistedVars) {
7512
7570
  const parentType = this.parent.type;
7513
- const needsBraces = parentType !== Program && parentType !== BlockStatement;
7571
+ const needsBraces = parentType !== Program$1 && parentType !== BlockStatement$1;
7514
7572
  code.prependRight(this.start, `${needsBraces ? '{ ' : ''}var ${hoistedVars}; `);
7515
7573
  if (needsBraces) {
7516
7574
  code.appendLeft(this.end, ` }`);
@@ -7523,7 +7581,7 @@ class IfStatement extends NodeBase {
7523
7581
  if (currentParent instanceof IfStatement && currentParent.alternate) {
7524
7582
  return true;
7525
7583
  }
7526
- if (currentParent instanceof BlockStatement$1) {
7584
+ if (currentParent instanceof BlockStatement) {
7527
7585
  return false;
7528
7586
  }
7529
7587
  currentParent = currentParent.parent;
@@ -7546,7 +7604,7 @@ class ImportDeclaration extends NodeBase {
7546
7604
  }
7547
7605
  ImportDeclaration.prototype.needsBoundaries = true;
7548
7606
 
7549
- class ImportDefaultSpecifier$1 extends NodeBase {
7607
+ class ImportDefaultSpecifier extends NodeBase {
7550
7608
  }
7551
7609
 
7552
7610
  class ImportExpression extends NodeBase {
@@ -7688,7 +7746,7 @@ const accessedImportGlobals = {
7688
7746
  system: ['module']
7689
7747
  };
7690
7748
 
7691
- class ImportNamespaceSpecifier$1 extends NodeBase {
7749
+ class ImportNamespaceSpecifier extends NodeBase {
7692
7750
  }
7693
7751
 
7694
7752
  class ImportSpecifier extends NodeBase {
@@ -7722,7 +7780,7 @@ class LabeledStatement extends NodeBase {
7722
7780
  this.label.render(code, options);
7723
7781
  }
7724
7782
  else {
7725
- code.remove(this.start, findFirstOccurrenceOutsideComment(code.original, ':', this.label.end) + 1);
7783
+ code.remove(this.start, findNonWhiteSpace(code.original, findFirstOccurrenceOutsideComment(code.original, ':', this.label.end) + 1));
7726
7784
  }
7727
7785
  this.body.render(code, options);
7728
7786
  }
@@ -7834,9 +7892,10 @@ class LogicalExpression extends NodeBase {
7834
7892
  if (!this.left.included || !this.right.included) {
7835
7893
  const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
7836
7894
  if (this.right.included) {
7837
- code.remove(this.start, operatorPos + 2);
7895
+ const removePos = findNonWhiteSpace(code.original, operatorPos + 2);
7896
+ code.remove(this.start, removePos);
7838
7897
  if (preventASI) {
7839
- removeLineBreaks(code, operatorPos + 2, this.right.start);
7898
+ removeLineBreaks(code, removePos, this.right.start);
7840
7899
  }
7841
7900
  }
7842
7901
  else {
@@ -7948,7 +8007,7 @@ class MetaProperty extends NodeBase {
7948
8007
  chunkReferenceId = metaProperty.substr(CHUNK_PREFIX.length);
7949
8008
  fileName = outputPluginDriver.getFileName(chunkReferenceId);
7950
8009
  }
7951
- const relativePath = normalize(sysPath.relative(sysPath.dirname(chunkId), fileName));
8010
+ const relativePath = normalize(path.relative(path.dirname(chunkId), fileName));
7952
8011
  let replacement;
7953
8012
  if (assetReferenceId !== null) {
7954
8013
  replacement = outputPluginDriver.hookFirstSync('resolveAssetUrl', [
@@ -8236,10 +8295,11 @@ class ObjectExpression extends NodeBase {
8236
8295
  return hasMemberEffectWhenCalled(objectMembers, key, this.included, callOptions, context);
8237
8296
  return false;
8238
8297
  }
8239
- render(code, options, { renderedParentType } = BLANK) {
8298
+ render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
8240
8299
  super.render(code, options);
8241
- if (renderedParentType === ExpressionStatement ||
8242
- renderedParentType === ArrowFunctionExpression) {
8300
+ const surroundingElement = renderedParentType || renderedSurroundingElement;
8301
+ if (surroundingElement === ExpressionStatement$1 ||
8302
+ surroundingElement === ArrowFunctionExpression$1) {
8243
8303
  code.appendRight(this.start, '(');
8244
8304
  code.prependLeft(this.end, ')');
8245
8305
  }
@@ -8282,7 +8342,7 @@ class ObjectExpression extends NodeBase {
8282
8342
  }
8283
8343
  key = String(keyValue);
8284
8344
  }
8285
- else if (property.key instanceof Identifier$1) {
8345
+ else if (property.key instanceof Identifier) {
8286
8346
  key = property.key.name;
8287
8347
  }
8288
8348
  else {
@@ -8314,7 +8374,7 @@ class ObjectExpression extends NodeBase {
8314
8374
  class ObjectPattern extends NodeBase {
8315
8375
  addExportedVariables(variables, exportNamesByVariable) {
8316
8376
  for (const property of this.properties) {
8317
- if (property.type === Property) {
8377
+ if (property.type === Property$1) {
8318
8378
  property.value.addExportedVariables(variables, exportNamesByVariable);
8319
8379
  }
8320
8380
  else {
@@ -8347,10 +8407,10 @@ class ObjectPattern extends NodeBase {
8347
8407
  }
8348
8408
  }
8349
8409
 
8350
- class PrivateName extends NodeBase {
8410
+ class PrivateIdentifier extends NodeBase {
8351
8411
  }
8352
8412
 
8353
- class Program$1 extends NodeBase {
8413
+ class Program extends NodeBase {
8354
8414
  constructor() {
8355
8415
  super(...arguments);
8356
8416
  this.hasCachedEffect = false;
@@ -8384,7 +8444,7 @@ class Program$1 extends NodeBase {
8384
8444
  }
8385
8445
  }
8386
8446
 
8387
- class Property$1 extends NodeBase {
8447
+ class Property extends NodeBase {
8388
8448
  constructor() {
8389
8449
  super(...arguments);
8390
8450
  this.declarationInit = null;
@@ -8491,7 +8551,14 @@ class Property$1 extends NodeBase {
8491
8551
  }
8492
8552
  }
8493
8553
 
8494
- class ReturnStatement$1 extends NodeBase {
8554
+ class PropertyDefinition extends NodeBase {
8555
+ hasEffects(context) {
8556
+ return (this.key.hasEffects(context) ||
8557
+ (this.static && this.value !== null && this.value.hasEffects(context)));
8558
+ }
8559
+ }
8560
+
8561
+ class ReturnStatement extends NodeBase {
8495
8562
  hasEffects(context) {
8496
8563
  if (!context.ignore.returnAwaitYield ||
8497
8564
  (this.argument !== null && this.argument.hasEffects(context)))
@@ -8694,7 +8761,7 @@ class SwitchStatement extends NodeBase {
8694
8761
  class TaggedTemplateExpression extends NodeBase {
8695
8762
  bind() {
8696
8763
  super.bind();
8697
- if (this.tag.type === Identifier) {
8764
+ if (this.tag.type === Identifier$1) {
8698
8765
  const name = this.tag.name;
8699
8766
  const variable = this.scope.findVariable(name);
8700
8767
  if (variable.isNamespace) {
@@ -8899,7 +8966,7 @@ class UnaryExpression extends NodeBase {
8899
8966
  return unaryOperators[this.operator](argumentValue);
8900
8967
  }
8901
8968
  hasEffects(context) {
8902
- if (this.operator === 'typeof' && this.argument instanceof Identifier$1)
8969
+ if (this.operator === 'typeof' && this.argument instanceof Identifier)
8903
8970
  return false;
8904
8971
  return (this.argument.hasEffects(context) ||
8905
8972
  (this.operator === 'delete' &&
@@ -8926,7 +8993,7 @@ class UpdateExpression extends NodeBase {
8926
8993
  bind() {
8927
8994
  super.bind();
8928
8995
  this.argument.deoptimizePath(EMPTY_PATH);
8929
- if (this.argument instanceof Identifier$1) {
8996
+ if (this.argument instanceof Identifier) {
8930
8997
  const variable = this.scope.findVariable(this.argument.name);
8931
8998
  variable.isReassigned = true;
8932
8999
  }
@@ -8955,7 +9022,7 @@ class UpdateExpression extends NodeBase {
8955
9022
  }
8956
9023
  }
8957
9024
  else if (exportNames.length > 1) {
8958
- code.overwrite(this.start, this.end, `${getSystemExportFunctionLeft([variable], false, options)}${this.operator}${name})`);
9025
+ code.overwrite(this.start, this.end, `(${getSystemExportFunctionLeft([variable], false, options)}${this.operator}${name}))`);
8959
9026
  }
8960
9027
  else {
8961
9028
  let op;
@@ -8977,11 +9044,12 @@ class UpdateExpression extends NodeBase {
8977
9044
  function isReassignedExportsMember(variable, exportNamesByVariable) {
8978
9045
  return (variable.renderBaseName !== null && exportNamesByVariable.has(variable) && variable.isReassigned);
8979
9046
  }
9047
+
8980
9048
  function areAllDeclarationsIncludedAndNotExported(declarations, exportNamesByVariable) {
8981
9049
  for (const declarator of declarations) {
8982
9050
  if (!declarator.id.included)
8983
9051
  return false;
8984
- if (declarator.id.type === Identifier) {
9052
+ if (declarator.id.type === Identifier$1) {
8985
9053
  if (exportNamesByVariable.has(declarator.id.variable))
8986
9054
  return false;
8987
9055
  }
@@ -9069,7 +9137,7 @@ class VariableDeclaration extends NodeBase {
9069
9137
  code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
9070
9138
  }
9071
9139
  }
9072
- renderReplacedDeclarations(code, options, { start = this.start, end = this.end, isNoStatement }) {
9140
+ renderReplacedDeclarations(code, options, { isNoStatement }) {
9073
9141
  const separatedNodes = getCommaSeparatedNodesWithBoundaries(this.declarations, code, this.start + this.kind.length, this.end - (code.original.charCodeAt(this.end - 1) === 59 /*";"*/ ? 1 : 0));
9074
9142
  let actualContentEnd, renderedContentEnd;
9075
9143
  renderedContentEnd = findNonWhiteSpace(code.original, this.start + this.kind.length);
@@ -9080,17 +9148,14 @@ class VariableDeclaration extends NodeBase {
9080
9148
  let separatorString = '', leadingString, nextSeparatorString;
9081
9149
  const systemPatternExports = [];
9082
9150
  for (const { node, start, separator, contentEnd, end } of separatedNodes) {
9083
- if (!node.included ||
9084
- (node.id instanceof Identifier$1 &&
9085
- isReassignedExportsMember(node.id.variable, options.exportNamesByVariable) &&
9086
- node.init === null)) {
9151
+ if (!node.included) {
9087
9152
  code.remove(start, end);
9088
9153
  continue;
9089
9154
  }
9090
9155
  leadingString = '';
9091
9156
  nextSeparatorString = '';
9092
9157
  if (!node.id.included ||
9093
- (node.id instanceof Identifier$1 &&
9158
+ (node.id instanceof Identifier &&
9094
9159
  isReassignedExportsMember(node.id.variable, options.exportNamesByVariable))) {
9095
9160
  if (hasRenderedContent) {
9096
9161
  separatorString += ';';
@@ -9099,7 +9164,7 @@ class VariableDeclaration extends NodeBase {
9099
9164
  }
9100
9165
  else {
9101
9166
  if (options.format === 'system' && node.init !== null) {
9102
- if (node.id.type !== Identifier) {
9167
+ if (node.id.type !== Identifier$1) {
9103
9168
  node.id.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
9104
9169
  }
9105
9170
  else {
@@ -9139,12 +9204,7 @@ class VariableDeclaration extends NodeBase {
9139
9204
  lastSeparatorPos = separator;
9140
9205
  separatorString = nextSeparatorString;
9141
9206
  }
9142
- if (hasRenderedContent) {
9143
- this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options, isNoStatement);
9144
- }
9145
- else {
9146
- code.remove(start, end);
9147
- }
9207
+ this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options, isNoStatement);
9148
9208
  }
9149
9209
  }
9150
9210
 
@@ -9177,7 +9237,12 @@ class VariableDeclarator extends NodeBase {
9177
9237
  code.remove(this.start, findNonWhiteSpace(code.original, operatorPos + 1));
9178
9238
  }
9179
9239
  if (this.init) {
9180
- this.init.render(code, options, renderId ? BLANK : { renderedParentType: ExpressionStatement });
9240
+ this.init.render(code, options, renderId ? BLANK : { renderedParentType: ExpressionStatement$1 });
9241
+ }
9242
+ else if (this.id instanceof Identifier &&
9243
+ isReassignedExportsMember(this.id.variable, options.exportNamesByVariable)) {
9244
+ const _ = options.compact ? '' : ' ';
9245
+ code.appendLeft(this.end, `${_}=${_}void 0`);
9181
9246
  }
9182
9247
  }
9183
9248
  }
@@ -9229,14 +9294,14 @@ class YieldExpression extends NodeBase {
9229
9294
  const nodeConstructors = {
9230
9295
  ArrayExpression,
9231
9296
  ArrayPattern,
9232
- ArrowFunctionExpression: ArrowFunctionExpression$1,
9297
+ ArrowFunctionExpression,
9233
9298
  AssignmentExpression,
9234
9299
  AssignmentPattern,
9235
9300
  AwaitExpression,
9236
9301
  BinaryExpression,
9237
- BlockStatement: BlockStatement$1,
9302
+ BlockStatement,
9238
9303
  BreakStatement,
9239
- CallExpression: CallExpression$1,
9304
+ CallExpression,
9240
9305
  CatchClause,
9241
9306
  ChainExpression,
9242
9307
  ClassBody,
@@ -9250,19 +9315,18 @@ const nodeConstructors = {
9250
9315
  ExportDefaultDeclaration,
9251
9316
  ExportNamedDeclaration,
9252
9317
  ExportSpecifier,
9253
- ExpressionStatement: ExpressionStatement$1,
9254
- FieldDefinition,
9318
+ ExpressionStatement,
9255
9319
  ForInStatement,
9256
9320
  ForOfStatement,
9257
9321
  ForStatement,
9258
9322
  FunctionDeclaration,
9259
- FunctionExpression: FunctionExpression$1,
9260
- Identifier: Identifier$1,
9323
+ FunctionExpression,
9324
+ Identifier,
9261
9325
  IfStatement,
9262
9326
  ImportDeclaration,
9263
- ImportDefaultSpecifier: ImportDefaultSpecifier$1,
9327
+ ImportDefaultSpecifier,
9264
9328
  ImportExpression,
9265
- ImportNamespaceSpecifier: ImportNamespaceSpecifier$1,
9329
+ ImportNamespaceSpecifier,
9266
9330
  ImportSpecifier,
9267
9331
  LabeledStatement,
9268
9332
  Literal,
@@ -9273,11 +9337,12 @@ const nodeConstructors = {
9273
9337
  NewExpression,
9274
9338
  ObjectExpression,
9275
9339
  ObjectPattern,
9276
- PrivateName,
9277
- Program: Program$1,
9278
- Property: Property$1,
9340
+ PrivateIdentifier,
9341
+ Program,
9342
+ Property,
9343
+ PropertyDefinition,
9279
9344
  RestElement,
9280
- ReturnStatement: ReturnStatement$1,
9345
+ ReturnStatement,
9281
9346
  SequenceExpression,
9282
9347
  SpreadElement,
9283
9348
  Super,
@@ -9339,9 +9404,9 @@ function ignore(_node, _st, _c) {}
9339
9404
 
9340
9405
  // Node walkers.
9341
9406
 
9342
- var base$1 = {};
9407
+ var base = {};
9343
9408
 
9344
- base$1.Program = base$1.BlockStatement = function (node, st, c) {
9409
+ base.Program = base.BlockStatement = function (node, st, c) {
9345
9410
  for (var i = 0, list = node.body; i < list.length; i += 1)
9346
9411
  {
9347
9412
  var stmt = list[i];
@@ -9349,22 +9414,22 @@ base$1.Program = base$1.BlockStatement = function (node, st, c) {
9349
9414
  c(stmt, st, "Statement");
9350
9415
  }
9351
9416
  };
9352
- base$1.Statement = skipThrough;
9353
- base$1.EmptyStatement = ignore;
9354
- base$1.ExpressionStatement = base$1.ParenthesizedExpression = base$1.ChainExpression =
9417
+ base.Statement = skipThrough;
9418
+ base.EmptyStatement = ignore;
9419
+ base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
9355
9420
  function (node, st, c) { return c(node.expression, st, "Expression"); };
9356
- base$1.IfStatement = function (node, st, c) {
9421
+ base.IfStatement = function (node, st, c) {
9357
9422
  c(node.test, st, "Expression");
9358
9423
  c(node.consequent, st, "Statement");
9359
9424
  if (node.alternate) { c(node.alternate, st, "Statement"); }
9360
9425
  };
9361
- base$1.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
9362
- base$1.BreakStatement = base$1.ContinueStatement = ignore;
9363
- base$1.WithStatement = function (node, st, c) {
9426
+ base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
9427
+ base.BreakStatement = base.ContinueStatement = ignore;
9428
+ base.WithStatement = function (node, st, c) {
9364
9429
  c(node.object, st, "Expression");
9365
9430
  c(node.body, st, "Statement");
9366
9431
  };
9367
- base$1.SwitchStatement = function (node, st, c) {
9432
+ base.SwitchStatement = function (node, st, c) {
9368
9433
  c(node.discriminant, st, "Expression");
9369
9434
  for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
9370
9435
  var cs = list$1[i$1];
@@ -9378,7 +9443,7 @@ base$1.SwitchStatement = function (node, st, c) {
9378
9443
  }
9379
9444
  }
9380
9445
  };
9381
- base$1.SwitchCase = function (node, st, c) {
9446
+ base.SwitchCase = function (node, st, c) {
9382
9447
  if (node.test) { c(node.test, st, "Expression"); }
9383
9448
  for (var i = 0, list = node.consequent; i < list.length; i += 1)
9384
9449
  {
@@ -9387,43 +9452,43 @@ base$1.SwitchCase = function (node, st, c) {
9387
9452
  c(cons, st, "Statement");
9388
9453
  }
9389
9454
  };
9390
- base$1.ReturnStatement = base$1.YieldExpression = base$1.AwaitExpression = function (node, st, c) {
9455
+ base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
9391
9456
  if (node.argument) { c(node.argument, st, "Expression"); }
9392
9457
  };
9393
- base$1.ThrowStatement = base$1.SpreadElement =
9458
+ base.ThrowStatement = base.SpreadElement =
9394
9459
  function (node, st, c) { return c(node.argument, st, "Expression"); };
9395
- base$1.TryStatement = function (node, st, c) {
9460
+ base.TryStatement = function (node, st, c) {
9396
9461
  c(node.block, st, "Statement");
9397
9462
  if (node.handler) { c(node.handler, st); }
9398
9463
  if (node.finalizer) { c(node.finalizer, st, "Statement"); }
9399
9464
  };
9400
- base$1.CatchClause = function (node, st, c) {
9465
+ base.CatchClause = function (node, st, c) {
9401
9466
  if (node.param) { c(node.param, st, "Pattern"); }
9402
9467
  c(node.body, st, "Statement");
9403
9468
  };
9404
- base$1.WhileStatement = base$1.DoWhileStatement = function (node, st, c) {
9469
+ base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
9405
9470
  c(node.test, st, "Expression");
9406
9471
  c(node.body, st, "Statement");
9407
9472
  };
9408
- base$1.ForStatement = function (node, st, c) {
9473
+ base.ForStatement = function (node, st, c) {
9409
9474
  if (node.init) { c(node.init, st, "ForInit"); }
9410
9475
  if (node.test) { c(node.test, st, "Expression"); }
9411
9476
  if (node.update) { c(node.update, st, "Expression"); }
9412
9477
  c(node.body, st, "Statement");
9413
9478
  };
9414
- base$1.ForInStatement = base$1.ForOfStatement = function (node, st, c) {
9479
+ base.ForInStatement = base.ForOfStatement = function (node, st, c) {
9415
9480
  c(node.left, st, "ForInit");
9416
9481
  c(node.right, st, "Expression");
9417
9482
  c(node.body, st, "Statement");
9418
9483
  };
9419
- base$1.ForInit = function (node, st, c) {
9484
+ base.ForInit = function (node, st, c) {
9420
9485
  if (node.type === "VariableDeclaration") { c(node, st); }
9421
9486
  else { c(node, st, "Expression"); }
9422
9487
  };
9423
- base$1.DebuggerStatement = ignore;
9488
+ base.DebuggerStatement = ignore;
9424
9489
 
9425
- base$1.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
9426
- base$1.VariableDeclaration = function (node, st, c) {
9490
+ base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
9491
+ base.VariableDeclaration = function (node, st, c) {
9427
9492
  for (var i = 0, list = node.declarations; i < list.length; i += 1)
9428
9493
  {
9429
9494
  var decl = list[i];
@@ -9431,12 +9496,12 @@ base$1.VariableDeclaration = function (node, st, c) {
9431
9496
  c(decl, st);
9432
9497
  }
9433
9498
  };
9434
- base$1.VariableDeclarator = function (node, st, c) {
9499
+ base.VariableDeclarator = function (node, st, c) {
9435
9500
  c(node.id, st, "Pattern");
9436
9501
  if (node.init) { c(node.init, st, "Expression"); }
9437
9502
  };
9438
9503
 
9439
- base$1.Function = function (node, st, c) {
9504
+ base.Function = function (node, st, c) {
9440
9505
  if (node.id) { c(node.id, st, "Pattern"); }
9441
9506
  for (var i = 0, list = node.params; i < list.length; i += 1)
9442
9507
  {
@@ -9447,7 +9512,7 @@ base$1.Function = function (node, st, c) {
9447
9512
  c(node.body, st, node.expression ? "Expression" : "Statement");
9448
9513
  };
9449
9514
 
9450
- base$1.Pattern = function (node, st, c) {
9515
+ base.Pattern = function (node, st, c) {
9451
9516
  if (node.type === "Identifier")
9452
9517
  { c(node, st, "VariablePattern"); }
9453
9518
  else if (node.type === "MemberExpression")
@@ -9455,17 +9520,17 @@ base$1.Pattern = function (node, st, c) {
9455
9520
  else
9456
9521
  { c(node, st); }
9457
9522
  };
9458
- base$1.VariablePattern = ignore;
9459
- base$1.MemberPattern = skipThrough;
9460
- base$1.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
9461
- base$1.ArrayPattern = function (node, st, c) {
9523
+ base.VariablePattern = ignore;
9524
+ base.MemberPattern = skipThrough;
9525
+ base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
9526
+ base.ArrayPattern = function (node, st, c) {
9462
9527
  for (var i = 0, list = node.elements; i < list.length; i += 1) {
9463
9528
  var elt = list[i];
9464
9529
 
9465
9530
  if (elt) { c(elt, st, "Pattern"); }
9466
9531
  }
9467
9532
  };
9468
- base$1.ObjectPattern = function (node, st, c) {
9533
+ base.ObjectPattern = function (node, st, c) {
9469
9534
  for (var i = 0, list = node.properties; i < list.length; i += 1) {
9470
9535
  var prop = list[i];
9471
9536
 
@@ -9478,16 +9543,16 @@ base$1.ObjectPattern = function (node, st, c) {
9478
9543
  }
9479
9544
  };
9480
9545
 
9481
- base$1.Expression = skipThrough;
9482
- base$1.ThisExpression = base$1.Super = base$1.MetaProperty = ignore;
9483
- base$1.ArrayExpression = function (node, st, c) {
9546
+ base.Expression = skipThrough;
9547
+ base.ThisExpression = base.Super = base.MetaProperty = ignore;
9548
+ base.ArrayExpression = function (node, st, c) {
9484
9549
  for (var i = 0, list = node.elements; i < list.length; i += 1) {
9485
9550
  var elt = list[i];
9486
9551
 
9487
9552
  if (elt) { c(elt, st, "Expression"); }
9488
9553
  }
9489
9554
  };
9490
- base$1.ObjectExpression = function (node, st, c) {
9555
+ base.ObjectExpression = function (node, st, c) {
9491
9556
  for (var i = 0, list = node.properties; i < list.length; i += 1)
9492
9557
  {
9493
9558
  var prop = list[i];
@@ -9495,8 +9560,8 @@ base$1.ObjectExpression = function (node, st, c) {
9495
9560
  c(prop, st);
9496
9561
  }
9497
9562
  };
9498
- base$1.FunctionExpression = base$1.ArrowFunctionExpression = base$1.FunctionDeclaration;
9499
- base$1.SequenceExpression = function (node, st, c) {
9563
+ base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
9564
+ base.SequenceExpression = function (node, st, c) {
9500
9565
  for (var i = 0, list = node.expressions; i < list.length; i += 1)
9501
9566
  {
9502
9567
  var expr = list[i];
@@ -9504,7 +9569,7 @@ base$1.SequenceExpression = function (node, st, c) {
9504
9569
  c(expr, st, "Expression");
9505
9570
  }
9506
9571
  };
9507
- base$1.TemplateLiteral = function (node, st, c) {
9572
+ base.TemplateLiteral = function (node, st, c) {
9508
9573
  for (var i = 0, list = node.quasis; i < list.length; i += 1)
9509
9574
  {
9510
9575
  var quasi = list[i];
@@ -9519,24 +9584,24 @@ base$1.TemplateLiteral = function (node, st, c) {
9519
9584
  c(expr, st, "Expression");
9520
9585
  }
9521
9586
  };
9522
- base$1.TemplateElement = ignore;
9523
- base$1.UnaryExpression = base$1.UpdateExpression = function (node, st, c) {
9587
+ base.TemplateElement = ignore;
9588
+ base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
9524
9589
  c(node.argument, st, "Expression");
9525
9590
  };
9526
- base$1.BinaryExpression = base$1.LogicalExpression = function (node, st, c) {
9591
+ base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
9527
9592
  c(node.left, st, "Expression");
9528
9593
  c(node.right, st, "Expression");
9529
9594
  };
9530
- base$1.AssignmentExpression = base$1.AssignmentPattern = function (node, st, c) {
9595
+ base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
9531
9596
  c(node.left, st, "Pattern");
9532
9597
  c(node.right, st, "Expression");
9533
9598
  };
9534
- base$1.ConditionalExpression = function (node, st, c) {
9599
+ base.ConditionalExpression = function (node, st, c) {
9535
9600
  c(node.test, st, "Expression");
9536
9601
  c(node.consequent, st, "Expression");
9537
9602
  c(node.alternate, st, "Expression");
9538
9603
  };
9539
- base$1.NewExpression = base$1.CallExpression = function (node, st, c) {
9604
+ base.NewExpression = base.CallExpression = function (node, st, c) {
9540
9605
  c(node.callee, st, "Expression");
9541
9606
  if (node.arguments)
9542
9607
  { for (var i = 0, list = node.arguments; i < list.length; i += 1)
@@ -9546,21 +9611,21 @@ base$1.NewExpression = base$1.CallExpression = function (node, st, c) {
9546
9611
  c(arg, st, "Expression");
9547
9612
  } }
9548
9613
  };
9549
- base$1.MemberExpression = function (node, st, c) {
9614
+ base.MemberExpression = function (node, st, c) {
9550
9615
  c(node.object, st, "Expression");
9551
9616
  if (node.computed) { c(node.property, st, "Expression"); }
9552
9617
  };
9553
- base$1.ExportNamedDeclaration = base$1.ExportDefaultDeclaration = function (node, st, c) {
9618
+ base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
9554
9619
  if (node.declaration)
9555
9620
  { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
9556
9621
  if (node.source) { c(node.source, st, "Expression"); }
9557
9622
  };
9558
- base$1.ExportAllDeclaration = function (node, st, c) {
9623
+ base.ExportAllDeclaration = function (node, st, c) {
9559
9624
  if (node.exported)
9560
9625
  { c(node.exported, st); }
9561
9626
  c(node.source, st, "Expression");
9562
9627
  };
9563
- base$1.ImportDeclaration = function (node, st, c) {
9628
+ base.ImportDeclaration = function (node, st, c) {
9564
9629
  for (var i = 0, list = node.specifiers; i < list.length; i += 1)
9565
9630
  {
9566
9631
  var spec = list[i];
@@ -9569,22 +9634,22 @@ base$1.ImportDeclaration = function (node, st, c) {
9569
9634
  }
9570
9635
  c(node.source, st, "Expression");
9571
9636
  };
9572
- base$1.ImportExpression = function (node, st, c) {
9637
+ base.ImportExpression = function (node, st, c) {
9573
9638
  c(node.source, st, "Expression");
9574
9639
  };
9575
- base$1.ImportSpecifier = base$1.ImportDefaultSpecifier = base$1.ImportNamespaceSpecifier = base$1.Identifier = base$1.Literal = ignore;
9640
+ base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
9576
9641
 
9577
- base$1.TaggedTemplateExpression = function (node, st, c) {
9642
+ base.TaggedTemplateExpression = function (node, st, c) {
9578
9643
  c(node.tag, st, "Expression");
9579
9644
  c(node.quasi, st, "Expression");
9580
9645
  };
9581
- base$1.ClassDeclaration = base$1.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
9582
- base$1.Class = function (node, st, c) {
9646
+ base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
9647
+ base.Class = function (node, st, c) {
9583
9648
  if (node.id) { c(node.id, st, "Pattern"); }
9584
9649
  if (node.superClass) { c(node.superClass, st, "Expression"); }
9585
9650
  c(node.body, st);
9586
9651
  };
9587
- base$1.ClassBody = function (node, st, c) {
9652
+ base.ClassBody = function (node, st, c) {
9588
9653
  for (var i = 0, list = node.body; i < list.length; i += 1)
9589
9654
  {
9590
9655
  var elt = list[i];
@@ -9592,14 +9657,13 @@ base$1.ClassBody = function (node, st, c) {
9592
9657
  c(elt, st);
9593
9658
  }
9594
9659
  };
9595
- base$1.MethodDefinition = base$1.Property = function (node, st, c) {
9660
+ base.MethodDefinition = base.Property = function (node, st, c) {
9596
9661
  if (node.computed) { c(node.key, st, "Expression"); }
9597
9662
  c(node.value, st, "Expression");
9598
9663
  };
9599
9664
 
9600
- // @ts-ignore
9601
9665
  // patch up acorn-walk until class-fields are officially supported
9602
- base$1.FieldDefinition = function (node, st, c) {
9666
+ base.PropertyDefinition = function (node, st, c) {
9603
9667
  if (node.computed) {
9604
9668
  c(node.key, st, 'Expression');
9605
9669
  }
@@ -9614,7 +9678,7 @@ function handlePureAnnotationsOfNode(node, state, type = node.type) {
9614
9678
  commentNode = state.commentNodes[++state.commentIndex];
9615
9679
  }
9616
9680
  if (commentNode && commentNode.end <= node.end) {
9617
- base$1[type](node, state, handlePureAnnotationsOfNode);
9681
+ base[type](node, state, handlePureAnnotationsOfNode);
9618
9682
  }
9619
9683
  }
9620
9684
  function markPureNode(node, comment) {
@@ -9624,10 +9688,10 @@ function markPureNode(node, comment) {
9624
9688
  else {
9625
9689
  node.annotations = [comment];
9626
9690
  }
9627
- if (node.type === 'ExpressionStatement') {
9691
+ if (node.type === ExpressionStatement$1) {
9628
9692
  node = node.expression;
9629
9693
  }
9630
- if (node.type === 'CallExpression' || node.type === 'NewExpression') {
9694
+ if (node.type === CallExpression$1 || node.type === NewExpression$1) {
9631
9695
  node.annotatedPure = true;
9632
9696
  }
9633
9697
  }
@@ -9920,8 +9984,8 @@ class Module {
9920
9984
  };
9921
9985
  }
9922
9986
  basename() {
9923
- const base = sysPath.basename(this.id);
9924
- const ext = sysPath.extname(this.id);
9987
+ const base = path.basename(this.id);
9988
+ const ext = path.extname(this.id);
9925
9989
  return makeLegal(ext ? base.slice(0, -ext.length) : base);
9926
9990
  }
9927
9991
  bindReferences() {
@@ -10286,7 +10350,7 @@ class Module {
10286
10350
  };
10287
10351
  this.scope = new ModuleScope(this.graph.scope, this.astContext);
10288
10352
  this.namespace = new NamespaceVariable(this.astContext, this.info.syntheticNamedExports);
10289
- this.ast = new Program$1(ast, { type: 'Module', context: this.astContext }, this.scope);
10353
+ this.ast = new Program(ast, { type: 'Module', context: this.astContext }, this.scope);
10290
10354
  this.info.ast = ast;
10291
10355
  timeEnd('analyse ast', 3);
10292
10356
  }
@@ -10425,8 +10489,8 @@ class Module {
10425
10489
  const source = node.source.value;
10426
10490
  this.sources.add(source);
10427
10491
  for (const specifier of node.specifiers) {
10428
- const isDefault = specifier.type === ImportDefaultSpecifier;
10429
- const isNamespace = specifier.type === ImportNamespaceSpecifier;
10492
+ const isDefault = specifier.type === ImportDefaultSpecifier$1;
10493
+ const isNamespace = specifier.type === ImportNamespaceSpecifier$1;
10430
10494
  const name = isDefault
10431
10495
  ? 'default'
10432
10496
  : isNamespace
@@ -10702,9 +10766,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
10702
10766
  else {
10703
10767
  const sources = originalSourcemap.sources;
10704
10768
  const sourcesContent = originalSourcemap.sourcesContent || [];
10705
- const directory = sysPath.dirname(id) || '.';
10769
+ const directory = path.dirname(id) || '.';
10706
10770
  const sourceRoot = originalSourcemap.sourceRoot || '.';
10707
- const baseSources = sources.map((source, i) => new Source(sysPath.resolve(directory, sourceRoot, source), sourcesContent[i]));
10771
+ const baseSources = sources.map((source, i) => new Source(path.resolve(directory, sourceRoot, source), sourcesContent[i]));
10708
10772
  source = new Link(originalSourcemap, baseSources);
10709
10773
  }
10710
10774
  return sourcemapChain.reduce(linkMap, source);
@@ -10720,9 +10784,9 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
10720
10784
  source = bundleSourcemapChain.reduce(linkMap, source);
10721
10785
  let { sources, sourcesContent, names, mappings } = source.traceMappings();
10722
10786
  if (file) {
10723
- const directory = sysPath.dirname(file);
10724
- sources = sources.map((source) => sysPath.relative(directory, source));
10725
- file = sysPath.basename(file);
10787
+ const directory = path.dirname(file);
10788
+ sources = sources.map((source) => path.relative(directory, source));
10789
+ file = path.basename(file);
10726
10790
  }
10727
10791
  sourcesContent = (excludeContent ? null : sourcesContent);
10728
10792
  return new SourceMap({ file, sources, sourcesContent, names, mappings });
@@ -10747,12 +10811,13 @@ const DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT = {
10747
10811
  umd: deconflictImportsOther
10748
10812
  };
10749
10813
  function deconflictChunk(modules, dependenciesToBeDeconflicted, imports, usedNames, format, interop, preserveModules, externalLiveBindings, chunkByModule, syntheticExports, exportNamesByVariable, accessedGlobalsByScope, includedNamespaces) {
10750
- for (const module of modules) {
10814
+ const reversedModules = modules.slice().reverse();
10815
+ for (const module of reversedModules) {
10751
10816
  module.scope.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope);
10752
10817
  }
10753
- deconflictTopLevelVariables(usedNames, modules, includedNamespaces);
10818
+ deconflictTopLevelVariables(usedNames, reversedModules, includedNamespaces);
10754
10819
  DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT[format](usedNames, imports, dependenciesToBeDeconflicted, interop, preserveModules, externalLiveBindings, chunkByModule, syntheticExports);
10755
- for (const module of modules) {
10820
+ for (const module of reversedModules) {
10756
10821
  module.scope.deconflict(format, exportNamesByVariable, accessedGlobalsByScope);
10757
10822
  }
10758
10823
  }
@@ -11053,7 +11118,7 @@ function makeUnique(name, existingNames) {
11053
11118
  const existingNamesLowercase = new Set(Object.keys(existingNames).map(key => key.toLowerCase()));
11054
11119
  if (!existingNamesLowercase.has(name.toLocaleLowerCase()))
11055
11120
  return name;
11056
- const ext = sysPath.extname(name);
11121
+ const ext = path.extname(name);
11057
11122
  name = name.substr(0, name.length - ext.length);
11058
11123
  let uniqueName, uniqueIndex = 1;
11059
11124
  while (existingNamesLowercase.has((uniqueName = name + ++uniqueIndex + ext).toLowerCase()))
@@ -11077,7 +11142,7 @@ function getGlobalName(module, globals, hasExports, warn) {
11077
11142
  return module.variableName;
11078
11143
  }
11079
11144
  }
11080
- class Chunk$1 {
11145
+ class Chunk {
11081
11146
  constructor(orderedModules, inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, manualChunkAlias) {
11082
11147
  this.orderedModules = orderedModules;
11083
11148
  this.inputOptions = inputOptions;
@@ -11148,7 +11213,7 @@ class Chunk$1 {
11148
11213
  this.suggestedVariableName = makeLegal(this.generateVariableName());
11149
11214
  }
11150
11215
  static generateFacade(inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, facadedModule, facadeName) {
11151
- const chunk = new Chunk$1([], inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, null);
11216
+ const chunk = new Chunk([], inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, null);
11152
11217
  chunk.assignFacadeName(facadeName, facadedModule);
11153
11218
  if (!facadeChunkByModule.has(facadedModule)) {
11154
11219
  facadeChunkByModule.set(facadedModule, chunk);
@@ -11253,7 +11318,7 @@ class Chunk$1 {
11253
11318
  }
11254
11319
  }
11255
11320
  for (const facadeName of requiredFacades) {
11256
- facades.push(Chunk$1.generateFacade(this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.modulesById, this.chunkByModule, this.facadeChunkByModule, this.includedNamespaces, module, facadeName));
11321
+ facades.push(Chunk.generateFacade(this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.modulesById, this.chunkByModule, this.facadeChunkByModule, this.includedNamespaces, module, facadeName));
11257
11322
  }
11258
11323
  }
11259
11324
  for (const module of this.dynamicEntryModules) {
@@ -11295,15 +11360,15 @@ class Chunk$1 {
11295
11360
  generateIdPreserveModules(preserveModulesRelativeDir, options, existingNames, unsetOptions) {
11296
11361
  const id = this.orderedModules[0].id;
11297
11362
  const sanitizedId = sanitizeFileName(id);
11298
- let path;
11363
+ let path$1;
11299
11364
  if (isAbsolute(id)) {
11300
- const extension = sysPath.extname(id);
11365
+ const extension = path.extname(id);
11301
11366
  const pattern = unsetOptions.has('entryFileNames')
11302
11367
  ? NON_ASSET_EXTENSIONS.includes(extension)
11303
11368
  ? '[name].js'
11304
11369
  : '[name][extname].js'
11305
11370
  : options.entryFileNames;
11306
- const currentDir = sysPath.dirname(sanitizedId);
11371
+ const currentDir = path.dirname(sanitizedId);
11307
11372
  const fileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getChunkInfo()) : pattern, 'output.entryFileNames', {
11308
11373
  ext: () => extension.substr(1),
11309
11374
  extname: () => extension,
@@ -11313,16 +11378,16 @@ class Chunk$1 {
11313
11378
  const currentPath = `${currentDir}/${fileName}`;
11314
11379
  const { preserveModulesRoot } = options;
11315
11380
  if (preserveModulesRoot && currentPath.startsWith(preserveModulesRoot)) {
11316
- path = currentPath.slice(preserveModulesRoot.length).replace(/^[\\/]/, '');
11381
+ path$1 = currentPath.slice(preserveModulesRoot.length).replace(/^[\\/]/, '');
11317
11382
  }
11318
11383
  else {
11319
- path = relative(preserveModulesRelativeDir, currentPath);
11384
+ path$1 = relative(preserveModulesRelativeDir, currentPath);
11320
11385
  }
11321
11386
  }
11322
11387
  else {
11323
- path = `_virtual/${sysPath.basename(sanitizedId)}`;
11388
+ path$1 = `_virtual/${path.basename(sanitizedId)}`;
11324
11389
  }
11325
- return makeUnique(normalize(path), existingNames);
11390
+ return makeUnique(normalize(path$1), existingNames);
11326
11391
  }
11327
11392
  getChunkInfo() {
11328
11393
  const facadeModule = this.facadeModule;
@@ -11394,7 +11459,7 @@ class Chunk$1 {
11394
11459
  }
11395
11460
  // prerender allows chunk hashes and names to be generated before finalizing
11396
11461
  preRender(options, inputBase) {
11397
- const magicString = new Bundle({ separator: options.compact ? '' : '\n\n' });
11462
+ const magicString = new Bundle$1({ separator: options.compact ? '' : '\n\n' });
11398
11463
  this.usedModules = [];
11399
11464
  this.indentString = getIndentString(this.orderedModules, options);
11400
11465
  const n = options.compact ? '' : '\n';
@@ -11415,7 +11480,7 @@ class Chunk$1 {
11415
11480
  !this.outputOptions.preserveModules &&
11416
11481
  this.facadeModule !== null) {
11417
11482
  for (const dep of this.dependencies) {
11418
- if (dep instanceof Chunk$1)
11483
+ if (dep instanceof Chunk)
11419
11484
  this.inlineChunkDependencies(dep);
11420
11485
  }
11421
11486
  }
@@ -11563,11 +11628,11 @@ class Chunk$1 {
11563
11628
  timeStart('sourcemap', 2);
11564
11629
  let file;
11565
11630
  if (options.file)
11566
- file = sysPath.resolve(options.sourcemapFile || options.file);
11631
+ file = path.resolve(options.sourcemapFile || options.file);
11567
11632
  else if (options.dir)
11568
- file = sysPath.resolve(options.dir, this.id);
11633
+ file = path.resolve(options.dir, this.id);
11569
11634
  else
11570
- file = sysPath.resolve(this.id);
11635
+ file = path.resolve(this.id);
11571
11636
  const decodedMap = magicString.generateDecodedMap({});
11572
11637
  map = collapseSourcemaps(file, decodedMap, this.usedModules, chunkSourcemapChain, options.sourcemapExcludeSources, this.inputOptions.onwarn);
11573
11638
  map.sources = map.sources
@@ -11727,7 +11792,7 @@ class Chunk$1 {
11727
11792
  getGlobalName(dep, options.globals, (imports || reexports) !== null, this.inputOptions.onwarn)),
11728
11793
  id: undefined,
11729
11794
  imports,
11730
- isChunk: dep instanceof Chunk$1,
11795
+ isChunk: dep instanceof Chunk,
11731
11796
  name: dep.variableName,
11732
11797
  namedExportsMode,
11733
11798
  namespaceVariableName: dep.namespaceVariableName,
@@ -11934,14 +11999,14 @@ class Chunk$1 {
11934
11999
  return referencedFiles;
11935
12000
  }
11936
12001
  getRelativePath(targetPath, stripJsExtension) {
11937
- let relativePath = normalize(relative(sysPath.dirname(this.id), targetPath));
12002
+ let relativePath = normalize(relative(path.dirname(this.id), targetPath));
11938
12003
  if (stripJsExtension && relativePath.endsWith('.js')) {
11939
12004
  relativePath = relativePath.slice(0, -3);
11940
12005
  }
11941
12006
  if (relativePath === '..')
11942
- return '../../' + sysPath.basename(targetPath);
12007
+ return '../../' + path.basename(targetPath);
11943
12008
  if (relativePath === '')
11944
- return '../' + sysPath.basename(targetPath);
12009
+ return '../' + path.basename(targetPath);
11945
12010
  return relativePath.startsWith('../') ? relativePath : './' + relativePath;
11946
12011
  }
11947
12012
  inlineChunkDependencies(chunk) {
@@ -11949,7 +12014,7 @@ class Chunk$1 {
11949
12014
  if (this.dependencies.has(dep))
11950
12015
  continue;
11951
12016
  this.dependencies.add(dep);
11952
- if (dep instanceof Chunk$1) {
12017
+ if (dep instanceof Chunk) {
11953
12018
  this.inlineChunkDependencies(dep);
11954
12019
  }
11955
12020
  }
@@ -11986,7 +12051,7 @@ class Chunk$1 {
11986
12051
  }
11987
12052
  }
11988
12053
  }
11989
- setIdentifierRenderResolutions({ format, interop }) {
12054
+ setIdentifierRenderResolutions({ format, interop, namespaceToStringTag }) {
11990
12055
  const syntheticExports = new Set();
11991
12056
  for (const exportName of this.getExportNames()) {
11992
12057
  const exportVariable = this.exportsByName[exportName];
@@ -12006,10 +12071,13 @@ class Chunk$1 {
12006
12071
  exportVariable.setRenderNames(null, null);
12007
12072
  }
12008
12073
  }
12009
- const usedNames = new Set();
12074
+ const usedNames = new Set(['Object', 'Promise']);
12010
12075
  if (this.needsExportsShim) {
12011
12076
  usedNames.add(MISSING_EXPORT_SHIM_VARIABLE);
12012
12077
  }
12078
+ if (namespaceToStringTag) {
12079
+ usedNames.add('Symbol');
12080
+ }
12013
12081
  switch (format) {
12014
12082
  case 'system':
12015
12083
  usedNames.add('module').add('exports');
@@ -12243,7 +12311,7 @@ function commondir(files) {
12243
12311
  if (files.length === 0)
12244
12312
  return '/';
12245
12313
  if (files.length === 1)
12246
- return sysPath.dirname(files[0]);
12314
+ return path.dirname(files[0]);
12247
12315
  const commonSegments = files.slice(1).reduce((commonSegments, file) => {
12248
12316
  const pathSegements = file.split(/\/+|\\+/);
12249
12317
  let i;
@@ -12340,9 +12408,9 @@ function generateAssetFileName(name, source, output) {
12340
12408
  hash.update(source);
12341
12409
  return hash.digest('hex').substr(0, 8);
12342
12410
  },
12343
- ext: () => sysPath.extname(emittedName).substr(1),
12344
- extname: () => sysPath.extname(emittedName),
12345
- name: () => emittedName.substr(0, emittedName.length - sysPath.extname(emittedName).length)
12411
+ ext: () => path.extname(emittedName).substr(1),
12412
+ extname: () => path.extname(emittedName),
12413
+ name: () => emittedName.substr(0, emittedName.length - path.extname(emittedName).length)
12346
12414
  }), output.bundle);
12347
12415
  }
12348
12416
  function reserveFileNameInBundle(fileName, bundle, warn) {
@@ -12566,7 +12634,7 @@ function areSourcesEqual(sourceA, sourceB) {
12566
12634
  return true;
12567
12635
  }
12568
12636
 
12569
- class Bundle$1 {
12637
+ class Bundle {
12570
12638
  constructor(outputOptions, unsetOptions, inputOptions, pluginDriver, graph) {
12571
12639
  this.outputOptions = outputOptions;
12572
12640
  this.unsetOptions = unsetOptions;
@@ -12645,7 +12713,7 @@ class Bundle$1 {
12645
12713
  const chunksForNaming = entryChunks.concat(otherChunks);
12646
12714
  for (const chunk of chunksForNaming) {
12647
12715
  if (this.outputOptions.file) {
12648
- chunk.id = sysPath.basename(this.outputOptions.file);
12716
+ chunk.id = path.basename(this.outputOptions.file);
12649
12717
  }
12650
12718
  else if (this.outputOptions.preserveModules) {
12651
12719
  chunk.id = chunk.generateIdPreserveModules(inputBase, this.outputOptions, bundle, this.unsetOptions);
@@ -12679,6 +12747,17 @@ class Bundle$1 {
12679
12747
  warnDeprecation('A plugin is directly adding properties to the bundle object in the "generateBundle" hook. This is deprecated and will be removed in a future Rollup version, please use "this.emitFile" instead.', true, this.inputOptions);
12680
12748
  file.type = 'asset';
12681
12749
  }
12750
+ if (this.outputOptions.validate && typeof file.code == 'string') {
12751
+ try {
12752
+ this.graph.contextParse(file.code, {
12753
+ allowHashBang: true,
12754
+ ecmaVersion: 'latest'
12755
+ });
12756
+ }
12757
+ catch (exception) {
12758
+ this.inputOptions.onwarn(errChunkInvalid(file, exception));
12759
+ }
12760
+ }
12682
12761
  }
12683
12762
  this.pluginDriver.finaliseAssets();
12684
12763
  }
@@ -12698,7 +12777,7 @@ class Bundle$1 {
12698
12777
  }))
12699
12778
  : getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry)) {
12700
12779
  sortByExecutionOrder(modules);
12701
- const chunk = new Chunk$1(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, this.facadeChunkByModule, this.includedNamespaces, alias);
12780
+ const chunk = new Chunk(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, this.facadeChunkByModule, this.includedNamespaces, alias);
12702
12781
  chunks.push(chunk);
12703
12782
  for (const module of modules) {
12704
12783
  chunkByModule.set(module, chunk);
@@ -12770,7 +12849,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
12770
12849
 
12771
12850
  // Reserved word lists for various dialects of the language
12772
12851
 
12773
- var reservedWords$1 = {
12852
+ var reservedWords = {
12774
12853
  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
12854
  5: "class enum extends super const export import",
12776
12855
  6: "enum",
@@ -13025,7 +13104,7 @@ var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
13025
13104
 
13026
13105
  var ref = Object.prototype;
13027
13106
  var hasOwnProperty = ref.hasOwnProperty;
13028
- var toString$1 = ref.toString;
13107
+ var toString = ref.toString;
13029
13108
 
13030
13109
  // Checks if an object has a property.
13031
13110
 
@@ -13034,7 +13113,7 @@ function has(obj, propName) {
13034
13113
  }
13035
13114
 
13036
13115
  var isArray = Array.isArray || (function (obj) { return (
13037
- toString$1.call(obj) === "[object Array]"
13116
+ toString.call(obj) === "[object Array]"
13038
13117
  ); });
13039
13118
 
13040
13119
  function wordsRegexp(words) {
@@ -13248,13 +13327,13 @@ var Parser = function Parser(options, input, startPos) {
13248
13327
  this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
13249
13328
  var reserved = "";
13250
13329
  if (options.allowReserved !== true) {
13251
- reserved = reservedWords$1[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
13330
+ reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
13252
13331
  if (options.sourceType === "module") { reserved += " await"; }
13253
13332
  }
13254
13333
  this.reservedWords = wordsRegexp(reserved);
13255
- var reservedStrict = (reserved ? reserved + " " : "") + reservedWords$1.strict;
13334
+ var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
13256
13335
  this.reservedWordsStrict = wordsRegexp(reservedStrict);
13257
- this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords$1.strictBind);
13336
+ this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
13258
13337
  this.input = String(input);
13259
13338
 
13260
13339
  // Used to signal to callers of `readWord1` whether the word
@@ -13307,7 +13386,7 @@ var Parser = function Parser(options, input, startPos) {
13307
13386
  // Labels in scope.
13308
13387
  this.labels = [];
13309
13388
  // Thus-far undefined exports.
13310
- this.undefinedExports = {};
13389
+ this.undefinedExports = Object.create(null);
13311
13390
 
13312
13391
  // If enabled, skip leading hashbang line.
13313
13392
  if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
@@ -13521,7 +13600,7 @@ var pp$1 = Parser.prototype;
13521
13600
  // to its body instead of creating a new node.
13522
13601
 
13523
13602
  pp$1.parseTopLevel = function(node) {
13524
- var exports = {};
13603
+ var exports = Object.create(null);
13525
13604
  if (!node.body) { node.body = []; }
13526
13605
  while (this.type !== types.eof) {
13527
13606
  var stmt = this.parseStatement(null, true, exports);
@@ -15647,7 +15726,7 @@ pp$3.isSimpleParamList = function(params) {
15647
15726
  // or "arguments" and duplicate parameters.
15648
15727
 
15649
15728
  pp$3.checkParams = function(node, allowDuplicates) {
15650
- var nameHash = {};
15729
+ var nameHash = Object.create(null);
15651
15730
  for (var i = 0, list = node.params; i < list.length; i += 1)
15652
15731
  {
15653
15732
  var param = list[i];
@@ -15790,7 +15869,7 @@ pp$4.curPosition = function() {
15790
15869
 
15791
15870
  var pp$5 = Parser.prototype;
15792
15871
 
15793
- var Scope$1 = function Scope(flags) {
15872
+ var Scope = function Scope(flags) {
15794
15873
  this.flags = flags;
15795
15874
  // A list of var-declared names in the current lexical scope
15796
15875
  this.var = [];
@@ -15803,7 +15882,7 @@ var Scope$1 = function Scope(flags) {
15803
15882
  // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
15804
15883
 
15805
15884
  pp$5.enterScope = function(flags) {
15806
- this.scopeStack.push(new Scope$1(flags));
15885
+ this.scopeStack.push(new Scope(flags));
15807
15886
  };
15808
15887
 
15809
15888
  pp$5.exitScope = function() {
@@ -17977,11 +18056,11 @@ pp$9.readWord = function() {
17977
18056
 
17978
18057
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
17979
18058
 
17980
- var version$1 = "8.0.4";
18059
+ var version = "8.0.5";
17981
18060
 
17982
18061
  Parser.acorn = {
17983
18062
  Parser: Parser,
17984
- version: version$1,
18063
+ version: version,
17985
18064
  defaultOptions: defaultOptions,
17986
18065
  Position: Position,
17987
18066
  SourceLocation: SourceLocation,
@@ -18050,10 +18129,10 @@ var acorn = {
18050
18129
  tokContexts: types$1,
18051
18130
  tokTypes: types,
18052
18131
  tokenizer: tokenizer,
18053
- version: version$1
18132
+ version: version
18054
18133
  };
18055
18134
 
18056
- class GlobalScope extends Scope {
18135
+ class GlobalScope extends Scope$1 {
18057
18136
  constructor() {
18058
18137
  super();
18059
18138
  this.variables.set('undefined', new UndefinedVariable());
@@ -18069,8 +18148,8 @@ class GlobalScope extends Scope {
18069
18148
  }
18070
18149
 
18071
18150
  const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
18072
- function mkdirpath(path) {
18073
- const dir = sysPath.dirname(path);
18151
+ function mkdirpath(path$1) {
18152
+ const dir = path.dirname(path$1);
18074
18153
  try {
18075
18154
  fs.readdirSync(dir);
18076
18155
  }
@@ -18112,7 +18191,7 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, skip,
18112
18191
  // absolute path is created. Absolute importees therefore shortcircuit the
18113
18192
  // resolve call and require no special handing on our part.
18114
18193
  // See https://nodejs.org/api/path.html#path_path_resolve_paths
18115
- return addJsExtensionIfNecessary(importer ? sysPath.resolve(sysPath.dirname(importer), source) : sysPath.resolve(source), preserveSymlinks);
18194
+ return addJsExtensionIfNecessary(importer ? path.resolve(path.dirname(importer), source) : path.resolve(source), preserveSymlinks);
18116
18195
  }
18117
18196
  function addJsExtensionIfNecessary(file, preserveSymlinks) {
18118
18197
  let found = findFile(file, preserveSymlinks);
@@ -18131,8 +18210,8 @@ function findFile(file, preserveSymlinks) {
18131
18210
  return findFile(fs.realpathSync(file), preserveSymlinks);
18132
18211
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
18133
18212
  // check case
18134
- const name = sysPath.basename(file);
18135
- const files = fs.readdirSync(sysPath.dirname(file));
18213
+ const name = path.basename(file);
18214
+ const files = fs.readdirSync(path.dirname(file));
18136
18215
  if (files.indexOf(name) !== -1)
18137
18216
  return file;
18138
18217
  }
@@ -18697,8 +18776,8 @@ class ModuleLoader {
18697
18776
  function normalizeRelativeExternalId(source, importer) {
18698
18777
  return isRelative(source)
18699
18778
  ? importer
18700
- ? sysPath.resolve(importer, '..', source)
18701
- : sysPath.resolve(source)
18779
+ ? path.resolve(importer, '..', source)
18780
+ : path.resolve(source)
18702
18781
  : source;
18703
18782
  }
18704
18783
  function addChunkNamesToModule(module, { fileName, name }, isUserDefined) {
@@ -18775,7 +18854,7 @@ function getPluginContexts(pluginCache, graph, options, fileEmitter) {
18775
18854
  getWatchFiles: () => Object.keys(graph.watchFiles),
18776
18855
  isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => options.external(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, options),
18777
18856
  meta: {
18778
- rollupVersion: version,
18857
+ rollupVersion: version$1,
18779
18858
  watchMode: graph.watchMode
18780
18859
  },
18781
18860
  get moduleIds() {
@@ -19196,34 +19275,14 @@ class Graph {
19196
19275
  }
19197
19276
  }
19198
19277
 
19199
- function getAugmentedNamespace(n) {
19200
- if (n.__esModule) return n;
19201
- var a = Object.defineProperty({}, '__esModule', {value: true});
19202
- Object.keys(n).forEach(function (k) {
19203
- var d = Object.getOwnPropertyDescriptor(n, k);
19204
- Object.defineProperty(a, k, d.get ? d : {
19205
- enumerable: true,
19206
- get: function () {
19207
- return n[k];
19208
- }
19209
- });
19210
- });
19211
- return a;
19212
- }
19213
-
19214
- function createCommonjsModule(fn) {
19215
- var module = { exports: {} };
19216
- return fn(module, module.exports), module.exports;
19217
- }
19218
-
19219
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(acorn);
19278
+ var require$$1 = /*@__PURE__*/getAugmentedNamespace(acorn);
19220
19279
 
19221
19280
  const getPrototype = Object.getPrototypeOf || (o => o.__proto__);
19222
19281
 
19223
- const getAcorn = Parser => {
19282
+ const getAcorn$1 = Parser => {
19224
19283
  if (Parser.acorn) return Parser.acorn
19225
19284
 
19226
- const acorn = require$$0;
19285
+ const acorn = require$$1;
19227
19286
 
19228
19287
  if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) {
19229
19288
  throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`)
@@ -19245,7 +19304,7 @@ var acornPrivateClassElements = function(Parser) {
19245
19304
  return Parser
19246
19305
  }
19247
19306
 
19248
- const acorn = getAcorn(Parser);
19307
+ const acorn = getAcorn$1(Parser);
19249
19308
 
19250
19309
  Parser = class extends Parser {
19251
19310
  _branch() {
@@ -19276,7 +19335,7 @@ var acornPrivateClassElements = function(Parser) {
19276
19335
  const node = this.startNode();
19277
19336
  node.name = this.value;
19278
19337
  this.next();
19279
- this.finishNode(node, "PrivateName");
19338
+ this.finishNode(node, "PrivateIdentifier");
19280
19339
  if (this.options.allowReserved == "never") this.checkUnreserved(node);
19281
19340
  return node
19282
19341
  }
@@ -19286,7 +19345,7 @@ var acornPrivateClassElements = function(Parser) {
19286
19345
  if (code === 35) {
19287
19346
  ++this.pos;
19288
19347
  const word = this.readWord1();
19289
- return this.finishToken(this.privateNameToken, word)
19348
+ return this.finishToken(this.privateIdentifierToken, word)
19290
19349
  }
19291
19350
  return super.getTokenFromCode(code)
19292
19351
  }
@@ -19335,7 +19394,7 @@ var acornPrivateClassElements = function(Parser) {
19335
19394
  const branch = this._branch();
19336
19395
  if (!(
19337
19396
  (branch.eat(acorn.tokTypes.dot) || (optionalSupported && branch.eat(acorn.tokTypes.questionDot))) &&
19338
- branch.type == this.privateNameToken
19397
+ branch.type == this.privateIdentifierToken
19339
19398
  )) {
19340
19399
  return super.parseSubscript.apply(this, arguments)
19341
19400
  }
@@ -19350,7 +19409,7 @@ var acornPrivateClassElements = function(Parser) {
19350
19409
  if (optionalSupported) {
19351
19410
  node.optional = optional;
19352
19411
  }
19353
- if (this.type == this.privateNameToken) {
19412
+ if (this.type == this.privateIdentifierToken) {
19354
19413
  if (base.type == "Super") {
19355
19414
  this.raise(this.start, "Cannot access private element on super");
19356
19415
  }
@@ -19371,22 +19430,24 @@ var acornPrivateClassElements = function(Parser) {
19371
19430
  parseMaybeUnary(refDestructuringErrors, sawUnary) {
19372
19431
  const _return = super.parseMaybeUnary(refDestructuringErrors, sawUnary);
19373
19432
  if (_return.operator == "delete") {
19374
- if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateName") {
19433
+ if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateIdentifier") {
19375
19434
  this.raise(_return.start, "Private elements may not be deleted");
19376
19435
  }
19377
19436
  }
19378
19437
  return _return
19379
19438
  }
19380
19439
  };
19381
- Parser.prototype.privateNameToken = new acorn.TokenType("privateName");
19440
+ Parser.prototype.privateIdentifierToken = new acorn.TokenType("privateIdentifier");
19382
19441
  return Parser
19383
19442
  };
19384
19443
 
19444
+ const privateClassElements$1 = acornPrivateClassElements;
19445
+
19385
19446
  var acornClassFields = function(Parser) {
19386
- const acorn = Parser.acorn || require$$0;
19447
+ const acorn = Parser.acorn || require$$1;
19387
19448
  const tt = acorn.tokTypes;
19388
19449
 
19389
- Parser = acornPrivateClassElements(Parser);
19450
+ Parser = privateClassElements$1(Parser);
19390
19451
  return class extends Parser {
19391
19452
  _maybeParseFieldValue(field) {
19392
19453
  if (this.eat(tt.eq)) {
@@ -19401,7 +19462,7 @@ var acornClassFields = function(Parser) {
19401
19462
 
19402
19463
  // Parse fields
19403
19464
  parseClassElement(_constructorAllowsSuper) {
19404
- if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type.keyword || this.type == this.privateNameToken || this.type == tt.bracketL || this.type == tt.string || this.type == tt.num)) {
19465
+ if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type.keyword || this.type == this.privateIdentifierToken || this.type == tt.bracketL || this.type == tt.string || this.type == tt.num)) {
19405
19466
  const branch = this._branch();
19406
19467
  if (branch.type == tt.bracketL) {
19407
19468
  let count = 0;
@@ -19417,7 +19478,7 @@ var acornClassFields = function(Parser) {
19417
19478
  }
19418
19479
  if (isField) {
19419
19480
  const node = this.startNode();
19420
- if (this.type == this.privateNameToken) {
19481
+ if (this.type == this.privateIdentifierToken) {
19421
19482
  this.parsePrivateClassElementName(node);
19422
19483
  } else {
19423
19484
  this.parsePropertyName(node);
@@ -19429,7 +19490,7 @@ var acornClassFields = function(Parser) {
19429
19490
  this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
19430
19491
  this._maybeParseFieldValue(node);
19431
19492
  this.exitScope();
19432
- this.finishNode(node, "FieldDefinition");
19493
+ this.finishNode(node, "PropertyDefinition");
19433
19494
  this.semicolon();
19434
19495
  return node
19435
19496
  }
@@ -19447,10 +19508,12 @@ var acornClassFields = function(Parser) {
19447
19508
  }
19448
19509
  };
19449
19510
 
19511
+ const privateClassElements = acornPrivateClassElements;
19512
+
19450
19513
  var acornStaticClassFeatures = function(Parser) {
19451
- const ExtendedParser = acornPrivateClassElements(Parser);
19514
+ const ExtendedParser = privateClassElements(Parser);
19452
19515
 
19453
- const acorn = Parser.acorn || require$$0;
19516
+ const acorn = Parser.acorn || require$$1;
19454
19517
  const tt = acorn.tokTypes;
19455
19518
 
19456
19519
  return class extends ExtendedParser {
@@ -19471,7 +19534,7 @@ var acornStaticClassFeatures = function(Parser) {
19471
19534
 
19472
19535
  const branch = this._branch();
19473
19536
  branch.next();
19474
- if ([tt.name, tt.bracketL, tt.string, tt.num, this.privateNameToken].indexOf(branch.type) == -1 && !branch.type.keyword) {
19537
+ if ([tt.name, tt.bracketL, tt.string, tt.num, this.privateIdentifierToken].indexOf(branch.type) == -1 && !branch.type.keyword) {
19475
19538
  return super.parseClassElement.apply(this, arguments)
19476
19539
  }
19477
19540
  if (branch.type == tt.bracketL) {
@@ -19488,7 +19551,7 @@ var acornStaticClassFeatures = function(Parser) {
19488
19551
 
19489
19552
  const node = this.startNode();
19490
19553
  node.static = this.eatContextual("static");
19491
- if (this.type == this.privateNameToken) {
19554
+ if (this.type == this.privateIdentifierToken) {
19492
19555
  this.parsePrivateClassElementName(node);
19493
19556
  } else {
19494
19557
  this.parsePropertyName(node);
@@ -19504,14 +19567,14 @@ var acornStaticClassFeatures = function(Parser) {
19504
19567
  this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
19505
19568
  this._maybeParseFieldValue(node);
19506
19569
  this.exitScope();
19507
- this.finishNode(node, "FieldDefinition");
19570
+ this.finishNode(node, "PropertyDefinition");
19508
19571
  this.semicolon();
19509
19572
  return node
19510
19573
  }
19511
19574
 
19512
19575
  // Parse private static methods
19513
19576
  parsePropertyName(prop) {
19514
- if (prop.static && this.type == this.privateNameToken) {
19577
+ if (prop.static && this.type == this.privateIdentifierToken) {
19515
19578
  this.parsePrivateClassElementName(prop);
19516
19579
  } else {
19517
19580
  super.parsePropertyName(prop);
@@ -19538,21 +19601,21 @@ function normalizeInputOptions(config) {
19538
19601
  const onwarn = getOnwarn(config);
19539
19602
  const strictDeprecations = config.strictDeprecations || false;
19540
19603
  const options = {
19541
- acorn: getAcorn$1(config),
19604
+ acorn: getAcorn(config),
19542
19605
  acornInjectPlugins: getAcornInjectPlugins(config),
19543
19606
  cache: getCache(config),
19544
19607
  context,
19545
19608
  experimentalCacheExpiry: (_b = config.experimentalCacheExpiry) !== null && _b !== void 0 ? _b : 10,
19546
19609
  external: getIdMatcher(config.external),
19547
- inlineDynamicImports: getInlineDynamicImports(config, onwarn, strictDeprecations),
19610
+ inlineDynamicImports: getInlineDynamicImports$1(config, onwarn, strictDeprecations),
19548
19611
  input: getInput(config),
19549
- manualChunks: getManualChunks(config, onwarn, strictDeprecations),
19612
+ manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
19550
19613
  moduleContext: getModuleContext(config, context),
19551
19614
  onwarn,
19552
19615
  perf: config.perf || false,
19553
19616
  plugins: ensureArray(config.plugins),
19554
19617
  preserveEntrySignatures: getPreserveEntrySignatures(config, unsetOptions),
19555
- preserveModules: getPreserveModules(config, onwarn, strictDeprecations),
19618
+ preserveModules: getPreserveModules$1(config, onwarn, strictDeprecations),
19556
19619
  preserveSymlinks: config.preserveSymlinks || false,
19557
19620
  shimMissingExports: config.shimMissingExports || false,
19558
19621
  strictDeprecations,
@@ -19577,7 +19640,7 @@ const getOnwarn = (config) => {
19577
19640
  }
19578
19641
  : defaultOnWarn;
19579
19642
  };
19580
- const getAcorn$1 = (config) => ({
19643
+ const getAcorn = (config) => ({
19581
19644
  allowAwaitOutsideFunction: true,
19582
19645
  ecmaVersion: 'latest',
19583
19646
  preserveParens: false,
@@ -19615,7 +19678,7 @@ const getIdMatcher = (option) => {
19615
19678
  }
19616
19679
  return () => false;
19617
19680
  };
19618
- const getInlineDynamicImports = (config, warn, strictDeprecations) => {
19681
+ const getInlineDynamicImports$1 = (config, warn, strictDeprecations) => {
19619
19682
  const configInlineDynamicImports = config.inlineDynamicImports;
19620
19683
  if (configInlineDynamicImports) {
19621
19684
  warnDeprecationWithOptions('The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.', false, warn, strictDeprecations);
@@ -19626,7 +19689,7 @@ const getInput = (config) => {
19626
19689
  const configInput = config.input;
19627
19690
  return configInput == null ? [] : typeof configInput === 'string' ? [configInput] : configInput;
19628
19691
  };
19629
- const getManualChunks = (config, warn, strictDeprecations) => {
19692
+ const getManualChunks$1 = (config, warn, strictDeprecations) => {
19630
19693
  const configManualChunks = config.manualChunks;
19631
19694
  if (configManualChunks) {
19632
19695
  warnDeprecationWithOptions('The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.', false, warn, strictDeprecations);
@@ -19641,7 +19704,7 @@ const getModuleContext = (config, context) => {
19641
19704
  if (configModuleContext) {
19642
19705
  const contextByModuleId = Object.create(null);
19643
19706
  for (const key of Object.keys(configModuleContext)) {
19644
- contextByModuleId[sysPath.resolve(key)] = configModuleContext[key];
19707
+ contextByModuleId[path.resolve(key)] = configModuleContext[key];
19645
19708
  }
19646
19709
  return id => contextByModuleId[id] || context;
19647
19710
  }
@@ -19654,7 +19717,7 @@ const getPreserveEntrySignatures = (config, unsetOptions) => {
19654
19717
  }
19655
19718
  return configPreserveEntrySignatures !== null && configPreserveEntrySignatures !== void 0 ? configPreserveEntrySignatures : 'strict';
19656
19719
  };
19657
- const getPreserveModules = (config, warn, strictDeprecations) => {
19720
+ const getPreserveModules$1 = (config, warn, strictDeprecations) => {
19658
19721
  const configPreserveModules = config.preserveModules;
19659
19722
  if (configPreserveModules) {
19660
19723
  warnDeprecationWithOptions('The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.', false, warn, strictDeprecations);
@@ -19714,8 +19777,8 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
19714
19777
  const unsetOptions = new Set(unsetInputOptions);
19715
19778
  const compact = config.compact || false;
19716
19779
  const format = getFormat(config);
19717
- const inlineDynamicImports = getInlineDynamicImports$1(config, inputOptions);
19718
- const preserveModules = getPreserveModules$1(config, inlineDynamicImports, inputOptions);
19780
+ const inlineDynamicImports = getInlineDynamicImports(config, inputOptions);
19781
+ const preserveModules = getPreserveModules(config, inlineDynamicImports, inputOptions);
19719
19782
  const file = getFile(config, preserveModules, inputOptions);
19720
19783
  const outputOptions = {
19721
19784
  amd: getAmd(config),
@@ -19740,7 +19803,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
19740
19803
  inlineDynamicImports,
19741
19804
  interop: getInterop(config, inputOptions),
19742
19805
  intro: getAddon(config, 'intro'),
19743
- manualChunks: getManualChunks$1(config, inlineDynamicImports, preserveModules, inputOptions),
19806
+ manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules, inputOptions),
19744
19807
  minifyInternalExports: getMinifyInternalExports(config, format, compact),
19745
19808
  name: config.name,
19746
19809
  namespaceToStringTag: config.namespaceToStringTag || false,
@@ -19756,7 +19819,8 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
19756
19819
  sourcemapFile: config.sourcemapFile,
19757
19820
  sourcemapPathTransform: config.sourcemapPathTransform,
19758
19821
  strict: (_g = config.strict) !== null && _g !== void 0 ? _g : true,
19759
- systemNullSetters: config.systemNullSetters || false
19822
+ systemNullSetters: config.systemNullSetters || false,
19823
+ validate: config.validate || false
19760
19824
  };
19761
19825
  warnUnknownOptions(config, Object.keys(outputOptions), 'output options', inputOptions.onwarn);
19762
19826
  return { options: outputOptions, unsetOptions };
@@ -19803,7 +19867,7 @@ const getFormat = (config) => {
19803
19867
  });
19804
19868
  }
19805
19869
  };
19806
- const getInlineDynamicImports$1 = (config, inputOptions) => {
19870
+ const getInlineDynamicImports = (config, inputOptions) => {
19807
19871
  var _a;
19808
19872
  const inlineDynamicImports = ((_a = config.inlineDynamicImports) !== null && _a !== void 0 ? _a : inputOptions.inlineDynamicImports) ||
19809
19873
  false;
@@ -19816,7 +19880,7 @@ const getInlineDynamicImports$1 = (config, inputOptions) => {
19816
19880
  }
19817
19881
  return inlineDynamicImports;
19818
19882
  };
19819
- const getPreserveModules$1 = (config, inlineDynamicImports, inputOptions) => {
19883
+ const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
19820
19884
  var _a;
19821
19885
  const preserveModules = ((_a = config.preserveModules) !== null && _a !== void 0 ? _a : inputOptions.preserveModules) || false;
19822
19886
  if (preserveModules) {
@@ -19840,7 +19904,7 @@ const getPreserveModulesRoot = (config) => {
19840
19904
  if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
19841
19905
  return undefined;
19842
19906
  }
19843
- return sysPath.resolve(preserveModulesRoot);
19907
+ return path.resolve(preserveModulesRoot);
19844
19908
  };
19845
19909
  const getAmd = (config) => {
19846
19910
  const collection = {
@@ -19960,7 +20024,7 @@ const getInterop = (config, inputOptions) => {
19960
20024
  }
19961
20025
  return configInterop === undefined ? () => true : () => validateInterop(configInterop);
19962
20026
  };
19963
- const getManualChunks$1 = (config, inlineDynamicImports, preserveModules, inputOptions) => {
20027
+ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOptions) => {
19964
20028
  const configManualChunks = config.manualChunks || inputOptions.manualChunks;
19965
20029
  if (configManualChunks) {
19966
20030
  if (inlineDynamicImports) {
@@ -20044,7 +20108,7 @@ async function getInputOptions(rawInputOptions, watchMode) {
20044
20108
  function applyOptionHook(watchMode) {
20045
20109
  return async (inputOptions, plugin) => {
20046
20110
  if (plugin.options)
20047
- return (plugin.options.call({ meta: { rollupVersion: version, watchMode } }, await inputOptions) || inputOptions);
20111
+ return (plugin.options.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions) || inputOptions);
20048
20112
  return inputOptions;
20049
20113
  };
20050
20114
  }
@@ -20058,7 +20122,7 @@ function normalizePlugins(plugins, anonymousPrefix) {
20058
20122
  }
20059
20123
  async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutputOptions, graph) {
20060
20124
  const { options: outputOptions, outputPluginDriver, unsetOptions } = getOutputOptionsAndPluginDriver(rawOutputOptions, graph.pluginDriver, inputOptions, unsetInputOptions);
20061
- const bundle = new Bundle$1(outputOptions, unsetOptions, inputOptions, outputPluginDriver, graph);
20125
+ const bundle = new Bundle(outputOptions, unsetOptions, inputOptions, outputPluginDriver, graph);
20062
20126
  const generated = await bundle.generate(isWrite);
20063
20127
  if (isWrite) {
20064
20128
  if (!outputOptions.dir && !outputOptions.file) {
@@ -20123,7 +20187,7 @@ function getSortingFileType(file) {
20123
20187
  return SortingFileType.SECONDARY_CHUNK;
20124
20188
  }
20125
20189
  function writeOutputFile(outputFile, outputOptions) {
20126
- const fileName = sysPath.resolve(outputOptions.dir || sysPath.dirname(outputOptions.file), outputFile.fileName);
20190
+ const fileName = path.resolve(outputOptions.dir || path.dirname(outputOptions.file), outputFile.fileName);
20127
20191
  let writeSourceMapPromise;
20128
20192
  let source;
20129
20193
  if (outputFile.type === 'asset') {
@@ -20137,7 +20201,7 @@ function writeOutputFile(outputFile, outputOptions) {
20137
20201
  url = outputFile.map.toUrl();
20138
20202
  }
20139
20203
  else {
20140
- url = `${sysPath.basename(outputFile.fileName)}.map`;
20204
+ url = `${path.basename(outputFile.fileName)}.map`;
20141
20205
  writeSourceMapPromise = writeFile(`${fileName}.map`, outputFile.map.toString());
20142
20206
  }
20143
20207
  if (outputOptions.sourcemap !== 'hidden') {
@@ -20148,7 +20212,7 @@ function writeOutputFile(outputFile, outputOptions) {
20148
20212
  return Promise.all([writeFile(fileName, source), writeSourceMapPromise]);
20149
20213
  }
20150
20214
 
20151
- class WatchEmitter extends require$$0$1.EventEmitter {
20215
+ class WatchEmitter extends require$$0.EventEmitter {
20152
20216
  constructor() {
20153
20217
  super();
20154
20218
  // Allows more than 10 bundles to be watched without
@@ -20170,7 +20234,6 @@ function watch(configs) {
20170
20234
  return emitter;
20171
20235
  }
20172
20236
 
20173
- exports.createCommonjsModule = createCommonjsModule;
20174
20237
  exports.defaultOnWarn = defaultOnWarn;
20175
20238
  exports.ensureArray = ensureArray;
20176
20239
  exports.error = error;
@@ -20182,7 +20245,7 @@ exports.loadFsEvents = loadFsEvents;
20182
20245
  exports.relativeId = relativeId;
20183
20246
  exports.rollup = rollup;
20184
20247
  exports.rollupInternal = rollupInternal;
20185
- exports.version = version;
20248
+ exports.version = version$1;
20186
20249
  exports.warnUnknownOptions = warnUnknownOptions;
20187
20250
  exports.watch = watch;
20188
20251
  //# sourceMappingURL=rollup.js.map