@vue/compiler-sfc 3.4.35 → 3.4.36

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.35
2
+ * @vue/compiler-sfc v3.4.36
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -20857,7 +20857,7 @@ function isStaticNode(node) {
20857
20857
  return false;
20858
20858
  }
20859
20859
 
20860
- const version = "3.4.35";
20860
+ const version = "3.4.36";
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.35
2
+ * @vue/compiler-sfc v3.4.36
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, node/no-unsupported-features/es-builtins
728
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/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 > 0xffff) {
732
- codePoint -= 0x10000;
733
- output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
734
- codePoint = 0xdc00 | (codePoint & 0x3ff);
731
+ if (codePoint > 65535) {
732
+ codePoint -= 65536;
733
+ output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
734
+ codePoint = 56320 | (codePoint & 1023);
735
735
  }
736
736
  output += String.fromCharCode(codePoint);
737
737
  return output;
@@ -743,8 +743,9 @@ const fromCodePoint =
743
743
  */
744
744
  function replaceCodePoint(codePoint) {
745
745
  var _a;
746
- if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
747
- return 0xfffd;
746
+ if ((codePoint >= 55296 && codePoint <= 57343) ||
747
+ codePoint > 1114111) {
748
+ return 65533;
748
749
  }
749
750
  return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
750
751
  }
@@ -765,7 +766,7 @@ var CharCodes;
765
766
  CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
766
767
  })(CharCodes || (CharCodes = {}));
767
768
  /** Bit that needs to be set to convert an upper case ASCII character to lower case */
768
- const TO_LOWER_BIT = 0b100000;
769
+ const TO_LOWER_BIT = 32;
769
770
  var BinTrieFlags;
770
771
  (function (BinTrieFlags) {
771
772
  BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
@@ -866,32 +867,32 @@ class EntityDecoder {
866
867
  * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
867
868
  * entity is incomplete, and resume when the next string is written.
868
869
  *
869
- * @param string The string containing the entity (or a continuation of the entity).
870
+ * @param input The string containing the entity (or a continuation of the entity).
870
871
  * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
871
872
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
872
873
  */
873
- write(str, offset) {
874
+ write(input, offset) {
874
875
  switch (this.state) {
875
876
  case EntityDecoderState.EntityStart: {
876
- if (str.charCodeAt(offset) === CharCodes.NUM) {
877
+ if (input.charCodeAt(offset) === CharCodes.NUM) {
877
878
  this.state = EntityDecoderState.NumericStart;
878
879
  this.consumed += 1;
879
- return this.stateNumericStart(str, offset + 1);
880
+ return this.stateNumericStart(input, offset + 1);
880
881
  }
881
882
  this.state = EntityDecoderState.NamedEntity;
882
- return this.stateNamedEntity(str, offset);
883
+ return this.stateNamedEntity(input, offset);
883
884
  }
884
885
  case EntityDecoderState.NumericStart: {
885
- return this.stateNumericStart(str, offset);
886
+ return this.stateNumericStart(input, offset);
886
887
  }
887
888
  case EntityDecoderState.NumericDecimal: {
888
- return this.stateNumericDecimal(str, offset);
889
+ return this.stateNumericDecimal(input, offset);
889
890
  }
890
891
  case EntityDecoderState.NumericHex: {
891
- return this.stateNumericHex(str, offset);
892
+ return this.stateNumericHex(input, offset);
892
893
  }
893
894
  case EntityDecoderState.NamedEntity: {
894
- return this.stateNamedEntity(str, offset);
895
+ return this.stateNamedEntity(input, offset);
895
896
  }
896
897
  }
897
898
  }
@@ -900,28 +901,28 @@ class EntityDecoder {
900
901
  *
901
902
  * Equivalent to the `Numeric character reference state` in the HTML spec.
902
903
  *
903
- * @param str The string containing the entity (or a continuation of the entity).
904
+ * @param input The string containing the entity (or a continuation of the entity).
904
905
  * @param offset The current offset.
905
906
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
906
907
  */
907
- stateNumericStart(str, offset) {
908
- if (offset >= str.length) {
908
+ stateNumericStart(input, offset) {
909
+ if (offset >= input.length) {
909
910
  return -1;
910
911
  }
911
- if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
912
+ if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
912
913
  this.state = EntityDecoderState.NumericHex;
913
914
  this.consumed += 1;
914
- return this.stateNumericHex(str, offset + 1);
915
+ return this.stateNumericHex(input, offset + 1);
915
916
  }
916
917
  this.state = EntityDecoderState.NumericDecimal;
917
- return this.stateNumericDecimal(str, offset);
918
+ return this.stateNumericDecimal(input, offset);
918
919
  }
919
- addToNumericResult(str, start, end, base) {
920
+ addToNumericResult(input, start, end, base) {
920
921
  if (start !== end) {
921
922
  const digitCount = end - start;
922
923
  this.result =
923
924
  this.result * Math.pow(base, digitCount) +
924
- parseInt(str.substr(start, digitCount), base);
925
+ Number.parseInt(input.substr(start, digitCount), base);
925
926
  this.consumed += digitCount;
926
927
  }
927
928
  }
@@ -930,23 +931,23 @@ class EntityDecoder {
930
931
  *
931
932
  * Equivalent to the `Hexademical character reference state` in the HTML spec.
932
933
  *
933
- * @param str The string containing the entity (or a continuation of the entity).
934
+ * @param input The string containing the entity (or a continuation of the entity).
934
935
  * @param offset The current offset.
935
936
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
936
937
  */
937
- stateNumericHex(str, offset) {
938
- const startIdx = offset;
939
- while (offset < str.length) {
940
- const char = str.charCodeAt(offset);
938
+ stateNumericHex(input, offset) {
939
+ const startIndex = offset;
940
+ while (offset < input.length) {
941
+ const char = input.charCodeAt(offset);
941
942
  if (isNumber$2(char) || isHexadecimalCharacter(char)) {
942
943
  offset += 1;
943
944
  }
944
945
  else {
945
- this.addToNumericResult(str, startIdx, offset, 16);
946
+ this.addToNumericResult(input, startIndex, offset, 16);
946
947
  return this.emitNumericEntity(char, 3);
947
948
  }
948
949
  }
949
- this.addToNumericResult(str, startIdx, offset, 16);
950
+ this.addToNumericResult(input, startIndex, offset, 16);
950
951
  return -1;
951
952
  }
952
953
  /**
@@ -954,23 +955,23 @@ class EntityDecoder {
954
955
  *
955
956
  * Equivalent to the `Decimal character reference state` in the HTML spec.
956
957
  *
957
- * @param str The string containing the entity (or a continuation of the entity).
958
+ * @param input The string containing the entity (or a continuation of the entity).
958
959
  * @param offset The current offset.
959
960
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
960
961
  */
961
- stateNumericDecimal(str, offset) {
962
- const startIdx = offset;
963
- while (offset < str.length) {
964
- const char = str.charCodeAt(offset);
962
+ stateNumericDecimal(input, offset) {
963
+ const startIndex = offset;
964
+ while (offset < input.length) {
965
+ const char = input.charCodeAt(offset);
965
966
  if (isNumber$2(char)) {
966
967
  offset += 1;
967
968
  }
968
969
  else {
969
- this.addToNumericResult(str, startIdx, offset, 10);
970
+ this.addToNumericResult(input, startIndex, offset, 10);
970
971
  return this.emitNumericEntity(char, 2);
971
972
  }
972
973
  }
973
- this.addToNumericResult(str, startIdx, offset, 10);
974
+ this.addToNumericResult(input, startIndex, offset, 10);
974
975
  return -1;
975
976
  }
976
977
  /**
@@ -1014,17 +1015,17 @@ class EntityDecoder {
1014
1015
  *
1015
1016
  * Equivalent to the `Named character reference state` in the HTML spec.
1016
1017
  *
1017
- * @param str The string containing the entity (or a continuation of the entity).
1018
+ * @param input The string containing the entity (or a continuation of the entity).
1018
1019
  * @param offset The current offset.
1019
1020
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
1020
1021
  */
1021
- stateNamedEntity(str, offset) {
1022
+ stateNamedEntity(input, offset) {
1022
1023
  const { decodeTree } = this;
1023
1024
  let current = decodeTree[this.treeIndex];
1024
1025
  // The mask is the number of bytes of the value, including the current byte.
1025
1026
  let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
1026
- for (; offset < str.length; offset++, this.excess++) {
1027
- const char = str.charCodeAt(offset);
1027
+ for (; offset < input.length; offset++, this.excess++) {
1028
+ const char = input.charCodeAt(offset);
1028
1029
  this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
1029
1030
  if (this.treeIndex < 0) {
1030
1031
  return this.result === 0 ||
@@ -1131,28 +1132,28 @@ class EntityDecoder {
1131
1132
  * @returns A function that decodes entities in a string.
1132
1133
  */
1133
1134
  function getDecoder(decodeTree) {
1134
- let ret = "";
1135
- const decoder = new EntityDecoder(decodeTree, (str) => (ret += fromCodePoint(str)));
1136
- return function decodeWithTrie(str, decodeMode) {
1135
+ let returnValue = "";
1136
+ const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += fromCodePoint(data)));
1137
+ return function decodeWithTrie(input, decodeMode) {
1137
1138
  let lastIndex = 0;
1138
1139
  let offset = 0;
1139
- while ((offset = str.indexOf("&", offset)) >= 0) {
1140
- ret += str.slice(lastIndex, offset);
1140
+ while ((offset = input.indexOf("&", offset)) >= 0) {
1141
+ returnValue += input.slice(lastIndex, offset);
1141
1142
  decoder.startEntity(decodeMode);
1142
- const len = decoder.write(str,
1143
+ const length = decoder.write(input,
1143
1144
  // Skip the "&"
1144
1145
  offset + 1);
1145
- if (len < 0) {
1146
+ if (length < 0) {
1146
1147
  lastIndex = offset + decoder.end();
1147
1148
  break;
1148
1149
  }
1149
- lastIndex = offset + len;
1150
- // If `len` is 0, skip the current `&` and continue.
1151
- offset = len === 0 ? lastIndex + 1 : lastIndex;
1150
+ lastIndex = offset + length;
1151
+ // If `length` is 0, skip the current `&` and continue.
1152
+ offset = length === 0 ? lastIndex + 1 : lastIndex;
1152
1153
  }
1153
- const result = ret + str.slice(lastIndex);
1154
+ const result = returnValue + input.slice(lastIndex);
1154
1155
  // Make sure we don't keep a reference to the final string.
1155
- ret = "";
1156
+ returnValue = "";
1156
1157
  return result;
1157
1158
  };
1158
1159
  }
@@ -1166,31 +1167,31 @@ function getDecoder(decodeTree) {
1166
1167
  * @param char The current character.
1167
1168
  * @returns The index of the next node, or -1 if no branch is taken.
1168
1169
  */
1169
- function determineBranch(decodeTree, current, nodeIdx, char) {
1170
+ function determineBranch(decodeTree, current, nodeIndex, char) {
1170
1171
  const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
1171
1172
  const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
1172
1173
  // Case 1: Single branch encoded in jump offset
1173
1174
  if (branchCount === 0) {
1174
- return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
1175
+ return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
1175
1176
  }
1176
1177
  // Case 2: Multiple branches encoded in jump table
1177
1178
  if (jumpOffset) {
1178
1179
  const value = char - jumpOffset;
1179
1180
  return value < 0 || value >= branchCount
1180
1181
  ? -1
1181
- : decodeTree[nodeIdx + value] - 1;
1182
+ : decodeTree[nodeIndex + value] - 1;
1182
1183
  }
1183
1184
  // Case 3: Multiple branches encoded in dictionary
1184
1185
  // Binary search for the character.
1185
- let lo = nodeIdx;
1186
+ let lo = nodeIndex;
1186
1187
  let hi = lo + branchCount - 1;
1187
1188
  while (lo <= hi) {
1188
1189
  const mid = (lo + hi) >>> 1;
1189
- const midVal = decodeTree[mid];
1190
- if (midVal < char) {
1190
+ const midValue = decodeTree[mid];
1191
+ if (midValue < char) {
1191
1192
  lo = mid + 1;
1192
1193
  }
1193
- else if (midVal > char) {
1194
+ else if (midValue > char) {
1194
1195
  hi = mid - 1;
1195
1196
  }
1196
1197
  else {
@@ -1204,12 +1205,12 @@ getDecoder(xmlDecodeTree);
1204
1205
  /**
1205
1206
  * Decodes an HTML string.
1206
1207
  *
1207
- * @param str The string to decode.
1208
+ * @param htmlString The string to decode.
1208
1209
  * @param mode The decoding mode.
1209
1210
  * @returns The decoded string.
1210
1211
  */
1211
- function decodeHTML(str, mode = DecodingMode.Legacy) {
1212
- return htmlDecoder(str, mode);
1212
+ function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
1213
+ return htmlDecoder(htmlString, mode);
1213
1214
  }
1214
1215
 
1215
1216
  const defaultDelimitersOpen = new Uint8Array([123, 123]);
@@ -16594,6 +16595,16 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
16594
16595
  (id) => markScopeIdentifier(node, id, knownIds)
16595
16596
  );
16596
16597
  }
16598
+ } else if (node.type === "CatchClause" && node.param) {
16599
+ for (const id of extractIdentifiers$1(node.param)) {
16600
+ markScopeIdentifier(node, id, knownIds);
16601
+ }
16602
+ } else if (isForStatement(node)) {
16603
+ walkForStatement(
16604
+ node,
16605
+ false,
16606
+ (id) => markScopeIdentifier(node, id, knownIds)
16607
+ );
16597
16608
  }
16598
16609
  },
16599
16610
  leave(node, parent) {
@@ -16674,14 +16685,20 @@ function walkBlockDeclarations(block, onIdent) {
16674
16685
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
16675
16686
  if (stmt.declare || !stmt.id) continue;
16676
16687
  onIdent(stmt.id);
16677
- } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
16678
- const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
16679
- if (variable && variable.type === "VariableDeclaration") {
16680
- for (const decl of variable.declarations) {
16681
- for (const id of extractIdentifiers$1(decl.id)) {
16682
- onIdent(id);
16683
- }
16684
- }
16688
+ } else if (isForStatement(stmt)) {
16689
+ walkForStatement(stmt, true, onIdent);
16690
+ }
16691
+ }
16692
+ }
16693
+ function isForStatement(stmt) {
16694
+ return stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement";
16695
+ }
16696
+ function walkForStatement(stmt, isVar, onIdent) {
16697
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
16698
+ if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar : !isVar)) {
16699
+ for (const decl of variable.declarations) {
16700
+ for (const id of extractIdentifiers$1(decl.id)) {
16701
+ onIdent(id);
16685
16702
  }
16686
16703
  }
16687
16704
  }
@@ -31059,6 +31076,25 @@ const ssrTransformElement = (node, context) => {
31059
31076
  ])
31060
31077
  ];
31061
31078
  }
31079
+ } else if (directives.length && !node.children.length) {
31080
+ const tempId = `_temp${context.temps++}`;
31081
+ propsExp.arguments = [
31082
+ createAssignmentExpression(
31083
+ createSimpleExpression(tempId, false),
31084
+ mergedProps
31085
+ )
31086
+ ];
31087
+ rawChildrenMap.set(
31088
+ node,
31089
+ createConditionalExpression(
31090
+ createSimpleExpression(`"textContent" in ${tempId}`, false),
31091
+ createCallExpression(context.helper(SSR_INTERPOLATE), [
31092
+ createSimpleExpression(`${tempId}.textContent`, false)
31093
+ ]),
31094
+ createSimpleExpression(`${tempId}.innerHTML ?? ''`, false),
31095
+ false
31096
+ )
31097
+ );
31062
31098
  }
31063
31099
  if (needTagForRuntime) {
31064
31100
  propsExp.arguments.push(`"${node.tag}"`);
@@ -31347,7 +31383,7 @@ function ssrProcessTransitionGroup(node, context) {
31347
31383
  context.pushStringPart(` ${scopeId}`);
31348
31384
  }
31349
31385
  context.pushStringPart(`>`);
31350
- processChildren(node, context, false, true);
31386
+ processChildren(node, context, false, true, true);
31351
31387
  context.pushStringPart(`</${tag.value.content}>`);
31352
31388
  }
31353
31389
  } else {
@@ -48439,7 +48475,7 @@ var __spreadValues = (a, b) => {
48439
48475
  }
48440
48476
  return a;
48441
48477
  };
48442
- const version = "3.4.35";
48478
+ const version = "3.4.36";
48443
48479
  const parseCache = parseCache$1;
48444
48480
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
48445
48481
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.4.35",
3
+ "version": "3.4.36",
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.35",
51
- "@vue/shared": "3.4.35",
52
- "@vue/compiler-ssr": "3.4.35",
53
- "@vue/compiler-dom": "3.4.35"
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"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.24.7",
@@ -58,7 +58,7 @@
58
58
  "hash-sum": "^2.0.0",
59
59
  "lru-cache": "10.1.0",
60
60
  "merge-source-map": "^1.1.0",
61
- "minimatch": "^9.0.5",
61
+ "minimatch": "~9.0.5",
62
62
  "postcss-modules": "^6.0.0",
63
63
  "postcss-selector-parser": "^6.1.1",
64
64
  "pug": "^3.0.3",