@vue/compiler-core 3.6.0-rc.5 → 3.6.0-rc.6
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-core.cjs.js +249 -223
- package/dist/compiler-core.cjs.prod.js +235 -216
- package/dist/compiler-core.d.ts +244 -276
- package/dist/compiler-core.esm-bundler.js +159 -148
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-core v3.6.0-rc.6
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -547,13 +547,14 @@ var Tokenizer = class {
|
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
stateInterpolationOpen(c) {
|
|
550
|
-
if (c === this.delimiterOpen[this.delimiterIndex])
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
550
|
+
if (c === this.delimiterOpen[this.delimiterIndex]) {
|
|
551
|
+
if (this.delimiterIndex === this.delimiterOpen.length - 1) {
|
|
552
|
+
const start = this.index + 1 - this.delimiterOpen.length;
|
|
553
|
+
if (start > this.sectionStart) this.cbs.ontext(this.sectionStart, start);
|
|
554
|
+
this.state = 3;
|
|
555
|
+
this.sectionStart = start;
|
|
556
|
+
} else this.delimiterIndex++;
|
|
557
|
+
} else if (this.inRCDATA) {
|
|
557
558
|
this.state = 32;
|
|
558
559
|
this.stateInRCDATA(c);
|
|
559
560
|
} else {
|
|
@@ -569,13 +570,14 @@ var Tokenizer = class {
|
|
|
569
570
|
}
|
|
570
571
|
}
|
|
571
572
|
stateInterpolationClose(c) {
|
|
572
|
-
if (c === this.delimiterClose[this.delimiterIndex])
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
573
|
+
if (c === this.delimiterClose[this.delimiterIndex]) {
|
|
574
|
+
if (this.delimiterIndex === this.delimiterClose.length - 1) {
|
|
575
|
+
this.cbs.oninterpolation(this.sectionStart, this.index + 1);
|
|
576
|
+
if (this.inRCDATA) this.state = 32;
|
|
577
|
+
else this.state = 1;
|
|
578
|
+
this.sectionStart = this.index + 1;
|
|
579
|
+
} else this.delimiterIndex++;
|
|
580
|
+
} else {
|
|
579
581
|
this.state = 3;
|
|
580
582
|
this.stateInterpolation(c);
|
|
581
583
|
}
|
|
@@ -690,9 +692,10 @@ var Tokenizer = class {
|
|
|
690
692
|
this.sectionStart = this.index;
|
|
691
693
|
if (this.mode === 0) this.state = 6;
|
|
692
694
|
else if (this.inSFCRoot) this.state = 34;
|
|
693
|
-
else if (!this.inXML)
|
|
694
|
-
|
|
695
|
-
|
|
695
|
+
else if (!this.inXML) {
|
|
696
|
+
if (c === 116) this.state = 30;
|
|
697
|
+
else this.state = c === 115 ? 29 : 6;
|
|
698
|
+
} else this.state = 6;
|
|
696
699
|
} else if (c === 47) this.state = 8;
|
|
697
700
|
else {
|
|
698
701
|
this.state = 1;
|
|
@@ -1045,9 +1048,7 @@ var Tokenizer = class {
|
|
|
1045
1048
|
case 24:
|
|
1046
1049
|
this.stateInProcessingInstruction(c);
|
|
1047
1050
|
break;
|
|
1048
|
-
case 33:
|
|
1049
|
-
this.stateInEntity();
|
|
1050
|
-
break;
|
|
1051
|
+
case 33: this.stateInEntity();
|
|
1051
1052
|
}
|
|
1052
1053
|
this.index++;
|
|
1053
1054
|
}
|
|
@@ -1076,9 +1077,10 @@ var Tokenizer = class {
|
|
|
1076
1077
|
handleTrailingData() {
|
|
1077
1078
|
const endIndex = this.buffer.length;
|
|
1078
1079
|
if (this.sectionStart >= endIndex) return;
|
|
1079
|
-
if (this.state === 28)
|
|
1080
|
-
|
|
1081
|
-
|
|
1080
|
+
if (this.state === 28) {
|
|
1081
|
+
if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex);
|
|
1082
|
+
else this.cbs.oncomment(this.sectionStart, endIndex);
|
|
1083
|
+
} else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) {} else this.cbs.ontext(this.sectionStart, endIndex);
|
|
1082
1084
|
}
|
|
1083
1085
|
emitCodePoint(cp, consumed) {}
|
|
1084
1086
|
};
|
|
@@ -1411,9 +1413,7 @@ function extractIdentifiers(param, nodes = []) {
|
|
|
1411
1413
|
case "RestElement":
|
|
1412
1414
|
extractIdentifiers(param.argument, nodes);
|
|
1413
1415
|
break;
|
|
1414
|
-
case "AssignmentPattern":
|
|
1415
|
-
extractIdentifiers(param.left, nodes);
|
|
1416
|
-
break;
|
|
1416
|
+
case "AssignmentPattern": extractIdentifiers(param.left, nodes);
|
|
1417
1417
|
}
|
|
1418
1418
|
return nodes;
|
|
1419
1419
|
}
|
|
@@ -1549,12 +1549,10 @@ const isMemberExpressionBrowser = (exp) => {
|
|
|
1549
1549
|
if (!--currentOpenParensCount) state = stateStack.pop();
|
|
1550
1550
|
}
|
|
1551
1551
|
break;
|
|
1552
|
-
case 3:
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
}
|
|
1557
|
-
break;
|
|
1552
|
+
case 3: if (char === currentStringType) {
|
|
1553
|
+
state = stateStack.pop();
|
|
1554
|
+
currentStringType = null;
|
|
1555
|
+
}
|
|
1558
1556
|
}
|
|
1559
1557
|
}
|
|
1560
1558
|
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
@@ -1625,7 +1623,7 @@ function isTemplateNode(node) {
|
|
|
1625
1623
|
function isSlotOutlet(node) {
|
|
1626
1624
|
return node.type === 1 && node.tagType === 2;
|
|
1627
1625
|
}
|
|
1628
|
-
const propsHelperSet = new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
1626
|
+
const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
1629
1627
|
function getUnnormalizedProps(props, callPath = []) {
|
|
1630
1628
|
if (props && !isString(props) && props.type === 14) {
|
|
1631
1629
|
const callee = props.callee;
|
|
@@ -1668,9 +1666,10 @@ function injectProp(node, prop, context) {
|
|
|
1668
1666
|
propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [createObjectExpression([prop]), props]);
|
|
1669
1667
|
if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) parentCall = callPath[callPath.length - 2];
|
|
1670
1668
|
}
|
|
1671
|
-
if (node.type === 13)
|
|
1672
|
-
|
|
1673
|
-
|
|
1669
|
+
if (node.type === 13) {
|
|
1670
|
+
if (parentCall) parentCall.arguments[0] = propsWithInjection;
|
|
1671
|
+
else node.props = propsWithInjection;
|
|
1672
|
+
} else if (parentCall) parentCall.arguments[0] = propsWithInjection;
|
|
1674
1673
|
else node.arguments[2] = propsWithInjection;
|
|
1675
1674
|
}
|
|
1676
1675
|
function injectSlotKey(node, prop) {
|
|
@@ -1987,10 +1986,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
1987
1986
|
case 18:
|
|
1988
1987
|
case 19:
|
|
1989
1988
|
case 20:
|
|
1990
|
-
case 21:
|
|
1991
|
-
emitError(9, end);
|
|
1992
|
-
break;
|
|
1993
|
-
default: break;
|
|
1989
|
+
case 21: emitError(9, end);
|
|
1994
1990
|
}
|
|
1995
1991
|
for (let index = 0; index < stack.length; index++) {
|
|
1996
1992
|
onCloseTag(stack[index], end - 1);
|
|
@@ -2140,7 +2136,7 @@ function backTrack(index, c) {
|
|
|
2140
2136
|
while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
|
|
2141
2137
|
return i;
|
|
2142
2138
|
}
|
|
2143
|
-
const specialTemplateDir = new Set([
|
|
2139
|
+
const specialTemplateDir = /* @__PURE__ */ new Set([
|
|
2144
2140
|
"if",
|
|
2145
2141
|
"else",
|
|
2146
2142
|
"else-if",
|
|
@@ -2176,16 +2172,18 @@ function condenseWhitespace(nodes) {
|
|
|
2176
2172
|
let removedWhitespace = false;
|
|
2177
2173
|
for (let i = 0; i < nodes.length; i++) {
|
|
2178
2174
|
const node = nodes[i];
|
|
2179
|
-
if (node.type === 2)
|
|
2180
|
-
if (
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2175
|
+
if (node.type === 2) {
|
|
2176
|
+
if (!inPre) {
|
|
2177
|
+
if (isAllWhitespace(node.content)) {
|
|
2178
|
+
const prev = nodes[i - 1] && nodes[i - 1].type;
|
|
2179
|
+
const next = nodes[i + 1] && nodes[i + 1].type;
|
|
2180
|
+
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
2181
|
+
removedWhitespace = true;
|
|
2182
|
+
nodes[i] = null;
|
|
2183
|
+
} else node.content = " ";
|
|
2184
|
+
} else if (shouldCondense) node.content = condense(node.content);
|
|
2185
|
+
} else node.content = node.content.replace(windowsNewlineRE, "\n");
|
|
2186
|
+
}
|
|
2189
2187
|
}
|
|
2190
2188
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
2191
2189
|
}
|
|
@@ -2450,7 +2448,7 @@ function getConstantType(node, context) {
|
|
|
2450
2448
|
return 0;
|
|
2451
2449
|
}
|
|
2452
2450
|
}
|
|
2453
|
-
const allowHoistedHelperSet = new Set([
|
|
2451
|
+
const allowHoistedHelperSet = /* @__PURE__ */ new Set([
|
|
2454
2452
|
NORMALIZE_CLASS,
|
|
2455
2453
|
NORMALIZE_STYLE,
|
|
2456
2454
|
NORMALIZE_PROPS,
|
|
@@ -2611,7 +2609,7 @@ function transform(root, options) {
|
|
|
2611
2609
|
traverseNode(root, context);
|
|
2612
2610
|
if (options.hoistStatic) cacheStatic(root, context);
|
|
2613
2611
|
if (!options.ssr) createRootCodegen(root, context);
|
|
2614
|
-
root.helpers = new Set([...context.helpers.keys()]);
|
|
2612
|
+
root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
|
|
2615
2613
|
root.components = [...context.components];
|
|
2616
2614
|
root.directives = [...context.directives];
|
|
2617
2615
|
root.imports = context.imports;
|
|
@@ -2658,8 +2656,10 @@ function traverseNode(node, context) {
|
|
|
2658
2656
|
const exitFns = [];
|
|
2659
2657
|
for (let i = 0; i < nodeTransforms.length; i++) {
|
|
2660
2658
|
const onExit = nodeTransforms[i](node, context);
|
|
2661
|
-
if (onExit)
|
|
2662
|
-
|
|
2659
|
+
if (onExit) {
|
|
2660
|
+
if (isArray(onExit)) exitFns.push(...onExit);
|
|
2661
|
+
else exitFns.push(onExit);
|
|
2662
|
+
}
|
|
2663
2663
|
if (!context.currentNode) return;
|
|
2664
2664
|
else node = context.currentNode;
|
|
2665
2665
|
}
|
|
@@ -2676,9 +2676,7 @@ function traverseNode(node, context) {
|
|
|
2676
2676
|
case 10:
|
|
2677
2677
|
case 11:
|
|
2678
2678
|
case 1:
|
|
2679
|
-
case 0:
|
|
2680
|
-
traverseChildren(node, context);
|
|
2681
|
-
break;
|
|
2679
|
+
case 0: traverseChildren(node, context);
|
|
2682
2680
|
}
|
|
2683
2681
|
context.currentNode = node;
|
|
2684
2682
|
let i = exitFns.length;
|
|
@@ -2884,10 +2882,12 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
2884
2882
|
if (isString(node)) push(node, -3);
|
|
2885
2883
|
else if (isArray(node)) genNodeListAsArray(node, context);
|
|
2886
2884
|
else genNode(node, context);
|
|
2887
|
-
if (i < nodes.length - 1)
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2885
|
+
if (i < nodes.length - 1) {
|
|
2886
|
+
if (multilines) {
|
|
2887
|
+
comma && push(",");
|
|
2888
|
+
newline();
|
|
2889
|
+
} else comma && push(", ");
|
|
2890
|
+
}
|
|
2891
2891
|
}
|
|
2892
2892
|
}
|
|
2893
2893
|
function genNode(node, context) {
|
|
@@ -3000,9 +3000,12 @@ function genVNodeCall(node, context) {
|
|
|
3000
3000
|
const { push, helper, pure } = context;
|
|
3001
3001
|
const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking, isComponent } = node;
|
|
3002
3002
|
let patchFlagString;
|
|
3003
|
-
if (patchFlag)
|
|
3004
|
-
|
|
3005
|
-
|
|
3003
|
+
if (patchFlag) {
|
|
3004
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3005
|
+
if (patchFlag < 0) patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
|
|
3006
|
+
else patchFlagString = patchFlag + ` /* ${Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `)} */`;
|
|
3007
|
+
} else patchFlagString = String(patchFlag);
|
|
3008
|
+
}
|
|
3006
3009
|
if (directives) push(helper(WITH_DIRECTIVES) + `(`);
|
|
3007
3010
|
if (isBlock) push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
|
|
3008
3011
|
if (pure) push(PURE_ANNOTATION);
|
|
@@ -3164,7 +3167,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
|
|
|
3164
3167
|
}
|
|
3165
3168
|
//#endregion
|
|
3166
3169
|
//#region packages/compiler-core/src/transforms/transformExpression.ts
|
|
3167
|
-
const isLiteralWhitelisted =
|
|
3170
|
+
const isLiteralWhitelisted = /*@__PURE__*/ makeMap("true,false,null,this");
|
|
3168
3171
|
const transformExpression = (node, context) => {
|
|
3169
3172
|
if (node.type === 5) node.content = processExpression(node.content, context);
|
|
3170
3173
|
else if (node.type === 1) {
|
|
@@ -3277,16 +3280,17 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
3277
3280
|
const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2));
|
|
3278
3281
|
const { children } = branch;
|
|
3279
3282
|
const firstChild = children[0];
|
|
3280
|
-
if (children.length !== 1 || firstChild.type !== 1)
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3283
|
+
if (children.length !== 1 || firstChild.type !== 1) {
|
|
3284
|
+
if (children.length === 1 && firstChild.type === 11) {
|
|
3285
|
+
const vnodeCall = firstChild.codegenNode;
|
|
3286
|
+
injectProp(vnodeCall, keyProperty, context);
|
|
3287
|
+
return vnodeCall;
|
|
3288
|
+
} else {
|
|
3289
|
+
let patchFlag = 64;
|
|
3290
|
+
if (!!(process.env.NODE_ENV !== "production") && !branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
|
|
3291
|
+
return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
|
|
3292
|
+
}
|
|
3284
3293
|
} else {
|
|
3285
|
-
let patchFlag = 64;
|
|
3286
|
-
if (!!(process.env.NODE_ENV !== "production") && !branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
|
|
3287
|
-
return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
|
|
3288
|
-
}
|
|
3289
|
-
else {
|
|
3290
3294
|
const ret = firstChild.codegenNode;
|
|
3291
3295
|
const vnodeCall = getMemoedVNodeCall(ret);
|
|
3292
3296
|
if (vnodeCall.type === 13) convertToBlock(vnodeCall, context);
|
|
@@ -3307,9 +3311,10 @@ function isSameKey(a, b) {
|
|
|
3307
3311
|
return true;
|
|
3308
3312
|
}
|
|
3309
3313
|
function getParentCondition(node) {
|
|
3310
|
-
while (true) if (node.type === 19)
|
|
3311
|
-
|
|
3312
|
-
|
|
3314
|
+
while (true) if (node.type === 19) {
|
|
3315
|
+
if (node.alternate.type === 19) node = node.alternate;
|
|
3316
|
+
else return node;
|
|
3317
|
+
} else if (node.type === 20) node = node.value;
|
|
3313
3318
|
}
|
|
3314
3319
|
//#endregion
|
|
3315
3320
|
//#region packages/compiler-core/src/transforms/vFor.ts
|
|
@@ -3348,10 +3353,12 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
3348
3353
|
childBlock = children[0].codegenNode;
|
|
3349
3354
|
if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
|
|
3350
3355
|
const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
|
|
3351
|
-
if (childBlock.isBlock !== shouldUseBlock)
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3356
|
+
if (childBlock.isBlock !== shouldUseBlock) {
|
|
3357
|
+
if (childBlock.isBlock) {
|
|
3358
|
+
removeHelper(OPEN_BLOCK);
|
|
3359
|
+
removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
3360
|
+
} else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
3361
|
+
}
|
|
3355
3362
|
childBlock.isBlock = shouldUseBlock;
|
|
3356
3363
|
if (childBlock.isBlock) {
|
|
3357
3364
|
helper(OPEN_BLOCK);
|
|
@@ -3555,8 +3562,10 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3555
3562
|
return createObjectProperty(`default`, fn);
|
|
3556
3563
|
};
|
|
3557
3564
|
if (!hasTemplateSlots) slotsProperties.push(buildDefaultSlotProperty(void 0, children));
|
|
3558
|
-
else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText))
|
|
3559
|
-
|
|
3565
|
+
else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText)) {
|
|
3566
|
+
if (hasNamedDefaultSlot) context.onError(createCompilerError(39, implicitDefaultChildren[0].loc));
|
|
3567
|
+
else slotsProperties.push(buildDefaultSlotProperty(void 0, implicitDefaultChildren));
|
|
3568
|
+
}
|
|
3560
3569
|
}
|
|
3561
3570
|
const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
|
|
3562
3571
|
let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`, createSimpleExpression(slotFlag + (!!(process.env.NODE_ENV !== "production") ? ` /* ${slotFlagsText[slotFlag]} */` : ``), false))), loc);
|
|
@@ -3582,10 +3591,7 @@ function hasForwardedSlots(children) {
|
|
|
3582
3591
|
if (hasForwardedSlots(child.branches)) return true;
|
|
3583
3592
|
break;
|
|
3584
3593
|
case 10:
|
|
3585
|
-
case 11:
|
|
3586
|
-
if (hasForwardedSlots(child.children)) return true;
|
|
3587
|
-
break;
|
|
3588
|
-
default: break;
|
|
3594
|
+
case 11: if (hasForwardedSlots(child.children)) return true;
|
|
3589
3595
|
}
|
|
3590
3596
|
}
|
|
3591
3597
|
return false;
|
|
@@ -3746,31 +3752,32 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3746
3752
|
if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
|
|
3747
3753
|
if (!arg && (isVBind || isVOn)) {
|
|
3748
3754
|
hasDynamicKeys = true;
|
|
3749
|
-
if (exp)
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
if (
|
|
3753
|
-
if (
|
|
3754
|
-
if (
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3755
|
+
if (exp) {
|
|
3756
|
+
if (isVBind) {
|
|
3757
|
+
pushMergeArg();
|
|
3758
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3759
|
+
if (mergeArgs.some((arg) => {
|
|
3760
|
+
if (arg.type === 15) return arg.properties.some(({ key }) => {
|
|
3761
|
+
if (key.type !== 4 || !key.isStatic) return true;
|
|
3762
|
+
return key.content !== "class" && key.content !== "style" && !isOn(key.content);
|
|
3763
|
+
});
|
|
3764
|
+
else return true;
|
|
3765
|
+
})) checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context, loc);
|
|
3766
|
+
}
|
|
3767
|
+
if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context)) {
|
|
3768
|
+
mergeArgs.unshift(exp);
|
|
3769
|
+
continue;
|
|
3770
|
+
}
|
|
3771
|
+
pushRefVForMarker();
|
|
3772
|
+
pushMergeArg();
|
|
3773
|
+
mergeArgs.push(exp);
|
|
3774
|
+
} else pushMergeArg({
|
|
3775
|
+
type: 14,
|
|
3776
|
+
loc,
|
|
3777
|
+
callee: context.helper(TO_HANDLERS),
|
|
3778
|
+
arguments: isComponent ? [exp] : [exp, `true`]
|
|
3779
|
+
});
|
|
3780
|
+
} else context.onError(createCompilerError(isVBind ? 34 : 35, loc));
|
|
3774
3781
|
continue;
|
|
3775
3782
|
}
|
|
3776
3783
|
if (isVBind && modifiers.some((mod) => mod.content === "prop")) patchFlag |= 32;
|
|
@@ -3828,9 +3835,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3828
3835
|
} else propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [propsExpression]);
|
|
3829
3836
|
break;
|
|
3830
3837
|
case 14: break;
|
|
3831
|
-
default:
|
|
3832
|
-
propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
|
|
3833
|
-
break;
|
|
3838
|
+
default: propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
|
|
3834
3839
|
}
|
|
3835
3840
|
return {
|
|
3836
3841
|
props: propsExpression,
|
|
@@ -3936,10 +3941,12 @@ function processSlotOutlet(node, context) {
|
|
|
3936
3941
|
for (let i = 0; i < node.props.length; i++) {
|
|
3937
3942
|
const p = node.props[i];
|
|
3938
3943
|
if (p.type === 6) {
|
|
3939
|
-
if (p.value)
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3944
|
+
if (p.value) {
|
|
3945
|
+
if (p.name === "name") slotName = JSON.stringify(p.value.content);
|
|
3946
|
+
else {
|
|
3947
|
+
p.name = camelize(p.name);
|
|
3948
|
+
nonNameProps.push(p);
|
|
3949
|
+
}
|
|
3943
3950
|
}
|
|
3944
3951
|
} else if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
|
|
3945
3952
|
if (p.exp) slotName = p.exp;
|
|
@@ -3965,17 +3972,18 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
3965
3972
|
const { loc, modifiers, arg } = dir;
|
|
3966
3973
|
if (!dir.exp && !modifiers.length) context.onError(createCompilerError(35, loc));
|
|
3967
3974
|
let eventName;
|
|
3968
|
-
if (arg.type === 4)
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3975
|
+
if (arg.type === 4) {
|
|
3976
|
+
if (arg.isStatic) {
|
|
3977
|
+
let rawName = arg.content;
|
|
3978
|
+
if (!!(process.env.NODE_ENV !== "production") && rawName.startsWith("vnode")) context.onError(createCompilerError(52, arg.loc));
|
|
3979
|
+
if (rawName.startsWith("vue:")) rawName = `vnode-${rawName.slice(4)}`;
|
|
3980
|
+
eventName = createSimpleExpression(node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? toHandlerKey(camelize(rawName)) : `on:${rawName}`, true, arg.loc);
|
|
3981
|
+
} else eventName = createCompoundExpression([
|
|
3982
|
+
`${context.helperString(TO_HANDLER_KEY)}(`,
|
|
3983
|
+
arg,
|
|
3984
|
+
`)`
|
|
3985
|
+
]);
|
|
3986
|
+
} else {
|
|
3979
3987
|
eventName = arg;
|
|
3980
3988
|
eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
|
|
3981
3989
|
eventName.children.push(`)`);
|
|
@@ -4011,11 +4019,14 @@ const transformBind = (dir, _node, context) => {
|
|
|
4011
4019
|
arg.children.unshift(`(`);
|
|
4012
4020
|
arg.children.push(`) || ""`);
|
|
4013
4021
|
} else if (!arg.isStatic) arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
4014
|
-
if (modifiers.some((mod) => mod.content === "camel"))
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4022
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
4023
|
+
if (arg.type === 4) {
|
|
4024
|
+
if (arg.isStatic) arg.content = camelize(arg.content);
|
|
4025
|
+
else arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
4026
|
+
} else {
|
|
4027
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
4028
|
+
arg.children.push(`)`);
|
|
4029
|
+
}
|
|
4019
4030
|
}
|
|
4020
4031
|
if (!context.inSSR) {
|
|
4021
4032
|
if (modifiers.some((mod) => mod.content === "prop")) injectPrefix(arg, ".");
|
|
@@ -4024,9 +4035,10 @@ const transformBind = (dir, _node, context) => {
|
|
|
4024
4035
|
return { props: [createObjectProperty(arg, exp)] };
|
|
4025
4036
|
};
|
|
4026
4037
|
const injectPrefix = (arg, prefix) => {
|
|
4027
|
-
if (arg.type === 4)
|
|
4028
|
-
|
|
4029
|
-
|
|
4038
|
+
if (arg.type === 4) {
|
|
4039
|
+
if (arg.isStatic) arg.content = prefix + arg.content;
|
|
4040
|
+
else arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4041
|
+
} else {
|
|
4030
4042
|
arg.children.unshift(`'${prefix}' + (`);
|
|
4031
4043
|
arg.children.push(`)`);
|
|
4032
4044
|
}
|
|
@@ -4173,11 +4185,12 @@ function parseFilter(node, context) {
|
|
|
4173
4185
|
if (c === 96 && prev !== 92) inTemplateString = false;
|
|
4174
4186
|
} else if (inRegex) {
|
|
4175
4187
|
if (c === 47 && prev !== 92) inRegex = false;
|
|
4176
|
-
} else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren)
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4188
|
+
} else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
|
|
4189
|
+
if (expression === void 0) {
|
|
4190
|
+
lastFilterIndex = i + 1;
|
|
4191
|
+
expression = exp.slice(0, i).trim();
|
|
4192
|
+
} else pushFilter();
|
|
4193
|
+
} else {
|
|
4181
4194
|
switch (c) {
|
|
4182
4195
|
case 34:
|
|
4183
4196
|
inDouble = true;
|
|
@@ -4203,9 +4216,7 @@ function parseFilter(node, context) {
|
|
|
4203
4216
|
case 123:
|
|
4204
4217
|
curly++;
|
|
4205
4218
|
break;
|
|
4206
|
-
case 125:
|
|
4207
|
-
curly--;
|
|
4208
|
-
break;
|
|
4219
|
+
case 125: curly--;
|
|
4209
4220
|
}
|
|
4210
4221
|
if (c === 47) {
|
|
4211
4222
|
let j = i - 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.6.0-rc.
|
|
3
|
+
"version": "3.6.0-rc.6",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"entities": "^7.0.1",
|
|
51
51
|
"estree-walker": "^2.0.2",
|
|
52
52
|
"source-map-js": "^1.2.1",
|
|
53
|
-
"@vue/shared": "3.6.0-rc.
|
|
53
|
+
"@vue/shared": "3.6.0-rc.6"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@babel/types": "^7.29.8"
|