rollup 3.9.0 → 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.9.0
4
- Wed, 28 Dec 2022 05:59:30 GMT - commit 5aa1cce444e767c40cf86cdd96953201e4d32774
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.9.0";
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;
@@ -6091,21 +6068,7 @@ class ObjectEntity extends ExpressionEntity {
6091
6068
  for (let index = properties.length - 1; index >= 0; index--) {
6092
6069
  const { key, kind, property } = properties[index];
6093
6070
  allProperties.push(property);
6094
- if (typeof key !== 'string') {
6095
- if (key === UnknownInteger) {
6096
- unknownIntegerProps.push(property);
6097
- continue;
6098
- }
6099
- if (kind === 'set')
6100
- unmatchableSetters.push(property);
6101
- if (kind === 'get')
6102
- unmatchableGetters.push(property);
6103
- if (kind !== 'get')
6104
- unmatchablePropertiesAndSetters.push(property);
6105
- if (kind !== 'set')
6106
- unmatchablePropertiesAndGetters.push(property);
6107
- }
6108
- else {
6071
+ if (typeof key === 'string') {
6109
6072
  if (kind === 'set') {
6110
6073
  if (!propertiesAndSettersByKey[key]) {
6111
6074
  propertiesAndSettersByKey[key] = [property, ...unmatchablePropertiesAndSetters];
@@ -6127,6 +6090,20 @@ class ObjectEntity extends ExpressionEntity {
6127
6090
  }
6128
6091
  }
6129
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
+ }
6130
6107
  }
6131
6108
  }
6132
6109
  deoptimizeCachedEntities() {
@@ -6324,8 +6301,6 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
6324
6301
  flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
6325
6302
  flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
6326
6303
  forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6327
- group: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6328
- groupToMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6329
6304
  includes: METHOD_RETURNS_BOOLEAN,
6330
6305
  indexOf: METHOD_RETURNS_NUMBER,
6331
6306
  join: METHOD_RETURNS_STRING,
@@ -6396,11 +6371,11 @@ class ArrayExpression extends NodeBase {
6396
6371
  properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
6397
6372
  }
6398
6373
  }
6399
- else if (!element) {
6400
- properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
6374
+ else if (element) {
6375
+ properties.push({ key: String(index), kind: 'init', property: element });
6401
6376
  }
6402
6377
  else {
6403
- properties.push({ key: String(index), kind: 'init', property: element });
6378
+ properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
6404
6379
  }
6405
6380
  }
6406
6381
  return (this.objectEntity = new ObjectEntity(properties, ARRAY_PROTOTYPE));
@@ -6586,14 +6561,14 @@ class LocalVariable extends Variable {
6586
6561
  }
6587
6562
  }
6588
6563
 
6589
- const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
6564
+ const chars$1 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
6590
6565
  const base = 64;
6591
6566
  function toBase64(value) {
6592
6567
  let outString = '';
6593
6568
  do {
6594
6569
  const currentDigit = value % base;
6595
6570
  value = (value / base) | 0;
6596
- outString = chars[currentDigit] + outString;
6571
+ outString = chars$1[currentDigit] + outString;
6597
6572
  } while (value !== 0);
6598
6573
  return outString;
6599
6574
  }
@@ -9603,9 +9578,9 @@ class ClassNode extends NodeBase {
9603
9578
  hasEffectsOnInteractionAtPath(path, interaction, context) {
9604
9579
  return interaction.type === INTERACTION_CALLED && path.length === 0
9605
9580
  ? !interaction.withNew ||
9606
- (this.classConstructor !== null
9607
- ? this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)
9608
- : this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
9581
+ (this.classConstructor === null
9582
+ ? this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)
9583
+ : this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
9609
9584
  false
9610
9585
  : this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
9611
9586
  }
@@ -9782,12 +9757,12 @@ class ConditionalExpression extends NodeBase {
9782
9757
  }
9783
9758
  deoptimizePath(path) {
9784
9759
  const usedBranch = this.getUsedBranch();
9785
- if (!usedBranch) {
9786
- this.consequent.deoptimizePath(path);
9787
- this.alternate.deoptimizePath(path);
9760
+ if (usedBranch) {
9761
+ usedBranch.deoptimizePath(path);
9788
9762
  }
9789
9763
  else {
9790
- usedBranch.deoptimizePath(path);
9764
+ this.consequent.deoptimizePath(path);
9765
+ this.alternate.deoptimizePath(path);
9791
9766
  }
9792
9767
  }
9793
9768
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -9845,17 +9820,22 @@ class ConditionalExpression extends NodeBase {
9845
9820
  }
9846
9821
  includeCallArguments(context, parameters) {
9847
9822
  const usedBranch = this.getUsedBranch();
9848
- if (!usedBranch) {
9849
- this.consequent.includeCallArguments(context, parameters);
9850
- this.alternate.includeCallArguments(context, parameters);
9823
+ if (usedBranch) {
9824
+ usedBranch.includeCallArguments(context, parameters);
9851
9825
  }
9852
9826
  else {
9853
- usedBranch.includeCallArguments(context, parameters);
9827
+ this.consequent.includeCallArguments(context, parameters);
9828
+ this.alternate.includeCallArguments(context, parameters);
9854
9829
  }
9855
9830
  }
9856
9831
  render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
9857
9832
  const usedBranch = this.getUsedBranch();
9858
- 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 {
9859
9839
  const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
9860
9840
  const inclusionStart = findNonWhiteSpace(code.original, (this.consequent.included
9861
9841
  ? findFirstOccurrenceOutsideComment(code.original, '?', this.test.end)
@@ -9875,11 +9855,6 @@ class ConditionalExpression extends NodeBase {
9875
9855
  renderedSurroundingElement: renderedSurroundingElement || this.parent.type
9876
9856
  });
9877
9857
  }
9878
- else {
9879
- this.test.render(code, options, { renderedSurroundingElement });
9880
- this.consequent.render(code, options);
9881
- this.alternate.render(code, options);
9882
- }
9883
9858
  }
9884
9859
  getUsedBranch() {
9885
9860
  if (this.isBranchResolutionAnalysed) {
@@ -10917,12 +10892,12 @@ class LogicalExpression extends NodeBase {
10917
10892
  }
10918
10893
  deoptimizePath(path) {
10919
10894
  const usedBranch = this.getUsedBranch();
10920
- if (!usedBranch) {
10921
- this.left.deoptimizePath(path);
10922
- this.right.deoptimizePath(path);
10895
+ if (usedBranch) {
10896
+ usedBranch.deoptimizePath(path);
10923
10897
  }
10924
10898
  else {
10925
- usedBranch.deoptimizePath(path);
10899
+ this.left.deoptimizePath(path);
10900
+ this.right.deoptimizePath(path);
10926
10901
  }
10927
10902
  }
10928
10903
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -12121,7 +12096,10 @@ class VariableDeclaration extends NodeBase {
12121
12096
  code.remove(this.end - 1, this.end);
12122
12097
  }
12123
12098
  separatorString += ';';
12124
- if (lastSeparatorPos !== null) {
12099
+ if (lastSeparatorPos === null) {
12100
+ code.appendLeft(renderedContentEnd, separatorString);
12101
+ }
12102
+ else {
12125
12103
  if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
12126
12104
  (code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
12127
12105
  code.original.charCodeAt(this.end) === 13) /*"\r"*/) {
@@ -12138,9 +12116,6 @@ class VariableDeclaration extends NodeBase {
12138
12116
  code.remove(actualContentEnd, renderedContentEnd);
12139
12117
  }
12140
12118
  }
12141
- else {
12142
- code.appendLeft(renderedContentEnd, separatorString);
12143
- }
12144
12119
  if (systemPatternExports.length > 0) {
12145
12120
  code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
12146
12121
  }
@@ -12464,7 +12439,8 @@ class NamespaceVariable extends Variable {
12464
12439
  return this.memberVariables;
12465
12440
  }
12466
12441
  const memberVariables = Object.create(null);
12467
- 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) {
12468
12444
  if (name[0] !== '*' && name !== this.module.info.syntheticNamedExports) {
12469
12445
  const exportedVariable = this.context.traceExport(name);
12470
12446
  if (exportedVariable) {
@@ -13691,7 +13667,7 @@ function getCompleteAmdId(options, chunkId) {
13691
13667
  if (options.autoId) {
13692
13668
  return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`;
13693
13669
  }
13694
- return options.id || '';
13670
+ return options.id ?? '';
13695
13671
  }
13696
13672
 
13697
13673
  function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, mechanism = 'return ') {
@@ -13898,33 +13874,82 @@ function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
13898
13874
  return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
13899
13875
  }
13900
13876
 
13901
- const builtins = {
13902
- assert: 1,
13903
- buffer: 1,
13904
- console: 1,
13905
- constants: 1,
13906
- domain: 1,
13907
- events: 1,
13908
- http: 1,
13909
- https: 1,
13910
- os: 1,
13911
- path: 1,
13912
- process: 1,
13913
- punycode: 1,
13914
- querystring: 1,
13915
- stream: 1,
13916
- string_decoder: 1,
13917
- timers: 1,
13918
- tty: 1,
13919
- url: 1,
13920
- util: 1,
13921
- vm: 1,
13922
- zlib: 1
13923
- };
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
+ ]);
13924
13949
  function warnOnBuiltins(warn, dependencies) {
13925
13950
  const externalBuiltins = dependencies
13926
13951
  .map(({ importPath }) => importPath)
13927
- .filter(importPath => importPath in builtins || importPath.startsWith('node:'));
13952
+ .filter(importPath => nodeBuiltins.has(importPath) || importPath.startsWith('node:'));
13928
13953
  if (externalBuiltins.length === 0)
13929
13954
  return;
13930
13955
  warn(errorMissingNodeBuiltins(externalBuiltins));
@@ -15076,10 +15101,7 @@ class Chunk {
15076
15101
  if (file) {
15077
15102
  fileName = basename(file);
15078
15103
  }
15079
- else if (this.fileName !== null) {
15080
- fileName = this.fileName;
15081
- }
15082
- else {
15104
+ else if (this.fileName === null) {
15083
15105
  const [pattern, patternName] = preserveModules || this.facadeModule?.isUserDefinedEntryPoint
15084
15106
  ? [entryFileNames, 'output.entryFileNames']
15085
15107
  : [chunkFileNames, 'output.chunkFileNames'];
@@ -15092,6 +15114,9 @@ class Chunk {
15092
15114
  fileName = makeUnique(fileName, this.bundle);
15093
15115
  }
15094
15116
  }
15117
+ else {
15118
+ fileName = this.fileName;
15119
+ }
15095
15120
  if (!hashPlaceholder) {
15096
15121
  this.bundle[fileName] = FILE_PLACEHOLDER;
15097
15122
  }
@@ -16338,10 +16363,7 @@ function getLinkMap(warn) {
16338
16363
  }
16339
16364
  function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, linkMap) {
16340
16365
  let source;
16341
- if (!originalSourcemap) {
16342
- source = new Source(id, originalCode);
16343
- }
16344
- else {
16366
+ if (originalSourcemap) {
16345
16367
  const sources = originalSourcemap.sources;
16346
16368
  const sourcesContent = originalSourcemap.sourcesContent || [];
16347
16369
  const directory = dirname(id) || '.';
@@ -16349,6 +16371,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
16349
16371
  const baseSources = sources.map((source, index) => new Source(resolve(directory, sourceRoot, source), sourcesContent[index]));
16350
16372
  source = new Link(originalSourcemap, baseSources);
16351
16373
  }
16374
+ else {
16375
+ source = new Source(id, originalCode);
16376
+ }
16352
16377
  return sourcemapChain.reduce(linkMap, source);
16353
16378
  }
16354
16379
  function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeContent, warn) {
@@ -16378,6 +16403,78 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
16378
16403
 
16379
16404
  const createHash = () => createHash$1('sha256');
16380
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
+
16381
16478
  function decodedSourcemap(map) {
16382
16479
  if (!map)
16383
16480
  return null;
@@ -22281,7 +22378,7 @@ pp.readWord = function() {
22281
22378
 
22282
22379
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
22283
22380
 
22284
- var version = "8.8.0";
22381
+ var version = "8.8.1";
22285
22382
 
22286
22383
  Parser.acorn = {
22287
22384
  Parser: Parser,
@@ -22440,13 +22537,13 @@ async function addJsExtensionIfNecessary(file, preserveSymlinks) {
22440
22537
  }
22441
22538
  async function findFile(file, preserveSymlinks) {
22442
22539
  try {
22443
- const stats = await promises.lstat(file);
22540
+ const stats = await lstat(file);
22444
22541
  if (!preserveSymlinks && stats.isSymbolicLink())
22445
- return await findFile(await promises.realpath(file), preserveSymlinks);
22542
+ return await findFile(await realpath(file), preserveSymlinks);
22446
22543
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
22447
22544
  // check case
22448
22545
  const name = basename(file);
22449
- const files = await promises.readdir(dirname(file));
22546
+ const files = await readdir(dirname(file));
22450
22547
  if (files.includes(name))
22451
22548
  return file;
22452
22549
  }
@@ -22691,15 +22788,15 @@ class ModuleLoader {
22691
22788
  entryModule.isUserDefinedEntryPoint || isUserDefined;
22692
22789
  addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined, firstChunkNamePriority + index);
22693
22790
  const existingIndexedModule = this.indexedEntryModules.find(indexedModule => indexedModule.module === entryModule);
22694
- if (!existingIndexedModule) {
22791
+ if (existingIndexedModule) {
22792
+ existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
22793
+ }
22794
+ else {
22695
22795
  this.indexedEntryModules.push({
22696
22796
  index: firstEntryModuleIndex + index,
22697
22797
  module: entryModule
22698
22798
  });
22699
22799
  }
22700
- else {
22701
- existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
22702
- }
22703
22800
  }
22704
22801
  this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
22705
22802
  return entryModules;
@@ -22750,7 +22847,7 @@ class ModuleLoader {
22750
22847
  async addModuleSource(id, importer, module) {
22751
22848
  let source;
22752
22849
  try {
22753
- 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')));
22754
22851
  }
22755
22852
  catch (error_) {
22756
22853
  let message = `Could not load ${id}`;
@@ -23215,8 +23312,11 @@ class FileEmitter {
23215
23312
  this.facadeChunkByModule = facadeChunkByModule;
23216
23313
  };
23217
23314
  this.setOutputBundle = (bundle, outputOptions) => {
23218
- const fileNamesBySource = new Map();
23219
- const output = (this.output = { bundle, fileNamesBySource, outputOptions });
23315
+ const output = (this.output = {
23316
+ bundle,
23317
+ fileNamesBySource: new Map(),
23318
+ outputOptions
23319
+ });
23220
23320
  for (const emittedFile of this.filesByReferenceId.values()) {
23221
23321
  if (emittedFile.fileName) {
23222
23322
  reserveFileNameInBundle(emittedFile.fileName, output, this.options.onwarn);
@@ -23237,12 +23337,9 @@ class FileEmitter {
23237
23337
  this.outputFileEmitters.push(outputFileEmitter);
23238
23338
  }
23239
23339
  assignReferenceId(file, idBase) {
23240
- let referenceId;
23340
+ let referenceId = idBase;
23241
23341
  do {
23242
- referenceId = createHash()
23243
- .update(referenceId || idBase)
23244
- .digest('hex')
23245
- .slice(0, 8);
23342
+ referenceId = createHash().update(referenceId).digest('hex').slice(0, 8);
23246
23343
  } while (this.filesByReferenceId.has(referenceId) ||
23247
23344
  this.outputFileEmitters.some(({ filesByReferenceId }) => filesByReferenceId.has(referenceId)));
23248
23345
  this.filesByReferenceId.set(referenceId, file);
@@ -23252,9 +23349,9 @@ class FileEmitter {
23252
23349
  return referenceId;
23253
23350
  }
23254
23351
  emitAsset(emittedAsset) {
23255
- const source = typeof emittedAsset.source !== 'undefined'
23256
- ? getValidSource(emittedAsset.source, emittedAsset, null)
23257
- : undefined;
23352
+ const source = emittedAsset.source === undefined
23353
+ ? undefined
23354
+ : getValidSource(emittedAsset.source, emittedAsset, null);
23258
23355
  const consumedAsset = {
23259
23356
  fileName: emittedAsset.fileName,
23260
23357
  name: emittedAsset.name,
@@ -24477,7 +24574,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
24477
24574
  return (_id, external) => !external;
24478
24575
  }
24479
24576
  if (typeof moduleSideEffectsOption === 'function') {
24480
- return (id, external) => !id.startsWith('\0') ? moduleSideEffectsOption(id, external) !== false : true;
24577
+ return (id, external) => id.startsWith('\0') ? true : moduleSideEffectsOption(id, external) !== false;
24481
24578
  }
24482
24579
  if (Array.isArray(moduleSideEffectsOption)) {
24483
24580
  const ids = new Set(moduleSideEffectsOption);
@@ -24941,8 +25038,8 @@ function getSortingFileType(file) {
24941
25038
  async function writeOutputFile(outputFile, outputOptions) {
24942
25039
  const fileName = resolve(outputOptions.dir || dirname(outputOptions.file), outputFile.fileName);
24943
25040
  // 'recursive: true' does not throw if the folder structure, or parts of it, already exist
24944
- await promises.mkdir(dirname(fileName), { recursive: true });
24945
- 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);
24946
25043
  }
24947
25044
  /**
24948
25045
  * Auxiliary function for defining rollup configuration
@@ -25340,8 +25437,8 @@ function getFsEvents() {
25340
25437
 
25341
25438
  const fseventsImporter = /*#__PURE__*/Object.defineProperty({
25342
25439
  __proto__: null,
25343
- loadFsEvents,
25344
- getFsEvents
25440
+ getFsEvents,
25441
+ loadFsEvents
25345
25442
  }, Symbol.toStringTag, { value: 'Module' });
25346
25443
 
25347
25444
  function watch(configs) {
@@ -25362,4 +25459,4 @@ async function watchInternal(configs, emitter) {
25362
25459
  new Watcher(watchOptionsList, emitter);
25363
25460
  }
25364
25461
 
25365
- 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 };