@vue/compiler-ssr 3.2.31 → 3.2.34-beta.1
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 +57 -15
- package/package.json +3 -3
package/dist/compiler-ssr.cjs.js
CHANGED
|
@@ -9,6 +9,7 @@ const SSR_INTERPOLATE = Symbol(`ssrInterpolate`);
|
|
|
9
9
|
const SSR_RENDER_VNODE = Symbol(`ssrRenderVNode`);
|
|
10
10
|
const SSR_RENDER_COMPONENT = Symbol(`ssrRenderComponent`);
|
|
11
11
|
const SSR_RENDER_SLOT = Symbol(`ssrRenderSlot`);
|
|
12
|
+
const SSR_RENDER_SLOT_INNER = Symbol(`ssrRenderSlotInner`);
|
|
12
13
|
const SSR_RENDER_CLASS = Symbol(`ssrRenderClass`);
|
|
13
14
|
const SSR_RENDER_STYLE = Symbol(`ssrRenderStyle`);
|
|
14
15
|
const SSR_RENDER_ATTRS = Symbol(`ssrRenderAttrs`);
|
|
@@ -28,6 +29,7 @@ const ssrHelpers = {
|
|
|
28
29
|
[SSR_RENDER_VNODE]: `ssrRenderVNode`,
|
|
29
30
|
[SSR_RENDER_COMPONENT]: `ssrRenderComponent`,
|
|
30
31
|
[SSR_RENDER_SLOT]: `ssrRenderSlot`,
|
|
32
|
+
[SSR_RENDER_SLOT_INNER]: `ssrRenderSlotInner`,
|
|
31
33
|
[SSR_RENDER_CLASS]: `ssrRenderClass`,
|
|
32
34
|
[SSR_RENDER_STYLE]: `ssrRenderStyle`,
|
|
33
35
|
[SSR_RENDER_ATTRS]: `ssrRenderAttrs`,
|
|
@@ -121,7 +123,20 @@ const ssrTransformSlotOutlet = (node, context) => {
|
|
|
121
123
|
if (context.scopeId && context.slotted !== false) {
|
|
122
124
|
args.push(`"${context.scopeId}-s"`);
|
|
123
125
|
}
|
|
124
|
-
|
|
126
|
+
let method = SSR_RENDER_SLOT;
|
|
127
|
+
// #3989
|
|
128
|
+
// check if this is a single slot inside a transition wrapper - since
|
|
129
|
+
// transition will unwrap the slot fragment into a single vnode at runtime,
|
|
130
|
+
// we need to avoid rendering the slot as a fragment.
|
|
131
|
+
const parent = context.parent;
|
|
132
|
+
if (parent &&
|
|
133
|
+
parent.type === 1 /* ELEMENT */ &&
|
|
134
|
+
parent.tagType === 1 /* COMPONENT */ &&
|
|
135
|
+
compilerDom.resolveComponentType(parent, context, true) === compilerDom.TRANSITION &&
|
|
136
|
+
parent.children.filter(c => c.type === 1 /* ELEMENT */).length === 1) {
|
|
137
|
+
method = SSR_RENDER_SLOT_INNER;
|
|
138
|
+
}
|
|
139
|
+
node.ssrCodegenNode = compilerDom.createCallExpression(context.helper(method), args);
|
|
125
140
|
}
|
|
126
141
|
};
|
|
127
142
|
function ssrProcessSlotOutlet(node, context) {
|
|
@@ -677,16 +692,25 @@ function ssrProcessComponent(node, context) {
|
|
|
677
692
|
const rawOptionsMap = new WeakMap();
|
|
678
693
|
const [baseNodeTransforms, baseDirectiveTransforms] = compilerDom.getBaseTransformPreset(true);
|
|
679
694
|
const vnodeNodeTransforms = [...baseNodeTransforms, ...compilerDom.DOMNodeTransforms];
|
|
680
|
-
const vnodeDirectiveTransforms =
|
|
695
|
+
const vnodeDirectiveTransforms = {
|
|
696
|
+
...baseDirectiveTransforms,
|
|
697
|
+
...compilerDom.DOMDirectiveTransforms
|
|
698
|
+
};
|
|
681
699
|
function createVNodeSlotBranch(props, children, parentContext) {
|
|
682
700
|
// apply a sub-transform using vnode-based transforms.
|
|
683
701
|
const rawOptions = rawOptionsMap.get(parentContext.root);
|
|
684
|
-
const subOptions =
|
|
702
|
+
const subOptions = {
|
|
703
|
+
...rawOptions,
|
|
685
704
|
// overwrite with vnode-based transforms
|
|
686
705
|
nodeTransforms: [
|
|
687
706
|
...vnodeNodeTransforms,
|
|
688
707
|
...(rawOptions.nodeTransforms || [])
|
|
689
|
-
],
|
|
708
|
+
],
|
|
709
|
+
directiveTransforms: {
|
|
710
|
+
...vnodeDirectiveTransforms,
|
|
711
|
+
...(rawOptions.directiveTransforms || {})
|
|
712
|
+
}
|
|
713
|
+
};
|
|
690
714
|
// wrap the children with a wrapper template for proper children treatment.
|
|
691
715
|
const wrapperNode = {
|
|
692
716
|
type: 1 /* ELEMENT */,
|
|
@@ -720,8 +744,8 @@ function subTransform(node, options, parentContext) {
|
|
|
720
744
|
// like normal render functions
|
|
721
745
|
childContext.ssr = false;
|
|
722
746
|
// inherit parent scope analysis state
|
|
723
|
-
childContext.scopes =
|
|
724
|
-
childContext.identifiers =
|
|
747
|
+
childContext.scopes = { ...parentContext.scopes };
|
|
748
|
+
childContext.identifiers = { ...parentContext.identifiers };
|
|
725
749
|
childContext.imports = parentContext.imports;
|
|
726
750
|
// traverse
|
|
727
751
|
compilerDom.traverseNode(childRoot, childContext);
|
|
@@ -1111,16 +1135,27 @@ function injectCssVars(node) {
|
|
|
1111
1135
|
}
|
|
1112
1136
|
|
|
1113
1137
|
function compile(template, options = {}) {
|
|
1114
|
-
options =
|
|
1138
|
+
options = {
|
|
1139
|
+
...options,
|
|
1140
|
+
// apply DOM-specific parsing options
|
|
1141
|
+
...compilerDom.parserOptions,
|
|
1142
|
+
ssr: true,
|
|
1143
|
+
inSSR: true,
|
|
1144
|
+
scopeId: options.mode === 'function' ? null : options.scopeId,
|
|
1115
1145
|
// always prefix since compiler-ssr doesn't have size concern
|
|
1116
|
-
prefixIdentifiers: true,
|
|
1146
|
+
prefixIdentifiers: true,
|
|
1117
1147
|
// disable optimizations that are unnecessary for ssr
|
|
1118
|
-
cacheHandlers: false,
|
|
1148
|
+
cacheHandlers: false,
|
|
1149
|
+
hoistStatic: false
|
|
1150
|
+
};
|
|
1119
1151
|
const ast = compilerDom.baseParse(template, options);
|
|
1120
1152
|
// Save raw options for AST. This is needed when performing sub-transforms
|
|
1121
1153
|
// on slot vnode branches.
|
|
1122
1154
|
rawOptionsMap.set(ast, options);
|
|
1123
|
-
compilerDom.transform(ast,
|
|
1155
|
+
compilerDom.transform(ast, {
|
|
1156
|
+
...options,
|
|
1157
|
+
hoistStatic: false,
|
|
1158
|
+
nodeTransforms: [
|
|
1124
1159
|
ssrTransformIf,
|
|
1125
1160
|
ssrTransformFor,
|
|
1126
1161
|
compilerDom.trackVForSlotScopes,
|
|
@@ -1133,14 +1168,21 @@ function compile(template, options = {}) {
|
|
|
1133
1168
|
compilerDom.trackSlotScopes,
|
|
1134
1169
|
compilerDom.transformStyle,
|
|
1135
1170
|
...(options.nodeTransforms || []) // user transforms
|
|
1136
|
-
],
|
|
1171
|
+
],
|
|
1172
|
+
directiveTransforms: {
|
|
1137
1173
|
// reusing core v-bind
|
|
1138
|
-
bind: compilerDom.transformBind,
|
|
1174
|
+
bind: compilerDom.transformBind,
|
|
1139
1175
|
// model and show has dedicated SSR handling
|
|
1140
|
-
model: ssrTransformModel,
|
|
1176
|
+
model: ssrTransformModel,
|
|
1177
|
+
show: ssrTransformShow,
|
|
1141
1178
|
// the following are ignored during SSR
|
|
1142
|
-
on: compilerDom.noopDirectiveTransform,
|
|
1143
|
-
|
|
1179
|
+
on: compilerDom.noopDirectiveTransform,
|
|
1180
|
+
cloak: compilerDom.noopDirectiveTransform,
|
|
1181
|
+
once: compilerDom.noopDirectiveTransform,
|
|
1182
|
+
memo: compilerDom.noopDirectiveTransform,
|
|
1183
|
+
...(options.directiveTransforms || {}) // user transforms
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1144
1186
|
// traverse the template AST and convert into SSR codegen AST
|
|
1145
1187
|
// by replacing ast.codegenNode.
|
|
1146
1188
|
ssrCodegenTransform(ast, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-ssr",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.34-beta.1",
|
|
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.2.
|
|
32
|
-
"@vue/compiler-dom": "3.2.
|
|
31
|
+
"@vue/shared": "3.2.34-beta.1",
|
|
32
|
+
"@vue/compiler-dom": "3.2.34-beta.1"
|
|
33
33
|
}
|
|
34
34
|
}
|