@vue/compiler-ssr 3.6.0-rc.4 → 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-ssr.cjs.js +38 -30
- package/dist/compiler-ssr.d.ts +1 -2
- package/package.json +3 -3
package/dist/compiler-ssr.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-ssr v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-ssr v3.6.0-rc.6
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -225,7 +225,8 @@ const ssrTransformElement = (node, context) => {
|
|
|
225
225
|
} else if (node.tag === "input") {
|
|
226
226
|
const vModel = findVModel(node);
|
|
227
227
|
if (vModel) {
|
|
228
|
-
const
|
|
228
|
+
const tempId = `_temp${context.temps++}`;
|
|
229
|
+
const tempExp = (0, _vue_compiler_dom.createSimpleExpression)(tempId, false);
|
|
229
230
|
propsExp.arguments = [(0, _vue_compiler_dom.createSequenceExpression)([(0, _vue_compiler_dom.createAssignmentExpression)(tempExp, mergedProps), (0, _vue_compiler_dom.createCallExpression)(context.helper(_vue_compiler_dom.MERGE_PROPS), [tempExp, (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_GET_DYNAMIC_MODEL_PROPS), [tempExp, vModel.exp])])])];
|
|
230
231
|
}
|
|
231
232
|
} else if (directives.length && !node.children.length) {
|
|
@@ -266,9 +267,10 @@ const ssrTransformElement = (node, context) => {
|
|
|
266
267
|
let attrName = key.content;
|
|
267
268
|
if (attrName === "key" || attrName === "ref") continue;
|
|
268
269
|
if (attrName === "class") openTag.push(` class="`, dynamicClassBinding = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_CLASS), [value]), `"`);
|
|
269
|
-
else if (attrName === "style")
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
else if (attrName === "style") {
|
|
271
|
+
if (dynamicStyleBinding) mergeCall(dynamicStyleBinding, value);
|
|
272
|
+
else openTag.push(` style="`, dynamicStyleBinding = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_STYLE), [value]), `"`);
|
|
273
|
+
} else {
|
|
272
274
|
attrName = node.tag.indexOf("-") > 0 ? attrName : _vue_shared.propsToAttrMap[attrName] || attrName.toLowerCase();
|
|
273
275
|
if ((0, _vue_shared.isBooleanAttr)(attrName)) openTag.push((0, _vue_compiler_dom.createConditionalExpression)((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [value]), (0, _vue_compiler_dom.createSimpleExpression)(" " + attrName, true), (0, _vue_compiler_dom.createSimpleExpression)("", true), false));
|
|
274
276
|
else if (attrName === "hidden") openTag.push((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_DYNAMIC_ATTR), [key, value]));
|
|
@@ -303,8 +305,10 @@ const ssrTransformElement = (node, context) => {
|
|
|
303
305
|
};
|
|
304
306
|
function buildSSRProps(props, directives, context) {
|
|
305
307
|
let mergePropsArgs = [];
|
|
306
|
-
if (props)
|
|
307
|
-
|
|
308
|
+
if (props) {
|
|
309
|
+
if (props.type === 14) mergePropsArgs = props.arguments;
|
|
310
|
+
else mergePropsArgs.push(props);
|
|
311
|
+
}
|
|
308
312
|
if (directives.length) for (const dir of directives) mergePropsArgs.push((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_GET_DIRECTIVE_PROPS), [`_ctx`, ...(0, _vue_compiler_dom.buildDirectiveArgs)(dir, context).elements]));
|
|
309
313
|
return mergePropsArgs.length > 1 ? (0, _vue_compiler_dom.createCallExpression)(context.helper(_vue_compiler_dom.MERGE_PROPS), mergePropsArgs) : mergePropsArgs[0];
|
|
310
314
|
}
|
|
@@ -349,7 +353,8 @@ function ssrTransformTransitionGroup(node, context) {
|
|
|
349
353
|
return () => {
|
|
350
354
|
const tag = (0, _vue_compiler_dom.findProp)(node, "tag");
|
|
351
355
|
if (tag) {
|
|
352
|
-
const
|
|
356
|
+
const otherProps = node.props.filter((p) => p !== tag);
|
|
357
|
+
const { props, directives } = (0, _vue_compiler_dom.buildProps)(node, context, otherProps, true, false, true);
|
|
353
358
|
let propsExp = null;
|
|
354
359
|
if (props || directives.length) propsExp = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_ATTRS), [buildSSRProps(props, directives, context)]);
|
|
355
360
|
wipMap$2.set(node, {
|
|
@@ -450,8 +455,9 @@ const ssrTransformComponent = (node, context) => {
|
|
|
450
455
|
const wipEntries = [];
|
|
451
456
|
wipMap.set(node, wipEntries);
|
|
452
457
|
const buildSSRSlotFn = (props, _vForExp, children, loc) => {
|
|
458
|
+
const param0 = props && (0, _vue_compiler_dom.stringifyExpression)(props) || `_`;
|
|
453
459
|
const fn = (0, _vue_compiler_dom.createFunctionExpression)([
|
|
454
|
-
|
|
460
|
+
param0,
|
|
455
461
|
`_push`,
|
|
456
462
|
`_parent`,
|
|
457
463
|
`_scopeId`
|
|
@@ -484,15 +490,16 @@ const ssrTransformComponent = (node, context) => {
|
|
|
484
490
|
};
|
|
485
491
|
function ssrProcessComponent(node, context, parent) {
|
|
486
492
|
const component = componentTypeMap.get(node);
|
|
487
|
-
if (!node.ssrCodegenNode)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
493
|
+
if (!node.ssrCodegenNode) {
|
|
494
|
+
if (component === _vue_compiler_dom.TELEPORT) return ssrProcessTeleport(node, context);
|
|
495
|
+
else if (component === _vue_compiler_dom.SUSPENSE) return ssrProcessSuspense(node, context);
|
|
496
|
+
else if (component === _vue_compiler_dom.TRANSITION_GROUP) return ssrProcessTransitionGroup(node, context);
|
|
497
|
+
else {
|
|
498
|
+
if (parent.type === WIP_SLOT) context.pushStringPart(``);
|
|
499
|
+
if (component === _vue_compiler_dom.TRANSITION) return ssrProcessTransition(node, context);
|
|
500
|
+
processChildren(node, context);
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
496
503
|
const wipEntries = wipMap.get(node) || [];
|
|
497
504
|
for (let i = 0; i < wipEntries.length; i++) {
|
|
498
505
|
const { fn, vnodeBranch } = wipEntries[i];
|
|
@@ -592,7 +599,7 @@ function ssrCodegenTransform(ast, options) {
|
|
|
592
599
|
}
|
|
593
600
|
processChildren(ast, context, ast.children.length > 1 && ast.children.some((c) => !(0, _vue_compiler_dom.isText)(c)));
|
|
594
601
|
ast.codegenNode = (0, _vue_compiler_dom.createBlockStatement)(context.body);
|
|
595
|
-
ast.ssrHelpers = Array.from(new Set([...Array.from(ast.helpers).filter((h) => h in ssrHelpers), ...context.helpers]));
|
|
602
|
+
ast.ssrHelpers = Array.from(/* @__PURE__ */ new Set([...Array.from(ast.helpers).filter((h) => h in ssrHelpers), ...context.helpers]));
|
|
596
603
|
ast.helpers = new Set(Array.from(ast.helpers).filter((h) => !(h in ssrHelpers)));
|
|
597
604
|
}
|
|
598
605
|
function createSSRTransformContext(root, options, helpers = /* @__PURE__ */ new Set(), withSlotScopeId = false) {
|
|
@@ -737,7 +744,6 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
737
744
|
default:
|
|
738
745
|
checkDuplicatedValue();
|
|
739
746
|
res.props = defaultProps;
|
|
740
|
-
break;
|
|
741
747
|
}
|
|
742
748
|
} else if ((0, _vue_compiler_dom.hasDynamicKeyVBind)(node)) {} else {
|
|
743
749
|
checkDuplicatedValue();
|
|
@@ -799,16 +805,18 @@ const ssrInjectCssVars = (node, context) => {
|
|
|
799
805
|
else injectCssVars(node);
|
|
800
806
|
};
|
|
801
807
|
function injectCssVars(node) {
|
|
802
|
-
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !(0, _vue_compiler_dom.findDir)(node, "for"))
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
808
|
+
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !(0, _vue_compiler_dom.findDir)(node, "for")) {
|
|
809
|
+
if (node.tag === "suspense" || node.tag === "Suspense") for (const child of node.children) if (child.type === 1 && child.tagType === 3) child.children.forEach(injectCssVars);
|
|
810
|
+
else injectCssVars(child);
|
|
811
|
+
else node.props.push({
|
|
812
|
+
type: 7,
|
|
813
|
+
name: "bind",
|
|
814
|
+
arg: void 0,
|
|
815
|
+
exp: (0, _vue_compiler_dom.createSimpleExpression)(`_cssVars`, false),
|
|
816
|
+
modifiers: [],
|
|
817
|
+
loc: _vue_compiler_dom.locStub
|
|
818
|
+
});
|
|
819
|
+
}
|
|
812
820
|
}
|
|
813
821
|
//#endregion
|
|
814
822
|
//#region packages/compiler-ssr/src/index.ts
|
package/dist/compiler-ssr.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-ssr",
|
|
3
|
-
"version": "3.6.0-rc.
|
|
3
|
+
"version": "3.6.0-rc.6",
|
|
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.6.0-rc.
|
|
32
|
-
"@vue/compiler-dom": "3.6.0-rc.
|
|
31
|
+
"@vue/shared": "3.6.0-rc.6",
|
|
32
|
+
"@vue/compiler-dom": "3.6.0-rc.6"
|
|
33
33
|
}
|
|
34
34
|
}
|