@vue/compiler-sfc 3.5.0-beta.1 → 3.5.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.0-beta.
|
|
2
|
+
* @vue/compiler-sfc v3.5.0-beta.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1831,8 +1831,7 @@ function parse$2(source, options = {}) {
|
|
|
1831
1831
|
pad = false,
|
|
1832
1832
|
ignoreEmpty = true,
|
|
1833
1833
|
compiler = CompilerDOM__namespace,
|
|
1834
|
-
templateParseOptions = {}
|
|
1835
|
-
parseExpressions = true
|
|
1834
|
+
templateParseOptions = {}
|
|
1836
1835
|
} = options;
|
|
1837
1836
|
const descriptor = {
|
|
1838
1837
|
filename,
|
|
@@ -1849,7 +1848,7 @@ function parse$2(source, options = {}) {
|
|
|
1849
1848
|
const errors = [];
|
|
1850
1849
|
const ast = compiler.parse(source, {
|
|
1851
1850
|
parseMode: "sfc",
|
|
1852
|
-
prefixIdentifiers:
|
|
1851
|
+
prefixIdentifiers: true,
|
|
1853
1852
|
...templateParseOptions,
|
|
1854
1853
|
onError: (e) => {
|
|
1855
1854
|
errors.push(e);
|
|
@@ -19144,7 +19143,7 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
19144
19143
|
return ["Symbol"];
|
|
19145
19144
|
case "TSIndexedAccessType": {
|
|
19146
19145
|
const types = resolveIndexType(ctx, node, scope);
|
|
19147
|
-
return flattenTypes(ctx, types, scope);
|
|
19146
|
+
return flattenTypes(ctx, types, scope, isKeyOf);
|
|
19148
19147
|
}
|
|
19149
19148
|
case "ClassDeclaration":
|
|
19150
19149
|
return ["Object"];
|
|
@@ -20856,7 +20855,7 @@ function isStaticNode(node) {
|
|
|
20856
20855
|
return false;
|
|
20857
20856
|
}
|
|
20858
20857
|
|
|
20859
|
-
const version = "3.5.0-beta.
|
|
20858
|
+
const version = "3.5.0-beta.2";
|
|
20860
20859
|
const parseCache = parseCache$1;
|
|
20861
20860
|
const errorMessages = {
|
|
20862
20861
|
...CompilerDOM.errorMessages,
|
package/dist/compiler-sfc.d.ts
CHANGED
|
@@ -160,11 +160,6 @@ export interface SFCParseOptions {
|
|
|
160
160
|
ignoreEmpty?: boolean;
|
|
161
161
|
compiler?: TemplateCompiler;
|
|
162
162
|
templateParseOptions?: ParserOptions;
|
|
163
|
-
/**
|
|
164
|
-
* TODO remove in 3.5
|
|
165
|
-
* @deprecated use `templateParseOptions: { prefixIdentifiers: false }` instead
|
|
166
|
-
*/
|
|
167
|
-
parseExpressions?: boolean;
|
|
168
163
|
}
|
|
169
164
|
export interface SFCBlock {
|
|
170
165
|
type: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.0-beta.
|
|
2
|
+
* @vue/compiler-sfc v3.5.0-beta.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -764,13 +764,13 @@ const decodeMap = new Map([
|
|
|
764
764
|
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
|
|
765
765
|
*/
|
|
766
766
|
const fromCodePoint =
|
|
767
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition,
|
|
767
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
|
|
768
768
|
(_a$1 = String.fromCodePoint) !== null && _a$1 !== void 0 ? _a$1 : function (codePoint) {
|
|
769
769
|
let output = "";
|
|
770
|
-
if (codePoint >
|
|
771
|
-
codePoint -=
|
|
772
|
-
output += String.fromCharCode(((codePoint >>> 10) &
|
|
773
|
-
codePoint =
|
|
770
|
+
if (codePoint > 0xffff) {
|
|
771
|
+
codePoint -= 0x10000;
|
|
772
|
+
output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
|
|
773
|
+
codePoint = 0xdc00 | (codePoint & 0x3ff);
|
|
774
774
|
}
|
|
775
775
|
output += String.fromCharCode(codePoint);
|
|
776
776
|
return output;
|
|
@@ -782,9 +782,8 @@ const fromCodePoint =
|
|
|
782
782
|
*/
|
|
783
783
|
function replaceCodePoint(codePoint) {
|
|
784
784
|
var _a;
|
|
785
|
-
if ((codePoint >=
|
|
786
|
-
|
|
787
|
-
return 65533;
|
|
785
|
+
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
|
|
786
|
+
return 0xfffd;
|
|
788
787
|
}
|
|
789
788
|
return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
|
|
790
789
|
}
|
|
@@ -805,7 +804,7 @@ var CharCodes;
|
|
|
805
804
|
CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
|
|
806
805
|
})(CharCodes || (CharCodes = {}));
|
|
807
806
|
/** Bit that needs to be set to convert an upper case ASCII character to lower case */
|
|
808
|
-
const TO_LOWER_BIT =
|
|
807
|
+
const TO_LOWER_BIT = 0b100000;
|
|
809
808
|
var BinTrieFlags;
|
|
810
809
|
(function (BinTrieFlags) {
|
|
811
810
|
BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
|
|
@@ -906,32 +905,32 @@ class EntityDecoder {
|
|
|
906
905
|
* Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
|
|
907
906
|
* entity is incomplete, and resume when the next string is written.
|
|
908
907
|
*
|
|
909
|
-
* @param
|
|
908
|
+
* @param string The string containing the entity (or a continuation of the entity).
|
|
910
909
|
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
|
|
911
910
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
912
911
|
*/
|
|
913
|
-
write(
|
|
912
|
+
write(str, offset) {
|
|
914
913
|
switch (this.state) {
|
|
915
914
|
case EntityDecoderState.EntityStart: {
|
|
916
|
-
if (
|
|
915
|
+
if (str.charCodeAt(offset) === CharCodes.NUM) {
|
|
917
916
|
this.state = EntityDecoderState.NumericStart;
|
|
918
917
|
this.consumed += 1;
|
|
919
|
-
return this.stateNumericStart(
|
|
918
|
+
return this.stateNumericStart(str, offset + 1);
|
|
920
919
|
}
|
|
921
920
|
this.state = EntityDecoderState.NamedEntity;
|
|
922
|
-
return this.stateNamedEntity(
|
|
921
|
+
return this.stateNamedEntity(str, offset);
|
|
923
922
|
}
|
|
924
923
|
case EntityDecoderState.NumericStart: {
|
|
925
|
-
return this.stateNumericStart(
|
|
924
|
+
return this.stateNumericStart(str, offset);
|
|
926
925
|
}
|
|
927
926
|
case EntityDecoderState.NumericDecimal: {
|
|
928
|
-
return this.stateNumericDecimal(
|
|
927
|
+
return this.stateNumericDecimal(str, offset);
|
|
929
928
|
}
|
|
930
929
|
case EntityDecoderState.NumericHex: {
|
|
931
|
-
return this.stateNumericHex(
|
|
930
|
+
return this.stateNumericHex(str, offset);
|
|
932
931
|
}
|
|
933
932
|
case EntityDecoderState.NamedEntity: {
|
|
934
|
-
return this.stateNamedEntity(
|
|
933
|
+
return this.stateNamedEntity(str, offset);
|
|
935
934
|
}
|
|
936
935
|
}
|
|
937
936
|
}
|
|
@@ -940,28 +939,28 @@ class EntityDecoder {
|
|
|
940
939
|
*
|
|
941
940
|
* Equivalent to the `Numeric character reference state` in the HTML spec.
|
|
942
941
|
*
|
|
943
|
-
* @param
|
|
942
|
+
* @param str The string containing the entity (or a continuation of the entity).
|
|
944
943
|
* @param offset The current offset.
|
|
945
944
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
946
945
|
*/
|
|
947
|
-
stateNumericStart(
|
|
948
|
-
if (offset >=
|
|
946
|
+
stateNumericStart(str, offset) {
|
|
947
|
+
if (offset >= str.length) {
|
|
949
948
|
return -1;
|
|
950
949
|
}
|
|
951
|
-
if ((
|
|
950
|
+
if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
|
|
952
951
|
this.state = EntityDecoderState.NumericHex;
|
|
953
952
|
this.consumed += 1;
|
|
954
|
-
return this.stateNumericHex(
|
|
953
|
+
return this.stateNumericHex(str, offset + 1);
|
|
955
954
|
}
|
|
956
955
|
this.state = EntityDecoderState.NumericDecimal;
|
|
957
|
-
return this.stateNumericDecimal(
|
|
956
|
+
return this.stateNumericDecimal(str, offset);
|
|
958
957
|
}
|
|
959
|
-
addToNumericResult(
|
|
958
|
+
addToNumericResult(str, start, end, base) {
|
|
960
959
|
if (start !== end) {
|
|
961
960
|
const digitCount = end - start;
|
|
962
961
|
this.result =
|
|
963
962
|
this.result * Math.pow(base, digitCount) +
|
|
964
|
-
|
|
963
|
+
parseInt(str.substr(start, digitCount), base);
|
|
965
964
|
this.consumed += digitCount;
|
|
966
965
|
}
|
|
967
966
|
}
|
|
@@ -970,23 +969,23 @@ class EntityDecoder {
|
|
|
970
969
|
*
|
|
971
970
|
* Equivalent to the `Hexademical character reference state` in the HTML spec.
|
|
972
971
|
*
|
|
973
|
-
* @param
|
|
972
|
+
* @param str The string containing the entity (or a continuation of the entity).
|
|
974
973
|
* @param offset The current offset.
|
|
975
974
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
976
975
|
*/
|
|
977
|
-
stateNumericHex(
|
|
978
|
-
const
|
|
979
|
-
while (offset <
|
|
980
|
-
const char =
|
|
976
|
+
stateNumericHex(str, offset) {
|
|
977
|
+
const startIdx = offset;
|
|
978
|
+
while (offset < str.length) {
|
|
979
|
+
const char = str.charCodeAt(offset);
|
|
981
980
|
if (isNumber$2(char) || isHexadecimalCharacter(char)) {
|
|
982
981
|
offset += 1;
|
|
983
982
|
}
|
|
984
983
|
else {
|
|
985
|
-
this.addToNumericResult(
|
|
984
|
+
this.addToNumericResult(str, startIdx, offset, 16);
|
|
986
985
|
return this.emitNumericEntity(char, 3);
|
|
987
986
|
}
|
|
988
987
|
}
|
|
989
|
-
this.addToNumericResult(
|
|
988
|
+
this.addToNumericResult(str, startIdx, offset, 16);
|
|
990
989
|
return -1;
|
|
991
990
|
}
|
|
992
991
|
/**
|
|
@@ -994,23 +993,23 @@ class EntityDecoder {
|
|
|
994
993
|
*
|
|
995
994
|
* Equivalent to the `Decimal character reference state` in the HTML spec.
|
|
996
995
|
*
|
|
997
|
-
* @param
|
|
996
|
+
* @param str The string containing the entity (or a continuation of the entity).
|
|
998
997
|
* @param offset The current offset.
|
|
999
998
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
1000
999
|
*/
|
|
1001
|
-
stateNumericDecimal(
|
|
1002
|
-
const
|
|
1003
|
-
while (offset <
|
|
1004
|
-
const char =
|
|
1000
|
+
stateNumericDecimal(str, offset) {
|
|
1001
|
+
const startIdx = offset;
|
|
1002
|
+
while (offset < str.length) {
|
|
1003
|
+
const char = str.charCodeAt(offset);
|
|
1005
1004
|
if (isNumber$2(char)) {
|
|
1006
1005
|
offset += 1;
|
|
1007
1006
|
}
|
|
1008
1007
|
else {
|
|
1009
|
-
this.addToNumericResult(
|
|
1008
|
+
this.addToNumericResult(str, startIdx, offset, 10);
|
|
1010
1009
|
return this.emitNumericEntity(char, 2);
|
|
1011
1010
|
}
|
|
1012
1011
|
}
|
|
1013
|
-
this.addToNumericResult(
|
|
1012
|
+
this.addToNumericResult(str, startIdx, offset, 10);
|
|
1014
1013
|
return -1;
|
|
1015
1014
|
}
|
|
1016
1015
|
/**
|
|
@@ -1054,17 +1053,17 @@ class EntityDecoder {
|
|
|
1054
1053
|
*
|
|
1055
1054
|
* Equivalent to the `Named character reference state` in the HTML spec.
|
|
1056
1055
|
*
|
|
1057
|
-
* @param
|
|
1056
|
+
* @param str The string containing the entity (or a continuation of the entity).
|
|
1058
1057
|
* @param offset The current offset.
|
|
1059
1058
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
1060
1059
|
*/
|
|
1061
|
-
stateNamedEntity(
|
|
1060
|
+
stateNamedEntity(str, offset) {
|
|
1062
1061
|
const { decodeTree } = this;
|
|
1063
1062
|
let current = decodeTree[this.treeIndex];
|
|
1064
1063
|
// The mask is the number of bytes of the value, including the current byte.
|
|
1065
1064
|
let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
1066
|
-
for (; offset <
|
|
1067
|
-
const char =
|
|
1065
|
+
for (; offset < str.length; offset++, this.excess++) {
|
|
1066
|
+
const char = str.charCodeAt(offset);
|
|
1068
1067
|
this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
|
|
1069
1068
|
if (this.treeIndex < 0) {
|
|
1070
1069
|
return this.result === 0 ||
|
|
@@ -1171,28 +1170,28 @@ class EntityDecoder {
|
|
|
1171
1170
|
* @returns A function that decodes entities in a string.
|
|
1172
1171
|
*/
|
|
1173
1172
|
function getDecoder(decodeTree) {
|
|
1174
|
-
let
|
|
1175
|
-
const decoder = new EntityDecoder(decodeTree, (
|
|
1176
|
-
return function decodeWithTrie(
|
|
1173
|
+
let ret = "";
|
|
1174
|
+
const decoder = new EntityDecoder(decodeTree, (str) => (ret += fromCodePoint(str)));
|
|
1175
|
+
return function decodeWithTrie(str, decodeMode) {
|
|
1177
1176
|
let lastIndex = 0;
|
|
1178
1177
|
let offset = 0;
|
|
1179
|
-
while ((offset =
|
|
1180
|
-
|
|
1178
|
+
while ((offset = str.indexOf("&", offset)) >= 0) {
|
|
1179
|
+
ret += str.slice(lastIndex, offset);
|
|
1181
1180
|
decoder.startEntity(decodeMode);
|
|
1182
|
-
const
|
|
1181
|
+
const len = decoder.write(str,
|
|
1183
1182
|
// Skip the "&"
|
|
1184
1183
|
offset + 1);
|
|
1185
|
-
if (
|
|
1184
|
+
if (len < 0) {
|
|
1186
1185
|
lastIndex = offset + decoder.end();
|
|
1187
1186
|
break;
|
|
1188
1187
|
}
|
|
1189
|
-
lastIndex = offset +
|
|
1190
|
-
// If `
|
|
1191
|
-
offset =
|
|
1188
|
+
lastIndex = offset + len;
|
|
1189
|
+
// If `len` is 0, skip the current `&` and continue.
|
|
1190
|
+
offset = len === 0 ? lastIndex + 1 : lastIndex;
|
|
1192
1191
|
}
|
|
1193
|
-
const result =
|
|
1192
|
+
const result = ret + str.slice(lastIndex);
|
|
1194
1193
|
// Make sure we don't keep a reference to the final string.
|
|
1195
|
-
|
|
1194
|
+
ret = "";
|
|
1196
1195
|
return result;
|
|
1197
1196
|
};
|
|
1198
1197
|
}
|
|
@@ -1206,31 +1205,31 @@ function getDecoder(decodeTree) {
|
|
|
1206
1205
|
* @param char The current character.
|
|
1207
1206
|
* @returns The index of the next node, or -1 if no branch is taken.
|
|
1208
1207
|
*/
|
|
1209
|
-
function determineBranch(decodeTree, current,
|
|
1208
|
+
function determineBranch(decodeTree, current, nodeIdx, char) {
|
|
1210
1209
|
const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
|
|
1211
1210
|
const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
|
|
1212
1211
|
// Case 1: Single branch encoded in jump offset
|
|
1213
1212
|
if (branchCount === 0) {
|
|
1214
|
-
return jumpOffset !== 0 && char === jumpOffset ?
|
|
1213
|
+
return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
|
|
1215
1214
|
}
|
|
1216
1215
|
// Case 2: Multiple branches encoded in jump table
|
|
1217
1216
|
if (jumpOffset) {
|
|
1218
1217
|
const value = char - jumpOffset;
|
|
1219
1218
|
return value < 0 || value >= branchCount
|
|
1220
1219
|
? -1
|
|
1221
|
-
: decodeTree[
|
|
1220
|
+
: decodeTree[nodeIdx + value] - 1;
|
|
1222
1221
|
}
|
|
1223
1222
|
// Case 3: Multiple branches encoded in dictionary
|
|
1224
1223
|
// Binary search for the character.
|
|
1225
|
-
let lo =
|
|
1224
|
+
let lo = nodeIdx;
|
|
1226
1225
|
let hi = lo + branchCount - 1;
|
|
1227
1226
|
while (lo <= hi) {
|
|
1228
1227
|
const mid = (lo + hi) >>> 1;
|
|
1229
|
-
const
|
|
1230
|
-
if (
|
|
1228
|
+
const midVal = decodeTree[mid];
|
|
1229
|
+
if (midVal < char) {
|
|
1231
1230
|
lo = mid + 1;
|
|
1232
1231
|
}
|
|
1233
|
-
else if (
|
|
1232
|
+
else if (midVal > char) {
|
|
1234
1233
|
hi = mid - 1;
|
|
1235
1234
|
}
|
|
1236
1235
|
else {
|
|
@@ -1244,12 +1243,12 @@ getDecoder(xmlDecodeTree);
|
|
|
1244
1243
|
/**
|
|
1245
1244
|
* Decodes an HTML string.
|
|
1246
1245
|
*
|
|
1247
|
-
* @param
|
|
1246
|
+
* @param str The string to decode.
|
|
1248
1247
|
* @param mode The decoding mode.
|
|
1249
1248
|
* @returns The decoded string.
|
|
1250
1249
|
*/
|
|
1251
|
-
function decodeHTML(
|
|
1252
|
-
return htmlDecoder(
|
|
1250
|
+
function decodeHTML(str, mode = DecodingMode.Legacy) {
|
|
1251
|
+
return htmlDecoder(str, mode);
|
|
1253
1252
|
}
|
|
1254
1253
|
|
|
1255
1254
|
const defaultDelimitersOpen = new Uint8Array([123, 123]);
|
|
@@ -16921,8 +16920,9 @@ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
|
16921
16920
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
16922
16921
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
16923
16922
|
const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
|
|
16924
|
-
const
|
|
16925
|
-
|
|
16923
|
+
const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
|
|
16924
|
+
const isMemberExpressionBrowser = (exp) => {
|
|
16925
|
+
const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
|
|
16926
16926
|
let state = 0 /* inMemberExp */;
|
|
16927
16927
|
let stateStack = [];
|
|
16928
16928
|
let currentOpenBracketCount = 0;
|
|
@@ -16983,10 +16983,10 @@ const isMemberExpressionBrowser = (path) => {
|
|
|
16983
16983
|
}
|
|
16984
16984
|
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
16985
16985
|
};
|
|
16986
|
-
const isMemberExpressionNode = (
|
|
16986
|
+
const isMemberExpressionNode = (exp, context) => {
|
|
16987
16987
|
try {
|
|
16988
|
-
let ret = parseExpression_1(
|
|
16989
|
-
plugins: context.expressionPlugins
|
|
16988
|
+
let ret = exp.ast || parseExpression_1(getExpSource(exp), {
|
|
16989
|
+
plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
|
|
16990
16990
|
});
|
|
16991
16991
|
ret = unwrapTSNode(ret);
|
|
16992
16992
|
return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
|
|
@@ -16995,6 +16995,26 @@ const isMemberExpressionNode = (path, context) => {
|
|
|
16995
16995
|
}
|
|
16996
16996
|
};
|
|
16997
16997
|
const isMemberExpression = isMemberExpressionNode;
|
|
16998
|
+
const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
16999
|
+
const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
|
|
17000
|
+
const isFnExpressionNode = (exp, context) => {
|
|
17001
|
+
try {
|
|
17002
|
+
let ret = exp.ast || parseExpression_1(getExpSource(exp), {
|
|
17003
|
+
plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
|
|
17004
|
+
});
|
|
17005
|
+
if (ret.type === "Program") {
|
|
17006
|
+
ret = ret.body[0];
|
|
17007
|
+
if (ret.type === "ExpressionStatement") {
|
|
17008
|
+
ret = ret.expression;
|
|
17009
|
+
}
|
|
17010
|
+
}
|
|
17011
|
+
ret = unwrapTSNode(ret);
|
|
17012
|
+
return ret.type === "FunctionExpression" || ret.type === "ArrowFunctionExpression";
|
|
17013
|
+
} catch (e) {
|
|
17014
|
+
return false;
|
|
17015
|
+
}
|
|
17016
|
+
};
|
|
17017
|
+
const isFnExpression = isFnExpressionNode;
|
|
16998
17018
|
function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
|
|
16999
17019
|
return advancePositionWithMutation(
|
|
17000
17020
|
{
|
|
@@ -24296,7 +24316,6 @@ function processSlotOutlet(node, context) {
|
|
|
24296
24316
|
};
|
|
24297
24317
|
}
|
|
24298
24318
|
|
|
24299
|
-
const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
24300
24319
|
const transformOn$1 = (dir, node, context, augmentor) => {
|
|
24301
24320
|
const { loc, modifiers, arg } = dir;
|
|
24302
24321
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -24340,8 +24359,8 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
24340
24359
|
}
|
|
24341
24360
|
let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
|
|
24342
24361
|
if (exp) {
|
|
24343
|
-
const isMemberExp = isMemberExpression(exp
|
|
24344
|
-
const isInlineStatement = !(isMemberExp ||
|
|
24362
|
+
const isMemberExp = isMemberExpression(exp, context);
|
|
24363
|
+
const isInlineStatement = !(isMemberExp || isFnExpression(exp, context));
|
|
24345
24364
|
const hasMultipleStatements = exp.content.includes(`;`);
|
|
24346
24365
|
if (context.prefixIdentifiers) {
|
|
24347
24366
|
isInlineStatement && context.addIdentifiers(`$event`);
|
|
@@ -24511,7 +24530,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
24511
24530
|
return createTransformProps();
|
|
24512
24531
|
}
|
|
24513
24532
|
const maybeRef = context.inline && (bindingType === "setup-let" || bindingType === "setup-ref" || bindingType === "setup-maybe-ref");
|
|
24514
|
-
if (!expString.trim() || !isMemberExpression(
|
|
24533
|
+
if (!expString.trim() || !isMemberExpression(exp, context) && !maybeRef) {
|
|
24515
24534
|
context.onError(
|
|
24516
24535
|
createCompilerError(42, exp.loc)
|
|
24517
24536
|
);
|
|
@@ -25684,6 +25703,9 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
25684
25703
|
helperNameMap: helperNameMap,
|
|
25685
25704
|
injectProp: injectProp,
|
|
25686
25705
|
isCoreComponent: isCoreComponent,
|
|
25706
|
+
isFnExpression: isFnExpression,
|
|
25707
|
+
isFnExpressionBrowser: isFnExpressionBrowser,
|
|
25708
|
+
isFnExpressionNode: isFnExpressionNode,
|
|
25687
25709
|
isFunctionType: isFunctionType,
|
|
25688
25710
|
isInDestructureAssignment: isInDestructureAssignment,
|
|
25689
25711
|
isInNewExpression: isInNewExpression,
|
|
@@ -26566,8 +26588,7 @@ function parse$7(source, options = {}) {
|
|
|
26566
26588
|
pad = false,
|
|
26567
26589
|
ignoreEmpty = true,
|
|
26568
26590
|
compiler = CompilerDOM,
|
|
26569
|
-
templateParseOptions = {}
|
|
26570
|
-
parseExpressions = true
|
|
26591
|
+
templateParseOptions = {}
|
|
26571
26592
|
} = options;
|
|
26572
26593
|
const descriptor = {
|
|
26573
26594
|
filename,
|
|
@@ -26584,7 +26605,7 @@ function parse$7(source, options = {}) {
|
|
|
26584
26605
|
const errors = [];
|
|
26585
26606
|
const ast = compiler.parse(source, __spreadProps$9(__spreadValues$a({
|
|
26586
26607
|
parseMode: "sfc",
|
|
26587
|
-
prefixIdentifiers:
|
|
26608
|
+
prefixIdentifiers: true
|
|
26588
26609
|
}, templateParseOptions), {
|
|
26589
26610
|
onError: (e) => {
|
|
26590
26611
|
errors.push(e);
|
|
@@ -47024,7 +47045,7 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
47024
47045
|
return ["Symbol"];
|
|
47025
47046
|
case "TSIndexedAccessType": {
|
|
47026
47047
|
const types = resolveIndexType(ctx, node, scope);
|
|
47027
|
-
return flattenTypes(ctx, types, scope);
|
|
47048
|
+
return flattenTypes(ctx, types, scope, isKeyOf);
|
|
47028
47049
|
}
|
|
47029
47050
|
case "ClassDeclaration":
|
|
47030
47051
|
return ["Object"];
|
|
@@ -48766,7 +48787,7 @@ var __spreadValues = (a, b) => {
|
|
|
48766
48787
|
}
|
|
48767
48788
|
return a;
|
|
48768
48789
|
};
|
|
48769
|
-
const version = "3.5.0-beta.
|
|
48790
|
+
const version = "3.5.0-beta.2";
|
|
48770
48791
|
const parseCache = parseCache$1;
|
|
48771
48792
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
48772
48793
|
const walk = walk$2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.5.0-beta.
|
|
3
|
+
"version": "3.5.0-beta.2",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"@babel/parser": "^7.25.3",
|
|
46
46
|
"estree-walker": "^2.0.2",
|
|
47
47
|
"magic-string": "^0.30.11",
|
|
48
|
-
"postcss": "^8.4.
|
|
48
|
+
"postcss": "^8.4.41",
|
|
49
49
|
"source-map-js": "^1.2.0",
|
|
50
|
-
"@vue/compiler-core": "3.5.0-beta.
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/compiler-
|
|
53
|
-
"@vue/shared": "3.5.0-beta.
|
|
50
|
+
"@vue/compiler-core": "3.5.0-beta.2",
|
|
51
|
+
"@vue/compiler-ssr": "3.5.0-beta.2",
|
|
52
|
+
"@vue/compiler-dom": "3.5.0-beta.2",
|
|
53
|
+
"@vue/shared": "3.5.0-beta.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@babel/types": "^7.25.2",
|