@vue/compiler-core 3.2.24 → 3.2.25
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.
|
@@ -530,12 +530,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
530
530
|
}
|
|
531
531
|
else if (p.name === 'bind' &&
|
|
532
532
|
(p.exp || allowEmpty) &&
|
|
533
|
-
|
|
533
|
+
isStaticArgOf(p.arg, name)) {
|
|
534
534
|
return p;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function isStaticArgOf(arg, name) {
|
|
539
539
|
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
540
540
|
}
|
|
541
541
|
function hasDynamicKeyVBind(node) {
|
|
@@ -768,11 +768,6 @@ const deprecationData = {
|
|
|
768
768
|
`data source.`,
|
|
769
769
|
link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
|
|
770
770
|
},
|
|
771
|
-
["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
|
|
772
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
773
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
774
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
775
|
-
},
|
|
776
771
|
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
|
777
772
|
message: `<template> with no special directives will render as a native template ` +
|
|
778
773
|
`element instead of its inner content in Vue 3.`
|
|
@@ -1290,7 +1285,7 @@ function isComponent(tag, props, context) {
|
|
|
1290
1285
|
else if (
|
|
1291
1286
|
// :is on plain element - only treat as component in compat mode
|
|
1292
1287
|
p.name === 'bind' &&
|
|
1293
|
-
|
|
1288
|
+
isStaticArgOf(p.arg, 'is') &&
|
|
1294
1289
|
true &&
|
|
1295
1290
|
checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
|
1296
1291
|
return true;
|
|
@@ -1748,6 +1743,11 @@ function getConstantType(node, context) {
|
|
|
1748
1743
|
if (codegenNode.type !== 13 /* VNODE_CALL */) {
|
|
1749
1744
|
return 0 /* NOT_CONSTANT */;
|
|
1750
1745
|
}
|
|
1746
|
+
if (codegenNode.isBlock &&
|
|
1747
|
+
node.tag !== 'svg' &&
|
|
1748
|
+
node.tag !== 'foreignObject') {
|
|
1749
|
+
return 0 /* NOT_CONSTANT */;
|
|
1750
|
+
}
|
|
1751
1751
|
const flag = getPatchFlag(codegenNode);
|
|
1752
1752
|
if (!flag) {
|
|
1753
1753
|
let returnType = 3 /* CAN_STRINGIFY */;
|
|
@@ -1884,7 +1884,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
1884
1884
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
1885
1885
|
// some helper calls can be hoisted,
|
|
1886
1886
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
1887
|
-
// in this case we need to respect the ConstantType of the helper's
|
|
1887
|
+
// in this case we need to respect the ConstantType of the helper's arguments
|
|
1888
1888
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
1889
1889
|
}
|
|
1890
1890
|
else {
|
|
@@ -4338,10 +4338,7 @@ const transformElement = (node, context) => {
|
|
|
4338
4338
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
4339
4339
|
// This is technically web-specific, but splitting the logic out of core
|
|
4340
4340
|
// leads to too much unnecessary complexity.
|
|
4341
|
-
(tag === 'svg' ||
|
|
4342
|
-
tag === 'foreignObject' ||
|
|
4343
|
-
// #938: elements with dynamic keys should be forced into blocks
|
|
4344
|
-
findProp(node, 'key', true)));
|
|
4341
|
+
(tag === 'svg' || tag === 'foreignObject'));
|
|
4345
4342
|
// props
|
|
4346
4343
|
if (props.length > 0) {
|
|
4347
4344
|
const propsBuildResult = buildProps(node, context);
|
|
@@ -4353,6 +4350,9 @@ const transformElement = (node, context) => {
|
|
|
4353
4350
|
directives && directives.length
|
|
4354
4351
|
? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
|
|
4355
4352
|
: undefined;
|
|
4353
|
+
if (propsBuildResult.shouldUseBlock) {
|
|
4354
|
+
shouldUseBlock = true;
|
|
4355
|
+
}
|
|
4356
4356
|
}
|
|
4357
4357
|
// children
|
|
4358
4358
|
if (node.children.length > 0) {
|
|
@@ -4542,11 +4542,13 @@ function resolveSetupReference(name, context) {
|
|
|
4542
4542
|
}
|
|
4543
4543
|
}
|
|
4544
4544
|
function buildProps(node, context, props = node.props, ssr = false) {
|
|
4545
|
-
const { tag, loc: elementLoc } = node;
|
|
4545
|
+
const { tag, loc: elementLoc, children } = node;
|
|
4546
4546
|
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
4547
4547
|
let properties = [];
|
|
4548
4548
|
const mergeArgs = [];
|
|
4549
4549
|
const runtimeDirectives = [];
|
|
4550
|
+
const hasChildren = children.length > 0;
|
|
4551
|
+
let shouldUseBlock = false;
|
|
4550
4552
|
// patchFlag analysis
|
|
4551
4553
|
let patchFlag = 0;
|
|
4552
4554
|
let hasRef = false;
|
|
@@ -4609,15 +4611,20 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4609
4611
|
const prop = props[i];
|
|
4610
4612
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
4611
4613
|
const { loc, name, value } = prop;
|
|
4612
|
-
let
|
|
4614
|
+
let isStatic = true;
|
|
4613
4615
|
if (name === 'ref') {
|
|
4614
4616
|
hasRef = true;
|
|
4617
|
+
if (context.scopes.vFor > 0) {
|
|
4618
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
4619
|
+
}
|
|
4615
4620
|
// in inline mode there is no setupState object, so we can't use string
|
|
4616
4621
|
// keys to set the ref. Instead, we need to transform it to pass the
|
|
4617
4622
|
// actual ref instead.
|
|
4618
|
-
if (
|
|
4619
|
-
|
|
4620
|
-
|
|
4623
|
+
if (value &&
|
|
4624
|
+
context.inline &&
|
|
4625
|
+
context.bindingMetadata[value.content]) {
|
|
4626
|
+
isStatic = false;
|
|
4627
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_key', true), createSimpleExpression(value.content, true, value.loc)));
|
|
4621
4628
|
}
|
|
4622
4629
|
}
|
|
4623
4630
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -4627,7 +4634,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4627
4634
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
|
4628
4635
|
continue;
|
|
4629
4636
|
}
|
|
4630
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
4637
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
|
4631
4638
|
}
|
|
4632
4639
|
else {
|
|
4633
4640
|
// directives
|
|
@@ -4648,7 +4655,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4648
4655
|
// skip v-is and :is on <component>
|
|
4649
4656
|
if (name === 'is' ||
|
|
4650
4657
|
(isVBind &&
|
|
4651
|
-
|
|
4658
|
+
isStaticArgOf(arg, 'is') &&
|
|
4652
4659
|
(isComponentTag(tag) ||
|
|
4653
4660
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
|
|
4654
4661
|
continue;
|
|
@@ -4657,6 +4664,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4657
4664
|
if (isVOn && ssr) {
|
|
4658
4665
|
continue;
|
|
4659
4666
|
}
|
|
4667
|
+
if (
|
|
4668
|
+
// #938: elements with dynamic keys should be forced into blocks
|
|
4669
|
+
(isVBind && isStaticArgOf(arg, 'key')) ||
|
|
4670
|
+
// inline before-update hooks need to force block so that it is invoked
|
|
4671
|
+
// before children
|
|
4672
|
+
(isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
|
|
4673
|
+
shouldUseBlock = true;
|
|
4674
|
+
}
|
|
4675
|
+
if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
|
|
4676
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
4677
|
+
}
|
|
4660
4678
|
// special case for v-bind and v-on with no argument
|
|
4661
4679
|
if (!arg && (isVBind || isVOn)) {
|
|
4662
4680
|
hasDynamicKeys = true;
|
|
@@ -4730,14 +4748,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4730
4748
|
else {
|
|
4731
4749
|
// no built-in transform, this is a user custom directive.
|
|
4732
4750
|
runtimeDirectives.push(prop);
|
|
4751
|
+
// custom dirs may use beforeUpdate so they need to force blocks
|
|
4752
|
+
// to ensure before-update gets called before children update
|
|
4753
|
+
if (hasChildren) {
|
|
4754
|
+
shouldUseBlock = true;
|
|
4755
|
+
}
|
|
4733
4756
|
}
|
|
4734
4757
|
}
|
|
4735
|
-
if (prop.type === 6 /* ATTRIBUTE */ &&
|
|
4736
|
-
prop.name === 'ref' &&
|
|
4737
|
-
context.scopes.vFor > 0 &&
|
|
4738
|
-
checkCompatEnabled("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
|
|
4739
|
-
properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
|
|
4740
|
-
}
|
|
4741
4758
|
}
|
|
4742
4759
|
let propsExpression = undefined;
|
|
4743
4760
|
// has v-bind="object" or v-on="object", wrap with mergeProps
|
|
@@ -4774,7 +4791,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4774
4791
|
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
|
4775
4792
|
}
|
|
4776
4793
|
}
|
|
4777
|
-
if (
|
|
4794
|
+
if (!shouldUseBlock &&
|
|
4795
|
+
(patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
|
|
4778
4796
|
(hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
|
|
4779
4797
|
patchFlag |= 512 /* NEED_PATCH */;
|
|
4780
4798
|
}
|
|
@@ -4841,7 +4859,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4841
4859
|
props: propsExpression,
|
|
4842
4860
|
directives: runtimeDirectives,
|
|
4843
4861
|
patchFlag,
|
|
4844
|
-
dynamicPropNames
|
|
4862
|
+
dynamicPropNames,
|
|
4863
|
+
shouldUseBlock
|
|
4845
4864
|
};
|
|
4846
4865
|
}
|
|
4847
4866
|
// Dedupe props in an object literal.
|
|
@@ -4936,21 +4955,6 @@ function stringifyDynamicPropNames(props) {
|
|
|
4936
4955
|
}
|
|
4937
4956
|
function isComponentTag(tag) {
|
|
4938
4957
|
return tag === 'component' || tag === 'Component';
|
|
4939
|
-
}
|
|
4940
|
-
function processInlineRef(context, raw) {
|
|
4941
|
-
const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
|
|
4942
|
-
const { bindingMetadata, helperString } = context;
|
|
4943
|
-
const type = bindingMetadata[raw];
|
|
4944
|
-
if (type === "setup-ref" /* SETUP_REF */) {
|
|
4945
|
-
body.push(createSimpleExpression(`${raw}.value = _value`));
|
|
4946
|
-
}
|
|
4947
|
-
else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
|
|
4948
|
-
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
|
|
4949
|
-
}
|
|
4950
|
-
else if (type === "setup-let" /* SETUP_LET */) {
|
|
4951
|
-
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
|
|
4952
|
-
}
|
|
4953
|
-
return body;
|
|
4954
4958
|
}
|
|
4955
4959
|
|
|
4956
4960
|
Object.freeze({})
|
|
@@ -5016,7 +5020,7 @@ function processSlotOutlet(node, context) {
|
|
|
5016
5020
|
}
|
|
5017
5021
|
}
|
|
5018
5022
|
else {
|
|
5019
|
-
if (p.name === 'bind' &&
|
|
5023
|
+
if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
|
|
5020
5024
|
if (p.exp)
|
|
5021
5025
|
slotName = p.exp;
|
|
5022
5026
|
}
|
|
@@ -5050,7 +5054,11 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
5050
5054
|
let eventName;
|
|
5051
5055
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
5052
5056
|
if (arg.isStatic) {
|
|
5053
|
-
|
|
5057
|
+
let rawName = arg.content;
|
|
5058
|
+
// TODO deprecate @vnodeXXX usage
|
|
5059
|
+
if (rawName.startsWith('vue:')) {
|
|
5060
|
+
rawName = `vnode-${rawName.slice(4)}`;
|
|
5061
|
+
}
|
|
5054
5062
|
// for all event listeners, auto convert it to camelCase. See issue #2249
|
|
5055
5063
|
eventName = createSimpleExpression(shared.toHandlerKey(shared.camelize(rawName)), true, arg.loc);
|
|
5056
5064
|
}
|
|
@@ -5748,7 +5756,6 @@ exports.hasDynamicKeyVBind = hasDynamicKeyVBind;
|
|
|
5748
5756
|
exports.hasScopeRef = hasScopeRef;
|
|
5749
5757
|
exports.helperNameMap = helperNameMap;
|
|
5750
5758
|
exports.injectProp = injectProp;
|
|
5751
|
-
exports.isBindKey = isBindKey;
|
|
5752
5759
|
exports.isBuiltInType = isBuiltInType;
|
|
5753
5760
|
exports.isCoreComponent = isCoreComponent;
|
|
5754
5761
|
exports.isFunctionType = isFunctionType;
|
|
@@ -5759,6 +5766,7 @@ exports.isMemberExpressionNode = isMemberExpressionNode;
|
|
|
5759
5766
|
exports.isReferencedIdentifier = isReferencedIdentifier;
|
|
5760
5767
|
exports.isSimpleIdentifier = isSimpleIdentifier;
|
|
5761
5768
|
exports.isSlotOutlet = isSlotOutlet;
|
|
5769
|
+
exports.isStaticArgOf = isStaticArgOf;
|
|
5762
5770
|
exports.isStaticExp = isStaticExp;
|
|
5763
5771
|
exports.isStaticProperty = isStaticProperty;
|
|
5764
5772
|
exports.isStaticPropertyKey = isStaticPropertyKey;
|
|
@@ -529,12 +529,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
529
529
|
}
|
|
530
530
|
else if (p.name === 'bind' &&
|
|
531
531
|
(p.exp || allowEmpty) &&
|
|
532
|
-
|
|
532
|
+
isStaticArgOf(p.arg, name)) {
|
|
533
533
|
return p;
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function isStaticArgOf(arg, name) {
|
|
538
538
|
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
539
539
|
}
|
|
540
540
|
function hasDynamicKeyVBind(node) {
|
|
@@ -767,11 +767,6 @@ const deprecationData = {
|
|
|
767
767
|
`data source.`,
|
|
768
768
|
link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
|
|
769
769
|
},
|
|
770
|
-
["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
|
|
771
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
772
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
773
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
774
|
-
},
|
|
775
770
|
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
|
776
771
|
message: `<template> with no special directives will render as a native template ` +
|
|
777
772
|
`element instead of its inner content in Vue 3.`
|
|
@@ -1265,7 +1260,7 @@ function isComponent(tag, props, context) {
|
|
|
1265
1260
|
else if (
|
|
1266
1261
|
// :is on plain element - only treat as component in compat mode
|
|
1267
1262
|
p.name === 'bind' &&
|
|
1268
|
-
|
|
1263
|
+
isStaticArgOf(p.arg, 'is') &&
|
|
1269
1264
|
true &&
|
|
1270
1265
|
checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
|
1271
1266
|
return true;
|
|
@@ -1720,6 +1715,11 @@ function getConstantType(node, context) {
|
|
|
1720
1715
|
if (codegenNode.type !== 13 /* VNODE_CALL */) {
|
|
1721
1716
|
return 0 /* NOT_CONSTANT */;
|
|
1722
1717
|
}
|
|
1718
|
+
if (codegenNode.isBlock &&
|
|
1719
|
+
node.tag !== 'svg' &&
|
|
1720
|
+
node.tag !== 'foreignObject') {
|
|
1721
|
+
return 0 /* NOT_CONSTANT */;
|
|
1722
|
+
}
|
|
1723
1723
|
const flag = getPatchFlag(codegenNode);
|
|
1724
1724
|
if (!flag) {
|
|
1725
1725
|
let returnType = 3 /* CAN_STRINGIFY */;
|
|
@@ -1856,7 +1856,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
1856
1856
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
1857
1857
|
// some helper calls can be hoisted,
|
|
1858
1858
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
1859
|
-
// in this case we need to respect the ConstantType of the helper's
|
|
1859
|
+
// in this case we need to respect the ConstantType of the helper's arguments
|
|
1860
1860
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
1861
1861
|
}
|
|
1862
1862
|
else {
|
|
@@ -4255,10 +4255,7 @@ const transformElement = (node, context) => {
|
|
|
4255
4255
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
4256
4256
|
// This is technically web-specific, but splitting the logic out of core
|
|
4257
4257
|
// leads to too much unnecessary complexity.
|
|
4258
|
-
(tag === 'svg' ||
|
|
4259
|
-
tag === 'foreignObject' ||
|
|
4260
|
-
// #938: elements with dynamic keys should be forced into blocks
|
|
4261
|
-
findProp(node, 'key', true)));
|
|
4258
|
+
(tag === 'svg' || tag === 'foreignObject'));
|
|
4262
4259
|
// props
|
|
4263
4260
|
if (props.length > 0) {
|
|
4264
4261
|
const propsBuildResult = buildProps(node, context);
|
|
@@ -4270,6 +4267,9 @@ const transformElement = (node, context) => {
|
|
|
4270
4267
|
directives && directives.length
|
|
4271
4268
|
? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
|
|
4272
4269
|
: undefined;
|
|
4270
|
+
if (propsBuildResult.shouldUseBlock) {
|
|
4271
|
+
shouldUseBlock = true;
|
|
4272
|
+
}
|
|
4273
4273
|
}
|
|
4274
4274
|
// children
|
|
4275
4275
|
if (node.children.length > 0) {
|
|
@@ -4440,11 +4440,13 @@ function resolveSetupReference(name, context) {
|
|
|
4440
4440
|
}
|
|
4441
4441
|
}
|
|
4442
4442
|
function buildProps(node, context, props = node.props, ssr = false) {
|
|
4443
|
-
const { tag, loc: elementLoc } = node;
|
|
4443
|
+
const { tag, loc: elementLoc, children } = node;
|
|
4444
4444
|
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
4445
4445
|
let properties = [];
|
|
4446
4446
|
const mergeArgs = [];
|
|
4447
4447
|
const runtimeDirectives = [];
|
|
4448
|
+
const hasChildren = children.length > 0;
|
|
4449
|
+
let shouldUseBlock = false;
|
|
4448
4450
|
// patchFlag analysis
|
|
4449
4451
|
let patchFlag = 0;
|
|
4450
4452
|
let hasRef = false;
|
|
@@ -4507,15 +4509,20 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4507
4509
|
const prop = props[i];
|
|
4508
4510
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
4509
4511
|
const { loc, name, value } = prop;
|
|
4510
|
-
let
|
|
4512
|
+
let isStatic = true;
|
|
4511
4513
|
if (name === 'ref') {
|
|
4512
4514
|
hasRef = true;
|
|
4515
|
+
if (context.scopes.vFor > 0) {
|
|
4516
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
4517
|
+
}
|
|
4513
4518
|
// in inline mode there is no setupState object, so we can't use string
|
|
4514
4519
|
// keys to set the ref. Instead, we need to transform it to pass the
|
|
4515
4520
|
// actual ref instead.
|
|
4516
|
-
if (
|
|
4517
|
-
|
|
4518
|
-
|
|
4521
|
+
if (value &&
|
|
4522
|
+
context.inline &&
|
|
4523
|
+
context.bindingMetadata[value.content]) {
|
|
4524
|
+
isStatic = false;
|
|
4525
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_key', true), createSimpleExpression(value.content, true, value.loc)));
|
|
4519
4526
|
}
|
|
4520
4527
|
}
|
|
4521
4528
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -4525,7 +4532,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4525
4532
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
|
4526
4533
|
continue;
|
|
4527
4534
|
}
|
|
4528
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
4535
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
|
4529
4536
|
}
|
|
4530
4537
|
else {
|
|
4531
4538
|
// directives
|
|
@@ -4546,7 +4553,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4546
4553
|
// skip v-is and :is on <component>
|
|
4547
4554
|
if (name === 'is' ||
|
|
4548
4555
|
(isVBind &&
|
|
4549
|
-
|
|
4556
|
+
isStaticArgOf(arg, 'is') &&
|
|
4550
4557
|
(isComponentTag(tag) ||
|
|
4551
4558
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
|
|
4552
4559
|
continue;
|
|
@@ -4555,6 +4562,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4555
4562
|
if (isVOn && ssr) {
|
|
4556
4563
|
continue;
|
|
4557
4564
|
}
|
|
4565
|
+
if (
|
|
4566
|
+
// #938: elements with dynamic keys should be forced into blocks
|
|
4567
|
+
(isVBind && isStaticArgOf(arg, 'key')) ||
|
|
4568
|
+
// inline before-update hooks need to force block so that it is invoked
|
|
4569
|
+
// before children
|
|
4570
|
+
(isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
|
|
4571
|
+
shouldUseBlock = true;
|
|
4572
|
+
}
|
|
4573
|
+
if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
|
|
4574
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
4575
|
+
}
|
|
4558
4576
|
// special case for v-bind and v-on with no argument
|
|
4559
4577
|
if (!arg && (isVBind || isVOn)) {
|
|
4560
4578
|
hasDynamicKeys = true;
|
|
@@ -4605,14 +4623,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4605
4623
|
else {
|
|
4606
4624
|
// no built-in transform, this is a user custom directive.
|
|
4607
4625
|
runtimeDirectives.push(prop);
|
|
4626
|
+
// custom dirs may use beforeUpdate so they need to force blocks
|
|
4627
|
+
// to ensure before-update gets called before children update
|
|
4628
|
+
if (hasChildren) {
|
|
4629
|
+
shouldUseBlock = true;
|
|
4630
|
+
}
|
|
4608
4631
|
}
|
|
4609
4632
|
}
|
|
4610
|
-
if (prop.type === 6 /* ATTRIBUTE */ &&
|
|
4611
|
-
prop.name === 'ref' &&
|
|
4612
|
-
context.scopes.vFor > 0 &&
|
|
4613
|
-
checkCompatEnabled("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
|
|
4614
|
-
properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
|
|
4615
|
-
}
|
|
4616
4633
|
}
|
|
4617
4634
|
let propsExpression = undefined;
|
|
4618
4635
|
// has v-bind="object" or v-on="object", wrap with mergeProps
|
|
@@ -4649,7 +4666,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4649
4666
|
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
|
4650
4667
|
}
|
|
4651
4668
|
}
|
|
4652
|
-
if (
|
|
4669
|
+
if (!shouldUseBlock &&
|
|
4670
|
+
(patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
|
|
4653
4671
|
(hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
|
|
4654
4672
|
patchFlag |= 512 /* NEED_PATCH */;
|
|
4655
4673
|
}
|
|
@@ -4716,7 +4734,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4716
4734
|
props: propsExpression,
|
|
4717
4735
|
directives: runtimeDirectives,
|
|
4718
4736
|
patchFlag,
|
|
4719
|
-
dynamicPropNames
|
|
4737
|
+
dynamicPropNames,
|
|
4738
|
+
shouldUseBlock
|
|
4720
4739
|
};
|
|
4721
4740
|
}
|
|
4722
4741
|
// Dedupe props in an object literal.
|
|
@@ -4811,21 +4830,6 @@ function stringifyDynamicPropNames(props) {
|
|
|
4811
4830
|
}
|
|
4812
4831
|
function isComponentTag(tag) {
|
|
4813
4832
|
return tag === 'component' || tag === 'Component';
|
|
4814
|
-
}
|
|
4815
|
-
function processInlineRef(context, raw) {
|
|
4816
|
-
const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
|
|
4817
|
-
const { bindingMetadata, helperString } = context;
|
|
4818
|
-
const type = bindingMetadata[raw];
|
|
4819
|
-
if (type === "setup-ref" /* SETUP_REF */) {
|
|
4820
|
-
body.push(createSimpleExpression(`${raw}.value = _value`));
|
|
4821
|
-
}
|
|
4822
|
-
else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
|
|
4823
|
-
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
|
|
4824
|
-
}
|
|
4825
|
-
else if (type === "setup-let" /* SETUP_LET */) {
|
|
4826
|
-
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
|
|
4827
|
-
}
|
|
4828
|
-
return body;
|
|
4829
4833
|
}
|
|
4830
4834
|
|
|
4831
4835
|
const cacheStringFunction = (fn) => {
|
|
@@ -4888,7 +4892,7 @@ function processSlotOutlet(node, context) {
|
|
|
4888
4892
|
}
|
|
4889
4893
|
}
|
|
4890
4894
|
else {
|
|
4891
|
-
if (p.name === 'bind' &&
|
|
4895
|
+
if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
|
|
4892
4896
|
if (p.exp)
|
|
4893
4897
|
slotName = p.exp;
|
|
4894
4898
|
}
|
|
@@ -4922,7 +4926,11 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
4922
4926
|
let eventName;
|
|
4923
4927
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
4924
4928
|
if (arg.isStatic) {
|
|
4925
|
-
|
|
4929
|
+
let rawName = arg.content;
|
|
4930
|
+
// TODO deprecate @vnodeXXX usage
|
|
4931
|
+
if (rawName.startsWith('vue:')) {
|
|
4932
|
+
rawName = `vnode-${rawName.slice(4)}`;
|
|
4933
|
+
}
|
|
4926
4934
|
// for all event listeners, auto convert it to camelCase. See issue #2249
|
|
4927
4935
|
eventName = createSimpleExpression(shared.toHandlerKey(shared.camelize(rawName)), true, arg.loc);
|
|
4928
4936
|
}
|
|
@@ -5619,7 +5627,6 @@ exports.hasDynamicKeyVBind = hasDynamicKeyVBind;
|
|
|
5619
5627
|
exports.hasScopeRef = hasScopeRef;
|
|
5620
5628
|
exports.helperNameMap = helperNameMap;
|
|
5621
5629
|
exports.injectProp = injectProp;
|
|
5622
|
-
exports.isBindKey = isBindKey;
|
|
5623
5630
|
exports.isBuiltInType = isBuiltInType;
|
|
5624
5631
|
exports.isCoreComponent = isCoreComponent;
|
|
5625
5632
|
exports.isFunctionType = isFunctionType;
|
|
@@ -5630,6 +5637,7 @@ exports.isMemberExpressionNode = isMemberExpressionNode;
|
|
|
5630
5637
|
exports.isReferencedIdentifier = isReferencedIdentifier;
|
|
5631
5638
|
exports.isSimpleIdentifier = isSimpleIdentifier;
|
|
5632
5639
|
exports.isSlotOutlet = isSlotOutlet;
|
|
5640
|
+
exports.isStaticArgOf = isStaticArgOf;
|
|
5633
5641
|
exports.isStaticExp = isStaticExp;
|
|
5634
5642
|
exports.isStaticProperty = isStaticProperty;
|
|
5635
5643
|
exports.isStaticPropertyKey = isStaticPropertyKey;
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ export declare function buildProps(node: ElementNode, context: TransformContext,
|
|
|
105
105
|
directives: DirectiveNode[];
|
|
106
106
|
patchFlag: number;
|
|
107
107
|
dynamicPropNames: string[];
|
|
108
|
+
shouldUseBlock: boolean;
|
|
108
109
|
};
|
|
109
110
|
|
|
110
111
|
export declare function buildSlots(node: ElementNode, context: TransformContext, buildSlotFn?: SlotFnBuilder): {
|
|
@@ -220,7 +221,6 @@ export declare const enum CompilerDeprecationTypes {
|
|
|
220
221
|
COMPILER_V_BIND_OBJECT_ORDER = "COMPILER_V_BIND_OBJECT_ORDER",
|
|
221
222
|
COMPILER_V_ON_NATIVE = "COMPILER_V_ON_NATIVE",
|
|
222
223
|
COMPILER_V_IF_V_FOR_PRECEDENCE = "COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
223
|
-
COMPILER_V_FOR_REF = "COMPILER_V_FOR_REF",
|
|
224
224
|
COMPILER_NATIVE_TEMPLATE = "COMPILER_NATIVE_TEMPLATE",
|
|
225
225
|
COMPILER_INLINE_TEMPLATE = "COMPILER_INLINE_TEMPLATE",
|
|
226
226
|
COMPILER_FILTERS = "COMPILER_FILTER"
|
|
@@ -589,8 +589,6 @@ export declare const IS_MEMO_SAME: unique symbol;
|
|
|
589
589
|
|
|
590
590
|
export declare const IS_REF: unique symbol;
|
|
591
591
|
|
|
592
|
-
export declare function isBindKey(arg: DirectiveNode['arg'], name: string): boolean;
|
|
593
|
-
|
|
594
592
|
export declare const isBuiltInType: (tag: string, expected: string) => boolean;
|
|
595
593
|
|
|
596
594
|
export declare function isCoreComponent(tag: string): symbol | void;
|
|
@@ -617,6 +615,8 @@ export declare const isSimpleIdentifier: (name: string) => boolean;
|
|
|
617
615
|
|
|
618
616
|
export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
|
|
619
617
|
|
|
618
|
+
export declare function isStaticArgOf(arg: DirectiveNode['arg'], name: string): boolean;
|
|
619
|
+
|
|
620
620
|
export declare const isStaticExp: (p: JSChildNode) => p is SimpleExpressionNode;
|
|
621
621
|
|
|
622
622
|
export declare const isStaticProperty: (node: Node_3) => node is ObjectProperty;
|
|
@@ -512,12 +512,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
512
512
|
}
|
|
513
513
|
else if (p.name === 'bind' &&
|
|
514
514
|
(p.exp || allowEmpty) &&
|
|
515
|
-
|
|
515
|
+
isStaticArgOf(p.arg, name)) {
|
|
516
516
|
return p;
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function isStaticArgOf(arg, name) {
|
|
521
521
|
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
522
522
|
}
|
|
523
523
|
function hasDynamicKeyVBind(node) {
|
|
@@ -751,11 +751,6 @@ const deprecationData = {
|
|
|
751
751
|
`data source.`,
|
|
752
752
|
link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
|
|
753
753
|
},
|
|
754
|
-
["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
|
|
755
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
756
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
757
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
758
|
-
},
|
|
759
754
|
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
|
760
755
|
message: `<template> with no special directives will render as a native template ` +
|
|
761
756
|
`element instead of its inner content in Vue 3.`
|
|
@@ -1275,7 +1270,7 @@ function isComponent(tag, props, context) {
|
|
|
1275
1270
|
else if (
|
|
1276
1271
|
// :is on plain element - only treat as component in compat mode
|
|
1277
1272
|
p.name === 'bind' &&
|
|
1278
|
-
|
|
1273
|
+
isStaticArgOf(p.arg, 'is') &&
|
|
1279
1274
|
true &&
|
|
1280
1275
|
checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
|
1281
1276
|
return true;
|
|
@@ -1733,6 +1728,11 @@ function getConstantType(node, context) {
|
|
|
1733
1728
|
if (codegenNode.type !== 13 /* VNODE_CALL */) {
|
|
1734
1729
|
return 0 /* NOT_CONSTANT */;
|
|
1735
1730
|
}
|
|
1731
|
+
if (codegenNode.isBlock &&
|
|
1732
|
+
node.tag !== 'svg' &&
|
|
1733
|
+
node.tag !== 'foreignObject') {
|
|
1734
|
+
return 0 /* NOT_CONSTANT */;
|
|
1735
|
+
}
|
|
1736
1736
|
const flag = getPatchFlag(codegenNode);
|
|
1737
1737
|
if (!flag) {
|
|
1738
1738
|
let returnType = 3 /* CAN_STRINGIFY */;
|
|
@@ -1870,7 +1870,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
1870
1870
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
1871
1871
|
// some helper calls can be hoisted,
|
|
1872
1872
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
1873
|
-
// in this case we need to respect the ConstantType of the helper's
|
|
1873
|
+
// in this case we need to respect the ConstantType of the helper's arguments
|
|
1874
1874
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
1875
1875
|
}
|
|
1876
1876
|
else {
|
|
@@ -3662,10 +3662,7 @@ const transformElement = (node, context) => {
|
|
|
3662
3662
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
3663
3663
|
// This is technically web-specific, but splitting the logic out of core
|
|
3664
3664
|
// leads to too much unnecessary complexity.
|
|
3665
|
-
(tag === 'svg' ||
|
|
3666
|
-
tag === 'foreignObject' ||
|
|
3667
|
-
// #938: elements with dynamic keys should be forced into blocks
|
|
3668
|
-
findProp(node, 'key', true)));
|
|
3665
|
+
(tag === 'svg' || tag === 'foreignObject'));
|
|
3669
3666
|
// props
|
|
3670
3667
|
if (props.length > 0) {
|
|
3671
3668
|
const propsBuildResult = buildProps(node, context);
|
|
@@ -3677,6 +3674,9 @@ const transformElement = (node, context) => {
|
|
|
3677
3674
|
directives && directives.length
|
|
3678
3675
|
? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
|
|
3679
3676
|
: undefined;
|
|
3677
|
+
if (propsBuildResult.shouldUseBlock) {
|
|
3678
|
+
shouldUseBlock = true;
|
|
3679
|
+
}
|
|
3680
3680
|
}
|
|
3681
3681
|
// children
|
|
3682
3682
|
if (node.children.length > 0) {
|
|
@@ -3808,11 +3808,13 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
3808
3808
|
return toValidAssetId(tag, `component`);
|
|
3809
3809
|
}
|
|
3810
3810
|
function buildProps(node, context, props = node.props, ssr = false) {
|
|
3811
|
-
const { tag, loc: elementLoc } = node;
|
|
3811
|
+
const { tag, loc: elementLoc, children } = node;
|
|
3812
3812
|
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
3813
3813
|
let properties = [];
|
|
3814
3814
|
const mergeArgs = [];
|
|
3815
3815
|
const runtimeDirectives = [];
|
|
3816
|
+
const hasChildren = children.length > 0;
|
|
3817
|
+
let shouldUseBlock = false;
|
|
3816
3818
|
// patchFlag analysis
|
|
3817
3819
|
let patchFlag = 0;
|
|
3818
3820
|
let hasRef = false;
|
|
@@ -3875,9 +3877,12 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
3875
3877
|
const prop = props[i];
|
|
3876
3878
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
3877
3879
|
const { loc, name, value } = prop;
|
|
3878
|
-
let
|
|
3880
|
+
let isStatic = true;
|
|
3879
3881
|
if (name === 'ref') {
|
|
3880
3882
|
hasRef = true;
|
|
3883
|
+
if (context.scopes.vFor > 0) {
|
|
3884
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
3885
|
+
}
|
|
3881
3886
|
}
|
|
3882
3887
|
// skip is on <component>, or is="vue:xxx"
|
|
3883
3888
|
if (name === 'is' &&
|
|
@@ -3886,7 +3891,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
3886
3891
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
|
3887
3892
|
continue;
|
|
3888
3893
|
}
|
|
3889
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
3894
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
|
3890
3895
|
}
|
|
3891
3896
|
else {
|
|
3892
3897
|
// directives
|
|
@@ -3907,7 +3912,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
3907
3912
|
// skip v-is and :is on <component>
|
|
3908
3913
|
if (name === 'is' ||
|
|
3909
3914
|
(isVBind &&
|
|
3910
|
-
|
|
3915
|
+
isStaticArgOf(arg, 'is') &&
|
|
3911
3916
|
(isComponentTag(tag) ||
|
|
3912
3917
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
|
|
3913
3918
|
continue;
|
|
@@ -3916,6 +3921,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
3916
3921
|
if (isVOn && ssr) {
|
|
3917
3922
|
continue;
|
|
3918
3923
|
}
|
|
3924
|
+
if (
|
|
3925
|
+
// #938: elements with dynamic keys should be forced into blocks
|
|
3926
|
+
(isVBind && isStaticArgOf(arg, 'key')) ||
|
|
3927
|
+
// inline before-update hooks need to force block so that it is invoked
|
|
3928
|
+
// before children
|
|
3929
|
+
(isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
|
|
3930
|
+
shouldUseBlock = true;
|
|
3931
|
+
}
|
|
3932
|
+
if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
|
|
3933
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
3934
|
+
}
|
|
3919
3935
|
// special case for v-bind and v-on with no argument
|
|
3920
3936
|
if (!arg && (isVBind || isVOn)) {
|
|
3921
3937
|
hasDynamicKeys = true;
|
|
@@ -3989,14 +4005,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
3989
4005
|
else {
|
|
3990
4006
|
// no built-in transform, this is a user custom directive.
|
|
3991
4007
|
runtimeDirectives.push(prop);
|
|
4008
|
+
// custom dirs may use beforeUpdate so they need to force blocks
|
|
4009
|
+
// to ensure before-update gets called before children update
|
|
4010
|
+
if (hasChildren) {
|
|
4011
|
+
shouldUseBlock = true;
|
|
4012
|
+
}
|
|
3992
4013
|
}
|
|
3993
4014
|
}
|
|
3994
|
-
if (prop.type === 6 /* ATTRIBUTE */ &&
|
|
3995
|
-
prop.name === 'ref' &&
|
|
3996
|
-
context.scopes.vFor > 0 &&
|
|
3997
|
-
checkCompatEnabled("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
|
|
3998
|
-
properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
|
|
3999
|
-
}
|
|
4000
4015
|
}
|
|
4001
4016
|
let propsExpression = undefined;
|
|
4002
4017
|
// has v-bind="object" or v-on="object", wrap with mergeProps
|
|
@@ -4033,7 +4048,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4033
4048
|
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
|
4034
4049
|
}
|
|
4035
4050
|
}
|
|
4036
|
-
if (
|
|
4051
|
+
if (!shouldUseBlock &&
|
|
4052
|
+
(patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
|
|
4037
4053
|
(hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
|
|
4038
4054
|
patchFlag |= 512 /* NEED_PATCH */;
|
|
4039
4055
|
}
|
|
@@ -4100,7 +4116,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4100
4116
|
props: propsExpression,
|
|
4101
4117
|
directives: runtimeDirectives,
|
|
4102
4118
|
patchFlag,
|
|
4103
|
-
dynamicPropNames
|
|
4119
|
+
dynamicPropNames,
|
|
4120
|
+
shouldUseBlock
|
|
4104
4121
|
};
|
|
4105
4122
|
}
|
|
4106
4123
|
// Dedupe props in an object literal.
|
|
@@ -4255,7 +4272,7 @@ function processSlotOutlet(node, context) {
|
|
|
4255
4272
|
}
|
|
4256
4273
|
}
|
|
4257
4274
|
else {
|
|
4258
|
-
if (p.name === 'bind' &&
|
|
4275
|
+
if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
|
|
4259
4276
|
if (p.exp)
|
|
4260
4277
|
slotName = p.exp;
|
|
4261
4278
|
}
|
|
@@ -4289,7 +4306,11 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
4289
4306
|
let eventName;
|
|
4290
4307
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
4291
4308
|
if (arg.isStatic) {
|
|
4292
|
-
|
|
4309
|
+
let rawName = arg.content;
|
|
4310
|
+
// TODO deprecate @vnodeXXX usage
|
|
4311
|
+
if (rawName.startsWith('vue:')) {
|
|
4312
|
+
rawName = `vnode-${rawName.slice(4)}`;
|
|
4313
|
+
}
|
|
4293
4314
|
// for all event listeners, auto convert it to camelCase. See issue #2249
|
|
4294
4315
|
eventName = createSimpleExpression(toHandlerKey(camelize$1(rawName)), true, arg.loc);
|
|
4295
4316
|
}
|
|
@@ -4834,4 +4855,4 @@ function baseCompile(template, options = {}) {
|
|
|
4834
4855
|
|
|
4835
4856
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
4836
4857
|
|
|
4837
|
-
export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp,
|
|
4858
|
+
export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText, isVSlot, locStub, makeBlock, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.25",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.2.
|
|
36
|
-
"@babel/parser": "^7.
|
|
35
|
+
"@vue/shared": "3.2.25",
|
|
36
|
+
"@babel/parser": "^7.16.4",
|
|
37
37
|
"estree-walker": "^2.0.2",
|
|
38
38
|
"source-map": "^0.6.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@babel/types": "^7.
|
|
41
|
+
"@babel/types": "^7.16.0"
|
|
42
42
|
}
|
|
43
43
|
}
|