rollup 3.9.0 → 3.10.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 v3.9.0
4
- Wed, 28 Dec 2022 05:59:30 GMT - commit 5aa1cce444e767c40cf86cdd96953201e4d32774
3
+ Rollup.js v3.10.0
4
+ Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -12,132 +12,172 @@ import require$$0$1, { win32, posix, isAbsolute as isAbsolute$1, resolve as reso
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.10.0";
20
+
21
+ const comma = ','.charCodeAt(0);
22
+ const semicolon = ';'.charCodeAt(0);
23
+ const chars$1 = '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$1.length; i++) {
27
+ const c = chars$1.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;
41
+ : {
42
+ decode(buf) {
43
+ let out = '';
44
+ for (let i = 0; i < buf.length; i++) {
45
+ out += String.fromCharCode(buf[i]);
46
+ }
47
+ return out;
48
+ },
49
+ };
50
+ function decode(mappings) {
51
+ const state = new Int32Array(5);
52
+ const decoded = [];
53
+ let index = 0;
54
+ do {
55
+ const semi = indexOf(mappings, index);
56
+ const line = [];
57
+ let sorted = true;
58
+ let lastCol = 0;
59
+ state[0] = 0;
60
+ for (let i = index; i < semi; i++) {
61
+ let seg;
62
+ i = decodeInteger(mappings, i, state, 0); // genColumn
63
+ const col = state[0];
64
+ if (col < lastCol)
65
+ sorted = false;
66
+ lastCol = col;
67
+ if (hasMoreVlq(mappings, i, semi)) {
68
+ i = decodeInteger(mappings, i, state, 1); // sourcesIndex
69
+ i = decodeInteger(mappings, i, state, 2); // sourceLine
70
+ i = decodeInteger(mappings, i, state, 3); // sourceColumn
71
+ if (hasMoreVlq(mappings, i, semi)) {
72
+ i = decodeInteger(mappings, i, state, 4); // namesIndex
73
+ seg = [col, state[1], state[2], state[3], state[4]];
74
+ }
75
+ else {
76
+ seg = [col, state[1], state[2], state[3]];
77
+ }
60
78
  }
61
79
  else {
62
- var shouldNegate = value & 1;
63
- value >>>= 1;
64
- if (shouldNegate) {
65
- value = value === 0 ? -0x80000000 : -value;
66
- }
67
- segment[j] += value;
68
- j++;
69
- value = shift = 0; // reset
80
+ seg = [col];
70
81
  }
82
+ line.push(seg);
71
83
  }
72
- }
73
- segmentify(line, segment, j);
74
- decoded.push(line);
84
+ if (!sorted)
85
+ sort(line);
86
+ decoded.push(line);
87
+ index = semi + 1;
88
+ } while (index <= mappings.length);
75
89
  return decoded;
76
90
  }
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
+ function indexOf(mappings, index) {
92
+ const idx = mappings.indexOf(';', index);
93
+ return idx === -1 ? mappings.length : idx;
94
+ }
95
+ function decodeInteger(mappings, pos, state, j) {
96
+ let value = 0;
97
+ let shift = 0;
98
+ let integer = 0;
99
+ do {
100
+ const c = mappings.charCodeAt(pos++);
101
+ integer = charToInt[c];
102
+ value |= (integer & 31) << shift;
103
+ shift += 5;
104
+ } while (integer & 32);
105
+ const shouldNegate = value & 1;
106
+ value >>>= 1;
107
+ if (shouldNegate) {
108
+ value = -0x80000000 | -value;
109
+ }
110
+ state[j] += value;
111
+ return pos;
112
+ }
113
+ function hasMoreVlq(mappings, i, length) {
114
+ if (i >= length)
115
+ return false;
116
+ return mappings.charCodeAt(i) !== comma;
117
+ }
118
+ function sort(line) {
119
+ line.sort(sortComparator);
120
+ }
121
+ function sortComparator(a, b) {
122
+ return a[0] - b[0];
91
123
  }
92
124
  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 += ';';
125
+ const state = new Int32Array(5);
126
+ const bufLength = 1024 * 16;
127
+ const subLength = bufLength - 36;
128
+ const buf = new Uint8Array(bufLength);
129
+ const sub = buf.subarray(0, subLength);
130
+ let pos = 0;
131
+ let out = '';
132
+ for (let i = 0; i < decoded.length; i++) {
133
+ const line = decoded[i];
134
+ if (i > 0) {
135
+ if (pos === bufLength) {
136
+ out += td.decode(buf);
137
+ pos = 0;
138
+ }
139
+ buf[pos++] = semicolon;
140
+ }
102
141
  if (line.length === 0)
103
142
  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 = '';
143
+ state[0] = 0;
144
+ for (let j = 0; j < line.length; j++) {
145
+ const segment = line[j];
146
+ // We can push up to 5 ints, each int can take at most 7 chars, and we
147
+ // may push a comma.
148
+ if (pos > subLength) {
149
+ out += td.decode(sub);
150
+ buf.copyWithin(0, subLength, pos);
151
+ pos -= subLength;
152
+ }
153
+ if (j > 0)
154
+ buf[pos++] = comma;
155
+ pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
156
+ if (segment.length === 1)
157
+ continue;
158
+ pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
159
+ pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
160
+ pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
161
+ if (segment.length === 4)
162
+ continue;
163
+ pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
164
+ }
165
+ }
166
+ return out + td.decode(buf.subarray(0, pos));
167
+ }
168
+ function encodeInteger(buf, pos, state, segment, j) {
169
+ const next = segment[j];
170
+ let num = next - state[j];
171
+ state[j] = next;
131
172
  num = num < 0 ? (-num << 1) | 1 : num << 1;
132
173
  do {
133
- var clamped = num & 31;
174
+ let clamped = num & 0b011111;
134
175
  num >>>= 5;
135
- if (num > 0) {
136
- clamped |= 32;
137
- }
138
- result += chars$1[clamped];
176
+ if (num > 0)
177
+ clamped |= 0b100000;
178
+ buf[pos++] = intToChar[clamped];
139
179
  } while (num > 0);
140
- return result;
180
+ return pos;
141
181
  }
142
182
 
143
183
  class BitSet {
@@ -1631,7 +1671,7 @@ function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName)
1631
1671
  return [...relativePath.split('/'), '..', basename(targetPath)].join('/');
1632
1672
  }
1633
1673
  }
1634
- return !relativePath ? '.' : relativePath.startsWith('..') ? relativePath : './' + relativePath;
1674
+ return relativePath ? (relativePath.startsWith('..') ? relativePath : './' + relativePath) : '.';
1635
1675
  }
1636
1676
 
1637
1677
  class ExternalChunk {
@@ -2234,7 +2274,7 @@ function errorInternalIdCannotBeExternal(source, importer) {
2234
2274
  function errorInvalidOption(option, urlHash, explanation, value) {
2235
2275
  return {
2236
2276
  code: INVALID_OPTION,
2237
- message: `Invalid value ${value !== undefined ? `${JSON.stringify(value)} ` : ''}for option "${option}" - ${explanation}.`,
2277
+ message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
2238
2278
  url: `https://rollupjs.org/guide/en/#${urlHash}`
2239
2279
  };
2240
2280
  }
@@ -2702,9 +2742,16 @@ function getDefaultExportFromCjs (x) {
2702
2742
  }
2703
2743
 
2704
2744
  function getAugmentedNamespace(n) {
2745
+ if (n.__esModule) return n;
2705
2746
  var f = n.default;
2706
2747
  if (typeof f == "function") {
2707
- var a = function () {
2748
+ var a = function a () {
2749
+ if (this instanceof a) {
2750
+ var args = [null];
2751
+ args.push.apply(args, arguments);
2752
+ var Ctor = Function.bind.apply(f, args);
2753
+ return new Ctor();
2754
+ }
2708
2755
  return f.apply(this, arguments);
2709
2756
  };
2710
2757
  a.prototype = f.prototype;
@@ -2722,7 +2769,11 @@ function getAugmentedNamespace(n) {
2722
2769
  return a;
2723
2770
  }
2724
2771
 
2725
- var picomatch$1 = {exports: {}};
2772
+ var picomatchExports = {};
2773
+ var picomatch$1 = {
2774
+ get exports(){ return picomatchExports; },
2775
+ set exports(v){ picomatchExports = v; },
2776
+ };
2726
2777
 
2727
2778
  var utils$3 = {};
2728
2779
 
@@ -4789,7 +4840,7 @@ var picomatch_1 = picomatch;
4789
4840
  module.exports = picomatch_1;
4790
4841
  } (picomatch$1));
4791
4842
 
4792
- const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch$1.exports);
4843
+ const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
4793
4844
 
4794
4845
  const extractors = {
4795
4846
  ArrayPattern(names, param) {
@@ -4892,8 +4943,8 @@ const createFilter = function createFilter(include, exclude, options) {
4892
4943
  };
4893
4944
 
4894
4945
  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(' '));
4946
+ 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';
4947
+ const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins}`.split(' '));
4897
4948
  forbiddenIdentifiers.add('');
4898
4949
 
4899
4950
  const BROKEN_FLOW_NONE = 0;
@@ -6091,21 +6142,7 @@ class ObjectEntity extends ExpressionEntity {
6091
6142
  for (let index = properties.length - 1; index >= 0; index--) {
6092
6143
  const { key, kind, property } = properties[index];
6093
6144
  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 {
6145
+ if (typeof key === 'string') {
6109
6146
  if (kind === 'set') {
6110
6147
  if (!propertiesAndSettersByKey[key]) {
6111
6148
  propertiesAndSettersByKey[key] = [property, ...unmatchablePropertiesAndSetters];
@@ -6127,6 +6164,20 @@ class ObjectEntity extends ExpressionEntity {
6127
6164
  }
6128
6165
  }
6129
6166
  }
6167
+ else {
6168
+ if (key === UnknownInteger) {
6169
+ unknownIntegerProps.push(property);
6170
+ continue;
6171
+ }
6172
+ if (kind === 'set')
6173
+ unmatchableSetters.push(property);
6174
+ if (kind === 'get')
6175
+ unmatchableGetters.push(property);
6176
+ if (kind !== 'get')
6177
+ unmatchablePropertiesAndSetters.push(property);
6178
+ if (kind !== 'set')
6179
+ unmatchablePropertiesAndGetters.push(property);
6180
+ }
6130
6181
  }
6131
6182
  }
6132
6183
  deoptimizeCachedEntities() {
@@ -6324,8 +6375,6 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
6324
6375
  flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
6325
6376
  flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
6326
6377
  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
6378
  includes: METHOD_RETURNS_BOOLEAN,
6330
6379
  indexOf: METHOD_RETURNS_NUMBER,
6331
6380
  join: METHOD_RETURNS_STRING,
@@ -6396,11 +6445,11 @@ class ArrayExpression extends NodeBase {
6396
6445
  properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
6397
6446
  }
6398
6447
  }
6399
- else if (!element) {
6400
- properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
6448
+ else if (element) {
6449
+ properties.push({ key: String(index), kind: 'init', property: element });
6401
6450
  }
6402
6451
  else {
6403
- properties.push({ key: String(index), kind: 'init', property: element });
6452
+ properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
6404
6453
  }
6405
6454
  }
6406
6455
  return (this.objectEntity = new ObjectEntity(properties, ARRAY_PROTOTYPE));
@@ -6817,7 +6866,6 @@ class ReturnValueScope extends ParameterScope {
6817
6866
  }
6818
6867
  }
6819
6868
 
6820
- //@ts-check
6821
6869
  /** @typedef { import('estree').Node} Node */
6822
6870
  /** @typedef {Node | {
6823
6871
  * type: 'PropertyDefinition';
@@ -6829,7 +6877,7 @@ class ReturnValueScope extends ParameterScope {
6829
6877
  *
6830
6878
  * @param {NodeWithPropertyDefinition} node
6831
6879
  * @param {NodeWithPropertyDefinition} parent
6832
- * @returns boolean
6880
+ * @returns {boolean}
6833
6881
  */
6834
6882
  function is_reference (node, parent) {
6835
6883
  if (node.type === 'MemberExpression') {
@@ -9433,7 +9481,34 @@ class CatchClause extends NodeBase {
9433
9481
  }
9434
9482
  }
9435
9483
 
9484
+ const unset$1 = Symbol('unset');
9436
9485
  class ChainExpression extends NodeBase {
9486
+ constructor() {
9487
+ super(...arguments);
9488
+ this.objectValue = unset$1;
9489
+ }
9490
+ deoptimizeCache() {
9491
+ this.objectValue = UnknownValue;
9492
+ }
9493
+ getLiteralValueAtPath() {
9494
+ if (this.getObjectValue() == null)
9495
+ return undefined;
9496
+ return UnknownValue;
9497
+ }
9498
+ hasEffects(context) {
9499
+ if (this.getObjectValue() == null)
9500
+ return false;
9501
+ return this.expression.hasEffects(context);
9502
+ }
9503
+ getObjectValue() {
9504
+ if (this.objectValue === unset$1) {
9505
+ let object = this.expression.type === 'CallExpression' ? this.expression.callee : this.expression.object;
9506
+ if (object.type === 'MemberExpression')
9507
+ object = object.object;
9508
+ this.objectValue = object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
9509
+ }
9510
+ return this.objectValue;
9511
+ }
9437
9512
  }
9438
9513
 
9439
9514
  class ClassBodyScope extends ChildScope {
@@ -9603,9 +9678,9 @@ class ClassNode extends NodeBase {
9603
9678
  hasEffectsOnInteractionAtPath(path, interaction, context) {
9604
9679
  return interaction.type === INTERACTION_CALLED && path.length === 0
9605
9680
  ? !interaction.withNew ||
9606
- (this.classConstructor !== null
9607
- ? this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)
9608
- : this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
9681
+ (this.classConstructor === null
9682
+ ? this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)
9683
+ : this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
9609
9684
  false
9610
9685
  : this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
9611
9686
  }
@@ -9782,12 +9857,12 @@ class ConditionalExpression extends NodeBase {
9782
9857
  }
9783
9858
  deoptimizePath(path) {
9784
9859
  const usedBranch = this.getUsedBranch();
9785
- if (!usedBranch) {
9786
- this.consequent.deoptimizePath(path);
9787
- this.alternate.deoptimizePath(path);
9860
+ if (usedBranch) {
9861
+ usedBranch.deoptimizePath(path);
9788
9862
  }
9789
9863
  else {
9790
- usedBranch.deoptimizePath(path);
9864
+ this.consequent.deoptimizePath(path);
9865
+ this.alternate.deoptimizePath(path);
9791
9866
  }
9792
9867
  }
9793
9868
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -9845,17 +9920,22 @@ class ConditionalExpression extends NodeBase {
9845
9920
  }
9846
9921
  includeCallArguments(context, parameters) {
9847
9922
  const usedBranch = this.getUsedBranch();
9848
- if (!usedBranch) {
9849
- this.consequent.includeCallArguments(context, parameters);
9850
- this.alternate.includeCallArguments(context, parameters);
9923
+ if (usedBranch) {
9924
+ usedBranch.includeCallArguments(context, parameters);
9851
9925
  }
9852
9926
  else {
9853
- usedBranch.includeCallArguments(context, parameters);
9927
+ this.consequent.includeCallArguments(context, parameters);
9928
+ this.alternate.includeCallArguments(context, parameters);
9854
9929
  }
9855
9930
  }
9856
9931
  render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
9857
9932
  const usedBranch = this.getUsedBranch();
9858
- if (!this.test.included) {
9933
+ if (this.test.included) {
9934
+ this.test.render(code, options, { renderedSurroundingElement });
9935
+ this.consequent.render(code, options);
9936
+ this.alternate.render(code, options);
9937
+ }
9938
+ else {
9859
9939
  const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
9860
9940
  const inclusionStart = findNonWhiteSpace(code.original, (this.consequent.included
9861
9941
  ? findFirstOccurrenceOutsideComment(code.original, '?', this.test.end)
@@ -9875,11 +9955,6 @@ class ConditionalExpression extends NodeBase {
9875
9955
  renderedSurroundingElement: renderedSurroundingElement || this.parent.type
9876
9956
  });
9877
9957
  }
9878
- else {
9879
- this.test.render(code, options, { renderedSurroundingElement });
9880
- this.consequent.render(code, options);
9881
- this.alternate.render(code, options);
9882
- }
9883
9958
  }
9884
9959
  getUsedBranch() {
9885
9960
  if (this.isBranchResolutionAnalysed) {
@@ -10917,12 +10992,12 @@ class LogicalExpression extends NodeBase {
10917
10992
  }
10918
10993
  deoptimizePath(path) {
10919
10994
  const usedBranch = this.getUsedBranch();
10920
- if (!usedBranch) {
10921
- this.left.deoptimizePath(path);
10922
- this.right.deoptimizePath(path);
10995
+ if (usedBranch) {
10996
+ usedBranch.deoptimizePath(path);
10923
10997
  }
10924
10998
  else {
10925
- usedBranch.deoptimizePath(path);
10999
+ this.left.deoptimizePath(path);
11000
+ this.right.deoptimizePath(path);
10926
11001
  }
10927
11002
  }
10928
11003
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -12121,7 +12196,10 @@ class VariableDeclaration extends NodeBase {
12121
12196
  code.remove(this.end - 1, this.end);
12122
12197
  }
12123
12198
  separatorString += ';';
12124
- if (lastSeparatorPos !== null) {
12199
+ if (lastSeparatorPos === null) {
12200
+ code.appendLeft(renderedContentEnd, separatorString);
12201
+ }
12202
+ else {
12125
12203
  if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
12126
12204
  (code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
12127
12205
  code.original.charCodeAt(this.end) === 13) /*"\r"*/) {
@@ -12138,9 +12216,6 @@ class VariableDeclaration extends NodeBase {
12138
12216
  code.remove(actualContentEnd, renderedContentEnd);
12139
12217
  }
12140
12218
  }
12141
- else {
12142
- code.appendLeft(renderedContentEnd, separatorString);
12143
- }
12144
12219
  if (systemPatternExports.length > 0) {
12145
12220
  code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
12146
12221
  }
@@ -12464,7 +12539,8 @@ class NamespaceVariable extends Variable {
12464
12539
  return this.memberVariables;
12465
12540
  }
12466
12541
  const memberVariables = Object.create(null);
12467
- for (const name of [...this.context.getExports(), ...this.context.getReexports()]) {
12542
+ const sortedExports = [...this.context.getExports(), ...this.context.getReexports()].sort();
12543
+ for (const name of sortedExports) {
12468
12544
  if (name[0] !== '*' && name !== this.module.info.syntheticNamedExports) {
12469
12545
  const exportedVariable = this.context.traceExport(name);
12470
12546
  if (exportedVariable) {
@@ -13268,10 +13344,10 @@ class Module {
13268
13344
  this.transformDependencies = transformDependencies;
13269
13345
  this.customTransformCache = customTransformCache;
13270
13346
  this.updateOptions(moduleOptions);
13271
- const moduleAst = ast || this.tryParse();
13347
+ const moduleAst = ast ?? this.tryParse();
13272
13348
  timeEnd('generate ast', 3);
13273
13349
  timeStart('analyze ast', 3);
13274
- this.resolvedIds = resolvedIds || Object.create(null);
13350
+ this.resolvedIds = resolvedIds ?? Object.create(null);
13275
13351
  // By default, `id` is the file name. Custom resolvers and loaders
13276
13352
  // can change that, but it makes sense to use it for the source file name
13277
13353
  const fileName = this.id;
@@ -13372,14 +13448,6 @@ class Module {
13372
13448
  }
13373
13449
  return null;
13374
13450
  }
13375
- tryParse() {
13376
- try {
13377
- return this.graph.contextParse(this.info.code);
13378
- }
13379
- catch (error_) {
13380
- return this.error(errorParseError(error_, this.id), error_.pos);
13381
- }
13382
- }
13383
13451
  updateOptions({ meta, moduleSideEffects, syntheticNamedExports }) {
13384
13452
  if (moduleSideEffects != null) {
13385
13453
  this.info.moduleSideEffects = moduleSideEffects;
@@ -13661,6 +13729,14 @@ class Module {
13661
13729
  this.options.onwarn(errorShimmedExport(this.id, name));
13662
13730
  this.exports.set(name, MISSING_EXPORT_SHIM_DESCRIPTION);
13663
13731
  }
13732
+ tryParse() {
13733
+ try {
13734
+ return this.graph.contextParse(this.info.code);
13735
+ }
13736
+ catch (error_) {
13737
+ return this.error(errorParseError(error_, this.id), error_.pos);
13738
+ }
13739
+ }
13664
13740
  }
13665
13741
  // if there is a cyclic import in the reexport chain, we should not
13666
13742
  // import from the original module but from the cyclic module to not
@@ -13691,7 +13767,7 @@ function getCompleteAmdId(options, chunkId) {
13691
13767
  if (options.autoId) {
13692
13768
  return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`;
13693
13769
  }
13694
- return options.id || '';
13770
+ return options.id ?? '';
13695
13771
  }
13696
13772
 
13697
13773
  function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, mechanism = 'return ') {
@@ -13898,33 +13974,82 @@ function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
13898
13974
  return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
13899
13975
  }
13900
13976
 
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
- };
13977
+ var _staticExports = {};
13978
+ var _static = {
13979
+ get exports(){ return _staticExports; },
13980
+ set exports(v){ _staticExports = v; },
13981
+ };
13982
+
13983
+ const require$$0 = [
13984
+ "assert",
13985
+ "async_hooks",
13986
+ "buffer",
13987
+ "child_process",
13988
+ "cluster",
13989
+ "console",
13990
+ "constants",
13991
+ "crypto",
13992
+ "dgram",
13993
+ "diagnostics_channel",
13994
+ "dns",
13995
+ "domain",
13996
+ "events",
13997
+ "fs",
13998
+ "http",
13999
+ "http2",
14000
+ "https",
14001
+ "inspector",
14002
+ "module",
14003
+ "net",
14004
+ "os",
14005
+ "path",
14006
+ "perf_hooks",
14007
+ "process",
14008
+ "punycode",
14009
+ "querystring",
14010
+ "readline",
14011
+ "repl",
14012
+ "stream",
14013
+ "string_decoder",
14014
+ "timers",
14015
+ "tls",
14016
+ "trace_events",
14017
+ "tty",
14018
+ "url",
14019
+ "util",
14020
+ "v8",
14021
+ "vm",
14022
+ "wasi",
14023
+ "worker_threads",
14024
+ "zlib"
14025
+ ];
14026
+
14027
+ (function (module) {
14028
+ module.exports = require$$0;
14029
+ } (_static));
14030
+
14031
+ const builtinModules = /*@__PURE__*/getDefaultExportFromCjs(_staticExports);
14032
+
14033
+ const nodeBuiltins = new Set([
14034
+ ...builtinModules,
14035
+ // TODO
14036
+ // remove once builtin-modules includes PR: https://github.com/sindresorhus/builtin-modules/pull/17
14037
+ 'assert/strict',
14038
+ 'dns/promises',
14039
+ 'fs/promises',
14040
+ 'path/posix',
14041
+ 'path/win32',
14042
+ 'readline/promises',
14043
+ 'stream/consumers',
14044
+ 'stream/promises',
14045
+ 'stream/web',
14046
+ 'timers/promises',
14047
+ 'util/types'
14048
+ ]);
13924
14049
  function warnOnBuiltins(warn, dependencies) {
13925
14050
  const externalBuiltins = dependencies
13926
14051
  .map(({ importPath }) => importPath)
13927
- .filter(importPath => importPath in builtins || importPath.startsWith('node:'));
14052
+ .filter(importPath => nodeBuiltins.has(importPath) || importPath.startsWith('node:'));
13928
14053
  if (externalBuiltins.length === 0)
13929
14054
  return;
13930
14055
  warn(errorMissingNodeBuiltins(externalBuiltins));
@@ -15076,10 +15201,7 @@ class Chunk {
15076
15201
  if (file) {
15077
15202
  fileName = basename(file);
15078
15203
  }
15079
- else if (this.fileName !== null) {
15080
- fileName = this.fileName;
15081
- }
15082
- else {
15204
+ else if (this.fileName === null) {
15083
15205
  const [pattern, patternName] = preserveModules || this.facadeModule?.isUserDefinedEntryPoint
15084
15206
  ? [entryFileNames, 'output.entryFileNames']
15085
15207
  : [chunkFileNames, 'output.chunkFileNames'];
@@ -15092,6 +15214,9 @@ class Chunk {
15092
15214
  fileName = makeUnique(fileName, this.bundle);
15093
15215
  }
15094
15216
  }
15217
+ else {
15218
+ fileName = this.fileName;
15219
+ }
15095
15220
  if (!hashPlaceholder) {
15096
15221
  this.bundle[fileName] = FILE_PLACEHOLDER;
15097
15222
  }
@@ -16338,10 +16463,7 @@ function getLinkMap(warn) {
16338
16463
  }
16339
16464
  function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, linkMap) {
16340
16465
  let source;
16341
- if (!originalSourcemap) {
16342
- source = new Source(id, originalCode);
16343
- }
16344
- else {
16466
+ if (originalSourcemap) {
16345
16467
  const sources = originalSourcemap.sources;
16346
16468
  const sourcesContent = originalSourcemap.sourcesContent || [];
16347
16469
  const directory = dirname(id) || '.';
@@ -16349,6 +16471,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
16349
16471
  const baseSources = sources.map((source, index) => new Source(resolve(directory, sourceRoot, source), sourcesContent[index]));
16350
16472
  source = new Link(originalSourcemap, baseSources);
16351
16473
  }
16474
+ else {
16475
+ source = new Source(id, originalCode);
16476
+ }
16352
16477
  return sourcemapChain.reduce(linkMap, source);
16353
16478
  }
16354
16479
  function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeContent, warn) {
@@ -16670,7 +16795,6 @@ class Bundle {
16670
16795
  if ('code' in file) {
16671
16796
  try {
16672
16797
  this.graph.contextParse(file.code, {
16673
- allowHashBang: true,
16674
16798
  ecmaVersion: 'latest'
16675
16799
  });
16676
16800
  }
@@ -22281,7 +22405,7 @@ pp.readWord = function() {
22281
22405
 
22282
22406
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
22283
22407
 
22284
- var version = "8.8.0";
22408
+ var version = "8.8.1";
22285
22409
 
22286
22410
  Parser.acorn = {
22287
22411
  Parser: Parser,
@@ -22331,7 +22455,7 @@ function tokenizer(input, options) {
22331
22455
  return Parser.tokenizer(input, options)
22332
22456
  }
22333
22457
 
22334
- const acorn = /*#__PURE__*/Object.defineProperty({
22458
+ const _acorn = /*#__PURE__*/Object.defineProperty({
22335
22459
  __proto__: null,
22336
22460
  Node,
22337
22461
  Parser,
@@ -22416,13 +22540,27 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
22416
22540
  resolve: (source, importer, { assertions, custom, isEntry, skipSelf } = BLANK) => moduleLoaderResolveId(source, importer, custom, isEntry, assertions || EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip)
22417
22541
  });
22418
22542
  }
22419
- return pluginDriver.hookFirst('resolveId', [source, importer, { assertions, custom: customOptions, isEntry }], replaceContext, skipped);
22543
+ return pluginDriver.hookFirstAndGetPlugin('resolveId', [source, importer, { assertions, custom: customOptions, isEntry }], replaceContext, skipped);
22420
22544
  }
22421
22545
 
22422
22546
  async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, assertions) {
22423
22547
  const pluginResult = await resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, assertions);
22424
- if (pluginResult != null)
22425
- return pluginResult;
22548
+ if (pluginResult != null) {
22549
+ const [resolveIdResult, plugin] = pluginResult;
22550
+ if (typeof resolveIdResult === 'object' && !resolveIdResult.resolvedBy) {
22551
+ return {
22552
+ ...resolveIdResult,
22553
+ resolvedBy: plugin.name
22554
+ };
22555
+ }
22556
+ if (typeof resolveIdResult === 'string') {
22557
+ return {
22558
+ id: resolveIdResult,
22559
+ resolvedBy: plugin.name
22560
+ };
22561
+ }
22562
+ return resolveIdResult;
22563
+ }
22426
22564
  // external modules (non-entry modules that start with neither '.' or '/')
22427
22565
  // are skipped at this stage.
22428
22566
  if (importer !== undefined && !isAbsolute(source) && source[0] !== '.')
@@ -22440,13 +22578,13 @@ async function addJsExtensionIfNecessary(file, preserveSymlinks) {
22440
22578
  }
22441
22579
  async function findFile(file, preserveSymlinks) {
22442
22580
  try {
22443
- const stats = await promises.lstat(file);
22581
+ const stats = await lstat(file);
22444
22582
  if (!preserveSymlinks && stats.isSymbolicLink())
22445
- return await findFile(await promises.realpath(file), preserveSymlinks);
22583
+ return await findFile(await realpath(file), preserveSymlinks);
22446
22584
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
22447
22585
  // check case
22448
22586
  const name = basename(file);
22449
- const files = await promises.readdir(dirname(file));
22587
+ const files = await readdir(dirname(file));
22450
22588
  if (files.includes(name))
22451
22589
  return file;
22452
22590
  }
@@ -22691,15 +22829,15 @@ class ModuleLoader {
22691
22829
  entryModule.isUserDefinedEntryPoint || isUserDefined;
22692
22830
  addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined, firstChunkNamePriority + index);
22693
22831
  const existingIndexedModule = this.indexedEntryModules.find(indexedModule => indexedModule.module === entryModule);
22694
- if (!existingIndexedModule) {
22832
+ if (existingIndexedModule) {
22833
+ existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
22834
+ }
22835
+ else {
22695
22836
  this.indexedEntryModules.push({
22696
22837
  index: firstEntryModuleIndex + index,
22697
22838
  module: entryModule
22698
22839
  });
22699
22840
  }
22700
- else {
22701
- existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
22702
- }
22703
22841
  }
22704
22842
  this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
22705
22843
  return entryModules;
@@ -22750,7 +22888,7 @@ class ModuleLoader {
22750
22888
  async addModuleSource(id, importer, module) {
22751
22889
  let source;
22752
22890
  try {
22753
- source = await this.graph.fileOperationQueue.run(async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await promises.readFile(id, 'utf8')));
22891
+ source = await this.graph.fileOperationQueue.run(async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await readFile(id, 'utf8')));
22754
22892
  }
22755
22893
  catch (error_) {
22756
22894
  let message = `Could not load ${id}`;
@@ -22972,6 +23110,7 @@ class ModuleLoader {
22972
23110
  id: resolvedId.id,
22973
23111
  meta: resolvedId.meta || {},
22974
23112
  moduleSideEffects: resolvedId.moduleSideEffects ?? this.hasModuleSideEffects(resolvedId.id, !!external),
23113
+ resolvedBy: resolvedId.resolvedBy ?? 'rollup',
22975
23114
  syntheticNamedExports: resolvedId.syntheticNamedExports ?? false
22976
23115
  };
22977
23116
  }
@@ -23004,6 +23143,7 @@ class ModuleLoader {
23004
23143
  id: source,
23005
23144
  meta: {},
23006
23145
  moduleSideEffects: this.hasModuleSideEffects(source, true),
23146
+ resolvedBy: 'rollup',
23007
23147
  syntheticNamedExports: false
23008
23148
  };
23009
23149
  }
@@ -23215,8 +23355,11 @@ class FileEmitter {
23215
23355
  this.facadeChunkByModule = facadeChunkByModule;
23216
23356
  };
23217
23357
  this.setOutputBundle = (bundle, outputOptions) => {
23218
- const fileNamesBySource = new Map();
23219
- const output = (this.output = { bundle, fileNamesBySource, outputOptions });
23358
+ const output = (this.output = {
23359
+ bundle,
23360
+ fileNamesBySource: new Map(),
23361
+ outputOptions
23362
+ });
23220
23363
  for (const emittedFile of this.filesByReferenceId.values()) {
23221
23364
  if (emittedFile.fileName) {
23222
23365
  reserveFileNameInBundle(emittedFile.fileName, output, this.options.onwarn);
@@ -23237,12 +23380,9 @@ class FileEmitter {
23237
23380
  this.outputFileEmitters.push(outputFileEmitter);
23238
23381
  }
23239
23382
  assignReferenceId(file, idBase) {
23240
- let referenceId;
23383
+ let referenceId = idBase;
23241
23384
  do {
23242
- referenceId = createHash()
23243
- .update(referenceId || idBase)
23244
- .digest('hex')
23245
- .slice(0, 8);
23385
+ referenceId = createHash().update(referenceId).digest('hex').slice(0, 8);
23246
23386
  } while (this.filesByReferenceId.has(referenceId) ||
23247
23387
  this.outputFileEmitters.some(({ filesByReferenceId }) => filesByReferenceId.has(referenceId)));
23248
23388
  this.filesByReferenceId.set(referenceId, file);
@@ -23252,9 +23392,9 @@ class FileEmitter {
23252
23392
  return referenceId;
23253
23393
  }
23254
23394
  emitAsset(emittedAsset) {
23255
- const source = typeof emittedAsset.source !== 'undefined'
23256
- ? getValidSource(emittedAsset.source, emittedAsset, null)
23257
- : undefined;
23395
+ const source = emittedAsset.source === undefined
23396
+ ? undefined
23397
+ : getValidSource(emittedAsset.source, emittedAsset, null);
23258
23398
  const consumedAsset = {
23259
23399
  fileName: emittedAsset.fileName,
23260
23400
  name: emittedAsset.name,
@@ -23454,17 +23594,18 @@ class PluginDriver {
23454
23594
  }
23455
23595
  // chains, first non-null result stops and returns
23456
23596
  hookFirst(hookName, parameters, replaceContext, skipped) {
23457
- let promise = Promise.resolve(null);
23597
+ return this.hookFirstAndGetPlugin(hookName, parameters, replaceContext, skipped).then(result => result && result[0]);
23598
+ }
23599
+ // chains, first non-null result stops and returns result and last plugin
23600
+ async hookFirstAndGetPlugin(hookName, parameters, replaceContext, skipped) {
23458
23601
  for (const plugin of this.getSortedPlugins(hookName)) {
23459
- if (skipped && skipped.has(plugin))
23602
+ if (skipped?.has(plugin))
23460
23603
  continue;
23461
- promise = promise.then(result => {
23462
- if (result != null)
23463
- return result;
23464
- return this.runHook(hookName, parameters, plugin, replaceContext);
23465
- });
23604
+ const result = await this.runHook(hookName, parameters, plugin, replaceContext);
23605
+ if (result != null)
23606
+ return [result, plugin];
23466
23607
  }
23467
- return promise;
23608
+ return null;
23468
23609
  }
23469
23610
  // chains synchronously, first non-null result stops and returns
23470
23611
  hookFirstSync(hookName, parameters, replaceContext) {
@@ -23927,26 +24068,11 @@ async function catchUnfinishedHookActions(pluginDriver, callback) {
23927
24068
  return result;
23928
24069
  }
23929
24070
 
23930
- var lib = {};
23931
-
23932
- const require$$0 = /*@__PURE__*/getAugmentedNamespace(acorn);
23933
-
23934
- Object.defineProperty(lib, "__esModule", {
23935
- value: true
23936
- });
23937
- var importAssertions_1 = lib.importAssertions = importAssertions;
23938
-
23939
- var _acorn = _interopRequireWildcard(require$$0);
23940
-
23941
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23942
-
23943
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23944
-
23945
24071
  const leftCurlyBrace = "{".charCodeAt(0);
23946
24072
  const space = " ".charCodeAt(0);
24073
+
23947
24074
  const keyword = "assert";
23948
- const FUNC_STATEMENT = 1,
23949
- FUNC_NULLABLE_ID = 4;
24075
+ const FUNC_STATEMENT = 1, FUNC_NULLABLE_ID = 4;
23950
24076
 
23951
24077
  function importAssertions(Parser) {
23952
24078
  // Use supplied version acorn version if present, to avoid
@@ -23955,10 +24081,8 @@ function importAssertions(Parser) {
23955
24081
  // its own internal version of acorn and thereby sidesteps
23956
24082
  // the package manager.
23957
24083
  const acorn = Parser.acorn || _acorn;
23958
- const {
23959
- tokTypes: tt,
23960
- TokenType
23961
- } = acorn;
24084
+ const { tokTypes: tt, TokenType } = acorn;
24085
+
23962
24086
  return class extends Parser {
23963
24087
  constructor(...args) {
23964
24088
  super(...args);
@@ -23973,21 +24097,19 @@ function importAssertions(Parser) {
23973
24097
  if (this.type !== t) {
23974
24098
  this.unexpected();
23975
24099
  }
23976
-
23977
24100
  this.next();
23978
24101
  }
23979
24102
 
23980
24103
  readToken(code) {
23981
24104
  let i = 0;
23982
-
23983
24105
  for (; i < keyword.length; i++) {
23984
24106
  if (this._codeAt(this.pos + i) !== keyword.charCodeAt(i)) {
23985
24107
  return super.readToken(code);
23986
24108
  }
23987
- } // ensure that the keyword is at the correct location
23988
- // ie `assert{...` or `assert {...`
23989
-
24109
+ }
23990
24110
 
24111
+ // ensure that the keyword is at the correct location
24112
+ // ie `assert{...` or `assert {...`
23991
24113
  for (;; i++) {
23992
24114
  if (this._codeAt(this.pos + i) === leftCurlyBrace) {
23993
24115
  // Found '{'
@@ -23998,11 +24120,11 @@ function importAssertions(Parser) {
23998
24120
  } else {
23999
24121
  return super.readToken(code);
24000
24122
  }
24001
- } // If we're inside a dynamic import expression we'll parse
24123
+ }
24124
+
24125
+ // If we're inside a dynamic import expression we'll parse
24002
24126
  // the `assert` keyword as a standard object property name
24003
24127
  // ie `import(""./foo.json", { assert: { type: "json" } })`
24004
-
24005
-
24006
24128
  if (this.type.label === "{") {
24007
24129
  return super.readToken(code);
24008
24130
  }
@@ -24013,24 +24135,22 @@ function importAssertions(Parser) {
24013
24135
 
24014
24136
  parseDynamicImport(node) {
24015
24137
  this.next(); // skip `(`
24016
- // Parse node.source.
24017
24138
 
24139
+ // Parse node.source.
24018
24140
  node.source = this.parseMaybeAssign();
24019
24141
 
24020
24142
  if (this.eat(tt.comma)) {
24021
24143
  const obj = this.parseObj(false);
24022
24144
  node.arguments = [obj];
24023
24145
  }
24024
-
24025
24146
  this._eat(tt.parenR);
24026
-
24027
24147
  return this.finishNode(node, "ImportExpression");
24028
- } // ported from acorn/src/statement.js pp.parseExport
24029
-
24148
+ }
24030
24149
 
24150
+ // ported from acorn/src/statement.js pp.parseExport
24031
24151
  parseExport(node, exports) {
24032
- this.next(); // export * from '...'
24033
-
24152
+ this.next();
24153
+ // export * from '...'
24034
24154
  if (this.eat(tt.star)) {
24035
24155
  if (this.options.ecmaVersion >= 11) {
24036
24156
  if (this.eatContextual("as")) {
@@ -24040,41 +24160,28 @@ function importAssertions(Parser) {
24040
24160
  node.exported = null;
24041
24161
  }
24042
24162
  }
24043
-
24044
24163
  this.expectContextual("from");
24045
-
24046
- if (this.type !== tt.string) {
24047
- this.unexpected();
24048
- }
24049
-
24164
+ if (this.type !== tt.string) { this.unexpected(); }
24050
24165
  node.source = this.parseExprAtom();
24051
24166
 
24052
24167
  if (this.type === this.assertToken) {
24053
24168
  this.next();
24054
24169
  const assertions = this.parseImportAssertions();
24055
-
24056
24170
  if (assertions) {
24057
24171
  node.assertions = assertions;
24058
24172
  }
24059
24173
  }
24060
24174
 
24061
24175
  this.semicolon();
24062
- return this.finishNode(node, "ExportAllDeclaration");
24176
+ return this.finishNode(node, "ExportAllDeclaration")
24063
24177
  }
24064
-
24065
- if (this.eat(tt._default)) {
24066
- // export default ...
24178
+ if (this.eat(tt._default)) { // export default ...
24067
24179
  this.checkExport(exports, "default", this.lastTokStart);
24068
24180
  var isAsync;
24069
-
24070
24181
  if (this.type === tt._function || (isAsync = this.isAsyncFunction())) {
24071
24182
  var fNode = this.startNode();
24072
24183
  this.next();
24073
-
24074
- if (isAsync) {
24075
- this.next();
24076
- }
24077
-
24184
+ if (isAsync) { this.next(); }
24078
24185
  node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
24079
24186
  } else if (this.type === tt._class) {
24080
24187
  var cNode = this.startNode();
@@ -24083,38 +24190,27 @@ function importAssertions(Parser) {
24083
24190
  node.declaration = this.parseMaybeAssign();
24084
24191
  this.semicolon();
24085
24192
  }
24086
-
24087
- return this.finishNode(node, "ExportDefaultDeclaration");
24088
- } // export var|const|let|function|class ...
24089
-
24090
-
24193
+ return this.finishNode(node, "ExportDefaultDeclaration")
24194
+ }
24195
+ // export var|const|let|function|class ...
24091
24196
  if (this.shouldParseExportStatement()) {
24092
24197
  node.declaration = this.parseStatement(null);
24093
-
24094
- if (node.declaration.type === "VariableDeclaration") {
24095
- this.checkVariableExport(exports, node.declaration.declarations);
24096
- } else {
24097
- this.checkExport(exports, node.declaration.id.name, node.declaration.id.start);
24098
- }
24099
-
24198
+ if (node.declaration.type === "VariableDeclaration")
24199
+ { this.checkVariableExport(exports, node.declaration.declarations); }
24200
+ else
24201
+ { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); }
24100
24202
  node.specifiers = [];
24101
24203
  node.source = null;
24102
- } else {
24103
- // export { x, y as z } [from '...']
24204
+ } else { // export { x, y as z } [from '...']
24104
24205
  node.declaration = null;
24105
24206
  node.specifiers = this.parseExportSpecifiers(exports);
24106
-
24107
24207
  if (this.eatContextual("from")) {
24108
- if (this.type !== tt.string) {
24109
- this.unexpected();
24110
- }
24111
-
24208
+ if (this.type !== tt.string) { this.unexpected(); }
24112
24209
  node.source = this.parseExprAtom();
24113
24210
 
24114
24211
  if (this.type === this.assertToken) {
24115
24212
  this.next();
24116
24213
  const assertions = this.parseImportAssertions();
24117
-
24118
24214
  if (assertions) {
24119
24215
  node.assertions = assertions;
24120
24216
  }
@@ -24123,52 +24219,47 @@ function importAssertions(Parser) {
24123
24219
  for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
24124
24220
  // check for keywords used as local names
24125
24221
  var spec = list[i];
24126
- this.checkUnreserved(spec.local); // check if export is defined
24127
24222
 
24223
+ this.checkUnreserved(spec.local);
24224
+ // check if export is defined
24128
24225
  this.checkLocalExport(spec.local);
24129
24226
  }
24130
24227
 
24131
24228
  node.source = null;
24132
24229
  }
24133
-
24134
24230
  this.semicolon();
24135
24231
  }
24136
-
24137
- return this.finishNode(node, "ExportNamedDeclaration");
24232
+ return this.finishNode(node, "ExportNamedDeclaration")
24138
24233
  }
24139
24234
 
24140
24235
  parseImport(node) {
24141
- this.next(); // import '...'
24142
-
24236
+ this.next();
24237
+ // import '...'
24143
24238
  if (this.type === tt.string) {
24144
24239
  node.specifiers = [];
24145
24240
  node.source = this.parseExprAtom();
24146
24241
  } else {
24147
24242
  node.specifiers = this.parseImportSpecifiers();
24148
24243
  this.expectContextual("from");
24149
- node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
24244
+ node.source =
24245
+ this.type === tt.string ? this.parseExprAtom() : this.unexpected();
24150
24246
  }
24151
24247
 
24152
24248
  if (this.type === this.assertToken) {
24153
24249
  this.next();
24154
24250
  const assertions = this.parseImportAssertions();
24155
-
24156
24251
  if (assertions) {
24157
24252
  node.assertions = assertions;
24158
24253
  }
24159
24254
  }
24160
-
24161
24255
  this.semicolon();
24162
24256
  return this.finishNode(node, "ImportDeclaration");
24163
24257
  }
24164
24258
 
24165
24259
  parseImportAssertions() {
24166
24260
  this._eat(tt.braceL);
24167
-
24168
24261
  const attrs = this.parseAssertEntries();
24169
-
24170
24262
  this._eat(tt.braceR);
24171
-
24172
24263
  return attrs;
24173
24264
  }
24174
24265
 
@@ -24181,38 +24272,40 @@ function importAssertions(Parser) {
24181
24272
  break;
24182
24273
  }
24183
24274
 
24184
- const node = this.startNode(); // parse AssertionKey : IdentifierName, StringLiteral
24275
+ const node = this.startNode();
24185
24276
 
24277
+ // parse AssertionKey : IdentifierName, StringLiteral
24186
24278
  let assertionKeyNode;
24187
-
24188
24279
  if (this.type === tt.string) {
24189
24280
  assertionKeyNode = this.parseLiteral(this.value);
24190
24281
  } else {
24191
24282
  assertionKeyNode = this.parseIdent(true);
24192
24283
  }
24193
-
24194
24284
  this.next();
24195
- node.key = assertionKeyNode; // check if we already have an entry for an attribute
24285
+ node.key = assertionKeyNode;
24286
+
24287
+ // check if we already have an entry for an attribute
24196
24288
  // if a duplicate entry is found, throw an error
24197
24289
  // for now this logic will come into play only when someone declares `type` twice
24198
-
24199
24290
  if (attrNames.has(node.key.name)) {
24200
24291
  this.raise(this.pos, "Duplicated key in assertions");
24201
24292
  }
24202
-
24203
24293
  attrNames.add(node.key.name);
24204
24294
 
24205
24295
  if (this.type !== tt.string) {
24206
- this.raise(this.pos, "Only string is supported as an assertion value");
24296
+ this.raise(
24297
+ this.pos,
24298
+ "Only string is supported as an assertion value"
24299
+ );
24207
24300
  }
24208
24301
 
24209
24302
  node.value = this.parseLiteral(this.value);
24303
+
24210
24304
  attrs.push(this.finishNode(node, "ImportAttribute"));
24211
24305
  } while (this.eat(tt.comma));
24212
24306
 
24213
24307
  return attrs;
24214
24308
  }
24215
-
24216
24309
  };
24217
24310
  }
24218
24311
 
@@ -24366,14 +24459,12 @@ const getOnwarn = (config) => {
24366
24459
  : defaultOnWarn;
24367
24460
  };
24368
24461
  const getAcorn = (config) => ({
24369
- allowAwaitOutsideFunction: true,
24370
24462
  ecmaVersion: 'latest',
24371
- preserveParens: false,
24372
24463
  sourceType: 'module',
24373
24464
  ...config.acorn
24374
24465
  });
24375
24466
  const getAcornInjectPlugins = (config) => [
24376
- importAssertions_1,
24467
+ importAssertions,
24377
24468
  ...ensureArray(config.acornInjectPlugins)
24378
24469
  ];
24379
24470
  const getCache = (config) => config.cache?.cache || config.cache;
@@ -24440,7 +24531,7 @@ const getModuleContext = (config, context) => {
24440
24531
  for (const [key, moduleContext] of Object.entries(configModuleContext)) {
24441
24532
  contextByModuleId[resolve(key)] = moduleContext;
24442
24533
  }
24443
- return id => contextByModuleId[id] || context;
24534
+ return id => contextByModuleId[id] ?? context;
24444
24535
  }
24445
24536
  return () => context;
24446
24537
  };
@@ -24477,7 +24568,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
24477
24568
  return (_id, external) => !external;
24478
24569
  }
24479
24570
  if (typeof moduleSideEffectsOption === 'function') {
24480
- return (id, external) => !id.startsWith('\0') ? moduleSideEffectsOption(id, external) !== false : true;
24571
+ return (id, external) => id.startsWith('\0') ? true : moduleSideEffectsOption(id, external) !== false;
24481
24572
  }
24482
24573
  if (Array.isArray(moduleSideEffectsOption)) {
24483
24574
  const ids = new Set(moduleSideEffectsOption);
@@ -24941,8 +25032,8 @@ function getSortingFileType(file) {
24941
25032
  async function writeOutputFile(outputFile, outputOptions) {
24942
25033
  const fileName = resolve(outputOptions.dir || dirname(outputOptions.file), outputFile.fileName);
24943
25034
  // '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);
25035
+ await mkdir(dirname(fileName), { recursive: true });
25036
+ return writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
24946
25037
  }
24947
25038
  /**
24948
25039
  * Auxiliary function for defining rollup configuration
@@ -25340,8 +25431,8 @@ function getFsEvents() {
25340
25431
 
25341
25432
  const fseventsImporter = /*#__PURE__*/Object.defineProperty({
25342
25433
  __proto__: null,
25343
- loadFsEvents,
25344
- getFsEvents
25434
+ getFsEvents,
25435
+ loadFsEvents
25345
25436
  }, Symbol.toStringTag, { value: 'Module' });
25346
25437
 
25347
25438
  function watch(configs) {
@@ -25362,4 +25453,4 @@ async function watchInternal(configs, emitter) {
25362
25453
  new Watcher(watchOptionsList, emitter);
25363
25454
  }
25364
25455
 
25365
- export { createFilter, defineConfig, fseventsImporter, getAugmentedNamespace, picomatch$1 as picomatch, rollup, rollupInternal, version$1 as version, watch };
25456
+ export { createFilter, defineConfig, fseventsImporter, getAugmentedNamespace, picomatchExports, rollup, rollupInternal, version$1 as version, watch };