@rollup/wasm-node 4.14.0 → 4.14.2

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 v4.14.0
4
- Wed, 03 Apr 2024 05:22:15 GMT - commit 5abe71bd5bae3423b4e2ee80207c871efde20253
3
+ Rollup.js v4.14.2
4
+ Fri, 12 Apr 2024 06:23:07 GMT - commit 7275328b41b29605142bfdf55d68cb54e895a20c
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -12,7 +12,7 @@
12
12
  const parseAst_js = require('./parseAst.js');
13
13
  const process$1 = require('node:process');
14
14
  const tty = require('tty');
15
- const node_path = require('node:path');
15
+ const path$2 = require('node:path');
16
16
  const require$$0$1 = require('path');
17
17
  const native_js = require('../native.js');
18
18
  const node_perf_hooks = require('node:perf_hooks');
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
31
31
 
32
32
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
33
33
 
34
- var version = "4.14.0";
34
+ var version = "4.14.2";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -195,7 +195,7 @@ function renderNamePattern(pattern, patternName, replacements) {
195
195
  function makeUnique(name, { [lowercaseBundleKeys]: reservedLowercaseBundleKeys }) {
196
196
  if (!reservedLowercaseBundleKeys.has(name.toLowerCase()))
197
197
  return name;
198
- const extension = node_path.extname(name);
198
+ const extension = path$2.extname(name);
199
199
  name = name.slice(0, Math.max(0, name.length - extension.length));
200
200
  let uniqueName, uniqueIndex = 1;
201
201
  while (reservedLowercaseBundleKeys.has((uniqueName = name + ++uniqueIndex + extension).toLowerCase()))
@@ -208,10 +208,10 @@ function generateAssetFileName(name, source, sourceHash, outputOptions, bundle)
208
208
  return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
209
209
  ? outputOptions.assetFileNames({ name, source, type: 'asset' })
210
210
  : outputOptions.assetFileNames, 'output.assetFileNames', {
211
- ext: () => node_path.extname(emittedName).slice(1),
212
- extname: () => node_path.extname(emittedName),
211
+ ext: () => path$2.extname(emittedName).slice(1),
212
+ extname: () => path$2.extname(emittedName),
213
213
  hash: size => sourceHash.slice(0, Math.max(0, size || DEFAULT_HASH_SIZE)),
214
- name: () => emittedName.slice(0, Math.max(0, emittedName.length - node_path.extname(emittedName).length))
214
+ name: () => emittedName.slice(0, Math.max(0, emittedName.length - path$2.extname(emittedName).length))
215
215
  }), bundle);
216
216
  }
217
217
  function reserveFileNameInBundle(fileName, { bundle }, log) {
@@ -613,15 +613,6 @@ function getCacheForUncacheablePlugin(pluginName) {
613
613
  };
614
614
  }
615
615
 
616
- const BLANK = Object.freeze(Object.create(null));
617
- const EMPTY_OBJECT = Object.freeze({});
618
- const EMPTY_ARRAY = Object.freeze([]);
619
- const EMPTY_SET = Object.freeze(new (class extends Set {
620
- add() {
621
- throw new Error('Cannot add to empty set');
622
- }
623
- })());
624
-
625
616
  const doNothing = () => { };
626
617
 
627
618
  async function asyncFlatten(array) {
@@ -693,7 +684,7 @@ const treeshakePresets = {
693
684
  recommended: {
694
685
  annotations: true,
695
686
  correctVarValueBeforeDeclaration: false,
696
- manualPureFunctions: EMPTY_ARRAY,
687
+ manualPureFunctions: parseAst_js.EMPTY_ARRAY,
697
688
  moduleSideEffects: () => true,
698
689
  propertyReadSideEffects: true,
699
690
  tryCatchDeoptimization: true,
@@ -702,7 +693,7 @@ const treeshakePresets = {
702
693
  safest: {
703
694
  annotations: true,
704
695
  correctVarValueBeforeDeclaration: true,
705
- manualPureFunctions: EMPTY_ARRAY,
696
+ manualPureFunctions: parseAst_js.EMPTY_ARRAY,
706
697
  moduleSideEffects: () => true,
707
698
  propertyReadSideEffects: true,
708
699
  tryCatchDeoptimization: true,
@@ -711,7 +702,7 @@ const treeshakePresets = {
711
702
  smallest: {
712
703
  annotations: true,
713
704
  correctVarValueBeforeDeclaration: false,
714
- manualPureFunctions: EMPTY_ARRAY,
705
+ manualPureFunctions: parseAst_js.EMPTY_ARRAY,
715
706
  moduleSideEffects: () => false,
716
707
  propertyReadSideEffects: false,
717
708
  tryCatchDeoptimization: false,
@@ -825,9 +816,9 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
825
816
  watchMode: graph.watchMode
826
817
  },
827
818
  parse: parseAst_js.parseAst,
828
- resolve(source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) {
819
+ resolve(source, importer, { attributes, custom, isEntry, skipSelf } = parseAst_js.BLANK) {
829
820
  skipSelf ??= true;
830
- return graph.moduleLoader.resolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [{ importer, plugin, source }] : null);
821
+ return graph.moduleLoader.resolveId(source, importer, custom, isEntry, attributes || parseAst_js.EMPTY_OBJECT, skipSelf ? [{ importer, plugin, source }] : null);
831
822
  },
832
823
  setAssetSource: fileEmitter.setAssetSource,
833
824
  warn: getLogHandler(parseAst_js.LOGLEVEL_WARN, 'PLUGIN_WARNING', onLog, plugin.name, logLevel)
@@ -1088,7 +1079,7 @@ function noReturn() { }
1088
1079
  function getLogger(plugins, onLog, watchMode, logLevel) {
1089
1080
  plugins = getSortedValidatedPlugins('onLog', plugins);
1090
1081
  const minimalPriority = parseAst_js.logLevelPriority[logLevel];
1091
- const logger = (level, log, skipped = EMPTY_SET) => {
1082
+ const logger = (level, log, skipped = parseAst_js.EMPTY_SET) => {
1092
1083
  parseAst_js.augmentLogMessage(log);
1093
1084
  const logPriority = parseAst_js.logLevelPriority[level];
1094
1085
  if (logPriority < minimalPriority) {
@@ -2829,21 +2820,29 @@ class MagicString {
2829
2820
  if (searchValue.global) {
2830
2821
  const matches = matchAll(searchValue, this.original);
2831
2822
  matches.forEach((match) => {
2832
- if (match.index != null)
2823
+ if (match.index != null) {
2824
+ const replacement = getReplacement(match, this.original);
2825
+ if (replacement !== match[0]) {
2826
+ this.overwrite(
2827
+ match.index,
2828
+ match.index + match[0].length,
2829
+ replacement
2830
+ );
2831
+ }
2832
+ }
2833
+ });
2834
+ } else {
2835
+ const match = this.original.match(searchValue);
2836
+ if (match && match.index != null) {
2837
+ const replacement = getReplacement(match, this.original);
2838
+ if (replacement !== match[0]) {
2833
2839
  this.overwrite(
2834
2840
  match.index,
2835
2841
  match.index + match[0].length,
2836
- getReplacement(match, this.original),
2842
+ replacement
2837
2843
  );
2838
- });
2839
- } else {
2840
- const match = this.original.match(searchValue);
2841
- if (match && match.index != null)
2842
- this.overwrite(
2843
- match.index,
2844
- match.index + match[0].length,
2845
- getReplacement(match, this.original),
2846
- );
2844
+ }
2845
+ }
2847
2846
  }
2848
2847
  return this;
2849
2848
  }
@@ -2875,7 +2874,9 @@ class MagicString {
2875
2874
  index !== -1;
2876
2875
  index = original.indexOf(string, index + stringLength)
2877
2876
  ) {
2878
- this.overwrite(index, index + stringLength, replacement);
2877
+ const previous = original.slice(index, index + stringLength);
2878
+ if (previous !== replacement)
2879
+ this.overwrite(index, index + stringLength, replacement);
2879
2880
  }
2880
2881
 
2881
2882
  return this;
@@ -3217,7 +3218,7 @@ class ExternalChunk {
3217
3218
  const { paths } = this.options;
3218
3219
  return (this.fileName =
3219
3220
  (typeof paths === 'function' ? paths(this.id) : paths[this.id]) ||
3220
- (this.renormalizeRenderPath ? parseAst_js.normalize(node_path.relative(this.inputBase, this.id)) : this.id));
3221
+ (this.renormalizeRenderPath ? parseAst_js.normalize(path$2.relative(this.inputBase, this.id)) : this.id));
3221
3222
  }
3222
3223
  getImportAttributes(snippets) {
3223
3224
  return (this.importAttributes ||= formatAttributes(this.options.format === 'es' &&
@@ -3601,8 +3602,8 @@ class ExternalModule {
3601
3602
  ast: null,
3602
3603
  attributes,
3603
3604
  code: null,
3604
- dynamicallyImportedIdResolutions: EMPTY_ARRAY,
3605
- dynamicallyImportedIds: EMPTY_ARRAY,
3605
+ dynamicallyImportedIdResolutions: parseAst_js.EMPTY_ARRAY,
3606
+ dynamicallyImportedIds: parseAst_js.EMPTY_ARRAY,
3606
3607
  get dynamicImporters() {
3607
3608
  return dynamicImporters.sort();
3608
3609
  },
@@ -3610,10 +3611,10 @@ class ExternalModule {
3610
3611
  exports: null,
3611
3612
  hasDefaultExport: null,
3612
3613
  id,
3613
- implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
3614
- implicitlyLoadedBefore: EMPTY_ARRAY,
3615
- importedIdResolutions: EMPTY_ARRAY,
3616
- importedIds: EMPTY_ARRAY,
3614
+ implicitlyLoadedAfterOneOf: parseAst_js.EMPTY_ARRAY,
3615
+ implicitlyLoadedBefore: parseAst_js.EMPTY_ARRAY,
3616
+ importedIdResolutions: parseAst_js.EMPTY_ARRAY,
3617
+ importedIds: parseAst_js.EMPTY_ARRAY,
3617
3618
  get importers() {
3618
3619
  return importers.sort();
3619
3620
  },
@@ -6092,7 +6093,7 @@ function getMemberReturnExpressionWhenCalled(members, memberName) {
6092
6093
  return [members[memberName].returns, false];
6093
6094
  }
6094
6095
 
6095
- // This file is generated by scripts/generate-ast-converters.js.
6096
+ // This file is generated by scripts/generate-child-node-keys.js.
6096
6097
  // Do not edit this file directly.
6097
6098
  const childNodeKeys = {
6098
6099
  ArrayExpression: ['elements'],
@@ -7147,7 +7148,7 @@ class LocalVariable extends Variable {
7147
7148
  if (path.length === 0) {
7148
7149
  this.isReassigned = true;
7149
7150
  const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
7150
- this.expressionsToBeDeoptimized = EMPTY_ARRAY;
7151
+ this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
7151
7152
  for (const expression of expressionsToBeDeoptimized) {
7152
7153
  expression.deoptimizeCache();
7153
7154
  }
@@ -7246,7 +7247,7 @@ class LocalVariable extends Variable {
7246
7247
  }
7247
7248
 
7248
7249
  const MAX_TRACKED_INTERACTIONS = 20;
7249
- const NO_INTERACTIONS = EMPTY_ARRAY;
7250
+ const NO_INTERACTIONS = parseAst_js.EMPTY_ARRAY;
7250
7251
  const UNKNOWN_DEOPTIMIZED_FIELD = new Set([UnknownKey]);
7251
7252
  const EMPTY_PATH_TRACKER = new PathTracker();
7252
7253
  const UNKNOWN_DEOPTIMIZED_ENTITY = new Set([UNKNOWN_EXPRESSION]);
@@ -8883,7 +8884,7 @@ class Identifier extends NodeBase {
8883
8884
  markDeclarationReached() {
8884
8885
  this.variable.initReached = true;
8885
8886
  }
8886
- render(code, { snippets: { getPropertyAccess }, useOriginalName }, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
8887
+ render(code, { snippets: { getPropertyAccess }, useOriginalName }, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = parseAst_js.BLANK) {
8887
8888
  if (this.variable) {
8888
8889
  const name = this.variable.getName(getPropertyAccess, useOriginalName);
8889
8890
  if (name !== this.name) {
@@ -9364,15 +9365,12 @@ class FunctionBase extends NodeBase {
9364
9365
  }
9365
9366
  parseNode(esTreeNode) {
9366
9367
  const { body, params } = esTreeNode;
9367
- const parameters = (this.params = []);
9368
9368
  const { scope } = this;
9369
9369
  const { bodyScope, context } = scope;
9370
9370
  // We need to ensure that parameters are declared before the body is parsed
9371
9371
  // so that the scope already knows all parameters and can detect conflicts
9372
9372
  // when parsing the body.
9373
- for (const parameter of params) {
9374
- parameters.push(new (context.getNodeConstructor(parameter.type))(this, scope).parseNode(parameter));
9375
- }
9373
+ const parameters = (this.params = params.map((parameter) => new (context.getNodeConstructor(parameter.type))(this, scope).parseNode(parameter)));
9376
9374
  scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
9377
9375
  this.body = new (context.getNodeConstructor(body.type))(this, bodyScope).parseNode(body);
9378
9376
  return super.parseNode(esTreeNode);
@@ -9560,7 +9558,7 @@ class AssignmentExpression extends NodeBase {
9560
9558
  }
9561
9559
  this.left.setAssignedValue(this.right);
9562
9560
  }
9563
- render(code, options, { preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
9561
+ render(code, options, { preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
9564
9562
  const { left, right, start, end, parent } = this;
9565
9563
  if (left.included) {
9566
9564
  left.render(code, options);
@@ -9632,7 +9630,7 @@ class AssignmentPattern extends NodeBase {
9632
9630
  markDeclarationReached() {
9633
9631
  this.left.markDeclarationReached();
9634
9632
  }
9635
- render(code, options, { isShorthandProperty } = BLANK) {
9633
+ render(code, options, { isShorthandProperty } = parseAst_js.BLANK) {
9636
9634
  this.left.render(code, options, { isShorthandProperty });
9637
9635
  this.right.render(code, options);
9638
9636
  }
@@ -9869,7 +9867,7 @@ class BinaryExpression extends NodeBase {
9869
9867
  removeAnnotations(code) {
9870
9868
  this.left.removeAnnotations(code);
9871
9869
  }
9872
- render(code, options, { renderedSurroundingElement } = BLANK) {
9870
+ render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
9873
9871
  this.left.render(code, options, { renderedSurroundingElement });
9874
9872
  this.right.render(code, options);
9875
9873
  }
@@ -10090,7 +10088,7 @@ class MemberExpression extends NodeBase {
10090
10088
  }
10091
10089
  deoptimizeCache() {
10092
10090
  const { expressionsToBeDeoptimized, object } = this;
10093
- this.expressionsToBeDeoptimized = EMPTY_ARRAY;
10091
+ this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
10094
10092
  this.propertyKey = UnknownKey;
10095
10093
  object.deoptimizePath(UNKNOWN_PATH);
10096
10094
  for (const expression of expressionsToBeDeoptimized) {
@@ -10201,7 +10199,7 @@ class MemberExpression extends NodeBase {
10201
10199
  (this.optional &&
10202
10200
  this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
10203
10201
  }
10204
- render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
10202
+ render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = parseAst_js.BLANK) {
10205
10203
  if (this.variable || this.isUndefined) {
10206
10204
  const { snippets: { getPropertyAccess } } = options;
10207
10205
  let replacement = this.variable ? this.variable.getName(getPropertyAccess) : 'undefined';
@@ -10347,8 +10345,8 @@ class CallExpressionBase extends NodeBase {
10347
10345
  if (this.returnExpression?.[0] !== UNKNOWN_EXPRESSION) {
10348
10346
  this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
10349
10347
  const { deoptimizableDependentExpressions, expressionsToBeDeoptimized } = this;
10350
- this.expressionsToBeDeoptimized = EMPTY_SET;
10351
- this.deoptimizableDependentExpressions = EMPTY_ARRAY;
10348
+ this.expressionsToBeDeoptimized = parseAst_js.EMPTY_SET;
10349
+ this.deoptimizableDependentExpressions = parseAst_js.EMPTY_ARRAY;
10352
10350
  for (const expression of deoptimizableDependentExpressions) {
10353
10351
  expression.deoptimizeCache();
10354
10352
  }
@@ -10482,7 +10480,7 @@ class CallExpression extends CallExpressionBase {
10482
10480
  (this.optional &&
10483
10481
  this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
10484
10482
  }
10485
- render(code, options, { renderedSurroundingElement } = BLANK) {
10483
+ render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
10486
10484
  this.callee.render(code, options, {
10487
10485
  isCalleeOfRenderedParent: true,
10488
10486
  renderedSurroundingElement
@@ -10837,7 +10835,7 @@ class ClassDeclaration extends ClassNode {
10837
10835
  }
10838
10836
 
10839
10837
  class ClassExpression extends ClassNode {
10840
- render(code, options, { renderedSurroundingElement } = BLANK) {
10838
+ render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
10841
10839
  super.render(code, options);
10842
10840
  if (renderedSurroundingElement === parseAst_js.ExpressionStatement) {
10843
10841
  code.appendRight(this.start, '(');
@@ -10893,7 +10891,7 @@ class ConditionalExpression extends NodeBase {
10893
10891
  this.usedBranch = null;
10894
10892
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
10895
10893
  const { expressionsToBeDeoptimized } = this;
10896
- this.expressionsToBeDeoptimized = EMPTY_ARRAY;
10894
+ this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
10897
10895
  for (const expression of expressionsToBeDeoptimized) {
10898
10896
  expression.deoptimizeCache();
10899
10897
  }
@@ -10971,7 +10969,7 @@ class ConditionalExpression extends NodeBase {
10971
10969
  removeAnnotations(code) {
10972
10970
  this.test.removeAnnotations(code);
10973
10971
  }
10974
- render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
10972
+ render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
10975
10973
  const usedBranch = this.getUsedBranch();
10976
10974
  if (this.test.included) {
10977
10975
  this.test.render(code, options, { renderedSurroundingElement });
@@ -11373,7 +11371,7 @@ class FunctionExpression extends FunctionNode {
11373
11371
  }
11374
11372
  return super.parseNode(esTreeNode);
11375
11373
  }
11376
- render(code, options, { renderedSurroundingElement } = BLANK) {
11374
+ render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
11377
11375
  super.render(code, options);
11378
11376
  if (renderedSurroundingElement === parseAst_js.ExpressionStatement) {
11379
11377
  code.appendRight(this.start, '(');
@@ -11840,7 +11838,7 @@ class VariableDeclarator extends NodeBase {
11840
11838
  code.appendLeft(init.start + 5, ` ${id.name}`);
11841
11839
  }
11842
11840
  }
11843
- init.render(code, options, renderId ? BLANK : { renderedSurroundingElement: parseAst_js.ExpressionStatement });
11841
+ init.render(code, options, renderId ? parseAst_js.BLANK : { renderedSurroundingElement: parseAst_js.ExpressionStatement });
11844
11842
  }
11845
11843
  else if (id instanceof Identifier &&
11846
11844
  isReassignedExportsMember(id.variable, exportNamesByVariable)) {
@@ -11889,13 +11887,13 @@ class ImportExpression extends NodeBase {
11889
11887
  const parent1 = this.parent;
11890
11888
  // Side-effect only: import('bar')
11891
11889
  if (parent1 instanceof ExpressionStatement) {
11892
- return EMPTY_ARRAY;
11890
+ return parseAst_js.EMPTY_ARRAY;
11893
11891
  }
11894
11892
  if (parent1 instanceof AwaitExpression) {
11895
11893
  const parent2 = parent1.parent;
11896
11894
  // Side-effect only: await import('bar')
11897
11895
  if (parent2 instanceof ExpressionStatement) {
11898
- return EMPTY_ARRAY;
11896
+ return parseAst_js.EMPTY_ARRAY;
11899
11897
  }
11900
11898
  // Case 1: const { foo } = await import('bar')
11901
11899
  if (parent2 instanceof VariableDeclarator) {
@@ -11924,13 +11922,13 @@ class ImportExpression extends NodeBase {
11924
11922
  // side-effect only, when only chaining .catch or .finally
11925
11923
  if (callExpression.parent instanceof ExpressionStatement &&
11926
11924
  ['catch', 'finally'].includes(memberName)) {
11927
- return EMPTY_ARRAY;
11925
+ return parseAst_js.EMPTY_ARRAY;
11928
11926
  }
11929
11927
  if (memberName !== 'then')
11930
11928
  return;
11931
11929
  // Side-effect only: import('bar').then()
11932
11930
  if (callExpression.arguments.length === 0) {
11933
- return EMPTY_ARRAY;
11931
+ return parseAst_js.EMPTY_ARRAY;
11934
11932
  }
11935
11933
  const argument = callExpression.arguments[0];
11936
11934
  if (callExpression.arguments.length !== 1 ||
@@ -11939,7 +11937,7 @@ class ImportExpression extends NodeBase {
11939
11937
  }
11940
11938
  // Side-effect only: import('bar').then(() => {})
11941
11939
  if (argument.params.length === 0) {
11942
- return EMPTY_ARRAY;
11940
+ return parseAst_js.EMPTY_ARRAY;
11943
11941
  }
11944
11942
  const declaration = argument.params[0];
11945
11943
  if (argument.params.length === 1 && declaration instanceof ObjectPattern) {
@@ -12213,7 +12211,7 @@ class LogicalExpression extends NodeBase {
12213
12211
  this.usedBranch = null;
12214
12212
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
12215
12213
  const { scope: { context }, expressionsToBeDeoptimized } = this;
12216
- this.expressionsToBeDeoptimized = EMPTY_ARRAY;
12214
+ this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
12217
12215
  for (const expression of expressionsToBeDeoptimized) {
12218
12216
  expression.deoptimizeCache();
12219
12217
  }
@@ -12285,7 +12283,7 @@ class LogicalExpression extends NodeBase {
12285
12283
  removeAnnotations(code) {
12286
12284
  this.left.removeAnnotations(code);
12287
12285
  }
12288
- render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
12286
+ render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
12289
12287
  if (!this.left.included || !this.right.included) {
12290
12288
  const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
12291
12289
  if (this.right.included) {
@@ -12381,7 +12379,7 @@ class MetaProperty extends NodeBase {
12381
12379
  const chunkId = preliminaryChunkId;
12382
12380
  if (referenceId) {
12383
12381
  const fileName = pluginDriver.getFileName(referenceId);
12384
- const relativePath = parseAst_js.normalize(node_path.relative(node_path.dirname(chunkId), fileName));
12382
+ const relativePath = parseAst_js.normalize(path$2.relative(path$2.dirname(chunkId), fileName));
12385
12383
  const replacement = pluginDriver.hookFirstSync('resolveFileUrl', [
12386
12384
  { chunkId, fileName, format, moduleId, referenceId, relativePath }
12387
12385
  ]) || relativeUrlMechanisms[format](relativePath);
@@ -12543,7 +12541,7 @@ class ObjectExpression extends NodeBase {
12543
12541
  hasEffectsOnInteractionAtPath(path, interaction, context) {
12544
12542
  return this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
12545
12543
  }
12546
- render(code, options, { renderedSurroundingElement } = BLANK) {
12544
+ render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
12547
12545
  super.render(code, options);
12548
12546
  if (renderedSurroundingElement === parseAst_js.ExpressionStatement ||
12549
12547
  renderedSurroundingElement === parseAst_js.ArrowFunctionExpression) {
@@ -12828,7 +12826,7 @@ class SequenceExpression extends NodeBase {
12828
12826
  removeAnnotations(code) {
12829
12827
  this.expressions[0].removeAnnotations(code);
12830
12828
  }
12831
- render(code, options, { renderedParentType, isCalleeOfRenderedParent, preventASI } = BLANK) {
12829
+ render(code, options, { renderedParentType, isCalleeOfRenderedParent, preventASI } = parseAst_js.BLANK) {
12832
12830
  let includedNodes = 0;
12833
12831
  let lastSeparatorPos = null;
12834
12832
  const lastNode = this.expressions[this.expressions.length - 1];
@@ -13483,7 +13481,7 @@ class VariableDeclaration extends NodeBase {
13483
13481
  hasEffectsOnInteractionAtPath() {
13484
13482
  return false;
13485
13483
  }
13486
- include(context, includeChildrenRecursively, { asSingleStatement } = BLANK) {
13484
+ include(context, includeChildrenRecursively, { asSingleStatement } = parseAst_js.BLANK) {
13487
13485
  this.included = true;
13488
13486
  for (const declarator of this.declarations) {
13489
13487
  if (includeChildrenRecursively || declarator.shouldBeIncluded(context))
@@ -13510,7 +13508,7 @@ class VariableDeclaration extends NodeBase {
13510
13508
  removeAnnotations(code) {
13511
13509
  this.declarations[0].removeAnnotations(code);
13512
13510
  }
13513
- render(code, options, nodeRenderOptions = BLANK) {
13511
+ render(code, options, nodeRenderOptions = parseAst_js.BLANK) {
13514
13512
  if (this.isUsingDeclaration ||
13515
13513
  areAllDeclarationsIncludedAndNotExported(this.declarations, options.exportNamesByVariable)) {
13516
13514
  for (const declarator of this.declarations) {
@@ -13669,7 +13667,7 @@ class YieldExpression extends NodeBase {
13669
13667
  }
13670
13668
  }
13671
13669
 
13672
- // This file is generated by scripts/generate-ast-converters.js.
13670
+ // This file is generated by scripts/generate-buffer-parsers.js.
13673
13671
  // Do not edit this file directly.
13674
13672
  function convertProgram(buffer, parent, parentScope) {
13675
13673
  return convertNode(parent, parentScope, 0, new Uint32Array(buffer.buffer), parseAst_js.getReadStringFunction(buffer));
@@ -13838,18 +13836,18 @@ const nodeConstructors$1 = [
13838
13836
  ];
13839
13837
  const bufferParsers = [
13840
13838
  function panicError(node, position, buffer, readString) {
13841
- node.message = parseAst_js.convertString(position, buffer, readString);
13839
+ node.message = parseAst_js.convertString(buffer[position], buffer, readString);
13842
13840
  },
13843
13841
  function parseError(node, position, buffer, readString) {
13844
- node.message = parseAst_js.convertString(position, buffer, readString);
13842
+ node.message = parseAst_js.convertString(buffer[position], buffer, readString);
13845
13843
  },
13846
13844
  function arrayExpression(node, position, buffer, readString) {
13847
13845
  const { scope } = node;
13848
- node.elements = convertNodeList(node, scope, position, buffer, readString);
13846
+ node.elements = convertNodeList(node, scope, buffer[position], buffer, readString);
13849
13847
  },
13850
13848
  function arrayPattern(node, position, buffer, readString) {
13851
13849
  const { scope } = node;
13852
- node.elements = convertNodeList(node, scope, position, buffer, readString);
13850
+ node.elements = convertNodeList(node, scope, buffer[position], buffer, readString);
13853
13851
  },
13854
13852
  function arrowFunctionExpression(node, position, buffer, readString) {
13855
13853
  const { scope } = node;
@@ -13857,36 +13855,36 @@ const bufferParsers = [
13857
13855
  node.async = (flags & 1) === 1;
13858
13856
  node.expression = (flags & 2) === 2;
13859
13857
  node.generator = (flags & 4) === 4;
13860
- const parameters = (node.params = convertNodeList(node, scope, buffer[position + 1], buffer, readString));
13861
- scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
13862
- node.body = convertNode(node, scope.bodyScope, buffer[position + 2], buffer, readString);
13863
- const annotations = (node.annotations = parseAst_js.convertAnnotations(position + 3, buffer));
13858
+ const annotations = (node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer));
13864
13859
  node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
13860
+ const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer, readString));
13861
+ scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
13862
+ node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer, readString);
13865
13863
  },
13866
13864
  function assignmentExpression(node, position, buffer, readString) {
13867
13865
  const { scope } = node;
13868
13866
  node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
13869
- node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
13870
- node.left = convertNode(node, scope, position + 2, buffer, readString);
13867
+ node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
13868
+ node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
13871
13869
  },
13872
13870
  function assignmentPattern(node, position, buffer, readString) {
13873
13871
  const { scope } = node;
13874
- node.right = convertNode(node, scope, buffer[position], buffer, readString);
13875
- node.left = convertNode(node, scope, position + 1, buffer, readString);
13872
+ node.left = convertNode(node, scope, buffer[position], buffer, readString);
13873
+ node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
13876
13874
  },
13877
13875
  function awaitExpression(node, position, buffer, readString) {
13878
13876
  const { scope } = node;
13879
- node.argument = convertNode(node, scope, position, buffer, readString);
13877
+ node.argument = convertNode(node, scope, buffer[position], buffer, readString);
13880
13878
  },
13881
13879
  function binaryExpression(node, position, buffer, readString) {
13882
13880
  const { scope } = node;
13883
13881
  node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
13884
- node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
13885
- node.left = convertNode(node, scope, position + 2, buffer, readString);
13882
+ node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
13883
+ node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
13886
13884
  },
13887
13885
  function blockStatement(node, position, buffer, readString) {
13888
13886
  const { scope } = node;
13889
- node.body = convertNodeList(node, scope, position, buffer, readString);
13887
+ node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
13890
13888
  },
13891
13889
  function breakStatement(node, position, buffer, readString) {
13892
13890
  const { scope } = node;
@@ -13898,9 +13896,9 @@ const bufferParsers = [
13898
13896
  const { scope } = node;
13899
13897
  const flags = buffer[position];
13900
13898
  node.optional = (flags & 1) === 1;
13901
- node.callee = convertNode(node, scope, buffer[position + 1], buffer, readString);
13902
- node.arguments = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
13903
- node.annotations = parseAst_js.convertAnnotations(position + 3, buffer);
13899
+ node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer);
13900
+ node.callee = convertNode(node, scope, buffer[position + 2], buffer, readString);
13901
+ node.arguments = convertNodeList(node, scope, buffer[position + 3], buffer, readString);
13904
13902
  },
13905
13903
  function catchClause(node, position, buffer, readString) {
13906
13904
  const { scope } = node;
@@ -13914,15 +13912,18 @@ const bufferParsers = [
13914
13912
  },
13915
13913
  function chainExpression(node, position, buffer, readString) {
13916
13914
  const { scope } = node;
13917
- node.expression = convertNode(node, scope, position, buffer, readString);
13915
+ node.expression = convertNode(node, scope, buffer[position], buffer, readString);
13918
13916
  },
13919
13917
  function classBody(node, position, buffer, readString) {
13920
13918
  const { scope } = node;
13921
- const length = buffer[position];
13919
+ const bodyPosition = buffer[position];
13922
13920
  const body = (node.body = []);
13923
- for (let index = 0; index < length; index++) {
13924
- const nodePosition = buffer[position + 1 + index];
13925
- body.push(convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer, readString));
13921
+ if (bodyPosition) {
13922
+ const length = buffer[bodyPosition];
13923
+ for (let index = 0; index < length; index++) {
13924
+ const nodePosition = buffer[bodyPosition + 1 + index];
13925
+ body.push(convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer, readString));
13926
+ }
13926
13927
  }
13927
13928
  },
13928
13929
  function classDeclaration(node, position, buffer, readString) {
@@ -13952,9 +13953,9 @@ const bufferParsers = [
13952
13953
  },
13953
13954
  function conditionalExpression(node, position, buffer, readString) {
13954
13955
  const { scope } = node;
13955
- node.consequent = convertNode(node, scope, buffer[position], buffer, readString);
13956
- node.alternate = convertNode(node, scope, buffer[position + 1], buffer, readString);
13957
- node.test = convertNode(node, scope, position + 2, buffer, readString);
13956
+ node.test = convertNode(node, scope, buffer[position], buffer, readString);
13957
+ node.consequent = convertNode(node, scope, buffer[position + 1], buffer, readString);
13958
+ node.alternate = convertNode(node, scope, buffer[position + 2], buffer, readString);
13958
13959
  },
13959
13960
  function continueStatement(node, position, buffer, readString) {
13960
13961
  const { scope } = node;
@@ -13965,13 +13966,13 @@ const bufferParsers = [
13965
13966
  function debuggerStatement() { },
13966
13967
  function directive(node, position, buffer, readString) {
13967
13968
  const { scope } = node;
13968
- node.expression = convertNode(node, scope, buffer[position], buffer, readString);
13969
- node.directive = parseAst_js.convertString(position + 1, buffer, readString);
13969
+ node.directive = parseAst_js.convertString(buffer[position], buffer, readString);
13970
+ node.expression = convertNode(node, scope, buffer[position + 1], buffer, readString);
13970
13971
  },
13971
13972
  function doWhileStatement(node, position, buffer, readString) {
13972
13973
  const { scope } = node;
13973
- node.test = convertNode(node, scope, buffer[position], buffer, readString);
13974
- node.body = convertNode(node, scope, position + 1, buffer, readString);
13974
+ node.body = convertNode(node, scope, buffer[position], buffer, readString);
13975
+ node.test = convertNode(node, scope, buffer[position + 1], buffer, readString);
13975
13976
  },
13976
13977
  function emptyStatement() { },
13977
13978
  function exportAllDeclaration(node, position, buffer, readString) {
@@ -13986,25 +13987,25 @@ const bufferParsers = [
13986
13987
  },
13987
13988
  function exportDefaultDeclaration(node, position, buffer, readString) {
13988
13989
  const { scope } = node;
13989
- node.declaration = convertNode(node, scope, position, buffer, readString);
13990
+ node.declaration = convertNode(node, scope, buffer[position], buffer, readString);
13990
13991
  },
13991
13992
  function exportNamedDeclaration(node, position, buffer, readString) {
13992
13993
  const { scope } = node;
13993
- const sourcePosition = buffer[position];
13994
+ node.specifiers = convertNodeList(node, scope, buffer[position], buffer, readString);
13995
+ const sourcePosition = buffer[position + 1];
13994
13996
  node.source =
13995
13997
  sourcePosition === 0 ? null : convertNode(node, scope, sourcePosition, buffer, readString);
13996
- node.attributes = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
13997
- const declarationPosition = buffer[position + 2];
13998
+ node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
13999
+ const declarationPosition = buffer[position + 3];
13998
14000
  node.declaration =
13999
14001
  declarationPosition === 0
14000
14002
  ? null
14001
14003
  : convertNode(node, scope, declarationPosition, buffer, readString);
14002
- node.specifiers = convertNodeList(node, scope, position + 3, buffer, readString);
14003
14004
  },
14004
14005
  function exportSpecifier(node, position, buffer, readString) {
14005
14006
  const { scope } = node;
14006
- const exportedPosition = buffer[position];
14007
- node.local = convertNode(node, scope, position + 1, buffer, readString);
14007
+ node.local = convertNode(node, scope, buffer[position], buffer, readString);
14008
+ const exportedPosition = buffer[position + 1];
14008
14009
  node.exported =
14009
14010
  exportedPosition === 0
14010
14011
  ? node.local
@@ -14012,21 +14013,21 @@ const bufferParsers = [
14012
14013
  },
14013
14014
  function expressionStatement(node, position, buffer, readString) {
14014
14015
  const { scope } = node;
14015
- node.expression = convertNode(node, scope, position, buffer, readString);
14016
+ node.expression = convertNode(node, scope, buffer[position], buffer, readString);
14016
14017
  },
14017
14018
  function forInStatement(node, position, buffer, readString) {
14018
14019
  const { scope } = node;
14019
- node.right = convertNode(node, scope, buffer[position], buffer, readString);
14020
- node.body = convertNode(node, scope, buffer[position + 1], buffer, readString);
14021
- node.left = convertNode(node, scope, position + 2, buffer, readString);
14020
+ node.left = convertNode(node, scope, buffer[position], buffer, readString);
14021
+ node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
14022
+ node.body = convertNode(node, scope, buffer[position + 2], buffer, readString);
14022
14023
  },
14023
14024
  function forOfStatement(node, position, buffer, readString) {
14024
14025
  const { scope } = node;
14025
14026
  const flags = buffer[position];
14026
14027
  node.await = (flags & 1) === 1;
14027
- node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
14028
- node.body = convertNode(node, scope, buffer[position + 2], buffer, readString);
14029
- node.left = convertNode(node, scope, position + 3, buffer, readString);
14028
+ node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
14029
+ node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
14030
+ node.body = convertNode(node, scope, buffer[position + 3], buffer, readString);
14030
14031
  },
14031
14032
  function forStatement(node, position, buffer, readString) {
14032
14033
  const { scope } = node;
@@ -14046,70 +14047,70 @@ const bufferParsers = [
14046
14047
  const flags = buffer[position];
14047
14048
  node.async = (flags & 1) === 1;
14048
14049
  node.generator = (flags & 2) === 2;
14049
- const idPosition = buffer[position + 1];
14050
+ const annotations = (node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer));
14051
+ node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
14052
+ const idPosition = buffer[position + 2];
14050
14053
  node.id =
14051
14054
  idPosition === 0
14052
14055
  ? null
14053
14056
  : convertNode(node, scope.parent, idPosition, buffer, readString);
14054
- const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer, readString));
14057
+ const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
14055
14058
  scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
14056
- node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer, readString);
14057
- const annotations = (node.annotations = parseAst_js.convertAnnotations(position + 4, buffer));
14058
- node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
14059
+ node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer, readString);
14059
14060
  },
14060
14061
  function functionExpression(node, position, buffer, readString) {
14061
14062
  const { scope } = node;
14062
14063
  const flags = buffer[position];
14063
14064
  node.async = (flags & 1) === 1;
14064
14065
  node.generator = (flags & 2) === 2;
14065
- const idPosition = buffer[position + 1];
14066
+ const annotations = (node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer));
14067
+ node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
14068
+ const idPosition = buffer[position + 2];
14066
14069
  node.id =
14067
14070
  idPosition === 0 ? null : convertNode(node, node.idScope, idPosition, buffer, readString);
14068
- const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer, readString));
14071
+ const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
14069
14072
  scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
14070
- node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer, readString);
14071
- const annotations = (node.annotations = parseAst_js.convertAnnotations(position + 4, buffer));
14072
- node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
14073
+ node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer, readString);
14073
14074
  },
14074
14075
  function identifier(node, position, buffer, readString) {
14075
- node.name = parseAst_js.convertString(position, buffer, readString);
14076
+ node.name = parseAst_js.convertString(buffer[position], buffer, readString);
14076
14077
  },
14077
14078
  function ifStatement(node, position, buffer, readString) {
14078
14079
  const { scope } = node;
14079
- node.consequent = convertNode(node, (node.consequentScope = new TrackingScope(scope)), buffer[position], buffer, readString);
14080
- const alternatePosition = buffer[position + 1];
14080
+ node.test = convertNode(node, scope, buffer[position], buffer, readString);
14081
+ node.consequent = convertNode(node, (node.consequentScope = new TrackingScope(scope)), buffer[position + 1], buffer, readString);
14082
+ const alternatePosition = buffer[position + 2];
14081
14083
  node.alternate =
14082
14084
  alternatePosition === 0
14083
14085
  ? null
14084
14086
  : convertNode(node, (node.alternateScope = new TrackingScope(scope)), alternatePosition, buffer, readString);
14085
- node.test = convertNode(node, scope, position + 2, buffer, readString);
14086
14087
  },
14087
14088
  function importAttribute(node, position, buffer, readString) {
14088
14089
  const { scope } = node;
14089
- node.value = convertNode(node, scope, buffer[position], buffer, readString);
14090
- node.key = convertNode(node, scope, position + 1, buffer, readString);
14090
+ node.key = convertNode(node, scope, buffer[position], buffer, readString);
14091
+ node.value = convertNode(node, scope, buffer[position + 1], buffer, readString);
14091
14092
  },
14092
14093
  function importDeclaration(node, position, buffer, readString) {
14093
14094
  const { scope } = node;
14094
- node.source = convertNode(node, scope, buffer[position], buffer, readString);
14095
- node.attributes = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
14096
- node.specifiers = convertNodeList(node, scope, position + 2, buffer, readString);
14095
+ node.specifiers = convertNodeList(node, scope, buffer[position], buffer, readString);
14096
+ node.source = convertNode(node, scope, buffer[position + 1], buffer, readString);
14097
+ node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
14097
14098
  },
14098
14099
  function importDefaultSpecifier(node, position, buffer, readString) {
14099
14100
  const { scope } = node;
14100
- node.local = convertNode(node, scope, position, buffer, readString);
14101
+ node.local = convertNode(node, scope, buffer[position], buffer, readString);
14101
14102
  },
14102
14103
  function importExpression(node, position, buffer, readString) {
14103
14104
  const { scope } = node;
14104
- const optionsPosition = buffer[position];
14105
+ node.source = convertNode(node, scope, buffer[position], buffer, readString);
14106
+ node.sourceAstNode = parseAst_js.convertNode(buffer[position], buffer, readString);
14107
+ const optionsPosition = buffer[position + 1];
14105
14108
  node.options =
14106
14109
  optionsPosition === 0 ? null : convertNode(node, scope, optionsPosition, buffer, readString);
14107
- node.source = convertNode(node, scope, position + 1, buffer, readString);
14108
- node.sourceAstNode = parseAst_js.convertNode(position + 1, buffer, readString);
14109
14110
  },
14110
14111
  function importNamespaceSpecifier(node, position, buffer, readString) {
14111
14112
  const { scope } = node;
14112
- node.local = convertNode(node, scope, position, buffer, readString);
14113
+ node.local = convertNode(node, scope, buffer[position], buffer, readString);
14113
14114
  },
14114
14115
  function importSpecifier(node, position, buffer, readString) {
14115
14116
  const { scope } = node;
@@ -14122,12 +14123,12 @@ const bufferParsers = [
14122
14123
  },
14123
14124
  function labeledStatement(node, position, buffer, readString) {
14124
14125
  const { scope } = node;
14125
- node.body = convertNode(node, scope, buffer[position], buffer, readString);
14126
- node.label = convertNode(node, scope, position + 1, buffer, readString);
14126
+ node.label = convertNode(node, scope, buffer[position], buffer, readString);
14127
+ node.body = convertNode(node, scope, buffer[position + 1], buffer, readString);
14127
14128
  },
14128
14129
  function literalBigInt(node, position, buffer, readString) {
14129
- node.raw = parseAst_js.convertString(buffer[position], buffer, readString);
14130
- const bigint = (node.bigint = parseAst_js.convertString(position + 1, buffer, readString));
14130
+ const bigint = (node.bigint = parseAst_js.convertString(buffer[position], buffer, readString));
14131
+ node.raw = parseAst_js.convertString(buffer[position + 1], buffer, readString);
14131
14132
  node.value = BigInt(bigint);
14132
14133
  },
14133
14134
  function literalBoolean(node, position, buffer) {
@@ -14144,66 +14145,66 @@ const bufferParsers = [
14144
14145
  node.value = new DataView(buffer.buffer).getFloat64((position + 1) << 2, true);
14145
14146
  },
14146
14147
  function literalRegExp(node, position, buffer, readString) {
14147
- const pattern = parseAst_js.convertString(buffer[position], buffer, readString);
14148
- const flags = parseAst_js.convertString(position + 1, buffer, readString);
14148
+ const flags = parseAst_js.convertString(buffer[position], buffer, readString);
14149
+ const pattern = parseAst_js.convertString(buffer[position + 1], buffer, readString);
14149
14150
  node.raw = `/${pattern}/${flags}`;
14150
14151
  node.regex = { flags, pattern };
14151
14152
  node.value = new RegExp(pattern, flags);
14152
14153
  },
14153
14154
  function literalString(node, position, buffer, readString) {
14154
- const rawPosition = buffer[position];
14155
+ node.value = parseAst_js.convertString(buffer[position], buffer, readString);
14156
+ const rawPosition = buffer[position + 1];
14155
14157
  node.raw = rawPosition === 0 ? undefined : parseAst_js.convertString(rawPosition, buffer, readString);
14156
- node.value = parseAst_js.convertString(position + 1, buffer, readString);
14157
14158
  },
14158
14159
  function logicalExpression(node, position, buffer, readString) {
14159
14160
  const { scope } = node;
14160
14161
  node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
14161
- node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
14162
- node.left = convertNode(node, scope, position + 2, buffer, readString);
14162
+ node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
14163
+ node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
14163
14164
  },
14164
14165
  function memberExpression(node, position, buffer, readString) {
14165
14166
  const { scope } = node;
14166
14167
  const flags = buffer[position];
14167
14168
  node.computed = (flags & 1) === 1;
14168
14169
  node.optional = (flags & 2) === 2;
14169
- node.property = convertNode(node, scope, buffer[position + 1], buffer, readString);
14170
- node.object = convertNode(node, scope, position + 2, buffer, readString);
14170
+ node.object = convertNode(node, scope, buffer[position + 1], buffer, readString);
14171
+ node.property = convertNode(node, scope, buffer[position + 2], buffer, readString);
14171
14172
  },
14172
14173
  function metaProperty(node, position, buffer, readString) {
14173
14174
  const { scope } = node;
14174
- node.property = convertNode(node, scope, buffer[position], buffer, readString);
14175
- node.meta = convertNode(node, scope, position + 1, buffer, readString);
14175
+ node.meta = convertNode(node, scope, buffer[position], buffer, readString);
14176
+ node.property = convertNode(node, scope, buffer[position + 1], buffer, readString);
14176
14177
  },
14177
14178
  function methodDefinition(node, position, buffer, readString) {
14178
14179
  const { scope } = node;
14179
14180
  const flags = buffer[position];
14180
14181
  node.static = (flags & 1) === 1;
14181
14182
  node.computed = (flags & 2) === 2;
14182
- node.value = convertNode(node, scope, buffer[position + 1], buffer, readString);
14183
- node.kind = parseAst_js.FIXED_STRINGS[buffer[position + 2]];
14184
- node.key = convertNode(node, scope, position + 3, buffer, readString);
14183
+ node.key = convertNode(node, scope, buffer[position + 1], buffer, readString);
14184
+ node.value = convertNode(node, scope, buffer[position + 2], buffer, readString);
14185
+ node.kind = parseAst_js.FIXED_STRINGS[buffer[position + 3]];
14185
14186
  },
14186
14187
  function newExpression(node, position, buffer, readString) {
14187
14188
  const { scope } = node;
14188
- node.callee = convertNode(node, scope, buffer[position], buffer, readString);
14189
- node.arguments = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
14190
- node.annotations = parseAst_js.convertAnnotations(position + 2, buffer);
14189
+ node.annotations = parseAst_js.convertAnnotations(buffer[position], buffer);
14190
+ node.callee = convertNode(node, scope, buffer[position + 1], buffer, readString);
14191
+ node.arguments = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
14191
14192
  },
14192
14193
  function objectExpression(node, position, buffer, readString) {
14193
14194
  const { scope } = node;
14194
- node.properties = convertNodeList(node, scope, position, buffer, readString);
14195
+ node.properties = convertNodeList(node, scope, buffer[position], buffer, readString);
14195
14196
  },
14196
14197
  function objectPattern(node, position, buffer, readString) {
14197
14198
  const { scope } = node;
14198
- node.properties = convertNodeList(node, scope, position, buffer, readString);
14199
+ node.properties = convertNodeList(node, scope, buffer[position], buffer, readString);
14199
14200
  },
14200
14201
  function privateIdentifier(node, position, buffer, readString) {
14201
- node.name = parseAst_js.convertString(position, buffer, readString);
14202
+ node.name = parseAst_js.convertString(buffer[position], buffer, readString);
14202
14203
  },
14203
14204
  function program(node, position, buffer, readString) {
14204
14205
  const { scope } = node;
14205
- node.invalidAnnotations = parseAst_js.convertAnnotations(buffer[position], buffer);
14206
- node.body = convertNodeList(node, scope, position + 1, buffer, readString);
14206
+ node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
14207
+ node.invalidAnnotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer);
14207
14208
  },
14208
14209
  function property(node, position, buffer, readString) {
14209
14210
  const { scope } = node;
@@ -14222,14 +14223,14 @@ const bufferParsers = [
14222
14223
  const flags = buffer[position];
14223
14224
  node.static = (flags & 1) === 1;
14224
14225
  node.computed = (flags & 2) === 2;
14225
- const valuePosition = buffer[position + 1];
14226
+ node.key = convertNode(node, scope, buffer[position + 1], buffer, readString);
14227
+ const valuePosition = buffer[position + 2];
14226
14228
  node.value =
14227
14229
  valuePosition === 0 ? null : convertNode(node, scope, valuePosition, buffer, readString);
14228
- node.key = convertNode(node, scope, position + 2, buffer, readString);
14229
14230
  },
14230
14231
  function restElement(node, position, buffer, readString) {
14231
14232
  const { scope } = node;
14232
- node.argument = convertNode(node, scope, position, buffer, readString);
14233
+ node.argument = convertNode(node, scope, buffer[position], buffer, readString);
14233
14234
  },
14234
14235
  function returnStatement(node, position, buffer, readString) {
14235
14236
  const { scope } = node;
@@ -14241,15 +14242,15 @@ const bufferParsers = [
14241
14242
  },
14242
14243
  function sequenceExpression(node, position, buffer, readString) {
14243
14244
  const { scope } = node;
14244
- node.expressions = convertNodeList(node, scope, position, buffer, readString);
14245
+ node.expressions = convertNodeList(node, scope, buffer[position], buffer, readString);
14245
14246
  },
14246
14247
  function spreadElement(node, position, buffer, readString) {
14247
14248
  const { scope } = node;
14248
- node.argument = convertNode(node, scope, position, buffer, readString);
14249
+ node.argument = convertNode(node, scope, buffer[position], buffer, readString);
14249
14250
  },
14250
14251
  function staticBlock(node, position, buffer, readString) {
14251
14252
  const { scope } = node;
14252
- node.body = convertNodeList(node, scope, position, buffer, readString);
14253
+ node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
14253
14254
  },
14254
14255
  function superElement() { },
14255
14256
  function switchCase(node, position, buffer, readString) {
@@ -14261,72 +14262,72 @@ const bufferParsers = [
14261
14262
  },
14262
14263
  function switchStatement(node, position, buffer, readString) {
14263
14264
  const { scope } = node;
14264
- node.cases = convertNodeList(node, scope, buffer[position], buffer, readString);
14265
- node.discriminant = convertNode(node, node.parentScope, position + 1, buffer, readString);
14265
+ node.discriminant = convertNode(node, node.parentScope, buffer[position], buffer, readString);
14266
+ node.cases = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
14266
14267
  },
14267
14268
  function taggedTemplateExpression(node, position, buffer, readString) {
14268
14269
  const { scope } = node;
14269
- node.quasi = convertNode(node, scope, buffer[position], buffer, readString);
14270
- node.tag = convertNode(node, scope, position + 1, buffer, readString);
14270
+ node.tag = convertNode(node, scope, buffer[position], buffer, readString);
14271
+ node.quasi = convertNode(node, scope, buffer[position + 1], buffer, readString);
14271
14272
  },
14272
14273
  function templateElement(node, position, buffer, readString) {
14273
14274
  const flags = buffer[position];
14274
14275
  node.tail = (flags & 1) === 1;
14275
14276
  const cookedPosition = buffer[position + 1];
14276
14277
  const cooked = cookedPosition === 0 ? undefined : parseAst_js.convertString(cookedPosition, buffer, readString);
14277
- const raw = parseAst_js.convertString(position + 2, buffer, readString);
14278
+ const raw = parseAst_js.convertString(buffer[position + 2], buffer, readString);
14278
14279
  node.value = { cooked, raw };
14279
14280
  },
14280
14281
  function templateLiteral(node, position, buffer, readString) {
14281
14282
  const { scope } = node;
14282
- node.expressions = convertNodeList(node, scope, buffer[position], buffer, readString);
14283
- node.quasis = convertNodeList(node, scope, position + 1, buffer, readString);
14283
+ node.quasis = convertNodeList(node, scope, buffer[position], buffer, readString);
14284
+ node.expressions = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
14284
14285
  },
14285
14286
  function thisExpression() { },
14286
14287
  function throwStatement(node, position, buffer, readString) {
14287
14288
  const { scope } = node;
14288
- node.argument = convertNode(node, scope, position, buffer, readString);
14289
+ node.argument = convertNode(node, scope, buffer[position], buffer, readString);
14289
14290
  },
14290
14291
  function tryStatement(node, position, buffer, readString) {
14291
14292
  const { scope } = node;
14292
- const handlerPosition = buffer[position];
14293
+ node.block = convertNode(node, scope, buffer[position], buffer, readString);
14294
+ const handlerPosition = buffer[position + 1];
14293
14295
  node.handler =
14294
14296
  handlerPosition === 0 ? null : convertNode(node, scope, handlerPosition, buffer, readString);
14295
- const finalizerPosition = buffer[position + 1];
14297
+ const finalizerPosition = buffer[position + 2];
14296
14298
  node.finalizer =
14297
14299
  finalizerPosition === 0
14298
14300
  ? null
14299
14301
  : convertNode(node, scope, finalizerPosition, buffer, readString);
14300
- node.block = convertNode(node, scope, position + 2, buffer, readString);
14301
14302
  },
14302
14303
  function unaryExpression(node, position, buffer, readString) {
14303
14304
  const { scope } = node;
14304
14305
  node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
14305
- node.argument = convertNode(node, scope, position + 1, buffer, readString);
14306
+ node.argument = convertNode(node, scope, buffer[position + 1], buffer, readString);
14306
14307
  },
14307
14308
  function updateExpression(node, position, buffer, readString) {
14308
14309
  const { scope } = node;
14309
14310
  const flags = buffer[position];
14310
14311
  node.prefix = (flags & 1) === 1;
14311
14312
  node.operator = parseAst_js.FIXED_STRINGS[buffer[position + 1]];
14312
- node.argument = convertNode(node, scope, position + 2, buffer, readString);
14313
+ node.argument = convertNode(node, scope, buffer[position + 2], buffer, readString);
14313
14314
  },
14314
14315
  function variableDeclaration(node, position, buffer, readString) {
14315
14316
  const { scope } = node;
14316
14317
  node.kind = parseAst_js.FIXED_STRINGS[buffer[position]];
14317
- node.declarations = convertNodeList(node, scope, position + 1, buffer, readString);
14318
+ node.declarations = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
14318
14319
  },
14319
14320
  function variableDeclarator(node, position, buffer, readString) {
14320
14321
  const { scope } = node;
14321
- const initPosition = buffer[position];
14322
+ node.id = convertNode(node, scope, buffer[position], buffer, readString);
14323
+ const initPosition = buffer[position + 1];
14322
14324
  node.init =
14323
14325
  initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer, readString);
14324
- node.id = convertNode(node, scope, position + 1, buffer, readString);
14325
14326
  },
14326
14327
  function whileStatement(node, position, buffer, readString) {
14327
14328
  const { scope } = node;
14328
- node.body = convertNode(node, scope, buffer[position], buffer, readString);
14329
- node.test = convertNode(node, scope, position + 1, buffer, readString);
14329
+ node.test = convertNode(node, scope, buffer[position], buffer, readString);
14330
+ node.body = convertNode(node, scope, buffer[position + 1], buffer, readString);
14330
14331
  },
14331
14332
  function yieldExpression(node, position, buffer, readString) {
14332
14333
  const { scope } = node;
@@ -14356,6 +14357,8 @@ function convertNode(parent, parentScope, position, buffer, readString) {
14356
14357
  return node;
14357
14358
  }
14358
14359
  function convertNodeList(parent, parentScope, position, buffer, readString) {
14360
+ if (position === 0)
14361
+ return parseAst_js.EMPTY_ARRAY;
14359
14362
  const length = buffer[position++];
14360
14363
  const list = [];
14361
14364
  for (let index = 0; index < length; index++) {
@@ -14742,15 +14745,15 @@ function getAttributesFromImportExpression(node) {
14742
14745
  if (options) {
14743
14746
  context.module.log(parseAst_js.LOGLEVEL_WARN, parseAst_js.logImportAttributeIsInvalid(context.module.id), start);
14744
14747
  }
14745
- return EMPTY_OBJECT;
14748
+ return parseAst_js.EMPTY_OBJECT;
14746
14749
  }
14747
14750
  const assertProperty = options.properties.find((property) => ATTRIBUTE_KEYWORDS.has(getPropertyKey(property)))?.value;
14748
14751
  if (!assertProperty) {
14749
- return EMPTY_OBJECT;
14752
+ return parseAst_js.EMPTY_OBJECT;
14750
14753
  }
14751
14754
  if (!(assertProperty instanceof ObjectExpression)) {
14752
14755
  context.module.log(parseAst_js.LOGLEVEL_WARN, parseAst_js.logImportOptionsAreInvalid(context.module.id), start);
14753
- return EMPTY_OBJECT;
14756
+ return parseAst_js.EMPTY_OBJECT;
14754
14757
  }
14755
14758
  const assertFields = assertProperty.properties
14756
14759
  .map(property => {
@@ -14766,7 +14769,7 @@ function getAttributesFromImportExpression(node) {
14766
14769
  if (assertFields.length > 0) {
14767
14770
  return Object.fromEntries(assertFields);
14768
14771
  }
14769
- return EMPTY_OBJECT;
14772
+ return parseAst_js.EMPTY_OBJECT;
14770
14773
  }
14771
14774
  const getPropertyKey = (property) => {
14772
14775
  const key = property.key;
@@ -14777,7 +14780,7 @@ const getPropertyKey = (property) => {
14777
14780
  function getAttributesFromImportExportDeclaration(attributes) {
14778
14781
  return attributes?.length
14779
14782
  ? Object.fromEntries(attributes.map(assertion => [getPropertyKey(assertion), assertion.value.value]))
14780
- : EMPTY_OBJECT;
14783
+ : parseAst_js.EMPTY_OBJECT;
14781
14784
  }
14782
14785
  function doAttributesDiffer(assertionA, assertionB) {
14783
14786
  const keysA = Object.keys(assertionA);
@@ -15092,8 +15095,8 @@ class Module {
15092
15095
  };
15093
15096
  }
15094
15097
  basename() {
15095
- const base = node_path.basename(this.id);
15096
- const extension = node_path.extname(this.id);
15098
+ const base = path$2.basename(this.id);
15099
+ const extension = path$2.extname(this.id);
15097
15100
  return makeLegal(extension ? base.slice(0, -extension.length) : base);
15098
15101
  }
15099
15102
  bindReferences() {
@@ -15265,7 +15268,7 @@ class Module {
15265
15268
  }
15266
15269
  return this.syntheticNamespace;
15267
15270
  }
15268
- getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, onlyExplicit, searchedNamesAndModules } = EMPTY_OBJECT) {
15271
+ getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, onlyExplicit, searchedNamesAndModules } = parseAst_js.EMPTY_OBJECT) {
15269
15272
  if (name[0] === '*') {
15270
15273
  if (name.length === 1) {
15271
15274
  // export * from './other'
@@ -15551,7 +15554,7 @@ class Module {
15551
15554
  transformFiles: this.transformFiles
15552
15555
  };
15553
15556
  }
15554
- traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = EMPTY_OBJECT) {
15557
+ traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = parseAst_js.EMPTY_OBJECT) {
15555
15558
  const localVariable = this.scope.variables.get(name);
15556
15559
  if (localVariable) {
15557
15560
  return localVariable;
@@ -17297,7 +17300,7 @@ class Chunk {
17297
17300
  let hashPlaceholder = null;
17298
17301
  const { chunkFileNames, entryFileNames, file, format, preserveModules } = this.outputOptions;
17299
17302
  if (file) {
17300
- fileName = node_path.basename(file);
17303
+ fileName = path$2.basename(file);
17301
17304
  }
17302
17305
  else if (this.fileName === null) {
17303
17306
  const [pattern, patternName] = preserveModules || this.facadeModule?.isUserDefinedEntryPoint
@@ -17395,15 +17398,15 @@ class Chunk {
17395
17398
  const renderedExports = exportMode === 'none' ? [] : this.getChunkExportDeclarations(format);
17396
17399
  let hasExports = renderedExports.length > 0;
17397
17400
  let hasDefaultExport = false;
17398
- for (const renderedDependence of renderedDependencies) {
17399
- const { reexports } = renderedDependence;
17401
+ for (const renderedDependency of renderedDependencies) {
17402
+ const { reexports } = renderedDependency;
17400
17403
  if (reexports?.length) {
17401
17404
  hasExports = true;
17402
17405
  if (!hasDefaultExport && reexports.some(reexport => reexport.reexported === 'default')) {
17403
17406
  hasDefaultExport = true;
17404
17407
  }
17405
17408
  if (format === 'es') {
17406
- renderedDependence.reexports = reexports.filter(
17409
+ renderedDependency.reexports = reexports.filter(
17407
17410
  // eslint-disable-next-line unicorn/prefer-array-some
17408
17411
  ({ reexported }) => !renderedExports.find(({ exported }) => exported === reexported));
17409
17412
  }
@@ -17610,8 +17613,13 @@ class Chunk {
17610
17613
  deconflictedDefault.add(chunk);
17611
17614
  }
17612
17615
  }
17613
- else if (variable.name === '*' &&
17614
- namespaceInteropHelpersByInteropType[interop(module.id)]) {
17616
+ else if (variable.isNamespace &&
17617
+ namespaceInteropHelpersByInteropType[interop(module.id)] &&
17618
+ (this.imports.has(variable) ||
17619
+ !this.exportNamesByVariable.get(variable)?.every(name => name.startsWith('*')))) {
17620
+ // We only need to deconflict it if the namespace is actually
17621
+ // created as a variable, i.e. because it is used internally or
17622
+ // because it is reexported as an object
17615
17623
  deconflictedNamespace.add(chunk);
17616
17624
  }
17617
17625
  }
@@ -17745,17 +17753,17 @@ class Chunk {
17745
17753
  return predefinedChunkName;
17746
17754
  const { preserveModulesRoot, sanitizeFileName } = this.outputOptions;
17747
17755
  const sanitizedId = sanitizeFileName(parseAst_js.normalize(module.id.split(QUERY_HASH_REGEX, 1)[0]));
17748
- const extensionName = node_path.extname(sanitizedId);
17756
+ const extensionName = path$2.extname(sanitizedId);
17749
17757
  const idWithoutExtension = NON_ASSET_EXTENSIONS.has(extensionName)
17750
17758
  ? sanitizedId.slice(0, -extensionName.length)
17751
17759
  : sanitizedId;
17752
17760
  if (parseAst_js.isAbsolute(idWithoutExtension)) {
17753
- return preserveModulesRoot && node_path.resolve(idWithoutExtension).startsWith(preserveModulesRoot)
17761
+ return preserveModulesRoot && path$2.resolve(idWithoutExtension).startsWith(preserveModulesRoot)
17754
17762
  ? idWithoutExtension.slice(preserveModulesRoot.length).replace(/^[/\\]/, '')
17755
17763
  : parseAst_js.relative(this.inputBase, idWithoutExtension);
17756
17764
  }
17757
17765
  else {
17758
- return `_virtual/${node_path.basename(idWithoutExtension)}`;
17766
+ return `_virtual/${path$2.basename(idWithoutExtension)}`;
17759
17767
  }
17760
17768
  }
17761
17769
  getReexportSpecifiers() {
@@ -17825,23 +17833,25 @@ class Chunk {
17825
17833
  const reexportSpecifiers = this.getReexportSpecifiers();
17826
17834
  const renderedDependencies = new Map();
17827
17835
  const fileName = this.getFileName();
17828
- for (const dep of this.dependencies) {
17829
- const imports = importSpecifiers.get(dep) || null;
17830
- const reexports = reexportSpecifiers.get(dep) || null;
17831
- const namedExportsMode = dep instanceof ExternalChunk || dep.exportMode !== 'default';
17832
- const importPath = dep.getImportPath(fileName);
17833
- renderedDependencies.set(dep, {
17834
- attributes: dep instanceof ExternalChunk ? dep.getImportAttributes(this.snippets) : null,
17835
- defaultVariableName: dep.defaultVariableName,
17836
- globalName: dep instanceof ExternalChunk &&
17836
+ for (const dependency of this.dependencies) {
17837
+ const imports = importSpecifiers.get(dependency) || null;
17838
+ const reexports = reexportSpecifiers.get(dependency) || null;
17839
+ const namedExportsMode = dependency instanceof ExternalChunk || dependency.exportMode !== 'default';
17840
+ const importPath = dependency.getImportPath(fileName);
17841
+ renderedDependencies.set(dependency, {
17842
+ attributes: dependency instanceof ExternalChunk
17843
+ ? dependency.getImportAttributes(this.snippets)
17844
+ : null,
17845
+ defaultVariableName: dependency.defaultVariableName,
17846
+ globalName: dependency instanceof ExternalChunk &&
17837
17847
  (this.outputOptions.format === 'umd' || this.outputOptions.format === 'iife') &&
17838
- getGlobalName(dep, this.outputOptions.globals, (imports || reexports) !== null, this.inputOptions.onLog),
17848
+ getGlobalName(dependency, this.outputOptions.globals, (imports || reexports) !== null, this.inputOptions.onLog),
17839
17849
  importPath,
17840
17850
  imports,
17841
- isChunk: dep instanceof Chunk,
17842
- name: dep.variableName,
17851
+ isChunk: dependency instanceof Chunk,
17852
+ name: dependency.variableName,
17843
17853
  namedExportsMode,
17844
- namespaceVariableName: dep.namespaceVariableName,
17854
+ namespaceVariableName: dependency.namespaceVariableName,
17845
17855
  reexports
17846
17856
  });
17847
17857
  }
@@ -18736,7 +18746,7 @@ function commondir(files) {
18736
18746
  if (files.length === 0)
18737
18747
  return '/';
18738
18748
  if (files.length === 1)
18739
- return node_path.dirname(files[0]);
18749
+ return path$2.dirname(files[0]);
18740
18750
  const commonSegments = files.slice(1).reduce((commonSegments, file) => {
18741
18751
  const pathSegments = file.split(/\/+|\\+/);
18742
18752
  let index;
@@ -18753,6 +18763,13 @@ const compareExecIndex = (unitA, unitB) => unitA.execIndex > unitB.execIndex ? 1
18753
18763
  function sortByExecutionOrder(units) {
18754
18764
  units.sort(compareExecIndex);
18755
18765
  }
18766
+ // This process is currently faulty in so far as it only takes the first entry
18767
+ // module into account and assumes that dynamic imports are imported in a
18768
+ // certain order.
18769
+ // A better algorithm would follow every possible execution path and mark which
18770
+ // modules are executed before or after which other modules. THen the chunking
18771
+ // would need to take care that in each chunk, all modules are always executed
18772
+ // in the same sequence.
18756
18773
  function analyseModuleExecution(entryModules) {
18757
18774
  let nextExecIndex = 0;
18758
18775
  const cyclePaths = [];
@@ -18987,9 +19004,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
18987
19004
  if (originalSourcemap) {
18988
19005
  const sources = originalSourcemap.sources;
18989
19006
  const sourcesContent = originalSourcemap.sourcesContent || [];
18990
- const directory = node_path.dirname(id) || '.';
19007
+ const directory = path$2.dirname(id) || '.';
18991
19008
  const sourceRoot = originalSourcemap.sourceRoot || '.';
18992
- const baseSources = sources.map((source, index) => new Source(node_path.resolve(directory, sourceRoot, source), sourcesContent[index]));
19009
+ const baseSources = sources.map((source, index) => new Source(path$2.resolve(directory, sourceRoot, source), sourcesContent[index]));
18993
19010
  source = new Link(originalSourcemap, baseSources);
18994
19011
  }
18995
19012
  else {
@@ -19006,9 +19023,9 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
19006
19023
  const source = bundleSourcemapChain.reduce(linkMap, link);
19007
19024
  let { sources, sourcesContent, names, mappings } = source.traceMappings();
19008
19025
  if (file) {
19009
- const directory = node_path.dirname(file);
19010
- sources = sources.map((source) => node_path.relative(directory, source));
19011
- file = node_path.basename(file);
19026
+ const directory = path$2.dirname(file);
19027
+ sources = sources.map((source) => path$2.relative(directory, source));
19028
+ file = path$2.basename(file);
19012
19029
  }
19013
19030
  sourcesContent = (excludeContent ? null : sourcesContent);
19014
19031
  for (const module of modules) {
@@ -19082,11 +19099,11 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
19082
19099
  timeStart('sourcemaps', 3);
19083
19100
  let resultingFile;
19084
19101
  if (file)
19085
- resultingFile = node_path.resolve(sourcemapFile || file);
19102
+ resultingFile = path$2.resolve(sourcemapFile || file);
19086
19103
  else if (dir)
19087
- resultingFile = node_path.resolve(dir, fileName);
19104
+ resultingFile = path$2.resolve(dir, fileName);
19088
19105
  else
19089
- resultingFile = node_path.resolve(fileName);
19106
+ resultingFile = path$2.resolve(fileName);
19090
19107
  const decodedMap = magicString.generateDecodedMap({});
19091
19108
  map = collapseSourcemaps(resultingFile, decodedMap, usedModules, sourcemapChain, sourcemapExcludeSources, log);
19092
19109
  for (let sourcesIndex = 0; sourcesIndex < map.sources.length; ++sourcesIndex) {
@@ -19232,7 +19249,7 @@ function emitSourceMapAndGetComment(fileName, map, pluginDriver, { sourcemap, so
19232
19249
  url = map.toUrl();
19233
19250
  }
19234
19251
  else {
19235
- const sourcemapFileName = node_path.basename(fileName);
19252
+ const sourcemapFileName = path$2.basename(fileName);
19236
19253
  url = sourcemapBaseUrl
19237
19254
  ? new URL(sourcemapFileName, sourcemapBaseUrl).toString()
19238
19255
  : sourcemapFileName;
@@ -19471,9 +19488,9 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
19471
19488
  }
19472
19489
  replaceContext = (pluginContext, plugin) => ({
19473
19490
  ...pluginContext,
19474
- resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) => {
19491
+ resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = parseAst_js.BLANK) => {
19475
19492
  skipSelf ??= true;
19476
- return moduleLoaderResolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip);
19493
+ return moduleLoaderResolveId(source, importer, custom, isEntry, attributes || parseAst_js.EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip);
19477
19494
  }
19478
19495
  });
19479
19496
  }
@@ -19506,7 +19523,7 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
19506
19523
  // absolute path is created. Absolute importees therefore shortcircuit the
19507
19524
  // resolve call and require no special handing on our part.
19508
19525
  // See https://nodejs.org/api/path.html#path_path_resolve_paths
19509
- return addJsExtensionIfNecessary(importer ? node_path.resolve(node_path.dirname(importer), source) : node_path.resolve(source), preserveSymlinks);
19526
+ return addJsExtensionIfNecessary(importer ? path$2.resolve(path$2.dirname(importer), source) : path$2.resolve(source), preserveSymlinks);
19510
19527
  }
19511
19528
  async function addJsExtensionIfNecessary(file, preserveSymlinks) {
19512
19529
  return ((await findFile(file, preserveSymlinks)) ??
@@ -19520,8 +19537,8 @@ async function findFile(file, preserveSymlinks) {
19520
19537
  return await findFile(await promises.realpath(file), preserveSymlinks);
19521
19538
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
19522
19539
  // check case
19523
- const name = node_path.basename(file);
19524
- const files = await promises.readdir(node_path.dirname(file));
19540
+ const name = path$2.basename(file);
19541
+ const files = await promises.readdir(path$2.dirname(file));
19525
19542
  if (files.includes(name))
19526
19543
  return file;
19527
19544
  }
@@ -19722,7 +19739,7 @@ class ModuleLoader {
19722
19739
  return module;
19723
19740
  }
19724
19741
  async preloadModule(resolvedId) {
19725
- const module = await this.fetchModule(this.getResolvedIdWithDefaults(resolvedId, EMPTY_OBJECT), undefined, false, resolvedId.resolveDependencies ? RESOLVE_DEPENDENCIES : true);
19742
+ const module = await this.fetchModule(this.getResolvedIdWithDefaults(resolvedId, parseAst_js.EMPTY_OBJECT), undefined, false, resolvedId.resolveDependencies ? RESOLVE_DEPENDENCIES : true);
19726
19743
  return module.info;
19727
19744
  }
19728
19745
  addEntryWithImplicitDependants(unresolvedModule, implicitlyLoadedAfter) {
@@ -19969,7 +19986,7 @@ class ModuleLoader {
19969
19986
  source,
19970
19987
  (module.resolvedIds[source] =
19971
19988
  module.resolvedIds[source] ||
19972
- this.handleInvalidResolvedId(await this.resolveId(source, module.id, EMPTY_OBJECT, false, attributes), source, module.id, attributes))
19989
+ this.handleInvalidResolvedId(await this.resolveId(source, module.id, parseAst_js.EMPTY_OBJECT, false, attributes), source, module.id, attributes))
19973
19990
  ]);
19974
19991
  }
19975
19992
  getResolvedIdWithDefaults(resolvedId, attributes) {
@@ -20028,7 +20045,7 @@ class ModuleLoader {
20028
20045
  return resolvedId;
20029
20046
  }
20030
20047
  async loadEntryModule(unresolvedId, isEntry, importer, implicitlyLoadedBefore, isLoadForManualChunks = false) {
20031
- const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, EMPTY_OBJECT, true, EMPTY_OBJECT);
20048
+ const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, parseAst_js.EMPTY_OBJECT, true, parseAst_js.EMPTY_OBJECT);
20032
20049
  if (resolveIdResult == null) {
20033
20050
  return parseAst_js.error(implicitlyLoadedBefore === null
20034
20051
  ? parseAst_js.logUnresolvedEntry(unresolvedId)
@@ -20044,7 +20061,7 @@ class ModuleLoader {
20044
20061
  }
20045
20062
  return this.fetchModule(this.getResolvedIdWithDefaults(typeof resolveIdResult === 'object'
20046
20063
  ? resolveIdResult
20047
- : { id: resolveIdResult }, EMPTY_OBJECT), undefined, isEntry, false);
20064
+ : { id: resolveIdResult }, parseAst_js.EMPTY_OBJECT), undefined, isEntry, false);
20048
20065
  }
20049
20066
  async resolveDynamicImport(module, specifier, importer, attributes) {
20050
20067
  const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
@@ -20069,7 +20086,7 @@ class ModuleLoader {
20069
20086
  }
20070
20087
  return existingResolution;
20071
20088
  }
20072
- return (module.resolvedIds[specifier] = this.handleInvalidResolvedId(await this.resolveId(specifier, module.id, EMPTY_OBJECT, false, attributes), specifier, module.id, attributes));
20089
+ return (module.resolvedIds[specifier] = this.handleInvalidResolvedId(await this.resolveId(specifier, module.id, parseAst_js.EMPTY_OBJECT, false, attributes), specifier, module.id, attributes));
20073
20090
  }
20074
20091
  return this.handleInvalidResolvedId(this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier), attributes), specifier, importer, attributes);
20075
20092
  }
@@ -20077,8 +20094,8 @@ class ModuleLoader {
20077
20094
  function normalizeRelativeExternalId(source, importer) {
20078
20095
  return parseAst_js.isRelative(source)
20079
20096
  ? importer
20080
- ? node_path.resolve(importer, '..', source)
20081
- : node_path.resolve(source)
20097
+ ? path$2.resolve(importer, '..', source)
20098
+ : path$2.resolve(source)
20082
20099
  : source;
20083
20100
  }
20084
20101
  function addChunkNamesToModule(module, { fileName, name }, isUserDefined, priority) {
@@ -20466,7 +20483,7 @@ const getModuleContext = (config, context) => {
20466
20483
  if (configModuleContext) {
20467
20484
  const contextByModuleId = Object.create(null);
20468
20485
  for (const [key, moduleContext] of Object.entries(configModuleContext)) {
20469
- contextByModuleId[node_path.resolve(key)] = moduleContext;
20486
+ contextByModuleId[path$2.resolve(key)] = moduleContext;
20470
20487
  }
20471
20488
  return id => contextByModuleId[id] ?? context;
20472
20489
  }
@@ -20481,7 +20498,7 @@ const getTreeshake = (config) => {
20481
20498
  return {
20482
20499
  annotations: configWithPreset.annotations !== false,
20483
20500
  correctVarValueBeforeDeclaration: configWithPreset.correctVarValueBeforeDeclaration === true,
20484
- manualPureFunctions: configWithPreset.manualPureFunctions ?? EMPTY_ARRAY,
20501
+ manualPureFunctions: configWithPreset.manualPureFunctions ?? parseAst_js.EMPTY_ARRAY,
20485
20502
  moduleSideEffects: getHasModuleSideEffects(configWithPreset.moduleSideEffects),
20486
20503
  propertyReadSideEffects: configWithPreset.propertyReadSideEffects === 'always'
20487
20504
  ? 'always'
@@ -20657,7 +20674,7 @@ const getPreserveModulesRoot = (config) => {
20657
20674
  if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
20658
20675
  return undefined;
20659
20676
  }
20660
- return node_path.resolve(preserveModulesRoot);
20677
+ return path$2.resolve(preserveModulesRoot);
20661
20678
  };
20662
20679
  const getAmd = (config) => {
20663
20680
  const mergedOption = {
@@ -20957,9 +20974,9 @@ function getSortingFileType(file) {
20957
20974
  return SortingFileType.SECONDARY_CHUNK;
20958
20975
  }
20959
20976
  async function writeOutputFile(outputFile, outputOptions) {
20960
- const fileName = node_path.resolve(outputOptions.dir || node_path.dirname(outputOptions.file), outputFile.fileName);
20977
+ const fileName = path$2.resolve(outputOptions.dir || path$2.dirname(outputOptions.file), outputFile.fileName);
20961
20978
  // 'recursive: true' does not throw if the folder structure, or parts of it, already exist
20962
- await promises.mkdir(node_path.dirname(fileName), { recursive: true });
20979
+ await promises.mkdir(path$2.dirname(fileName), { recursive: true });
20963
20980
  return promises.writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
20964
20981
  }
20965
20982
  /**