@vue/compiler-ssr 3.6.0-rc.1 → 3.6.0-rc.11
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 +87 -77
- 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.11
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -65,7 +65,7 @@ function ssrProcessIf(node, context, disableNestedFragments = false, disableComm
|
|
|
65
65
|
if (branch.condition) currentIf = currentIf.alternate = (0, _vue_compiler_dom.createIfStatement)(branch.condition, branchBlockStatement);
|
|
66
66
|
else currentIf.alternate = branchBlockStatement;
|
|
67
67
|
}
|
|
68
|
-
if (!currentIf.alternate && !disableComment) currentIf.alternate = (0, _vue_compiler_dom.createBlockStatement)([(0, _vue_compiler_dom.createCallExpression)(`_push`, ["`<!---->`"])]);
|
|
68
|
+
if (!currentIf.alternate && (!disableComment || context.options.vapor)) currentIf.alternate = (0, _vue_compiler_dom.createBlockStatement)([(0, _vue_compiler_dom.createCallExpression)(`_push`, ["`<!---->`"])]);
|
|
69
69
|
}
|
|
70
70
|
function processIfBranch(branch, context, disableNestedFragments = false) {
|
|
71
71
|
const { children } = branch;
|
|
@@ -83,48 +83,6 @@ function ssrProcessFor(node, context, disableNestedFragments = false) {
|
|
|
83
83
|
if (!disableNestedFragments) context.pushStringPart(`<!--]-->`);
|
|
84
84
|
}
|
|
85
85
|
//#endregion
|
|
86
|
-
//#region packages/compiler-ssr/src/transforms/ssrTransformSlotOutlet.ts
|
|
87
|
-
const ssrTransformSlotOutlet = (node, context) => {
|
|
88
|
-
if ((0, _vue_compiler_dom.isSlotOutlet)(node)) {
|
|
89
|
-
const { slotName, slotProps } = (0, _vue_compiler_dom.processSlotOutlet)(node, context);
|
|
90
|
-
const args = [
|
|
91
|
-
`_ctx.$slots`,
|
|
92
|
-
slotName,
|
|
93
|
-
slotProps || `{}`,
|
|
94
|
-
`null`,
|
|
95
|
-
`_push`,
|
|
96
|
-
`_parent`
|
|
97
|
-
];
|
|
98
|
-
if (context.scopeId && context.slotted !== false) args.push(`"${context.scopeId}-s"`);
|
|
99
|
-
let method = SSR_RENDER_SLOT;
|
|
100
|
-
let parent = context.parent;
|
|
101
|
-
if (parent) {
|
|
102
|
-
const children = parent.children;
|
|
103
|
-
if (parent.type === 10) parent = context.grandParent;
|
|
104
|
-
let componentType;
|
|
105
|
-
if (parent.type === 1 && parent.tagType === 1 && ((componentType = (0, _vue_compiler_dom.resolveComponentType)(parent, context, true)) === _vue_compiler_dom.TRANSITION || componentType === _vue_compiler_dom.TRANSITION_GROUP) && children.filter((c) => c.type === 1).length === 1) {
|
|
106
|
-
method = SSR_RENDER_SLOT_INNER;
|
|
107
|
-
if (!(context.scopeId && context.slotted !== false)) args.push("null");
|
|
108
|
-
args.push("true");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
node.ssrCodegenNode = (0, _vue_compiler_dom.createCallExpression)(context.helper(method), args);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
function ssrProcessSlotOutlet(node, context) {
|
|
115
|
-
const renderCall = node.ssrCodegenNode;
|
|
116
|
-
if (node.children.length) {
|
|
117
|
-
const fallbackRenderFn = (0, _vue_compiler_dom.createFunctionExpression)([]);
|
|
118
|
-
fallbackRenderFn.body = processChildrenAsStatement(node, context);
|
|
119
|
-
renderCall.arguments[3] = fallbackRenderFn;
|
|
120
|
-
}
|
|
121
|
-
if (context.withSlotScopeId) {
|
|
122
|
-
const slotScopeId = renderCall.arguments[6];
|
|
123
|
-
renderCall.arguments[6] = slotScopeId ? `${slotScopeId} + _scopeId` : `_scopeId`;
|
|
124
|
-
}
|
|
125
|
-
context.pushStatement(node.ssrCodegenNode);
|
|
126
|
-
}
|
|
127
|
-
//#endregion
|
|
128
86
|
//#region packages/compiler-ssr/src/errors.ts
|
|
129
87
|
function createSSRCompilerError(code, loc) {
|
|
130
88
|
return (0, _vue_compiler_dom.createCompilerError)(code, loc, SSRErrorMessages);
|
|
@@ -189,7 +147,7 @@ function ssrProcessSuspense(node, context) {
|
|
|
189
147
|
const { slotsExp, wipSlots } = wipEntry;
|
|
190
148
|
for (let i = 0; i < wipSlots.length; i++) {
|
|
191
149
|
const slot = wipSlots[i];
|
|
192
|
-
slot.fn.body = processChildrenAsStatement(slot, context);
|
|
150
|
+
slot.fn.body = processChildrenAsStatement(slot, context, !!context.options.vapor);
|
|
193
151
|
}
|
|
194
152
|
context.pushStatement((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_SUSPENSE), [`_push`, slotsExp]));
|
|
195
153
|
}
|
|
@@ -225,7 +183,8 @@ const ssrTransformElement = (node, context) => {
|
|
|
225
183
|
} else if (node.tag === "input") {
|
|
226
184
|
const vModel = findVModel(node);
|
|
227
185
|
if (vModel) {
|
|
228
|
-
const
|
|
186
|
+
const tempId = `_temp${context.temps++}`;
|
|
187
|
+
const tempExp = (0, _vue_compiler_dom.createSimpleExpression)(tempId, false);
|
|
229
188
|
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
189
|
}
|
|
231
190
|
} else if (directives.length && !node.children.length) {
|
|
@@ -266,11 +225,13 @@ const ssrTransformElement = (node, context) => {
|
|
|
266
225
|
let attrName = key.content;
|
|
267
226
|
if (attrName === "key" || attrName === "ref") continue;
|
|
268
227
|
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
|
-
|
|
228
|
+
else if (attrName === "style") {
|
|
229
|
+
if (dynamicStyleBinding) mergeCall(dynamicStyleBinding, value);
|
|
230
|
+
else openTag.push(` style="`, dynamicStyleBinding = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_STYLE), [value]), `"`);
|
|
231
|
+
} else {
|
|
272
232
|
attrName = node.tag.indexOf("-") > 0 ? attrName : _vue_shared.propsToAttrMap[attrName] || attrName.toLowerCase();
|
|
273
233
|
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));
|
|
234
|
+
else if (attrName === "hidden") openTag.push((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_DYNAMIC_ATTR), [key, value]));
|
|
274
235
|
else if ((0, _vue_shared.isSSRSafeAttrName)(attrName)) openTag.push((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_ATTR), [key, value]));
|
|
275
236
|
else context.onError(createSSRCompilerError(65, key.loc));
|
|
276
237
|
}
|
|
@@ -302,8 +263,10 @@ const ssrTransformElement = (node, context) => {
|
|
|
302
263
|
};
|
|
303
264
|
function buildSSRProps(props, directives, context) {
|
|
304
265
|
let mergePropsArgs = [];
|
|
305
|
-
if (props)
|
|
306
|
-
|
|
266
|
+
if (props) {
|
|
267
|
+
if (props.type === 14) mergePropsArgs = props.arguments;
|
|
268
|
+
else mergePropsArgs.push(props);
|
|
269
|
+
}
|
|
307
270
|
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]));
|
|
308
271
|
return mergePropsArgs.length > 1 ? (0, _vue_compiler_dom.createCallExpression)(context.helper(_vue_compiler_dom.MERGE_PROPS), mergePropsArgs) : mergePropsArgs[0];
|
|
309
272
|
}
|
|
@@ -348,7 +311,8 @@ function ssrTransformTransitionGroup(node, context) {
|
|
|
348
311
|
return () => {
|
|
349
312
|
const tag = (0, _vue_compiler_dom.findProp)(node, "tag");
|
|
350
313
|
if (tag) {
|
|
351
|
-
const
|
|
314
|
+
const otherProps = node.props.filter((p) => p !== tag);
|
|
315
|
+
const { props, directives } = (0, _vue_compiler_dom.buildProps)(node, context, otherProps, true, false, true);
|
|
352
316
|
let propsExp = null;
|
|
353
317
|
if (props || directives.length) propsExp = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_ATTRS), [buildSSRProps(props, directives, context)]);
|
|
354
318
|
wipMap$2.set(node, {
|
|
@@ -361,6 +325,7 @@ function ssrTransformTransitionGroup(node, context) {
|
|
|
361
325
|
}
|
|
362
326
|
function ssrProcessTransitionGroup(node, context) {
|
|
363
327
|
const entry = wipMap$2.get(node);
|
|
328
|
+
const disableNestedFragments = !context.options.vapor;
|
|
364
329
|
if (entry) {
|
|
365
330
|
const { tag, propsExp, scopeId } = entry;
|
|
366
331
|
if (tag.type === 7) {
|
|
@@ -379,7 +344,7 @@ function ssrProcessTransitionGroup(node, context) {
|
|
|
379
344
|
* be patched using the same key map) so we need to account for that here
|
|
380
345
|
* by disabling nested fragment wrappers from being generated.
|
|
381
346
|
*/
|
|
382
|
-
|
|
347
|
+
disableNestedFragments,
|
|
383
348
|
/**
|
|
384
349
|
* TransitionGroup filters out comment children at runtime and thus
|
|
385
350
|
* doesn't expect comments to be present during hydration. We need to
|
|
@@ -396,10 +361,10 @@ function ssrProcessTransitionGroup(node, context) {
|
|
|
396
361
|
if (propsExp) context.pushStringPart(propsExp);
|
|
397
362
|
if (scopeId) context.pushStringPart(` ${scopeId}`);
|
|
398
363
|
context.pushStringPart(`>`);
|
|
399
|
-
processChildren(node, context, false,
|
|
364
|
+
processChildren(node, context, false, disableNestedFragments, true);
|
|
400
365
|
context.pushStringPart(`</${tag.value.content}>`);
|
|
401
366
|
}
|
|
402
|
-
} else processChildren(node, context, true,
|
|
367
|
+
} else processChildren(node, context, true, disableNestedFragments, true);
|
|
403
368
|
}
|
|
404
369
|
//#endregion
|
|
405
370
|
//#region packages/compiler-ssr/src/transforms/ssrTransformTransition.ts
|
|
@@ -449,8 +414,9 @@ const ssrTransformComponent = (node, context) => {
|
|
|
449
414
|
const wipEntries = [];
|
|
450
415
|
wipMap.set(node, wipEntries);
|
|
451
416
|
const buildSSRSlotFn = (props, _vForExp, children, loc) => {
|
|
417
|
+
const param0 = props && (0, _vue_compiler_dom.stringifyExpression)(props) || `_`;
|
|
452
418
|
const fn = (0, _vue_compiler_dom.createFunctionExpression)([
|
|
453
|
-
|
|
419
|
+
param0,
|
|
454
420
|
`_push`,
|
|
455
421
|
`_parent`,
|
|
456
422
|
`_scopeId`
|
|
@@ -483,15 +449,16 @@ const ssrTransformComponent = (node, context) => {
|
|
|
483
449
|
};
|
|
484
450
|
function ssrProcessComponent(node, context, parent) {
|
|
485
451
|
const component = componentTypeMap.get(node);
|
|
486
|
-
if (!node.ssrCodegenNode)
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
452
|
+
if (!node.ssrCodegenNode) {
|
|
453
|
+
if (component === _vue_compiler_dom.TELEPORT) return ssrProcessTeleport(node, context);
|
|
454
|
+
else if (component === _vue_compiler_dom.SUSPENSE) return ssrProcessSuspense(node, context);
|
|
455
|
+
else if (component === _vue_compiler_dom.TRANSITION_GROUP) return ssrProcessTransitionGroup(node, context);
|
|
456
|
+
else {
|
|
457
|
+
if (parent.type === WIP_SLOT) context.pushStringPart(``);
|
|
458
|
+
if (component === _vue_compiler_dom.TRANSITION) return ssrProcessTransition(node, context);
|
|
459
|
+
processChildren(node, context);
|
|
460
|
+
}
|
|
461
|
+
} else {
|
|
495
462
|
const wipEntries = wipMap.get(node) || [];
|
|
496
463
|
for (let i = 0; i < wipEntries.length; i++) {
|
|
497
464
|
const { fn, vnodeBranch } = wipEntries[i];
|
|
@@ -574,6 +541,48 @@ function clone(v) {
|
|
|
574
541
|
} else return v;
|
|
575
542
|
}
|
|
576
543
|
//#endregion
|
|
544
|
+
//#region packages/compiler-ssr/src/transforms/ssrTransformSlotOutlet.ts
|
|
545
|
+
const ssrTransformSlotOutlet = (node, context) => {
|
|
546
|
+
if ((0, _vue_compiler_dom.isSlotOutlet)(node)) {
|
|
547
|
+
const { slotName, slotProps } = (0, _vue_compiler_dom.processSlotOutlet)(node, context);
|
|
548
|
+
const args = [
|
|
549
|
+
`_ctx.$slots`,
|
|
550
|
+
slotName,
|
|
551
|
+
slotProps || `{}`,
|
|
552
|
+
`null`,
|
|
553
|
+
`_push`,
|
|
554
|
+
`_parent`
|
|
555
|
+
];
|
|
556
|
+
if (context.scopeId && context.slotted !== false) args.push(`"${context.scopeId}-s"`);
|
|
557
|
+
let method = SSR_RENDER_SLOT;
|
|
558
|
+
let parent = context.parent;
|
|
559
|
+
if (parent && !rawOptionsMap.get(context.root).vapor) {
|
|
560
|
+
const children = parent.children;
|
|
561
|
+
if (parent.type === 10) parent = context.grandParent;
|
|
562
|
+
let componentType;
|
|
563
|
+
if (parent.type === 1 && parent.tagType === 1 && ((componentType = (0, _vue_compiler_dom.resolveComponentType)(parent, context, true)) === _vue_compiler_dom.TRANSITION || componentType === _vue_compiler_dom.TRANSITION_GROUP) && children.filter((c) => c.type === 1).length === 1) {
|
|
564
|
+
method = SSR_RENDER_SLOT_INNER;
|
|
565
|
+
if (!(context.scopeId && context.slotted !== false)) args.push("null");
|
|
566
|
+
args.push("true");
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
node.ssrCodegenNode = (0, _vue_compiler_dom.createCallExpression)(context.helper(method), args);
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
function ssrProcessSlotOutlet(node, context) {
|
|
573
|
+
const renderCall = node.ssrCodegenNode;
|
|
574
|
+
if (node.children.length) {
|
|
575
|
+
const fallbackRenderFn = (0, _vue_compiler_dom.createFunctionExpression)([]);
|
|
576
|
+
fallbackRenderFn.body = processChildrenAsStatement(node, context);
|
|
577
|
+
renderCall.arguments[3] = fallbackRenderFn;
|
|
578
|
+
}
|
|
579
|
+
if (context.withSlotScopeId) {
|
|
580
|
+
const slotScopeId = renderCall.arguments[6];
|
|
581
|
+
renderCall.arguments[6] = slotScopeId ? `${slotScopeId} + _scopeId` : `_scopeId`;
|
|
582
|
+
}
|
|
583
|
+
context.pushStatement(node.ssrCodegenNode);
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
577
586
|
//#region packages/compiler-ssr/src/ssrCodegenTransform.ts
|
|
578
587
|
function ssrCodegenTransform(ast, options) {
|
|
579
588
|
const context = createSSRTransformContext(ast, options);
|
|
@@ -591,7 +600,7 @@ function ssrCodegenTransform(ast, options) {
|
|
|
591
600
|
}
|
|
592
601
|
processChildren(ast, context, ast.children.length > 1 && ast.children.some((c) => !(0, _vue_compiler_dom.isText)(c)));
|
|
593
602
|
ast.codegenNode = (0, _vue_compiler_dom.createBlockStatement)(context.body);
|
|
594
|
-
ast.ssrHelpers = Array.from(new Set([...Array.from(ast.helpers).filter((h) => h in ssrHelpers), ...context.helpers]));
|
|
603
|
+
ast.ssrHelpers = Array.from(/* @__PURE__ */ new Set([...Array.from(ast.helpers).filter((h) => h in ssrHelpers), ...context.helpers]));
|
|
595
604
|
ast.helpers = new Set(Array.from(ast.helpers).filter((h) => !(h in ssrHelpers)));
|
|
596
605
|
}
|
|
597
606
|
function createSSRTransformContext(root, options, helpers = /* @__PURE__ */ new Set(), withSlotScopeId = false) {
|
|
@@ -736,7 +745,6 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
736
745
|
default:
|
|
737
746
|
checkDuplicatedValue();
|
|
738
747
|
res.props = defaultProps;
|
|
739
|
-
break;
|
|
740
748
|
}
|
|
741
749
|
} else if ((0, _vue_compiler_dom.hasDynamicKeyVBind)(node)) {} else {
|
|
742
750
|
checkDuplicatedValue();
|
|
@@ -798,16 +806,18 @@ const ssrInjectCssVars = (node, context) => {
|
|
|
798
806
|
else injectCssVars(node);
|
|
799
807
|
};
|
|
800
808
|
function injectCssVars(node) {
|
|
801
|
-
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !(0, _vue_compiler_dom.findDir)(node, "for"))
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
809
|
+
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !(0, _vue_compiler_dom.findDir)(node, "for")) {
|
|
810
|
+
if (node.tag === "suspense" || node.tag === "Suspense") for (const child of node.children) if (child.type === 1 && child.tagType === 3) child.children.forEach(injectCssVars);
|
|
811
|
+
else injectCssVars(child);
|
|
812
|
+
else node.props.push({
|
|
813
|
+
type: 7,
|
|
814
|
+
name: "bind",
|
|
815
|
+
arg: void 0,
|
|
816
|
+
exp: (0, _vue_compiler_dom.createSimpleExpression)(`_cssVars`, false),
|
|
817
|
+
modifiers: [],
|
|
818
|
+
loc: _vue_compiler_dom.locStub
|
|
819
|
+
});
|
|
820
|
+
}
|
|
811
821
|
}
|
|
812
822
|
//#endregion
|
|
813
823
|
//#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.11",
|
|
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.11",
|
|
32
|
+
"@vue/compiler-dom": "3.6.0-rc.11"
|
|
33
33
|
}
|
|
34
34
|
}
|