@vue/compiler-dom 3.5.12 → 3.5.14
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-dom.cjs.js +1 -1
- package/dist/compiler-dom.cjs.prod.js +1 -1
- package/dist/compiler-dom.esm-browser.js +31 -13
- package/dist/compiler-dom.esm-browser.prod.js +11 -8
- package/dist/compiler-dom.esm-bundler.js +3 -3
- package/dist/compiler-dom.global.js +31 -13
- package/dist/compiler-dom.global.prod.js +11 -8
- package/package.json +3 -3
package/dist/compiler-dom.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.5.
|
|
2
|
+
* @vue/compiler-dom v3.5.14
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -466,12 +466,13 @@ function createConditionalExpression(test, consequent, alternate, newline = true
|
|
|
466
466
|
loc: locStub
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
|
-
function createCacheExpression(index, value, needPauseTracking = false) {
|
|
469
|
+
function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
|
|
470
470
|
return {
|
|
471
471
|
type: 20,
|
|
472
472
|
index,
|
|
473
473
|
value,
|
|
474
474
|
needPauseTracking,
|
|
475
|
+
inVOnce,
|
|
475
476
|
needArraySpread: false,
|
|
476
477
|
loc: locStub
|
|
477
478
|
};
|
|
@@ -1668,7 +1669,7 @@ function isForStatement(stmt) {
|
|
|
1668
1669
|
}
|
|
1669
1670
|
function walkForStatement(stmt, isVar, onIdent) {
|
|
1670
1671
|
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
1671
|
-
if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar :
|
|
1672
|
+
if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar : false)) {
|
|
1672
1673
|
for (const decl of variable.declarations) {
|
|
1673
1674
|
for (const id of extractIdentifiers(decl.id)) {
|
|
1674
1675
|
onIdent(id);
|
|
@@ -2285,7 +2286,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2285
2286
|
"COMPILER_V_BIND_SYNC",
|
|
2286
2287
|
currentOptions,
|
|
2287
2288
|
currentProp.loc,
|
|
2288
|
-
currentProp.
|
|
2289
|
+
currentProp.arg.loc.source
|
|
2289
2290
|
)) {
|
|
2290
2291
|
currentProp.name = "model";
|
|
2291
2292
|
currentProp.modifiers.splice(syncIndex, 1);
|
|
@@ -2861,6 +2862,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2861
2862
|
}
|
|
2862
2863
|
}
|
|
2863
2864
|
let cachedAsArray = false;
|
|
2865
|
+
const slotCacheKeys = [];
|
|
2864
2866
|
if (toCache.length === children.length && node.type === 1) {
|
|
2865
2867
|
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
|
|
2866
2868
|
node.codegenNode.children = getCacheExpression(
|
|
@@ -2870,6 +2872,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2870
2872
|
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
|
|
2871
2873
|
const slot = getSlotNode(node.codegenNode, "default");
|
|
2872
2874
|
if (slot) {
|
|
2875
|
+
slotCacheKeys.push(context.cached.length);
|
|
2873
2876
|
slot.returns = getCacheExpression(
|
|
2874
2877
|
createArrayExpression(slot.returns)
|
|
2875
2878
|
);
|
|
@@ -2879,6 +2882,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2879
2882
|
const slotName = findDir(node, "slot", true);
|
|
2880
2883
|
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
|
|
2881
2884
|
if (slot) {
|
|
2885
|
+
slotCacheKeys.push(context.cached.length);
|
|
2882
2886
|
slot.returns = getCacheExpression(
|
|
2883
2887
|
createArrayExpression(slot.returns)
|
|
2884
2888
|
);
|
|
@@ -2888,9 +2892,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2888
2892
|
}
|
|
2889
2893
|
if (!cachedAsArray) {
|
|
2890
2894
|
for (const child of toCache) {
|
|
2895
|
+
slotCacheKeys.push(context.cached.length);
|
|
2891
2896
|
child.codegenNode = context.cache(child.codegenNode);
|
|
2892
2897
|
}
|
|
2893
2898
|
}
|
|
2899
|
+
if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
|
|
2900
|
+
node.codegenNode.children.properties.push(
|
|
2901
|
+
createObjectProperty(
|
|
2902
|
+
`__`,
|
|
2903
|
+
createSimpleExpression(JSON.stringify(slotCacheKeys), false)
|
|
2904
|
+
)
|
|
2905
|
+
);
|
|
2906
|
+
}
|
|
2894
2907
|
function getCacheExpression(value) {
|
|
2895
2908
|
const exp = context.cache(value);
|
|
2896
2909
|
if (inFor && context.hmr) {
|
|
@@ -3213,11 +3226,12 @@ function createTransformContext(root, {
|
|
|
3213
3226
|
identifier.hoisted = exp;
|
|
3214
3227
|
return identifier;
|
|
3215
3228
|
},
|
|
3216
|
-
cache(exp, isVNode = false) {
|
|
3229
|
+
cache(exp, isVNode = false, inVOnce = false) {
|
|
3217
3230
|
const cacheExp = createCacheExpression(
|
|
3218
3231
|
context.cached.length,
|
|
3219
3232
|
exp,
|
|
3220
|
-
isVNode
|
|
3233
|
+
isVNode,
|
|
3234
|
+
inVOnce
|
|
3221
3235
|
);
|
|
3222
3236
|
context.cached.push(cacheExp);
|
|
3223
3237
|
return cacheExp;
|
|
@@ -3930,7 +3944,9 @@ function genCacheExpression(node, context) {
|
|
|
3930
3944
|
push(`_cache[${node.index}] || (`);
|
|
3931
3945
|
if (needPauseTracking) {
|
|
3932
3946
|
indent();
|
|
3933
|
-
push(`${helper(SET_BLOCK_TRACKING)}(-1)
|
|
3947
|
+
push(`${helper(SET_BLOCK_TRACKING)}(-1`);
|
|
3948
|
+
if (node.inVOnce) push(`, true`);
|
|
3949
|
+
push(`),`);
|
|
3934
3950
|
newline();
|
|
3935
3951
|
push(`(`);
|
|
3936
3952
|
}
|
|
@@ -3987,12 +4003,14 @@ const transformExpression = (node, context) => {
|
|
|
3987
4003
|
context
|
|
3988
4004
|
);
|
|
3989
4005
|
} else if (node.type === 1) {
|
|
4006
|
+
const memo = findDir(node, "memo");
|
|
3990
4007
|
for (let i = 0; i < node.props.length; i++) {
|
|
3991
4008
|
const dir = node.props[i];
|
|
3992
4009
|
if (dir.type === 7 && dir.name !== "for") {
|
|
3993
4010
|
const exp = dir.exp;
|
|
3994
4011
|
const arg = dir.arg;
|
|
3995
|
-
if (exp && exp.type === 4 && !(dir.name === "on" && arg))
|
|
4012
|
+
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
|
|
4013
|
+
!(memo && arg && arg.type === 4 && arg.content === "key")) {
|
|
3996
4014
|
dir.exp = processExpression(
|
|
3997
4015
|
exp,
|
|
3998
4016
|
context,
|
|
@@ -4329,10 +4347,11 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4329
4347
|
const isTemplate = isTemplateNode(node);
|
|
4330
4348
|
const memo = findDir(node, "memo");
|
|
4331
4349
|
const keyProp = findProp(node, `key`, false, true);
|
|
4332
|
-
|
|
4350
|
+
const isDirKey = keyProp && keyProp.type === 7;
|
|
4351
|
+
if (isDirKey && !keyProp.exp) {
|
|
4333
4352
|
transformBindShorthand(keyProp);
|
|
4334
4353
|
}
|
|
4335
|
-
|
|
4354
|
+
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4336
4355
|
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4337
4356
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
4338
4357
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
@@ -5590,8 +5609,8 @@ const transformOnce = (node, context) => {
|
|
|
5590
5609
|
if (cur.codegenNode) {
|
|
5591
5610
|
cur.codegenNode = context.cache(
|
|
5592
5611
|
cur.codegenNode,
|
|
5612
|
+
true,
|
|
5593
5613
|
true
|
|
5594
|
-
/* isVNode */
|
|
5595
5614
|
);
|
|
5596
5615
|
}
|
|
5597
5616
|
};
|
|
@@ -5613,8 +5632,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
5613
5632
|
context.onError(createCompilerError(44, exp.loc));
|
|
5614
5633
|
return createTransformProps();
|
|
5615
5634
|
}
|
|
5616
|
-
|
|
5617
|
-
if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
|
|
5635
|
+
if (!expString.trim() || !isMemberExpression(exp) && true) {
|
|
5618
5636
|
context.onError(
|
|
5619
5637
|
createCompilerError(42, exp.loc)
|
|
5620
5638
|
);
|