@vue/server-renderer 3.5.17 → 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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.
|
|
2
|
+
* @vue/server-renderer v3.6.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { createVNode, ssrUtils, ssrContextKey, warn as warn$2, Fragment, Static, Comment, Text, mergeProps, createApp, initDirectivesForSSR } from 'vue';
|
|
7
|
-
import { makeMap, isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, isArray, toDisplayString, isFunction, EMPTY_OBJ,
|
|
6
|
+
import { createVNode as createVNode$1, ssrUtils, ssrContextKey, warn as warn$2, Fragment as Fragment$1, Static, Comment as Comment$1, Text as Text$1, mergeProps as mergeProps$1, createApp, initDirectivesForSSR } from 'vue';
|
|
7
|
+
import { makeMap, isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, isArray, isObject, normalizeCssVarValue, toDisplayString, isFunction, EMPTY_OBJ, extend, NOOP, looseEqual, looseIndexOf, escapeHtmlComment, isPromise, isVoidTag } from '@vue/shared';
|
|
8
8
|
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
|
9
9
|
|
|
10
10
|
const shouldIgnoreProp = /* @__PURE__ */ makeMap(
|
|
@@ -61,13 +61,27 @@ function ssrRenderStyle(raw) {
|
|
|
61
61
|
if (isString(raw)) {
|
|
62
62
|
return escapeHtml(raw);
|
|
63
63
|
}
|
|
64
|
-
const styles = normalizeStyle(raw);
|
|
64
|
+
const styles = normalizeStyle(ssrResetCssVars(raw));
|
|
65
65
|
return escapeHtml(stringifyStyle(styles));
|
|
66
66
|
}
|
|
67
|
+
function ssrResetCssVars(raw) {
|
|
68
|
+
if (!isArray(raw) && isObject(raw)) {
|
|
69
|
+
const res = {};
|
|
70
|
+
for (const key in raw) {
|
|
71
|
+
if (key.startsWith(":--")) {
|
|
72
|
+
res[key.slice(1)] = normalizeCssVarValue(raw[key]);
|
|
73
|
+
} else {
|
|
74
|
+
res[key] = raw[key];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return res;
|
|
78
|
+
}
|
|
79
|
+
return raw;
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
|
69
83
|
return renderComponentVNode(
|
|
70
|
-
createVNode(comp, props, children),
|
|
84
|
+
createVNode$1(comp, props, children),
|
|
71
85
|
parentComponent,
|
|
72
86
|
slotScopeId
|
|
73
87
|
);
|
|
@@ -177,6 +191,15 @@ function ssrInterpolate(value) {
|
|
|
177
191
|
return escapeHtml(toDisplayString(value));
|
|
178
192
|
}
|
|
179
193
|
|
|
194
|
+
let activeSub = void 0;
|
|
195
|
+
function setActiveSub(sub) {
|
|
196
|
+
try {
|
|
197
|
+
return activeSub;
|
|
198
|
+
} finally {
|
|
199
|
+
activeSub = sub;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
180
203
|
function isProxy(value) {
|
|
181
204
|
return value ? !!value["__v_raw"] : false;
|
|
182
205
|
}
|
|
@@ -190,8 +213,8 @@ function isRef(r) {
|
|
|
190
213
|
}
|
|
191
214
|
|
|
192
215
|
const stack = [];
|
|
193
|
-
function pushWarningContext$1(
|
|
194
|
-
stack.push(
|
|
216
|
+
function pushWarningContext$1(ctx) {
|
|
217
|
+
stack.push(ctx);
|
|
195
218
|
}
|
|
196
219
|
function popWarningContext$1() {
|
|
197
220
|
stack.pop();
|
|
@@ -200,7 +223,9 @@ let isWarning = false;
|
|
|
200
223
|
function warn$1(msg, ...args) {
|
|
201
224
|
if (isWarning) return;
|
|
202
225
|
isWarning = true;
|
|
203
|
-
const
|
|
226
|
+
const prevSub = setActiveSub();
|
|
227
|
+
const entry = stack.length ? stack[stack.length - 1] : null;
|
|
228
|
+
const instance = isVNode$2(entry) ? entry.component : entry;
|
|
204
229
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
205
230
|
const trace = getComponentTrace();
|
|
206
231
|
if (appWarnHandler) {
|
|
@@ -214,9 +239,9 @@ function warn$1(msg, ...args) {
|
|
|
214
239
|
var _a, _b;
|
|
215
240
|
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
216
241
|
}).join(""),
|
|
217
|
-
instance && instance.proxy,
|
|
242
|
+
instance && instance.proxy || instance,
|
|
218
243
|
trace.map(
|
|
219
|
-
({
|
|
244
|
+
({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
|
|
220
245
|
).join("\n"),
|
|
221
246
|
trace
|
|
222
247
|
]
|
|
@@ -230,26 +255,31 @@ function warn$1(msg, ...args) {
|
|
|
230
255
|
}
|
|
231
256
|
console.warn(...warnArgs);
|
|
232
257
|
}
|
|
258
|
+
setActiveSub(prevSub);
|
|
233
259
|
isWarning = false;
|
|
234
260
|
}
|
|
235
261
|
function getComponentTrace() {
|
|
236
|
-
let
|
|
237
|
-
if (!
|
|
262
|
+
let currentCtx = stack[stack.length - 1];
|
|
263
|
+
if (!currentCtx) {
|
|
238
264
|
return [];
|
|
239
265
|
}
|
|
240
266
|
const normalizedStack = [];
|
|
241
|
-
while (
|
|
267
|
+
while (currentCtx) {
|
|
242
268
|
const last = normalizedStack[0];
|
|
243
|
-
if (last && last.
|
|
269
|
+
if (last && last.ctx === currentCtx) {
|
|
244
270
|
last.recurseCount++;
|
|
245
271
|
} else {
|
|
246
272
|
normalizedStack.push({
|
|
247
|
-
|
|
273
|
+
ctx: currentCtx,
|
|
248
274
|
recurseCount: 0
|
|
249
275
|
});
|
|
250
276
|
}
|
|
251
|
-
|
|
252
|
-
|
|
277
|
+
if (isVNode$2(currentCtx)) {
|
|
278
|
+
const parent = currentCtx.component && currentCtx.component.parent;
|
|
279
|
+
currentCtx = parent && parent.vnode || parent;
|
|
280
|
+
} else {
|
|
281
|
+
currentCtx = currentCtx.parent;
|
|
282
|
+
}
|
|
253
283
|
}
|
|
254
284
|
return normalizedStack;
|
|
255
285
|
}
|
|
@@ -261,16 +291,13 @@ function formatTrace(trace) {
|
|
|
261
291
|
});
|
|
262
292
|
return logs;
|
|
263
293
|
}
|
|
264
|
-
function formatTraceEntry({
|
|
294
|
+
function formatTraceEntry({ ctx, recurseCount }) {
|
|
265
295
|
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
vnode.type,
|
|
270
|
-
isRoot
|
|
271
|
-
)}`;
|
|
296
|
+
const instance = isVNode$2(ctx) ? ctx.component : ctx;
|
|
297
|
+
const isRoot = instance ? instance.parent == null : false;
|
|
298
|
+
const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
|
|
272
299
|
const close = `>` + postfix;
|
|
273
|
-
return
|
|
300
|
+
return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
|
|
274
301
|
}
|
|
275
302
|
function formatProps(props) {
|
|
276
303
|
const res = [];
|
|
@@ -341,11 +368,10 @@ function callWithErrorHandling(fn, instance, type, args) {
|
|
|
341
368
|
}
|
|
342
369
|
}
|
|
343
370
|
function handleError(err, instance, type, throwInDev = true) {
|
|
344
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
345
371
|
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
346
372
|
if (instance) {
|
|
347
373
|
let cur = instance.parent;
|
|
348
|
-
const exposedInstance = instance.proxy;
|
|
374
|
+
const exposedInstance = instance.proxy || instance;
|
|
349
375
|
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
|
|
350
376
|
while (cur) {
|
|
351
377
|
const errorCapturedHooks = cur.ec;
|
|
@@ -359,24 +385,26 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
359
385
|
cur = cur.parent;
|
|
360
386
|
}
|
|
361
387
|
if (errorHandler) {
|
|
388
|
+
const prevSub = setActiveSub();
|
|
362
389
|
callWithErrorHandling(errorHandler, null, 10, [
|
|
363
390
|
err,
|
|
364
391
|
exposedInstance,
|
|
365
392
|
errorInfo
|
|
366
393
|
]);
|
|
394
|
+
setActiveSub(prevSub);
|
|
367
395
|
return;
|
|
368
396
|
}
|
|
369
397
|
}
|
|
370
|
-
logError(err, type,
|
|
398
|
+
logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
|
|
371
399
|
}
|
|
372
|
-
function logError(err, type,
|
|
400
|
+
function logError(err, type, instance, throwInDev = true, throwInProd = false) {
|
|
373
401
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
374
402
|
const info = ErrorTypeStrings[type];
|
|
375
|
-
if (
|
|
376
|
-
pushWarningContext$1(
|
|
403
|
+
if (instance) {
|
|
404
|
+
pushWarningContext$1(instance);
|
|
377
405
|
}
|
|
378
406
|
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
379
|
-
if (
|
|
407
|
+
if (instance) {
|
|
380
408
|
popWarningContext$1();
|
|
381
409
|
}
|
|
382
410
|
if (throwInDev) {
|
|
@@ -424,26 +452,284 @@ function setDevtoolsHook(hook, target) {
|
|
|
424
452
|
}
|
|
425
453
|
}
|
|
426
454
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
455
|
+
let currentRenderingInstance = null;
|
|
456
|
+
let currentScopeId = null;
|
|
457
|
+
|
|
458
|
+
const isTeleport = (type) => type.__isTeleport;
|
|
459
|
+
|
|
460
|
+
function setTransitionHooks(vnode, hooks) {
|
|
461
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
462
|
+
vnode.transition = hooks;
|
|
463
|
+
setTransitionHooks(vnode.component.subTree, hooks);
|
|
464
|
+
} else if (vnode.shapeFlag & 128) {
|
|
465
|
+
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
466
|
+
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
467
|
+
} else {
|
|
468
|
+
vnode.transition = hooks;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
473
|
+
|
|
474
|
+
const internalObjectProto = {};
|
|
475
|
+
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
476
|
+
|
|
477
|
+
const isSuspense = (type) => type.__isSuspense;
|
|
478
|
+
|
|
479
|
+
const Fragment = Symbol.for("v-fgt");
|
|
480
|
+
const Text = Symbol.for("v-txt");
|
|
481
|
+
const Comment = Symbol.for("v-cmt");
|
|
482
|
+
function isVNode$2(value) {
|
|
483
|
+
return value ? value.__v_isVNode === true : false;
|
|
484
|
+
}
|
|
485
|
+
const createVNodeWithArgsTransform = (...args) => {
|
|
486
|
+
return _createVNode(
|
|
487
|
+
...args
|
|
441
488
|
);
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
489
|
+
};
|
|
490
|
+
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
491
|
+
const normalizeRef = ({
|
|
492
|
+
ref,
|
|
493
|
+
ref_key,
|
|
494
|
+
ref_for
|
|
495
|
+
}) => {
|
|
496
|
+
if (typeof ref === "number") {
|
|
497
|
+
ref = "" + ref;
|
|
498
|
+
}
|
|
499
|
+
return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
|
500
|
+
};
|
|
501
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
502
|
+
const vnode = {
|
|
503
|
+
__v_isVNode: true,
|
|
504
|
+
__v_skip: true,
|
|
505
|
+
type,
|
|
506
|
+
props,
|
|
507
|
+
key: props && normalizeKey(props),
|
|
508
|
+
ref: props && normalizeRef(props),
|
|
509
|
+
scopeId: currentScopeId,
|
|
510
|
+
slotScopeIds: null,
|
|
511
|
+
children,
|
|
512
|
+
component: null,
|
|
513
|
+
suspense: null,
|
|
514
|
+
ssContent: null,
|
|
515
|
+
ssFallback: null,
|
|
516
|
+
dirs: null,
|
|
517
|
+
transition: null,
|
|
518
|
+
el: null,
|
|
519
|
+
anchor: null,
|
|
520
|
+
target: null,
|
|
521
|
+
targetStart: null,
|
|
522
|
+
targetAnchor: null,
|
|
523
|
+
staticCount: 0,
|
|
524
|
+
shapeFlag,
|
|
525
|
+
patchFlag,
|
|
526
|
+
dynamicProps,
|
|
527
|
+
dynamicChildren: null,
|
|
528
|
+
appContext: null,
|
|
529
|
+
ctx: currentRenderingInstance
|
|
530
|
+
};
|
|
531
|
+
if (needFullChildrenNormalization) {
|
|
532
|
+
normalizeChildren(vnode, children);
|
|
533
|
+
if (shapeFlag & 128) {
|
|
534
|
+
type.normalize(vnode);
|
|
535
|
+
}
|
|
536
|
+
} else if (children) {
|
|
537
|
+
vnode.shapeFlag |= isString(children) ? 8 : 16;
|
|
538
|
+
}
|
|
539
|
+
if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
|
|
540
|
+
warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
541
|
+
}
|
|
542
|
+
return vnode;
|
|
543
|
+
}
|
|
544
|
+
const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
|
|
545
|
+
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
546
|
+
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
547
|
+
if (!!(process.env.NODE_ENV !== "production") && !type) {
|
|
548
|
+
warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
|
549
|
+
}
|
|
550
|
+
type = Comment;
|
|
551
|
+
}
|
|
552
|
+
if (isVNode$2(type)) {
|
|
553
|
+
const cloned = cloneVNode(
|
|
554
|
+
type,
|
|
555
|
+
props,
|
|
556
|
+
true
|
|
557
|
+
/* mergeRef: true */
|
|
558
|
+
);
|
|
559
|
+
if (children) {
|
|
560
|
+
normalizeChildren(cloned, children);
|
|
561
|
+
}
|
|
562
|
+
cloned.patchFlag = -2;
|
|
563
|
+
return cloned;
|
|
564
|
+
}
|
|
565
|
+
if (isClassComponent(type)) {
|
|
566
|
+
type = type.__vccOpts;
|
|
567
|
+
}
|
|
568
|
+
if (props) {
|
|
569
|
+
props = guardReactiveProps(props);
|
|
570
|
+
let { class: klass, style } = props;
|
|
571
|
+
if (klass && !isString(klass)) {
|
|
572
|
+
props.class = normalizeClass(klass);
|
|
573
|
+
}
|
|
574
|
+
if (isObject(style)) {
|
|
575
|
+
if (isProxy(style) && !isArray(style)) {
|
|
576
|
+
style = extend({}, style);
|
|
577
|
+
}
|
|
578
|
+
props.style = normalizeStyle(style);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
|
582
|
+
if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
|
|
583
|
+
type = toRaw(type);
|
|
584
|
+
warn$1(
|
|
585
|
+
`Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
|
|
586
|
+
`
|
|
587
|
+
Component that was made reactive: `,
|
|
588
|
+
type
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
return createBaseVNode(
|
|
592
|
+
type,
|
|
593
|
+
props,
|
|
594
|
+
children,
|
|
595
|
+
patchFlag,
|
|
596
|
+
dynamicProps,
|
|
597
|
+
shapeFlag,
|
|
598
|
+
isBlockNode,
|
|
599
|
+
true
|
|
445
600
|
);
|
|
446
601
|
}
|
|
602
|
+
function guardReactiveProps(props) {
|
|
603
|
+
if (!props) return null;
|
|
604
|
+
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
|
605
|
+
}
|
|
606
|
+
function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
|
|
607
|
+
const { props, ref, patchFlag, children, transition } = vnode;
|
|
608
|
+
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
609
|
+
const cloned = {
|
|
610
|
+
__v_isVNode: true,
|
|
611
|
+
__v_skip: true,
|
|
612
|
+
type: vnode.type,
|
|
613
|
+
props: mergedProps,
|
|
614
|
+
key: mergedProps && normalizeKey(mergedProps),
|
|
615
|
+
ref: extraProps && extraProps.ref ? (
|
|
616
|
+
// #2078 in the case of <component :is="vnode" ref="extra"/>
|
|
617
|
+
// if the vnode itself already has a ref, cloneVNode will need to merge
|
|
618
|
+
// the refs so the single vnode can be set on multiple refs
|
|
619
|
+
mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
|
620
|
+
) : ref,
|
|
621
|
+
scopeId: vnode.scopeId,
|
|
622
|
+
slotScopeIds: vnode.slotScopeIds,
|
|
623
|
+
children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
|
|
624
|
+
target: vnode.target,
|
|
625
|
+
targetStart: vnode.targetStart,
|
|
626
|
+
targetAnchor: vnode.targetAnchor,
|
|
627
|
+
staticCount: vnode.staticCount,
|
|
628
|
+
shapeFlag: vnode.shapeFlag,
|
|
629
|
+
// if the vnode is cloned with extra props, we can no longer assume its
|
|
630
|
+
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
631
|
+
// note: preserve flag for fragments since they use the flag for children
|
|
632
|
+
// fast paths only.
|
|
633
|
+
patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
|
634
|
+
dynamicProps: vnode.dynamicProps,
|
|
635
|
+
dynamicChildren: vnode.dynamicChildren,
|
|
636
|
+
appContext: vnode.appContext,
|
|
637
|
+
dirs: vnode.dirs,
|
|
638
|
+
transition,
|
|
639
|
+
// These should technically only be non-null on mounted VNodes. However,
|
|
640
|
+
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
641
|
+
// them since them being non-null during a mount doesn't affect the logic as
|
|
642
|
+
// they will simply be overwritten.
|
|
643
|
+
component: vnode.component,
|
|
644
|
+
suspense: vnode.suspense,
|
|
645
|
+
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
646
|
+
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
647
|
+
el: vnode.el,
|
|
648
|
+
anchor: vnode.anchor,
|
|
649
|
+
ctx: vnode.ctx,
|
|
650
|
+
ce: vnode.ce
|
|
651
|
+
};
|
|
652
|
+
if (transition && cloneTransition) {
|
|
653
|
+
setTransitionHooks(
|
|
654
|
+
cloned,
|
|
655
|
+
transition.clone(cloned)
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
return cloned;
|
|
659
|
+
}
|
|
660
|
+
function deepCloneVNode(vnode) {
|
|
661
|
+
const cloned = cloneVNode(vnode);
|
|
662
|
+
if (isArray(vnode.children)) {
|
|
663
|
+
cloned.children = vnode.children.map(deepCloneVNode);
|
|
664
|
+
}
|
|
665
|
+
return cloned;
|
|
666
|
+
}
|
|
667
|
+
function createTextVNode(text = " ", flag = 0) {
|
|
668
|
+
return createVNode(Text, null, text, flag);
|
|
669
|
+
}
|
|
670
|
+
function normalizeChildren(vnode, children) {
|
|
671
|
+
let type = 0;
|
|
672
|
+
const { shapeFlag } = vnode;
|
|
673
|
+
if (children == null) {
|
|
674
|
+
children = null;
|
|
675
|
+
} else if (isArray(children)) {
|
|
676
|
+
type = 16;
|
|
677
|
+
} else if (typeof children === "object") {
|
|
678
|
+
if (shapeFlag & (1 | 64)) {
|
|
679
|
+
const slot = children.default;
|
|
680
|
+
if (slot) {
|
|
681
|
+
slot._c && (slot._d = false);
|
|
682
|
+
normalizeChildren(vnode, slot());
|
|
683
|
+
slot._c && (slot._d = true);
|
|
684
|
+
}
|
|
685
|
+
return;
|
|
686
|
+
} else {
|
|
687
|
+
type = 32;
|
|
688
|
+
const slotFlag = children._;
|
|
689
|
+
if (!slotFlag && !isInternalObject(children)) {
|
|
690
|
+
children._ctx = currentRenderingInstance;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
} else if (isFunction(children)) {
|
|
694
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
695
|
+
type = 32;
|
|
696
|
+
} else {
|
|
697
|
+
children = String(children);
|
|
698
|
+
if (shapeFlag & 64) {
|
|
699
|
+
type = 16;
|
|
700
|
+
children = [createTextVNode(children)];
|
|
701
|
+
} else {
|
|
702
|
+
type = 8;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
vnode.children = children;
|
|
706
|
+
vnode.shapeFlag |= type;
|
|
707
|
+
}
|
|
708
|
+
function mergeProps(...args) {
|
|
709
|
+
const ret = {};
|
|
710
|
+
for (let i = 0; i < args.length; i++) {
|
|
711
|
+
const toMerge = args[i];
|
|
712
|
+
for (const key in toMerge) {
|
|
713
|
+
if (key === "class") {
|
|
714
|
+
if (ret.class !== toMerge.class) {
|
|
715
|
+
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
716
|
+
}
|
|
717
|
+
} else if (key === "style") {
|
|
718
|
+
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
719
|
+
} else if (isOn(key)) {
|
|
720
|
+
const existing = ret[key];
|
|
721
|
+
const incoming = toMerge[key];
|
|
722
|
+
if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
|
|
723
|
+
ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
724
|
+
}
|
|
725
|
+
} else if (key !== "") {
|
|
726
|
+
ret[key] = toMerge[key];
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return ret;
|
|
731
|
+
}
|
|
732
|
+
|
|
447
733
|
!!(process.env.NODE_ENV !== "production") ? {
|
|
448
734
|
} : {
|
|
449
735
|
};
|
|
@@ -713,10 +999,10 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
713
999
|
vnode.props = applySSRDirectives(vnode, props, dirs);
|
|
714
1000
|
}
|
|
715
1001
|
switch (type) {
|
|
716
|
-
case Text:
|
|
1002
|
+
case Text$1:
|
|
717
1003
|
push(escapeHtml(children));
|
|
718
1004
|
break;
|
|
719
|
-
case Comment:
|
|
1005
|
+
case Comment$1:
|
|
720
1006
|
push(
|
|
721
1007
|
children ? `<!--${escapeHtmlComment(children)}-->` : `<!---->`
|
|
722
1008
|
);
|
|
@@ -724,7 +1010,7 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
724
1010
|
case Static:
|
|
725
1011
|
push(children);
|
|
726
1012
|
break;
|
|
727
|
-
case Fragment:
|
|
1013
|
+
case Fragment$1:
|
|
728
1014
|
if (vnode.slotScopeIds) {
|
|
729
1015
|
slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
|
|
730
1016
|
}
|
|
@@ -824,7 +1110,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
|
|
|
824
1110
|
if (props) toMerge.push(props);
|
|
825
1111
|
}
|
|
826
1112
|
}
|
|
827
|
-
return mergeProps(rawProps || {}, ...toMerge);
|
|
1113
|
+
return mergeProps$1(rawProps || {}, ...toMerge);
|
|
828
1114
|
}
|
|
829
1115
|
function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
830
1116
|
const target = vnode.props && vnode.props.to;
|
|
@@ -905,7 +1191,7 @@ async function renderToString(input, context = {}) {
|
|
|
905
1191
|
if (isVNode$1(input)) {
|
|
906
1192
|
return renderToString(createApp({ render: () => input }), context);
|
|
907
1193
|
}
|
|
908
|
-
const vnode = createVNode(input._component, input._props);
|
|
1194
|
+
const vnode = createVNode$1(input._component, input._props);
|
|
909
1195
|
vnode.appContext = input._context;
|
|
910
1196
|
input.provide(ssrContextKey, context);
|
|
911
1197
|
const buffer = await renderComponentVNode(vnode);
|
|
@@ -965,7 +1251,7 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
965
1251
|
stream
|
|
966
1252
|
);
|
|
967
1253
|
}
|
|
968
|
-
const vnode = createVNode(input._component, input._props);
|
|
1254
|
+
const vnode = createVNode$1(input._component, input._props);
|
|
969
1255
|
vnode.appContext = input._context;
|
|
970
1256
|
input.provide(ssrContextKey, context);
|
|
971
1257
|
Promise.resolve(renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/server-renderer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0-alpha.2",
|
|
4
4
|
"description": "@vue/server-renderer",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/server-renderer.esm-bundler.js",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"vue": "3.
|
|
49
|
+
"vue": "3.6.0-alpha.2"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@vue/
|
|
53
|
-
"@vue/
|
|
52
|
+
"@vue/compiler-ssr": "3.6.0-alpha.2",
|
|
53
|
+
"@vue/shared": "3.6.0-alpha.2"
|
|
54
54
|
}
|
|
55
55
|
}
|