@vue/compiler-dom 3.2.21 → 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.
- package/dist/compiler-dom.cjs.js +20 -3
- package/dist/compiler-dom.cjs.prod.js +20 -3
- package/dist/compiler-dom.esm-browser.js +57 -56
- package/dist/compiler-dom.esm-browser.prod.js +1 -1
- package/dist/compiler-dom.global.js +57 -56
- package/dist/compiler-dom.global.prod.js +1 -1
- package/package.json +3 -3
package/dist/compiler-dom.cjs.js
CHANGED
|
@@ -2766,6 +2766,11 @@ function hasMultipleChildren(node) {
|
|
|
2766
2766
|
/**
|
|
2767
2767
|
* This module is Node-only.
|
|
2768
2768
|
*/
|
|
2769
|
+
/**
|
|
2770
|
+
* Regex for replacing placeholders for embedded constant variables
|
|
2771
|
+
* (e.g. import URL string constants generated by compiler-sfc)
|
|
2772
|
+
*/
|
|
2773
|
+
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
|
2769
2774
|
/**
|
|
2770
2775
|
* Turn eligible hoisted static trees into stringified static nodes, e.g.
|
|
2771
2776
|
*
|
|
@@ -2802,7 +2807,7 @@ const stringifyStatic = (children, context, parent) => {
|
|
|
2802
2807
|
ec >= 5 /* ELEMENT_WITH_BINDING_COUNT */) {
|
|
2803
2808
|
// combine all currently eligible nodes into a single static vnode call
|
|
2804
2809
|
const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
|
|
2805
|
-
JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')),
|
|
2810
|
+
JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')).replace(expReplaceRE, `" + $1 + "`),
|
|
2806
2811
|
// the 2nd argument indicates the number of DOM nodes this static vnode
|
|
2807
2812
|
// will insert / hydrate
|
|
2808
2813
|
String(currentChunk.length)
|
|
@@ -2870,7 +2875,7 @@ const replaceHoist = (node, replacement, context) => {
|
|
|
2870
2875
|
const isNonStringifiable = /*#__PURE__*/ shared.makeMap(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
|
|
2871
2876
|
/**
|
|
2872
2877
|
* for a hoisted node, analyze it and return:
|
|
2873
|
-
* - false: bailed (contains runtime constant)
|
|
2878
|
+
* - false: bailed (contains non-stringifiable props or runtime constant)
|
|
2874
2879
|
* - [nc, ec] where
|
|
2875
2880
|
* - nc is the number of nodes inside
|
|
2876
2881
|
* - ec is the number of element with bindings inside
|
|
@@ -2908,6 +2913,11 @@ function analyzeNode(node) {
|
|
|
2908
2913
|
(p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns)))) {
|
|
2909
2914
|
return bail();
|
|
2910
2915
|
}
|
|
2916
|
+
if (p.exp &&
|
|
2917
|
+
(p.exp.type === 8 /* COMPOUND_EXPRESSION */ ||
|
|
2918
|
+
p.exp.constType < 3 /* CAN_STRINGIFY */)) {
|
|
2919
|
+
return bail();
|
|
2920
|
+
}
|
|
2911
2921
|
}
|
|
2912
2922
|
}
|
|
2913
2923
|
for (let i = 0; i < node.children.length; i++) {
|
|
@@ -2963,8 +2973,15 @@ function stringifyElement(node, context) {
|
|
|
2963
2973
|
}
|
|
2964
2974
|
}
|
|
2965
2975
|
else if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
|
|
2976
|
+
const exp = p.exp;
|
|
2977
|
+
if (exp.content[0] === '_') {
|
|
2978
|
+
// internally generated string constant references
|
|
2979
|
+
// e.g. imported URL strings via compiler-sfc transformAssetUrl plugin
|
|
2980
|
+
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
2981
|
+
continue;
|
|
2982
|
+
}
|
|
2966
2983
|
// constant v-bind, e.g. :foo="1"
|
|
2967
|
-
let evaluated = evaluateConstant(
|
|
2984
|
+
let evaluated = evaluateConstant(exp);
|
|
2968
2985
|
if (evaluated != null) {
|
|
2969
2986
|
const arg = p.arg && p.arg.content;
|
|
2970
2987
|
if (arg === 'class') {
|
|
@@ -2723,6 +2723,11 @@ const transformShow = (dir, node, context) => {
|
|
|
2723
2723
|
/**
|
|
2724
2724
|
* This module is Node-only.
|
|
2725
2725
|
*/
|
|
2726
|
+
/**
|
|
2727
|
+
* Regex for replacing placeholders for embedded constant variables
|
|
2728
|
+
* (e.g. import URL string constants generated by compiler-sfc)
|
|
2729
|
+
*/
|
|
2730
|
+
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
|
2726
2731
|
/**
|
|
2727
2732
|
* Turn eligible hoisted static trees into stringified static nodes, e.g.
|
|
2728
2733
|
*
|
|
@@ -2759,7 +2764,7 @@ const stringifyStatic = (children, context, parent) => {
|
|
|
2759
2764
|
ec >= 5 /* ELEMENT_WITH_BINDING_COUNT */) {
|
|
2760
2765
|
// combine all currently eligible nodes into a single static vnode call
|
|
2761
2766
|
const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
|
|
2762
|
-
JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')),
|
|
2767
|
+
JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')).replace(expReplaceRE, `" + $1 + "`),
|
|
2763
2768
|
// the 2nd argument indicates the number of DOM nodes this static vnode
|
|
2764
2769
|
// will insert / hydrate
|
|
2765
2770
|
String(currentChunk.length)
|
|
@@ -2827,7 +2832,7 @@ const replaceHoist = (node, replacement, context) => {
|
|
|
2827
2832
|
const isNonStringifiable = /*#__PURE__*/ shared.makeMap(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
|
|
2828
2833
|
/**
|
|
2829
2834
|
* for a hoisted node, analyze it and return:
|
|
2830
|
-
* - false: bailed (contains runtime constant)
|
|
2835
|
+
* - false: bailed (contains non-stringifiable props or runtime constant)
|
|
2831
2836
|
* - [nc, ec] where
|
|
2832
2837
|
* - nc is the number of nodes inside
|
|
2833
2838
|
* - ec is the number of element with bindings inside
|
|
@@ -2865,6 +2870,11 @@ function analyzeNode(node) {
|
|
|
2865
2870
|
(p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns)))) {
|
|
2866
2871
|
return bail();
|
|
2867
2872
|
}
|
|
2873
|
+
if (p.exp &&
|
|
2874
|
+
(p.exp.type === 8 /* COMPOUND_EXPRESSION */ ||
|
|
2875
|
+
p.exp.constType < 3 /* CAN_STRINGIFY */)) {
|
|
2876
|
+
return bail();
|
|
2877
|
+
}
|
|
2868
2878
|
}
|
|
2869
2879
|
}
|
|
2870
2880
|
for (let i = 0; i < node.children.length; i++) {
|
|
@@ -2920,8 +2930,15 @@ function stringifyElement(node, context) {
|
|
|
2920
2930
|
}
|
|
2921
2931
|
}
|
|
2922
2932
|
else if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
|
|
2933
|
+
const exp = p.exp;
|
|
2934
|
+
if (exp.content[0] === '_') {
|
|
2935
|
+
// internally generated string constant references
|
|
2936
|
+
// e.g. imported URL strings via compiler-sfc transformAssetUrl plugin
|
|
2937
|
+
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
2938
|
+
continue;
|
|
2939
|
+
}
|
|
2923
2940
|
// constant v-bind, e.g. :foo="1"
|
|
2924
|
-
let evaluated = evaluateConstant(
|
|
2941
|
+
let evaluated = evaluateConstant(exp);
|
|
2925
2942
|
if (evaluated != null) {
|
|
2926
2943
|
const arg = p.arg && p.arg.content;
|
|
2927
2944
|
if (arg === 'class') {
|
|
@@ -144,7 +144,7 @@ const isSymbol = (val) => typeof val === 'symbol';
|
|
|
144
144
|
const isObject = (val) => val !== null && typeof val === 'object';
|
|
145
145
|
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
146
146
|
// the leading comma is intentional so empty string "" is also included
|
|
147
|
-
',key,ref,' +
|
|
147
|
+
',key,ref,ref_for,ref_key,' +
|
|
148
148
|
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
149
149
|
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
150
150
|
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
@@ -686,12 +686,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
686
686
|
}
|
|
687
687
|
else if (p.name === 'bind' &&
|
|
688
688
|
(p.exp || allowEmpty) &&
|
|
689
|
-
|
|
689
|
+
isStaticArgOf(p.arg, name)) {
|
|
690
690
|
return p;
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function isStaticArgOf(arg, name) {
|
|
695
695
|
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
696
696
|
}
|
|
697
697
|
function hasDynamicKeyVBind(node) {
|
|
@@ -734,7 +734,6 @@ function getUnnormalizedProps(props, callPath = []) {
|
|
|
734
734
|
}
|
|
735
735
|
function injectProp(node, prop, context) {
|
|
736
736
|
let propsWithInjection;
|
|
737
|
-
const originalProps = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
|
|
738
737
|
/**
|
|
739
738
|
* 1. mergeProps(...)
|
|
740
739
|
* 2. toHandlers(...)
|
|
@@ -743,7 +742,7 @@ function injectProp(node, prop, context) {
|
|
|
743
742
|
*
|
|
744
743
|
* we need to get the real props before normalization
|
|
745
744
|
*/
|
|
746
|
-
let props =
|
|
745
|
+
let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
|
|
747
746
|
let callPath = [];
|
|
748
747
|
let parentCall;
|
|
749
748
|
if (props &&
|
|
@@ -925,11 +924,6 @@ const deprecationData = {
|
|
|
925
924
|
`data source.`,
|
|
926
925
|
link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
|
|
927
926
|
},
|
|
928
|
-
["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
|
|
929
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
930
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
931
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
932
|
-
},
|
|
933
927
|
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
|
934
928
|
message: `<template> with no special directives will render as a native template ` +
|
|
935
929
|
`element instead of its inner content in Vue 3.`
|
|
@@ -1447,7 +1441,7 @@ function isComponent(tag, props, context) {
|
|
|
1447
1441
|
else if (
|
|
1448
1442
|
// :is on plain element - only treat as component in compat mode
|
|
1449
1443
|
p.name === 'bind' &&
|
|
1450
|
-
|
|
1444
|
+
isStaticArgOf(p.arg, 'is') &&
|
|
1451
1445
|
true &&
|
|
1452
1446
|
checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
|
1453
1447
|
return true;
|
|
@@ -1807,15 +1801,6 @@ function isSingleElementRoot(root, child) {
|
|
|
1807
1801
|
!isSlotOutlet(child));
|
|
1808
1802
|
}
|
|
1809
1803
|
function walk(node, context, doNotHoistNode = false) {
|
|
1810
|
-
// Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
|
|
1811
|
-
// static bindings with expressions. These expressions are guaranteed to be
|
|
1812
|
-
// constant so they are still eligible for hoisting, but they are only
|
|
1813
|
-
// available at runtime and therefore cannot be evaluated ahead of time.
|
|
1814
|
-
// This is only a concern for pre-stringification (via transformHoist by
|
|
1815
|
-
// @vue/compiler-dom), but doing it here allows us to perform only one full
|
|
1816
|
-
// walk of the AST and allow `stringifyStatic` to stop walking as soon as its
|
|
1817
|
-
// stringification threshold is met.
|
|
1818
|
-
let canStringify = true;
|
|
1819
1804
|
const { children } = node;
|
|
1820
1805
|
const originalCount = children.length;
|
|
1821
1806
|
let hoistedCount = 0;
|
|
@@ -1828,9 +1813,6 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1828
1813
|
? 0 /* NOT_CONSTANT */
|
|
1829
1814
|
: getConstantType(child, context);
|
|
1830
1815
|
if (constantType > 0 /* NOT_CONSTANT */) {
|
|
1831
|
-
if (constantType < 3 /* CAN_STRINGIFY */) {
|
|
1832
|
-
canStringify = false;
|
|
1833
|
-
}
|
|
1834
1816
|
if (constantType >= 2 /* CAN_HOIST */) {
|
|
1835
1817
|
child.codegenNode.patchFlag =
|
|
1836
1818
|
-1 /* HOISTED */ + (` /* HOISTED */` );
|
|
@@ -1861,17 +1843,10 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1861
1843
|
}
|
|
1862
1844
|
}
|
|
1863
1845
|
}
|
|
1864
|
-
else if (child.type === 12 /* TEXT_CALL */
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
canStringify = false;
|
|
1869
|
-
}
|
|
1870
|
-
if (contentType >= 2 /* CAN_HOIST */) {
|
|
1871
|
-
child.codegenNode = context.hoist(child.codegenNode);
|
|
1872
|
-
hoistedCount++;
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1846
|
+
else if (child.type === 12 /* TEXT_CALL */ &&
|
|
1847
|
+
getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
|
|
1848
|
+
child.codegenNode = context.hoist(child.codegenNode);
|
|
1849
|
+
hoistedCount++;
|
|
1875
1850
|
}
|
|
1876
1851
|
// walk further
|
|
1877
1852
|
if (child.type === 1 /* ELEMENT */) {
|
|
@@ -1895,7 +1870,7 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1895
1870
|
}
|
|
1896
1871
|
}
|
|
1897
1872
|
}
|
|
1898
|
-
if (
|
|
1873
|
+
if (hoistedCount && context.transformHoist) {
|
|
1899
1874
|
context.transformHoist(children, context, node);
|
|
1900
1875
|
}
|
|
1901
1876
|
// all children were hoisted - the entire children array is hoistable.
|
|
@@ -1924,6 +1899,11 @@ function getConstantType(node, context) {
|
|
|
1924
1899
|
if (codegenNode.type !== 13 /* VNODE_CALL */) {
|
|
1925
1900
|
return 0 /* NOT_CONSTANT */;
|
|
1926
1901
|
}
|
|
1902
|
+
if (codegenNode.isBlock &&
|
|
1903
|
+
node.tag !== 'svg' &&
|
|
1904
|
+
node.tag !== 'foreignObject') {
|
|
1905
|
+
return 0 /* NOT_CONSTANT */;
|
|
1906
|
+
}
|
|
1927
1907
|
const flag = getPatchFlag(codegenNode);
|
|
1928
1908
|
if (!flag) {
|
|
1929
1909
|
let returnType = 3 /* CAN_STRINGIFY */;
|
|
@@ -2060,7 +2040,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
2060
2040
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
2061
2041
|
// some helper calls can be hoisted,
|
|
2062
2042
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
2063
|
-
// in this case we need to respect the ConstantType of the helper's
|
|
2043
|
+
// in this case we need to respect the ConstantType of the helper's arguments
|
|
2064
2044
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
2065
2045
|
}
|
|
2066
2046
|
else {
|
|
@@ -3846,10 +3826,7 @@ const transformElement = (node, context) => {
|
|
|
3846
3826
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
3847
3827
|
// This is technically web-specific, but splitting the logic out of core
|
|
3848
3828
|
// leads to too much unnecessary complexity.
|
|
3849
|
-
(tag === 'svg' ||
|
|
3850
|
-
tag === 'foreignObject' ||
|
|
3851
|
-
// #938: elements with dynamic keys should be forced into blocks
|
|
3852
|
-
findProp(node, 'key', true)));
|
|
3829
|
+
(tag === 'svg' || tag === 'foreignObject'));
|
|
3853
3830
|
// props
|
|
3854
3831
|
if (props.length > 0) {
|
|
3855
3832
|
const propsBuildResult = buildProps(node, context);
|
|
@@ -3861,6 +3838,9 @@ const transformElement = (node, context) => {
|
|
|
3861
3838
|
directives && directives.length
|
|
3862
3839
|
? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
|
|
3863
3840
|
: undefined;
|
|
3841
|
+
if (propsBuildResult.shouldUseBlock) {
|
|
3842
|
+
shouldUseBlock = true;
|
|
3843
|
+
}
|
|
3864
3844
|
}
|
|
3865
3845
|
// children
|
|
3866
3846
|
if (node.children.length > 0) {
|
|
@@ -3989,11 +3969,13 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
3989
3969
|
return toValidAssetId(tag, `component`);
|
|
3990
3970
|
}
|
|
3991
3971
|
function buildProps(node, context, props = node.props, ssr = false) {
|
|
3992
|
-
const { tag, loc: elementLoc } = node;
|
|
3972
|
+
const { tag, loc: elementLoc, children } = node;
|
|
3993
3973
|
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
3994
3974
|
let properties = [];
|
|
3995
3975
|
const mergeArgs = [];
|
|
3996
3976
|
const runtimeDirectives = [];
|
|
3977
|
+
const hasChildren = children.length > 0;
|
|
3978
|
+
let shouldUseBlock = false;
|
|
3997
3979
|
// patchFlag analysis
|
|
3998
3980
|
let patchFlag = 0;
|
|
3999
3981
|
let hasRef = false;
|
|
@@ -4056,9 +4038,12 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4056
4038
|
const prop = props[i];
|
|
4057
4039
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
4058
4040
|
const { loc, name, value } = prop;
|
|
4059
|
-
let
|
|
4041
|
+
let isStatic = true;
|
|
4060
4042
|
if (name === 'ref') {
|
|
4061
4043
|
hasRef = true;
|
|
4044
|
+
if (context.scopes.vFor > 0) {
|
|
4045
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
4046
|
+
}
|
|
4062
4047
|
}
|
|
4063
4048
|
// skip is on <component>, or is="vue:xxx"
|
|
4064
4049
|
if (name === 'is' &&
|
|
@@ -4067,7 +4052,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4067
4052
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
|
4068
4053
|
continue;
|
|
4069
4054
|
}
|
|
4070
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
4055
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
|
4071
4056
|
}
|
|
4072
4057
|
else {
|
|
4073
4058
|
// directives
|
|
@@ -4088,7 +4073,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4088
4073
|
// skip v-is and :is on <component>
|
|
4089
4074
|
if (name === 'is' ||
|
|
4090
4075
|
(isVBind &&
|
|
4091
|
-
|
|
4076
|
+
isStaticArgOf(arg, 'is') &&
|
|
4092
4077
|
(isComponentTag(tag) ||
|
|
4093
4078
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
|
|
4094
4079
|
continue;
|
|
@@ -4097,6 +4082,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4097
4082
|
if (isVOn && ssr) {
|
|
4098
4083
|
continue;
|
|
4099
4084
|
}
|
|
4085
|
+
if (
|
|
4086
|
+
// #938: elements with dynamic keys should be forced into blocks
|
|
4087
|
+
(isVBind && isStaticArgOf(arg, 'key')) ||
|
|
4088
|
+
// inline before-update hooks need to force block so that it is invoked
|
|
4089
|
+
// before children
|
|
4090
|
+
(isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
|
|
4091
|
+
shouldUseBlock = true;
|
|
4092
|
+
}
|
|
4093
|
+
if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
|
|
4094
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
4095
|
+
}
|
|
4100
4096
|
// special case for v-bind and v-on with no argument
|
|
4101
4097
|
if (!arg && (isVBind || isVOn)) {
|
|
4102
4098
|
hasDynamicKeys = true;
|
|
@@ -4170,14 +4166,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4170
4166
|
else {
|
|
4171
4167
|
// no built-in transform, this is a user custom directive.
|
|
4172
4168
|
runtimeDirectives.push(prop);
|
|
4169
|
+
// custom dirs may use beforeUpdate so they need to force blocks
|
|
4170
|
+
// to ensure before-update gets called before children update
|
|
4171
|
+
if (hasChildren) {
|
|
4172
|
+
shouldUseBlock = true;
|
|
4173
|
+
}
|
|
4173
4174
|
}
|
|
4174
4175
|
}
|
|
4175
|
-
if (prop.type === 6 /* ATTRIBUTE */ &&
|
|
4176
|
-
prop.name === 'ref' &&
|
|
4177
|
-
context.scopes.vFor > 0 &&
|
|
4178
|
-
checkCompatEnabled("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
|
|
4179
|
-
properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
|
|
4180
|
-
}
|
|
4181
4176
|
}
|
|
4182
4177
|
let propsExpression = undefined;
|
|
4183
4178
|
// has v-bind="object" or v-on="object", wrap with mergeProps
|
|
@@ -4214,7 +4209,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4214
4209
|
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
|
4215
4210
|
}
|
|
4216
4211
|
}
|
|
4217
|
-
if (
|
|
4212
|
+
if (!shouldUseBlock &&
|
|
4213
|
+
(patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
|
|
4218
4214
|
(hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
|
|
4219
4215
|
patchFlag |= 512 /* NEED_PATCH */;
|
|
4220
4216
|
}
|
|
@@ -4281,7 +4277,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4281
4277
|
props: propsExpression,
|
|
4282
4278
|
directives: runtimeDirectives,
|
|
4283
4279
|
patchFlag,
|
|
4284
|
-
dynamicPropNames
|
|
4280
|
+
dynamicPropNames,
|
|
4281
|
+
shouldUseBlock
|
|
4285
4282
|
};
|
|
4286
4283
|
}
|
|
4287
4284
|
// Dedupe props in an object literal.
|
|
@@ -4369,7 +4366,7 @@ function stringifyDynamicPropNames(props) {
|
|
|
4369
4366
|
return propsNamesString + `]`;
|
|
4370
4367
|
}
|
|
4371
4368
|
function isComponentTag(tag) {
|
|
4372
|
-
return tag
|
|
4369
|
+
return tag === 'component' || tag === 'Component';
|
|
4373
4370
|
}
|
|
4374
4371
|
|
|
4375
4372
|
const transformSlotOutlet = (node, context) => {
|
|
@@ -4417,7 +4414,7 @@ function processSlotOutlet(node, context) {
|
|
|
4417
4414
|
}
|
|
4418
4415
|
}
|
|
4419
4416
|
else {
|
|
4420
|
-
if (p.name === 'bind' &&
|
|
4417
|
+
if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
|
|
4421
4418
|
if (p.exp)
|
|
4422
4419
|
slotName = p.exp;
|
|
4423
4420
|
}
|
|
@@ -4451,7 +4448,11 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
4451
4448
|
let eventName;
|
|
4452
4449
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
4453
4450
|
if (arg.isStatic) {
|
|
4454
|
-
|
|
4451
|
+
let rawName = arg.content;
|
|
4452
|
+
// TODO deprecate @vnodeXXX usage
|
|
4453
|
+
if (rawName.startsWith('vue:')) {
|
|
4454
|
+
rawName = `vnode-${rawName.slice(4)}`;
|
|
4455
|
+
}
|
|
4455
4456
|
// for all event listeners, auto convert it to camelCase. See issue #2249
|
|
4456
4457
|
eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
|
|
4457
4458
|
}
|
|
@@ -5451,4 +5452,4 @@ function parse(template, options = {}) {
|
|
|
5451
5452
|
return baseParse(template, extend({}, parserOptions, options));
|
|
5452
5453
|
}
|
|
5453
5454
|
|
|
5454
|
-
export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, DOMDirectiveTransforms, DOMNodeTransforms, 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, TRANSITION, TRANSITION_GROUP, UNREF, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildProps, buildSlots, checkCompatEnabled, compile, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createDOMCompilerError, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, generateCodeFrame, getBaseTransformPreset, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp,
|
|
5455
|
+
export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, DOMDirectiveTransforms, DOMNodeTransforms, 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, TRANSITION, TRANSITION_GROUP, UNREF, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildProps, buildSlots, checkCompatEnabled, compile, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createDOMCompilerError, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, generateCodeFrame, 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, parse, parserOptions, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, transformStyle, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|