rollup 3.8.1 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,143 +1,109 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.8.1
4
- Fri, 23 Dec 2022 05:34:14 GMT - commit 571f3a83d4e24f7bfa9b085cf9736ccdf89e8251
3
+ Rollup.js v3.9.1
4
+ Mon, 02 Jan 2023 13:46:34 GMT - commit c6c884433e748cde70f3f4299dd48b81af97ec14
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
10
10
  import { resolve, basename, extname, dirname, relative as relative$1 } from 'node:path';
11
- import require$$0$1, { win32, posix, isAbsolute as isAbsolute$1, resolve as resolve$1 } from 'path';
11
+ import require$$0$2, { win32, posix, isAbsolute as isAbsolute$1, resolve as resolve$1 } from 'path';
12
12
  import process$1, { env as env$1 } from 'node:process';
13
13
  import { performance } from 'node:perf_hooks';
14
14
  import { createHash as createHash$1 } from 'node:crypto';
15
- import { promises } from 'node:fs';
15
+ import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
16
16
  import { EventEmitter } from 'node:events';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version$1 = "3.8.1";
20
-
21
- var charToInteger = {};
22
- var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
23
- for (var i$1 = 0; i$1 < chars$1.length; i$1++) {
24
- charToInteger[chars$1.charCodeAt(i$1)] = i$1;
25
- }
26
- function decode(mappings) {
27
- var decoded = [];
28
- var line = [];
29
- var segment = [
30
- 0,
31
- 0,
32
- 0,
33
- 0,
34
- 0,
35
- ];
36
- var j = 0;
37
- for (var i = 0, shift = 0, value = 0; i < mappings.length; i++) {
38
- var c = mappings.charCodeAt(i);
39
- if (c === 44) { // ","
40
- segmentify(line, segment, j);
41
- j = 0;
42
- }
43
- else if (c === 59) { // ";"
44
- segmentify(line, segment, j);
45
- j = 0;
46
- decoded.push(line);
47
- line = [];
48
- segment[0] = 0;
19
+ var version$1 = "3.9.1";
20
+
21
+ const comma = ','.charCodeAt(0);
22
+ const semicolon = ';'.charCodeAt(0);
23
+ const chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
24
+ const intToChar = new Uint8Array(64); // 64 possible chars.
25
+ const charToInt = new Uint8Array(128); // z is 122 in ASCII
26
+ for (let i = 0; i < chars$2.length; i++) {
27
+ const c = chars$2.charCodeAt(i);
28
+ intToChar[i] = c;
29
+ charToInt[c] = i;
30
+ }
31
+ // Provide a fallback for older environments.
32
+ const td = typeof TextDecoder !== 'undefined'
33
+ ? /* #__PURE__ */ new TextDecoder()
34
+ : typeof Buffer !== 'undefined'
35
+ ? {
36
+ decode(buf) {
37
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
38
+ return out.toString();
39
+ },
49
40
  }
50
- else {
51
- var integer = charToInteger[c];
52
- if (integer === undefined) {
53
- throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
54
- }
55
- var hasContinuationBit = integer & 32;
56
- integer &= 31;
57
- value += integer << shift;
58
- if (hasContinuationBit) {
59
- shift += 5;
60
- }
61
- else {
62
- var shouldNegate = value & 1;
63
- value >>>= 1;
64
- if (shouldNegate) {
65
- value = value === 0 ? -0x80000000 : -value;
41
+ : {
42
+ decode(buf) {
43
+ let out = '';
44
+ for (let i = 0; i < buf.length; i++) {
45
+ out += String.fromCharCode(buf[i]);
66
46
  }
67
- segment[j] += value;
68
- j++;
69
- value = shift = 0; // reset
70
- }
71
- }
72
- }
73
- segmentify(line, segment, j);
74
- decoded.push(line);
75
- return decoded;
76
- }
77
- function segmentify(line, segment, j) {
78
- // This looks ugly, but we're creating specialized arrays with a specific
79
- // length. This is much faster than creating a new array (which v8 expands to
80
- // a capacity of 17 after pushing the first item), or slicing out a subarray
81
- // (which is slow). Length 4 is assumed to be the most frequent, followed by
82
- // length 5 (since not everything will have an associated name), followed by
83
- // length 1 (it's probably rare for a source substring to not have an
84
- // associated segment data).
85
- if (j === 4)
86
- line.push([segment[0], segment[1], segment[2], segment[3]]);
87
- else if (j === 5)
88
- line.push([segment[0], segment[1], segment[2], segment[3], segment[4]]);
89
- else if (j === 1)
90
- line.push([segment[0]]);
91
- }
47
+ return out;
48
+ },
49
+ };
92
50
  function encode(decoded) {
93
- var sourceFileIndex = 0; // second field
94
- var sourceCodeLine = 0; // third field
95
- var sourceCodeColumn = 0; // fourth field
96
- var nameIndex = 0; // fifth field
97
- var mappings = '';
98
- for (var i = 0; i < decoded.length; i++) {
99
- var line = decoded[i];
100
- if (i > 0)
101
- mappings += ';';
51
+ const state = new Int32Array(5);
52
+ const bufLength = 1024 * 16;
53
+ const subLength = bufLength - 36;
54
+ const buf = new Uint8Array(bufLength);
55
+ const sub = buf.subarray(0, subLength);
56
+ let pos = 0;
57
+ let out = '';
58
+ for (let i = 0; i < decoded.length; i++) {
59
+ const line = decoded[i];
60
+ if (i > 0) {
61
+ if (pos === bufLength) {
62
+ out += td.decode(buf);
63
+ pos = 0;
64
+ }
65
+ buf[pos++] = semicolon;
66
+ }
102
67
  if (line.length === 0)
103
68
  continue;
104
- var generatedCodeColumn = 0; // first field
105
- var lineMappings = [];
106
- for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
107
- var segment = line_1[_i];
108
- var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
109
- generatedCodeColumn = segment[0];
110
- if (segment.length > 1) {
111
- segmentMappings +=
112
- encodeInteger(segment[1] - sourceFileIndex) +
113
- encodeInteger(segment[2] - sourceCodeLine) +
114
- encodeInteger(segment[3] - sourceCodeColumn);
115
- sourceFileIndex = segment[1];
116
- sourceCodeLine = segment[2];
117
- sourceCodeColumn = segment[3];
118
- }
119
- if (segment.length === 5) {
120
- segmentMappings += encodeInteger(segment[4] - nameIndex);
121
- nameIndex = segment[4];
122
- }
123
- lineMappings.push(segmentMappings);
124
- }
125
- mappings += lineMappings.join(',');
126
- }
127
- return mappings;
128
- }
129
- function encodeInteger(num) {
130
- var result = '';
69
+ state[0] = 0;
70
+ for (let j = 0; j < line.length; j++) {
71
+ const segment = line[j];
72
+ // We can push up to 5 ints, each int can take at most 7 chars, and we
73
+ // may push a comma.
74
+ if (pos > subLength) {
75
+ out += td.decode(sub);
76
+ buf.copyWithin(0, subLength, pos);
77
+ pos -= subLength;
78
+ }
79
+ if (j > 0)
80
+ buf[pos++] = comma;
81
+ pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
82
+ if (segment.length === 1)
83
+ continue;
84
+ pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
85
+ pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
86
+ pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
87
+ if (segment.length === 4)
88
+ continue;
89
+ pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
90
+ }
91
+ }
92
+ return out + td.decode(buf.subarray(0, pos));
93
+ }
94
+ function encodeInteger(buf, pos, state, segment, j) {
95
+ const next = segment[j];
96
+ let num = next - state[j];
97
+ state[j] = next;
131
98
  num = num < 0 ? (-num << 1) | 1 : num << 1;
132
99
  do {
133
- var clamped = num & 31;
100
+ let clamped = num & 0b011111;
134
101
  num >>>= 5;
135
- if (num > 0) {
136
- clamped |= 32;
137
- }
138
- result += chars$1[clamped];
102
+ if (num > 0)
103
+ clamped |= 0b100000;
104
+ buf[pos++] = intToChar[clamped];
139
105
  } while (num > 0);
140
- return result;
106
+ return pos;
141
107
  }
142
108
 
143
109
  class BitSet {
@@ -1631,7 +1597,7 @@ function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName)
1631
1597
  return [...relativePath.split('/'), '..', basename(targetPath)].join('/');
1632
1598
  }
1633
1599
  }
1634
- return !relativePath ? '.' : relativePath.startsWith('..') ? relativePath : './' + relativePath;
1600
+ return relativePath ? (relativePath.startsWith('..') ? relativePath : './' + relativePath) : '.';
1635
1601
  }
1636
1602
 
1637
1603
  class ExternalChunk {
@@ -2234,7 +2200,7 @@ function errorInternalIdCannotBeExternal(source, importer) {
2234
2200
  function errorInvalidOption(option, urlHash, explanation, value) {
2235
2201
  return {
2236
2202
  code: INVALID_OPTION,
2237
- message: `Invalid value ${value !== undefined ? `${JSON.stringify(value)} ` : ''}for option "${option}" - ${explanation}.`,
2203
+ message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
2238
2204
  url: `https://rollupjs.org/guide/en/#${urlHash}`
2239
2205
  };
2240
2206
  }
@@ -2702,9 +2668,16 @@ function getDefaultExportFromCjs (x) {
2702
2668
  }
2703
2669
 
2704
2670
  function getAugmentedNamespace(n) {
2671
+ if (n.__esModule) return n;
2705
2672
  var f = n.default;
2706
2673
  if (typeof f == "function") {
2707
- var a = function () {
2674
+ var a = function a () {
2675
+ if (this instanceof a) {
2676
+ var args = [null];
2677
+ args.push.apply(args, arguments);
2678
+ var Ctor = Function.bind.apply(f, args);
2679
+ return new Ctor();
2680
+ }
2708
2681
  return f.apply(this, arguments);
2709
2682
  };
2710
2683
  a.prototype = f.prototype;
@@ -2722,11 +2695,15 @@ function getAugmentedNamespace(n) {
2722
2695
  return a;
2723
2696
  }
2724
2697
 
2725
- var picomatch$1 = {exports: {}};
2698
+ var picomatchExports = {};
2699
+ var picomatch$1 = {
2700
+ get exports(){ return picomatchExports; },
2701
+ set exports(v){ picomatchExports = v; },
2702
+ };
2726
2703
 
2727
2704
  var utils$3 = {};
2728
2705
 
2729
- const path$1 = require$$0$1;
2706
+ const path$1 = require$$0$2;
2730
2707
  const WIN_SLASH = '\\\\/';
2731
2708
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
2732
2709
 
@@ -2906,7 +2883,7 @@ var constants$2 = {
2906
2883
 
2907
2884
  (function (exports) {
2908
2885
 
2909
- const path = require$$0$1;
2886
+ const path = require$$0$2;
2910
2887
  const win32 = process.platform === 'win32';
2911
2888
  const {
2912
2889
  REGEX_BACKSLASH,
@@ -4443,7 +4420,7 @@ parse$2.fastpaths = (input, options) => {
4443
4420
 
4444
4421
  var parse_1 = parse$2;
4445
4422
 
4446
- const path = require$$0$1;
4423
+ const path = require$$0$2;
4447
4424
  const scan = scan_1;
4448
4425
  const parse$1 = parse_1;
4449
4426
  const utils = utils$3;
@@ -4789,7 +4766,7 @@ var picomatch_1 = picomatch;
4789
4766
  module.exports = picomatch_1;
4790
4767
  } (picomatch$1));
4791
4768
 
4792
- const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch$1.exports);
4769
+ const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
4793
4770
 
4794
4771
  const extractors = {
4795
4772
  ArrayPattern(names, param) {
@@ -4892,8 +4869,8 @@ const createFilter = function createFilter(include, exclude, options) {
4892
4869
  };
4893
4870
 
4894
4871
  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';
4895
- const builtins$1 = 'arguments 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';
4896
- const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins$1}`.split(' '));
4872
+ const builtins = 'arguments 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';
4873
+ const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins}`.split(' '));
4897
4874
  forbiddenIdentifiers.add('');
4898
4875
 
4899
4876
  const BROKEN_FLOW_NONE = 0;
@@ -5399,8 +5376,6 @@ const ChainExpression$1 = 'ChainExpression';
5399
5376
  const ConditionalExpression$1 = 'ConditionalExpression';
5400
5377
  const ExpressionStatement$1 = 'ExpressionStatement';
5401
5378
  const Identifier$1 = 'Identifier';
5402
- const ImportDefaultSpecifier$1 = 'ImportDefaultSpecifier';
5403
- const ImportNamespaceSpecifier$1 = 'ImportNamespaceSpecifier';
5404
5379
  const LogicalExpression$1 = 'LogicalExpression';
5405
5380
  const NewExpression$1 = 'NewExpression';
5406
5381
  const Program$1 = 'Program';
@@ -6093,21 +6068,7 @@ class ObjectEntity extends ExpressionEntity {
6093
6068
  for (let index = properties.length - 1; index >= 0; index--) {
6094
6069
  const { key, kind, property } = properties[index];
6095
6070
  allProperties.push(property);
6096
- if (typeof key !== 'string') {
6097
- if (key === UnknownInteger) {
6098
- unknownIntegerProps.push(property);
6099
- continue;
6100
- }
6101
- if (kind === 'set')
6102
- unmatchableSetters.push(property);
6103
- if (kind === 'get')
6104
- unmatchableGetters.push(property);
6105
- if (kind !== 'get')
6106
- unmatchablePropertiesAndSetters.push(property);
6107
- if (kind !== 'set')
6108
- unmatchablePropertiesAndGetters.push(property);
6109
- }
6110
- else {
6071
+ if (typeof key === 'string') {
6111
6072
  if (kind === 'set') {
6112
6073
  if (!propertiesAndSettersByKey[key]) {
6113
6074
  propertiesAndSettersByKey[key] = [property, ...unmatchablePropertiesAndSetters];
@@ -6129,6 +6090,20 @@ class ObjectEntity extends ExpressionEntity {
6129
6090
  }
6130
6091
  }
6131
6092
  }
6093
+ else {
6094
+ if (key === UnknownInteger) {
6095
+ unknownIntegerProps.push(property);
6096
+ continue;
6097
+ }
6098
+ if (kind === 'set')
6099
+ unmatchableSetters.push(property);
6100
+ if (kind === 'get')
6101
+ unmatchableGetters.push(property);
6102
+ if (kind !== 'get')
6103
+ unmatchablePropertiesAndSetters.push(property);
6104
+ if (kind !== 'set')
6105
+ unmatchablePropertiesAndGetters.push(property);
6106
+ }
6132
6107
  }
6133
6108
  }
6134
6109
  deoptimizeCachedEntities() {
@@ -6326,8 +6301,6 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
6326
6301
  flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
6327
6302
  flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
6328
6303
  forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6329
- group: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6330
- groupToMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6331
6304
  includes: METHOD_RETURNS_BOOLEAN,
6332
6305
  indexOf: METHOD_RETURNS_NUMBER,
6333
6306
  join: METHOD_RETURNS_STRING,
@@ -6398,11 +6371,11 @@ class ArrayExpression extends NodeBase {
6398
6371
  properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
6399
6372
  }
6400
6373
  }
6401
- else if (!element) {
6402
- properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
6374
+ else if (element) {
6375
+ properties.push({ key: String(index), kind: 'init', property: element });
6403
6376
  }
6404
6377
  else {
6405
- properties.push({ key: String(index), kind: 'init', property: element });
6378
+ properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
6406
6379
  }
6407
6380
  }
6408
6381
  return (this.objectEntity = new ObjectEntity(properties, ARRAY_PROTOTYPE));
@@ -6588,14 +6561,14 @@ class LocalVariable extends Variable {
6588
6561
  }
6589
6562
  }
6590
6563
 
6591
- const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
6564
+ const chars$1 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
6592
6565
  const base = 64;
6593
6566
  function toBase64(value) {
6594
6567
  let outString = '';
6595
6568
  do {
6596
6569
  const currentDigit = value % base;
6597
6570
  value = (value / base) | 0;
6598
- outString = chars[currentDigit] + outString;
6571
+ outString = chars$1[currentDigit] + outString;
6599
6572
  } while (value !== 0);
6600
6573
  return outString;
6601
6574
  }
@@ -9605,9 +9578,9 @@ class ClassNode extends NodeBase {
9605
9578
  hasEffectsOnInteractionAtPath(path, interaction, context) {
9606
9579
  return interaction.type === INTERACTION_CALLED && path.length === 0
9607
9580
  ? !interaction.withNew ||
9608
- (this.classConstructor !== null
9609
- ? this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)
9610
- : this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
9581
+ (this.classConstructor === null
9582
+ ? this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)
9583
+ : this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
9611
9584
  false
9612
9585
  : this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
9613
9586
  }
@@ -9784,12 +9757,12 @@ class ConditionalExpression extends NodeBase {
9784
9757
  }
9785
9758
  deoptimizePath(path) {
9786
9759
  const usedBranch = this.getUsedBranch();
9787
- if (!usedBranch) {
9788
- this.consequent.deoptimizePath(path);
9789
- this.alternate.deoptimizePath(path);
9760
+ if (usedBranch) {
9761
+ usedBranch.deoptimizePath(path);
9790
9762
  }
9791
9763
  else {
9792
- usedBranch.deoptimizePath(path);
9764
+ this.consequent.deoptimizePath(path);
9765
+ this.alternate.deoptimizePath(path);
9793
9766
  }
9794
9767
  }
9795
9768
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -9847,17 +9820,22 @@ class ConditionalExpression extends NodeBase {
9847
9820
  }
9848
9821
  includeCallArguments(context, parameters) {
9849
9822
  const usedBranch = this.getUsedBranch();
9850
- if (!usedBranch) {
9851
- this.consequent.includeCallArguments(context, parameters);
9852
- this.alternate.includeCallArguments(context, parameters);
9823
+ if (usedBranch) {
9824
+ usedBranch.includeCallArguments(context, parameters);
9853
9825
  }
9854
9826
  else {
9855
- usedBranch.includeCallArguments(context, parameters);
9827
+ this.consequent.includeCallArguments(context, parameters);
9828
+ this.alternate.includeCallArguments(context, parameters);
9856
9829
  }
9857
9830
  }
9858
9831
  render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
9859
9832
  const usedBranch = this.getUsedBranch();
9860
- if (!this.test.included) {
9833
+ if (this.test.included) {
9834
+ this.test.render(code, options, { renderedSurroundingElement });
9835
+ this.consequent.render(code, options);
9836
+ this.alternate.render(code, options);
9837
+ }
9838
+ else {
9861
9839
  const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
9862
9840
  const inclusionStart = findNonWhiteSpace(code.original, (this.consequent.included
9863
9841
  ? findFirstOccurrenceOutsideComment(code.original, '?', this.test.end)
@@ -9877,11 +9855,6 @@ class ConditionalExpression extends NodeBase {
9877
9855
  renderedSurroundingElement: renderedSurroundingElement || this.parent.type
9878
9856
  });
9879
9857
  }
9880
- else {
9881
- this.test.render(code, options, { renderedSurroundingElement });
9882
- this.consequent.render(code, options);
9883
- this.alternate.render(code, options);
9884
- }
9885
9858
  }
9886
9859
  getUsedBranch() {
9887
9860
  if (this.isBranchResolutionAnalysed) {
@@ -10919,12 +10892,12 @@ class LogicalExpression extends NodeBase {
10919
10892
  }
10920
10893
  deoptimizePath(path) {
10921
10894
  const usedBranch = this.getUsedBranch();
10922
- if (!usedBranch) {
10923
- this.left.deoptimizePath(path);
10924
- this.right.deoptimizePath(path);
10895
+ if (usedBranch) {
10896
+ usedBranch.deoptimizePath(path);
10925
10897
  }
10926
10898
  else {
10927
- usedBranch.deoptimizePath(path);
10899
+ this.left.deoptimizePath(path);
10900
+ this.right.deoptimizePath(path);
10928
10901
  }
10929
10902
  }
10930
10903
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -12123,7 +12096,10 @@ class VariableDeclaration extends NodeBase {
12123
12096
  code.remove(this.end - 1, this.end);
12124
12097
  }
12125
12098
  separatorString += ';';
12126
- if (lastSeparatorPos !== null) {
12099
+ if (lastSeparatorPos === null) {
12100
+ code.appendLeft(renderedContentEnd, separatorString);
12101
+ }
12102
+ else {
12127
12103
  if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
12128
12104
  (code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
12129
12105
  code.original.charCodeAt(this.end) === 13) /*"\r"*/) {
@@ -12140,9 +12116,6 @@ class VariableDeclaration extends NodeBase {
12140
12116
  code.remove(actualContentEnd, renderedContentEnd);
12141
12117
  }
12142
12118
  }
12143
- else {
12144
- code.appendLeft(renderedContentEnd, separatorString);
12145
- }
12146
12119
  if (systemPatternExports.length > 0) {
12147
12120
  code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
12148
12121
  }
@@ -12466,7 +12439,8 @@ class NamespaceVariable extends Variable {
12466
12439
  return this.memberVariables;
12467
12440
  }
12468
12441
  const memberVariables = Object.create(null);
12469
- for (const name of [...this.context.getExports(), ...this.context.getReexports()]) {
12442
+ const sortedExports = [...this.context.getExports(), ...this.context.getReexports()].sort();
12443
+ for (const name of sortedExports) {
12470
12444
  if (name[0] !== '*' && name !== this.module.info.syntheticNamedExports) {
12471
12445
  const exportedVariable = this.context.traceExport(name);
12472
12446
  if (exportedVariable) {
@@ -13360,15 +13334,15 @@ class Module {
13360
13334
  if (localVariable) {
13361
13335
  return localVariable;
13362
13336
  }
13363
- const importDeclaration = this.importDescriptions.get(name);
13364
- if (importDeclaration) {
13365
- const otherModule = importDeclaration.module;
13366
- if (otherModule instanceof Module && importDeclaration.name === '*') {
13337
+ const importDescription = this.importDescriptions.get(name);
13338
+ if (importDescription) {
13339
+ const otherModule = importDescription.module;
13340
+ if (otherModule instanceof Module && importDescription.name === '*') {
13367
13341
  return otherModule.namespace;
13368
13342
  }
13369
- const [declaration] = getVariableForExportNameRecursive(otherModule, importDeclaration.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules);
13343
+ const [declaration] = getVariableForExportNameRecursive(otherModule, importDescription.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules);
13370
13344
  if (!declaration) {
13371
- return this.error(errorMissingExport(importDeclaration.name, this.id, otherModule.id), importDeclaration.start);
13345
+ return this.error(errorMissingExport(importDescription.name, this.id, otherModule.id), importDescription.start);
13372
13346
  }
13373
13347
  return declaration;
13374
13348
  }
@@ -13439,13 +13413,13 @@ class Module {
13439
13413
  // export { name } from './other'
13440
13414
  const source = node.source.value;
13441
13415
  this.addSource(source, node);
13442
- for (const specifier of node.specifiers) {
13443
- const name = specifier.exported.name;
13416
+ for (const { exported, local, start } of node.specifiers) {
13417
+ const name = exported instanceof Literal ? exported.value : exported.name;
13444
13418
  this.reexportDescriptions.set(name, {
13445
- localName: specifier.local.name,
13419
+ localName: local instanceof Literal ? local.value : local.name,
13446
13420
  module: null,
13447
13421
  source,
13448
- start: specifier.start
13422
+ start
13449
13423
  });
13450
13424
  }
13451
13425
  }
@@ -13468,9 +13442,10 @@ class Module {
13468
13442
  }
13469
13443
  else {
13470
13444
  // export { foo, bar, baz }
13471
- for (const specifier of node.specifiers) {
13472
- const localName = specifier.local.name;
13473
- const exportedName = specifier.exported.name;
13445
+ for (const { local, exported } of node.specifiers) {
13446
+ // except for reexports, local must be an Identifier
13447
+ const localName = local.name;
13448
+ const exportedName = exported instanceof Identifier ? exported.name : exported.value;
13474
13449
  this.exports.set(exportedName, { identifier: null, localName });
13475
13450
  }
13476
13451
  }
@@ -13479,9 +13454,13 @@ class Module {
13479
13454
  const source = node.source.value;
13480
13455
  this.addSource(source, node);
13481
13456
  for (const specifier of node.specifiers) {
13482
- const isDefault = specifier.type === ImportDefaultSpecifier$1;
13483
- const isNamespace = specifier.type === ImportNamespaceSpecifier$1;
13484
- const name = isDefault ? 'default' : isNamespace ? '*' : specifier.imported.name;
13457
+ const name = specifier instanceof ImportDefaultSpecifier
13458
+ ? 'default'
13459
+ : specifier instanceof ImportNamespaceSpecifier
13460
+ ? '*'
13461
+ : specifier.imported instanceof Identifier
13462
+ ? specifier.imported.name
13463
+ : specifier.imported.value;
13485
13464
  this.importDescriptions.set(specifier.local.name, {
13486
13465
  module: null,
13487
13466
  name,
@@ -13688,7 +13667,7 @@ function getCompleteAmdId(options, chunkId) {
13688
13667
  if (options.autoId) {
13689
13668
  return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`;
13690
13669
  }
13691
- return options.id || '';
13670
+ return options.id ?? '';
13692
13671
  }
13693
13672
 
13694
13673
  function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, mechanism = 'return ') {
@@ -13895,33 +13874,82 @@ function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
13895
13874
  return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
13896
13875
  }
13897
13876
 
13898
- const builtins = {
13899
- assert: 1,
13900
- buffer: 1,
13901
- console: 1,
13902
- constants: 1,
13903
- domain: 1,
13904
- events: 1,
13905
- http: 1,
13906
- https: 1,
13907
- os: 1,
13908
- path: 1,
13909
- process: 1,
13910
- punycode: 1,
13911
- querystring: 1,
13912
- stream: 1,
13913
- string_decoder: 1,
13914
- timers: 1,
13915
- tty: 1,
13916
- url: 1,
13917
- util: 1,
13918
- vm: 1,
13919
- zlib: 1
13920
- };
13877
+ var _staticExports = {};
13878
+ var _static = {
13879
+ get exports(){ return _staticExports; },
13880
+ set exports(v){ _staticExports = v; },
13881
+ };
13882
+
13883
+ const require$$0$1 = [
13884
+ "assert",
13885
+ "async_hooks",
13886
+ "buffer",
13887
+ "child_process",
13888
+ "cluster",
13889
+ "console",
13890
+ "constants",
13891
+ "crypto",
13892
+ "dgram",
13893
+ "diagnostics_channel",
13894
+ "dns",
13895
+ "domain",
13896
+ "events",
13897
+ "fs",
13898
+ "http",
13899
+ "http2",
13900
+ "https",
13901
+ "inspector",
13902
+ "module",
13903
+ "net",
13904
+ "os",
13905
+ "path",
13906
+ "perf_hooks",
13907
+ "process",
13908
+ "punycode",
13909
+ "querystring",
13910
+ "readline",
13911
+ "repl",
13912
+ "stream",
13913
+ "string_decoder",
13914
+ "timers",
13915
+ "tls",
13916
+ "trace_events",
13917
+ "tty",
13918
+ "url",
13919
+ "util",
13920
+ "v8",
13921
+ "vm",
13922
+ "wasi",
13923
+ "worker_threads",
13924
+ "zlib"
13925
+ ];
13926
+
13927
+ (function (module) {
13928
+ module.exports = require$$0$1;
13929
+ } (_static));
13930
+
13931
+ const builtinModules = /*@__PURE__*/getDefaultExportFromCjs(_staticExports);
13932
+
13933
+ const nodeBuiltins = new Set([
13934
+ ...builtinModules,
13935
+ // TODO
13936
+ // remove once builtin-modules includes PR: https://github.com/sindresorhus/builtin-modules/pull/17
13937
+ 'assert/strict',
13938
+ 'dns/promises',
13939
+ 'fs/promises',
13940
+ 'path/posix',
13941
+ 'path/win32',
13942
+ 'readline/promises',
13943
+ 'stream/consumers',
13944
+ 'stream/promises',
13945
+ 'stream/web',
13946
+ 'timers/promises',
13947
+ 'util/types'
13948
+ ]);
13921
13949
  function warnOnBuiltins(warn, dependencies) {
13922
13950
  const externalBuiltins = dependencies
13923
13951
  .map(({ importPath }) => importPath)
13924
- .filter(importPath => importPath in builtins || importPath.startsWith('node:'));
13952
+ .filter(importPath => nodeBuiltins.has(importPath) || importPath.startsWith('node:'));
13925
13953
  if (externalBuiltins.length === 0)
13926
13954
  return;
13927
13955
  warn(errorMissingNodeBuiltins(externalBuiltins));
@@ -15073,10 +15101,7 @@ class Chunk {
15073
15101
  if (file) {
15074
15102
  fileName = basename(file);
15075
15103
  }
15076
- else if (this.fileName !== null) {
15077
- fileName = this.fileName;
15078
- }
15079
- else {
15104
+ else if (this.fileName === null) {
15080
15105
  const [pattern, patternName] = preserveModules || this.facadeModule?.isUserDefinedEntryPoint
15081
15106
  ? [entryFileNames, 'output.entryFileNames']
15082
15107
  : [chunkFileNames, 'output.chunkFileNames'];
@@ -15089,6 +15114,9 @@ class Chunk {
15089
15114
  fileName = makeUnique(fileName, this.bundle);
15090
15115
  }
15091
15116
  }
15117
+ else {
15118
+ fileName = this.fileName;
15119
+ }
15092
15120
  if (!hashPlaceholder) {
15093
15121
  this.bundle[fileName] = FILE_PLACEHOLDER;
15094
15122
  }
@@ -16335,10 +16363,7 @@ function getLinkMap(warn) {
16335
16363
  }
16336
16364
  function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, linkMap) {
16337
16365
  let source;
16338
- if (!originalSourcemap) {
16339
- source = new Source(id, originalCode);
16340
- }
16341
- else {
16366
+ if (originalSourcemap) {
16342
16367
  const sources = originalSourcemap.sources;
16343
16368
  const sourcesContent = originalSourcemap.sourcesContent || [];
16344
16369
  const directory = dirname(id) || '.';
@@ -16346,6 +16371,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
16346
16371
  const baseSources = sources.map((source, index) => new Source(resolve(directory, sourceRoot, source), sourcesContent[index]));
16347
16372
  source = new Link(originalSourcemap, baseSources);
16348
16373
  }
16374
+ else {
16375
+ source = new Source(id, originalCode);
16376
+ }
16349
16377
  return sourcemapChain.reduce(linkMap, source);
16350
16378
  }
16351
16379
  function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeContent, warn) {
@@ -16375,6 +16403,78 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
16375
16403
 
16376
16404
  const createHash = () => createHash$1('sha256');
16377
16405
 
16406
+ var charToInteger = {};
16407
+ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
16408
+ for (var i$1 = 0; i$1 < chars.length; i$1++) {
16409
+ charToInteger[chars.charCodeAt(i$1)] = i$1;
16410
+ }
16411
+ function decode(mappings) {
16412
+ var decoded = [];
16413
+ var line = [];
16414
+ var segment = [
16415
+ 0,
16416
+ 0,
16417
+ 0,
16418
+ 0,
16419
+ 0,
16420
+ ];
16421
+ var j = 0;
16422
+ for (var i = 0, shift = 0, value = 0; i < mappings.length; i++) {
16423
+ var c = mappings.charCodeAt(i);
16424
+ if (c === 44) { // ","
16425
+ segmentify(line, segment, j);
16426
+ j = 0;
16427
+ }
16428
+ else if (c === 59) { // ";"
16429
+ segmentify(line, segment, j);
16430
+ j = 0;
16431
+ decoded.push(line);
16432
+ line = [];
16433
+ segment[0] = 0;
16434
+ }
16435
+ else {
16436
+ var integer = charToInteger[c];
16437
+ if (integer === undefined) {
16438
+ throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
16439
+ }
16440
+ var hasContinuationBit = integer & 32;
16441
+ integer &= 31;
16442
+ value += integer << shift;
16443
+ if (hasContinuationBit) {
16444
+ shift += 5;
16445
+ }
16446
+ else {
16447
+ var shouldNegate = value & 1;
16448
+ value >>>= 1;
16449
+ if (shouldNegate) {
16450
+ value = value === 0 ? -0x80000000 : -value;
16451
+ }
16452
+ segment[j] += value;
16453
+ j++;
16454
+ value = shift = 0; // reset
16455
+ }
16456
+ }
16457
+ }
16458
+ segmentify(line, segment, j);
16459
+ decoded.push(line);
16460
+ return decoded;
16461
+ }
16462
+ function segmentify(line, segment, j) {
16463
+ // This looks ugly, but we're creating specialized arrays with a specific
16464
+ // length. This is much faster than creating a new array (which v8 expands to
16465
+ // a capacity of 17 after pushing the first item), or slicing out a subarray
16466
+ // (which is slow). Length 4 is assumed to be the most frequent, followed by
16467
+ // length 5 (since not everything will have an associated name), followed by
16468
+ // length 1 (it's probably rare for a source substring to not have an
16469
+ // associated segment data).
16470
+ if (j === 4)
16471
+ line.push([segment[0], segment[1], segment[2], segment[3]]);
16472
+ else if (j === 5)
16473
+ line.push([segment[0], segment[1], segment[2], segment[3], segment[4]]);
16474
+ else if (j === 1)
16475
+ line.push([segment[0]]);
16476
+ }
16477
+
16378
16478
  function decodedSourcemap(map) {
16379
16479
  if (!map)
16380
16480
  return null;
@@ -22278,7 +22378,7 @@ pp.readWord = function() {
22278
22378
 
22279
22379
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
22280
22380
 
22281
- var version = "8.8.0";
22381
+ var version = "8.8.1";
22282
22382
 
22283
22383
  Parser.acorn = {
22284
22384
  Parser: Parser,
@@ -22437,13 +22537,13 @@ async function addJsExtensionIfNecessary(file, preserveSymlinks) {
22437
22537
  }
22438
22538
  async function findFile(file, preserveSymlinks) {
22439
22539
  try {
22440
- const stats = await promises.lstat(file);
22540
+ const stats = await lstat(file);
22441
22541
  if (!preserveSymlinks && stats.isSymbolicLink())
22442
- return await findFile(await promises.realpath(file), preserveSymlinks);
22542
+ return await findFile(await realpath(file), preserveSymlinks);
22443
22543
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
22444
22544
  // check case
22445
22545
  const name = basename(file);
22446
- const files = await promises.readdir(dirname(file));
22546
+ const files = await readdir(dirname(file));
22447
22547
  if (files.includes(name))
22448
22548
  return file;
22449
22549
  }
@@ -22688,15 +22788,15 @@ class ModuleLoader {
22688
22788
  entryModule.isUserDefinedEntryPoint || isUserDefined;
22689
22789
  addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined, firstChunkNamePriority + index);
22690
22790
  const existingIndexedModule = this.indexedEntryModules.find(indexedModule => indexedModule.module === entryModule);
22691
- if (!existingIndexedModule) {
22791
+ if (existingIndexedModule) {
22792
+ existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
22793
+ }
22794
+ else {
22692
22795
  this.indexedEntryModules.push({
22693
22796
  index: firstEntryModuleIndex + index,
22694
22797
  module: entryModule
22695
22798
  });
22696
22799
  }
22697
- else {
22698
- existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
22699
- }
22700
22800
  }
22701
22801
  this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
22702
22802
  return entryModules;
@@ -22747,7 +22847,7 @@ class ModuleLoader {
22747
22847
  async addModuleSource(id, importer, module) {
22748
22848
  let source;
22749
22849
  try {
22750
- source = await this.graph.fileOperationQueue.run(async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await promises.readFile(id, 'utf8')));
22850
+ source = await this.graph.fileOperationQueue.run(async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await readFile(id, 'utf8')));
22751
22851
  }
22752
22852
  catch (error_) {
22753
22853
  let message = `Could not load ${id}`;
@@ -23212,8 +23312,11 @@ class FileEmitter {
23212
23312
  this.facadeChunkByModule = facadeChunkByModule;
23213
23313
  };
23214
23314
  this.setOutputBundle = (bundle, outputOptions) => {
23215
- const fileNamesBySource = new Map();
23216
- const output = (this.output = { bundle, fileNamesBySource, outputOptions });
23315
+ const output = (this.output = {
23316
+ bundle,
23317
+ fileNamesBySource: new Map(),
23318
+ outputOptions
23319
+ });
23217
23320
  for (const emittedFile of this.filesByReferenceId.values()) {
23218
23321
  if (emittedFile.fileName) {
23219
23322
  reserveFileNameInBundle(emittedFile.fileName, output, this.options.onwarn);
@@ -23234,12 +23337,9 @@ class FileEmitter {
23234
23337
  this.outputFileEmitters.push(outputFileEmitter);
23235
23338
  }
23236
23339
  assignReferenceId(file, idBase) {
23237
- let referenceId;
23340
+ let referenceId = idBase;
23238
23341
  do {
23239
- referenceId = createHash()
23240
- .update(referenceId || idBase)
23241
- .digest('hex')
23242
- .slice(0, 8);
23342
+ referenceId = createHash().update(referenceId).digest('hex').slice(0, 8);
23243
23343
  } while (this.filesByReferenceId.has(referenceId) ||
23244
23344
  this.outputFileEmitters.some(({ filesByReferenceId }) => filesByReferenceId.has(referenceId)));
23245
23345
  this.filesByReferenceId.set(referenceId, file);
@@ -23249,9 +23349,9 @@ class FileEmitter {
23249
23349
  return referenceId;
23250
23350
  }
23251
23351
  emitAsset(emittedAsset) {
23252
- const source = typeof emittedAsset.source !== 'undefined'
23253
- ? getValidSource(emittedAsset.source, emittedAsset, null)
23254
- : undefined;
23352
+ const source = emittedAsset.source === undefined
23353
+ ? undefined
23354
+ : getValidSource(emittedAsset.source, emittedAsset, null);
23255
23355
  const consumedAsset = {
23256
23356
  fileName: emittedAsset.fileName,
23257
23357
  name: emittedAsset.name,
@@ -24474,7 +24574,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
24474
24574
  return (_id, external) => !external;
24475
24575
  }
24476
24576
  if (typeof moduleSideEffectsOption === 'function') {
24477
- return (id, external) => !id.startsWith('\0') ? moduleSideEffectsOption(id, external) !== false : true;
24577
+ return (id, external) => id.startsWith('\0') ? true : moduleSideEffectsOption(id, external) !== false;
24478
24578
  }
24479
24579
  if (Array.isArray(moduleSideEffectsOption)) {
24480
24580
  const ids = new Set(moduleSideEffectsOption);
@@ -24938,8 +25038,8 @@ function getSortingFileType(file) {
24938
25038
  async function writeOutputFile(outputFile, outputOptions) {
24939
25039
  const fileName = resolve(outputOptions.dir || dirname(outputOptions.file), outputFile.fileName);
24940
25040
  // 'recursive: true' does not throw if the folder structure, or parts of it, already exist
24941
- await promises.mkdir(dirname(fileName), { recursive: true });
24942
- return promises.writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
25041
+ await mkdir(dirname(fileName), { recursive: true });
25042
+ return writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
24943
25043
  }
24944
25044
  /**
24945
25045
  * Auxiliary function for defining rollup configuration
@@ -25337,8 +25437,8 @@ function getFsEvents() {
25337
25437
 
25338
25438
  const fseventsImporter = /*#__PURE__*/Object.defineProperty({
25339
25439
  __proto__: null,
25340
- loadFsEvents,
25341
- getFsEvents
25440
+ getFsEvents,
25441
+ loadFsEvents
25342
25442
  }, Symbol.toStringTag, { value: 'Module' });
25343
25443
 
25344
25444
  function watch(configs) {
@@ -25359,4 +25459,4 @@ async function watchInternal(configs, emitter) {
25359
25459
  new Watcher(watchOptionsList, emitter);
25360
25460
  }
25361
25461
 
25362
- export { createFilter, defineConfig, fseventsImporter, getAugmentedNamespace, picomatch$1 as picomatch, rollup, rollupInternal, version$1 as version, watch };
25462
+ export { createFilter, defineConfig, fseventsImporter, getAugmentedNamespace, picomatchExports, rollup, rollupInternal, version$1 as version, watch };