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,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.9.1
4
+ Mon, 02 Jan 2023 13:46:34 GMT - commit c6c884433e748cde70f3f4299dd48b81af97ec14
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -10,11 +10,11 @@
10
10
  'use strict';
11
11
 
12
12
  const node_path = require('node:path');
13
- const require$$0$1 = require('path');
13
+ const require$$0$2 = require('path');
14
14
  const process$1 = require('node:process');
15
15
  const node_perf_hooks = require('node:perf_hooks');
16
16
  const node_crypto = require('node:crypto');
17
- const node_fs = require('node:fs');
17
+ const promises = require('node:fs/promises');
18
18
  const node_events = require('node:events');
19
19
  const tty = require('tty');
20
20
 
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
31
31
 
32
32
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
33
33
 
34
- var version$1 = "3.9.0";
34
+ var version$1 = "3.9.1";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -202,7 +202,7 @@ function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName)
202
202
  return [...relativePath.split('/'), '..', node_path.basename(targetPath)].join('/');
203
203
  }
204
204
  }
205
- return !relativePath ? '.' : relativePath.startsWith('..') ? relativePath : './' + relativePath;
205
+ return relativePath ? (relativePath.startsWith('..') ? relativePath : './' + relativePath) : '.';
206
206
  }
207
207
 
208
208
  function error(base) {
@@ -482,7 +482,7 @@ function errorInternalIdCannotBeExternal(source, importer) {
482
482
  function errorInvalidOption(option, urlHash, explanation, value) {
483
483
  return {
484
484
  code: INVALID_OPTION,
485
- message: `Invalid value ${value !== undefined ? `${JSON.stringify(value)} ` : ''}for option "${option}" - ${explanation}.`,
485
+ message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
486
486
  url: `https://rollupjs.org/guide/en/#${urlHash}`
487
487
  };
488
488
  }
@@ -1084,8 +1084,8 @@ function getFsEvents() {
1084
1084
 
1085
1085
  const fseventsImporter = /*#__PURE__*/Object.defineProperty({
1086
1086
  __proto__: null,
1087
- loadFsEvents,
1088
- getFsEvents
1087
+ getFsEvents,
1088
+ loadFsEvents
1089
1089
  }, Symbol.toStringTag, { value: 'Module' });
1090
1090
 
1091
1091
  const {
@@ -1231,126 +1231,92 @@ function handleError(error, recover = false) {
1231
1231
  process$1.exit(1);
1232
1232
  }
1233
1233
 
1234
- var charToInteger = {};
1235
- var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
1236
- for (var i$1 = 0; i$1 < chars$1.length; i$1++) {
1237
- charToInteger[chars$1.charCodeAt(i$1)] = i$1;
1238
- }
1239
- function decode(mappings) {
1240
- var decoded = [];
1241
- var line = [];
1242
- var segment = [
1243
- 0,
1244
- 0,
1245
- 0,
1246
- 0,
1247
- 0,
1248
- ];
1249
- var j = 0;
1250
- for (var i = 0, shift = 0, value = 0; i < mappings.length; i++) {
1251
- var c = mappings.charCodeAt(i);
1252
- if (c === 44) { // ","
1253
- segmentify(line, segment, j);
1254
- j = 0;
1255
- }
1256
- else if (c === 59) { // ";"
1257
- segmentify(line, segment, j);
1258
- j = 0;
1259
- decoded.push(line);
1260
- line = [];
1261
- segment[0] = 0;
1234
+ const comma = ','.charCodeAt(0);
1235
+ const semicolon = ';'.charCodeAt(0);
1236
+ const chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
1237
+ const intToChar = new Uint8Array(64); // 64 possible chars.
1238
+ const charToInt = new Uint8Array(128); // z is 122 in ASCII
1239
+ for (let i = 0; i < chars$2.length; i++) {
1240
+ const c = chars$2.charCodeAt(i);
1241
+ intToChar[i] = c;
1242
+ charToInt[c] = i;
1243
+ }
1244
+ // Provide a fallback for older environments.
1245
+ const td = typeof TextDecoder !== 'undefined'
1246
+ ? /* #__PURE__ */ new TextDecoder()
1247
+ : typeof Buffer !== 'undefined'
1248
+ ? {
1249
+ decode(buf) {
1250
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
1251
+ return out.toString();
1252
+ },
1262
1253
  }
1263
- else {
1264
- var integer = charToInteger[c];
1265
- if (integer === undefined) {
1266
- throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
1267
- }
1268
- var hasContinuationBit = integer & 32;
1269
- integer &= 31;
1270
- value += integer << shift;
1271
- if (hasContinuationBit) {
1272
- shift += 5;
1273
- }
1274
- else {
1275
- var shouldNegate = value & 1;
1276
- value >>>= 1;
1277
- if (shouldNegate) {
1278
- value = value === 0 ? -0x80000000 : -value;
1254
+ : {
1255
+ decode(buf) {
1256
+ let out = '';
1257
+ for (let i = 0; i < buf.length; i++) {
1258
+ out += String.fromCharCode(buf[i]);
1279
1259
  }
1280
- segment[j] += value;
1281
- j++;
1282
- value = shift = 0; // reset
1283
- }
1284
- }
1285
- }
1286
- segmentify(line, segment, j);
1287
- decoded.push(line);
1288
- return decoded;
1289
- }
1290
- function segmentify(line, segment, j) {
1291
- // This looks ugly, but we're creating specialized arrays with a specific
1292
- // length. This is much faster than creating a new array (which v8 expands to
1293
- // a capacity of 17 after pushing the first item), or slicing out a subarray
1294
- // (which is slow). Length 4 is assumed to be the most frequent, followed by
1295
- // length 5 (since not everything will have an associated name), followed by
1296
- // length 1 (it's probably rare for a source substring to not have an
1297
- // associated segment data).
1298
- if (j === 4)
1299
- line.push([segment[0], segment[1], segment[2], segment[3]]);
1300
- else if (j === 5)
1301
- line.push([segment[0], segment[1], segment[2], segment[3], segment[4]]);
1302
- else if (j === 1)
1303
- line.push([segment[0]]);
1304
- }
1260
+ return out;
1261
+ },
1262
+ };
1305
1263
  function encode(decoded) {
1306
- var sourceFileIndex = 0; // second field
1307
- var sourceCodeLine = 0; // third field
1308
- var sourceCodeColumn = 0; // fourth field
1309
- var nameIndex = 0; // fifth field
1310
- var mappings = '';
1311
- for (var i = 0; i < decoded.length; i++) {
1312
- var line = decoded[i];
1313
- if (i > 0)
1314
- mappings += ';';
1264
+ const state = new Int32Array(5);
1265
+ const bufLength = 1024 * 16;
1266
+ const subLength = bufLength - 36;
1267
+ const buf = new Uint8Array(bufLength);
1268
+ const sub = buf.subarray(0, subLength);
1269
+ let pos = 0;
1270
+ let out = '';
1271
+ for (let i = 0; i < decoded.length; i++) {
1272
+ const line = decoded[i];
1273
+ if (i > 0) {
1274
+ if (pos === bufLength) {
1275
+ out += td.decode(buf);
1276
+ pos = 0;
1277
+ }
1278
+ buf[pos++] = semicolon;
1279
+ }
1315
1280
  if (line.length === 0)
1316
1281
  continue;
1317
- var generatedCodeColumn = 0; // first field
1318
- var lineMappings = [];
1319
- for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
1320
- var segment = line_1[_i];
1321
- var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
1322
- generatedCodeColumn = segment[0];
1323
- if (segment.length > 1) {
1324
- segmentMappings +=
1325
- encodeInteger(segment[1] - sourceFileIndex) +
1326
- encodeInteger(segment[2] - sourceCodeLine) +
1327
- encodeInteger(segment[3] - sourceCodeColumn);
1328
- sourceFileIndex = segment[1];
1329
- sourceCodeLine = segment[2];
1330
- sourceCodeColumn = segment[3];
1331
- }
1332
- if (segment.length === 5) {
1333
- segmentMappings += encodeInteger(segment[4] - nameIndex);
1334
- nameIndex = segment[4];
1335
- }
1336
- lineMappings.push(segmentMappings);
1337
- }
1338
- mappings += lineMappings.join(',');
1339
- }
1340
- return mappings;
1341
- }
1342
- function encodeInteger(num) {
1343
- var result = '';
1282
+ state[0] = 0;
1283
+ for (let j = 0; j < line.length; j++) {
1284
+ const segment = line[j];
1285
+ // We can push up to 5 ints, each int can take at most 7 chars, and we
1286
+ // may push a comma.
1287
+ if (pos > subLength) {
1288
+ out += td.decode(sub);
1289
+ buf.copyWithin(0, subLength, pos);
1290
+ pos -= subLength;
1291
+ }
1292
+ if (j > 0)
1293
+ buf[pos++] = comma;
1294
+ pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
1295
+ if (segment.length === 1)
1296
+ continue;
1297
+ pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
1298
+ pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
1299
+ pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
1300
+ if (segment.length === 4)
1301
+ continue;
1302
+ pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
1303
+ }
1304
+ }
1305
+ return out + td.decode(buf.subarray(0, pos));
1306
+ }
1307
+ function encodeInteger(buf, pos, state, segment, j) {
1308
+ const next = segment[j];
1309
+ let num = next - state[j];
1310
+ state[j] = next;
1344
1311
  num = num < 0 ? (-num << 1) | 1 : num << 1;
1345
1312
  do {
1346
- var clamped = num & 31;
1313
+ let clamped = num & 0b011111;
1347
1314
  num >>>= 5;
1348
- if (num > 0) {
1349
- clamped |= 32;
1350
- }
1351
- result += chars$1[clamped];
1315
+ if (num > 0)
1316
+ clamped |= 0b100000;
1317
+ buf[pos++] = intToChar[clamped];
1352
1318
  } while (num > 0);
1353
- return result;
1319
+ return pos;
1354
1320
  }
1355
1321
 
1356
1322
  class BitSet {
@@ -3218,9 +3184,16 @@ function getDefaultExportFromCjs (x) {
3218
3184
  }
3219
3185
 
3220
3186
  function getAugmentedNamespace(n) {
3187
+ if (n.__esModule) return n;
3221
3188
  var f = n.default;
3222
3189
  if (typeof f == "function") {
3223
- var a = function () {
3190
+ var a = function a () {
3191
+ if (this instanceof a) {
3192
+ var args = [null];
3193
+ args.push.apply(args, arguments);
3194
+ var Ctor = Function.bind.apply(f, args);
3195
+ return new Ctor();
3196
+ }
3224
3197
  return f.apply(this, arguments);
3225
3198
  };
3226
3199
  a.prototype = f.prototype;
@@ -3238,11 +3211,15 @@ function getAugmentedNamespace(n) {
3238
3211
  return a;
3239
3212
  }
3240
3213
 
3241
- var picomatch$1 = {exports: {}};
3214
+ exports.picomatchExports = {};
3215
+ var picomatch$1 = {
3216
+ get exports(){ return exports.picomatchExports; },
3217
+ set exports(v){ exports.picomatchExports = v; },
3218
+ };
3242
3219
 
3243
3220
  var utils$3 = {};
3244
3221
 
3245
- const path$1 = require$$0$1;
3222
+ const path$1 = require$$0$2;
3246
3223
  const WIN_SLASH = '\\\\/';
3247
3224
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
3248
3225
 
@@ -3422,7 +3399,7 @@ var constants$2 = {
3422
3399
 
3423
3400
  (function (exports) {
3424
3401
 
3425
- const path = require$$0$1;
3402
+ const path = require$$0$2;
3426
3403
  const win32 = process.platform === 'win32';
3427
3404
  const {
3428
3405
  REGEX_BACKSLASH,
@@ -4959,7 +4936,7 @@ parse$2.fastpaths = (input, options) => {
4959
4936
 
4960
4937
  var parse_1 = parse$2;
4961
4938
 
4962
- const path = require$$0$1;
4939
+ const path = require$$0$2;
4963
4940
  const scan = scan_1;
4964
4941
  const parse$1 = parse_1;
4965
4942
  const utils = utils$3;
@@ -5305,7 +5282,7 @@ var picomatch_1 = picomatch;
5305
5282
  module.exports = picomatch_1;
5306
5283
  } (picomatch$1));
5307
5284
 
5308
- const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch$1.exports);
5285
+ const pm = /*@__PURE__*/getDefaultExportFromCjs(exports.picomatchExports);
5309
5286
 
5310
5287
  const extractors = {
5311
5288
  ArrayPattern(names, param) {
@@ -5355,22 +5332,22 @@ function ensureArray(thing) {
5355
5332
  }
5356
5333
 
5357
5334
  const normalizePath = function normalizePath(filename) {
5358
- return filename.split(require$$0$1.win32.sep).join(require$$0$1.posix.sep);
5335
+ return filename.split(require$$0$2.win32.sep).join(require$$0$2.posix.sep);
5359
5336
  };
5360
5337
 
5361
5338
  function getMatcherString(id, resolutionBase) {
5362
- if (resolutionBase === false || require$$0$1.isAbsolute(id) || id.startsWith('*')) {
5339
+ if (resolutionBase === false || require$$0$2.isAbsolute(id) || id.startsWith('*')) {
5363
5340
  return normalizePath(id);
5364
5341
  }
5365
5342
  // resolve('') is valid and will default to process.cwd()
5366
- const basePath = normalizePath(require$$0$1.resolve(resolutionBase || ''))
5343
+ const basePath = normalizePath(require$$0$2.resolve(resolutionBase || ''))
5367
5344
  // escape all possible (posix + win) path characters that might interfere with regex
5368
5345
  .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
5369
5346
  // Note that we use posix.join because:
5370
5347
  // 1. the basePath has been normalized to use /
5371
5348
  // 2. the incoming glob (id) matcher, also uses /
5372
5349
  // otherwise Node will force backslash (\) on windows
5373
- return require$$0$1.posix.join(basePath, normalizePath(id));
5350
+ return require$$0$2.posix.join(basePath, normalizePath(id));
5374
5351
  }
5375
5352
  const createFilter = function createFilter(include, exclude, options) {
5376
5353
  const resolutionBase = options && options.resolve;
@@ -5408,8 +5385,8 @@ const createFilter = function createFilter(include, exclude, options) {
5408
5385
  };
5409
5386
 
5410
5387
  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';
5411
- 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';
5412
- const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins$1}`.split(' '));
5388
+ 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';
5389
+ const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins}`.split(' '));
5413
5390
  forbiddenIdentifiers.add('');
5414
5391
 
5415
5392
  const BROKEN_FLOW_NONE = 0;
@@ -6607,21 +6584,7 @@ class ObjectEntity extends ExpressionEntity {
6607
6584
  for (let index = properties.length - 1; index >= 0; index--) {
6608
6585
  const { key, kind, property } = properties[index];
6609
6586
  allProperties.push(property);
6610
- if (typeof key !== 'string') {
6611
- if (key === UnknownInteger) {
6612
- unknownIntegerProps.push(property);
6613
- continue;
6614
- }
6615
- if (kind === 'set')
6616
- unmatchableSetters.push(property);
6617
- if (kind === 'get')
6618
- unmatchableGetters.push(property);
6619
- if (kind !== 'get')
6620
- unmatchablePropertiesAndSetters.push(property);
6621
- if (kind !== 'set')
6622
- unmatchablePropertiesAndGetters.push(property);
6623
- }
6624
- else {
6587
+ if (typeof key === 'string') {
6625
6588
  if (kind === 'set') {
6626
6589
  if (!propertiesAndSettersByKey[key]) {
6627
6590
  propertiesAndSettersByKey[key] = [property, ...unmatchablePropertiesAndSetters];
@@ -6643,6 +6606,20 @@ class ObjectEntity extends ExpressionEntity {
6643
6606
  }
6644
6607
  }
6645
6608
  }
6609
+ else {
6610
+ if (key === UnknownInteger) {
6611
+ unknownIntegerProps.push(property);
6612
+ continue;
6613
+ }
6614
+ if (kind === 'set')
6615
+ unmatchableSetters.push(property);
6616
+ if (kind === 'get')
6617
+ unmatchableGetters.push(property);
6618
+ if (kind !== 'get')
6619
+ unmatchablePropertiesAndSetters.push(property);
6620
+ if (kind !== 'set')
6621
+ unmatchablePropertiesAndGetters.push(property);
6622
+ }
6646
6623
  }
6647
6624
  }
6648
6625
  deoptimizeCachedEntities() {
@@ -6840,8 +6817,6 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
6840
6817
  flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
6841
6818
  flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
6842
6819
  forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6843
- group: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6844
- groupToMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
6845
6820
  includes: METHOD_RETURNS_BOOLEAN,
6846
6821
  indexOf: METHOD_RETURNS_NUMBER,
6847
6822
  join: METHOD_RETURNS_STRING,
@@ -6912,11 +6887,11 @@ class ArrayExpression extends NodeBase {
6912
6887
  properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
6913
6888
  }
6914
6889
  }
6915
- else if (!element) {
6916
- properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
6890
+ else if (element) {
6891
+ properties.push({ key: String(index), kind: 'init', property: element });
6917
6892
  }
6918
6893
  else {
6919
- properties.push({ key: String(index), kind: 'init', property: element });
6894
+ properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
6920
6895
  }
6921
6896
  }
6922
6897
  return (this.objectEntity = new ObjectEntity(properties, ARRAY_PROTOTYPE));
@@ -7102,14 +7077,14 @@ class LocalVariable extends Variable {
7102
7077
  }
7103
7078
  }
7104
7079
 
7105
- const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
7080
+ const chars$1 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
7106
7081
  const base = 64;
7107
7082
  function toBase64(value) {
7108
7083
  let outString = '';
7109
7084
  do {
7110
7085
  const currentDigit = value % base;
7111
7086
  value = (value / base) | 0;
7112
- outString = chars[currentDigit] + outString;
7087
+ outString = chars$1[currentDigit] + outString;
7113
7088
  } while (value !== 0);
7114
7089
  return outString;
7115
7090
  }
@@ -10119,9 +10094,9 @@ class ClassNode extends NodeBase {
10119
10094
  hasEffectsOnInteractionAtPath(path, interaction, context) {
10120
10095
  return interaction.type === INTERACTION_CALLED && path.length === 0
10121
10096
  ? !interaction.withNew ||
10122
- (this.classConstructor !== null
10123
- ? this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)
10124
- : this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
10097
+ (this.classConstructor === null
10098
+ ? this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)
10099
+ : this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
10125
10100
  false
10126
10101
  : this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
10127
10102
  }
@@ -10298,12 +10273,12 @@ class ConditionalExpression extends NodeBase {
10298
10273
  }
10299
10274
  deoptimizePath(path) {
10300
10275
  const usedBranch = this.getUsedBranch();
10301
- if (!usedBranch) {
10302
- this.consequent.deoptimizePath(path);
10303
- this.alternate.deoptimizePath(path);
10276
+ if (usedBranch) {
10277
+ usedBranch.deoptimizePath(path);
10304
10278
  }
10305
10279
  else {
10306
- usedBranch.deoptimizePath(path);
10280
+ this.consequent.deoptimizePath(path);
10281
+ this.alternate.deoptimizePath(path);
10307
10282
  }
10308
10283
  }
10309
10284
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -10361,17 +10336,22 @@ class ConditionalExpression extends NodeBase {
10361
10336
  }
10362
10337
  includeCallArguments(context, parameters) {
10363
10338
  const usedBranch = this.getUsedBranch();
10364
- if (!usedBranch) {
10365
- this.consequent.includeCallArguments(context, parameters);
10366
- this.alternate.includeCallArguments(context, parameters);
10339
+ if (usedBranch) {
10340
+ usedBranch.includeCallArguments(context, parameters);
10367
10341
  }
10368
10342
  else {
10369
- usedBranch.includeCallArguments(context, parameters);
10343
+ this.consequent.includeCallArguments(context, parameters);
10344
+ this.alternate.includeCallArguments(context, parameters);
10370
10345
  }
10371
10346
  }
10372
10347
  render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
10373
10348
  const usedBranch = this.getUsedBranch();
10374
- if (!this.test.included) {
10349
+ if (this.test.included) {
10350
+ this.test.render(code, options, { renderedSurroundingElement });
10351
+ this.consequent.render(code, options);
10352
+ this.alternate.render(code, options);
10353
+ }
10354
+ else {
10375
10355
  const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
10376
10356
  const inclusionStart = findNonWhiteSpace(code.original, (this.consequent.included
10377
10357
  ? findFirstOccurrenceOutsideComment(code.original, '?', this.test.end)
@@ -10391,11 +10371,6 @@ class ConditionalExpression extends NodeBase {
10391
10371
  renderedSurroundingElement: renderedSurroundingElement || this.parent.type
10392
10372
  });
10393
10373
  }
10394
- else {
10395
- this.test.render(code, options, { renderedSurroundingElement });
10396
- this.consequent.render(code, options);
10397
- this.alternate.render(code, options);
10398
- }
10399
10374
  }
10400
10375
  getUsedBranch() {
10401
10376
  if (this.isBranchResolutionAnalysed) {
@@ -11433,12 +11408,12 @@ class LogicalExpression extends NodeBase {
11433
11408
  }
11434
11409
  deoptimizePath(path) {
11435
11410
  const usedBranch = this.getUsedBranch();
11436
- if (!usedBranch) {
11437
- this.left.deoptimizePath(path);
11438
- this.right.deoptimizePath(path);
11411
+ if (usedBranch) {
11412
+ usedBranch.deoptimizePath(path);
11439
11413
  }
11440
11414
  else {
11441
- usedBranch.deoptimizePath(path);
11415
+ this.left.deoptimizePath(path);
11416
+ this.right.deoptimizePath(path);
11442
11417
  }
11443
11418
  }
11444
11419
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -12637,7 +12612,10 @@ class VariableDeclaration extends NodeBase {
12637
12612
  code.remove(this.end - 1, this.end);
12638
12613
  }
12639
12614
  separatorString += ';';
12640
- if (lastSeparatorPos !== null) {
12615
+ if (lastSeparatorPos === null) {
12616
+ code.appendLeft(renderedContentEnd, separatorString);
12617
+ }
12618
+ else {
12641
12619
  if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
12642
12620
  (code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
12643
12621
  code.original.charCodeAt(this.end) === 13) /*"\r"*/) {
@@ -12654,9 +12632,6 @@ class VariableDeclaration extends NodeBase {
12654
12632
  code.remove(actualContentEnd, renderedContentEnd);
12655
12633
  }
12656
12634
  }
12657
- else {
12658
- code.appendLeft(renderedContentEnd, separatorString);
12659
- }
12660
12635
  if (systemPatternExports.length > 0) {
12661
12636
  code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
12662
12637
  }
@@ -12980,7 +12955,8 @@ class NamespaceVariable extends Variable {
12980
12955
  return this.memberVariables;
12981
12956
  }
12982
12957
  const memberVariables = Object.create(null);
12983
- for (const name of [...this.context.getExports(), ...this.context.getReexports()]) {
12958
+ const sortedExports = [...this.context.getExports(), ...this.context.getReexports()].sort();
12959
+ for (const name of sortedExports) {
12984
12960
  if (name[0] !== '*' && name !== this.module.info.syntheticNamedExports) {
12985
12961
  const exportedVariable = this.context.traceExport(name);
12986
12962
  if (exportedVariable) {
@@ -14207,7 +14183,7 @@ function getCompleteAmdId(options, chunkId) {
14207
14183
  if (options.autoId) {
14208
14184
  return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`;
14209
14185
  }
14210
- return options.id || '';
14186
+ return options.id ?? '';
14211
14187
  }
14212
14188
 
14213
14189
  function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, mechanism = 'return ') {
@@ -14414,33 +14390,82 @@ function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
14414
14390
  return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
14415
14391
  }
14416
14392
 
14417
- const builtins = {
14418
- assert: 1,
14419
- buffer: 1,
14420
- console: 1,
14421
- constants: 1,
14422
- domain: 1,
14423
- events: 1,
14424
- http: 1,
14425
- https: 1,
14426
- os: 1,
14427
- path: 1,
14428
- process: 1,
14429
- punycode: 1,
14430
- querystring: 1,
14431
- stream: 1,
14432
- string_decoder: 1,
14433
- timers: 1,
14434
- tty: 1,
14435
- url: 1,
14436
- util: 1,
14437
- vm: 1,
14438
- zlib: 1
14439
- };
14393
+ var _staticExports = {};
14394
+ var _static = {
14395
+ get exports(){ return _staticExports; },
14396
+ set exports(v){ _staticExports = v; },
14397
+ };
14398
+
14399
+ const require$$0$1 = [
14400
+ "assert",
14401
+ "async_hooks",
14402
+ "buffer",
14403
+ "child_process",
14404
+ "cluster",
14405
+ "console",
14406
+ "constants",
14407
+ "crypto",
14408
+ "dgram",
14409
+ "diagnostics_channel",
14410
+ "dns",
14411
+ "domain",
14412
+ "events",
14413
+ "fs",
14414
+ "http",
14415
+ "http2",
14416
+ "https",
14417
+ "inspector",
14418
+ "module",
14419
+ "net",
14420
+ "os",
14421
+ "path",
14422
+ "perf_hooks",
14423
+ "process",
14424
+ "punycode",
14425
+ "querystring",
14426
+ "readline",
14427
+ "repl",
14428
+ "stream",
14429
+ "string_decoder",
14430
+ "timers",
14431
+ "tls",
14432
+ "trace_events",
14433
+ "tty",
14434
+ "url",
14435
+ "util",
14436
+ "v8",
14437
+ "vm",
14438
+ "wasi",
14439
+ "worker_threads",
14440
+ "zlib"
14441
+ ];
14442
+
14443
+ (function (module) {
14444
+ module.exports = require$$0$1;
14445
+ } (_static));
14446
+
14447
+ const builtinModules = /*@__PURE__*/getDefaultExportFromCjs(_staticExports);
14448
+
14449
+ const nodeBuiltins = new Set([
14450
+ ...builtinModules,
14451
+ // TODO
14452
+ // remove once builtin-modules includes PR: https://github.com/sindresorhus/builtin-modules/pull/17
14453
+ 'assert/strict',
14454
+ 'dns/promises',
14455
+ 'fs/promises',
14456
+ 'path/posix',
14457
+ 'path/win32',
14458
+ 'readline/promises',
14459
+ 'stream/consumers',
14460
+ 'stream/promises',
14461
+ 'stream/web',
14462
+ 'timers/promises',
14463
+ 'util/types'
14464
+ ]);
14440
14465
  function warnOnBuiltins(warn, dependencies) {
14441
14466
  const externalBuiltins = dependencies
14442
14467
  .map(({ importPath }) => importPath)
14443
- .filter(importPath => importPath in builtins || importPath.startsWith('node:'));
14468
+ .filter(importPath => nodeBuiltins.has(importPath) || importPath.startsWith('node:'));
14444
14469
  if (externalBuiltins.length === 0)
14445
14470
  return;
14446
14471
  warn(errorMissingNodeBuiltins(externalBuiltins));
@@ -15592,10 +15617,7 @@ class Chunk {
15592
15617
  if (file) {
15593
15618
  fileName = node_path.basename(file);
15594
15619
  }
15595
- else if (this.fileName !== null) {
15596
- fileName = this.fileName;
15597
- }
15598
- else {
15620
+ else if (this.fileName === null) {
15599
15621
  const [pattern, patternName] = preserveModules || this.facadeModule?.isUserDefinedEntryPoint
15600
15622
  ? [entryFileNames, 'output.entryFileNames']
15601
15623
  : [chunkFileNames, 'output.chunkFileNames'];
@@ -15608,6 +15630,9 @@ class Chunk {
15608
15630
  fileName = makeUnique(fileName, this.bundle);
15609
15631
  }
15610
15632
  }
15633
+ else {
15634
+ fileName = this.fileName;
15635
+ }
15611
15636
  if (!hashPlaceholder) {
15612
15637
  this.bundle[fileName] = FILE_PLACEHOLDER;
15613
15638
  }
@@ -16854,10 +16879,7 @@ function getLinkMap(warn) {
16854
16879
  }
16855
16880
  function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, linkMap) {
16856
16881
  let source;
16857
- if (!originalSourcemap) {
16858
- source = new Source(id, originalCode);
16859
- }
16860
- else {
16882
+ if (originalSourcemap) {
16861
16883
  const sources = originalSourcemap.sources;
16862
16884
  const sourcesContent = originalSourcemap.sourcesContent || [];
16863
16885
  const directory = node_path.dirname(id) || '.';
@@ -16865,6 +16887,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
16865
16887
  const baseSources = sources.map((source, index) => new Source(node_path.resolve(directory, sourceRoot, source), sourcesContent[index]));
16866
16888
  source = new Link(originalSourcemap, baseSources);
16867
16889
  }
16890
+ else {
16891
+ source = new Source(id, originalCode);
16892
+ }
16868
16893
  return sourcemapChain.reduce(linkMap, source);
16869
16894
  }
16870
16895
  function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeContent, warn) {
@@ -16894,6 +16919,78 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
16894
16919
 
16895
16920
  const createHash = () => node_crypto.createHash('sha256');
16896
16921
 
16922
+ var charToInteger = {};
16923
+ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
16924
+ for (var i$1 = 0; i$1 < chars.length; i$1++) {
16925
+ charToInteger[chars.charCodeAt(i$1)] = i$1;
16926
+ }
16927
+ function decode(mappings) {
16928
+ var decoded = [];
16929
+ var line = [];
16930
+ var segment = [
16931
+ 0,
16932
+ 0,
16933
+ 0,
16934
+ 0,
16935
+ 0,
16936
+ ];
16937
+ var j = 0;
16938
+ for (var i = 0, shift = 0, value = 0; i < mappings.length; i++) {
16939
+ var c = mappings.charCodeAt(i);
16940
+ if (c === 44) { // ","
16941
+ segmentify(line, segment, j);
16942
+ j = 0;
16943
+ }
16944
+ else if (c === 59) { // ";"
16945
+ segmentify(line, segment, j);
16946
+ j = 0;
16947
+ decoded.push(line);
16948
+ line = [];
16949
+ segment[0] = 0;
16950
+ }
16951
+ else {
16952
+ var integer = charToInteger[c];
16953
+ if (integer === undefined) {
16954
+ throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
16955
+ }
16956
+ var hasContinuationBit = integer & 32;
16957
+ integer &= 31;
16958
+ value += integer << shift;
16959
+ if (hasContinuationBit) {
16960
+ shift += 5;
16961
+ }
16962
+ else {
16963
+ var shouldNegate = value & 1;
16964
+ value >>>= 1;
16965
+ if (shouldNegate) {
16966
+ value = value === 0 ? -0x80000000 : -value;
16967
+ }
16968
+ segment[j] += value;
16969
+ j++;
16970
+ value = shift = 0; // reset
16971
+ }
16972
+ }
16973
+ }
16974
+ segmentify(line, segment, j);
16975
+ decoded.push(line);
16976
+ return decoded;
16977
+ }
16978
+ function segmentify(line, segment, j) {
16979
+ // This looks ugly, but we're creating specialized arrays with a specific
16980
+ // length. This is much faster than creating a new array (which v8 expands to
16981
+ // a capacity of 17 after pushing the first item), or slicing out a subarray
16982
+ // (which is slow). Length 4 is assumed to be the most frequent, followed by
16983
+ // length 5 (since not everything will have an associated name), followed by
16984
+ // length 1 (it's probably rare for a source substring to not have an
16985
+ // associated segment data).
16986
+ if (j === 4)
16987
+ line.push([segment[0], segment[1], segment[2], segment[3]]);
16988
+ else if (j === 5)
16989
+ line.push([segment[0], segment[1], segment[2], segment[3], segment[4]]);
16990
+ else if (j === 1)
16991
+ line.push([segment[0]]);
16992
+ }
16993
+
16897
16994
  function decodedSourcemap(map) {
16898
16995
  if (!map)
16899
16996
  return null;
@@ -22797,7 +22894,7 @@ pp.readWord = function() {
22797
22894
 
22798
22895
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
22799
22896
 
22800
- var version = "8.8.0";
22897
+ var version = "8.8.1";
22801
22898
 
22802
22899
  Parser.acorn = {
22803
22900
  Parser: Parser,
@@ -22956,13 +23053,13 @@ async function addJsExtensionIfNecessary(file, preserveSymlinks) {
22956
23053
  }
22957
23054
  async function findFile(file, preserveSymlinks) {
22958
23055
  try {
22959
- const stats = await node_fs.promises.lstat(file);
23056
+ const stats = await promises.lstat(file);
22960
23057
  if (!preserveSymlinks && stats.isSymbolicLink())
22961
- return await findFile(await node_fs.promises.realpath(file), preserveSymlinks);
23058
+ return await findFile(await promises.realpath(file), preserveSymlinks);
22962
23059
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
22963
23060
  // check case
22964
23061
  const name = node_path.basename(file);
22965
- const files = await node_fs.promises.readdir(node_path.dirname(file));
23062
+ const files = await promises.readdir(node_path.dirname(file));
22966
23063
  if (files.includes(name))
22967
23064
  return file;
22968
23065
  }
@@ -23207,15 +23304,15 @@ class ModuleLoader {
23207
23304
  entryModule.isUserDefinedEntryPoint || isUserDefined;
23208
23305
  addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined, firstChunkNamePriority + index);
23209
23306
  const existingIndexedModule = this.indexedEntryModules.find(indexedModule => indexedModule.module === entryModule);
23210
- if (!existingIndexedModule) {
23307
+ if (existingIndexedModule) {
23308
+ existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
23309
+ }
23310
+ else {
23211
23311
  this.indexedEntryModules.push({
23212
23312
  index: firstEntryModuleIndex + index,
23213
23313
  module: entryModule
23214
23314
  });
23215
23315
  }
23216
- else {
23217
- existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
23218
- }
23219
23316
  }
23220
23317
  this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
23221
23318
  return entryModules;
@@ -23266,7 +23363,7 @@ class ModuleLoader {
23266
23363
  async addModuleSource(id, importer, module) {
23267
23364
  let source;
23268
23365
  try {
23269
- source = await this.graph.fileOperationQueue.run(async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await node_fs.promises.readFile(id, 'utf8')));
23366
+ source = await this.graph.fileOperationQueue.run(async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await promises.readFile(id, 'utf8')));
23270
23367
  }
23271
23368
  catch (error_) {
23272
23369
  let message = `Could not load ${id}`;
@@ -23731,8 +23828,11 @@ class FileEmitter {
23731
23828
  this.facadeChunkByModule = facadeChunkByModule;
23732
23829
  };
23733
23830
  this.setOutputBundle = (bundle, outputOptions) => {
23734
- const fileNamesBySource = new Map();
23735
- const output = (this.output = { bundle, fileNamesBySource, outputOptions });
23831
+ const output = (this.output = {
23832
+ bundle,
23833
+ fileNamesBySource: new Map(),
23834
+ outputOptions
23835
+ });
23736
23836
  for (const emittedFile of this.filesByReferenceId.values()) {
23737
23837
  if (emittedFile.fileName) {
23738
23838
  reserveFileNameInBundle(emittedFile.fileName, output, this.options.onwarn);
@@ -23753,12 +23853,9 @@ class FileEmitter {
23753
23853
  this.outputFileEmitters.push(outputFileEmitter);
23754
23854
  }
23755
23855
  assignReferenceId(file, idBase) {
23756
- let referenceId;
23856
+ let referenceId = idBase;
23757
23857
  do {
23758
- referenceId = createHash()
23759
- .update(referenceId || idBase)
23760
- .digest('hex')
23761
- .slice(0, 8);
23858
+ referenceId = createHash().update(referenceId).digest('hex').slice(0, 8);
23762
23859
  } while (this.filesByReferenceId.has(referenceId) ||
23763
23860
  this.outputFileEmitters.some(({ filesByReferenceId }) => filesByReferenceId.has(referenceId)));
23764
23861
  this.filesByReferenceId.set(referenceId, file);
@@ -23768,9 +23865,9 @@ class FileEmitter {
23768
23865
  return referenceId;
23769
23866
  }
23770
23867
  emitAsset(emittedAsset) {
23771
- const source = typeof emittedAsset.source !== 'undefined'
23772
- ? getValidSource(emittedAsset.source, emittedAsset, null)
23773
- : undefined;
23868
+ const source = emittedAsset.source === undefined
23869
+ ? undefined
23870
+ : getValidSource(emittedAsset.source, emittedAsset, null);
23774
23871
  const consumedAsset = {
23775
23872
  fileName: emittedAsset.fileName,
23776
23873
  name: emittedAsset.name,
@@ -24896,7 +24993,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
24896
24993
  return (_id, external) => !external;
24897
24994
  }
24898
24995
  if (typeof moduleSideEffectsOption === 'function') {
24899
- return (id, external) => !id.startsWith('\0') ? moduleSideEffectsOption(id, external) !== false : true;
24996
+ return (id, external) => id.startsWith('\0') ? true : moduleSideEffectsOption(id, external) !== false;
24900
24997
  }
24901
24998
  if (Array.isArray(moduleSideEffectsOption)) {
24902
24999
  const ids = new Set(moduleSideEffectsOption);
@@ -25360,8 +25457,8 @@ function getSortingFileType(file) {
25360
25457
  async function writeOutputFile(outputFile, outputOptions) {
25361
25458
  const fileName = node_path.resolve(outputOptions.dir || node_path.dirname(outputOptions.file), outputFile.fileName);
25362
25459
  // 'recursive: true' does not throw if the folder structure, or parts of it, already exist
25363
- await node_fs.promises.mkdir(node_path.dirname(fileName), { recursive: true });
25364
- return node_fs.promises.writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
25460
+ await promises.mkdir(node_path.dirname(fileName), { recursive: true });
25461
+ return promises.writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
25365
25462
  }
25366
25463
  /**
25367
25464
  * Auxiliary function for defining rollup configuration
@@ -25470,7 +25567,6 @@ exports.isWatchEnabled = isWatchEnabled;
25470
25567
  exports.loadFsEvents = loadFsEvents;
25471
25568
  exports.mergeOptions = mergeOptions;
25472
25569
  exports.normalizePluginOption = normalizePluginOption;
25473
- exports.picomatch = picomatch$1;
25474
25570
  exports.printQuotedStringList = printQuotedStringList;
25475
25571
  exports.relativeId = relativeId;
25476
25572
  exports.rollup = rollup;