@vue/compiler-ssr 3.3.0-alpha.2 → 3.3.0-alpha.4
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-ssr.cjs.js +17 -17
- package/package.json +3 -3
package/dist/compiler-ssr.cjs.js
CHANGED
|
@@ -83,7 +83,7 @@ function ssrProcessIf(node, context, disableNestedFragments = false) {
|
|
|
83
83
|
}
|
|
84
84
|
function processIfBranch(branch, context, disableNestedFragments = false) {
|
|
85
85
|
const { children } = branch;
|
|
86
|
-
const needFragmentWrapper = !disableNestedFragments && (children.length !== 1 || children[0].type !==
|
|
86
|
+
const needFragmentWrapper = !disableNestedFragments && (children.length !== 1 || children[0].type !== 1) && // optimize away nested fragments when the only child is a ForNode
|
|
87
87
|
!(children.length === 1 && children[0].type === 11);
|
|
88
88
|
return processChildrenAsStatement(branch, context, needFragmentWrapper);
|
|
89
89
|
}
|
|
@@ -93,7 +93,7 @@ const ssrTransformFor = compilerDom.createStructuralDirectiveTransform(
|
|
|
93
93
|
compilerDom.processFor
|
|
94
94
|
);
|
|
95
95
|
function ssrProcessFor(node, context, disableNestedFragments = false) {
|
|
96
|
-
const needFragmentWrapper = !disableNestedFragments && (node.children.length !== 1 || node.children[0].type !==
|
|
96
|
+
const needFragmentWrapper = !disableNestedFragments && (node.children.length !== 1 || node.children[0].type !== 1);
|
|
97
97
|
const renderLoop = compilerDom.createFunctionExpression(
|
|
98
98
|
compilerDom.createForLoopParams(node.parseResult)
|
|
99
99
|
);
|
|
@@ -133,7 +133,7 @@ const ssrTransformSlotOutlet = (node, context) => {
|
|
|
133
133
|
}
|
|
134
134
|
let method = SSR_RENDER_SLOT;
|
|
135
135
|
const parent = context.parent;
|
|
136
|
-
if (parent && parent.type ===
|
|
136
|
+
if (parent && parent.type === 1 && parent.tagType === 1 && compilerDom.resolveComponentType(parent, context, true) === compilerDom.TRANSITION && parent.children.filter((c) => c.type === 1).length === 1) {
|
|
137
137
|
method = SSR_RENDER_SLOT_INNER;
|
|
138
138
|
if (!(context.scopeId && context.slotted !== false)) {
|
|
139
139
|
args.push("null");
|
|
@@ -269,7 +269,7 @@ function ssrProcessSuspense(node, context) {
|
|
|
269
269
|
|
|
270
270
|
const rawChildrenMap = /* @__PURE__ */ new WeakMap();
|
|
271
271
|
const ssrTransformElement = (node, context) => {
|
|
272
|
-
if (node.type !==
|
|
272
|
+
if (node.type !== 1 || node.tagType !== 0) {
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
275
|
return function ssrPostTransformElement() {
|
|
@@ -628,7 +628,7 @@ const wipMap = /* @__PURE__ */ new WeakMap();
|
|
|
628
628
|
const WIP_SLOT = Symbol();
|
|
629
629
|
const componentTypeMap = /* @__PURE__ */ new WeakMap();
|
|
630
630
|
const ssrTransformComponent = (node, context) => {
|
|
631
|
-
if (node.type !==
|
|
631
|
+
if (node.type !== 1 || node.tagType !== 1) {
|
|
632
632
|
return;
|
|
633
633
|
}
|
|
634
634
|
const component = compilerDom.resolveComponentType(
|
|
@@ -729,7 +729,7 @@ function ssrProcessComponent(node, context, parent) {
|
|
|
729
729
|
context.pushStringPart(``);
|
|
730
730
|
}
|
|
731
731
|
if (component === compilerDom.TRANSITION) {
|
|
732
|
-
node.children = node.children.filter((c) => c.type !==
|
|
732
|
+
node.children = node.children.filter((c) => c.type !== 3);
|
|
733
733
|
}
|
|
734
734
|
processChildren(node, context);
|
|
735
735
|
}
|
|
@@ -783,7 +783,7 @@ function createVNodeSlotBranch(props, children, parentContext) {
|
|
|
783
783
|
}
|
|
784
784
|
};
|
|
785
785
|
const wrapperNode = {
|
|
786
|
-
type:
|
|
786
|
+
type: 1,
|
|
787
787
|
ns: 0,
|
|
788
788
|
tag: "template",
|
|
789
789
|
tagType: 3,
|
|
@@ -923,7 +923,7 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
|
|
|
923
923
|
for (let i = 0; i < children.length; i++) {
|
|
924
924
|
const child = children[i];
|
|
925
925
|
switch (child.type) {
|
|
926
|
-
case
|
|
926
|
+
case 1:
|
|
927
927
|
switch (child.tagType) {
|
|
928
928
|
case 0:
|
|
929
929
|
ssrProcessElement(child, context);
|
|
@@ -947,10 +947,10 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
|
|
|
947
947
|
return exhaustiveCheck2;
|
|
948
948
|
}
|
|
949
949
|
break;
|
|
950
|
-
case
|
|
950
|
+
case 2:
|
|
951
951
|
context.pushStringPart(shared.escapeHtml(child.content));
|
|
952
952
|
break;
|
|
953
|
-
case
|
|
953
|
+
case 3:
|
|
954
954
|
context.pushStringPart(`<!--${child.content}-->`);
|
|
955
955
|
break;
|
|
956
956
|
case 5:
|
|
@@ -1129,13 +1129,13 @@ const ssrTransformShow = (dir, node, context) => {
|
|
|
1129
1129
|
};
|
|
1130
1130
|
};
|
|
1131
1131
|
|
|
1132
|
-
const filterChild = (node) => node.children.filter((n) => n.type !==
|
|
1132
|
+
const filterChild = (node) => node.children.filter((n) => n.type !== 3);
|
|
1133
1133
|
const hasSingleChild = (node) => filterChild(node).length === 1;
|
|
1134
1134
|
const ssrInjectFallthroughAttrs = (node, context) => {
|
|
1135
1135
|
if (node.type === 0) {
|
|
1136
1136
|
context.identifiers._attrs = 1;
|
|
1137
1137
|
}
|
|
1138
|
-
if (node.type ===
|
|
1138
|
+
if (node.type === 1 && node.tagType === 1 && (compilerDom.isBuiltInType(node.tag, "Transition") || compilerDom.isBuiltInType(node.tag, "KeepAlive"))) {
|
|
1139
1139
|
const rootChildren = filterChild(context.root);
|
|
1140
1140
|
if (rootChildren.length === 1 && rootChildren[0] === node) {
|
|
1141
1141
|
if (hasSingleChild(node)) {
|
|
@@ -1151,14 +1151,14 @@ const ssrInjectFallthroughAttrs = (node, context) => {
|
|
|
1151
1151
|
if (node.type === 10 && hasSingleChild(node)) {
|
|
1152
1152
|
let hasEncounteredIf = false;
|
|
1153
1153
|
for (const c of filterChild(parent)) {
|
|
1154
|
-
if (c.type === 9 || c.type ===
|
|
1154
|
+
if (c.type === 9 || c.type === 1 && compilerDom.findDir(c, "if")) {
|
|
1155
1155
|
if (hasEncounteredIf)
|
|
1156
1156
|
return;
|
|
1157
1157
|
hasEncounteredIf = true;
|
|
1158
1158
|
} else if (
|
|
1159
1159
|
// node before v-if
|
|
1160
1160
|
!hasEncounteredIf || // non else nodes
|
|
1161
|
-
!(c.type ===
|
|
1161
|
+
!(c.type === 1 && compilerDom.findDir(c, /else/, true))
|
|
1162
1162
|
) {
|
|
1163
1163
|
return;
|
|
1164
1164
|
}
|
|
@@ -1169,7 +1169,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
};
|
|
1171
1171
|
function injectFallthroughAttrs(node) {
|
|
1172
|
-
if (node.type ===
|
|
1172
|
+
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !compilerDom.findDir(node, "for")) {
|
|
1173
1173
|
node.props.push({
|
|
1174
1174
|
type: 7,
|
|
1175
1175
|
name: "bind",
|
|
@@ -1201,10 +1201,10 @@ const ssrInjectCssVars = (node, context) => {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
};
|
|
1203
1203
|
function injectCssVars(node) {
|
|
1204
|
-
if (node.type ===
|
|
1204
|
+
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !compilerDom.findDir(node, "for")) {
|
|
1205
1205
|
if (compilerDom.isBuiltInType(node.tag, "Suspense")) {
|
|
1206
1206
|
for (const child of node.children) {
|
|
1207
|
-
if (child.type ===
|
|
1207
|
+
if (child.type === 1 && child.tagType === 3) {
|
|
1208
1208
|
child.children.forEach(injectCssVars);
|
|
1209
1209
|
} else {
|
|
1210
1210
|
injectCssVars(child);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-ssr",
|
|
3
|
-
"version": "3.3.0-alpha.
|
|
3
|
+
"version": "3.3.0-alpha.4",
|
|
4
4
|
"description": "@vue/compiler-ssr",
|
|
5
5
|
"main": "dist/compiler-ssr.cjs.js",
|
|
6
6
|
"types": "dist/compiler-ssr.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@vue/shared": "3.3.0-alpha.
|
|
32
|
-
"@vue/compiler-dom": "3.3.0-alpha.
|
|
31
|
+
"@vue/shared": "3.3.0-alpha.4",
|
|
32
|
+
"@vue/compiler-dom": "3.3.0-alpha.4"
|
|
33
33
|
}
|
|
34
34
|
}
|