@vue/compiler-sfc 3.4.36 → 3.4.38

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.4.36
2
+ * @vue/compiler-sfc v3.4.38
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -19144,7 +19144,7 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
19144
19144
  return ["Symbol"];
19145
19145
  case "TSIndexedAccessType": {
19146
19146
  const types = resolveIndexType(ctx, node, scope);
19147
- return flattenTypes(ctx, types, scope);
19147
+ return flattenTypes(ctx, types, scope, isKeyOf);
19148
19148
  }
19149
19149
  case "ClassDeclaration":
19150
19150
  return ["Object"];
@@ -20857,7 +20857,7 @@ function isStaticNode(node) {
20857
20857
  return false;
20858
20858
  }
20859
20859
 
20860
- const version = "3.4.36";
20860
+ const version = "3.4.38";
20861
20861
  const parseCache = parseCache$1;
20862
20862
  const errorMessages = {
20863
20863
  ...CompilerDOM.errorMessages,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.4.36
2
+ * @vue/compiler-sfc v3.4.38
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -725,13 +725,13 @@ const decodeMap = new Map([
725
725
  * Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
726
726
  */
727
727
  const fromCodePoint =
728
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
728
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
729
729
  (_a$1 = String.fromCodePoint) !== null && _a$1 !== void 0 ? _a$1 : function (codePoint) {
730
730
  let output = "";
731
- if (codePoint > 65535) {
732
- codePoint -= 65536;
733
- output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
734
- codePoint = 56320 | (codePoint & 1023);
731
+ if (codePoint > 0xffff) {
732
+ codePoint -= 0x10000;
733
+ output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
734
+ codePoint = 0xdc00 | (codePoint & 0x3ff);
735
735
  }
736
736
  output += String.fromCharCode(codePoint);
737
737
  return output;
@@ -743,9 +743,8 @@ const fromCodePoint =
743
743
  */
744
744
  function replaceCodePoint(codePoint) {
745
745
  var _a;
746
- if ((codePoint >= 55296 && codePoint <= 57343) ||
747
- codePoint > 1114111) {
748
- return 65533;
746
+ if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
747
+ return 0xfffd;
749
748
  }
750
749
  return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
751
750
  }
@@ -766,7 +765,7 @@ var CharCodes;
766
765
  CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
767
766
  })(CharCodes || (CharCodes = {}));
768
767
  /** Bit that needs to be set to convert an upper case ASCII character to lower case */
769
- const TO_LOWER_BIT = 32;
768
+ const TO_LOWER_BIT = 0b100000;
770
769
  var BinTrieFlags;
771
770
  (function (BinTrieFlags) {
772
771
  BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
@@ -867,32 +866,32 @@ class EntityDecoder {
867
866
  * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
868
867
  * entity is incomplete, and resume when the next string is written.
869
868
  *
870
- * @param input The string containing the entity (or a continuation of the entity).
869
+ * @param string The string containing the entity (or a continuation of the entity).
871
870
  * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
872
871
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
873
872
  */
874
- write(input, offset) {
873
+ write(str, offset) {
875
874
  switch (this.state) {
876
875
  case EntityDecoderState.EntityStart: {
877
- if (input.charCodeAt(offset) === CharCodes.NUM) {
876
+ if (str.charCodeAt(offset) === CharCodes.NUM) {
878
877
  this.state = EntityDecoderState.NumericStart;
879
878
  this.consumed += 1;
880
- return this.stateNumericStart(input, offset + 1);
879
+ return this.stateNumericStart(str, offset + 1);
881
880
  }
882
881
  this.state = EntityDecoderState.NamedEntity;
883
- return this.stateNamedEntity(input, offset);
882
+ return this.stateNamedEntity(str, offset);
884
883
  }
885
884
  case EntityDecoderState.NumericStart: {
886
- return this.stateNumericStart(input, offset);
885
+ return this.stateNumericStart(str, offset);
887
886
  }
888
887
  case EntityDecoderState.NumericDecimal: {
889
- return this.stateNumericDecimal(input, offset);
888
+ return this.stateNumericDecimal(str, offset);
890
889
  }
891
890
  case EntityDecoderState.NumericHex: {
892
- return this.stateNumericHex(input, offset);
891
+ return this.stateNumericHex(str, offset);
893
892
  }
894
893
  case EntityDecoderState.NamedEntity: {
895
- return this.stateNamedEntity(input, offset);
894
+ return this.stateNamedEntity(str, offset);
896
895
  }
897
896
  }
898
897
  }
@@ -901,28 +900,28 @@ class EntityDecoder {
901
900
  *
902
901
  * Equivalent to the `Numeric character reference state` in the HTML spec.
903
902
  *
904
- * @param input The string containing the entity (or a continuation of the entity).
903
+ * @param str The string containing the entity (or a continuation of the entity).
905
904
  * @param offset The current offset.
906
905
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
907
906
  */
908
- stateNumericStart(input, offset) {
909
- if (offset >= input.length) {
907
+ stateNumericStart(str, offset) {
908
+ if (offset >= str.length) {
910
909
  return -1;
911
910
  }
912
- if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
911
+ if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
913
912
  this.state = EntityDecoderState.NumericHex;
914
913
  this.consumed += 1;
915
- return this.stateNumericHex(input, offset + 1);
914
+ return this.stateNumericHex(str, offset + 1);
916
915
  }
917
916
  this.state = EntityDecoderState.NumericDecimal;
918
- return this.stateNumericDecimal(input, offset);
917
+ return this.stateNumericDecimal(str, offset);
919
918
  }
920
- addToNumericResult(input, start, end, base) {
919
+ addToNumericResult(str, start, end, base) {
921
920
  if (start !== end) {
922
921
  const digitCount = end - start;
923
922
  this.result =
924
923
  this.result * Math.pow(base, digitCount) +
925
- Number.parseInt(input.substr(start, digitCount), base);
924
+ parseInt(str.substr(start, digitCount), base);
926
925
  this.consumed += digitCount;
927
926
  }
928
927
  }
@@ -931,23 +930,23 @@ class EntityDecoder {
931
930
  *
932
931
  * Equivalent to the `Hexademical character reference state` in the HTML spec.
933
932
  *
934
- * @param input The string containing the entity (or a continuation of the entity).
933
+ * @param str The string containing the entity (or a continuation of the entity).
935
934
  * @param offset The current offset.
936
935
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
937
936
  */
938
- stateNumericHex(input, offset) {
939
- const startIndex = offset;
940
- while (offset < input.length) {
941
- const char = input.charCodeAt(offset);
937
+ stateNumericHex(str, offset) {
938
+ const startIdx = offset;
939
+ while (offset < str.length) {
940
+ const char = str.charCodeAt(offset);
942
941
  if (isNumber$2(char) || isHexadecimalCharacter(char)) {
943
942
  offset += 1;
944
943
  }
945
944
  else {
946
- this.addToNumericResult(input, startIndex, offset, 16);
945
+ this.addToNumericResult(str, startIdx, offset, 16);
947
946
  return this.emitNumericEntity(char, 3);
948
947
  }
949
948
  }
950
- this.addToNumericResult(input, startIndex, offset, 16);
949
+ this.addToNumericResult(str, startIdx, offset, 16);
951
950
  return -1;
952
951
  }
953
952
  /**
@@ -955,23 +954,23 @@ class EntityDecoder {
955
954
  *
956
955
  * Equivalent to the `Decimal character reference state` in the HTML spec.
957
956
  *
958
- * @param input The string containing the entity (or a continuation of the entity).
957
+ * @param str The string containing the entity (or a continuation of the entity).
959
958
  * @param offset The current offset.
960
959
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
961
960
  */
962
- stateNumericDecimal(input, offset) {
963
- const startIndex = offset;
964
- while (offset < input.length) {
965
- const char = input.charCodeAt(offset);
961
+ stateNumericDecimal(str, offset) {
962
+ const startIdx = offset;
963
+ while (offset < str.length) {
964
+ const char = str.charCodeAt(offset);
966
965
  if (isNumber$2(char)) {
967
966
  offset += 1;
968
967
  }
969
968
  else {
970
- this.addToNumericResult(input, startIndex, offset, 10);
969
+ this.addToNumericResult(str, startIdx, offset, 10);
971
970
  return this.emitNumericEntity(char, 2);
972
971
  }
973
972
  }
974
- this.addToNumericResult(input, startIndex, offset, 10);
973
+ this.addToNumericResult(str, startIdx, offset, 10);
975
974
  return -1;
976
975
  }
977
976
  /**
@@ -1015,17 +1014,17 @@ class EntityDecoder {
1015
1014
  *
1016
1015
  * Equivalent to the `Named character reference state` in the HTML spec.
1017
1016
  *
1018
- * @param input The string containing the entity (or a continuation of the entity).
1017
+ * @param str The string containing the entity (or a continuation of the entity).
1019
1018
  * @param offset The current offset.
1020
1019
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
1021
1020
  */
1022
- stateNamedEntity(input, offset) {
1021
+ stateNamedEntity(str, offset) {
1023
1022
  const { decodeTree } = this;
1024
1023
  let current = decodeTree[this.treeIndex];
1025
1024
  // The mask is the number of bytes of the value, including the current byte.
1026
1025
  let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
1027
- for (; offset < input.length; offset++, this.excess++) {
1028
- const char = input.charCodeAt(offset);
1026
+ for (; offset < str.length; offset++, this.excess++) {
1027
+ const char = str.charCodeAt(offset);
1029
1028
  this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
1030
1029
  if (this.treeIndex < 0) {
1031
1030
  return this.result === 0 ||
@@ -1132,28 +1131,28 @@ class EntityDecoder {
1132
1131
  * @returns A function that decodes entities in a string.
1133
1132
  */
1134
1133
  function getDecoder(decodeTree) {
1135
- let returnValue = "";
1136
- const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += fromCodePoint(data)));
1137
- return function decodeWithTrie(input, decodeMode) {
1134
+ let ret = "";
1135
+ const decoder = new EntityDecoder(decodeTree, (str) => (ret += fromCodePoint(str)));
1136
+ return function decodeWithTrie(str, decodeMode) {
1138
1137
  let lastIndex = 0;
1139
1138
  let offset = 0;
1140
- while ((offset = input.indexOf("&", offset)) >= 0) {
1141
- returnValue += input.slice(lastIndex, offset);
1139
+ while ((offset = str.indexOf("&", offset)) >= 0) {
1140
+ ret += str.slice(lastIndex, offset);
1142
1141
  decoder.startEntity(decodeMode);
1143
- const length = decoder.write(input,
1142
+ const len = decoder.write(str,
1144
1143
  // Skip the "&"
1145
1144
  offset + 1);
1146
- if (length < 0) {
1145
+ if (len < 0) {
1147
1146
  lastIndex = offset + decoder.end();
1148
1147
  break;
1149
1148
  }
1150
- lastIndex = offset + length;
1151
- // If `length` is 0, skip the current `&` and continue.
1152
- offset = length === 0 ? lastIndex + 1 : lastIndex;
1149
+ lastIndex = offset + len;
1150
+ // If `len` is 0, skip the current `&` and continue.
1151
+ offset = len === 0 ? lastIndex + 1 : lastIndex;
1153
1152
  }
1154
- const result = returnValue + input.slice(lastIndex);
1153
+ const result = ret + str.slice(lastIndex);
1155
1154
  // Make sure we don't keep a reference to the final string.
1156
- returnValue = "";
1155
+ ret = "";
1157
1156
  return result;
1158
1157
  };
1159
1158
  }
@@ -1167,31 +1166,31 @@ function getDecoder(decodeTree) {
1167
1166
  * @param char The current character.
1168
1167
  * @returns The index of the next node, or -1 if no branch is taken.
1169
1168
  */
1170
- function determineBranch(decodeTree, current, nodeIndex, char) {
1169
+ function determineBranch(decodeTree, current, nodeIdx, char) {
1171
1170
  const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
1172
1171
  const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
1173
1172
  // Case 1: Single branch encoded in jump offset
1174
1173
  if (branchCount === 0) {
1175
- return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
1174
+ return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
1176
1175
  }
1177
1176
  // Case 2: Multiple branches encoded in jump table
1178
1177
  if (jumpOffset) {
1179
1178
  const value = char - jumpOffset;
1180
1179
  return value < 0 || value >= branchCount
1181
1180
  ? -1
1182
- : decodeTree[nodeIndex + value] - 1;
1181
+ : decodeTree[nodeIdx + value] - 1;
1183
1182
  }
1184
1183
  // Case 3: Multiple branches encoded in dictionary
1185
1184
  // Binary search for the character.
1186
- let lo = nodeIndex;
1185
+ let lo = nodeIdx;
1187
1186
  let hi = lo + branchCount - 1;
1188
1187
  while (lo <= hi) {
1189
1188
  const mid = (lo + hi) >>> 1;
1190
- const midValue = decodeTree[mid];
1191
- if (midValue < char) {
1189
+ const midVal = decodeTree[mid];
1190
+ if (midVal < char) {
1192
1191
  lo = mid + 1;
1193
1192
  }
1194
- else if (midValue > char) {
1193
+ else if (midVal > char) {
1195
1194
  hi = mid - 1;
1196
1195
  }
1197
1196
  else {
@@ -1205,12 +1204,12 @@ getDecoder(xmlDecodeTree);
1205
1204
  /**
1206
1205
  * Decodes an HTML string.
1207
1206
  *
1208
- * @param htmlString The string to decode.
1207
+ * @param str The string to decode.
1209
1208
  * @param mode The decoding mode.
1210
1209
  * @returns The decoded string.
1211
1210
  */
1212
- function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
1213
- return htmlDecoder(htmlString, mode);
1211
+ function decodeHTML(str, mode = DecodingMode.Legacy) {
1212
+ return htmlDecoder(str, mode);
1214
1213
  }
1215
1214
 
1216
1215
  const defaultDelimitersOpen = new Uint8Array([123, 123]);
@@ -16884,8 +16883,9 @@ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
16884
16883
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
16885
16884
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
16886
16885
  const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
16887
- const isMemberExpressionBrowser = (path) => {
16888
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
16886
+ const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
16887
+ const isMemberExpressionBrowser = (exp) => {
16888
+ const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
16889
16889
  let state = 0 /* inMemberExp */;
16890
16890
  let stateStack = [];
16891
16891
  let currentOpenBracketCount = 0;
@@ -16946,10 +16946,10 @@ const isMemberExpressionBrowser = (path) => {
16946
16946
  }
16947
16947
  return !currentOpenBracketCount && !currentOpenParensCount;
16948
16948
  };
16949
- const isMemberExpressionNode = (path, context) => {
16949
+ const isMemberExpressionNode = (exp, context) => {
16950
16950
  try {
16951
- let ret = parseExpression_1(path, {
16952
- plugins: context.expressionPlugins
16951
+ let ret = exp.ast || parseExpression_1(getExpSource(exp), {
16952
+ plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
16953
16953
  });
16954
16954
  ret = unwrapTSNode(ret);
16955
16955
  return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
@@ -16958,6 +16958,26 @@ const isMemberExpressionNode = (path, context) => {
16958
16958
  }
16959
16959
  };
16960
16960
  const isMemberExpression = isMemberExpressionNode;
16961
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16962
+ const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
16963
+ const isFnExpressionNode = (exp, context) => {
16964
+ try {
16965
+ let ret = exp.ast || parseExpression_1(getExpSource(exp), {
16966
+ plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
16967
+ });
16968
+ if (ret.type === "Program") {
16969
+ ret = ret.body[0];
16970
+ if (ret.type === "ExpressionStatement") {
16971
+ ret = ret.expression;
16972
+ }
16973
+ }
16974
+ ret = unwrapTSNode(ret);
16975
+ return ret.type === "FunctionExpression" || ret.type === "ArrowFunctionExpression";
16976
+ } catch (e) {
16977
+ return false;
16978
+ }
16979
+ };
16980
+ const isFnExpression = isFnExpressionNode;
16961
16981
  function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
16962
16982
  return advancePositionWithMutation(
16963
16983
  {
@@ -23674,7 +23694,7 @@ function resolveComponentType(node, context, ssr = false) {
23674
23694
  } else {
23675
23695
  exp = isProp.exp;
23676
23696
  if (!exp) {
23677
- exp = createSimpleExpression(`is`, false, isProp.loc);
23697
+ exp = createSimpleExpression(`is`, false, isProp.arg.loc);
23678
23698
  {
23679
23699
  exp = isProp.exp = processExpression(exp, context);
23680
23700
  }
@@ -24218,7 +24238,6 @@ function processSlotOutlet(node, context) {
24218
24238
  };
24219
24239
  }
24220
24240
 
24221
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
24222
24241
  const transformOn$1 = (dir, node, context, augmentor) => {
24223
24242
  const { loc, modifiers, arg } = dir;
24224
24243
  if (!dir.exp && !modifiers.length) {
@@ -24262,8 +24281,8 @@ const transformOn$1 = (dir, node, context, augmentor) => {
24262
24281
  }
24263
24282
  let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
24264
24283
  if (exp) {
24265
- const isMemberExp = isMemberExpression(exp.content, context);
24266
- const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
24284
+ const isMemberExp = isMemberExpression(exp, context);
24285
+ const isInlineStatement = !(isMemberExp || isFnExpression(exp, context));
24267
24286
  const hasMultipleStatements = exp.content.includes(`;`);
24268
24287
  if (context.prefixIdentifiers) {
24269
24288
  isInlineStatement && context.addIdentifiers(`$event`);
@@ -24433,7 +24452,7 @@ const transformModel$1 = (dir, node, context) => {
24433
24452
  return createTransformProps();
24434
24453
  }
24435
24454
  const maybeRef = context.inline && (bindingType === "setup-let" || bindingType === "setup-ref" || bindingType === "setup-maybe-ref");
24436
- if (!expString.trim() || !isMemberExpression(expString, context) && !maybeRef) {
24455
+ if (!expString.trim() || !isMemberExpression(exp, context) && !maybeRef) {
24437
24456
  context.onError(
24438
24457
  createCompilerError(42, exp.loc)
24439
24458
  );
@@ -25410,6 +25429,9 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
25410
25429
  helperNameMap: helperNameMap,
25411
25430
  injectProp: injectProp,
25412
25431
  isCoreComponent: isCoreComponent,
25432
+ isFnExpression: isFnExpression,
25433
+ isFnExpressionBrowser: isFnExpressionBrowser,
25434
+ isFnExpressionNode: isFnExpressionNode,
25413
25435
  isFunctionType: isFunctionType,
25414
25436
  isInDestructureAssignment: isInDestructureAssignment,
25415
25437
  isInNewExpression: isInNewExpression,
@@ -43979,6 +44001,20 @@ for (let i = 0; i < chars.length; i++) {
43979
44001
  intToChar[i] = c;
43980
44002
  charToInt[c] = i;
43981
44003
  }
44004
+ function encodeInteger(builder, num, relative) {
44005
+ let delta = num - relative;
44006
+ delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
44007
+ do {
44008
+ let clamped = delta & 0b011111;
44009
+ delta >>>= 5;
44010
+ if (delta > 0)
44011
+ clamped |= 0b100000;
44012
+ builder.write(intToChar[clamped]);
44013
+ } while (delta > 0);
44014
+ return num;
44015
+ }
44016
+
44017
+ const bufLength = 1024 * 16;
43982
44018
  // Provide a fallback for older environments.
43983
44019
  const td = typeof TextDecoder !== 'undefined'
43984
44020
  ? /* #__PURE__ */ new TextDecoder()
@@ -43998,63 +44034,54 @@ const td = typeof TextDecoder !== 'undefined'
43998
44034
  return out;
43999
44035
  },
44000
44036
  };
44037
+ class StringWriter {
44038
+ constructor() {
44039
+ this.pos = 0;
44040
+ this.out = '';
44041
+ this.buffer = new Uint8Array(bufLength);
44042
+ }
44043
+ write(v) {
44044
+ const { buffer } = this;
44045
+ buffer[this.pos++] = v;
44046
+ if (this.pos === bufLength) {
44047
+ this.out += td.decode(buffer);
44048
+ this.pos = 0;
44049
+ }
44050
+ }
44051
+ flush() {
44052
+ const { buffer, out, pos } = this;
44053
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
44054
+ }
44055
+ }
44001
44056
  function encode(decoded) {
44002
- const state = new Int32Array(5);
44003
- const bufLength = 1024 * 16;
44004
- const subLength = bufLength - 36;
44005
- const buf = new Uint8Array(bufLength);
44006
- const sub = buf.subarray(0, subLength);
44007
- let pos = 0;
44008
- let out = '';
44057
+ const writer = new StringWriter();
44058
+ let sourcesIndex = 0;
44059
+ let sourceLine = 0;
44060
+ let sourceColumn = 0;
44061
+ let namesIndex = 0;
44009
44062
  for (let i = 0; i < decoded.length; i++) {
44010
44063
  const line = decoded[i];
44011
- if (i > 0) {
44012
- if (pos === bufLength) {
44013
- out += td.decode(buf);
44014
- pos = 0;
44015
- }
44016
- buf[pos++] = semicolon;
44017
- }
44064
+ if (i > 0)
44065
+ writer.write(semicolon);
44018
44066
  if (line.length === 0)
44019
44067
  continue;
44020
- state[0] = 0;
44068
+ let genColumn = 0;
44021
44069
  for (let j = 0; j < line.length; j++) {
44022
44070
  const segment = line[j];
44023
- // We can push up to 5 ints, each int can take at most 7 chars, and we
44024
- // may push a comma.
44025
- if (pos > subLength) {
44026
- out += td.decode(sub);
44027
- buf.copyWithin(0, subLength, pos);
44028
- pos -= subLength;
44029
- }
44030
44071
  if (j > 0)
44031
- buf[pos++] = comma;
44032
- pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
44072
+ writer.write(comma);
44073
+ genColumn = encodeInteger(writer, segment[0], genColumn);
44033
44074
  if (segment.length === 1)
44034
44075
  continue;
44035
- pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
44036
- pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
44037
- pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
44076
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
44077
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
44078
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
44038
44079
  if (segment.length === 4)
44039
44080
  continue;
44040
- pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
44081
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
44041
44082
  }
44042
44083
  }
44043
- return out + td.decode(buf.subarray(0, pos));
44044
- }
44045
- function encodeInteger(buf, pos, state, segment, j) {
44046
- const next = segment[j];
44047
- let num = next - state[j];
44048
- state[j] = next;
44049
- num = num < 0 ? (-num << 1) | 1 : num << 1;
44050
- do {
44051
- let clamped = num & 0b011111;
44052
- num >>>= 5;
44053
- if (num > 0)
44054
- clamped |= 0b100000;
44055
- buf[pos++] = intToChar[clamped];
44056
- } while (num > 0);
44057
- return pos;
44084
+ return writer.flush();
44058
44085
  }
44059
44086
 
44060
44087
  class BitSet {
@@ -44812,8 +44839,10 @@ class MagicString {
44812
44839
  update(start, end, content, options) {
44813
44840
  if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
44814
44841
 
44815
- while (start < 0) start += this.original.length;
44816
- while (end < 0) end += this.original.length;
44842
+ if (this.original.length !== 0) {
44843
+ while (start < 0) start += this.original.length;
44844
+ while (end < 0) end += this.original.length;
44845
+ }
44817
44846
 
44818
44847
  if (end > this.original.length) throw new Error('end is out of bounds');
44819
44848
  if (start === end)
@@ -44909,8 +44938,10 @@ class MagicString {
44909
44938
  }
44910
44939
 
44911
44940
  remove(start, end) {
44912
- while (start < 0) start += this.original.length;
44913
- while (end < 0) end += this.original.length;
44941
+ if (this.original.length !== 0) {
44942
+ while (start < 0) start += this.original.length;
44943
+ while (end < 0) end += this.original.length;
44944
+ }
44914
44945
 
44915
44946
  if (start === end) return this;
44916
44947
 
@@ -44933,8 +44964,10 @@ class MagicString {
44933
44964
  }
44934
44965
 
44935
44966
  reset(start, end) {
44936
- while (start < 0) start += this.original.length;
44937
- while (end < 0) end += this.original.length;
44967
+ if (this.original.length !== 0) {
44968
+ while (start < 0) start += this.original.length;
44969
+ while (end < 0) end += this.original.length;
44970
+ }
44938
44971
 
44939
44972
  if (start === end) return this;
44940
44973
 
@@ -44996,8 +45029,10 @@ class MagicString {
44996
45029
  }
44997
45030
 
44998
45031
  slice(start = 0, end = this.original.length) {
44999
- while (start < 0) start += this.original.length;
45000
- while (end < 0) end += this.original.length;
45032
+ if (this.original.length !== 0) {
45033
+ while (start < 0) start += this.original.length;
45034
+ while (end < 0) end += this.original.length;
45035
+ }
45001
45036
 
45002
45037
  let result = '';
45003
45038
 
@@ -46732,7 +46767,7 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46732
46767
  return ["Symbol"];
46733
46768
  case "TSIndexedAccessType": {
46734
46769
  const types = resolveIndexType(ctx, node, scope);
46735
- return flattenTypes(ctx, types, scope);
46770
+ return flattenTypes(ctx, types, scope, isKeyOf);
46736
46771
  }
46737
46772
  case "ClassDeclaration":
46738
46773
  return ["Object"];
@@ -48475,7 +48510,7 @@ var __spreadValues = (a, b) => {
48475
48510
  }
48476
48511
  return a;
48477
48512
  };
48478
- const version = "3.4.36";
48513
+ const version = "3.4.38";
48479
48514
  const parseCache = parseCache$1;
48480
48515
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
48481
48516
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.4.36",
3
+ "version": "3.4.38",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -47,10 +47,10 @@
47
47
  "magic-string": "^0.30.10",
48
48
  "postcss": "^8.4.40",
49
49
  "source-map-js": "^1.2.0",
50
- "@vue/compiler-core": "3.4.36",
51
- "@vue/compiler-ssr": "3.4.36",
52
- "@vue/compiler-dom": "3.4.36",
53
- "@vue/shared": "3.4.36"
50
+ "@vue/compiler-core": "3.4.38",
51
+ "@vue/compiler-dom": "3.4.38",
52
+ "@vue/compiler-ssr": "3.4.38",
53
+ "@vue/shared": "3.4.38"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.24.7",