@vue/compiler-vapor 3.6.0-alpha.4 → 3.6.0-alpha.5
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -282,6 +282,7 @@ function transform(node, options = {}) {
|
|
|
282
282
|
source: node.source,
|
|
283
283
|
template: /* @__PURE__ */ new Map(),
|
|
284
284
|
templateIndexMap: /* @__PURE__ */ new Map(),
|
|
285
|
+
rootTemplateIndexes: /* @__PURE__ */ new Set(),
|
|
285
286
|
component: /* @__PURE__ */ new Set(),
|
|
286
287
|
directive: /* @__PURE__ */ new Set(),
|
|
287
288
|
block: newBlock(node),
|
|
@@ -778,8 +779,10 @@ function analyzeExpressions(expressions) {
|
|
|
778
779
|
exp.ast === null && registerVariable(exp.content, exp, true);
|
|
779
780
|
continue;
|
|
780
781
|
}
|
|
782
|
+
const seenParents = /* @__PURE__ */ new Set();
|
|
781
783
|
compilerDom.walkIdentifiers(exp.ast, (currentNode, parent, parentStack) => {
|
|
782
|
-
if (parent && isMemberExpression(parent)) {
|
|
784
|
+
if (parent && isMemberExpression(parent) && !seenParents.has(parent)) {
|
|
785
|
+
seenParents.add(parent);
|
|
783
786
|
const memberExp = extractMemberExpression(parent, (id) => {
|
|
784
787
|
registerVariable(id.name, exp, true, {
|
|
785
788
|
start: id.start,
|
|
@@ -881,7 +884,7 @@ function shouldDeclareVariable(name, expToVariableMap, exps) {
|
|
|
881
884
|
}
|
|
882
885
|
return true;
|
|
883
886
|
}
|
|
884
|
-
if (vars.
|
|
887
|
+
if (vars.every((v) => v.every((e, idx) => e === first[idx]))) {
|
|
885
888
|
return false;
|
|
886
889
|
}
|
|
887
890
|
return true;
|
|
@@ -890,7 +893,9 @@ function processRepeatedExpressions(context, expressions, varDeclarations, updat
|
|
|
890
893
|
const declarations = [];
|
|
891
894
|
const seenExp = expressions.reduce(
|
|
892
895
|
(acc, exp) => {
|
|
893
|
-
const
|
|
896
|
+
const vars = expToVariableMap.get(exp);
|
|
897
|
+
if (!vars) return acc;
|
|
898
|
+
const variables = vars.map((v) => v.name);
|
|
894
899
|
if (exp.ast && exp.ast.type !== "Identifier" && !(variables && variables.some((v) => updatedVariable.has(v)))) {
|
|
895
900
|
acc[exp.content] = (acc[exp.content] || 0) + 1;
|
|
896
901
|
}
|
|
@@ -1006,12 +1011,14 @@ function extractMemberExpression(exp, onIdentifier) {
|
|
|
1006
1011
|
const object = extractMemberExpression(exp.object, onIdentifier);
|
|
1007
1012
|
const prop = exp.computed ? `[${extractMemberExpression(exp.property, onIdentifier)}]` : `.${extractMemberExpression(exp.property, shared.NOOP)}`;
|
|
1008
1013
|
return `${object}${prop}`;
|
|
1014
|
+
case "TSNonNullExpression":
|
|
1015
|
+
return `${extractMemberExpression(exp.expression, onIdentifier)}`;
|
|
1009
1016
|
default:
|
|
1010
1017
|
return "";
|
|
1011
1018
|
}
|
|
1012
1019
|
}
|
|
1013
1020
|
const isMemberExpression = (node) => {
|
|
1014
|
-
return node.type === "MemberExpression" || node.type === "OptionalMemberExpression";
|
|
1021
|
+
return node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "TSNonNullExpression";
|
|
1015
1022
|
};
|
|
1016
1023
|
|
|
1017
1024
|
function genSetEvent(oper, context) {
|
|
@@ -1582,7 +1589,6 @@ function genDynamicProps$1(oper, context) {
|
|
|
1582
1589
|
helper("setDynamicProps"),
|
|
1583
1590
|
`n${oper.element}`,
|
|
1584
1591
|
genMulti(DELIMITERS_ARRAY, ...values),
|
|
1585
|
-
oper.root && "true",
|
|
1586
1592
|
isSVG && "true"
|
|
1587
1593
|
)
|
|
1588
1594
|
];
|
|
@@ -2163,7 +2169,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
2163
2169
|
`}`
|
|
2164
2170
|
];
|
|
2165
2171
|
}
|
|
2166
|
-
if (node.type === 1) {
|
|
2172
|
+
if (node.type === 1 && !isKeepAliveTag(node.tag)) {
|
|
2167
2173
|
blockFn = [`${context.helper("withVaporCtx")}(`, ...blockFn, `)`];
|
|
2168
2174
|
}
|
|
2169
2175
|
return blockFn;
|
|
@@ -2319,7 +2325,7 @@ function genInsertionState(operation, context) {
|
|
|
2319
2325
|
];
|
|
2320
2326
|
}
|
|
2321
2327
|
|
|
2322
|
-
function genTemplates(templates,
|
|
2328
|
+
function genTemplates(templates, rootIndexes, context) {
|
|
2323
2329
|
const result = [];
|
|
2324
2330
|
let i = 0;
|
|
2325
2331
|
templates.forEach((ns, template) => {
|
|
@@ -2330,7 +2336,7 @@ function genTemplates(templates, rootIndex, context) {
|
|
|
2330
2336
|
// replace import expressions with string concatenation
|
|
2331
2337
|
IMPORT_EXPR_RE,
|
|
2332
2338
|
`" + $1 + "`
|
|
2333
|
-
)}${i
|
|
2339
|
+
)}${rootIndexes.has(i) ? ", true" : ns ? ", false" : ""}${ns ? `, ${ns}` : ""})
|
|
2334
2340
|
`
|
|
2335
2341
|
);
|
|
2336
2342
|
i++;
|
|
@@ -2630,7 +2636,7 @@ function generate(ir, options = {}) {
|
|
|
2630
2636
|
push("}");
|
|
2631
2637
|
}
|
|
2632
2638
|
const delegates = genDelegates(context);
|
|
2633
|
-
const templates = genTemplates(ir.template, ir.
|
|
2639
|
+
const templates = genTemplates(ir.template, ir.rootTemplateIndexes, context);
|
|
2634
2640
|
const imports = genHelperImports(context) + genAssetImports(context);
|
|
2635
2641
|
const preamble = imports + templates + delegates;
|
|
2636
2642
|
const newlineCount = [...preamble].filter((c) => c === "\n").length;
|
|
@@ -2791,11 +2797,7 @@ const transformElement = (node, context) => {
|
|
|
2791
2797
|
isDynamicComponent,
|
|
2792
2798
|
getEffectIndex
|
|
2793
2799
|
);
|
|
2794
|
-
|
|
2795
|
-
while (parent && parent.parent && parent.node.type === 1 && parent.node.tagType === 3) {
|
|
2796
|
-
parent = parent.parent;
|
|
2797
|
-
}
|
|
2798
|
-
const singleRoot = context.root === parent && parent.node.children.filter((child) => child.type !== 3).length === 1 || isCustomElement;
|
|
2800
|
+
const singleRoot = isSingleRoot(context);
|
|
2799
2801
|
if (isComponent) {
|
|
2800
2802
|
transformComponentElement(
|
|
2801
2803
|
node,
|
|
@@ -2816,6 +2818,22 @@ const transformElement = (node, context) => {
|
|
|
2816
2818
|
}
|
|
2817
2819
|
};
|
|
2818
2820
|
};
|
|
2821
|
+
function isSingleRoot(context) {
|
|
2822
|
+
if (context.inVFor) {
|
|
2823
|
+
return false;
|
|
2824
|
+
}
|
|
2825
|
+
let { parent } = context;
|
|
2826
|
+
if (parent && !(compilerDom.hasSingleChild(parent.node) || compilerDom.isSingleIfBlock(parent.node))) {
|
|
2827
|
+
return false;
|
|
2828
|
+
}
|
|
2829
|
+
while (parent && parent.parent && parent.node.type === 1 && parent.node.tagType === 3) {
|
|
2830
|
+
parent = parent.parent;
|
|
2831
|
+
if (!(compilerDom.hasSingleChild(parent.node) || compilerDom.isSingleIfBlock(parent.node))) {
|
|
2832
|
+
return false;
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
return context.root === parent;
|
|
2836
|
+
}
|
|
2819
2837
|
function transformComponentElement(node, propsResult, singleRoot, context, isDynamicComponent, isCustomElement) {
|
|
2820
2838
|
const dynamicComponent = isDynamicComponent ? resolveDynamicComponent(node) : void 0;
|
|
2821
2839
|
let { tag } = node;
|
|
@@ -2853,7 +2871,7 @@ function transformComponentElement(node, propsResult, singleRoot, context, isDyn
|
|
|
2853
2871
|
tag,
|
|
2854
2872
|
props: propsResult[0] ? propsResult[1] : [propsResult[1]],
|
|
2855
2873
|
asset,
|
|
2856
|
-
root: singleRoot
|
|
2874
|
+
root: singleRoot,
|
|
2857
2875
|
slots: [...context.slots],
|
|
2858
2876
|
once: context.inVOnce,
|
|
2859
2877
|
dynamic: dynamicComponent,
|
|
@@ -2904,7 +2922,6 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
2904
2922
|
type: 3,
|
|
2905
2923
|
element: context.reference(),
|
|
2906
2924
|
props: dynamicArgs,
|
|
2907
|
-
root: singleRoot,
|
|
2908
2925
|
tag
|
|
2909
2926
|
},
|
|
2910
2927
|
getEffectIndex
|
|
@@ -2928,7 +2945,6 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
2928
2945
|
type: 2,
|
|
2929
2946
|
element: context.reference(),
|
|
2930
2947
|
prop,
|
|
2931
|
-
root: singleRoot,
|
|
2932
2948
|
tag
|
|
2933
2949
|
},
|
|
2934
2950
|
getEffectIndex
|
|
@@ -2941,7 +2957,7 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
2941
2957
|
template += `</${tag}>`;
|
|
2942
2958
|
}
|
|
2943
2959
|
if (singleRoot) {
|
|
2944
|
-
context.ir.
|
|
2960
|
+
context.ir.rootTemplateIndexes.add(context.ir.template.size);
|
|
2945
2961
|
}
|
|
2946
2962
|
if (context.parent && context.parent.node.type === 1 && !compilerDom.isValidHTMLNesting(context.parent.node.tag, tag)) {
|
|
2947
2963
|
context.reference();
|
package/dist/compiler-vapor.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ export interface RootIRNode {
|
|
|
102
102
|
source: string;
|
|
103
103
|
template: Map<string, Namespace>;
|
|
104
104
|
templateIndexMap: Map<string, number>;
|
|
105
|
-
|
|
105
|
+
rootTemplateIndexes: Set<number>;
|
|
106
106
|
component: Set<string>;
|
|
107
107
|
directive: Set<string>;
|
|
108
108
|
block: BlockIRNode;
|
|
@@ -143,14 +143,12 @@ export interface SetPropIRNode extends BaseIRNode {
|
|
|
143
143
|
type: IRNodeTypes.SET_PROP;
|
|
144
144
|
element: number;
|
|
145
145
|
prop: IRProp;
|
|
146
|
-
root: boolean;
|
|
147
146
|
tag: string;
|
|
148
147
|
}
|
|
149
148
|
export interface SetDynamicPropsIRNode extends BaseIRNode {
|
|
150
149
|
type: IRNodeTypes.SET_DYNAMIC_PROPS;
|
|
151
150
|
element: number;
|
|
152
151
|
props: IRProps[];
|
|
153
|
-
root: boolean;
|
|
154
152
|
tag: string;
|
|
155
153
|
}
|
|
156
154
|
export interface SetDynamicEventsIRNode extends BaseIRNode {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -17084,7 +17084,43 @@ function toValidAssetId(name, type) {
|
|
|
17084
17084
|
return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
|
|
17085
17085
|
})}`;
|
|
17086
17086
|
}
|
|
17087
|
+
function filterNonCommentChildren(node) {
|
|
17088
|
+
return node.children.filter((n) => n.type !== 3);
|
|
17089
|
+
}
|
|
17090
|
+
function hasSingleChild(node) {
|
|
17091
|
+
return filterNonCommentChildren(node).length === 1;
|
|
17092
|
+
}
|
|
17093
|
+
function isSingleIfBlock(parent) {
|
|
17094
|
+
let hasEncounteredIf = false;
|
|
17095
|
+
for (const c of filterNonCommentChildren(parent)) {
|
|
17096
|
+
if (c.type === 9 || c.type === 1 && findDir$1(c, "if")) {
|
|
17097
|
+
if (hasEncounteredIf) return false;
|
|
17098
|
+
hasEncounteredIf = true;
|
|
17099
|
+
} else if (
|
|
17100
|
+
// node before v-if
|
|
17101
|
+
!hasEncounteredIf || // non else nodes
|
|
17102
|
+
!(c.type === 1 && findDir$1(c, /^else(-if)?$/, true))
|
|
17103
|
+
) {
|
|
17104
|
+
return false;
|
|
17105
|
+
}
|
|
17106
|
+
}
|
|
17107
|
+
return true;
|
|
17108
|
+
}
|
|
17087
17109
|
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
17110
|
+
function isAllWhitespace(str) {
|
|
17111
|
+
for (let i = 0; i < str.length; i++) {
|
|
17112
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
17113
|
+
return false;
|
|
17114
|
+
}
|
|
17115
|
+
}
|
|
17116
|
+
return true;
|
|
17117
|
+
}
|
|
17118
|
+
function isWhitespaceText(node) {
|
|
17119
|
+
return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content);
|
|
17120
|
+
}
|
|
17121
|
+
function isCommentOrWhitespace(node) {
|
|
17122
|
+
return node.type === 3 || isWhitespaceText(node);
|
|
17123
|
+
}
|
|
17088
17124
|
|
|
17089
17125
|
const defaultParserOptions = {
|
|
17090
17126
|
parseMode: "base",
|
|
@@ -17621,14 +17657,6 @@ function condenseWhitespace(nodes) {
|
|
|
17621
17657
|
}
|
|
17622
17658
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
17623
17659
|
}
|
|
17624
|
-
function isAllWhitespace(str) {
|
|
17625
|
-
for (let i = 0; i < str.length; i++) {
|
|
17626
|
-
if (!isWhitespace(str.charCodeAt(i))) {
|
|
17627
|
-
return false;
|
|
17628
|
-
}
|
|
17629
|
-
}
|
|
17630
|
-
return true;
|
|
17631
|
-
}
|
|
17632
17660
|
function hasNewlineChar(str) {
|
|
17633
17661
|
for (let i = 0; i < str.length; i++) {
|
|
17634
17662
|
const c = str.charCodeAt(i);
|
|
@@ -21382,7 +21410,7 @@ function postTransformTransition(node, onError, hasMultipleChildren = defaultHas
|
|
|
21382
21410
|
}
|
|
21383
21411
|
function defaultHasMultipleChildren(node) {
|
|
21384
21412
|
const children = node.children = node.children.filter(
|
|
21385
|
-
(c) =>
|
|
21413
|
+
(c) => !isCommentOrWhitespace(c)
|
|
21386
21414
|
);
|
|
21387
21415
|
const child = children[0];
|
|
21388
21416
|
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
|
|
@@ -21826,6 +21854,7 @@ function transform(node, options = {}) {
|
|
|
21826
21854
|
source: node.source,
|
|
21827
21855
|
template: /* @__PURE__ */ new Map(),
|
|
21828
21856
|
templateIndexMap: /* @__PURE__ */ new Map(),
|
|
21857
|
+
rootTemplateIndexes: /* @__PURE__ */ new Set(),
|
|
21829
21858
|
component: /* @__PURE__ */ new Set(),
|
|
21830
21859
|
directive: /* @__PURE__ */ new Set(),
|
|
21831
21860
|
block: newBlock(node),
|
|
@@ -22322,8 +22351,10 @@ function analyzeExpressions(expressions) {
|
|
|
22322
22351
|
exp.ast === null && registerVariable(exp.content, exp, true);
|
|
22323
22352
|
continue;
|
|
22324
22353
|
}
|
|
22354
|
+
const seenParents = /* @__PURE__ */ new Set();
|
|
22325
22355
|
walkIdentifiers(exp.ast, (currentNode, parent, parentStack) => {
|
|
22326
|
-
if (parent && isMemberExpression(parent)) {
|
|
22356
|
+
if (parent && isMemberExpression(parent) && !seenParents.has(parent)) {
|
|
22357
|
+
seenParents.add(parent);
|
|
22327
22358
|
const memberExp = extractMemberExpression(parent, (id) => {
|
|
22328
22359
|
registerVariable(id.name, exp, true, {
|
|
22329
22360
|
start: id.start,
|
|
@@ -22425,7 +22456,7 @@ function shouldDeclareVariable(name, expToVariableMap, exps) {
|
|
|
22425
22456
|
}
|
|
22426
22457
|
return true;
|
|
22427
22458
|
}
|
|
22428
|
-
if (vars.
|
|
22459
|
+
if (vars.every((v) => v.every((e, idx) => e === first[idx]))) {
|
|
22429
22460
|
return false;
|
|
22430
22461
|
}
|
|
22431
22462
|
return true;
|
|
@@ -22434,7 +22465,9 @@ function processRepeatedExpressions(context, expressions, varDeclarations, updat
|
|
|
22434
22465
|
const declarations = [];
|
|
22435
22466
|
const seenExp = expressions.reduce(
|
|
22436
22467
|
(acc, exp) => {
|
|
22437
|
-
const
|
|
22468
|
+
const vars = expToVariableMap.get(exp);
|
|
22469
|
+
if (!vars) return acc;
|
|
22470
|
+
const variables = vars.map((v) => v.name);
|
|
22438
22471
|
if (exp.ast && exp.ast.type !== "Identifier" && !(variables && variables.some((v) => updatedVariable.has(v)))) {
|
|
22439
22472
|
acc[exp.content] = (acc[exp.content] || 0) + 1;
|
|
22440
22473
|
}
|
|
@@ -22550,12 +22583,14 @@ function extractMemberExpression(exp, onIdentifier) {
|
|
|
22550
22583
|
const object = extractMemberExpression(exp.object, onIdentifier);
|
|
22551
22584
|
const prop = exp.computed ? `[${extractMemberExpression(exp.property, onIdentifier)}]` : `.${extractMemberExpression(exp.property, NOOP)}`;
|
|
22552
22585
|
return `${object}${prop}`;
|
|
22586
|
+
case "TSNonNullExpression":
|
|
22587
|
+
return `${extractMemberExpression(exp.expression, onIdentifier)}`;
|
|
22553
22588
|
default:
|
|
22554
22589
|
return "";
|
|
22555
22590
|
}
|
|
22556
22591
|
}
|
|
22557
22592
|
const isMemberExpression = (node) => {
|
|
22558
|
-
return node.type === "MemberExpression" || node.type === "OptionalMemberExpression";
|
|
22593
|
+
return node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "TSNonNullExpression";
|
|
22559
22594
|
};
|
|
22560
22595
|
|
|
22561
22596
|
function genSetEvent(oper, context) {
|
|
@@ -23126,7 +23161,6 @@ function genDynamicProps$1(oper, context) {
|
|
|
23126
23161
|
helper("setDynamicProps"),
|
|
23127
23162
|
`n${oper.element}`,
|
|
23128
23163
|
genMulti(DELIMITERS_ARRAY, ...values),
|
|
23129
|
-
oper.root && "true",
|
|
23130
23164
|
isSVG && "true"
|
|
23131
23165
|
)
|
|
23132
23166
|
];
|
|
@@ -23707,7 +23741,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
23707
23741
|
`}`
|
|
23708
23742
|
];
|
|
23709
23743
|
}
|
|
23710
|
-
if (node.type === 1) {
|
|
23744
|
+
if (node.type === 1 && !isKeepAliveTag(node.tag)) {
|
|
23711
23745
|
blockFn = [`${context.helper("withVaporCtx")}(`, ...blockFn, `)`];
|
|
23712
23746
|
}
|
|
23713
23747
|
return blockFn;
|
|
@@ -23863,7 +23897,7 @@ function genInsertionState(operation, context) {
|
|
|
23863
23897
|
];
|
|
23864
23898
|
}
|
|
23865
23899
|
|
|
23866
|
-
function genTemplates(templates,
|
|
23900
|
+
function genTemplates(templates, rootIndexes, context) {
|
|
23867
23901
|
const result = [];
|
|
23868
23902
|
let i = 0;
|
|
23869
23903
|
templates.forEach((ns, template) => {
|
|
@@ -23874,7 +23908,7 @@ function genTemplates(templates, rootIndex, context) {
|
|
|
23874
23908
|
// replace import expressions with string concatenation
|
|
23875
23909
|
IMPORT_EXPR_RE,
|
|
23876
23910
|
`" + $1 + "`
|
|
23877
|
-
)}${i
|
|
23911
|
+
)}${rootIndexes.has(i) ? ", true" : ns ? ", false" : ""}${ns ? `, ${ns}` : ""})
|
|
23878
23912
|
`
|
|
23879
23913
|
);
|
|
23880
23914
|
i++;
|
|
@@ -24174,7 +24208,7 @@ function generate(ir, options = {}) {
|
|
|
24174
24208
|
push("}");
|
|
24175
24209
|
}
|
|
24176
24210
|
const delegates = genDelegates(context);
|
|
24177
|
-
const templates = genTemplates(ir.template, ir.
|
|
24211
|
+
const templates = genTemplates(ir.template, ir.rootTemplateIndexes, context);
|
|
24178
24212
|
const imports = genHelperImports(context) + genAssetImports(context);
|
|
24179
24213
|
const preamble = imports + templates + delegates;
|
|
24180
24214
|
const newlineCount = [...preamble].filter((c) => c === "\n").length;
|
|
@@ -24335,11 +24369,7 @@ const transformElement = (node, context) => {
|
|
|
24335
24369
|
isDynamicComponent,
|
|
24336
24370
|
getEffectIndex
|
|
24337
24371
|
);
|
|
24338
|
-
|
|
24339
|
-
while (parent && parent.parent && parent.node.type === 1 && parent.node.tagType === 3) {
|
|
24340
|
-
parent = parent.parent;
|
|
24341
|
-
}
|
|
24342
|
-
const singleRoot = context.root === parent && parent.node.children.filter((child) => child.type !== 3).length === 1 || isCustomElement;
|
|
24372
|
+
const singleRoot = isSingleRoot(context);
|
|
24343
24373
|
if (isComponent) {
|
|
24344
24374
|
transformComponentElement(
|
|
24345
24375
|
node,
|
|
@@ -24360,6 +24390,22 @@ const transformElement = (node, context) => {
|
|
|
24360
24390
|
}
|
|
24361
24391
|
};
|
|
24362
24392
|
};
|
|
24393
|
+
function isSingleRoot(context) {
|
|
24394
|
+
if (context.inVFor) {
|
|
24395
|
+
return false;
|
|
24396
|
+
}
|
|
24397
|
+
let { parent } = context;
|
|
24398
|
+
if (parent && !(hasSingleChild(parent.node) || isSingleIfBlock(parent.node))) {
|
|
24399
|
+
return false;
|
|
24400
|
+
}
|
|
24401
|
+
while (parent && parent.parent && parent.node.type === 1 && parent.node.tagType === 3) {
|
|
24402
|
+
parent = parent.parent;
|
|
24403
|
+
if (!(hasSingleChild(parent.node) || isSingleIfBlock(parent.node))) {
|
|
24404
|
+
return false;
|
|
24405
|
+
}
|
|
24406
|
+
}
|
|
24407
|
+
return context.root === parent;
|
|
24408
|
+
}
|
|
24363
24409
|
function transformComponentElement(node, propsResult, singleRoot, context, isDynamicComponent, isCustomElement) {
|
|
24364
24410
|
const dynamicComponent = isDynamicComponent ? resolveDynamicComponent(node) : void 0;
|
|
24365
24411
|
let { tag } = node;
|
|
@@ -24397,7 +24443,7 @@ function transformComponentElement(node, propsResult, singleRoot, context, isDyn
|
|
|
24397
24443
|
tag,
|
|
24398
24444
|
props: propsResult[0] ? propsResult[1] : [propsResult[1]],
|
|
24399
24445
|
asset,
|
|
24400
|
-
root: singleRoot
|
|
24446
|
+
root: singleRoot,
|
|
24401
24447
|
slots: [...context.slots],
|
|
24402
24448
|
once: context.inVOnce,
|
|
24403
24449
|
dynamic: dynamicComponent,
|
|
@@ -24448,7 +24494,6 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
24448
24494
|
type: 3,
|
|
24449
24495
|
element: context.reference(),
|
|
24450
24496
|
props: dynamicArgs,
|
|
24451
|
-
root: singleRoot,
|
|
24452
24497
|
tag
|
|
24453
24498
|
},
|
|
24454
24499
|
getEffectIndex
|
|
@@ -24472,7 +24517,6 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
24472
24517
|
type: 2,
|
|
24473
24518
|
element: context.reference(),
|
|
24474
24519
|
prop,
|
|
24475
|
-
root: singleRoot,
|
|
24476
24520
|
tag
|
|
24477
24521
|
},
|
|
24478
24522
|
getEffectIndex
|
|
@@ -24485,7 +24529,7 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
24485
24529
|
template += `</${tag}>`;
|
|
24486
24530
|
}
|
|
24487
24531
|
if (singleRoot) {
|
|
24488
|
-
context.ir.
|
|
24532
|
+
context.ir.rootTemplateIndexes.add(context.ir.template.size);
|
|
24489
24533
|
}
|
|
24490
24534
|
if (context.parent && context.parent.node.type === 1 && !isValidHTMLNesting(context.parent.node.tag, tag)) {
|
|
24491
24535
|
context.reference();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-vapor",
|
|
3
|
-
"version": "3.6.0-alpha.
|
|
3
|
+
"version": "3.6.0-alpha.5",
|
|
4
4
|
"description": "@vue/compiler-vapor",
|
|
5
5
|
"main": "dist/compiler-vapor.cjs.js",
|
|
6
6
|
"module": "dist/compiler-vapor.esm-bundler.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/parser": "^7.28.5",
|
|
46
46
|
"estree-walker": "^2.0.2",
|
|
47
47
|
"source-map-js": "^1.2.1",
|
|
48
|
-
"@vue/compiler-dom": "3.6.0-alpha.
|
|
49
|
-
"@vue/shared": "3.6.0-alpha.
|
|
48
|
+
"@vue/compiler-dom": "3.6.0-alpha.5",
|
|
49
|
+
"@vue/shared": "3.6.0-alpha.5"
|
|
50
50
|
}
|
|
51
51
|
}
|