@vue/compiler-sfc 3.5.21 → 3.5.22
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 +25 -4
- package/dist/compiler-sfc.esm-browser.js +187 -102
- package/package.json +9 -9
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.
|
|
2
|
+
* @vue/compiler-sfc v3.5.22
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -140,7 +140,7 @@ function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
|
140
140
|
}
|
|
141
141
|
function genVarName(id, raw, isProd, isSSR = false) {
|
|
142
142
|
if (isProd) {
|
|
143
|
-
return hash(id + raw);
|
|
143
|
+
return hash(id + raw).replace(/^\d/, (r) => `v${r}`);
|
|
144
144
|
} else {
|
|
145
145
|
return `${id}-${shared.getEscapedCssVarName(raw, isSSR)}`;
|
|
146
146
|
}
|
|
@@ -23015,6 +23015,9 @@ function recordImport(node, imports) {
|
|
|
23015
23015
|
}
|
|
23016
23016
|
}
|
|
23017
23017
|
function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false, typeParameters) {
|
|
23018
|
+
if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
23019
|
+
return [UNKNOWN_TYPE];
|
|
23020
|
+
}
|
|
23018
23021
|
try {
|
|
23019
23022
|
switch (node.type) {
|
|
23020
23023
|
case "TSStringKeyword":
|
|
@@ -23251,6 +23254,24 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
23251
23254
|
typeParameters
|
|
23252
23255
|
).filter((t) => t !== UNKNOWN_TYPE);
|
|
23253
23256
|
}
|
|
23257
|
+
case "TSMappedType": {
|
|
23258
|
+
const { typeAnnotation, typeParameter } = node;
|
|
23259
|
+
if (typeAnnotation && typeAnnotation.type === "TSIndexedAccessType" && typeParameter && typeParameter.constraint && typeParameters) {
|
|
23260
|
+
const constraint = typeParameter.constraint;
|
|
23261
|
+
if (constraint.type === "TSTypeOperator" && constraint.operator === "keyof" && constraint.typeAnnotation && constraint.typeAnnotation.type === "TSTypeReference" && constraint.typeAnnotation.typeName.type === "Identifier") {
|
|
23262
|
+
const typeName = constraint.typeAnnotation.typeName.name;
|
|
23263
|
+
const index = typeAnnotation.indexType;
|
|
23264
|
+
const obj = typeAnnotation.objectType;
|
|
23265
|
+
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) {
|
|
23266
|
+
const targetType = typeParameters[typeName];
|
|
23267
|
+
if (targetType) {
|
|
23268
|
+
return inferRuntimeType(ctx, targetType, scope);
|
|
23269
|
+
}
|
|
23270
|
+
}
|
|
23271
|
+
}
|
|
23272
|
+
}
|
|
23273
|
+
return [UNKNOWN_TYPE];
|
|
23274
|
+
}
|
|
23254
23275
|
case "TSEnumDeclaration":
|
|
23255
23276
|
return inferEnumType(node);
|
|
23256
23277
|
case "TSSymbolKeyword":
|
|
@@ -24653,6 +24674,7 @@ let __temp${any}, __restore${any}
|
|
|
24653
24674
|
}
|
|
24654
24675
|
let templateMap;
|
|
24655
24676
|
let returned;
|
|
24677
|
+
const propsDecl = genRuntimeProps(ctx);
|
|
24656
24678
|
if (!options.inlineTemplate || !sfc.template && ctx.hasDefaultExportRender) {
|
|
24657
24679
|
const allBindings = {
|
|
24658
24680
|
...scriptBindings,
|
|
@@ -24759,7 +24781,6 @@ return ${returned}
|
|
|
24759
24781
|
runtimeOptions += `
|
|
24760
24782
|
__ssrInlineRender: true,`;
|
|
24761
24783
|
}
|
|
24762
|
-
const propsDecl = genRuntimeProps(ctx);
|
|
24763
24784
|
if (propsDecl) runtimeOptions += `
|
|
24764
24785
|
props: ${propsDecl},`;
|
|
24765
24786
|
const emitsDecl = genRuntimeEmits(ctx);
|
|
@@ -25027,7 +25048,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
25027
25048
|
return generator.toJSON();
|
|
25028
25049
|
}
|
|
25029
25050
|
|
|
25030
|
-
const version = "3.5.
|
|
25051
|
+
const version = "3.5.22";
|
|
25031
25052
|
const parseCache = parseCache$1;
|
|
25032
25053
|
const errorMessages = {
|
|
25033
25054
|
...CompilerDOM.errorMessages,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.
|
|
2
|
+
* @vue/compiler-sfc v3.5.22
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -12664,7 +12664,7 @@ function requireLib () {
|
|
|
12664
12664
|
}
|
|
12665
12665
|
}
|
|
12666
12666
|
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;
|
|
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$optional5, _node$readonly4, _node$declare7, _node$global, _node$const2, _node$in, _node$out;
|
|
12668
12668
|
switch (node.type) {
|
|
12669
12669
|
case "ExpressionStatement":
|
|
12670
12670
|
(_node$directive = node.directive) != null ? _node$directive : node.directive = undefined;
|
|
@@ -12755,6 +12755,10 @@ function requireLib () {
|
|
|
12755
12755
|
(_node$declare6 = node.declare) != null ? _node$declare6 : node.declare = false;
|
|
12756
12756
|
(_node$extends = node.extends) != null ? _node$extends : node.extends = [];
|
|
12757
12757
|
return;
|
|
12758
|
+
case "TSMappedType":
|
|
12759
|
+
(_node$optional5 = node.optional) != null ? _node$optional5 : node.optional = false;
|
|
12760
|
+
(_node$readonly4 = node.readonly) != null ? _node$readonly4 : node.readonly = undefined;
|
|
12761
|
+
return;
|
|
12758
12762
|
case "TSModuleDeclaration":
|
|
12759
12763
|
(_node$declare7 = node.declare) != null ? _node$declare7 : node.declare = false;
|
|
12760
12764
|
(_node$global = node.global) != null ? _node$global : node.global = node.kind === "global";
|
|
@@ -17266,16 +17270,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
17266
17270
|
(id) => markScopeIdentifier(node, id, knownIds)
|
|
17267
17271
|
);
|
|
17268
17272
|
}
|
|
17273
|
+
} else if (node.type === "SwitchStatement") {
|
|
17274
|
+
if (node.scopeIds) {
|
|
17275
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
17276
|
+
} else {
|
|
17277
|
+
walkSwitchStatement(
|
|
17278
|
+
node,
|
|
17279
|
+
false,
|
|
17280
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
17281
|
+
);
|
|
17282
|
+
}
|
|
17269
17283
|
} else if (node.type === "CatchClause" && node.param) {
|
|
17270
|
-
|
|
17271
|
-
|
|
17284
|
+
if (node.scopeIds) {
|
|
17285
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
17286
|
+
} else {
|
|
17287
|
+
for (const id of extractIdentifiers$1(node.param)) {
|
|
17288
|
+
markScopeIdentifier(node, id, knownIds);
|
|
17289
|
+
}
|
|
17272
17290
|
}
|
|
17273
17291
|
} else if (isForStatement(node)) {
|
|
17274
|
-
|
|
17275
|
-
node,
|
|
17276
|
-
|
|
17277
|
-
(
|
|
17278
|
-
|
|
17292
|
+
if (node.scopeIds) {
|
|
17293
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
17294
|
+
} else {
|
|
17295
|
+
walkForStatement(
|
|
17296
|
+
node,
|
|
17297
|
+
false,
|
|
17298
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
17299
|
+
);
|
|
17300
|
+
}
|
|
17279
17301
|
}
|
|
17280
17302
|
},
|
|
17281
17303
|
leave(node, parent) {
|
|
@@ -17346,7 +17368,8 @@ function walkFunctionParams(node, onIdent) {
|
|
|
17346
17368
|
}
|
|
17347
17369
|
}
|
|
17348
17370
|
function walkBlockDeclarations(block, onIdent) {
|
|
17349
|
-
|
|
17371
|
+
const body = block.type === "SwitchCase" ? block.consequent : block.body;
|
|
17372
|
+
for (const stmt of body) {
|
|
17350
17373
|
if (stmt.type === "VariableDeclaration") {
|
|
17351
17374
|
if (stmt.declare) continue;
|
|
17352
17375
|
for (const decl of stmt.declarations) {
|
|
@@ -17359,6 +17382,8 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
17359
17382
|
onIdent(stmt.id);
|
|
17360
17383
|
} else if (isForStatement(stmt)) {
|
|
17361
17384
|
walkForStatement(stmt, true, onIdent);
|
|
17385
|
+
} else if (stmt.type === "SwitchStatement") {
|
|
17386
|
+
walkSwitchStatement(stmt, true, onIdent);
|
|
17362
17387
|
}
|
|
17363
17388
|
}
|
|
17364
17389
|
}
|
|
@@ -17375,6 +17400,20 @@ function walkForStatement(stmt, isVar, onIdent) {
|
|
|
17375
17400
|
}
|
|
17376
17401
|
}
|
|
17377
17402
|
}
|
|
17403
|
+
function walkSwitchStatement(stmt, isVar, onIdent) {
|
|
17404
|
+
for (const cs of stmt.cases) {
|
|
17405
|
+
for (const stmt2 of cs.consequent) {
|
|
17406
|
+
if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
|
|
17407
|
+
for (const decl of stmt2.declarations) {
|
|
17408
|
+
for (const id of extractIdentifiers$1(decl.id)) {
|
|
17409
|
+
onIdent(id);
|
|
17410
|
+
}
|
|
17411
|
+
}
|
|
17412
|
+
}
|
|
17413
|
+
}
|
|
17414
|
+
walkBlockDeclarations(cs, onIdent);
|
|
17415
|
+
}
|
|
17416
|
+
}
|
|
17378
17417
|
function extractIdentifiers$1(param, nodes = []) {
|
|
17379
17418
|
switch (param.type) {
|
|
17380
17419
|
case "Identifier":
|
|
@@ -23853,90 +23892,6 @@ function getParentCondition(node) {
|
|
|
23853
23892
|
}
|
|
23854
23893
|
}
|
|
23855
23894
|
|
|
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
23895
|
const transformFor = createStructuralDirectiveTransform(
|
|
23941
23896
|
"for",
|
|
23942
23897
|
(node, dir, context) => {
|
|
@@ -23949,9 +23904,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
23949
23904
|
const memo = findDir(node, "memo");
|
|
23950
23905
|
const keyProp = findProp(node, `key`, false, true);
|
|
23951
23906
|
const isDirKey = keyProp && keyProp.type === 7;
|
|
23952
|
-
if (isDirKey && !keyProp.exp) {
|
|
23953
|
-
transformBindShorthand(keyProp, context);
|
|
23954
|
-
}
|
|
23955
23907
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
23956
23908
|
if (memo && keyExp && isDirKey) {
|
|
23957
23909
|
{
|
|
@@ -25224,6 +25176,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
25224
25176
|
return ret;
|
|
25225
25177
|
};
|
|
25226
25178
|
|
|
25179
|
+
const transformBind = (dir, _node, context) => {
|
|
25180
|
+
const { modifiers, loc } = dir;
|
|
25181
|
+
const arg = dir.arg;
|
|
25182
|
+
let { exp } = dir;
|
|
25183
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
25184
|
+
{
|
|
25185
|
+
context.onError(
|
|
25186
|
+
createCompilerError(34, loc)
|
|
25187
|
+
);
|
|
25188
|
+
return {
|
|
25189
|
+
props: [
|
|
25190
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
25191
|
+
]
|
|
25192
|
+
};
|
|
25193
|
+
}
|
|
25194
|
+
}
|
|
25195
|
+
if (arg.type !== 4) {
|
|
25196
|
+
arg.children.unshift(`(`);
|
|
25197
|
+
arg.children.push(`) || ""`);
|
|
25198
|
+
} else if (!arg.isStatic) {
|
|
25199
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
25200
|
+
}
|
|
25201
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
25202
|
+
if (arg.type === 4) {
|
|
25203
|
+
if (arg.isStatic) {
|
|
25204
|
+
arg.content = camelize(arg.content);
|
|
25205
|
+
} else {
|
|
25206
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
25207
|
+
}
|
|
25208
|
+
} else {
|
|
25209
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
25210
|
+
arg.children.push(`)`);
|
|
25211
|
+
}
|
|
25212
|
+
}
|
|
25213
|
+
if (!context.inSSR) {
|
|
25214
|
+
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
25215
|
+
injectPrefix(arg, ".");
|
|
25216
|
+
}
|
|
25217
|
+
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
25218
|
+
injectPrefix(arg, "^");
|
|
25219
|
+
}
|
|
25220
|
+
}
|
|
25221
|
+
return {
|
|
25222
|
+
props: [createObjectProperty(arg, exp)]
|
|
25223
|
+
};
|
|
25224
|
+
};
|
|
25225
|
+
const injectPrefix = (arg, prefix) => {
|
|
25226
|
+
if (arg.type === 4) {
|
|
25227
|
+
if (arg.isStatic) {
|
|
25228
|
+
arg.content = prefix + arg.content;
|
|
25229
|
+
} else {
|
|
25230
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
25231
|
+
}
|
|
25232
|
+
} else {
|
|
25233
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
25234
|
+
arg.children.push(`)`);
|
|
25235
|
+
}
|
|
25236
|
+
};
|
|
25237
|
+
|
|
25227
25238
|
const transformText = (node, context) => {
|
|
25228
25239
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
25229
25240
|
return () => {
|
|
@@ -25430,9 +25441,35 @@ const transformMemo = (node, context) => {
|
|
|
25430
25441
|
}
|
|
25431
25442
|
};
|
|
25432
25443
|
|
|
25444
|
+
const transformVBindShorthand = (node, context) => {
|
|
25445
|
+
if (node.type === 1) {
|
|
25446
|
+
for (const prop of node.props) {
|
|
25447
|
+
if (prop.type === 7 && prop.name === "bind" && !prop.exp) {
|
|
25448
|
+
const arg = prop.arg;
|
|
25449
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
25450
|
+
context.onError(
|
|
25451
|
+
createCompilerError(
|
|
25452
|
+
52,
|
|
25453
|
+
arg.loc
|
|
25454
|
+
)
|
|
25455
|
+
);
|
|
25456
|
+
prop.exp = createSimpleExpression("", true, arg.loc);
|
|
25457
|
+
} else {
|
|
25458
|
+
const propName = camelize(arg.content);
|
|
25459
|
+
if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
|
|
25460
|
+
propName[0] === "-") {
|
|
25461
|
+
prop.exp = createSimpleExpression(propName, false, arg.loc);
|
|
25462
|
+
}
|
|
25463
|
+
}
|
|
25464
|
+
}
|
|
25465
|
+
}
|
|
25466
|
+
}
|
|
25467
|
+
};
|
|
25468
|
+
|
|
25433
25469
|
function getBaseTransformPreset(prefixIdentifiers) {
|
|
25434
25470
|
return [
|
|
25435
25471
|
[
|
|
25472
|
+
transformVBindShorthand,
|
|
25436
25473
|
transformOnce,
|
|
25437
25474
|
transformIf,
|
|
25438
25475
|
transformMemo,
|
|
@@ -26027,6 +26064,9 @@ function analyzeNode(node) {
|
|
|
26027
26064
|
if (node.type === 1 && isNonStringifiable(node.tag)) {
|
|
26028
26065
|
return false;
|
|
26029
26066
|
}
|
|
26067
|
+
if (node.type === 1 && findDir(node, "once", true)) {
|
|
26068
|
+
return false;
|
|
26069
|
+
}
|
|
26030
26070
|
if (node.type === 12) {
|
|
26031
26071
|
return [1, 0];
|
|
26032
26072
|
}
|
|
@@ -26556,8 +26596,10 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26556
26596
|
transformModel: transformModel$1,
|
|
26557
26597
|
transformOn: transformOn$1,
|
|
26558
26598
|
transformStyle: transformStyle,
|
|
26599
|
+
transformVBindShorthand: transformVBindShorthand,
|
|
26559
26600
|
traverseNode: traverseNode,
|
|
26560
26601
|
unwrapTSNode: unwrapTSNode,
|
|
26602
|
+
validFirstIdentCharRE: validFirstIdentCharRE,
|
|
26561
26603
|
walkBlockDeclarations: walkBlockDeclarations,
|
|
26562
26604
|
walkFunctionParams: walkFunctionParams,
|
|
26563
26605
|
walkIdentifiers: walkIdentifiers,
|
|
@@ -26661,7 +26703,7 @@ function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
|
26661
26703
|
}
|
|
26662
26704
|
function genVarName(id, raw, isProd, isSSR = false) {
|
|
26663
26705
|
if (isProd) {
|
|
26664
|
-
return hash(id + raw);
|
|
26706
|
+
return hash(id + raw).replace(/^\d/, (r) => `v${r}`);
|
|
26665
26707
|
} else {
|
|
26666
26708
|
return `${id}-${getEscapedCssVarName(raw, isSSR)}`;
|
|
26667
26709
|
}
|
|
@@ -32084,6 +32126,14 @@ const ssrTransformElement = (node, context) => {
|
|
|
32084
32126
|
const hasCustomDir = node.props.some(
|
|
32085
32127
|
(p) => p.type === 7 && !isBuiltInDirective(p.name)
|
|
32086
32128
|
);
|
|
32129
|
+
const vShowPropIndex = node.props.findIndex(
|
|
32130
|
+
(i) => i.type === 7 && i.name === "show"
|
|
32131
|
+
);
|
|
32132
|
+
if (vShowPropIndex !== -1) {
|
|
32133
|
+
const vShowProp = node.props[vShowPropIndex];
|
|
32134
|
+
node.props.splice(vShowPropIndex, 1);
|
|
32135
|
+
node.props.push(vShowProp);
|
|
32136
|
+
}
|
|
32087
32137
|
const needMergeProps = hasDynamicVBind || hasCustomDir;
|
|
32088
32138
|
if (needMergeProps) {
|
|
32089
32139
|
const { props, directives } = buildProps(
|
|
@@ -33179,6 +33229,7 @@ function compile(source, options = {}) {
|
|
|
33179
33229
|
transform(ast, __spreadProps$6(__spreadValues$7({}, options), {
|
|
33180
33230
|
hoistStatic: false,
|
|
33181
33231
|
nodeTransforms: [
|
|
33232
|
+
transformVBindShorthand,
|
|
33182
33233
|
ssrTransformIf,
|
|
33183
33234
|
ssrTransformFor,
|
|
33184
33235
|
trackVForSlotScopes,
|
|
@@ -46468,6 +46519,10 @@ class MagicString {
|
|
|
46468
46519
|
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
46469
46520
|
});
|
|
46470
46521
|
|
|
46522
|
+
if (this.outro) {
|
|
46523
|
+
mappings.advance(this.outro);
|
|
46524
|
+
}
|
|
46525
|
+
|
|
46471
46526
|
return {
|
|
46472
46527
|
file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
|
|
46473
46528
|
sources: [
|
|
@@ -47133,7 +47188,12 @@ class MagicString {
|
|
|
47133
47188
|
const index = original.indexOf(string);
|
|
47134
47189
|
|
|
47135
47190
|
if (index !== -1) {
|
|
47136
|
-
|
|
47191
|
+
if (typeof replacement === 'function') {
|
|
47192
|
+
replacement = replacement(string, index, original);
|
|
47193
|
+
}
|
|
47194
|
+
if (string !== replacement) {
|
|
47195
|
+
this.overwrite(index, index + string.length, replacement);
|
|
47196
|
+
}
|
|
47137
47197
|
}
|
|
47138
47198
|
|
|
47139
47199
|
return this;
|
|
@@ -47156,7 +47216,11 @@ class MagicString {
|
|
|
47156
47216
|
index = original.indexOf(string, index + stringLength)
|
|
47157
47217
|
) {
|
|
47158
47218
|
const previous = original.slice(index, index + stringLength);
|
|
47159
|
-
|
|
47219
|
+
let _replacement = replacement;
|
|
47220
|
+
if (typeof replacement === 'function') {
|
|
47221
|
+
_replacement = replacement(previous, index, original);
|
|
47222
|
+
}
|
|
47223
|
+
if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
|
|
47160
47224
|
}
|
|
47161
47225
|
|
|
47162
47226
|
return this;
|
|
@@ -48434,6 +48498,9 @@ function recordImport(node, imports) {
|
|
|
48434
48498
|
}
|
|
48435
48499
|
}
|
|
48436
48500
|
function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false, typeParameters) {
|
|
48501
|
+
if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
48502
|
+
return [UNKNOWN_TYPE];
|
|
48503
|
+
}
|
|
48437
48504
|
try {
|
|
48438
48505
|
switch (node.type) {
|
|
48439
48506
|
case "TSStringKeyword":
|
|
@@ -48670,6 +48737,24 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
48670
48737
|
typeParameters
|
|
48671
48738
|
).filter((t) => t !== UNKNOWN_TYPE);
|
|
48672
48739
|
}
|
|
48740
|
+
case "TSMappedType": {
|
|
48741
|
+
const { typeAnnotation, typeParameter } = node;
|
|
48742
|
+
if (typeAnnotation && typeAnnotation.type === "TSIndexedAccessType" && typeParameter && typeParameter.constraint && typeParameters) {
|
|
48743
|
+
const constraint = typeParameter.constraint;
|
|
48744
|
+
if (constraint.type === "TSTypeOperator" && constraint.operator === "keyof" && constraint.typeAnnotation && constraint.typeAnnotation.type === "TSTypeReference" && constraint.typeAnnotation.typeName.type === "Identifier") {
|
|
48745
|
+
const typeName = constraint.typeAnnotation.typeName.name;
|
|
48746
|
+
const index = typeAnnotation.indexType;
|
|
48747
|
+
const obj = typeAnnotation.objectType;
|
|
48748
|
+
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) {
|
|
48749
|
+
const targetType = typeParameters[typeName];
|
|
48750
|
+
if (targetType) {
|
|
48751
|
+
return inferRuntimeType(ctx, targetType, scope);
|
|
48752
|
+
}
|
|
48753
|
+
}
|
|
48754
|
+
}
|
|
48755
|
+
}
|
|
48756
|
+
return [UNKNOWN_TYPE];
|
|
48757
|
+
}
|
|
48673
48758
|
case "TSEnumDeclaration":
|
|
48674
48759
|
return inferEnumType(node);
|
|
48675
48760
|
case "TSSymbolKeyword":
|
|
@@ -50091,6 +50176,7 @@ let __temp${any}, __restore${any}
|
|
|
50091
50176
|
}
|
|
50092
50177
|
let templateMap;
|
|
50093
50178
|
let returned;
|
|
50179
|
+
const propsDecl = genRuntimeProps(ctx);
|
|
50094
50180
|
if (!options.inlineTemplate || !sfc.template && ctx.hasDefaultExportRender) {
|
|
50095
50181
|
const allBindings = __spreadValues$1(__spreadValues$1({}, scriptBindings), setupBindings);
|
|
50096
50182
|
for (const key in ctx.userImports) {
|
|
@@ -50193,7 +50279,6 @@ return ${returned}
|
|
|
50193
50279
|
runtimeOptions += `
|
|
50194
50280
|
__ssrInlineRender: true,`;
|
|
50195
50281
|
}
|
|
50196
|
-
const propsDecl = genRuntimeProps(ctx);
|
|
50197
50282
|
if (propsDecl) runtimeOptions += `
|
|
50198
50283
|
props: ${propsDecl},`;
|
|
50199
50284
|
const emitsDecl = genRuntimeEmits(ctx);
|
|
@@ -50476,7 +50561,7 @@ var __spreadValues = (a, b) => {
|
|
|
50476
50561
|
}
|
|
50477
50562
|
return a;
|
|
50478
50563
|
};
|
|
50479
|
-
const version = "3.5.
|
|
50564
|
+
const version = "3.5.22";
|
|
50480
50565
|
const parseCache = parseCache$1;
|
|
50481
50566
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
50482
50567
|
const walk = walk$2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.22",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@babel/parser": "^7.28.
|
|
45
|
+
"@babel/parser": "^7.28.4",
|
|
46
46
|
"estree-walker": "^2.0.2",
|
|
47
|
-
"magic-string": "^0.30.
|
|
47
|
+
"magic-string": "^0.30.19",
|
|
48
48
|
"postcss": "^8.5.6",
|
|
49
49
|
"source-map-js": "^1.2.1",
|
|
50
|
-
"@vue/compiler-core": "3.5.
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/
|
|
53
|
-
"@vue/
|
|
50
|
+
"@vue/compiler-core": "3.5.22",
|
|
51
|
+
"@vue/compiler-ssr": "3.5.22",
|
|
52
|
+
"@vue/shared": "3.5.22",
|
|
53
|
+
"@vue/compiler-dom": "3.5.22"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@babel/types": "^7.28.
|
|
56
|
+
"@babel/types": "^7.28.4",
|
|
57
57
|
"@vue/consolidate": "^1.0.0",
|
|
58
58
|
"hash-sum": "^2.0.0",
|
|
59
59
|
"lru-cache": "10.1.0",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"postcss-modules": "^6.0.1",
|
|
63
63
|
"postcss-selector-parser": "^7.1.0",
|
|
64
64
|
"pug": "^3.0.3",
|
|
65
|
-
"sass": "^1.
|
|
65
|
+
"sass": "^1.93.2"
|
|
66
66
|
}
|
|
67
67
|
}
|