@vue/compiler-sfc 3.5.0-alpha.4 → 3.5.0-beta.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,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.0-alpha.4
2
+ * @vue/compiler-sfc v3.5.0-beta.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -44,9 +44,11 @@ const cacheStringFunction = (fn) => {
44
44
  };
45
45
  };
46
46
  const camelizeRE = /-(\w)/g;
47
- const camelize = cacheStringFunction((str) => {
48
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
49
- });
47
+ const camelize = cacheStringFunction(
48
+ (str) => {
49
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
50
+ }
51
+ );
50
52
  const hyphenateRE = /\B([A-Z])/g;
51
53
  const hyphenate = cacheStringFunction(
52
54
  (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -54,10 +56,12 @@ const hyphenate = cacheStringFunction(
54
56
  const capitalize$1 = cacheStringFunction((str) => {
55
57
  return str.charAt(0).toUpperCase() + str.slice(1);
56
58
  });
57
- const toHandlerKey = cacheStringFunction((str) => {
58
- const s = str ? `on${capitalize$1(str)}` : ``;
59
- return s;
60
- });
59
+ const toHandlerKey = cacheStringFunction(
60
+ (str) => {
61
+ const s = str ? `on${capitalize$1(str)}` : ``;
62
+ return s;
63
+ }
64
+ );
61
65
  const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
62
66
  function genPropsAccessExp(name) {
63
67
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
@@ -317,36 +321,70 @@ const FRAGMENT = Symbol(`Fragment` );
317
321
  const TELEPORT = Symbol(`Teleport` );
318
322
  const SUSPENSE = Symbol(`Suspense` );
319
323
  const KEEP_ALIVE = Symbol(`KeepAlive` );
320
- const BASE_TRANSITION = Symbol(`BaseTransition` );
324
+ const BASE_TRANSITION = Symbol(
325
+ `BaseTransition`
326
+ );
321
327
  const OPEN_BLOCK = Symbol(`openBlock` );
322
328
  const CREATE_BLOCK = Symbol(`createBlock` );
323
- const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
329
+ const CREATE_ELEMENT_BLOCK = Symbol(
330
+ `createElementBlock`
331
+ );
324
332
  const CREATE_VNODE = Symbol(`createVNode` );
325
- const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
326
- const CREATE_COMMENT = Symbol(`createCommentVNode` );
327
- const CREATE_TEXT = Symbol(`createTextVNode` );
328
- const CREATE_STATIC = Symbol(`createStaticVNode` );
329
- const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
333
+ const CREATE_ELEMENT_VNODE = Symbol(
334
+ `createElementVNode`
335
+ );
336
+ const CREATE_COMMENT = Symbol(
337
+ `createCommentVNode`
338
+ );
339
+ const CREATE_TEXT = Symbol(
340
+ `createTextVNode`
341
+ );
342
+ const CREATE_STATIC = Symbol(
343
+ `createStaticVNode`
344
+ );
345
+ const RESOLVE_COMPONENT = Symbol(
346
+ `resolveComponent`
347
+ );
330
348
  const RESOLVE_DYNAMIC_COMPONENT = Symbol(
331
349
  `resolveDynamicComponent`
332
350
  );
333
- const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
334
- const RESOLVE_FILTER = Symbol(`resolveFilter` );
335
- const WITH_DIRECTIVES = Symbol(`withDirectives` );
351
+ const RESOLVE_DIRECTIVE = Symbol(
352
+ `resolveDirective`
353
+ );
354
+ const RESOLVE_FILTER = Symbol(
355
+ `resolveFilter`
356
+ );
357
+ const WITH_DIRECTIVES = Symbol(
358
+ `withDirectives`
359
+ );
336
360
  const RENDER_LIST = Symbol(`renderList` );
337
361
  const RENDER_SLOT = Symbol(`renderSlot` );
338
362
  const CREATE_SLOTS = Symbol(`createSlots` );
339
- const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
363
+ const TO_DISPLAY_STRING = Symbol(
364
+ `toDisplayString`
365
+ );
340
366
  const MERGE_PROPS = Symbol(`mergeProps` );
341
- const NORMALIZE_CLASS = Symbol(`normalizeClass` );
342
- const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
343
- const NORMALIZE_PROPS = Symbol(`normalizeProps` );
344
- const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
367
+ const NORMALIZE_CLASS = Symbol(
368
+ `normalizeClass`
369
+ );
370
+ const NORMALIZE_STYLE = Symbol(
371
+ `normalizeStyle`
372
+ );
373
+ const NORMALIZE_PROPS = Symbol(
374
+ `normalizeProps`
375
+ );
376
+ const GUARD_REACTIVE_PROPS = Symbol(
377
+ `guardReactiveProps`
378
+ );
345
379
  const TO_HANDLERS = Symbol(`toHandlers` );
346
380
  const CAMELIZE = Symbol(`camelize` );
347
381
  const CAPITALIZE = Symbol(`capitalize` );
348
- const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
349
- const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
382
+ const TO_HANDLER_KEY = Symbol(
383
+ `toHandlerKey`
384
+ );
385
+ const SET_BLOCK_TRACKING = Symbol(
386
+ `setBlockTracking`
387
+ );
350
388
  const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
351
389
  const POP_SCOPE_ID = Symbol(`popScopeId` );
352
390
  const WITH_CTX = Symbol(`withCtx` );
@@ -726,13 +764,13 @@ const decodeMap = new Map([
726
764
  * Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
727
765
  */
728
766
  const fromCodePoint =
729
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
767
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
730
768
  (_a$1 = String.fromCodePoint) !== null && _a$1 !== void 0 ? _a$1 : function (codePoint) {
731
769
  let output = "";
732
- if (codePoint > 0xffff) {
733
- codePoint -= 0x10000;
734
- output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
735
- codePoint = 0xdc00 | (codePoint & 0x3ff);
770
+ if (codePoint > 65535) {
771
+ codePoint -= 65536;
772
+ output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
773
+ codePoint = 56320 | (codePoint & 1023);
736
774
  }
737
775
  output += String.fromCharCode(codePoint);
738
776
  return output;
@@ -744,8 +782,9 @@ const fromCodePoint =
744
782
  */
745
783
  function replaceCodePoint(codePoint) {
746
784
  var _a;
747
- if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
748
- return 0xfffd;
785
+ if ((codePoint >= 55296 && codePoint <= 57343) ||
786
+ codePoint > 1114111) {
787
+ return 65533;
749
788
  }
750
789
  return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
751
790
  }
@@ -766,7 +805,7 @@ var CharCodes;
766
805
  CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
767
806
  })(CharCodes || (CharCodes = {}));
768
807
  /** Bit that needs to be set to convert an upper case ASCII character to lower case */
769
- const TO_LOWER_BIT = 0b100000;
808
+ const TO_LOWER_BIT = 32;
770
809
  var BinTrieFlags;
771
810
  (function (BinTrieFlags) {
772
811
  BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
@@ -867,32 +906,32 @@ class EntityDecoder {
867
906
  * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
868
907
  * entity is incomplete, and resume when the next string is written.
869
908
  *
870
- * @param string The string containing the entity (or a continuation of the entity).
909
+ * @param input The string containing the entity (or a continuation of the entity).
871
910
  * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
872
911
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
873
912
  */
874
- write(str, offset) {
913
+ write(input, offset) {
875
914
  switch (this.state) {
876
915
  case EntityDecoderState.EntityStart: {
877
- if (str.charCodeAt(offset) === CharCodes.NUM) {
916
+ if (input.charCodeAt(offset) === CharCodes.NUM) {
878
917
  this.state = EntityDecoderState.NumericStart;
879
918
  this.consumed += 1;
880
- return this.stateNumericStart(str, offset + 1);
919
+ return this.stateNumericStart(input, offset + 1);
881
920
  }
882
921
  this.state = EntityDecoderState.NamedEntity;
883
- return this.stateNamedEntity(str, offset);
922
+ return this.stateNamedEntity(input, offset);
884
923
  }
885
924
  case EntityDecoderState.NumericStart: {
886
- return this.stateNumericStart(str, offset);
925
+ return this.stateNumericStart(input, offset);
887
926
  }
888
927
  case EntityDecoderState.NumericDecimal: {
889
- return this.stateNumericDecimal(str, offset);
928
+ return this.stateNumericDecimal(input, offset);
890
929
  }
891
930
  case EntityDecoderState.NumericHex: {
892
- return this.stateNumericHex(str, offset);
931
+ return this.stateNumericHex(input, offset);
893
932
  }
894
933
  case EntityDecoderState.NamedEntity: {
895
- return this.stateNamedEntity(str, offset);
934
+ return this.stateNamedEntity(input, offset);
896
935
  }
897
936
  }
898
937
  }
@@ -901,28 +940,28 @@ class EntityDecoder {
901
940
  *
902
941
  * Equivalent to the `Numeric character reference state` in the HTML spec.
903
942
  *
904
- * @param str The string containing the entity (or a continuation of the entity).
943
+ * @param input The string containing the entity (or a continuation of the entity).
905
944
  * @param offset The current offset.
906
945
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
907
946
  */
908
- stateNumericStart(str, offset) {
909
- if (offset >= str.length) {
947
+ stateNumericStart(input, offset) {
948
+ if (offset >= input.length) {
910
949
  return -1;
911
950
  }
912
- if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
951
+ if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
913
952
  this.state = EntityDecoderState.NumericHex;
914
953
  this.consumed += 1;
915
- return this.stateNumericHex(str, offset + 1);
954
+ return this.stateNumericHex(input, offset + 1);
916
955
  }
917
956
  this.state = EntityDecoderState.NumericDecimal;
918
- return this.stateNumericDecimal(str, offset);
957
+ return this.stateNumericDecimal(input, offset);
919
958
  }
920
- addToNumericResult(str, start, end, base) {
959
+ addToNumericResult(input, start, end, base) {
921
960
  if (start !== end) {
922
961
  const digitCount = end - start;
923
962
  this.result =
924
963
  this.result * Math.pow(base, digitCount) +
925
- parseInt(str.substr(start, digitCount), base);
964
+ Number.parseInt(input.substr(start, digitCount), base);
926
965
  this.consumed += digitCount;
927
966
  }
928
967
  }
@@ -931,23 +970,23 @@ class EntityDecoder {
931
970
  *
932
971
  * Equivalent to the `Hexademical character reference state` in the HTML spec.
933
972
  *
934
- * @param str The string containing the entity (or a continuation of the entity).
973
+ * @param input The string containing the entity (or a continuation of the entity).
935
974
  * @param offset The current offset.
936
975
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
937
976
  */
938
- stateNumericHex(str, offset) {
939
- const startIdx = offset;
940
- while (offset < str.length) {
941
- const char = str.charCodeAt(offset);
977
+ stateNumericHex(input, offset) {
978
+ const startIndex = offset;
979
+ while (offset < input.length) {
980
+ const char = input.charCodeAt(offset);
942
981
  if (isNumber$2(char) || isHexadecimalCharacter(char)) {
943
982
  offset += 1;
944
983
  }
945
984
  else {
946
- this.addToNumericResult(str, startIdx, offset, 16);
985
+ this.addToNumericResult(input, startIndex, offset, 16);
947
986
  return this.emitNumericEntity(char, 3);
948
987
  }
949
988
  }
950
- this.addToNumericResult(str, startIdx, offset, 16);
989
+ this.addToNumericResult(input, startIndex, offset, 16);
951
990
  return -1;
952
991
  }
953
992
  /**
@@ -955,23 +994,23 @@ class EntityDecoder {
955
994
  *
956
995
  * Equivalent to the `Decimal character reference state` in the HTML spec.
957
996
  *
958
- * @param str The string containing the entity (or a continuation of the entity).
997
+ * @param input The string containing the entity (or a continuation of the entity).
959
998
  * @param offset The current offset.
960
999
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
961
1000
  */
962
- stateNumericDecimal(str, offset) {
963
- const startIdx = offset;
964
- while (offset < str.length) {
965
- const char = str.charCodeAt(offset);
1001
+ stateNumericDecimal(input, offset) {
1002
+ const startIndex = offset;
1003
+ while (offset < input.length) {
1004
+ const char = input.charCodeAt(offset);
966
1005
  if (isNumber$2(char)) {
967
1006
  offset += 1;
968
1007
  }
969
1008
  else {
970
- this.addToNumericResult(str, startIdx, offset, 10);
1009
+ this.addToNumericResult(input, startIndex, offset, 10);
971
1010
  return this.emitNumericEntity(char, 2);
972
1011
  }
973
1012
  }
974
- this.addToNumericResult(str, startIdx, offset, 10);
1013
+ this.addToNumericResult(input, startIndex, offset, 10);
975
1014
  return -1;
976
1015
  }
977
1016
  /**
@@ -1015,17 +1054,17 @@ class EntityDecoder {
1015
1054
  *
1016
1055
  * Equivalent to the `Named character reference state` in the HTML spec.
1017
1056
  *
1018
- * @param str The string containing the entity (or a continuation of the entity).
1057
+ * @param input The string containing the entity (or a continuation of the entity).
1019
1058
  * @param offset The current offset.
1020
1059
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
1021
1060
  */
1022
- stateNamedEntity(str, offset) {
1061
+ stateNamedEntity(input, offset) {
1023
1062
  const { decodeTree } = this;
1024
1063
  let current = decodeTree[this.treeIndex];
1025
1064
  // The mask is the number of bytes of the value, including the current byte.
1026
1065
  let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
1027
- for (; offset < str.length; offset++, this.excess++) {
1028
- const char = str.charCodeAt(offset);
1066
+ for (; offset < input.length; offset++, this.excess++) {
1067
+ const char = input.charCodeAt(offset);
1029
1068
  this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
1030
1069
  if (this.treeIndex < 0) {
1031
1070
  return this.result === 0 ||
@@ -1132,28 +1171,28 @@ class EntityDecoder {
1132
1171
  * @returns A function that decodes entities in a string.
1133
1172
  */
1134
1173
  function getDecoder(decodeTree) {
1135
- let ret = "";
1136
- const decoder = new EntityDecoder(decodeTree, (str) => (ret += fromCodePoint(str)));
1137
- return function decodeWithTrie(str, decodeMode) {
1174
+ let returnValue = "";
1175
+ const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += fromCodePoint(data)));
1176
+ return function decodeWithTrie(input, decodeMode) {
1138
1177
  let lastIndex = 0;
1139
1178
  let offset = 0;
1140
- while ((offset = str.indexOf("&", offset)) >= 0) {
1141
- ret += str.slice(lastIndex, offset);
1179
+ while ((offset = input.indexOf("&", offset)) >= 0) {
1180
+ returnValue += input.slice(lastIndex, offset);
1142
1181
  decoder.startEntity(decodeMode);
1143
- const len = decoder.write(str,
1182
+ const length = decoder.write(input,
1144
1183
  // Skip the "&"
1145
1184
  offset + 1);
1146
- if (len < 0) {
1185
+ if (length < 0) {
1147
1186
  lastIndex = offset + decoder.end();
1148
1187
  break;
1149
1188
  }
1150
- lastIndex = offset + len;
1151
- // If `len` is 0, skip the current `&` and continue.
1152
- offset = len === 0 ? lastIndex + 1 : lastIndex;
1189
+ lastIndex = offset + length;
1190
+ // If `length` is 0, skip the current `&` and continue.
1191
+ offset = length === 0 ? lastIndex + 1 : lastIndex;
1153
1192
  }
1154
- const result = ret + str.slice(lastIndex);
1193
+ const result = returnValue + input.slice(lastIndex);
1155
1194
  // Make sure we don't keep a reference to the final string.
1156
- ret = "";
1195
+ returnValue = "";
1157
1196
  return result;
1158
1197
  };
1159
1198
  }
@@ -1167,31 +1206,31 @@ function getDecoder(decodeTree) {
1167
1206
  * @param char The current character.
1168
1207
  * @returns The index of the next node, or -1 if no branch is taken.
1169
1208
  */
1170
- function determineBranch(decodeTree, current, nodeIdx, char) {
1209
+ function determineBranch(decodeTree, current, nodeIndex, char) {
1171
1210
  const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
1172
1211
  const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
1173
1212
  // Case 1: Single branch encoded in jump offset
1174
1213
  if (branchCount === 0) {
1175
- return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
1214
+ return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
1176
1215
  }
1177
1216
  // Case 2: Multiple branches encoded in jump table
1178
1217
  if (jumpOffset) {
1179
1218
  const value = char - jumpOffset;
1180
1219
  return value < 0 || value >= branchCount
1181
1220
  ? -1
1182
- : decodeTree[nodeIdx + value] - 1;
1221
+ : decodeTree[nodeIndex + value] - 1;
1183
1222
  }
1184
1223
  // Case 3: Multiple branches encoded in dictionary
1185
1224
  // Binary search for the character.
1186
- let lo = nodeIdx;
1225
+ let lo = nodeIndex;
1187
1226
  let hi = lo + branchCount - 1;
1188
1227
  while (lo <= hi) {
1189
1228
  const mid = (lo + hi) >>> 1;
1190
- const midVal = decodeTree[mid];
1191
- if (midVal < char) {
1229
+ const midValue = decodeTree[mid];
1230
+ if (midValue < char) {
1192
1231
  lo = mid + 1;
1193
1232
  }
1194
- else if (midVal > char) {
1233
+ else if (midValue > char) {
1195
1234
  hi = mid - 1;
1196
1235
  }
1197
1236
  else {
@@ -1205,12 +1244,12 @@ getDecoder(xmlDecodeTree);
1205
1244
  /**
1206
1245
  * Decodes an HTML string.
1207
1246
  *
1208
- * @param str The string to decode.
1247
+ * @param htmlString The string to decode.
1209
1248
  * @param mode The decoding mode.
1210
1249
  * @returns The decoded string.
1211
1250
  */
1212
- function decodeHTML(str, mode = DecodingMode.Legacy) {
1213
- return htmlDecoder(str, mode);
1251
+ function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
1252
+ return htmlDecoder(htmlString, mode);
1214
1253
  }
1215
1254
 
1216
1255
  const defaultDelimitersOpen = new Uint8Array([123, 123]);
@@ -2376,17 +2415,14 @@ var lib = {};
2376
2415
  Object.defineProperty(lib, '__esModule', {
2377
2416
  value: true
2378
2417
  });
2379
- function _objectWithoutPropertiesLoose(source, excluded) {
2380
- if (source == null) return {};
2381
- var target = {};
2382
- var sourceKeys = Object.keys(source);
2383
- var key, i;
2384
- for (i = 0; i < sourceKeys.length; i++) {
2385
- key = sourceKeys[i];
2386
- if (excluded.indexOf(key) >= 0) continue;
2387
- target[key] = source[key];
2388
- }
2389
- return target;
2418
+ function _objectWithoutPropertiesLoose(r, e) {
2419
+ if (null == r) return {};
2420
+ var t = {};
2421
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
2422
+ if (e.includes(n)) continue;
2423
+ t[n] = r[n];
2424
+ }
2425
+ return t;
2390
2426
  }
2391
2427
  class Position {
2392
2428
  constructor(line, col, index) {
@@ -2706,8 +2742,7 @@ var PipelineOperatorErrors = {
2706
2742
  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
2707
2743
  PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
2708
2744
  };
2709
- const _excluded = ["toMessage"],
2710
- _excluded2 = ["message"];
2745
+ const _excluded = ["message"];
2711
2746
  function defineHidden(obj, key, value) {
2712
2747
  Object.defineProperty(obj, key, {
2713
2748
  enumerable: false,
@@ -2715,21 +2750,22 @@ function defineHidden(obj, key, value) {
2715
2750
  value
2716
2751
  });
2717
2752
  }
2718
- function toParseErrorConstructor(_ref) {
2719
- let {
2720
- toMessage
2721
- } = _ref,
2722
- properties = _objectWithoutPropertiesLoose(_ref, _excluded);
2753
+ function toParseErrorConstructor({
2754
+ toMessage,
2755
+ code,
2756
+ reasonCode,
2757
+ syntaxPlugin
2758
+ }) {
2759
+ const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
2723
2760
  return function constructor(loc, details) {
2724
2761
  const error = new SyntaxError();
2725
- Object.assign(error, properties, {
2726
- loc,
2727
- pos: loc.index
2728
- });
2729
- if ("missingPlugin" in details) {
2730
- Object.assign(error, {
2731
- missingPlugin: details.missingPlugin
2732
- });
2762
+ error.code = code;
2763
+ error.reasonCode = reasonCode;
2764
+ error.loc = loc;
2765
+ error.pos = loc.index;
2766
+ error.syntaxPlugin = syntaxPlugin;
2767
+ if (hasMissingPlugin) {
2768
+ error.missingPlugin = details.missingPlugin;
2733
2769
  }
2734
2770
  defineHidden(error, "clone", function clone(overrides = {}) {
2735
2771
  var _overrides$loc;
@@ -2765,15 +2801,15 @@ function ParseErrorEnum(argument, syntaxPlugin) {
2765
2801
  const ParseErrorConstructors = {};
2766
2802
  for (const reasonCode of Object.keys(argument)) {
2767
2803
  const template = argument[reasonCode];
2768
- const _ref2 = typeof template === "string" ? {
2804
+ const _ref = typeof template === "string" ? {
2769
2805
  message: () => template
2770
2806
  } : typeof template === "function" ? {
2771
2807
  message: template
2772
2808
  } : template,
2773
2809
  {
2774
2810
  message
2775
- } = _ref2,
2776
- rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
2811
+ } = _ref,
2812
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
2777
2813
  const toMessage = typeof message === "string" ? () => message : message;
2778
2814
  ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
2779
2815
  code: "BABEL_PARSER_SYNTAX_ERROR",
@@ -2789,13 +2825,17 @@ const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(St
2789
2825
  const {
2790
2826
  defineProperty
2791
2827
  } = Object;
2792
- const toUnenumerable = (object, key) => defineProperty(object, key, {
2793
- enumerable: false,
2794
- value: object[key]
2795
- });
2828
+ const toUnenumerable = (object, key) => {
2829
+ if (object) {
2830
+ defineProperty(object, key, {
2831
+ enumerable: false,
2832
+ value: object[key]
2833
+ });
2834
+ }
2835
+ };
2796
2836
  function toESTreeLocation(node) {
2797
- node.loc.start && toUnenumerable(node.loc.start, "index");
2798
- node.loc.end && toUnenumerable(node.loc.end, "index");
2837
+ toUnenumerable(node.loc.start, "index");
2838
+ toUnenumerable(node.loc.end, "index");
2799
2839
  return node;
2800
2840
  }
2801
2841
  var estree = superClass => class ESTreeParserMixin extends superClass {
@@ -2813,7 +2853,7 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
2813
2853
  let regex = null;
2814
2854
  try {
2815
2855
  regex = new RegExp(pattern, flags);
2816
- } catch (e) {}
2856
+ } catch (_) {}
2817
2857
  const node = this.estreeParseLiteral(regex);
2818
2858
  node.regex = {
2819
2859
  pattern,
@@ -4159,7 +4199,7 @@ class CommentsParser extends BaseParser {
4159
4199
  }
4160
4200
  }
4161
4201
  }
4162
- const lineBreak = /\r\n?|[\n\u2028\u2029]/;
4202
+ const lineBreak = /\r\n|[\r\n\u2028\u2029]/;
4163
4203
  const lineBreakG = new RegExp(lineBreak.source, "g");
4164
4204
  function isNewLine(code) {
4165
4205
  switch (code) {
@@ -4172,9 +4212,16 @@ function isNewLine(code) {
4172
4212
  return false;
4173
4213
  }
4174
4214
  }
4215
+ function hasNewLine(input, start, end) {
4216
+ for (let i = start; i < end; i++) {
4217
+ if (isNewLine(input.charCodeAt(i))) {
4218
+ return true;
4219
+ }
4220
+ }
4221
+ return false;
4222
+ }
4175
4223
  const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
4176
4224
  const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
4177
- const skipWhiteSpaceToLineBreak = new RegExp("(?=(" + skipWhiteSpaceInLine.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y");
4178
4225
  function isWhitespace(code) {
4179
4226
  switch (code) {
4180
4227
  case 0x0009:
@@ -4316,6 +4363,12 @@ class State {
4316
4363
  set containsEsc(v) {
4317
4364
  if (v) this.flags |= 2048;else this.flags &= -2049;
4318
4365
  }
4366
+ get hasTopLevelAwait() {
4367
+ return (this.flags & 4096) > 0;
4368
+ }
4369
+ set hasTopLevelAwait(v) {
4370
+ if (v) this.flags |= 4096;else this.flags &= -4097;
4371
+ }
4319
4372
  curPosition() {
4320
4373
  return new Position(this.curLine, this.pos - this.lineStart, this.pos);
4321
4374
  }
@@ -4496,7 +4549,7 @@ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
4496
4549
  default:
4497
4550
  if (ch >= 48 && ch <= 55) {
4498
4551
  const startPos = pos - 1;
4499
- const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
4552
+ const match = /^[0-7]+/.exec(input.slice(startPos, pos + 2));
4500
4553
  let octalStr = match[0];
4501
4554
  let octal = parseInt(octalStr, 8);
4502
4555
  if (octal > 255) {
@@ -5869,7 +5922,13 @@ function functionFlags(isAsync, isGenerator) {
5869
5922
  class UtilParser extends Tokenizer {
5870
5923
  addExtra(node, key, value, enumerable = true) {
5871
5924
  if (!node) return;
5872
- const extra = node.extra = node.extra || {};
5925
+ let {
5926
+ extra
5927
+ } = node;
5928
+ if (extra == null) {
5929
+ extra = {};
5930
+ node.extra = extra;
5931
+ }
5873
5932
  if (enumerable) {
5874
5933
  extra[key] = value;
5875
5934
  } else {
@@ -5913,11 +5972,10 @@ class UtilParser extends Tokenizer {
5913
5972
  return this.match(139) || this.match(8) || this.hasPrecedingLineBreak();
5914
5973
  }
5915
5974
  hasPrecedingLineBreak() {
5916
- return lineBreak.test(this.input.slice(this.state.lastTokEndLoc.index, this.state.start));
5975
+ return hasNewLine(this.input, this.state.lastTokEndLoc.index, this.state.start);
5917
5976
  }
5918
5977
  hasFollowingLineBreak() {
5919
- skipWhiteSpaceToLineBreak.lastIndex = this.state.end;
5920
- return skipWhiteSpaceToLineBreak.test(this.input);
5978
+ return hasNewLine(this.input, this.state.end, this.nextTokenStart());
5921
5979
  }
5922
5980
  isLineTerminator() {
5923
5981
  return this.eat(13) || this.canInsertSemicolon();
@@ -5927,7 +5985,9 @@ class UtilParser extends Tokenizer {
5927
5985
  this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
5928
5986
  }
5929
5987
  expect(type, loc) {
5930
- this.eat(type) || this.unexpected(loc, type);
5988
+ if (!this.eat(type)) {
5989
+ this.unexpected(loc, type);
5990
+ }
5931
5991
  }
5932
5992
  tryParse(fn, oldState = this.state.clone()) {
5933
5993
  const abortSignal = {
@@ -7532,7 +7592,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
7532
7592
  }
7533
7593
  forwardNoArrowParamsConversionAt(node, parse) {
7534
7594
  let result;
7535
- if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
7595
+ if (this.state.noArrowParamsConversionAt.includes(node.start)) {
7536
7596
  this.state.noArrowParamsConversionAt.push(this.state.start);
7537
7597
  result = parse();
7538
7598
  this.state.noArrowParamsConversionAt.pop();
@@ -8042,14 +8102,14 @@ var flow = superClass => class FlowParserMixin extends superClass {
8042
8102
  return this.match(14) || super.shouldParseArrow(params);
8043
8103
  }
8044
8104
  setArrowFunctionParameters(node, params) {
8045
- if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
8105
+ if (this.state.noArrowParamsConversionAt.includes(node.start)) {
8046
8106
  node.params = params;
8047
8107
  } else {
8048
8108
  super.setArrowFunctionParameters(node, params);
8049
8109
  }
8050
8110
  }
8051
8111
  checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
8052
- if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
8112
+ if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(node.start)) {
8053
8113
  return;
8054
8114
  }
8055
8115
  for (let i = 0; i < node.params.length; i++) {
@@ -8060,10 +8120,10 @@ var flow = superClass => class FlowParserMixin extends superClass {
8060
8120
  super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
8061
8121
  }
8062
8122
  parseParenAndDistinguishExpression(canBeArrow) {
8063
- return super.parseParenAndDistinguishExpression(canBeArrow && this.state.noArrowAt.indexOf(this.state.start) === -1);
8123
+ return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.state.start));
8064
8124
  }
8065
8125
  parseSubscripts(base, startLoc, noCalls) {
8066
- if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.indexOf(startLoc.index) !== -1) {
8126
+ if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.includes(startLoc.index)) {
8067
8127
  this.next();
8068
8128
  const node = this.startNodeAt(startLoc);
8069
8129
  node.callee = base;
@@ -9324,7 +9384,6 @@ class TypeScriptScopeHandler extends ScopeHandler {
9324
9384
  super.checkLocalExport(id);
9325
9385
  }
9326
9386
  }
9327
- const getOwn$1 = (object, key) => hasOwnProperty.call(object, key) && object[key];
9328
9387
  const unwrapParenthesizedExpression = node => {
9329
9388
  return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
9330
9389
  };
@@ -9583,25 +9642,26 @@ class LValParser extends NodeUtils {
9583
9642
  return this.finishNode(node, "AssignmentPattern");
9584
9643
  }
9585
9644
  isValidLVal(type, isUnparenthesizedInAssign, binding) {
9586
- return getOwn$1({
9587
- AssignmentPattern: "left",
9588
- RestElement: "argument",
9589
- ObjectProperty: "value",
9590
- ParenthesizedExpression: "expression",
9591
- ArrayPattern: "elements",
9592
- ObjectPattern: "properties"
9593
- }, type);
9645
+ switch (type) {
9646
+ case "AssignmentPattern":
9647
+ return "left";
9648
+ case "RestElement":
9649
+ return "argument";
9650
+ case "ObjectProperty":
9651
+ return "value";
9652
+ case "ParenthesizedExpression":
9653
+ return "expression";
9654
+ case "ArrayPattern":
9655
+ return "elements";
9656
+ case "ObjectPattern":
9657
+ return "properties";
9658
+ }
9659
+ return false;
9594
9660
  }
9595
9661
  isOptionalMemberExpression(expression) {
9596
9662
  return expression.type === "OptionalMemberExpression";
9597
9663
  }
9598
- checkLVal(expression, {
9599
- in: ancestor,
9600
- binding = 64,
9601
- checkClashes = false,
9602
- strictModeChanged = false,
9603
- hasParenthesizedAncestor = false
9604
- }) {
9664
+ checkLVal(expression, ancestor, binding = 64, checkClashes = false, strictModeChanged = false, hasParenthesizedAncestor = false) {
9605
9665
  var _expression$extra;
9606
9666
  const type = expression.type;
9607
9667
  if (this.isObjectMethod(expression)) return;
@@ -9643,20 +9703,25 @@ class LValParser extends NodeUtils {
9643
9703
  });
9644
9704
  return;
9645
9705
  }
9646
- const [key, isParenthesizedExpression] = Array.isArray(validity) ? validity : [validity, type === "ParenthesizedExpression"];
9706
+ let key, isParenthesizedExpression;
9707
+ if (typeof validity === "string") {
9708
+ key = validity;
9709
+ isParenthesizedExpression = type === "ParenthesizedExpression";
9710
+ } else {
9711
+ [key, isParenthesizedExpression] = validity;
9712
+ }
9647
9713
  const nextAncestor = type === "ArrayPattern" || type === "ObjectPattern" ? {
9648
9714
  type
9649
9715
  } : ancestor;
9650
- for (const child of [].concat(expression[key])) {
9651
- if (child) {
9652
- this.checkLVal(child, {
9653
- in: nextAncestor,
9654
- binding,
9655
- checkClashes,
9656
- strictModeChanged,
9657
- hasParenthesizedAncestor: isParenthesizedExpression
9658
- });
9716
+ const val = expression[key];
9717
+ if (Array.isArray(val)) {
9718
+ for (const child of val) {
9719
+ if (child) {
9720
+ this.checkLVal(child, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression);
9721
+ }
9659
9722
  }
9723
+ } else if (val) {
9724
+ this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression);
9660
9725
  }
9661
9726
  }
9662
9727
  checkIdentifier(at, bindingType, strictModeChanged = false) {
@@ -9704,7 +9769,6 @@ class LValParser extends NodeUtils {
9704
9769
  return true;
9705
9770
  }
9706
9771
  }
9707
- const getOwn = (object, key) => hasOwnProperty.call(object, key) && object[key];
9708
9772
  function nonNull(x) {
9709
9773
  if (x == null) {
9710
9774
  throw new Error(`Unexpected ${x} value.`);
@@ -9878,7 +9942,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
9878
9942
  return undefined;
9879
9943
  }
9880
9944
  const modifier = this.state.value;
9881
- if (allowedModifiers.indexOf(modifier) !== -1) {
9945
+ if (allowedModifiers.includes(modifier)) {
9882
9946
  if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) {
9883
9947
  return undefined;
9884
9948
  }
@@ -11887,15 +11951,21 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11887
11951
  }
11888
11952
  }
11889
11953
  isValidLVal(type, isUnparenthesizedInAssign, binding) {
11890
- return getOwn({
11891
- TSTypeCastExpression: true,
11892
- TSParameterProperty: "parameter",
11893
- TSNonNullExpression: "expression",
11894
- TSInstantiationExpression: "expression",
11895
- TSAsExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true],
11896
- TSSatisfiesExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true],
11897
- TSTypeAssertion: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true]
11898
- }, type) || super.isValidLVal(type, isUnparenthesizedInAssign, binding);
11954
+ switch (type) {
11955
+ case "TSTypeCastExpression":
11956
+ return true;
11957
+ case "TSParameterProperty":
11958
+ return "parameter";
11959
+ case "TSNonNullExpression":
11960
+ case "TSInstantiationExpression":
11961
+ return "expression";
11962
+ case "TSAsExpression":
11963
+ case "TSSatisfiesExpression":
11964
+ case "TSTypeAssertion":
11965
+ return (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true];
11966
+ default:
11967
+ return super.isValidLVal(type, isUnparenthesizedInAssign, binding);
11968
+ }
11899
11969
  }
11900
11970
  parseBindingAtom() {
11901
11971
  if (this.state.type === 78) {
@@ -12021,12 +12091,17 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
12021
12091
  return param;
12022
12092
  }
12023
12093
  tsInAmbientContext(cb) {
12024
- const oldIsAmbientContext = this.state.isAmbientContext;
12094
+ const {
12095
+ isAmbientContext: oldIsAmbientContext,
12096
+ strict: oldStrict
12097
+ } = this.state;
12025
12098
  this.state.isAmbientContext = true;
12099
+ this.state.strict = false;
12026
12100
  try {
12027
12101
  return cb();
12028
12102
  } finally {
12029
12103
  this.state.isAmbientContext = oldIsAmbientContext;
12104
+ this.state.strict = oldStrict;
12030
12105
  }
12031
12106
  }
12032
12107
  parseClass(node, isStatement, optionalId) {
@@ -12437,107 +12512,71 @@ var v8intrinsic = superClass => class V8IntrinsicMixin extends superClass {
12437
12512
  return this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors);
12438
12513
  }
12439
12514
  };
12440
- function hasPlugin(plugins, expectedConfig) {
12441
- const [expectedName, expectedOptions] = typeof expectedConfig === "string" ? [expectedConfig, {}] : expectedConfig;
12442
- const expectedKeys = Object.keys(expectedOptions);
12443
- const expectedOptionsIsEmpty = expectedKeys.length === 0;
12444
- return plugins.some(p => {
12445
- if (typeof p === "string") {
12446
- return expectedOptionsIsEmpty && p === expectedName;
12447
- } else {
12448
- const [pluginName, pluginOptions] = p;
12449
- if (pluginName !== expectedName) {
12450
- return false;
12451
- }
12452
- for (const key of expectedKeys) {
12453
- if (pluginOptions[key] !== expectedOptions[key]) {
12454
- return false;
12455
- }
12456
- }
12457
- return true;
12458
- }
12459
- });
12460
- }
12461
- function getPluginOption(plugins, name, option) {
12462
- const plugin = plugins.find(plugin => {
12463
- if (Array.isArray(plugin)) {
12464
- return plugin[0] === name;
12465
- } else {
12466
- return plugin === name;
12467
- }
12468
- });
12469
- if (plugin && Array.isArray(plugin) && plugin.length > 1) {
12470
- return plugin[1][option];
12471
- }
12472
- return null;
12473
- }
12474
12515
  const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"];
12475
12516
  const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"];
12476
- function validatePlugins(plugins) {
12477
- if (hasPlugin(plugins, "decorators")) {
12478
- if (hasPlugin(plugins, "decorators-legacy")) {
12517
+ function validatePlugins(pluginsMap) {
12518
+ if (pluginsMap.has("decorators")) {
12519
+ if (pluginsMap.has("decorators-legacy")) {
12479
12520
  throw new Error("Cannot use the decorators and decorators-legacy plugin together");
12480
12521
  }
12481
- const decoratorsBeforeExport = getPluginOption(plugins, "decorators", "decoratorsBeforeExport");
12522
+ const decoratorsBeforeExport = pluginsMap.get("decorators").decoratorsBeforeExport;
12482
12523
  if (decoratorsBeforeExport != null && typeof decoratorsBeforeExport !== "boolean") {
12483
12524
  throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");
12484
12525
  }
12485
- const allowCallParenthesized = getPluginOption(plugins, "decorators", "allowCallParenthesized");
12526
+ const allowCallParenthesized = pluginsMap.get("decorators").allowCallParenthesized;
12486
12527
  if (allowCallParenthesized != null && typeof allowCallParenthesized !== "boolean") {
12487
12528
  throw new Error("'allowCallParenthesized' must be a boolean.");
12488
12529
  }
12489
12530
  }
12490
- if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) {
12531
+ if (pluginsMap.has("flow") && pluginsMap.has("typescript")) {
12491
12532
  throw new Error("Cannot combine flow and typescript plugins.");
12492
12533
  }
12493
- if (hasPlugin(plugins, "placeholders") && hasPlugin(plugins, "v8intrinsic")) {
12534
+ if (pluginsMap.has("placeholders") && pluginsMap.has("v8intrinsic")) {
12494
12535
  throw new Error("Cannot combine placeholders and v8intrinsic plugins.");
12495
12536
  }
12496
- if (hasPlugin(plugins, "pipelineOperator")) {
12497
- const proposal = getPluginOption(plugins, "pipelineOperator", "proposal");
12537
+ if (pluginsMap.has("pipelineOperator")) {
12538
+ var _pluginsMap$get;
12539
+ const proposal = pluginsMap.get("pipelineOperator").proposal;
12498
12540
  if (!PIPELINE_PROPOSALS.includes(proposal)) {
12499
12541
  const proposalList = PIPELINE_PROPOSALS.map(p => `"${p}"`).join(", ");
12500
12542
  throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);
12501
12543
  }
12502
- const recordAndTupleConfigItem = ["recordAndTuple", {
12503
- syntaxType: "hash"
12504
- }];
12505
- const tupleSyntaxIsHash = hasPlugin(plugins, recordAndTupleConfigItem);
12544
+ const tupleSyntaxIsHash = ((_pluginsMap$get = pluginsMap.get("recordAndTuple")) == null ? void 0 : _pluginsMap$get.syntaxType) === "hash";
12506
12545
  if (proposal === "hack") {
12507
- if (hasPlugin(plugins, "placeholders")) {
12546
+ if (pluginsMap.has("placeholders")) {
12508
12547
  throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
12509
12548
  }
12510
- if (hasPlugin(plugins, "v8intrinsic")) {
12549
+ if (pluginsMap.has("v8intrinsic")) {
12511
12550
  throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");
12512
12551
  }
12513
- const topicToken = getPluginOption(plugins, "pipelineOperator", "topicToken");
12552
+ const topicToken = pluginsMap.get("pipelineOperator").topicToken;
12514
12553
  if (!TOPIC_TOKENS.includes(topicToken)) {
12515
12554
  const tokenList = TOPIC_TOKENS.map(t => `"${t}"`).join(", ");
12516
12555
  throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
12517
12556
  }
12518
12557
  if (topicToken === "#" && tupleSyntaxIsHash) {
12519
- throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(recordAndTupleConfigItem)}\`.`);
12558
+ throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple", pluginsMap.get("recordAndTuple")])}\`.`);
12520
12559
  }
12521
12560
  } else if (proposal === "smart" && tupleSyntaxIsHash) {
12522
- throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(recordAndTupleConfigItem)}\`.`);
12561
+ throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple", pluginsMap.get("recordAndTuple")])}\`.`);
12523
12562
  }
12524
12563
  }
12525
- if (hasPlugin(plugins, "moduleAttributes")) {
12564
+ if (pluginsMap.has("moduleAttributes")) {
12526
12565
  {
12527
- if (hasPlugin(plugins, "importAssertions") || hasPlugin(plugins, "importAttributes")) {
12566
+ if (pluginsMap.has("importAttributes") || pluginsMap.has("importAssertions")) {
12528
12567
  throw new Error("Cannot combine importAssertions, importAttributes and moduleAttributes plugins.");
12529
12568
  }
12530
- const moduleAttributesVersionPluginOption = getPluginOption(plugins, "moduleAttributes", "version");
12569
+ const moduleAttributesVersionPluginOption = pluginsMap.get("moduleAttributes").version;
12531
12570
  if (moduleAttributesVersionPluginOption !== "may-2020") {
12532
12571
  throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
12533
12572
  }
12534
12573
  }
12535
12574
  }
12536
- if (hasPlugin(plugins, "importAssertions") && hasPlugin(plugins, "importAttributes")) {
12575
+ if (pluginsMap.has("importAttributes") && pluginsMap.has("importAssertions")) {
12537
12576
  throw new Error("Cannot combine importAssertions and importAttributes plugins.");
12538
12577
  }
12539
- if (hasPlugin(plugins, "recordAndTuple")) {
12540
- const syntaxType = getPluginOption(plugins, "recordAndTuple", "syntaxType");
12578
+ if (pluginsMap.has("recordAndTuple")) {
12579
+ const syntaxType = pluginsMap.get("recordAndTuple").syntaxType;
12541
12580
  if (syntaxType != null) {
12542
12581
  {
12543
12582
  const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
@@ -12547,12 +12586,12 @@ function validatePlugins(plugins) {
12547
12586
  }
12548
12587
  }
12549
12588
  }
12550
- if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) {
12589
+ if (pluginsMap.has("asyncDoExpressions") && !pluginsMap.has("doExpressions")) {
12551
12590
  const error = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");
12552
12591
  error.missingPlugins = "doExpressions";
12553
12592
  throw error;
12554
12593
  }
12555
- if (hasPlugin(plugins, "optionalChainingAssign") && getPluginOption(plugins, "optionalChainingAssign", "version") !== "2023-07") {
12594
+ if (pluginsMap.has("optionalChainingAssign") && pluginsMap.get("optionalChainingAssign").version !== "2023-07") {
12556
12595
  throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is '2023-07'.");
12557
12596
  }
12558
12597
  }
@@ -12723,9 +12762,7 @@ class ExpressionParser extends LValParser {
12723
12762
  }
12724
12763
  this.next();
12725
12764
  node.right = this.parseMaybeAssign();
12726
- this.checkLVal(left, {
12727
- in: this.finishNode(node, "AssignmentExpression")
12728
- });
12765
+ this.checkLVal(left, this.finishNode(node, "AssignmentExpression"));
12729
12766
  return node;
12730
12767
  } else if (ownExpressionErrors) {
12731
12768
  this.checkExpressionErrors(refExpressionErrors, true);
@@ -12866,7 +12903,7 @@ class ExpressionParser extends LValParser {
12866
12903
  parseMaybeUnary(refExpressionErrors, sawUnary) {
12867
12904
  const startLoc = this.state.startLoc;
12868
12905
  const isAwait = this.isContextual(96);
12869
- if (isAwait && this.isAwaitAllowed()) {
12906
+ if (isAwait && this.recordAwaitIfAllowed()) {
12870
12907
  this.next();
12871
12908
  const expr = this.parseAwait(startLoc);
12872
12909
  if (!sawUnary) this.checkExponentialAfterUnary(expr);
@@ -12915,9 +12952,7 @@ class ExpressionParser extends LValParser {
12915
12952
  parseUpdate(node, update, refExpressionErrors) {
12916
12953
  if (update) {
12917
12954
  const updateExpressionNode = node;
12918
- this.checkLVal(updateExpressionNode.argument, {
12919
- in: this.finishNode(updateExpressionNode, "UpdateExpression")
12920
- });
12955
+ this.checkLVal(updateExpressionNode.argument, this.finishNode(updateExpressionNode, "UpdateExpression"));
12921
12956
  return node;
12922
12957
  }
12923
12958
  const startLoc = this.state.startLoc;
@@ -12929,9 +12964,7 @@ class ExpressionParser extends LValParser {
12929
12964
  node.prefix = false;
12930
12965
  node.argument = expr;
12931
12966
  this.next();
12932
- this.checkLVal(expr, {
12933
- in: expr = this.finishNode(node, "UpdateExpression")
12934
- });
12967
+ this.checkLVal(expr, expr = this.finishNode(node, "UpdateExpression"));
12935
12968
  }
12936
12969
  return expr;
12937
12970
  }
@@ -13498,10 +13531,12 @@ class ExpressionParser extends LValParser {
13498
13531
  return this.parseLiteral(value, "DecimalLiteral");
13499
13532
  }
13500
13533
  parseRegExpLiteral(value) {
13501
- const node = this.parseLiteral(value.value, "RegExpLiteral");
13534
+ const node = this.startNode();
13535
+ this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
13502
13536
  node.pattern = value.pattern;
13503
13537
  node.flags = value.flags;
13504
- return node;
13538
+ this.next();
13539
+ return this.finishNode(node, "RegExpLiteral");
13505
13540
  }
13506
13541
  parseBooleanLiteral(value) {
13507
13542
  const node = this.startNode();
@@ -14001,12 +14036,7 @@ class ExpressionParser extends LValParser {
14001
14036
  type: "FormalParameters"
14002
14037
  };
14003
14038
  for (const param of node.params) {
14004
- this.checkLVal(param, {
14005
- in: formalParameters,
14006
- binding: 5,
14007
- checkClashes,
14008
- strictModeChanged
14009
- });
14039
+ this.checkLVal(param, formalParameters, 5, checkClashes, strictModeChanged);
14010
14040
  }
14011
14041
  }
14012
14042
  parseExprList(close, allowEmpty, refExpressionErrors, nodeForExtra) {
@@ -14127,12 +14157,12 @@ class ExpressionParser extends LValParser {
14127
14157
  }
14128
14158
  }
14129
14159
  }
14130
- isAwaitAllowed() {
14131
- if (this.prodParam.hasAwait) return true;
14132
- if (this.options.allowAwaitOutsideFunction && !this.scope.inFunction) {
14133
- return true;
14160
+ recordAwaitIfAllowed() {
14161
+ const isAwaitAllowed = this.prodParam.hasAwait || this.options.allowAwaitOutsideFunction && !this.scope.inFunction;
14162
+ if (isAwaitAllowed && !this.scope.inFunction) {
14163
+ this.state.hasTopLevelAwait = true;
14134
14164
  }
14135
- return false;
14165
+ return isAwaitAllowed;
14136
14166
  }
14137
14167
  parseAwait(startLoc) {
14138
14168
  const node = this.startNodeAt(startLoc);
@@ -14471,12 +14501,15 @@ class StatementParser extends ExpressionParser {
14471
14501
  program.sourceType = sourceType;
14472
14502
  program.interpreter = this.parseInterpreterDirective();
14473
14503
  this.parseBlockBody(program, true, true, end);
14474
- if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
14475
- for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
14476
- this.raise(Errors.ModuleExportUndefined, at, {
14477
- localName
14478
- });
14504
+ if (this.inModule) {
14505
+ if (!this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
14506
+ for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
14507
+ this.raise(Errors.ModuleExportUndefined, at, {
14508
+ localName
14509
+ });
14510
+ }
14479
14511
  }
14512
+ this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
14480
14513
  }
14481
14514
  let finishedProgram;
14482
14515
  if (end === 139) {
@@ -14540,10 +14573,10 @@ class StatementParser extends ExpressionParser {
14540
14573
  const nextCh = this.codePointAtPos(next);
14541
14574
  return this.chStartsBindingPattern(nextCh) || this.chStartsBindingIdentifier(nextCh, next);
14542
14575
  }
14543
- hasInLineFollowingBindingIdentifier() {
14576
+ hasInLineFollowingBindingIdentifierOrBrace() {
14544
14577
  const next = this.nextTokenInLineStart();
14545
14578
  const nextCh = this.codePointAtPos(next);
14546
- return this.chStartsBindingIdentifier(nextCh, next);
14579
+ return nextCh === 123 || this.chStartsBindingIdentifier(nextCh, next);
14547
14580
  }
14548
14581
  startsUsingForOf() {
14549
14582
  const {
@@ -14596,12 +14629,12 @@ class StatementParser extends ExpressionParser {
14596
14629
  return this.parseStatementContent(flags, decorators);
14597
14630
  }
14598
14631
  parseStatementContent(flags, decorators) {
14599
- const starttype = this.state.type;
14632
+ const startType = this.state.type;
14600
14633
  const node = this.startNode();
14601
14634
  const allowDeclaration = !!(flags & 2);
14602
14635
  const allowFunctionDeclaration = !!(flags & 4);
14603
14636
  const topLevel = flags & 1;
14604
- switch (starttype) {
14637
+ switch (startType) {
14605
14638
  case 60:
14606
14639
  return this.parseBreakContinueStatement(node, true);
14607
14640
  case 63:
@@ -14633,7 +14666,7 @@ class StatementParser extends ExpressionParser {
14633
14666
  return this.parseTryStatement(node);
14634
14667
  case 96:
14635
14668
  if (!this.state.containsEsc && this.startsAwaitUsing()) {
14636
- if (!this.isAwaitAllowed()) {
14669
+ if (!this.recordAwaitIfAllowed()) {
14637
14670
  this.raise(Errors.AwaitUsingNotInAsyncContext, node);
14638
14671
  } else if (!allowDeclaration) {
14639
14672
  this.raise(Errors.UnexpectedLexicalDeclaration, node);
@@ -14643,7 +14676,7 @@ class StatementParser extends ExpressionParser {
14643
14676
  }
14644
14677
  break;
14645
14678
  case 107:
14646
- if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifier()) {
14679
+ if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) {
14647
14680
  break;
14648
14681
  }
14649
14682
  this.expectPlugin("explicitResourceManagement");
@@ -14700,7 +14733,7 @@ class StatementParser extends ExpressionParser {
14700
14733
  }
14701
14734
  this.next();
14702
14735
  let result;
14703
- if (starttype === 83) {
14736
+ if (startType === 83) {
14704
14737
  result = this.parseImport(node);
14705
14738
  if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
14706
14739
  this.sawUnambiguousESM = true;
@@ -14727,7 +14760,7 @@ class StatementParser extends ExpressionParser {
14727
14760
  }
14728
14761
  const maybeName = this.state.value;
14729
14762
  const expr = this.parseExpression();
14730
- if (tokenIsIdentifier(starttype) && expr.type === "Identifier" && this.eat(14)) {
14763
+ if (tokenIsIdentifier(startType) && expr.type === "Identifier" && this.eat(14)) {
14731
14764
  return this.parseLabeledStatement(node, maybeName, expr, flags);
14732
14765
  } else {
14733
14766
  return this.parseExpressionStatement(node, expr, decorators);
@@ -14880,8 +14913,9 @@ class StatementParser extends ExpressionParser {
14880
14913
  this.next();
14881
14914
  this.state.labels.push(loopLabel);
14882
14915
  let awaitAt = null;
14883
- if (this.isAwaitAllowed() && this.eatContextual(96)) {
14884
- awaitAt = this.state.lastTokStartLoc;
14916
+ if (this.isContextual(96) && this.recordAwaitIfAllowed()) {
14917
+ awaitAt = this.state.startLoc;
14918
+ this.next();
14885
14919
  }
14886
14920
  this.scope.enter(0);
14887
14921
  this.expect(10);
@@ -14901,7 +14935,7 @@ class StatementParser extends ExpressionParser {
14901
14935
  let kind;
14902
14936
  if (startsWithAwaitUsing) {
14903
14937
  kind = "await using";
14904
- if (!this.isAwaitAllowed()) {
14938
+ if (!this.recordAwaitIfAllowed()) {
14905
14939
  this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
14906
14940
  }
14907
14941
  this.next();
@@ -14941,9 +14975,7 @@ class StatementParser extends ExpressionParser {
14941
14975
  this.toAssignable(init, true);
14942
14976
  const type = isForOf ? "ForOfStatement" : "ForInStatement";
14943
14977
  this.checkLVal(init, {
14944
- in: {
14945
- type
14946
- }
14978
+ type
14947
14979
  });
14948
14980
  return this.parseForIn(node, init, awaitAt);
14949
14981
  } else {
@@ -15030,11 +15062,8 @@ class StatementParser extends ExpressionParser {
15030
15062
  const param = this.parseBindingAtom();
15031
15063
  this.scope.enter(this.options.annexB && param.type === "Identifier" ? 8 : 0);
15032
15064
  this.checkLVal(param, {
15033
- in: {
15034
- type: "CatchClause"
15035
- },
15036
- binding: 9
15037
- });
15065
+ type: "CatchClause"
15066
+ }, 9);
15038
15067
  return param;
15039
15068
  }
15040
15069
  parseTryStatement(node) {
@@ -15237,12 +15266,14 @@ class StatementParser extends ExpressionParser {
15237
15266
  }
15238
15267
  parseVarId(decl, kind) {
15239
15268
  const id = this.parseBindingAtom();
15269
+ if (kind === "using" || kind === "await using") {
15270
+ if (id.type === "ArrayPattern" || id.type === "ObjectPattern") {
15271
+ this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start);
15272
+ }
15273
+ }
15240
15274
  this.checkLVal(id, {
15241
- in: {
15242
- type: "VariableDeclarator"
15243
- },
15244
- binding: kind === "var" ? 5 : 8201
15245
- });
15275
+ type: "VariableDeclarator"
15276
+ }, kind === "var" ? 5 : 8201);
15246
15277
  decl.id = id;
15247
15278
  }
15248
15279
  parseAsyncFunctionExpression(node) {
@@ -15936,7 +15967,7 @@ class StatementParser extends ExpressionParser {
15936
15967
  parseModuleExportName() {
15937
15968
  if (this.match(133)) {
15938
15969
  const result = this.parseStringLiteral(this.state.value);
15939
- const surrogate = result.value.match(loneSurrogate);
15970
+ const surrogate = loneSurrogate.exec(result.value);
15940
15971
  if (surrogate) {
15941
15972
  this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, {
15942
15973
  surrogateCharCode: surrogate[0].charCodeAt(0)
@@ -16087,11 +16118,8 @@ class StatementParser extends ExpressionParser {
16087
16118
  }
16088
16119
  finishImportSpecifier(specifier, type, bindingType = 8201) {
16089
16120
  this.checkLVal(specifier.local, {
16090
- in: {
16091
- type
16092
- },
16093
- binding: bindingType
16094
- });
16121
+ type
16122
+ }, bindingType);
16095
16123
  return this.finishNode(specifier, type);
16096
16124
  }
16097
16125
  parseImportAttributes() {
@@ -16257,12 +16285,12 @@ class StatementParser extends ExpressionParser {
16257
16285
  }
16258
16286
  }
16259
16287
  let Parser$2 = class Parser extends StatementParser {
16260
- constructor(options, input) {
16288
+ constructor(options, input, pluginsMap) {
16261
16289
  options = getOptions(options);
16262
16290
  super(options, input);
16263
16291
  this.options = options;
16264
16292
  this.initializeScopes();
16265
- this.plugins = pluginsMap(this.options.plugins);
16293
+ this.plugins = pluginsMap;
16266
16294
  this.filename = options.sourceFilename;
16267
16295
  }
16268
16296
  getScopeHandler() {
@@ -16280,14 +16308,6 @@ let Parser$2 = class Parser extends StatementParser {
16280
16308
  return file;
16281
16309
  }
16282
16310
  };
16283
- function pluginsMap(plugins) {
16284
- const pluginMap = new Map();
16285
- for (const plugin of plugins) {
16286
- const [name, options] = Array.isArray(plugin) ? plugin : [plugin, {}];
16287
- if (!pluginMap.has(name)) pluginMap.set(name, options || {});
16288
- }
16289
- return pluginMap;
16290
- }
16291
16311
  function parse$9(input, options) {
16292
16312
  var _options;
16293
16313
  if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
@@ -16336,23 +16356,40 @@ function generateExportedTokenTypes(internalTokenTypes) {
16336
16356
  const tokTypes = generateExportedTokenTypes(tt);
16337
16357
  function getParser(options, input) {
16338
16358
  let cls = Parser$2;
16359
+ const pluginsMap = new Map();
16339
16360
  if (options != null && options.plugins) {
16340
- validatePlugins(options.plugins);
16341
- cls = getParserClass(options.plugins);
16361
+ for (const plugin of options.plugins) {
16362
+ let name, opts;
16363
+ if (typeof plugin === "string") {
16364
+ name = plugin;
16365
+ } else {
16366
+ [name, opts] = plugin;
16367
+ }
16368
+ if (!pluginsMap.has(name)) {
16369
+ pluginsMap.set(name, opts || {});
16370
+ }
16371
+ }
16372
+ validatePlugins(pluginsMap);
16373
+ cls = getParserClass(pluginsMap);
16342
16374
  }
16343
- return new cls(options, input);
16375
+ return new cls(options, input, pluginsMap);
16344
16376
  }
16345
- const parserClassCache = {};
16346
- function getParserClass(pluginsFromOptions) {
16347
- const pluginList = mixinPluginNames.filter(name => hasPlugin(pluginsFromOptions, name));
16348
- const key = pluginList.join("/");
16349
- let cls = parserClassCache[key];
16377
+ const parserClassCache = new Map();
16378
+ function getParserClass(pluginsMap) {
16379
+ const pluginList = [];
16380
+ for (const name of mixinPluginNames) {
16381
+ if (pluginsMap.has(name)) {
16382
+ pluginList.push(name);
16383
+ }
16384
+ }
16385
+ const key = pluginList.join("|");
16386
+ let cls = parserClassCache.get(key);
16350
16387
  if (!cls) {
16351
16388
  cls = Parser$2;
16352
16389
  for (const plugin of pluginList) {
16353
16390
  cls = mixinPlugins[plugin](cls);
16354
16391
  }
16355
- parserClassCache[key] = cls;
16392
+ parserClassCache.set(key, cls);
16356
16393
  }
16357
16394
  return cls;
16358
16395
  }
@@ -16595,6 +16632,16 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
16595
16632
  (id) => markScopeIdentifier(node, id, knownIds)
16596
16633
  );
16597
16634
  }
16635
+ } else if (node.type === "CatchClause" && node.param) {
16636
+ for (const id of extractIdentifiers$1(node.param)) {
16637
+ markScopeIdentifier(node, id, knownIds);
16638
+ }
16639
+ } else if (isForStatement(node)) {
16640
+ walkForStatement(
16641
+ node,
16642
+ false,
16643
+ (id) => markScopeIdentifier(node, id, knownIds)
16644
+ );
16598
16645
  }
16599
16646
  },
16600
16647
  leave(node, parent) {
@@ -16675,14 +16722,20 @@ function walkBlockDeclarations(block, onIdent) {
16675
16722
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
16676
16723
  if (stmt.declare || !stmt.id) continue;
16677
16724
  onIdent(stmt.id);
16678
- } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
16679
- const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
16680
- if (variable && variable.type === "VariableDeclaration") {
16681
- for (const decl of variable.declarations) {
16682
- for (const id of extractIdentifiers$1(decl.id)) {
16683
- onIdent(id);
16684
- }
16685
- }
16725
+ } else if (isForStatement(stmt)) {
16726
+ walkForStatement(stmt, true, onIdent);
16727
+ }
16728
+ }
16729
+ }
16730
+ function isForStatement(stmt) {
16731
+ return stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement";
16732
+ }
16733
+ function walkForStatement(stmt, isVar, onIdent) {
16734
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
16735
+ if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar : !isVar)) {
16736
+ for (const decl of variable.declarations) {
16737
+ for (const id of extractIdentifiers$1(decl.id)) {
16738
+ onIdent(id);
16686
16739
  }
16687
16740
  }
16688
16741
  }
@@ -16769,7 +16822,7 @@ function isReferenced(node, parent, grandparent) {
16769
16822
  if (parent.key === node) {
16770
16823
  return !!parent.computed;
16771
16824
  }
16772
- return !grandparent ;
16825
+ return !grandparent;
16773
16826
  case "ClassProperty":
16774
16827
  if (parent.key === node) {
16775
16828
  return !!parent.computed;
@@ -23699,7 +23752,7 @@ function resolveComponentType(node, context, ssr = false) {
23699
23752
  } else {
23700
23753
  exp = isProp.exp;
23701
23754
  if (!exp) {
23702
- exp = createSimpleExpression(`is`, false, isProp.loc);
23755
+ exp = createSimpleExpression(`is`, false, isProp.arg.loc);
23703
23756
  {
23704
23757
  exp = isProp.exp = processExpression(exp, context);
23705
23758
  }
@@ -24633,15 +24686,27 @@ const BindingTypes = {
24633
24686
  const noopDirectiveTransform = () => ({ props: [] });
24634
24687
 
24635
24688
  const V_MODEL_RADIO = Symbol(`vModelRadio` );
24636
- const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
24689
+ const V_MODEL_CHECKBOX = Symbol(
24690
+ `vModelCheckbox`
24691
+ );
24637
24692
  const V_MODEL_TEXT = Symbol(`vModelText` );
24638
- const V_MODEL_SELECT = Symbol(`vModelSelect` );
24639
- const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
24640
- const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
24641
- const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
24693
+ const V_MODEL_SELECT = Symbol(
24694
+ `vModelSelect`
24695
+ );
24696
+ const V_MODEL_DYNAMIC = Symbol(
24697
+ `vModelDynamic`
24698
+ );
24699
+ const V_ON_WITH_MODIFIERS = Symbol(
24700
+ `vOnModifiersGuard`
24701
+ );
24702
+ const V_ON_WITH_KEYS = Symbol(
24703
+ `vOnKeysGuard`
24704
+ );
24642
24705
  const V_SHOW = Symbol(`vShow` );
24643
24706
  const TRANSITION = Symbol(`Transition` );
24644
- const TRANSITION_GROUP = Symbol(`TransitionGroup` );
24707
+ const TRANSITION_GROUP = Symbol(
24708
+ `TransitionGroup`
24709
+ );
24645
24710
  registerRuntimeHelpers({
24646
24711
  [V_MODEL_RADIO]: `vModelRadio`,
24647
24712
  [V_MODEL_CHECKBOX]: `vModelCheckbox`,
@@ -30947,11 +31012,17 @@ const SSR_RENDER_ATTRS = Symbol(`ssrRenderAttrs`);
30947
31012
  const SSR_RENDER_ATTR = Symbol(`ssrRenderAttr`);
30948
31013
  const SSR_RENDER_DYNAMIC_ATTR = Symbol(`ssrRenderDynamicAttr`);
30949
31014
  const SSR_RENDER_LIST = Symbol(`ssrRenderList`);
30950
- const SSR_INCLUDE_BOOLEAN_ATTR = Symbol(`ssrIncludeBooleanAttr`);
31015
+ const SSR_INCLUDE_BOOLEAN_ATTR = Symbol(
31016
+ `ssrIncludeBooleanAttr`
31017
+ );
30951
31018
  const SSR_LOOSE_EQUAL = Symbol(`ssrLooseEqual`);
30952
31019
  const SSR_LOOSE_CONTAIN = Symbol(`ssrLooseContain`);
30953
- const SSR_RENDER_DYNAMIC_MODEL = Symbol(`ssrRenderDynamicModel`);
30954
- const SSR_GET_DYNAMIC_MODEL_PROPS = Symbol(`ssrGetDynamicModelProps`);
31020
+ const SSR_RENDER_DYNAMIC_MODEL = Symbol(
31021
+ `ssrRenderDynamicModel`
31022
+ );
31023
+ const SSR_GET_DYNAMIC_MODEL_PROPS = Symbol(
31024
+ `ssrGetDynamicModelProps`
31025
+ );
30955
31026
  const SSR_RENDER_TELEPORT = Symbol(`ssrRenderTeleport`);
30956
31027
  const SSR_RENDER_SUSPENSE = Symbol(`ssrRenderSuspense`);
30957
31028
  const SSR_GET_DIRECTIVE_PROPS = Symbol(`ssrGetDirectiveProps`);
@@ -31019,10 +31090,7 @@ function processIfBranch(branch, context, disableNestedFragments = false) {
31019
31090
  return processChildrenAsStatement(branch, context, needFragmentWrapper);
31020
31091
  }
31021
31092
 
31022
- const ssrTransformFor = createStructuralDirectiveTransform(
31023
- "for",
31024
- processFor
31025
- );
31093
+ const ssrTransformFor = createStructuralDirectiveTransform("for", processFor);
31026
31094
  function ssrProcessFor(node, context, disableNestedFragments = false) {
31027
31095
  const needFragmentWrapper = !disableNestedFragments && (node.children.length !== 1 || node.children[0].type !== 1);
31028
31096
  const renderLoop = createFunctionExpression(
@@ -31285,6 +31353,25 @@ const ssrTransformElement = (node, context) => {
31285
31353
  ])
31286
31354
  ];
31287
31355
  }
31356
+ } else if (directives.length && !node.children.length) {
31357
+ const tempId = `_temp${context.temps++}`;
31358
+ propsExp.arguments = [
31359
+ createAssignmentExpression(
31360
+ createSimpleExpression(tempId, false),
31361
+ mergedProps
31362
+ )
31363
+ ];
31364
+ rawChildrenMap.set(
31365
+ node,
31366
+ createConditionalExpression(
31367
+ createSimpleExpression(`"textContent" in ${tempId}`, false),
31368
+ createCallExpression(context.helper(SSR_INTERPOLATE), [
31369
+ createSimpleExpression(`${tempId}.textContent`, false)
31370
+ ]),
31371
+ createSimpleExpression(`${tempId}.innerHTML ?? ''`, false),
31372
+ false
31373
+ )
31374
+ );
31288
31375
  }
31289
31376
  if (needTagForRuntime) {
31290
31377
  propsExp.arguments.push(`"${node.tag}"`);
@@ -31573,7 +31660,7 @@ function ssrProcessTransitionGroup(node, context) {
31573
31660
  context.pushStringPart(` ${scopeId}`);
31574
31661
  }
31575
31662
  context.pushStringPart(`>`);
31576
- processChildren(node, context, false, true);
31663
+ processChildren(node, context, false, true, true);
31577
31664
  context.pushStringPart(`</${tag.value.content}>`);
31578
31665
  }
31579
31666
  } else {
@@ -33956,12 +34043,14 @@ let PreviousMap$2 = class PreviousMap {
33956
34043
  let charsetUri = /^data:application\/json;charset=utf-?8,/;
33957
34044
  let uri = /^data:application\/json,/;
33958
34045
 
33959
- if (charsetUri.test(text) || uri.test(text)) {
33960
- return decodeURIComponent(text.substr(RegExp.lastMatch.length))
34046
+ let uriMatch = text.match(charsetUri) || text.match(uri);
34047
+ if (uriMatch) {
34048
+ return decodeURIComponent(text.substr(uriMatch[0].length))
33961
34049
  }
33962
34050
 
33963
- if (baseCharsetUri.test(text) || baseUri.test(text)) {
33964
- return fromBase64(text.substr(RegExp.lastMatch.length))
34051
+ let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri);
34052
+ if (baseUriMatch) {
34053
+ return fromBase64(text.substr(baseUriMatch[0].length))
33965
34054
  }
33966
34055
 
33967
34056
  let encoding = text.match(/data:application\/json;([^,]+),/)[1];
@@ -33982,7 +34071,7 @@ let PreviousMap$2 = class PreviousMap {
33982
34071
  }
33983
34072
 
33984
34073
  loadAnnotation(css) {
33985
- let comments = css.match(/\/\*\s*# sourceMappingURL=/gm);
34074
+ let comments = css.match(/\/\*\s*# sourceMappingURL=/g);
33986
34075
  if (!comments) return
33987
34076
 
33988
34077
  // sourceMappingURLs from comments, strings, etc.
@@ -34378,7 +34467,7 @@ let MapGenerator$2 = class MapGenerator {
34378
34467
  }
34379
34468
  }
34380
34469
  } else if (this.css) {
34381
- this.css = this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm, '');
34470
+ this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '');
34382
34471
  }
34383
34472
  }
34384
34473
 
@@ -34697,11 +34786,11 @@ function cleanSource(nodes) {
34697
34786
  })
34698
34787
  }
34699
34788
 
34700
- function markDirtyUp(node) {
34789
+ function markTreeDirty(node) {
34701
34790
  node[isClean$1] = false;
34702
34791
  if (node.proxyOf.nodes) {
34703
34792
  for (let i of node.proxyOf.nodes) {
34704
- markDirtyUp(i);
34793
+ markTreeDirty(i);
34705
34794
  }
34706
34795
  }
34707
34796
  }
@@ -34835,7 +34924,11 @@ let Container$7 = class Container extends Node$1 {
34835
34924
  insertBefore(exist, add) {
34836
34925
  let existIndex = this.index(exist);
34837
34926
  let type = existIndex === 0 ? 'prepend' : false;
34838
- let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();
34927
+ let nodes = this.normalize(
34928
+ add,
34929
+ this.proxyOf.nodes[existIndex],
34930
+ type
34931
+ ).reverse();
34839
34932
  existIndex = this.index(exist);
34840
34933
  for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node);
34841
34934
 
@@ -34876,7 +34969,7 @@ let Container$7 = class Container extends Node$1 {
34876
34969
  nodes.value = String(nodes.value);
34877
34970
  }
34878
34971
  nodes = [new Declaration$3(nodes)];
34879
- } else if (nodes.selector) {
34972
+ } else if (nodes.selector || nodes.selectors) {
34880
34973
  nodes = [new Rule$4(nodes)];
34881
34974
  } else if (nodes.name) {
34882
34975
  nodes = [new AtRule$4(nodes)];
@@ -34891,7 +34984,7 @@ let Container$7 = class Container extends Node$1 {
34891
34984
  if (!i[my$1]) Container.rebuild(i);
34892
34985
  i = i.proxyOf;
34893
34986
  if (i.parent) i.parent.removeChild(i);
34894
- if (i[isClean$1]) markDirtyUp(i);
34987
+ if (i[isClean$1]) markTreeDirty(i);
34895
34988
  if (typeof i.raws.before === 'undefined') {
34896
34989
  if (sample && typeof sample.raws.before !== 'undefined') {
34897
34990
  i.raws.before = sample.raws.before.replace(/\S/g, '');
@@ -36752,7 +36845,7 @@ let Root$2 = root$2;
36752
36845
 
36753
36846
  let Processor$1 = class Processor {
36754
36847
  constructor(plugins = []) {
36755
- this.version = '8.4.39';
36848
+ this.version = '8.4.41';
36756
36849
  this.plugins = this.normalize(plugins);
36757
36850
  }
36758
36851
 
@@ -37424,7 +37517,7 @@ types.UNIVERSAL = UNIVERSAL;
37424
37517
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37425
37518
  function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37426
37519
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
37427
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike ) { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
37520
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
37428
37521
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37429
37522
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
37430
37523
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -44165,6 +44258,20 @@ for (let i = 0; i < chars.length; i++) {
44165
44258
  intToChar[i] = c;
44166
44259
  charToInt[c] = i;
44167
44260
  }
44261
+ function encodeInteger(builder, num, relative) {
44262
+ let delta = num - relative;
44263
+ delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
44264
+ do {
44265
+ let clamped = delta & 0b011111;
44266
+ delta >>>= 5;
44267
+ if (delta > 0)
44268
+ clamped |= 0b100000;
44269
+ builder.write(intToChar[clamped]);
44270
+ } while (delta > 0);
44271
+ return num;
44272
+ }
44273
+
44274
+ const bufLength = 1024 * 16;
44168
44275
  // Provide a fallback for older environments.
44169
44276
  const td = typeof TextDecoder !== 'undefined'
44170
44277
  ? /* #__PURE__ */ new TextDecoder()
@@ -44184,63 +44291,54 @@ const td = typeof TextDecoder !== 'undefined'
44184
44291
  return out;
44185
44292
  },
44186
44293
  };
44294
+ class StringWriter {
44295
+ constructor() {
44296
+ this.pos = 0;
44297
+ this.out = '';
44298
+ this.buffer = new Uint8Array(bufLength);
44299
+ }
44300
+ write(v) {
44301
+ const { buffer } = this;
44302
+ buffer[this.pos++] = v;
44303
+ if (this.pos === bufLength) {
44304
+ this.out += td.decode(buffer);
44305
+ this.pos = 0;
44306
+ }
44307
+ }
44308
+ flush() {
44309
+ const { buffer, out, pos } = this;
44310
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
44311
+ }
44312
+ }
44187
44313
  function encode(decoded) {
44188
- const state = new Int32Array(5);
44189
- const bufLength = 1024 * 16;
44190
- const subLength = bufLength - 36;
44191
- const buf = new Uint8Array(bufLength);
44192
- const sub = buf.subarray(0, subLength);
44193
- let pos = 0;
44194
- let out = '';
44314
+ const writer = new StringWriter();
44315
+ let sourcesIndex = 0;
44316
+ let sourceLine = 0;
44317
+ let sourceColumn = 0;
44318
+ let namesIndex = 0;
44195
44319
  for (let i = 0; i < decoded.length; i++) {
44196
44320
  const line = decoded[i];
44197
- if (i > 0) {
44198
- if (pos === bufLength) {
44199
- out += td.decode(buf);
44200
- pos = 0;
44201
- }
44202
- buf[pos++] = semicolon;
44203
- }
44321
+ if (i > 0)
44322
+ writer.write(semicolon);
44204
44323
  if (line.length === 0)
44205
44324
  continue;
44206
- state[0] = 0;
44325
+ let genColumn = 0;
44207
44326
  for (let j = 0; j < line.length; j++) {
44208
44327
  const segment = line[j];
44209
- // We can push up to 5 ints, each int can take at most 7 chars, and we
44210
- // may push a comma.
44211
- if (pos > subLength) {
44212
- out += td.decode(sub);
44213
- buf.copyWithin(0, subLength, pos);
44214
- pos -= subLength;
44215
- }
44216
44328
  if (j > 0)
44217
- buf[pos++] = comma;
44218
- pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
44329
+ writer.write(comma);
44330
+ genColumn = encodeInteger(writer, segment[0], genColumn);
44219
44331
  if (segment.length === 1)
44220
44332
  continue;
44221
- pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
44222
- pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
44223
- pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
44333
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
44334
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
44335
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
44224
44336
  if (segment.length === 4)
44225
44337
  continue;
44226
- pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
44338
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
44227
44339
  }
44228
44340
  }
44229
- return out + td.decode(buf.subarray(0, pos));
44230
- }
44231
- function encodeInteger(buf, pos, state, segment, j) {
44232
- const next = segment[j];
44233
- let num = next - state[j];
44234
- state[j] = next;
44235
- num = num < 0 ? (-num << 1) | 1 : num << 1;
44236
- do {
44237
- let clamped = num & 0b011111;
44238
- num >>>= 5;
44239
- if (num > 0)
44240
- clamped |= 0b100000;
44241
- buf[pos++] = intToChar[clamped];
44242
- } while (num > 0);
44243
- return pos;
44341
+ return writer.flush();
44244
44342
  }
44245
44343
 
44246
44344
  class BitSet {
@@ -44998,8 +45096,10 @@ class MagicString {
44998
45096
  update(start, end, content, options) {
44999
45097
  if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
45000
45098
 
45001
- while (start < 0) start += this.original.length;
45002
- while (end < 0) end += this.original.length;
45099
+ if (this.original.length !== 0) {
45100
+ while (start < 0) start += this.original.length;
45101
+ while (end < 0) end += this.original.length;
45102
+ }
45003
45103
 
45004
45104
  if (end > this.original.length) throw new Error('end is out of bounds');
45005
45105
  if (start === end)
@@ -45095,8 +45195,10 @@ class MagicString {
45095
45195
  }
45096
45196
 
45097
45197
  remove(start, end) {
45098
- while (start < 0) start += this.original.length;
45099
- while (end < 0) end += this.original.length;
45198
+ if (this.original.length !== 0) {
45199
+ while (start < 0) start += this.original.length;
45200
+ while (end < 0) end += this.original.length;
45201
+ }
45100
45202
 
45101
45203
  if (start === end) return this;
45102
45204
 
@@ -45119,8 +45221,10 @@ class MagicString {
45119
45221
  }
45120
45222
 
45121
45223
  reset(start, end) {
45122
- while (start < 0) start += this.original.length;
45123
- while (end < 0) end += this.original.length;
45224
+ if (this.original.length !== 0) {
45225
+ while (start < 0) start += this.original.length;
45226
+ while (end < 0) end += this.original.length;
45227
+ }
45124
45228
 
45125
45229
  if (start === end) return this;
45126
45230
 
@@ -45182,8 +45286,10 @@ class MagicString {
45182
45286
  }
45183
45287
 
45184
45288
  slice(start = 0, end = this.original.length) {
45185
- while (start < 0) start += this.original.length;
45186
- while (end < 0) end += this.original.length;
45289
+ if (this.original.length !== 0) {
45290
+ while (start < 0) start += this.original.length;
45291
+ while (end < 0) end += this.original.length;
45292
+ }
45187
45293
 
45188
45294
  let result = '';
45189
45295
 
@@ -48660,7 +48766,7 @@ var __spreadValues = (a, b) => {
48660
48766
  }
48661
48767
  return a;
48662
48768
  };
48663
- const version = "3.5.0-alpha.4";
48769
+ const version = "3.5.0-beta.1";
48664
48770
  const parseCache = parseCache$1;
48665
48771
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
48666
48772
  const walk = walk$2;