@vue/compiler-vapor 3.6.0-alpha.1 → 3.6.0-alpha.2
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-vapor.cjs.js +47 -24
- package/dist/compiler-vapor.esm-browser.js +47 -24
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1084,18 +1084,26 @@ function genFor(oper, context) {
|
|
|
1084
1084
|
keyProp,
|
|
1085
1085
|
idMap
|
|
1086
1086
|
);
|
|
1087
|
-
const
|
|
1087
|
+
const selectorDeclarations = [];
|
|
1088
|
+
const selectorSetup = [];
|
|
1088
1089
|
for (let i = 0; i < selectorPatterns.length; i++) {
|
|
1089
1090
|
const { selector } = selectorPatterns[i];
|
|
1090
1091
|
const selectorName = `_selector${id}_${i}`;
|
|
1091
|
-
|
|
1092
|
+
selectorDeclarations.push(`let ${selectorName}`, NEWLINE);
|
|
1093
|
+
if (i === 0) {
|
|
1094
|
+
selectorSetup.push(`({ createSelector }) => {`, INDENT_START);
|
|
1095
|
+
}
|
|
1096
|
+
selectorSetup.push(
|
|
1092
1097
|
NEWLINE,
|
|
1093
|
-
|
|
1094
|
-
...genCall(`
|
|
1098
|
+
`${selectorName} = `,
|
|
1099
|
+
...genCall(`createSelector`, [
|
|
1095
1100
|
`() => `,
|
|
1096
1101
|
...genExpression(selector, context)
|
|
1097
1102
|
])
|
|
1098
1103
|
);
|
|
1104
|
+
if (i === selectorPatterns.length - 1) {
|
|
1105
|
+
selectorSetup.push(INDENT_END, NEWLINE, "}");
|
|
1106
|
+
}
|
|
1099
1107
|
}
|
|
1100
1108
|
const blockFn = context.withId(() => {
|
|
1101
1109
|
const frag = [];
|
|
@@ -1103,25 +1111,25 @@ function genFor(oper, context) {
|
|
|
1103
1111
|
if (selectorPatterns.length || keyOnlyBindingPatterns.length) {
|
|
1104
1112
|
frag.push(
|
|
1105
1113
|
...genBlockContent(render, context, false, () => {
|
|
1106
|
-
const
|
|
1114
|
+
const patternFrag = [];
|
|
1107
1115
|
for (let i = 0; i < selectorPatterns.length; i++) {
|
|
1108
1116
|
const { effect } = selectorPatterns[i];
|
|
1109
|
-
|
|
1117
|
+
patternFrag.push(
|
|
1110
1118
|
NEWLINE,
|
|
1111
1119
|
`_selector${id}_${i}(() => {`,
|
|
1112
1120
|
INDENT_START
|
|
1113
1121
|
);
|
|
1114
1122
|
for (const oper2 of effect.operations) {
|
|
1115
|
-
|
|
1123
|
+
patternFrag.push(...genOperation(oper2, context));
|
|
1116
1124
|
}
|
|
1117
|
-
|
|
1125
|
+
patternFrag.push(INDENT_END, NEWLINE, `})`);
|
|
1118
1126
|
}
|
|
1119
1127
|
for (const { effect } of keyOnlyBindingPatterns) {
|
|
1120
1128
|
for (const oper2 of effect.operations) {
|
|
1121
|
-
|
|
1129
|
+
patternFrag.push(...genOperation(oper2, context));
|
|
1122
1130
|
}
|
|
1123
1131
|
}
|
|
1124
|
-
return
|
|
1132
|
+
return patternFrag;
|
|
1125
1133
|
})
|
|
1126
1134
|
);
|
|
1127
1135
|
} else {
|
|
@@ -1143,16 +1151,17 @@ function genFor(oper, context) {
|
|
|
1143
1151
|
}
|
|
1144
1152
|
return [
|
|
1145
1153
|
NEWLINE,
|
|
1154
|
+
...selectorDeclarations,
|
|
1146
1155
|
`const n${id} = `,
|
|
1147
1156
|
...genCall(
|
|
1148
|
-
helper("createFor"),
|
|
1157
|
+
[helper("createFor"), "undefined"],
|
|
1149
1158
|
sourceExpr,
|
|
1150
1159
|
blockFn,
|
|
1151
1160
|
genCallback(keyProp),
|
|
1152
|
-
flags ? String(flags) : void 0
|
|
1161
|
+
flags ? String(flags) : void 0,
|
|
1162
|
+
selectorSetup.length ? selectorSetup : void 0
|
|
1153
1163
|
// todo: hydrationNode
|
|
1154
|
-
)
|
|
1155
|
-
...patternFrag
|
|
1164
|
+
)
|
|
1156
1165
|
];
|
|
1157
1166
|
function parseValueDestructure() {
|
|
1158
1167
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1790,6 +1799,7 @@ function genCreateComponent(operation, context) {
|
|
|
1790
1799
|
}
|
|
1791
1800
|
function getUniqueHandlerName(context, name) {
|
|
1792
1801
|
const { seenInlineHandlerNames } = context;
|
|
1802
|
+
name = genVarName(name);
|
|
1793
1803
|
const count = seenInlineHandlerNames[name] || 0;
|
|
1794
1804
|
seenInlineHandlerNames[name] = count + 1;
|
|
1795
1805
|
return count === 0 ? name : `${name}${count}`;
|
|
@@ -3091,7 +3101,8 @@ const transformText = (node, context) => {
|
|
|
3091
3101
|
}
|
|
3092
3102
|
};
|
|
3093
3103
|
function processInterpolation(context) {
|
|
3094
|
-
const
|
|
3104
|
+
const parentNode = context.parent.node;
|
|
3105
|
+
const children = parentNode.children;
|
|
3095
3106
|
const nexts = children.slice(context.index);
|
|
3096
3107
|
const idx = nexts.findIndex((n) => !isTextLike(n));
|
|
3097
3108
|
const nodes = idx > -1 ? nexts.slice(0, idx) : nexts;
|
|
@@ -3099,9 +3110,15 @@ function processInterpolation(context) {
|
|
|
3099
3110
|
if (prev && prev.type === 2) {
|
|
3100
3111
|
nodes.unshift(prev);
|
|
3101
3112
|
}
|
|
3113
|
+
const values = processTextLikeChildren(nodes, context);
|
|
3114
|
+
if (values.length === 0 && parentNode.type !== 0) {
|
|
3115
|
+
return;
|
|
3116
|
+
}
|
|
3102
3117
|
context.template += " ";
|
|
3103
3118
|
const id = context.reference();
|
|
3104
|
-
|
|
3119
|
+
if (values.length === 0) {
|
|
3120
|
+
return;
|
|
3121
|
+
}
|
|
3105
3122
|
const nonConstantExps = values.filter((v) => !isConstantExpression(v));
|
|
3106
3123
|
const isStatic = !nonConstantExps.length || nonConstantExps.every(
|
|
3107
3124
|
(e) => isStaticExpression(e, context.options.bindingMetadata)
|
|
@@ -3121,7 +3138,7 @@ function processInterpolation(context) {
|
|
|
3121
3138
|
}
|
|
3122
3139
|
}
|
|
3123
3140
|
function processTextContainer(children, context) {
|
|
3124
|
-
const values = children
|
|
3141
|
+
const values = processTextLikeChildren(children, context);
|
|
3125
3142
|
const literals = values.map(getLiteralExpressionValue);
|
|
3126
3143
|
if (literals.every((l) => l != null)) {
|
|
3127
3144
|
context.childrenTemplate = literals.map((l) => String(l));
|
|
@@ -3140,13 +3157,19 @@ function processTextContainer(children, context) {
|
|
|
3140
3157
|
});
|
|
3141
3158
|
}
|
|
3142
3159
|
}
|
|
3143
|
-
function
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3160
|
+
function processTextLikeChildren(nodes, context) {
|
|
3161
|
+
const exps = [];
|
|
3162
|
+
for (const node of nodes) {
|
|
3163
|
+
let exp;
|
|
3164
|
+
markNonTemplate(node, context);
|
|
3165
|
+
if (node.type === 2) {
|
|
3166
|
+
exp = compilerDom.createSimpleExpression(node.content, true, node.loc);
|
|
3167
|
+
} else {
|
|
3168
|
+
exp = node.content;
|
|
3169
|
+
}
|
|
3170
|
+
if (exp.content) exps.push(exp);
|
|
3149
3171
|
}
|
|
3172
|
+
return exps;
|
|
3150
3173
|
}
|
|
3151
3174
|
function isTextLike(node) {
|
|
3152
3175
|
return node.type === 5 || node.type === 2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-vapor v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-vapor v3.6.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -33612,18 +33612,26 @@ function genFor(oper, context) {
|
|
|
33612
33612
|
keyProp,
|
|
33613
33613
|
idMap
|
|
33614
33614
|
);
|
|
33615
|
-
const
|
|
33615
|
+
const selectorDeclarations = [];
|
|
33616
|
+
const selectorSetup = [];
|
|
33616
33617
|
for (let i = 0; i < selectorPatterns.length; i++) {
|
|
33617
33618
|
const { selector } = selectorPatterns[i];
|
|
33618
33619
|
const selectorName = `_selector${id}_${i}`;
|
|
33619
|
-
|
|
33620
|
+
selectorDeclarations.push(`let ${selectorName}`, NEWLINE);
|
|
33621
|
+
if (i === 0) {
|
|
33622
|
+
selectorSetup.push(`({ createSelector }) => {`, INDENT_START);
|
|
33623
|
+
}
|
|
33624
|
+
selectorSetup.push(
|
|
33620
33625
|
NEWLINE,
|
|
33621
|
-
|
|
33622
|
-
...genCall(`
|
|
33626
|
+
`${selectorName} = `,
|
|
33627
|
+
...genCall(`createSelector`, [
|
|
33623
33628
|
`() => `,
|
|
33624
33629
|
...genExpression(selector, context)
|
|
33625
33630
|
])
|
|
33626
33631
|
);
|
|
33632
|
+
if (i === selectorPatterns.length - 1) {
|
|
33633
|
+
selectorSetup.push(INDENT_END, NEWLINE, "}");
|
|
33634
|
+
}
|
|
33627
33635
|
}
|
|
33628
33636
|
const blockFn = context.withId(() => {
|
|
33629
33637
|
const frag = [];
|
|
@@ -33631,25 +33639,25 @@ function genFor(oper, context) {
|
|
|
33631
33639
|
if (selectorPatterns.length || keyOnlyBindingPatterns.length) {
|
|
33632
33640
|
frag.push(
|
|
33633
33641
|
...genBlockContent(render, context, false, () => {
|
|
33634
|
-
const
|
|
33642
|
+
const patternFrag = [];
|
|
33635
33643
|
for (let i = 0; i < selectorPatterns.length; i++) {
|
|
33636
33644
|
const { effect } = selectorPatterns[i];
|
|
33637
|
-
|
|
33645
|
+
patternFrag.push(
|
|
33638
33646
|
NEWLINE,
|
|
33639
33647
|
`_selector${id}_${i}(() => {`,
|
|
33640
33648
|
INDENT_START
|
|
33641
33649
|
);
|
|
33642
33650
|
for (const oper2 of effect.operations) {
|
|
33643
|
-
|
|
33651
|
+
patternFrag.push(...genOperation(oper2, context));
|
|
33644
33652
|
}
|
|
33645
|
-
|
|
33653
|
+
patternFrag.push(INDENT_END, NEWLINE, `})`);
|
|
33646
33654
|
}
|
|
33647
33655
|
for (const { effect } of keyOnlyBindingPatterns) {
|
|
33648
33656
|
for (const oper2 of effect.operations) {
|
|
33649
|
-
|
|
33657
|
+
patternFrag.push(...genOperation(oper2, context));
|
|
33650
33658
|
}
|
|
33651
33659
|
}
|
|
33652
|
-
return
|
|
33660
|
+
return patternFrag;
|
|
33653
33661
|
})
|
|
33654
33662
|
);
|
|
33655
33663
|
} else {
|
|
@@ -33671,16 +33679,17 @@ function genFor(oper, context) {
|
|
|
33671
33679
|
}
|
|
33672
33680
|
return [
|
|
33673
33681
|
NEWLINE,
|
|
33682
|
+
...selectorDeclarations,
|
|
33674
33683
|
`const n${id} = `,
|
|
33675
33684
|
...genCall(
|
|
33676
|
-
helper("createFor"),
|
|
33685
|
+
[helper("createFor"), "undefined"],
|
|
33677
33686
|
sourceExpr,
|
|
33678
33687
|
blockFn,
|
|
33679
33688
|
genCallback(keyProp),
|
|
33680
|
-
flags ? String(flags) : void 0
|
|
33689
|
+
flags ? String(flags) : void 0,
|
|
33690
|
+
selectorSetup.length ? selectorSetup : void 0
|
|
33681
33691
|
// todo: hydrationNode
|
|
33682
|
-
)
|
|
33683
|
-
...patternFrag
|
|
33692
|
+
)
|
|
33684
33693
|
];
|
|
33685
33694
|
function parseValueDestructure() {
|
|
33686
33695
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -34318,6 +34327,7 @@ function genCreateComponent(operation, context) {
|
|
|
34318
34327
|
}
|
|
34319
34328
|
function getUniqueHandlerName(context, name) {
|
|
34320
34329
|
const { seenInlineHandlerNames } = context;
|
|
34330
|
+
name = genVarName(name);
|
|
34321
34331
|
const count = seenInlineHandlerNames[name] || 0;
|
|
34322
34332
|
seenInlineHandlerNames[name] = count + 1;
|
|
34323
34333
|
return count === 0 ? name : `${name}${count}`;
|
|
@@ -35605,7 +35615,8 @@ const transformText = (node, context) => {
|
|
|
35605
35615
|
}
|
|
35606
35616
|
};
|
|
35607
35617
|
function processInterpolation(context) {
|
|
35608
|
-
const
|
|
35618
|
+
const parentNode = context.parent.node;
|
|
35619
|
+
const children = parentNode.children;
|
|
35609
35620
|
const nexts = children.slice(context.index);
|
|
35610
35621
|
const idx = nexts.findIndex((n) => !isTextLike(n));
|
|
35611
35622
|
const nodes = idx > -1 ? nexts.slice(0, idx) : nexts;
|
|
@@ -35613,9 +35624,15 @@ function processInterpolation(context) {
|
|
|
35613
35624
|
if (prev && prev.type === 2) {
|
|
35614
35625
|
nodes.unshift(prev);
|
|
35615
35626
|
}
|
|
35627
|
+
const values = processTextLikeChildren(nodes, context);
|
|
35628
|
+
if (values.length === 0 && parentNode.type !== 0) {
|
|
35629
|
+
return;
|
|
35630
|
+
}
|
|
35616
35631
|
context.template += " ";
|
|
35617
35632
|
const id = context.reference();
|
|
35618
|
-
|
|
35633
|
+
if (values.length === 0) {
|
|
35634
|
+
return;
|
|
35635
|
+
}
|
|
35619
35636
|
const nonConstantExps = values.filter((v) => !isConstantExpression(v));
|
|
35620
35637
|
const isStatic = !nonConstantExps.length || nonConstantExps.every(
|
|
35621
35638
|
(e) => isStaticExpression(e, context.options.bindingMetadata)
|
|
@@ -35635,7 +35652,7 @@ function processInterpolation(context) {
|
|
|
35635
35652
|
}
|
|
35636
35653
|
}
|
|
35637
35654
|
function processTextContainer(children, context) {
|
|
35638
|
-
const values = children
|
|
35655
|
+
const values = processTextLikeChildren(children, context);
|
|
35639
35656
|
const literals = values.map(getLiteralExpressionValue);
|
|
35640
35657
|
if (literals.every((l) => l != null)) {
|
|
35641
35658
|
context.childrenTemplate = literals.map((l) => String(l));
|
|
@@ -35654,13 +35671,19 @@ function processTextContainer(children, context) {
|
|
|
35654
35671
|
});
|
|
35655
35672
|
}
|
|
35656
35673
|
}
|
|
35657
|
-
function
|
|
35658
|
-
|
|
35659
|
-
|
|
35660
|
-
|
|
35661
|
-
|
|
35662
|
-
|
|
35674
|
+
function processTextLikeChildren(nodes, context) {
|
|
35675
|
+
const exps = [];
|
|
35676
|
+
for (const node of nodes) {
|
|
35677
|
+
let exp;
|
|
35678
|
+
markNonTemplate(node, context);
|
|
35679
|
+
if (node.type === 2) {
|
|
35680
|
+
exp = createSimpleExpression(node.content, true, node.loc);
|
|
35681
|
+
} else {
|
|
35682
|
+
exp = node.content;
|
|
35683
|
+
}
|
|
35684
|
+
if (exp.content) exps.push(exp);
|
|
35663
35685
|
}
|
|
35686
|
+
return exps;
|
|
35664
35687
|
}
|
|
35665
35688
|
function isTextLike(node) {
|
|
35666
35689
|
return node.type === 5 || node.type === 2;
|
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.2",
|
|
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.27.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.2",
|
|
49
|
+
"@vue/shared": "3.6.0-alpha.2"
|
|
50
50
|
}
|
|
51
51
|
}
|