@vue/compiler-core 3.2.41 → 3.2.42
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.
|
@@ -605,7 +605,10 @@ function injectProp(node, prop, context) {
|
|
|
605
605
|
// if doesn't override user provided keys
|
|
606
606
|
const first = props.arguments[0];
|
|
607
607
|
if (!shared.isString(first) && first.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
|
|
608
|
-
|
|
608
|
+
// #6631
|
|
609
|
+
if (!hasProp(prop, first)) {
|
|
610
|
+
first.properties.unshift(prop);
|
|
611
|
+
}
|
|
609
612
|
}
|
|
610
613
|
else {
|
|
611
614
|
if (props.callee === TO_HANDLERS) {
|
|
@@ -622,14 +625,7 @@ function injectProp(node, prop, context) {
|
|
|
622
625
|
!propsWithInjection && (propsWithInjection = props);
|
|
623
626
|
}
|
|
624
627
|
else if (props.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
|
|
625
|
-
|
|
626
|
-
// check existing key to avoid overriding user provided keys
|
|
627
|
-
if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
|
|
628
|
-
const propKeyName = prop.key.content;
|
|
629
|
-
alreadyExists = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
|
|
630
|
-
p.key.content === propKeyName);
|
|
631
|
-
}
|
|
632
|
-
if (!alreadyExists) {
|
|
628
|
+
if (!hasProp(prop, props)) {
|
|
633
629
|
props.properties.unshift(prop);
|
|
634
630
|
}
|
|
635
631
|
propsWithInjection = props;
|
|
@@ -664,6 +660,16 @@ function injectProp(node, prop, context) {
|
|
|
664
660
|
}
|
|
665
661
|
}
|
|
666
662
|
}
|
|
663
|
+
// check existing key to avoid overriding user provided keys
|
|
664
|
+
function hasProp(prop, props) {
|
|
665
|
+
let result = false;
|
|
666
|
+
if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
|
|
667
|
+
const propKeyName = prop.key.content;
|
|
668
|
+
result = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
|
|
669
|
+
p.key.content === propKeyName);
|
|
670
|
+
}
|
|
671
|
+
return result;
|
|
672
|
+
}
|
|
667
673
|
function toValidAssetId(name, type) {
|
|
668
674
|
// see issue#4422, we need adding identifier on validAssetId if variable `name` has specific character
|
|
669
675
|
return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
|
|
@@ -978,13 +984,18 @@ function parseChildren(context, mode, ancestors) {
|
|
|
978
984
|
const next = nodes[i + 1];
|
|
979
985
|
// Remove if:
|
|
980
986
|
// - the whitespace is the first or last node, or:
|
|
981
|
-
// - (condense mode) the whitespace is
|
|
987
|
+
// - (condense mode) the whitespace is between twos comments, or:
|
|
988
|
+
// - (condense mode) the whitespace is between comment and element, or:
|
|
982
989
|
// - (condense mode) the whitespace is between two elements AND contains newline
|
|
983
990
|
if (!prev ||
|
|
984
991
|
!next ||
|
|
985
992
|
(shouldCondense &&
|
|
986
|
-
(prev.type === 3 /* NodeTypes.COMMENT */
|
|
987
|
-
next.type === 3 /* NodeTypes.COMMENT */ ||
|
|
993
|
+
((prev.type === 3 /* NodeTypes.COMMENT */ &&
|
|
994
|
+
next.type === 3 /* NodeTypes.COMMENT */) ||
|
|
995
|
+
(prev.type === 3 /* NodeTypes.COMMENT */ &&
|
|
996
|
+
next.type === 1 /* NodeTypes.ELEMENT */) ||
|
|
997
|
+
(prev.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
998
|
+
next.type === 3 /* NodeTypes.COMMENT */) ||
|
|
988
999
|
(prev.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
989
1000
|
next.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
990
1001
|
/[\r\n]/.test(node.content))))) {
|
|
@@ -4646,11 +4657,14 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4646
4657
|
// in inline mode there is no setupState object, so we can't use string
|
|
4647
4658
|
// keys to set the ref. Instead, we need to transform it to pass the
|
|
4648
4659
|
// actual ref instead.
|
|
4649
|
-
if (value &&
|
|
4650
|
-
context.
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4660
|
+
if (value && context.inline) {
|
|
4661
|
+
const binding = context.bindingMetadata[value.content];
|
|
4662
|
+
if (binding === "setup-let" /* BindingTypes.SETUP_LET */ ||
|
|
4663
|
+
binding === "setup-ref" /* BindingTypes.SETUP_REF */ ||
|
|
4664
|
+
binding === "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */) {
|
|
4665
|
+
isStatic = false;
|
|
4666
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_key', true), createSimpleExpression(value.content, true, value.loc)));
|
|
4667
|
+
}
|
|
4654
4668
|
}
|
|
4655
4669
|
}
|
|
4656
4670
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -5074,7 +5088,7 @@ function processSlotOutlet(node, context) {
|
|
|
5074
5088
|
};
|
|
5075
5089
|
}
|
|
5076
5090
|
|
|
5077
|
-
const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s
|
|
5091
|
+
const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
5078
5092
|
const transformOn = (dir, node, context, augmentor) => {
|
|
5079
5093
|
const { loc, modifiers, arg } = dir;
|
|
5080
5094
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -5088,10 +5102,10 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
5088
5102
|
if (rawName.startsWith('vue:')) {
|
|
5089
5103
|
rawName = `vnode-${rawName.slice(4)}`;
|
|
5090
5104
|
}
|
|
5091
|
-
const eventString = node.tagType
|
|
5105
|
+
const eventString = node.tagType !== 0 /* ElementTypes.ELEMENT */ ||
|
|
5092
5106
|
rawName.startsWith('vnode') ||
|
|
5093
5107
|
!/[A-Z]/.test(rawName)
|
|
5094
|
-
? // for
|
|
5108
|
+
? // for non-element and vnode lifecycle event listeners, auto convert
|
|
5095
5109
|
// it to camelCase. See issue #2249
|
|
5096
5110
|
shared.toHandlerKey(shared.camelize(rawName))
|
|
5097
5111
|
: // preserve case for plain element listeners that have uppercase
|
|
@@ -5817,6 +5831,7 @@ exports.processIf = processIf;
|
|
|
5817
5831
|
exports.processSlotOutlet = processSlotOutlet;
|
|
5818
5832
|
exports.registerRuntimeHelpers = registerRuntimeHelpers;
|
|
5819
5833
|
exports.resolveComponentType = resolveComponentType;
|
|
5834
|
+
exports.stringifyExpression = stringifyExpression;
|
|
5820
5835
|
exports.toValidAssetId = toValidAssetId;
|
|
5821
5836
|
exports.trackSlotScopes = trackSlotScopes;
|
|
5822
5837
|
exports.trackVForSlotScopes = trackVForSlotScopes;
|
|
@@ -604,7 +604,10 @@ function injectProp(node, prop, context) {
|
|
|
604
604
|
// if doesn't override user provided keys
|
|
605
605
|
const first = props.arguments[0];
|
|
606
606
|
if (!shared.isString(first) && first.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
|
|
607
|
-
|
|
607
|
+
// #6631
|
|
608
|
+
if (!hasProp(prop, first)) {
|
|
609
|
+
first.properties.unshift(prop);
|
|
610
|
+
}
|
|
608
611
|
}
|
|
609
612
|
else {
|
|
610
613
|
if (props.callee === TO_HANDLERS) {
|
|
@@ -621,14 +624,7 @@ function injectProp(node, prop, context) {
|
|
|
621
624
|
!propsWithInjection && (propsWithInjection = props);
|
|
622
625
|
}
|
|
623
626
|
else if (props.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
|
|
624
|
-
|
|
625
|
-
// check existing key to avoid overriding user provided keys
|
|
626
|
-
if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
|
|
627
|
-
const propKeyName = prop.key.content;
|
|
628
|
-
alreadyExists = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
|
|
629
|
-
p.key.content === propKeyName);
|
|
630
|
-
}
|
|
631
|
-
if (!alreadyExists) {
|
|
627
|
+
if (!hasProp(prop, props)) {
|
|
632
628
|
props.properties.unshift(prop);
|
|
633
629
|
}
|
|
634
630
|
propsWithInjection = props;
|
|
@@ -663,6 +659,16 @@ function injectProp(node, prop, context) {
|
|
|
663
659
|
}
|
|
664
660
|
}
|
|
665
661
|
}
|
|
662
|
+
// check existing key to avoid overriding user provided keys
|
|
663
|
+
function hasProp(prop, props) {
|
|
664
|
+
let result = false;
|
|
665
|
+
if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
|
|
666
|
+
const propKeyName = prop.key.content;
|
|
667
|
+
result = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
|
|
668
|
+
p.key.content === propKeyName);
|
|
669
|
+
}
|
|
670
|
+
return result;
|
|
671
|
+
}
|
|
666
672
|
function toValidAssetId(name, type) {
|
|
667
673
|
// see issue#4422, we need adding identifier on validAssetId if variable `name` has specific character
|
|
668
674
|
return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
|
|
@@ -973,13 +979,18 @@ function parseChildren(context, mode, ancestors) {
|
|
|
973
979
|
const next = nodes[i + 1];
|
|
974
980
|
// Remove if:
|
|
975
981
|
// - the whitespace is the first or last node, or:
|
|
976
|
-
// - (condense mode) the whitespace is
|
|
982
|
+
// - (condense mode) the whitespace is between twos comments, or:
|
|
983
|
+
// - (condense mode) the whitespace is between comment and element, or:
|
|
977
984
|
// - (condense mode) the whitespace is between two elements AND contains newline
|
|
978
985
|
if (!prev ||
|
|
979
986
|
!next ||
|
|
980
987
|
(shouldCondense &&
|
|
981
|
-
(prev.type === 3 /* NodeTypes.COMMENT */
|
|
982
|
-
next.type === 3 /* NodeTypes.COMMENT */ ||
|
|
988
|
+
((prev.type === 3 /* NodeTypes.COMMENT */ &&
|
|
989
|
+
next.type === 3 /* NodeTypes.COMMENT */) ||
|
|
990
|
+
(prev.type === 3 /* NodeTypes.COMMENT */ &&
|
|
991
|
+
next.type === 1 /* NodeTypes.ELEMENT */) ||
|
|
992
|
+
(prev.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
993
|
+
next.type === 3 /* NodeTypes.COMMENT */) ||
|
|
983
994
|
(prev.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
984
995
|
next.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
985
996
|
/[\r\n]/.test(node.content))))) {
|
|
@@ -3578,6 +3589,10 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3578
3589
|
let i = siblings.indexOf(node);
|
|
3579
3590
|
while (i-- >= -1) {
|
|
3580
3591
|
const sibling = siblings[i];
|
|
3592
|
+
if (sibling && sibling.type === 3 /* NodeTypes.COMMENT */) {
|
|
3593
|
+
context.removeNode(sibling);
|
|
3594
|
+
continue;
|
|
3595
|
+
}
|
|
3581
3596
|
if (sibling &&
|
|
3582
3597
|
sibling.type === 2 /* NodeTypes.TEXT */ &&
|
|
3583
3598
|
!sibling.content.trim().length) {
|
|
@@ -4543,11 +4558,14 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4543
4558
|
// in inline mode there is no setupState object, so we can't use string
|
|
4544
4559
|
// keys to set the ref. Instead, we need to transform it to pass the
|
|
4545
4560
|
// actual ref instead.
|
|
4546
|
-
if (value &&
|
|
4547
|
-
context.
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4561
|
+
if (value && context.inline) {
|
|
4562
|
+
const binding = context.bindingMetadata[value.content];
|
|
4563
|
+
if (binding === "setup-let" /* BindingTypes.SETUP_LET */ ||
|
|
4564
|
+
binding === "setup-ref" /* BindingTypes.SETUP_REF */ ||
|
|
4565
|
+
binding === "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */) {
|
|
4566
|
+
isStatic = false;
|
|
4567
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_key', true), createSimpleExpression(value.content, true, value.loc)));
|
|
4568
|
+
}
|
|
4551
4569
|
}
|
|
4552
4570
|
}
|
|
4553
4571
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -4945,7 +4963,7 @@ function processSlotOutlet(node, context) {
|
|
|
4945
4963
|
};
|
|
4946
4964
|
}
|
|
4947
4965
|
|
|
4948
|
-
const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s
|
|
4966
|
+
const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
4949
4967
|
const transformOn = (dir, node, context, augmentor) => {
|
|
4950
4968
|
const { loc, modifiers, arg } = dir;
|
|
4951
4969
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -4959,10 +4977,10 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
4959
4977
|
if (rawName.startsWith('vue:')) {
|
|
4960
4978
|
rawName = `vnode-${rawName.slice(4)}`;
|
|
4961
4979
|
}
|
|
4962
|
-
const eventString = node.tagType
|
|
4980
|
+
const eventString = node.tagType !== 0 /* ElementTypes.ELEMENT */ ||
|
|
4963
4981
|
rawName.startsWith('vnode') ||
|
|
4964
4982
|
!/[A-Z]/.test(rawName)
|
|
4965
|
-
? // for
|
|
4983
|
+
? // for non-element and vnode lifecycle event listeners, auto convert
|
|
4966
4984
|
// it to camelCase. See issue #2249
|
|
4967
4985
|
shared.toHandlerKey(shared.camelize(rawName))
|
|
4968
4986
|
: // preserve case for plain element listeners that have uppercase
|
|
@@ -5687,6 +5705,7 @@ exports.processIf = processIf;
|
|
|
5687
5705
|
exports.processSlotOutlet = processSlotOutlet;
|
|
5688
5706
|
exports.registerRuntimeHelpers = registerRuntimeHelpers;
|
|
5689
5707
|
exports.resolveComponentType = resolveComponentType;
|
|
5708
|
+
exports.stringifyExpression = stringifyExpression;
|
|
5690
5709
|
exports.toValidAssetId = toValidAssetId;
|
|
5691
5710
|
exports.trackSlotScopes = trackSlotScopes;
|
|
5692
5711
|
exports.trackVForSlotScopes = trackVForSlotScopes;
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -982,6 +982,8 @@ export declare interface SourceLocation {
|
|
|
982
982
|
|
|
983
983
|
export declare type SSRCodegenNode = BlockStatement | TemplateLiteral | IfStatement | AssignmentExpression | ReturnStatement | SequenceExpression;
|
|
984
984
|
|
|
985
|
+
export declare function stringifyExpression(exp: ExpressionNode | string): string;
|
|
986
|
+
|
|
985
987
|
export declare type StructuralDirectiveTransform = (node: ElementNode, dir: DirectiveNode, context: TransformContext) => void | (() => void);
|
|
986
988
|
|
|
987
989
|
export declare const SUSPENSE: unique symbol;
|
|
@@ -587,7 +587,10 @@ function injectProp(node, prop, context) {
|
|
|
587
587
|
// if doesn't override user provided keys
|
|
588
588
|
const first = props.arguments[0];
|
|
589
589
|
if (!isString(first) && first.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
|
|
590
|
-
|
|
590
|
+
// #6631
|
|
591
|
+
if (!hasProp(prop, first)) {
|
|
592
|
+
first.properties.unshift(prop);
|
|
593
|
+
}
|
|
591
594
|
}
|
|
592
595
|
else {
|
|
593
596
|
if (props.callee === TO_HANDLERS) {
|
|
@@ -604,14 +607,7 @@ function injectProp(node, prop, context) {
|
|
|
604
607
|
!propsWithInjection && (propsWithInjection = props);
|
|
605
608
|
}
|
|
606
609
|
else if (props.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
|
|
607
|
-
|
|
608
|
-
// check existing key to avoid overriding user provided keys
|
|
609
|
-
if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
|
|
610
|
-
const propKeyName = prop.key.content;
|
|
611
|
-
alreadyExists = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
|
|
612
|
-
p.key.content === propKeyName);
|
|
613
|
-
}
|
|
614
|
-
if (!alreadyExists) {
|
|
610
|
+
if (!hasProp(prop, props)) {
|
|
615
611
|
props.properties.unshift(prop);
|
|
616
612
|
}
|
|
617
613
|
propsWithInjection = props;
|
|
@@ -646,6 +642,16 @@ function injectProp(node, prop, context) {
|
|
|
646
642
|
}
|
|
647
643
|
}
|
|
648
644
|
}
|
|
645
|
+
// check existing key to avoid overriding user provided keys
|
|
646
|
+
function hasProp(prop, props) {
|
|
647
|
+
let result = false;
|
|
648
|
+
if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
|
|
649
|
+
const propKeyName = prop.key.content;
|
|
650
|
+
result = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
|
|
651
|
+
p.key.content === propKeyName);
|
|
652
|
+
}
|
|
653
|
+
return result;
|
|
654
|
+
}
|
|
649
655
|
function toValidAssetId(name, type) {
|
|
650
656
|
// see issue#4422, we need adding identifier on validAssetId if variable `name` has specific character
|
|
651
657
|
return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
|
|
@@ -962,13 +968,18 @@ function parseChildren(context, mode, ancestors) {
|
|
|
962
968
|
const next = nodes[i + 1];
|
|
963
969
|
// Remove if:
|
|
964
970
|
// - the whitespace is the first or last node, or:
|
|
965
|
-
// - (condense mode) the whitespace is
|
|
971
|
+
// - (condense mode) the whitespace is between twos comments, or:
|
|
972
|
+
// - (condense mode) the whitespace is between comment and element, or:
|
|
966
973
|
// - (condense mode) the whitespace is between two elements AND contains newline
|
|
967
974
|
if (!prev ||
|
|
968
975
|
!next ||
|
|
969
976
|
(shouldCondense &&
|
|
970
|
-
(prev.type === 3 /* NodeTypes.COMMENT */
|
|
971
|
-
next.type === 3 /* NodeTypes.COMMENT */ ||
|
|
977
|
+
((prev.type === 3 /* NodeTypes.COMMENT */ &&
|
|
978
|
+
next.type === 3 /* NodeTypes.COMMENT */) ||
|
|
979
|
+
(prev.type === 3 /* NodeTypes.COMMENT */ &&
|
|
980
|
+
next.type === 1 /* NodeTypes.ELEMENT */) ||
|
|
981
|
+
(prev.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
982
|
+
next.type === 3 /* NodeTypes.COMMENT */) ||
|
|
972
983
|
(prev.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
973
984
|
next.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
974
985
|
/[\r\n]/.test(node.content))))) {
|
|
@@ -2935,6 +2946,19 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
2935
2946
|
return node;
|
|
2936
2947
|
}
|
|
2937
2948
|
}
|
|
2949
|
+
function stringifyExpression(exp) {
|
|
2950
|
+
if (isString(exp)) {
|
|
2951
|
+
return exp;
|
|
2952
|
+
}
|
|
2953
|
+
else if (exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
|
|
2954
|
+
return exp.content;
|
|
2955
|
+
}
|
|
2956
|
+
else {
|
|
2957
|
+
return exp.children
|
|
2958
|
+
.map(stringifyExpression)
|
|
2959
|
+
.join('');
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2938
2962
|
|
|
2939
2963
|
const transformIf = createStructuralDirectiveTransform(/^(if|else|else-if)$/, (node, dir, context) => {
|
|
2940
2964
|
return processIf(node, dir, context, (ifNode, branch, isRoot) => {
|
|
@@ -2994,9 +3018,9 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
2994
3018
|
let i = siblings.indexOf(node);
|
|
2995
3019
|
while (i-- >= -1) {
|
|
2996
3020
|
const sibling = siblings[i];
|
|
2997
|
-
if (
|
|
3021
|
+
if (sibling && sibling.type === 3 /* NodeTypes.COMMENT */) {
|
|
2998
3022
|
context.removeNode(sibling);
|
|
2999
|
-
comments.unshift(sibling);
|
|
3023
|
+
(process.env.NODE_ENV !== 'production') && comments.unshift(sibling);
|
|
3000
3024
|
continue;
|
|
3001
3025
|
}
|
|
3002
3026
|
if (sibling &&
|
|
@@ -4321,7 +4345,7 @@ function processSlotOutlet(node, context) {
|
|
|
4321
4345
|
};
|
|
4322
4346
|
}
|
|
4323
4347
|
|
|
4324
|
-
const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s
|
|
4348
|
+
const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
4325
4349
|
const transformOn = (dir, node, context, augmentor) => {
|
|
4326
4350
|
const { loc, modifiers, arg } = dir;
|
|
4327
4351
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -4335,10 +4359,10 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
4335
4359
|
if (rawName.startsWith('vue:')) {
|
|
4336
4360
|
rawName = `vnode-${rawName.slice(4)}`;
|
|
4337
4361
|
}
|
|
4338
|
-
const eventString = node.tagType
|
|
4362
|
+
const eventString = node.tagType !== 0 /* ElementTypes.ELEMENT */ ||
|
|
4339
4363
|
rawName.startsWith('vnode') ||
|
|
4340
4364
|
!/[A-Z]/.test(rawName)
|
|
4341
|
-
? // for
|
|
4365
|
+
? // for non-element and vnode lifecycle event listeners, auto convert
|
|
4342
4366
|
// it to camelCase. See issue #2249
|
|
4343
4367
|
toHandlerKey(camelize$1(rawName))
|
|
4344
4368
|
: // preserve case for plain element listeners that have uppercase
|
|
@@ -4883,4 +4907,4 @@ function baseCompile(template, options = {}) {
|
|
|
4883
4907
|
|
|
4884
4908
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
4885
4909
|
|
|
4886
|
-
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, buildDirectiveArgs, 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, getConstantType, 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 };
|
|
4910
|
+
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, buildDirectiveArgs, 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, getConstantType, 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, stringifyExpression, 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.42",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.2.
|
|
35
|
+
"@vue/shared": "3.2.42",
|
|
36
36
|
"@babel/parser": "^7.16.4",
|
|
37
37
|
"estree-walker": "^2.0.2",
|
|
38
38
|
"source-map": "^0.6.1"
|