@vue/compiler-sfc 3.5.21 → 3.5.23
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 +87 -31
- package/dist/compiler-sfc.esm-browser.js +419 -262
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.
|
|
2
|
+
* @vue/compiler-sfc v3.5.23
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2880,7 +2880,7 @@ function requireLib () {
|
|
|
2880
2880
|
allowUndeclaredExports: false,
|
|
2881
2881
|
allowYieldOutsideFunction: false,
|
|
2882
2882
|
plugins: [],
|
|
2883
|
-
strictMode:
|
|
2883
|
+
strictMode: undefined,
|
|
2884
2884
|
ranges: false,
|
|
2885
2885
|
tokens: false,
|
|
2886
2886
|
createImportExpressions: false,
|
|
@@ -3068,7 +3068,6 @@ function requireLib () {
|
|
|
3068
3068
|
}
|
|
3069
3069
|
convertPrivateNameToPrivateIdentifier(node) {
|
|
3070
3070
|
const name = super.getPrivateNameSV(node);
|
|
3071
|
-
node = node;
|
|
3072
3071
|
delete node.id;
|
|
3073
3072
|
node.name = name;
|
|
3074
3073
|
return this.castNodeTo(node, "PrivateIdentifier");
|
|
@@ -3183,8 +3182,8 @@ function requireLib () {
|
|
|
3183
3182
|
node.kind = "init";
|
|
3184
3183
|
return this.finishNode(node, "Property");
|
|
3185
3184
|
}
|
|
3186
|
-
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
3187
|
-
return type === "Property" ? "value" : super.isValidLVal(type, isUnparenthesizedInAssign, binding);
|
|
3185
|
+
isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding) {
|
|
3186
|
+
return type === "Property" ? "value" : super.isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding);
|
|
3188
3187
|
}
|
|
3189
3188
|
isAssignable(node, isBinding) {
|
|
3190
3189
|
if (node != null && this.isObjectProperty(node)) {
|
|
@@ -3901,13 +3900,13 @@ function requireLib () {
|
|
|
3901
3900
|
context.push(types.j_expr, types.j_oTag);
|
|
3902
3901
|
};
|
|
3903
3902
|
}
|
|
3904
|
-
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\
|
|
3905
|
-
let nonASCIIidentifierChars = "\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\
|
|
3903
|
+
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
3904
|
+
let nonASCIIidentifierChars = "\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
|
|
3906
3905
|
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
3907
3906
|
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
3908
3907
|
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
3909
|
-
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25,
|
|
3910
|
-
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1,
|
|
3908
|
+
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
|
|
3909
|
+
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
3911
3910
|
function isInAstralSet(code, set) {
|
|
3912
3911
|
let pos = 0x10000;
|
|
3913
3912
|
for (let i = 0, length = set.length; i < length; i += 2) {
|
|
@@ -4091,7 +4090,7 @@ function requireLib () {
|
|
|
4091
4090
|
if (bindingType & 8) {
|
|
4092
4091
|
return scope.names.has(name);
|
|
4093
4092
|
}
|
|
4094
|
-
const type = scope.names.get(name);
|
|
4093
|
+
const type = scope.names.get(name) || 0;
|
|
4095
4094
|
if (bindingType & 16) {
|
|
4096
4095
|
return (type & 2) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & 1) > 0;
|
|
4097
4096
|
}
|
|
@@ -4406,9 +4405,8 @@ function requireLib () {
|
|
|
4406
4405
|
return this.flowParseDeclareInterface(node);
|
|
4407
4406
|
} else if (this.match(82)) {
|
|
4408
4407
|
return this.flowParseDeclareExportDeclaration(node, insideModule);
|
|
4409
|
-
} else {
|
|
4410
|
-
this.unexpected();
|
|
4411
4408
|
}
|
|
4409
|
+
throw this.unexpected();
|
|
4412
4410
|
}
|
|
4413
4411
|
flowParseDeclareVariable(node) {
|
|
4414
4412
|
this.next();
|
|
@@ -4428,18 +4426,17 @@ function requireLib () {
|
|
|
4428
4426
|
const body = bodyNode.body = [];
|
|
4429
4427
|
this.expect(5);
|
|
4430
4428
|
while (!this.match(8)) {
|
|
4431
|
-
|
|
4429
|
+
const bodyNode = this.startNode();
|
|
4432
4430
|
if (this.match(83)) {
|
|
4433
4431
|
this.next();
|
|
4434
4432
|
if (!this.isContextual(130) && !this.match(87)) {
|
|
4435
4433
|
this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
|
|
4436
4434
|
}
|
|
4437
|
-
super.parseImport(bodyNode);
|
|
4435
|
+
body.push(super.parseImport(bodyNode));
|
|
4438
4436
|
} else {
|
|
4439
4437
|
this.expectContextual(125, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
4440
|
-
|
|
4438
|
+
body.push(this.flowParseDeclare(bodyNode, true));
|
|
4441
4439
|
}
|
|
4442
|
-
body.push(bodyNode);
|
|
4443
4440
|
}
|
|
4444
4441
|
this.scope.exit();
|
|
4445
4442
|
this.expect(8);
|
|
@@ -4500,7 +4497,7 @@ function requireLib () {
|
|
|
4500
4497
|
}
|
|
4501
4498
|
}
|
|
4502
4499
|
}
|
|
4503
|
-
this.unexpected();
|
|
4500
|
+
throw this.unexpected();
|
|
4504
4501
|
}
|
|
4505
4502
|
flowParseDeclareModuleExports(node) {
|
|
4506
4503
|
this.next();
|
|
@@ -4708,7 +4705,7 @@ function requireLib () {
|
|
|
4708
4705
|
return this.finishNode(node, "TypeParameterInstantiation");
|
|
4709
4706
|
}
|
|
4710
4707
|
flowParseTypeParameterInstantiationCallOrNew() {
|
|
4711
|
-
if (this.reScan_lt() !== 47) return;
|
|
4708
|
+
if (this.reScan_lt() !== 47) return null;
|
|
4712
4709
|
const node = this.startNode();
|
|
4713
4710
|
const oldInType = this.state.inType;
|
|
4714
4711
|
node.params = [];
|
|
@@ -5204,8 +5201,7 @@ function requireLib () {
|
|
|
5204
5201
|
}
|
|
5205
5202
|
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
5206
5203
|
}
|
|
5207
|
-
this.unexpected();
|
|
5208
|
-
return;
|
|
5204
|
+
throw this.unexpected();
|
|
5209
5205
|
case 135:
|
|
5210
5206
|
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
5211
5207
|
case 136:
|
|
@@ -5236,7 +5232,7 @@ function requireLib () {
|
|
|
5236
5232
|
return this.flowIdentToTypeAnnotation(startLoc, node, this.parseIdentifier());
|
|
5237
5233
|
}
|
|
5238
5234
|
}
|
|
5239
|
-
this.unexpected();
|
|
5235
|
+
throw this.unexpected();
|
|
5240
5236
|
}
|
|
5241
5237
|
flowParsePostfixType() {
|
|
5242
5238
|
const startLoc = this.state.startLoc;
|
|
@@ -5697,15 +5693,15 @@ function requireLib () {
|
|
|
5697
5693
|
}
|
|
5698
5694
|
return exprList;
|
|
5699
5695
|
}
|
|
5700
|
-
parseArrayLike(close,
|
|
5701
|
-
const node = super.parseArrayLike(close,
|
|
5702
|
-
if (
|
|
5696
|
+
parseArrayLike(close, isTuple, refExpressionErrors) {
|
|
5697
|
+
const node = super.parseArrayLike(close, isTuple, refExpressionErrors);
|
|
5698
|
+
if (refExpressionErrors != null && !this.state.maybeInArrowParameters) {
|
|
5703
5699
|
this.toReferencedList(node.elements);
|
|
5704
5700
|
}
|
|
5705
5701
|
return node;
|
|
5706
5702
|
}
|
|
5707
|
-
isValidLVal(type, isParenthesized, binding) {
|
|
5708
|
-
return type === "TypeCastExpression" || super.isValidLVal(type, isParenthesized, binding);
|
|
5703
|
+
isValidLVal(type, disallowCallExpression, isParenthesized, binding) {
|
|
5704
|
+
return type === "TypeCastExpression" || super.isValidLVal(type, disallowCallExpression, isParenthesized, binding);
|
|
5709
5705
|
}
|
|
5710
5706
|
parseClassProperty(node) {
|
|
5711
5707
|
if (this.match(14)) {
|
|
@@ -7554,10 +7550,8 @@ function requireLib () {
|
|
|
7554
7550
|
setLeadingComments(commentWS.trailingNode, comments);
|
|
7555
7551
|
}
|
|
7556
7552
|
} else {
|
|
7557
|
-
const
|
|
7558
|
-
|
|
7559
|
-
start: commentStart
|
|
7560
|
-
} = commentWS;
|
|
7553
|
+
const node = commentWS.containingNode;
|
|
7554
|
+
const commentStart = commentWS.start;
|
|
7561
7555
|
if (this.input.charCodeAt(this.offsetToSourcePos(commentStart) - 1) === 44) {
|
|
7562
7556
|
switch (node.type) {
|
|
7563
7557
|
case "ObjectExpression":
|
|
@@ -8378,7 +8372,7 @@ function requireLib () {
|
|
|
8378
8372
|
const commentWhitespace = {
|
|
8379
8373
|
start: this.sourceToOffsetPos(spaceStart),
|
|
8380
8374
|
end: this.sourceToOffsetPos(end),
|
|
8381
|
-
comments,
|
|
8375
|
+
comments: comments,
|
|
8382
8376
|
leadingNode: null,
|
|
8383
8377
|
trailingNode: null,
|
|
8384
8378
|
containingNode: null
|
|
@@ -9389,7 +9383,7 @@ function requireLib () {
|
|
|
9389
9383
|
};
|
|
9390
9384
|
}
|
|
9391
9385
|
return {
|
|
9392
|
-
node,
|
|
9386
|
+
node: node,
|
|
9393
9387
|
error: null,
|
|
9394
9388
|
thrown: false,
|
|
9395
9389
|
aborted: false,
|
|
@@ -9645,7 +9639,7 @@ function requireLib () {
|
|
|
9645
9639
|
if (isLHS) {
|
|
9646
9640
|
if (parenthesized.type === "Identifier") {
|
|
9647
9641
|
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
|
|
9648
|
-
} else if (parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
|
|
9642
|
+
} else if (parenthesized.type !== "CallExpression" && parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
|
|
9649
9643
|
this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
9650
9644
|
}
|
|
9651
9645
|
} else {
|
|
@@ -9921,7 +9915,7 @@ function requireLib () {
|
|
|
9921
9915
|
node.right = this.parseMaybeAssignAllowIn();
|
|
9922
9916
|
return this.finishNode(node, "AssignmentPattern");
|
|
9923
9917
|
}
|
|
9924
|
-
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
9918
|
+
isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding) {
|
|
9925
9919
|
switch (type) {
|
|
9926
9920
|
case "AssignmentPattern":
|
|
9927
9921
|
return "left";
|
|
@@ -9937,13 +9931,17 @@ function requireLib () {
|
|
|
9937
9931
|
return "properties";
|
|
9938
9932
|
case "VoidPattern":
|
|
9939
9933
|
return true;
|
|
9934
|
+
case "CallExpression":
|
|
9935
|
+
if (!disallowCallExpression && !this.state.strict && this.optionFlags & 8192) {
|
|
9936
|
+
return true;
|
|
9937
|
+
}
|
|
9940
9938
|
}
|
|
9941
9939
|
return false;
|
|
9942
9940
|
}
|
|
9943
9941
|
isOptionalMemberExpression(expression) {
|
|
9944
9942
|
return expression.type === "OptionalMemberExpression";
|
|
9945
9943
|
}
|
|
9946
|
-
checkLVal(expression, ancestor, binding = 64, checkClashes = false, strictModeChanged = false, hasParenthesizedAncestor = false) {
|
|
9944
|
+
checkLVal(expression, ancestor, binding = 64, checkClashes = false, strictModeChanged = false, hasParenthesizedAncestor = false, disallowCallExpression = false) {
|
|
9947
9945
|
var _expression$extra;
|
|
9948
9946
|
const type = expression.type;
|
|
9949
9947
|
if (this.isObjectMethod(expression)) return;
|
|
@@ -9978,7 +9976,9 @@ function requireLib () {
|
|
|
9978
9976
|
} else if (type === "VoidPattern" && ancestor.type === "CatchClause") {
|
|
9979
9977
|
this.raise(Errors.VoidPatternCatchClauseParam, expression);
|
|
9980
9978
|
}
|
|
9981
|
-
const
|
|
9979
|
+
const unwrappedExpression = unwrapParenthesizedExpression(expression);
|
|
9980
|
+
disallowCallExpression || (disallowCallExpression = unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super"));
|
|
9981
|
+
const validity = this.isValidLVal(type, disallowCallExpression, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
9982
9982
|
if (validity === true) return;
|
|
9983
9983
|
if (validity === false) {
|
|
9984
9984
|
const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
|
|
@@ -10001,11 +10001,11 @@ function requireLib () {
|
|
|
10001
10001
|
if (Array.isArray(val)) {
|
|
10002
10002
|
for (const child of val) {
|
|
10003
10003
|
if (child) {
|
|
10004
|
-
this.checkLVal(child, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression);
|
|
10004
|
+
this.checkLVal(child, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression, true);
|
|
10005
10005
|
}
|
|
10006
10006
|
}
|
|
10007
10007
|
} else if (val) {
|
|
10008
|
-
this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression);
|
|
10008
|
+
this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression, disallowCallExpression);
|
|
10009
10009
|
}
|
|
10010
10010
|
}
|
|
10011
10011
|
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
@@ -10053,6 +10053,7 @@ function requireLib () {
|
|
|
10053
10053
|
return true;
|
|
10054
10054
|
}
|
|
10055
10055
|
}
|
|
10056
|
+
const keywordAndTSRelationalOperator = /in(?:stanceof)?|as|satisfies/y;
|
|
10056
10057
|
function nonNull(x) {
|
|
10057
10058
|
if (x == null) {
|
|
10058
10059
|
throw new Error(`Unexpected ${x} value.`);
|
|
@@ -10940,7 +10941,7 @@ function requireLib () {
|
|
|
10940
10941
|
}
|
|
10941
10942
|
}
|
|
10942
10943
|
}
|
|
10943
|
-
this.unexpected();
|
|
10944
|
+
throw this.unexpected();
|
|
10944
10945
|
}
|
|
10945
10946
|
tsParseArrayTypeOrHigher() {
|
|
10946
10947
|
const {
|
|
@@ -11504,52 +11505,22 @@ function requireLib () {
|
|
|
11504
11505
|
}
|
|
11505
11506
|
default:
|
|
11506
11507
|
if (tokenIsIdentifier(startType)) {
|
|
11507
|
-
return this.tsParseDeclaration(node, this.state.
|
|
11508
|
+
return this.tsParseDeclaration(node, this.state.type, true, null);
|
|
11508
11509
|
}
|
|
11509
11510
|
}
|
|
11510
11511
|
});
|
|
11511
11512
|
}
|
|
11512
11513
|
tsTryParseExportDeclaration() {
|
|
11513
|
-
return this.tsParseDeclaration(this.startNode(), this.state.
|
|
11514
|
+
return this.tsParseDeclaration(this.startNode(), this.state.type, true, null);
|
|
11514
11515
|
}
|
|
11515
|
-
|
|
11516
|
-
switch (
|
|
11517
|
-
case
|
|
11518
|
-
{
|
|
11519
|
-
const declaration = this.tsTryParseDeclare(node);
|
|
11520
|
-
if (declaration) {
|
|
11521
|
-
declaration.declare = true;
|
|
11522
|
-
}
|
|
11523
|
-
return declaration;
|
|
11524
|
-
}
|
|
11525
|
-
case "global":
|
|
11526
|
-
if (this.match(5)) {
|
|
11527
|
-
this.scope.enter(1024);
|
|
11528
|
-
this.prodParam.enter(0);
|
|
11529
|
-
const mod = node;
|
|
11530
|
-
mod.kind = "global";
|
|
11531
|
-
{
|
|
11532
|
-
node.global = true;
|
|
11533
|
-
}
|
|
11534
|
-
mod.id = expr;
|
|
11535
|
-
mod.body = this.tsParseModuleBlock();
|
|
11536
|
-
this.scope.exit();
|
|
11537
|
-
this.prodParam.exit();
|
|
11538
|
-
return this.finishNode(mod, "TSModuleDeclaration");
|
|
11539
|
-
}
|
|
11540
|
-
break;
|
|
11541
|
-
default:
|
|
11542
|
-
return this.tsParseDeclaration(node, expr.name, false, decorators);
|
|
11543
|
-
}
|
|
11544
|
-
}
|
|
11545
|
-
tsParseDeclaration(node, value, next, decorators) {
|
|
11546
|
-
switch (value) {
|
|
11547
|
-
case "abstract":
|
|
11516
|
+
tsParseDeclaration(node, type, next, decorators) {
|
|
11517
|
+
switch (type) {
|
|
11518
|
+
case 124:
|
|
11548
11519
|
if (this.tsCheckLineTerminator(next) && (this.match(80) || tokenIsIdentifier(this.state.type))) {
|
|
11549
11520
|
return this.tsParseAbstractDeclaration(node, decorators);
|
|
11550
11521
|
}
|
|
11551
11522
|
break;
|
|
11552
|
-
case
|
|
11523
|
+
case 127:
|
|
11553
11524
|
if (this.tsCheckLineTerminator(next)) {
|
|
11554
11525
|
if (this.match(134)) {
|
|
11555
11526
|
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
@@ -11559,13 +11530,13 @@ function requireLib () {
|
|
|
11559
11530
|
}
|
|
11560
11531
|
}
|
|
11561
11532
|
break;
|
|
11562
|
-
case
|
|
11533
|
+
case 128:
|
|
11563
11534
|
if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
|
|
11564
11535
|
node.kind = "namespace";
|
|
11565
11536
|
return this.tsParseModuleOrNamespaceDeclaration(node);
|
|
11566
11537
|
}
|
|
11567
11538
|
break;
|
|
11568
|
-
case
|
|
11539
|
+
case 130:
|
|
11569
11540
|
if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
|
|
11570
11541
|
return this.tsParseTypeAliasDeclaration(node);
|
|
11571
11542
|
}
|
|
@@ -11706,8 +11677,8 @@ function requireLib () {
|
|
|
11706
11677
|
this.tsCheckForInvalidTypeCasts(exprList);
|
|
11707
11678
|
return exprList;
|
|
11708
11679
|
}
|
|
11709
|
-
parseArrayLike(close,
|
|
11710
|
-
const node = super.parseArrayLike(close,
|
|
11680
|
+
parseArrayLike(close, isTuple, refExpressionErrors) {
|
|
11681
|
+
const node = super.parseArrayLike(close, isTuple, refExpressionErrors);
|
|
11711
11682
|
if (node.type === "ArrayExpression") {
|
|
11712
11683
|
this.tsCheckForInvalidTypeCasts(node.elements);
|
|
11713
11684
|
}
|
|
@@ -11952,19 +11923,85 @@ function requireLib () {
|
|
|
11952
11923
|
return declaration;
|
|
11953
11924
|
}
|
|
11954
11925
|
parseStatementContent(flags, decorators) {
|
|
11955
|
-
if (this.
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11926
|
+
if (!this.state.containsEsc) {
|
|
11927
|
+
switch (this.state.type) {
|
|
11928
|
+
case 75:
|
|
11929
|
+
{
|
|
11930
|
+
if (this.isLookaheadContextual("enum")) {
|
|
11931
|
+
const node = this.startNode();
|
|
11932
|
+
this.expect(75);
|
|
11933
|
+
return this.tsParseEnumDeclaration(node, {
|
|
11934
|
+
const: true
|
|
11935
|
+
});
|
|
11936
|
+
}
|
|
11937
|
+
break;
|
|
11938
|
+
}
|
|
11939
|
+
case 124:
|
|
11940
|
+
case 125:
|
|
11941
|
+
{
|
|
11942
|
+
if (this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()) {
|
|
11943
|
+
const token = this.state.type;
|
|
11944
|
+
const node = this.startNode();
|
|
11945
|
+
this.next();
|
|
11946
|
+
const declaration = token === 125 ? this.tsTryParseDeclare(node) : this.tsParseAbstractDeclaration(node, decorators);
|
|
11947
|
+
if (declaration) {
|
|
11948
|
+
if (token === 125) {
|
|
11949
|
+
declaration.declare = true;
|
|
11950
|
+
}
|
|
11951
|
+
return declaration;
|
|
11952
|
+
} else {
|
|
11953
|
+
node.expression = this.createIdentifier(this.startNodeAt(node.loc.start), token === 125 ? "declare" : "abstract");
|
|
11954
|
+
this.semicolon(false);
|
|
11955
|
+
return this.finishNode(node, "ExpressionStatement");
|
|
11956
|
+
}
|
|
11957
|
+
}
|
|
11958
|
+
break;
|
|
11959
|
+
}
|
|
11960
|
+
case 126:
|
|
11961
|
+
return this.tsParseEnumDeclaration(this.startNode());
|
|
11962
|
+
case 112:
|
|
11963
|
+
{
|
|
11964
|
+
const nextCh = this.lookaheadCharCode();
|
|
11965
|
+
if (nextCh === 123) {
|
|
11966
|
+
const node = this.startNode();
|
|
11967
|
+
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
11968
|
+
}
|
|
11969
|
+
break;
|
|
11970
|
+
}
|
|
11971
|
+
case 129:
|
|
11972
|
+
{
|
|
11973
|
+
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
11974
|
+
if (result) return result;
|
|
11975
|
+
break;
|
|
11976
|
+
}
|
|
11977
|
+
case 127:
|
|
11978
|
+
{
|
|
11979
|
+
if (this.nextTokenIsIdentifierOrStringLiteralOnSameLine()) {
|
|
11980
|
+
const node = this.startNode();
|
|
11981
|
+
this.next();
|
|
11982
|
+
return this.tsParseDeclaration(node, 127, false, decorators);
|
|
11983
|
+
}
|
|
11984
|
+
break;
|
|
11985
|
+
}
|
|
11986
|
+
case 128:
|
|
11987
|
+
{
|
|
11988
|
+
if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
11989
|
+
const node = this.startNode();
|
|
11990
|
+
this.next();
|
|
11991
|
+
return this.tsParseDeclaration(node, 128, false, decorators);
|
|
11992
|
+
}
|
|
11993
|
+
break;
|
|
11994
|
+
}
|
|
11995
|
+
case 130:
|
|
11996
|
+
{
|
|
11997
|
+
if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
11998
|
+
const node = this.startNode();
|
|
11999
|
+
this.next();
|
|
12000
|
+
return this.tsParseTypeAliasDeclaration(node);
|
|
12001
|
+
}
|
|
12002
|
+
break;
|
|
12003
|
+
}
|
|
12004
|
+
}
|
|
11968
12005
|
}
|
|
11969
12006
|
return super.parseStatementContent(flags, decorators);
|
|
11970
12007
|
}
|
|
@@ -12048,10 +12085,6 @@ function requireLib () {
|
|
|
12048
12085
|
this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
|
|
12049
12086
|
}
|
|
12050
12087
|
}
|
|
12051
|
-
parseExpressionStatement(node, expr, decorators) {
|
|
12052
|
-
const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr, decorators) : undefined;
|
|
12053
|
-
return decl || super.parseExpressionStatement(node, expr, decorators);
|
|
12054
|
-
}
|
|
12055
12088
|
shouldParseExportDeclaration() {
|
|
12056
12089
|
if (this.tsIsDeclarationStart()) return true;
|
|
12057
12090
|
return super.shouldParseExportDeclaration();
|
|
@@ -12376,7 +12409,7 @@ function requireLib () {
|
|
|
12376
12409
|
super.checkToRestConversion(node, allowPattern);
|
|
12377
12410
|
}
|
|
12378
12411
|
}
|
|
12379
|
-
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
12412
|
+
isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding) {
|
|
12380
12413
|
switch (type) {
|
|
12381
12414
|
case "TSTypeCastExpression":
|
|
12382
12415
|
return true;
|
|
@@ -12389,7 +12422,7 @@ function requireLib () {
|
|
|
12389
12422
|
case "TSTypeAssertion":
|
|
12390
12423
|
return (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true];
|
|
12391
12424
|
default:
|
|
12392
|
-
return super.isValidLVal(type, isUnparenthesizedInAssign, binding);
|
|
12425
|
+
return super.isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding);
|
|
12393
12426
|
}
|
|
12394
12427
|
}
|
|
12395
12428
|
parseBindingAtom() {
|
|
@@ -12551,10 +12584,11 @@ function requireLib () {
|
|
|
12551
12584
|
node.abstract = true;
|
|
12552
12585
|
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifier, node);
|
|
12553
12586
|
return this.tsParseInterfaceDeclaration(node);
|
|
12587
|
+
} else {
|
|
12588
|
+
return null;
|
|
12554
12589
|
}
|
|
12555
|
-
} else {
|
|
12556
|
-
this.unexpected(null, 80);
|
|
12557
12590
|
}
|
|
12591
|
+
throw this.unexpected(null, 80);
|
|
12558
12592
|
}
|
|
12559
12593
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
|
|
12560
12594
|
const method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
@@ -12664,7 +12698,7 @@ function requireLib () {
|
|
|
12664
12698
|
}
|
|
12665
12699
|
}
|
|
12666
12700
|
fillOptionalPropertiesForTSESLint(node) {
|
|
12667
|
-
var _node$directive, _node$decorators, _node$optional, _node$typeAnnotation, _node$accessibility, _node$decorators2, _node$override, _node$readonly, _node$static, _node$declare, _node$returnType, _node$typeParameters, _node$optional2, _node$optional3, _node$accessibility2, _node$readonly2, _node$static2, _node$declare2, _node$definite, _node$readonly3, _node$typeAnnotation2, _node$accessibility3, _node$decorators3, _node$override2, _node$optional4, _node$id, _node$abstract, _node$declare3, _node$decorators4, _node$implements, _node$superTypeArgume, _node$typeParameters2, _node$declare4, _node$definite2, _node$const, _node$declare5, _node$computed, _node$qualifier, _node$options, _node$declare6, _node$extends, _node$declare7, _node$global, _node$const2, _node$in, _node$out;
|
|
12701
|
+
var _node$directive, _node$decorators, _node$optional, _node$typeAnnotation, _node$accessibility, _node$decorators2, _node$override, _node$readonly, _node$static, _node$declare, _node$returnType, _node$typeParameters, _node$optional2, _node$optional3, _node$accessibility2, _node$readonly2, _node$static2, _node$declare2, _node$definite, _node$readonly3, _node$typeAnnotation2, _node$accessibility3, _node$decorators3, _node$override2, _node$optional4, _node$id, _node$abstract, _node$declare3, _node$decorators4, _node$implements, _node$superTypeArgume, _node$typeParameters2, _node$declare4, _node$definite2, _node$const, _node$declare5, _node$computed, _node$qualifier, _node$options, _node$declare6, _node$extends, _node$optional5, _node$readonly4, _node$declare7, _node$global, _node$const2, _node$in, _node$out;
|
|
12668
12702
|
switch (node.type) {
|
|
12669
12703
|
case "ExpressionStatement":
|
|
12670
12704
|
(_node$directive = node.directive) != null ? _node$directive : node.directive = undefined;
|
|
@@ -12755,6 +12789,10 @@ function requireLib () {
|
|
|
12755
12789
|
(_node$declare6 = node.declare) != null ? _node$declare6 : node.declare = false;
|
|
12756
12790
|
(_node$extends = node.extends) != null ? _node$extends : node.extends = [];
|
|
12757
12791
|
return;
|
|
12792
|
+
case "TSMappedType":
|
|
12793
|
+
(_node$optional5 = node.optional) != null ? _node$optional5 : node.optional = false;
|
|
12794
|
+
(_node$readonly4 = node.readonly) != null ? _node$readonly4 : node.readonly = undefined;
|
|
12795
|
+
return;
|
|
12758
12796
|
case "TSModuleDeclaration":
|
|
12759
12797
|
(_node$declare7 = node.declare) != null ? _node$declare7 : node.declare = false;
|
|
12760
12798
|
(_node$global = node.global) != null ? _node$global : node.global = node.kind === "global";
|
|
@@ -12766,6 +12804,32 @@ function requireLib () {
|
|
|
12766
12804
|
return;
|
|
12767
12805
|
}
|
|
12768
12806
|
}
|
|
12807
|
+
chStartsBindingIdentifierAndNotRelationalOperator(ch, pos) {
|
|
12808
|
+
if (isIdentifierStart(ch)) {
|
|
12809
|
+
keywordAndTSRelationalOperator.lastIndex = pos;
|
|
12810
|
+
if (keywordAndTSRelationalOperator.test(this.input)) {
|
|
12811
|
+
const endCh = this.codePointAtPos(keywordAndTSRelationalOperator.lastIndex);
|
|
12812
|
+
if (!isIdentifierChar(endCh) && endCh !== 92) {
|
|
12813
|
+
return false;
|
|
12814
|
+
}
|
|
12815
|
+
}
|
|
12816
|
+
return true;
|
|
12817
|
+
} else if (ch === 92) {
|
|
12818
|
+
return true;
|
|
12819
|
+
} else {
|
|
12820
|
+
return false;
|
|
12821
|
+
}
|
|
12822
|
+
}
|
|
12823
|
+
nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine() {
|
|
12824
|
+
const next = this.nextTokenInLineStart();
|
|
12825
|
+
const nextCh = this.codePointAtPos(next);
|
|
12826
|
+
return this.chStartsBindingIdentifierAndNotRelationalOperator(nextCh, next);
|
|
12827
|
+
}
|
|
12828
|
+
nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
12829
|
+
const next = this.nextTokenInLineStart();
|
|
12830
|
+
const nextCh = this.codePointAtPos(next);
|
|
12831
|
+
return this.chStartsBindingIdentifier(nextCh, next) || nextCh === 34 || nextCh === 39;
|
|
12832
|
+
}
|
|
12769
12833
|
};
|
|
12770
12834
|
function isPossiblyLiteralEnum(expression) {
|
|
12771
12835
|
if (expression.type !== "MemberExpression") return false;
|
|
@@ -12894,8 +12958,8 @@ function requireLib () {
|
|
|
12894
12958
|
parseBindingAtom() {
|
|
12895
12959
|
return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
|
|
12896
12960
|
}
|
|
12897
|
-
isValidLVal(type, isParenthesized, binding) {
|
|
12898
|
-
return type === "Placeholder" || super.isValidLVal(type, isParenthesized, binding);
|
|
12961
|
+
isValidLVal(type, disallowCallExpression, isParenthesized, binding) {
|
|
12962
|
+
return type === "Placeholder" || super.isValidLVal(type, disallowCallExpression, isParenthesized, binding);
|
|
12899
12963
|
}
|
|
12900
12964
|
toAssignable(node, isLHS) {
|
|
12901
12965
|
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
|
|
@@ -13295,7 +13359,7 @@ function requireLib () {
|
|
|
13295
13359
|
}
|
|
13296
13360
|
this.next();
|
|
13297
13361
|
node.right = this.parseMaybeAssign();
|
|
13298
|
-
this.checkLVal(left, this.finishNode(node, "AssignmentExpression"));
|
|
13362
|
+
this.checkLVal(left, this.finishNode(node, "AssignmentExpression"), undefined, undefined, undefined, undefined, operator === "||=" || operator === "&&=" || operator === "??=");
|
|
13299
13363
|
return node;
|
|
13300
13364
|
} else if (ownExpressionErrors) {
|
|
13301
13365
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
@@ -13769,7 +13833,7 @@ function requireLib () {
|
|
|
13769
13833
|
}
|
|
13770
13834
|
case 0:
|
|
13771
13835
|
{
|
|
13772
|
-
return this.parseArrayLike(3,
|
|
13836
|
+
return this.parseArrayLike(3, false, refExpressionErrors);
|
|
13773
13837
|
}
|
|
13774
13838
|
case 5:
|
|
13775
13839
|
{
|
|
@@ -13826,25 +13890,22 @@ function requireLib () {
|
|
|
13826
13890
|
if (pipeProposal) {
|
|
13827
13891
|
return this.parseTopicReference(pipeProposal);
|
|
13828
13892
|
}
|
|
13829
|
-
this.unexpected();
|
|
13830
|
-
break;
|
|
13893
|
+
throw this.unexpected();
|
|
13831
13894
|
}
|
|
13832
13895
|
case 47:
|
|
13833
13896
|
{
|
|
13834
13897
|
const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
|
|
13835
13898
|
if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) {
|
|
13836
|
-
this.expectOnePlugin(["jsx", "flow", "typescript"]);
|
|
13837
|
-
} else {
|
|
13838
|
-
this.unexpected();
|
|
13899
|
+
throw this.expectOnePlugin(["jsx", "flow", "typescript"]);
|
|
13839
13900
|
}
|
|
13840
|
-
|
|
13901
|
+
throw this.unexpected();
|
|
13841
13902
|
}
|
|
13842
13903
|
default:
|
|
13843
13904
|
{
|
|
13844
13905
|
if (type === 137) {
|
|
13845
13906
|
return this.parseDecimalLiteral(this.state.value);
|
|
13846
13907
|
} else if (type === 2 || type === 1) {
|
|
13847
|
-
return this.parseArrayLike(this.state.type === 2 ? 4 : 3,
|
|
13908
|
+
return this.parseArrayLike(this.state.type === 2 ? 4 : 3, true);
|
|
13848
13909
|
} else if (type === 6 || type === 7) {
|
|
13849
13910
|
return this.parseObjectLike(this.state.type === 6 ? 9 : 8, false, true);
|
|
13850
13911
|
}
|
|
@@ -13881,7 +13942,7 @@ function requireLib () {
|
|
|
13881
13942
|
}
|
|
13882
13943
|
return id;
|
|
13883
13944
|
} else {
|
|
13884
|
-
this.unexpected();
|
|
13945
|
+
throw this.unexpected();
|
|
13885
13946
|
}
|
|
13886
13947
|
}
|
|
13887
13948
|
}
|
|
@@ -13894,9 +13955,8 @@ function requireLib () {
|
|
|
13894
13955
|
this.state.end--;
|
|
13895
13956
|
this.state.endLoc = createPositionWithColumnOffset(this.state.endLoc, -1);
|
|
13896
13957
|
return this.parseTopicReference(pipeProposal);
|
|
13897
|
-
} else {
|
|
13898
|
-
this.unexpected();
|
|
13899
13958
|
}
|
|
13959
|
+
throw this.unexpected();
|
|
13900
13960
|
}
|
|
13901
13961
|
parseTopicReference(pipeProposal) {
|
|
13902
13962
|
const node = this.startNode();
|
|
@@ -13972,10 +14032,18 @@ function requireLib () {
|
|
|
13972
14032
|
parseSuper() {
|
|
13973
14033
|
const node = this.startNode();
|
|
13974
14034
|
this.next();
|
|
13975
|
-
if (this.match(10) && !this.scope.allowDirectSuper
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
14035
|
+
if (this.match(10) && !this.scope.allowDirectSuper) {
|
|
14036
|
+
{
|
|
14037
|
+
if (!(this.optionFlags & 16)) {
|
|
14038
|
+
this.raise(Errors.SuperNotAllowed, node);
|
|
14039
|
+
}
|
|
14040
|
+
}
|
|
14041
|
+
} else if (!this.scope.allowSuper) {
|
|
14042
|
+
{
|
|
14043
|
+
if (!(this.optionFlags & 16)) {
|
|
14044
|
+
this.raise(Errors.UnexpectedSuper, node);
|
|
14045
|
+
}
|
|
14046
|
+
}
|
|
13979
14047
|
}
|
|
13980
14048
|
if (!this.match(10) && !this.match(0) && !this.match(16)) {
|
|
13981
14049
|
this.raise(Errors.UnsupportedSuper, node);
|
|
@@ -14489,7 +14557,7 @@ function requireLib () {
|
|
|
14489
14557
|
this.scope.exit();
|
|
14490
14558
|
return finishedNode;
|
|
14491
14559
|
}
|
|
14492
|
-
parseArrayLike(close,
|
|
14560
|
+
parseArrayLike(close, isTuple, refExpressionErrors) {
|
|
14493
14561
|
if (isTuple) {
|
|
14494
14562
|
this.expectPlugin("recordAndTuple");
|
|
14495
14563
|
}
|
|
@@ -15115,9 +15183,7 @@ function requireLib () {
|
|
|
15115
15183
|
if (!this.isContextual(107)) {
|
|
15116
15184
|
return false;
|
|
15117
15185
|
}
|
|
15118
|
-
|
|
15119
|
-
const nextCh = this.codePointAtPos(next);
|
|
15120
|
-
return this.chStartsBindingIdentifier(nextCh, next);
|
|
15186
|
+
return this.nextTokenIsIdentifierOnSameLine();
|
|
15121
15187
|
}
|
|
15122
15188
|
isForUsing() {
|
|
15123
15189
|
if (!this.isContextual(107)) {
|
|
@@ -15136,6 +15202,11 @@ function requireLib () {
|
|
|
15136
15202
|
}
|
|
15137
15203
|
return false;
|
|
15138
15204
|
}
|
|
15205
|
+
nextTokenIsIdentifierOnSameLine() {
|
|
15206
|
+
const next = this.nextTokenInLineStart();
|
|
15207
|
+
const nextCh = this.codePointAtPos(next);
|
|
15208
|
+
return this.chStartsBindingIdentifier(nextCh, next);
|
|
15209
|
+
}
|
|
15139
15210
|
isAwaitUsing() {
|
|
15140
15211
|
if (!this.isContextual(96)) {
|
|
15141
15212
|
return false;
|
|
@@ -16278,7 +16349,7 @@ function requireLib () {
|
|
|
16278
16349
|
this.sawUnambiguousESM = true;
|
|
16279
16350
|
return this.finishNode(node2, "ExportDefaultDeclaration");
|
|
16280
16351
|
}
|
|
16281
|
-
this.unexpected(null, 5);
|
|
16352
|
+
throw this.unexpected(null, 5);
|
|
16282
16353
|
}
|
|
16283
16354
|
eatExportStar(node) {
|
|
16284
16355
|
return this.eat(55);
|
|
@@ -16870,54 +16941,54 @@ function requireLib () {
|
|
|
16870
16941
|
}
|
|
16871
16942
|
class Parser extends StatementParser {
|
|
16872
16943
|
constructor(options, input, pluginsMap) {
|
|
16873
|
-
|
|
16874
|
-
super(
|
|
16875
|
-
this.options =
|
|
16944
|
+
const normalizedOptions = getOptions(options);
|
|
16945
|
+
super(normalizedOptions, input);
|
|
16946
|
+
this.options = normalizedOptions;
|
|
16876
16947
|
this.initializeScopes();
|
|
16877
16948
|
this.plugins = pluginsMap;
|
|
16878
|
-
this.filename =
|
|
16879
|
-
this.startIndex =
|
|
16949
|
+
this.filename = normalizedOptions.sourceFilename;
|
|
16950
|
+
this.startIndex = normalizedOptions.startIndex;
|
|
16880
16951
|
let optionFlags = 0;
|
|
16881
|
-
if (
|
|
16952
|
+
if (normalizedOptions.allowAwaitOutsideFunction) {
|
|
16882
16953
|
optionFlags |= 1;
|
|
16883
16954
|
}
|
|
16884
|
-
if (
|
|
16955
|
+
if (normalizedOptions.allowReturnOutsideFunction) {
|
|
16885
16956
|
optionFlags |= 2;
|
|
16886
16957
|
}
|
|
16887
|
-
if (
|
|
16958
|
+
if (normalizedOptions.allowImportExportEverywhere) {
|
|
16888
16959
|
optionFlags |= 8;
|
|
16889
16960
|
}
|
|
16890
|
-
if (
|
|
16961
|
+
if (normalizedOptions.allowSuperOutsideMethod) {
|
|
16891
16962
|
optionFlags |= 16;
|
|
16892
16963
|
}
|
|
16893
|
-
if (
|
|
16964
|
+
if (normalizedOptions.allowUndeclaredExports) {
|
|
16894
16965
|
optionFlags |= 64;
|
|
16895
16966
|
}
|
|
16896
|
-
if (
|
|
16967
|
+
if (normalizedOptions.allowNewTargetOutsideFunction) {
|
|
16897
16968
|
optionFlags |= 4;
|
|
16898
16969
|
}
|
|
16899
|
-
if (
|
|
16970
|
+
if (normalizedOptions.allowYieldOutsideFunction) {
|
|
16900
16971
|
optionFlags |= 32;
|
|
16901
16972
|
}
|
|
16902
|
-
if (
|
|
16973
|
+
if (normalizedOptions.ranges) {
|
|
16903
16974
|
optionFlags |= 128;
|
|
16904
16975
|
}
|
|
16905
|
-
if (
|
|
16976
|
+
if (normalizedOptions.tokens) {
|
|
16906
16977
|
optionFlags |= 256;
|
|
16907
16978
|
}
|
|
16908
|
-
if (
|
|
16979
|
+
if (normalizedOptions.createImportExpressions) {
|
|
16909
16980
|
optionFlags |= 512;
|
|
16910
16981
|
}
|
|
16911
|
-
if (
|
|
16982
|
+
if (normalizedOptions.createParenthesizedExpressions) {
|
|
16912
16983
|
optionFlags |= 1024;
|
|
16913
16984
|
}
|
|
16914
|
-
if (
|
|
16985
|
+
if (normalizedOptions.errorRecovery) {
|
|
16915
16986
|
optionFlags |= 2048;
|
|
16916
16987
|
}
|
|
16917
|
-
if (
|
|
16988
|
+
if (normalizedOptions.attachComment) {
|
|
16918
16989
|
optionFlags |= 4096;
|
|
16919
16990
|
}
|
|
16920
|
-
if (
|
|
16991
|
+
if (normalizedOptions.annexB) {
|
|
16921
16992
|
optionFlags |= 8192;
|
|
16922
16993
|
}
|
|
16923
16994
|
this.optionFlags = optionFlags;
|
|
@@ -16931,10 +17002,10 @@ function requireLib () {
|
|
|
16931
17002
|
const program = this.startNode();
|
|
16932
17003
|
this.nextToken();
|
|
16933
17004
|
file.errors = null;
|
|
16934
|
-
this.parseTopLevel(file, program);
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
return
|
|
17005
|
+
const result = this.parseTopLevel(file, program);
|
|
17006
|
+
result.errors = this.state.errors;
|
|
17007
|
+
result.comments.length = this.state.commentsLen;
|
|
17008
|
+
return result;
|
|
16938
17009
|
}
|
|
16939
17010
|
}
|
|
16940
17011
|
function parse(input, options) {
|
|
@@ -17266,16 +17337,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
17266
17337
|
(id) => markScopeIdentifier(node, id, knownIds)
|
|
17267
17338
|
);
|
|
17268
17339
|
}
|
|
17340
|
+
} else if (node.type === "SwitchStatement") {
|
|
17341
|
+
if (node.scopeIds) {
|
|
17342
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
17343
|
+
} else {
|
|
17344
|
+
walkSwitchStatement(
|
|
17345
|
+
node,
|
|
17346
|
+
false,
|
|
17347
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
17348
|
+
);
|
|
17349
|
+
}
|
|
17269
17350
|
} else if (node.type === "CatchClause" && node.param) {
|
|
17270
|
-
|
|
17271
|
-
|
|
17351
|
+
if (node.scopeIds) {
|
|
17352
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
17353
|
+
} else {
|
|
17354
|
+
for (const id of extractIdentifiers$1(node.param)) {
|
|
17355
|
+
markScopeIdentifier(node, id, knownIds);
|
|
17356
|
+
}
|
|
17272
17357
|
}
|
|
17273
17358
|
} else if (isForStatement(node)) {
|
|
17274
|
-
|
|
17275
|
-
node,
|
|
17276
|
-
|
|
17277
|
-
(
|
|
17278
|
-
|
|
17359
|
+
if (node.scopeIds) {
|
|
17360
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
17361
|
+
} else {
|
|
17362
|
+
walkForStatement(
|
|
17363
|
+
node,
|
|
17364
|
+
false,
|
|
17365
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
17366
|
+
);
|
|
17367
|
+
}
|
|
17279
17368
|
}
|
|
17280
17369
|
},
|
|
17281
17370
|
leave(node, parent) {
|
|
@@ -17346,7 +17435,8 @@ function walkFunctionParams(node, onIdent) {
|
|
|
17346
17435
|
}
|
|
17347
17436
|
}
|
|
17348
17437
|
function walkBlockDeclarations(block, onIdent) {
|
|
17349
|
-
|
|
17438
|
+
const body = block.type === "SwitchCase" ? block.consequent : block.body;
|
|
17439
|
+
for (const stmt of body) {
|
|
17350
17440
|
if (stmt.type === "VariableDeclaration") {
|
|
17351
17441
|
if (stmt.declare) continue;
|
|
17352
17442
|
for (const decl of stmt.declarations) {
|
|
@@ -17359,6 +17449,8 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
17359
17449
|
onIdent(stmt.id);
|
|
17360
17450
|
} else if (isForStatement(stmt)) {
|
|
17361
17451
|
walkForStatement(stmt, true, onIdent);
|
|
17452
|
+
} else if (stmt.type === "SwitchStatement") {
|
|
17453
|
+
walkSwitchStatement(stmt, true, onIdent);
|
|
17362
17454
|
}
|
|
17363
17455
|
}
|
|
17364
17456
|
}
|
|
@@ -17375,6 +17467,20 @@ function walkForStatement(stmt, isVar, onIdent) {
|
|
|
17375
17467
|
}
|
|
17376
17468
|
}
|
|
17377
17469
|
}
|
|
17470
|
+
function walkSwitchStatement(stmt, isVar, onIdent) {
|
|
17471
|
+
for (const cs of stmt.cases) {
|
|
17472
|
+
for (const stmt2 of cs.consequent) {
|
|
17473
|
+
if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
|
|
17474
|
+
for (const decl of stmt2.declarations) {
|
|
17475
|
+
for (const id of extractIdentifiers$1(decl.id)) {
|
|
17476
|
+
onIdent(id);
|
|
17477
|
+
}
|
|
17478
|
+
}
|
|
17479
|
+
}
|
|
17480
|
+
}
|
|
17481
|
+
walkBlockDeclarations(cs, onIdent);
|
|
17482
|
+
}
|
|
17483
|
+
}
|
|
17378
17484
|
function extractIdentifiers$1(param, nodes = []) {
|
|
17379
17485
|
switch (param.type) {
|
|
17380
17486
|
case "Identifier":
|
|
@@ -23575,14 +23681,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
23575
23681
|
knownIds
|
|
23576
23682
|
);
|
|
23577
23683
|
const children = [];
|
|
23684
|
+
const isTSNode = TS_NODE_TYPES.includes(ast.type);
|
|
23578
23685
|
ids.sort((a, b) => a.start - b.start);
|
|
23579
23686
|
ids.forEach((id, i) => {
|
|
23580
23687
|
const start = id.start - 1;
|
|
23581
23688
|
const end = id.end - 1;
|
|
23582
23689
|
const last = ids[i - 1];
|
|
23583
|
-
|
|
23584
|
-
|
|
23585
|
-
|
|
23690
|
+
if (!(isTSNode && i === 0)) {
|
|
23691
|
+
const leadingText = rawExp.slice(last ? last.end - 1 : 0, start);
|
|
23692
|
+
if (leadingText.length || id.prefix) {
|
|
23693
|
+
children.push(leadingText + (id.prefix || ``));
|
|
23694
|
+
}
|
|
23586
23695
|
}
|
|
23587
23696
|
const source = rawExp.slice(start, end);
|
|
23588
23697
|
children.push(
|
|
@@ -23597,7 +23706,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
23597
23706
|
id.isConstant ? 3 : 0
|
|
23598
23707
|
)
|
|
23599
23708
|
);
|
|
23600
|
-
if (i === ids.length - 1 && end < rawExp.length) {
|
|
23709
|
+
if (i === ids.length - 1 && end < rawExp.length && !isTSNode) {
|
|
23601
23710
|
children.push(rawExp.slice(end));
|
|
23602
23711
|
}
|
|
23603
23712
|
});
|
|
@@ -23853,90 +23962,6 @@ function getParentCondition(node) {
|
|
|
23853
23962
|
}
|
|
23854
23963
|
}
|
|
23855
23964
|
|
|
23856
|
-
const transformBind = (dir, _node, context) => {
|
|
23857
|
-
const { modifiers, loc } = dir;
|
|
23858
|
-
const arg = dir.arg;
|
|
23859
|
-
let { exp } = dir;
|
|
23860
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
23861
|
-
{
|
|
23862
|
-
context.onError(
|
|
23863
|
-
createCompilerError(34, loc)
|
|
23864
|
-
);
|
|
23865
|
-
return {
|
|
23866
|
-
props: [
|
|
23867
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
23868
|
-
]
|
|
23869
|
-
};
|
|
23870
|
-
}
|
|
23871
|
-
}
|
|
23872
|
-
if (!exp) {
|
|
23873
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
23874
|
-
context.onError(
|
|
23875
|
-
createCompilerError(
|
|
23876
|
-
52,
|
|
23877
|
-
arg.loc
|
|
23878
|
-
)
|
|
23879
|
-
);
|
|
23880
|
-
return {
|
|
23881
|
-
props: [
|
|
23882
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
23883
|
-
]
|
|
23884
|
-
};
|
|
23885
|
-
}
|
|
23886
|
-
transformBindShorthand(dir, context);
|
|
23887
|
-
exp = dir.exp;
|
|
23888
|
-
}
|
|
23889
|
-
if (arg.type !== 4) {
|
|
23890
|
-
arg.children.unshift(`(`);
|
|
23891
|
-
arg.children.push(`) || ""`);
|
|
23892
|
-
} else if (!arg.isStatic) {
|
|
23893
|
-
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
23894
|
-
}
|
|
23895
|
-
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
23896
|
-
if (arg.type === 4) {
|
|
23897
|
-
if (arg.isStatic) {
|
|
23898
|
-
arg.content = camelize(arg.content);
|
|
23899
|
-
} else {
|
|
23900
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
23901
|
-
}
|
|
23902
|
-
} else {
|
|
23903
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
23904
|
-
arg.children.push(`)`);
|
|
23905
|
-
}
|
|
23906
|
-
}
|
|
23907
|
-
if (!context.inSSR) {
|
|
23908
|
-
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
23909
|
-
injectPrefix(arg, ".");
|
|
23910
|
-
}
|
|
23911
|
-
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
23912
|
-
injectPrefix(arg, "^");
|
|
23913
|
-
}
|
|
23914
|
-
}
|
|
23915
|
-
return {
|
|
23916
|
-
props: [createObjectProperty(arg, exp)]
|
|
23917
|
-
};
|
|
23918
|
-
};
|
|
23919
|
-
const transformBindShorthand = (dir, context) => {
|
|
23920
|
-
const arg = dir.arg;
|
|
23921
|
-
const propName = camelize(arg.content);
|
|
23922
|
-
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
23923
|
-
{
|
|
23924
|
-
dir.exp = processExpression(dir.exp, context);
|
|
23925
|
-
}
|
|
23926
|
-
};
|
|
23927
|
-
const injectPrefix = (arg, prefix) => {
|
|
23928
|
-
if (arg.type === 4) {
|
|
23929
|
-
if (arg.isStatic) {
|
|
23930
|
-
arg.content = prefix + arg.content;
|
|
23931
|
-
} else {
|
|
23932
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
23933
|
-
}
|
|
23934
|
-
} else {
|
|
23935
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
23936
|
-
arg.children.push(`)`);
|
|
23937
|
-
}
|
|
23938
|
-
};
|
|
23939
|
-
|
|
23940
23965
|
const transformFor = createStructuralDirectiveTransform(
|
|
23941
23966
|
"for",
|
|
23942
23967
|
(node, dir, context) => {
|
|
@@ -23949,9 +23974,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
23949
23974
|
const memo = findDir(node, "memo");
|
|
23950
23975
|
const keyProp = findProp(node, `key`, false, true);
|
|
23951
23976
|
const isDirKey = keyProp && keyProp.type === 7;
|
|
23952
|
-
if (isDirKey && !keyProp.exp) {
|
|
23953
|
-
transformBindShorthand(keyProp, context);
|
|
23954
|
-
}
|
|
23955
23977
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
23956
23978
|
if (memo && keyExp && isDirKey) {
|
|
23957
23979
|
{
|
|
@@ -25224,6 +25246,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
25224
25246
|
return ret;
|
|
25225
25247
|
};
|
|
25226
25248
|
|
|
25249
|
+
const transformBind = (dir, _node, context) => {
|
|
25250
|
+
const { modifiers, loc } = dir;
|
|
25251
|
+
const arg = dir.arg;
|
|
25252
|
+
let { exp } = dir;
|
|
25253
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
25254
|
+
{
|
|
25255
|
+
context.onError(
|
|
25256
|
+
createCompilerError(34, loc)
|
|
25257
|
+
);
|
|
25258
|
+
return {
|
|
25259
|
+
props: [
|
|
25260
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
25261
|
+
]
|
|
25262
|
+
};
|
|
25263
|
+
}
|
|
25264
|
+
}
|
|
25265
|
+
if (arg.type !== 4) {
|
|
25266
|
+
arg.children.unshift(`(`);
|
|
25267
|
+
arg.children.push(`) || ""`);
|
|
25268
|
+
} else if (!arg.isStatic) {
|
|
25269
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
25270
|
+
}
|
|
25271
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
25272
|
+
if (arg.type === 4) {
|
|
25273
|
+
if (arg.isStatic) {
|
|
25274
|
+
arg.content = camelize(arg.content);
|
|
25275
|
+
} else {
|
|
25276
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
25277
|
+
}
|
|
25278
|
+
} else {
|
|
25279
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
25280
|
+
arg.children.push(`)`);
|
|
25281
|
+
}
|
|
25282
|
+
}
|
|
25283
|
+
if (!context.inSSR) {
|
|
25284
|
+
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
25285
|
+
injectPrefix(arg, ".");
|
|
25286
|
+
}
|
|
25287
|
+
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
25288
|
+
injectPrefix(arg, "^");
|
|
25289
|
+
}
|
|
25290
|
+
}
|
|
25291
|
+
return {
|
|
25292
|
+
props: [createObjectProperty(arg, exp)]
|
|
25293
|
+
};
|
|
25294
|
+
};
|
|
25295
|
+
const injectPrefix = (arg, prefix) => {
|
|
25296
|
+
if (arg.type === 4) {
|
|
25297
|
+
if (arg.isStatic) {
|
|
25298
|
+
arg.content = prefix + arg.content;
|
|
25299
|
+
} else {
|
|
25300
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
25301
|
+
}
|
|
25302
|
+
} else {
|
|
25303
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
25304
|
+
arg.children.push(`)`);
|
|
25305
|
+
}
|
|
25306
|
+
};
|
|
25307
|
+
|
|
25227
25308
|
const transformText = (node, context) => {
|
|
25228
25309
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
25229
25310
|
return () => {
|
|
@@ -25430,9 +25511,36 @@ const transformMemo = (node, context) => {
|
|
|
25430
25511
|
}
|
|
25431
25512
|
};
|
|
25432
25513
|
|
|
25514
|
+
const transformVBindShorthand = (node, context) => {
|
|
25515
|
+
if (node.type === 1) {
|
|
25516
|
+
for (const prop of node.props) {
|
|
25517
|
+
if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
|
|
25518
|
+
false) && prop.arg) {
|
|
25519
|
+
const arg = prop.arg;
|
|
25520
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
25521
|
+
context.onError(
|
|
25522
|
+
createCompilerError(
|
|
25523
|
+
52,
|
|
25524
|
+
arg.loc
|
|
25525
|
+
)
|
|
25526
|
+
);
|
|
25527
|
+
prop.exp = createSimpleExpression("", true, arg.loc);
|
|
25528
|
+
} else {
|
|
25529
|
+
const propName = camelize(arg.content);
|
|
25530
|
+
if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
|
|
25531
|
+
propName[0] === "-") {
|
|
25532
|
+
prop.exp = createSimpleExpression(propName, false, arg.loc);
|
|
25533
|
+
}
|
|
25534
|
+
}
|
|
25535
|
+
}
|
|
25536
|
+
}
|
|
25537
|
+
}
|
|
25538
|
+
};
|
|
25539
|
+
|
|
25433
25540
|
function getBaseTransformPreset(prefixIdentifiers) {
|
|
25434
25541
|
return [
|
|
25435
25542
|
[
|
|
25543
|
+
transformVBindShorthand,
|
|
25436
25544
|
transformOnce,
|
|
25437
25545
|
transformIf,
|
|
25438
25546
|
transformMemo,
|
|
@@ -26027,6 +26135,9 @@ function analyzeNode(node) {
|
|
|
26027
26135
|
if (node.type === 1 && isNonStringifiable(node.tag)) {
|
|
26028
26136
|
return false;
|
|
26029
26137
|
}
|
|
26138
|
+
if (node.type === 1 && findDir(node, "once", true)) {
|
|
26139
|
+
return false;
|
|
26140
|
+
}
|
|
26030
26141
|
if (node.type === 12) {
|
|
26031
26142
|
return [1, 0];
|
|
26032
26143
|
}
|
|
@@ -26556,8 +26667,10 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26556
26667
|
transformModel: transformModel$1,
|
|
26557
26668
|
transformOn: transformOn$1,
|
|
26558
26669
|
transformStyle: transformStyle,
|
|
26670
|
+
transformVBindShorthand: transformVBindShorthand,
|
|
26559
26671
|
traverseNode: traverseNode,
|
|
26560
26672
|
unwrapTSNode: unwrapTSNode,
|
|
26673
|
+
validFirstIdentCharRE: validFirstIdentCharRE,
|
|
26561
26674
|
walkBlockDeclarations: walkBlockDeclarations,
|
|
26562
26675
|
walkFunctionParams: walkFunctionParams,
|
|
26563
26676
|
walkIdentifiers: walkIdentifiers,
|
|
@@ -26661,7 +26774,7 @@ function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
|
26661
26774
|
}
|
|
26662
26775
|
function genVarName(id, raw, isProd, isSSR = false) {
|
|
26663
26776
|
if (isProd) {
|
|
26664
|
-
return hash(id + raw);
|
|
26777
|
+
return hash(id + raw).replace(/^\d/, (r) => `v${r}`);
|
|
26665
26778
|
} else {
|
|
26666
26779
|
return `${id}-${getEscapedCssVarName(raw, isSSR)}`;
|
|
26667
26780
|
}
|
|
@@ -32084,6 +32197,14 @@ const ssrTransformElement = (node, context) => {
|
|
|
32084
32197
|
const hasCustomDir = node.props.some(
|
|
32085
32198
|
(p) => p.type === 7 && !isBuiltInDirective(p.name)
|
|
32086
32199
|
);
|
|
32200
|
+
const vShowPropIndex = node.props.findIndex(
|
|
32201
|
+
(i) => i.type === 7 && i.name === "show"
|
|
32202
|
+
);
|
|
32203
|
+
if (vShowPropIndex !== -1) {
|
|
32204
|
+
const vShowProp = node.props[vShowPropIndex];
|
|
32205
|
+
node.props.splice(vShowPropIndex, 1);
|
|
32206
|
+
node.props.push(vShowProp);
|
|
32207
|
+
}
|
|
32087
32208
|
const needMergeProps = hasDynamicVBind || hasCustomDir;
|
|
32088
32209
|
if (needMergeProps) {
|
|
32089
32210
|
const { props, directives } = buildProps(
|
|
@@ -32102,7 +32223,7 @@ const ssrTransformElement = (node, context) => {
|
|
|
32102
32223
|
);
|
|
32103
32224
|
if (node.tag === "textarea") {
|
|
32104
32225
|
const existingText = node.children[0];
|
|
32105
|
-
if (!existingText || existingText.type !== 5) {
|
|
32226
|
+
if (!hasContentOverrideDirective(node) && (!existingText || existingText.type !== 5)) {
|
|
32106
32227
|
const tempId = `_temp${context.temps++}`;
|
|
32107
32228
|
propsExp.arguments = [
|
|
32108
32229
|
createAssignmentExpression(
|
|
@@ -32149,8 +32270,7 @@ const ssrTransformElement = (node, context) => {
|
|
|
32149
32270
|
];
|
|
32150
32271
|
}
|
|
32151
32272
|
} else if (directives.length && !node.children.length) {
|
|
32152
|
-
|
|
32153
|
-
if (!vText) {
|
|
32273
|
+
if (!hasContentOverrideDirective(node)) {
|
|
32154
32274
|
const tempId = `_temp${context.temps++}`;
|
|
32155
32275
|
propsExp.arguments = [
|
|
32156
32276
|
createAssignmentExpression(
|
|
@@ -32364,6 +32484,9 @@ function findVModel(node) {
|
|
|
32364
32484
|
(p) => p.type === 7 && p.name === "model" && p.exp
|
|
32365
32485
|
);
|
|
32366
32486
|
}
|
|
32487
|
+
function hasContentOverrideDirective(node) {
|
|
32488
|
+
return !!findDir(node, "text") || !!findDir(node, "html");
|
|
32489
|
+
}
|
|
32367
32490
|
function ssrProcessElement(node, context) {
|
|
32368
32491
|
const isVoidTag = context.options.isVoidTag || NO;
|
|
32369
32492
|
const elementsToAdd = node.ssrCodegenNode.elements;
|
|
@@ -33179,6 +33302,7 @@ function compile(source, options = {}) {
|
|
|
33179
33302
|
transform(ast, __spreadProps$6(__spreadValues$7({}, options), {
|
|
33180
33303
|
hoistStatic: false,
|
|
33181
33304
|
nodeTransforms: [
|
|
33305
|
+
transformVBindShorthand,
|
|
33182
33306
|
ssrTransformIf,
|
|
33183
33307
|
ssrTransformFor,
|
|
33184
33308
|
trackVForSlotScopes,
|
|
@@ -45731,6 +45855,9 @@ function getImportedName(specifier) {
|
|
|
45731
45855
|
function getId(node) {
|
|
45732
45856
|
return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
|
|
45733
45857
|
}
|
|
45858
|
+
function getStringLiteralKey(node) {
|
|
45859
|
+
return node.computed ? node.key.type === "TemplateLiteral" && !node.key.expressions.length ? node.key.quasis.map((q) => q.value.cooked).join("") : null : node.key.type === "Identifier" ? node.key.name : node.key.type === "StringLiteral" ? node.key.value : node.key.type === "NumericLiteral" ? String(node.key.value) : null;
|
|
45860
|
+
}
|
|
45734
45861
|
const normalize = (path.posix || path).normalize;
|
|
45735
45862
|
const windowsSlashRE = /\\/g;
|
|
45736
45863
|
function normalizePath(p) {
|
|
@@ -46468,6 +46595,10 @@ class MagicString {
|
|
|
46468
46595
|
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
46469
46596
|
});
|
|
46470
46597
|
|
|
46598
|
+
if (this.outro) {
|
|
46599
|
+
mappings.advance(this.outro);
|
|
46600
|
+
}
|
|
46601
|
+
|
|
46471
46602
|
return {
|
|
46472
46603
|
file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
|
|
46473
46604
|
sources: [
|
|
@@ -47133,7 +47264,12 @@ class MagicString {
|
|
|
47133
47264
|
const index = original.indexOf(string);
|
|
47134
47265
|
|
|
47135
47266
|
if (index !== -1) {
|
|
47136
|
-
|
|
47267
|
+
if (typeof replacement === 'function') {
|
|
47268
|
+
replacement = replacement(string, index, original);
|
|
47269
|
+
}
|
|
47270
|
+
if (string !== replacement) {
|
|
47271
|
+
this.overwrite(index, index + string.length, replacement);
|
|
47272
|
+
}
|
|
47137
47273
|
}
|
|
47138
47274
|
|
|
47139
47275
|
return this;
|
|
@@ -47156,7 +47292,11 @@ class MagicString {
|
|
|
47156
47292
|
index = original.indexOf(string, index + stringLength)
|
|
47157
47293
|
) {
|
|
47158
47294
|
const previous = original.slice(index, index + stringLength);
|
|
47159
|
-
|
|
47295
|
+
let _replacement = replacement;
|
|
47296
|
+
if (typeof replacement === 'function') {
|
|
47297
|
+
_replacement = replacement(previous, index, original);
|
|
47298
|
+
}
|
|
47299
|
+
if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
|
|
47160
47300
|
}
|
|
47161
47301
|
|
|
47162
47302
|
return this;
|
|
@@ -47637,13 +47777,9 @@ function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameter
|
|
|
47637
47777
|
Object.assign(scope.types, typeParameters);
|
|
47638
47778
|
}
|
|
47639
47779
|
e._ownerScope = scope;
|
|
47640
|
-
const name =
|
|
47641
|
-
if (name
|
|
47780
|
+
const name = getStringLiteralKey(e);
|
|
47781
|
+
if (name !== null) {
|
|
47642
47782
|
res.props[name] = e;
|
|
47643
|
-
} else if (e.key.type === "TemplateLiteral") {
|
|
47644
|
-
for (const key of resolveTemplateKeys(ctx, e.key, scope)) {
|
|
47645
|
-
res.props[key] = e;
|
|
47646
|
-
}
|
|
47647
47783
|
} else {
|
|
47648
47784
|
ctx.error(
|
|
47649
47785
|
`Unsupported computed key in type referenced by a macro`,
|
|
@@ -48041,7 +48177,7 @@ function registerTS(_loadTS) {
|
|
|
48041
48177
|
} catch (err) {
|
|
48042
48178
|
if (typeof err.message === "string" && err.message.includes("Cannot find module")) {
|
|
48043
48179
|
throw new Error(
|
|
48044
|
-
'Failed to load TypeScript, which is required for resolving imported types. Please make sure "
|
|
48180
|
+
'Failed to load TypeScript, which is required for resolving imported types. Please make sure "TypeScript" is installed as a project dependency.'
|
|
48045
48181
|
);
|
|
48046
48182
|
} else {
|
|
48047
48183
|
throw new Error(
|
|
@@ -48434,6 +48570,9 @@ function recordImport(node, imports) {
|
|
|
48434
48570
|
}
|
|
48435
48571
|
}
|
|
48436
48572
|
function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false, typeParameters) {
|
|
48573
|
+
if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
48574
|
+
return [UNKNOWN_TYPE];
|
|
48575
|
+
}
|
|
48437
48576
|
try {
|
|
48438
48577
|
switch (node.type) {
|
|
48439
48578
|
case "TSStringKeyword":
|
|
@@ -48670,6 +48809,24 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
48670
48809
|
typeParameters
|
|
48671
48810
|
).filter((t) => t !== UNKNOWN_TYPE);
|
|
48672
48811
|
}
|
|
48812
|
+
case "TSMappedType": {
|
|
48813
|
+
const { typeAnnotation, typeParameter } = node;
|
|
48814
|
+
if (typeAnnotation && typeAnnotation.type === "TSIndexedAccessType" && typeParameter && typeParameter.constraint && typeParameters) {
|
|
48815
|
+
const constraint = typeParameter.constraint;
|
|
48816
|
+
if (constraint.type === "TSTypeOperator" && constraint.operator === "keyof" && constraint.typeAnnotation && constraint.typeAnnotation.type === "TSTypeReference" && constraint.typeAnnotation.typeName.type === "Identifier") {
|
|
48817
|
+
const typeName = constraint.typeAnnotation.typeName.name;
|
|
48818
|
+
const index = typeAnnotation.indexType;
|
|
48819
|
+
const obj = typeAnnotation.objectType;
|
|
48820
|
+
if (obj && obj.type === "TSTypeReference" && obj.typeName.type === "Identifier" && obj.typeName.name === typeName && index && index.type === "TSTypeReference" && index.typeName.type === "Identifier" && index.typeName.name === typeParameter.name) {
|
|
48821
|
+
const targetType = typeParameters[typeName];
|
|
48822
|
+
if (targetType) {
|
|
48823
|
+
return inferRuntimeType(ctx, targetType, scope);
|
|
48824
|
+
}
|
|
48825
|
+
}
|
|
48826
|
+
}
|
|
48827
|
+
}
|
|
48828
|
+
return [UNKNOWN_TYPE];
|
|
48829
|
+
}
|
|
48673
48830
|
case "TSEnumDeclaration":
|
|
48674
48831
|
return inferEnumType(node);
|
|
48675
48832
|
case "TSSymbolKeyword":
|
|
@@ -48818,7 +48975,7 @@ function ctorToType(ctorType) {
|
|
|
48818
48975
|
}
|
|
48819
48976
|
function findStaticPropertyType(node, key) {
|
|
48820
48977
|
const prop = node.members.find(
|
|
48821
|
-
(m) => m.type === "TSPropertySignature" &&
|
|
48978
|
+
(m) => m.type === "TSPropertySignature" && getStringLiteralKey(m) === key && m.typeAnnotation
|
|
48822
48979
|
);
|
|
48823
48980
|
return prop && prop.typeAnnotation.typeAnnotation;
|
|
48824
48981
|
}
|
|
@@ -50091,6 +50248,7 @@ let __temp${any}, __restore${any}
|
|
|
50091
50248
|
}
|
|
50092
50249
|
let templateMap;
|
|
50093
50250
|
let returned;
|
|
50251
|
+
const propsDecl = genRuntimeProps(ctx);
|
|
50094
50252
|
if (!options.inlineTemplate || !sfc.template && ctx.hasDefaultExportRender) {
|
|
50095
50253
|
const allBindings = __spreadValues$1(__spreadValues$1({}, scriptBindings), setupBindings);
|
|
50096
50254
|
for (const key in ctx.userImports) {
|
|
@@ -50193,7 +50351,6 @@ return ${returned}
|
|
|
50193
50351
|
runtimeOptions += `
|
|
50194
50352
|
__ssrInlineRender: true,`;
|
|
50195
50353
|
}
|
|
50196
|
-
const propsDecl = genRuntimeProps(ctx);
|
|
50197
50354
|
if (propsDecl) runtimeOptions += `
|
|
50198
50355
|
props: ${propsDecl},`;
|
|
50199
50356
|
const emitsDecl = genRuntimeEmits(ctx);
|
|
@@ -50476,7 +50633,7 @@ var __spreadValues = (a, b) => {
|
|
|
50476
50633
|
}
|
|
50477
50634
|
return a;
|
|
50478
50635
|
};
|
|
50479
|
-
const version = "3.5.
|
|
50636
|
+
const version = "3.5.23";
|
|
50480
50637
|
const parseCache = parseCache$1;
|
|
50481
50638
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
50482
50639
|
const walk = walk$2;
|