@vue/server-renderer 3.2.33 → 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/server-renderer.cjs.js +93 -121
- package/dist/server-renderer.cjs.prod.js +93 -121
- package/dist/server-renderer.d.ts +2 -0
- package/dist/server-renderer.esm-bundler.js +92 -121
- package/package.json +4 -4
|
@@ -6,31 +6,6 @@ var vue = require('vue');
|
|
|
6
6
|
var shared = require('@vue/shared');
|
|
7
7
|
var compilerSsr = require('@vue/compiler-ssr');
|
|
8
8
|
|
|
9
|
-
/*! *****************************************************************************
|
|
10
|
-
Copyright (c) Microsoft Corporation.
|
|
11
|
-
|
|
12
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
13
|
-
purpose with or without fee is hereby granted.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
18
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
-
***************************************************************************** */
|
|
23
|
-
|
|
24
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
25
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
26
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
27
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
28
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
29
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
30
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
9
|
// leading comma for empty string ""
|
|
35
10
|
const shouldIgnoreProp = shared.makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
|
|
36
11
|
function ssrRenderAttrs(props, tag) {
|
|
@@ -244,7 +219,7 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
244
219
|
const scopeId = cur.vnode.scopeId;
|
|
245
220
|
if (scopeId) {
|
|
246
221
|
if (!hasCloned) {
|
|
247
|
-
attrs =
|
|
222
|
+
attrs = { ...attrs };
|
|
248
223
|
hasCloned = true;
|
|
249
224
|
}
|
|
250
225
|
attrs[scopeId] = '';
|
|
@@ -261,7 +236,7 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
261
236
|
}
|
|
262
237
|
if (slotScopeId) {
|
|
263
238
|
if (!hasCloned)
|
|
264
|
-
attrs =
|
|
239
|
+
attrs = { ...attrs };
|
|
265
240
|
attrs[slotScopeId.trim()] = '';
|
|
266
241
|
}
|
|
267
242
|
// set current rendering instance for asset resolution
|
|
@@ -275,7 +250,8 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
275
250
|
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance, slotScopeId);
|
|
276
251
|
}
|
|
277
252
|
else {
|
|
278
|
-
|
|
253
|
+
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
|
254
|
+
vue.warn(`Component ${componentName} is missing template or render function.`);
|
|
279
255
|
push(`<!---->`);
|
|
280
256
|
}
|
|
281
257
|
}
|
|
@@ -396,7 +372,9 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
396
372
|
const target = vnode.props && vnode.props.to;
|
|
397
373
|
const disabled = vnode.props && vnode.props.disabled;
|
|
398
374
|
if (!target) {
|
|
399
|
-
|
|
375
|
+
if (!disabled) {
|
|
376
|
+
vue.warn(`[@vue/server-renderer] Teleport is missing target prop.`);
|
|
377
|
+
}
|
|
400
378
|
return [];
|
|
401
379
|
}
|
|
402
380
|
if (!shared.isString(target)) {
|
|
@@ -409,30 +387,28 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
409
387
|
}
|
|
410
388
|
|
|
411
389
|
const { isVNode } = vue.ssrUtils;
|
|
412
|
-
function unrollBuffer(buffer) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
ret += yield unrollBuffer(item);
|
|
426
|
-
}
|
|
390
|
+
async function unrollBuffer(buffer) {
|
|
391
|
+
if (buffer.hasAsync) {
|
|
392
|
+
let ret = '';
|
|
393
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
394
|
+
let item = buffer[i];
|
|
395
|
+
if (shared.isPromise(item)) {
|
|
396
|
+
item = await item;
|
|
397
|
+
}
|
|
398
|
+
if (shared.isString(item)) {
|
|
399
|
+
ret += item;
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
ret += await unrollBuffer(item);
|
|
427
403
|
}
|
|
428
|
-
return ret;
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
432
|
-
// ticks
|
|
433
|
-
return unrollBufferSync(buffer);
|
|
434
404
|
}
|
|
435
|
-
|
|
405
|
+
return ret;
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
409
|
+
// ticks
|
|
410
|
+
return unrollBufferSync(buffer);
|
|
411
|
+
}
|
|
436
412
|
}
|
|
437
413
|
function unrollBufferSync(buffer) {
|
|
438
414
|
let ret = '';
|
|
@@ -448,58 +424,53 @@ function unrollBufferSync(buffer) {
|
|
|
448
424
|
}
|
|
449
425
|
return ret;
|
|
450
426
|
}
|
|
451
|
-
function renderToString(input, context = {}) {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
});
|
|
427
|
+
async function renderToString(input, context = {}) {
|
|
428
|
+
if (isVNode(input)) {
|
|
429
|
+
// raw vnode, wrap with app (for context)
|
|
430
|
+
return renderToString(vue.createApp({ render: () => input }), context);
|
|
431
|
+
}
|
|
432
|
+
// rendering an app
|
|
433
|
+
const vnode = vue.createVNode(input._component, input._props);
|
|
434
|
+
vnode.appContext = input._context;
|
|
435
|
+
// provide the ssr context to the tree
|
|
436
|
+
input.provide(vue.ssrContextKey, context);
|
|
437
|
+
const buffer = await renderComponentVNode(vnode);
|
|
438
|
+
const result = await unrollBuffer(buffer);
|
|
439
|
+
await resolveTeleports(context);
|
|
440
|
+
return result;
|
|
466
441
|
}
|
|
467
|
-
function resolveTeleports(context) {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
context.teleports[key] = yield unrollBuffer((yield Promise.all(context.__teleportBuffers[key])));
|
|
475
|
-
}
|
|
442
|
+
async function resolveTeleports(context) {
|
|
443
|
+
if (context.__teleportBuffers) {
|
|
444
|
+
context.teleports = context.teleports || {};
|
|
445
|
+
for (const key in context.__teleportBuffers) {
|
|
446
|
+
// note: it's OK to await sequentially here because the Promises were
|
|
447
|
+
// created eagerly in parallel.
|
|
448
|
+
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
|
|
476
449
|
}
|
|
477
|
-
}
|
|
450
|
+
}
|
|
478
451
|
}
|
|
479
452
|
|
|
480
453
|
const { isVNode: isVNode$1 } = vue.ssrUtils;
|
|
481
|
-
function unrollBuffer$1(buffer, stream) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
yield unrollBuffer$1(item, stream);
|
|
494
|
-
}
|
|
454
|
+
async function unrollBuffer$1(buffer, stream) {
|
|
455
|
+
if (buffer.hasAsync) {
|
|
456
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
457
|
+
let item = buffer[i];
|
|
458
|
+
if (shared.isPromise(item)) {
|
|
459
|
+
item = await item;
|
|
460
|
+
}
|
|
461
|
+
if (shared.isString(item)) {
|
|
462
|
+
stream.push(item);
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
await unrollBuffer$1(item, stream);
|
|
495
466
|
}
|
|
496
467
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
471
|
+
// ticks
|
|
472
|
+
unrollBufferSync$1(buffer, stream);
|
|
473
|
+
}
|
|
503
474
|
}
|
|
504
475
|
function unrollBufferSync$1(buffer, stream) {
|
|
505
476
|
for (let i = 0; i < buffer.length; i++) {
|
|
@@ -525,6 +496,7 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
525
496
|
input.provide(vue.ssrContextKey, context);
|
|
526
497
|
Promise.resolve(renderComponentVNode(vnode))
|
|
527
498
|
.then(buffer => unrollBuffer$1(buffer, stream))
|
|
499
|
+
.then(() => resolveTeleports(context))
|
|
528
500
|
.then(() => stream.push(null))
|
|
529
501
|
.catch(error => {
|
|
530
502
|
stream.destroy(error);
|
|
@@ -539,7 +511,7 @@ function renderToStream(input, context = {}) {
|
|
|
539
511
|
return renderToNodeStream(input, context);
|
|
540
512
|
}
|
|
541
513
|
function renderToNodeStream(input, context = {}) {
|
|
542
|
-
const stream = new (require('stream').Readable)()
|
|
514
|
+
const stream = new (require('stream').Readable)({ read() { } })
|
|
543
515
|
;
|
|
544
516
|
if (!stream) {
|
|
545
517
|
throw new Error(`ESM build of renderToStream() does not support renderToNodeStream(). ` +
|
|
@@ -604,18 +576,16 @@ function pipeToWebWritable(input, context = {}, writable) {
|
|
|
604
576
|
}
|
|
605
577
|
catch (e) { }
|
|
606
578
|
renderToSimpleStream(input, context, {
|
|
607
|
-
push(content) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
});
|
|
579
|
+
async push(content) {
|
|
580
|
+
if (hasReady) {
|
|
581
|
+
await writer.ready;
|
|
582
|
+
}
|
|
583
|
+
if (content != null) {
|
|
584
|
+
return writer.write(encoder.encode(content));
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
return writer.close();
|
|
588
|
+
}
|
|
619
589
|
},
|
|
620
590
|
destroy(err) {
|
|
621
591
|
// TODO better error handling?
|
|
@@ -632,6 +602,10 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
|
|
|
632
602
|
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
633
603
|
// template-compiled slots are always rendered as fragments
|
|
634
604
|
push(`<!--[-->`);
|
|
605
|
+
ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId);
|
|
606
|
+
push(`<!--]-->`);
|
|
607
|
+
}
|
|
608
|
+
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
635
609
|
const slotFn = slots[slotName];
|
|
636
610
|
if (slotFn) {
|
|
637
611
|
const slotBuffer = [];
|
|
@@ -668,11 +642,10 @@ function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, paren
|
|
|
668
642
|
else if (fallbackRenderFn) {
|
|
669
643
|
fallbackRenderFn();
|
|
670
644
|
}
|
|
671
|
-
push(`<!--]-->`);
|
|
672
645
|
}
|
|
673
|
-
const commentRE =
|
|
646
|
+
const commentRE = /<!--.*?-->/g;
|
|
674
647
|
function isComment(item) {
|
|
675
|
-
return typeof item === 'string' && commentRE.
|
|
648
|
+
return typeof item === 'string' && !item.replace(commentRE, '').trim();
|
|
676
649
|
}
|
|
677
650
|
|
|
678
651
|
function ssrInterpolate(value) {
|
|
@@ -952,15 +925,13 @@ function ssrRenderList(source, renderItem) {
|
|
|
952
925
|
}
|
|
953
926
|
}
|
|
954
927
|
|
|
955
|
-
function ssrRenderSuspense(push, { default: renderContent }) {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
}
|
|
963
|
-
});
|
|
928
|
+
async function ssrRenderSuspense(push, { default: renderContent }) {
|
|
929
|
+
if (renderContent) {
|
|
930
|
+
renderContent();
|
|
931
|
+
}
|
|
932
|
+
else {
|
|
933
|
+
push(`<!---->`);
|
|
934
|
+
}
|
|
964
935
|
}
|
|
965
936
|
|
|
966
937
|
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
@@ -1034,6 +1005,7 @@ exports.ssrRenderDynamicAttr = ssrRenderDynamicAttr;
|
|
|
1034
1005
|
exports.ssrRenderDynamicModel = ssrRenderDynamicModel;
|
|
1035
1006
|
exports.ssrRenderList = ssrRenderList;
|
|
1036
1007
|
exports.ssrRenderSlot = ssrRenderSlot;
|
|
1008
|
+
exports.ssrRenderSlotInner = ssrRenderSlotInner;
|
|
1037
1009
|
exports.ssrRenderStyle = ssrRenderStyle;
|
|
1038
1010
|
exports.ssrRenderSuspense = ssrRenderSuspense;
|
|
1039
1011
|
exports.ssrRenderTeleport = ssrRenderTeleport;
|
|
@@ -6,31 +6,6 @@ var vue = require('vue');
|
|
|
6
6
|
var shared = require('@vue/shared');
|
|
7
7
|
var compilerSsr = require('@vue/compiler-ssr');
|
|
8
8
|
|
|
9
|
-
/*! *****************************************************************************
|
|
10
|
-
Copyright (c) Microsoft Corporation.
|
|
11
|
-
|
|
12
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
13
|
-
purpose with or without fee is hereby granted.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
18
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
-
***************************************************************************** */
|
|
23
|
-
|
|
24
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
25
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
26
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
27
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
28
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
29
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
30
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
9
|
// leading comma for empty string ""
|
|
35
10
|
const shouldIgnoreProp = shared.makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
|
|
36
11
|
function ssrRenderAttrs(props, tag) {
|
|
@@ -241,7 +216,7 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
241
216
|
const scopeId = cur.vnode.scopeId;
|
|
242
217
|
if (scopeId) {
|
|
243
218
|
if (!hasCloned) {
|
|
244
|
-
attrs =
|
|
219
|
+
attrs = { ...attrs };
|
|
245
220
|
hasCloned = true;
|
|
246
221
|
}
|
|
247
222
|
attrs[scopeId] = '';
|
|
@@ -258,7 +233,7 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
258
233
|
}
|
|
259
234
|
if (slotScopeId) {
|
|
260
235
|
if (!hasCloned)
|
|
261
|
-
attrs =
|
|
236
|
+
attrs = { ...attrs };
|
|
262
237
|
attrs[slotScopeId.trim()] = '';
|
|
263
238
|
}
|
|
264
239
|
// set current rendering instance for asset resolution
|
|
@@ -272,7 +247,8 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
272
247
|
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance, slotScopeId);
|
|
273
248
|
}
|
|
274
249
|
else {
|
|
275
|
-
|
|
250
|
+
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
|
251
|
+
vue.warn(`Component ${componentName} is missing template or render function.`);
|
|
276
252
|
push(`<!---->`);
|
|
277
253
|
}
|
|
278
254
|
}
|
|
@@ -393,7 +369,9 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
393
369
|
const target = vnode.props && vnode.props.to;
|
|
394
370
|
const disabled = vnode.props && vnode.props.disabled;
|
|
395
371
|
if (!target) {
|
|
396
|
-
|
|
372
|
+
if (!disabled) {
|
|
373
|
+
vue.warn(`[@vue/server-renderer] Teleport is missing target prop.`);
|
|
374
|
+
}
|
|
397
375
|
return [];
|
|
398
376
|
}
|
|
399
377
|
if (!shared.isString(target)) {
|
|
@@ -406,30 +384,28 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
406
384
|
}
|
|
407
385
|
|
|
408
386
|
const { isVNode } = vue.ssrUtils;
|
|
409
|
-
function unrollBuffer(buffer) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
ret += yield unrollBuffer(item);
|
|
423
|
-
}
|
|
387
|
+
async function unrollBuffer(buffer) {
|
|
388
|
+
if (buffer.hasAsync) {
|
|
389
|
+
let ret = '';
|
|
390
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
391
|
+
let item = buffer[i];
|
|
392
|
+
if (shared.isPromise(item)) {
|
|
393
|
+
item = await item;
|
|
394
|
+
}
|
|
395
|
+
if (shared.isString(item)) {
|
|
396
|
+
ret += item;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
ret += await unrollBuffer(item);
|
|
424
400
|
}
|
|
425
|
-
return ret;
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
429
|
-
// ticks
|
|
430
|
-
return unrollBufferSync(buffer);
|
|
431
401
|
}
|
|
432
|
-
|
|
402
|
+
return ret;
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
406
|
+
// ticks
|
|
407
|
+
return unrollBufferSync(buffer);
|
|
408
|
+
}
|
|
433
409
|
}
|
|
434
410
|
function unrollBufferSync(buffer) {
|
|
435
411
|
let ret = '';
|
|
@@ -445,58 +421,53 @@ function unrollBufferSync(buffer) {
|
|
|
445
421
|
}
|
|
446
422
|
return ret;
|
|
447
423
|
}
|
|
448
|
-
function renderToString(input, context = {}) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
});
|
|
424
|
+
async function renderToString(input, context = {}) {
|
|
425
|
+
if (isVNode(input)) {
|
|
426
|
+
// raw vnode, wrap with app (for context)
|
|
427
|
+
return renderToString(vue.createApp({ render: () => input }), context);
|
|
428
|
+
}
|
|
429
|
+
// rendering an app
|
|
430
|
+
const vnode = vue.createVNode(input._component, input._props);
|
|
431
|
+
vnode.appContext = input._context;
|
|
432
|
+
// provide the ssr context to the tree
|
|
433
|
+
input.provide(vue.ssrContextKey, context);
|
|
434
|
+
const buffer = await renderComponentVNode(vnode);
|
|
435
|
+
const result = await unrollBuffer(buffer);
|
|
436
|
+
await resolveTeleports(context);
|
|
437
|
+
return result;
|
|
463
438
|
}
|
|
464
|
-
function resolveTeleports(context) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
context.teleports[key] = yield unrollBuffer((yield Promise.all(context.__teleportBuffers[key])));
|
|
472
|
-
}
|
|
439
|
+
async function resolveTeleports(context) {
|
|
440
|
+
if (context.__teleportBuffers) {
|
|
441
|
+
context.teleports = context.teleports || {};
|
|
442
|
+
for (const key in context.__teleportBuffers) {
|
|
443
|
+
// note: it's OK to await sequentially here because the Promises were
|
|
444
|
+
// created eagerly in parallel.
|
|
445
|
+
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
|
|
473
446
|
}
|
|
474
|
-
}
|
|
447
|
+
}
|
|
475
448
|
}
|
|
476
449
|
|
|
477
450
|
const { isVNode: isVNode$1 } = vue.ssrUtils;
|
|
478
|
-
function unrollBuffer$1(buffer, stream) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
yield unrollBuffer$1(item, stream);
|
|
491
|
-
}
|
|
451
|
+
async function unrollBuffer$1(buffer, stream) {
|
|
452
|
+
if (buffer.hasAsync) {
|
|
453
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
454
|
+
let item = buffer[i];
|
|
455
|
+
if (shared.isPromise(item)) {
|
|
456
|
+
item = await item;
|
|
457
|
+
}
|
|
458
|
+
if (shared.isString(item)) {
|
|
459
|
+
stream.push(item);
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
await unrollBuffer$1(item, stream);
|
|
492
463
|
}
|
|
493
464
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
468
|
+
// ticks
|
|
469
|
+
unrollBufferSync$1(buffer, stream);
|
|
470
|
+
}
|
|
500
471
|
}
|
|
501
472
|
function unrollBufferSync$1(buffer, stream) {
|
|
502
473
|
for (let i = 0; i < buffer.length; i++) {
|
|
@@ -522,6 +493,7 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
522
493
|
input.provide(vue.ssrContextKey, context);
|
|
523
494
|
Promise.resolve(renderComponentVNode(vnode))
|
|
524
495
|
.then(buffer => unrollBuffer$1(buffer, stream))
|
|
496
|
+
.then(() => resolveTeleports(context))
|
|
525
497
|
.then(() => stream.push(null))
|
|
526
498
|
.catch(error => {
|
|
527
499
|
stream.destroy(error);
|
|
@@ -536,7 +508,7 @@ function renderToStream(input, context = {}) {
|
|
|
536
508
|
return renderToNodeStream(input, context);
|
|
537
509
|
}
|
|
538
510
|
function renderToNodeStream(input, context = {}) {
|
|
539
|
-
const stream = new (require('stream').Readable)()
|
|
511
|
+
const stream = new (require('stream').Readable)({ read() { } })
|
|
540
512
|
;
|
|
541
513
|
if (!stream) {
|
|
542
514
|
throw new Error(`ESM build of renderToStream() does not support renderToNodeStream(). ` +
|
|
@@ -601,18 +573,16 @@ function pipeToWebWritable(input, context = {}, writable) {
|
|
|
601
573
|
}
|
|
602
574
|
catch (e) { }
|
|
603
575
|
renderToSimpleStream(input, context, {
|
|
604
|
-
push(content) {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
});
|
|
576
|
+
async push(content) {
|
|
577
|
+
if (hasReady) {
|
|
578
|
+
await writer.ready;
|
|
579
|
+
}
|
|
580
|
+
if (content != null) {
|
|
581
|
+
return writer.write(encoder.encode(content));
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
return writer.close();
|
|
585
|
+
}
|
|
616
586
|
},
|
|
617
587
|
destroy(err) {
|
|
618
588
|
// TODO better error handling?
|
|
@@ -629,6 +599,10 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
|
|
|
629
599
|
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
630
600
|
// template-compiled slots are always rendered as fragments
|
|
631
601
|
push(`<!--[-->`);
|
|
602
|
+
ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId);
|
|
603
|
+
push(`<!--]-->`);
|
|
604
|
+
}
|
|
605
|
+
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
632
606
|
const slotFn = slots[slotName];
|
|
633
607
|
if (slotFn) {
|
|
634
608
|
const slotBuffer = [];
|
|
@@ -665,11 +639,10 @@ function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, paren
|
|
|
665
639
|
else if (fallbackRenderFn) {
|
|
666
640
|
fallbackRenderFn();
|
|
667
641
|
}
|
|
668
|
-
push(`<!--]-->`);
|
|
669
642
|
}
|
|
670
|
-
const commentRE =
|
|
643
|
+
const commentRE = /<!--.*?-->/g;
|
|
671
644
|
function isComment(item) {
|
|
672
|
-
return typeof item === 'string' && commentRE.
|
|
645
|
+
return typeof item === 'string' && !item.replace(commentRE, '').trim();
|
|
673
646
|
}
|
|
674
647
|
|
|
675
648
|
function ssrInterpolate(value) {
|
|
@@ -704,15 +677,13 @@ function ssrRenderList(source, renderItem) {
|
|
|
704
677
|
}
|
|
705
678
|
}
|
|
706
679
|
|
|
707
|
-
function ssrRenderSuspense(push, { default: renderContent }) {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
}
|
|
715
|
-
});
|
|
680
|
+
async function ssrRenderSuspense(push, { default: renderContent }) {
|
|
681
|
+
if (renderContent) {
|
|
682
|
+
renderContent();
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
push(`<!---->`);
|
|
686
|
+
}
|
|
716
687
|
}
|
|
717
688
|
|
|
718
689
|
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
@@ -786,6 +757,7 @@ exports.ssrRenderDynamicAttr = ssrRenderDynamicAttr;
|
|
|
786
757
|
exports.ssrRenderDynamicModel = ssrRenderDynamicModel;
|
|
787
758
|
exports.ssrRenderList = ssrRenderList;
|
|
788
759
|
exports.ssrRenderSlot = ssrRenderSlot;
|
|
760
|
+
exports.ssrRenderSlotInner = ssrRenderSlotInner;
|
|
789
761
|
exports.ssrRenderStyle = ssrRenderStyle;
|
|
790
762
|
exports.ssrRenderSuspense = ssrRenderSuspense;
|
|
791
763
|
exports.ssrRenderTeleport = ssrRenderTeleport;
|
|
@@ -83,6 +83,8 @@ export declare function ssrRenderList(source: unknown, renderItem: (value: unkno
|
|
|
83
83
|
|
|
84
84
|
export declare function ssrRenderSlot(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
|
85
85
|
|
|
86
|
+
export declare function ssrRenderSlotInner(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
|
87
|
+
|
|
86
88
|
export declare function ssrRenderStyle(raw: unknown): string;
|
|
87
89
|
|
|
88
90
|
export declare function ssrRenderSuspense(push: PushFn, { default: renderContent }: Record<string, (() => void) | undefined>): Promise<void>;
|
|
@@ -2,31 +2,6 @@ import { ssrContextKey, warn as warn$1, Fragment, Static, Comment, Text, mergePr
|
|
|
2
2
|
import { makeMap, isOn, escapeHtml, normalizeClass, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, isString, normalizeStyle, stringifyStyle, escapeHtmlComment, isVoidTag, isPromise, isArray, isFunction, NOOP, toDisplayString, isObject, looseEqual, looseIndexOf } from '@vue/shared';
|
|
3
3
|
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
|
4
4
|
|
|
5
|
-
/*! *****************************************************************************
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
purpose with or without fee is hereby granted.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
***************************************************************************** */
|
|
19
|
-
|
|
20
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
21
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
23
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
24
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
25
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
26
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
5
|
// leading comma for empty string ""
|
|
31
6
|
const shouldIgnoreProp = makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
|
|
32
7
|
function ssrRenderAttrs(props, tag) {
|
|
@@ -213,7 +188,7 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
213
188
|
const scopeId = cur.vnode.scopeId;
|
|
214
189
|
if (scopeId) {
|
|
215
190
|
if (!hasCloned) {
|
|
216
|
-
attrs =
|
|
191
|
+
attrs = { ...attrs };
|
|
217
192
|
hasCloned = true;
|
|
218
193
|
}
|
|
219
194
|
attrs[scopeId] = '';
|
|
@@ -230,7 +205,7 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
230
205
|
}
|
|
231
206
|
if (slotScopeId) {
|
|
232
207
|
if (!hasCloned)
|
|
233
|
-
attrs =
|
|
208
|
+
attrs = { ...attrs };
|
|
234
209
|
attrs[slotScopeId.trim()] = '';
|
|
235
210
|
}
|
|
236
211
|
// set current rendering instance for asset resolution
|
|
@@ -244,7 +219,8 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
244
219
|
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance, slotScopeId);
|
|
245
220
|
}
|
|
246
221
|
else {
|
|
247
|
-
|
|
222
|
+
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
|
223
|
+
warn$1(`Component ${componentName} is missing template or render function.`);
|
|
248
224
|
push(`<!---->`);
|
|
249
225
|
}
|
|
250
226
|
}
|
|
@@ -365,7 +341,9 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
365
341
|
const target = vnode.props && vnode.props.to;
|
|
366
342
|
const disabled = vnode.props && vnode.props.disabled;
|
|
367
343
|
if (!target) {
|
|
368
|
-
|
|
344
|
+
if (!disabled) {
|
|
345
|
+
warn$1(`[@vue/server-renderer] Teleport is missing target prop.`);
|
|
346
|
+
}
|
|
369
347
|
return [];
|
|
370
348
|
}
|
|
371
349
|
if (!isString(target)) {
|
|
@@ -378,30 +356,28 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
378
356
|
}
|
|
379
357
|
|
|
380
358
|
const { isVNode } = ssrUtils;
|
|
381
|
-
function unrollBuffer(buffer) {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
ret += yield unrollBuffer(item);
|
|
395
|
-
}
|
|
359
|
+
async function unrollBuffer(buffer) {
|
|
360
|
+
if (buffer.hasAsync) {
|
|
361
|
+
let ret = '';
|
|
362
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
363
|
+
let item = buffer[i];
|
|
364
|
+
if (isPromise(item)) {
|
|
365
|
+
item = await item;
|
|
366
|
+
}
|
|
367
|
+
if (isString(item)) {
|
|
368
|
+
ret += item;
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
ret += await unrollBuffer(item);
|
|
396
372
|
}
|
|
397
|
-
return ret;
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
401
|
-
// ticks
|
|
402
|
-
return unrollBufferSync(buffer);
|
|
403
373
|
}
|
|
404
|
-
|
|
374
|
+
return ret;
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
378
|
+
// ticks
|
|
379
|
+
return unrollBufferSync(buffer);
|
|
380
|
+
}
|
|
405
381
|
}
|
|
406
382
|
function unrollBufferSync(buffer) {
|
|
407
383
|
let ret = '';
|
|
@@ -417,58 +393,53 @@ function unrollBufferSync(buffer) {
|
|
|
417
393
|
}
|
|
418
394
|
return ret;
|
|
419
395
|
}
|
|
420
|
-
function renderToString(input, context = {}) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
});
|
|
396
|
+
async function renderToString(input, context = {}) {
|
|
397
|
+
if (isVNode(input)) {
|
|
398
|
+
// raw vnode, wrap with app (for context)
|
|
399
|
+
return renderToString(createApp({ render: () => input }), context);
|
|
400
|
+
}
|
|
401
|
+
// rendering an app
|
|
402
|
+
const vnode = createVNode(input._component, input._props);
|
|
403
|
+
vnode.appContext = input._context;
|
|
404
|
+
// provide the ssr context to the tree
|
|
405
|
+
input.provide(ssrContextKey, context);
|
|
406
|
+
const buffer = await renderComponentVNode(vnode);
|
|
407
|
+
const result = await unrollBuffer(buffer);
|
|
408
|
+
await resolveTeleports(context);
|
|
409
|
+
return result;
|
|
435
410
|
}
|
|
436
|
-
function resolveTeleports(context) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
context.teleports[key] = yield unrollBuffer((yield Promise.all(context.__teleportBuffers[key])));
|
|
444
|
-
}
|
|
411
|
+
async function resolveTeleports(context) {
|
|
412
|
+
if (context.__teleportBuffers) {
|
|
413
|
+
context.teleports = context.teleports || {};
|
|
414
|
+
for (const key in context.__teleportBuffers) {
|
|
415
|
+
// note: it's OK to await sequentially here because the Promises were
|
|
416
|
+
// created eagerly in parallel.
|
|
417
|
+
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
|
|
445
418
|
}
|
|
446
|
-
}
|
|
419
|
+
}
|
|
447
420
|
}
|
|
448
421
|
|
|
449
422
|
const { isVNode: isVNode$1 } = ssrUtils;
|
|
450
|
-
function unrollBuffer$1(buffer, stream) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
yield unrollBuffer$1(item, stream);
|
|
463
|
-
}
|
|
423
|
+
async function unrollBuffer$1(buffer, stream) {
|
|
424
|
+
if (buffer.hasAsync) {
|
|
425
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
426
|
+
let item = buffer[i];
|
|
427
|
+
if (isPromise(item)) {
|
|
428
|
+
item = await item;
|
|
429
|
+
}
|
|
430
|
+
if (isString(item)) {
|
|
431
|
+
stream.push(item);
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
await unrollBuffer$1(item, stream);
|
|
464
435
|
}
|
|
465
436
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
440
|
+
// ticks
|
|
441
|
+
unrollBufferSync$1(buffer, stream);
|
|
442
|
+
}
|
|
472
443
|
}
|
|
473
444
|
function unrollBufferSync$1(buffer, stream) {
|
|
474
445
|
for (let i = 0; i < buffer.length; i++) {
|
|
@@ -494,6 +465,7 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
494
465
|
input.provide(ssrContextKey, context);
|
|
495
466
|
Promise.resolve(renderComponentVNode(vnode))
|
|
496
467
|
.then(buffer => unrollBuffer$1(buffer, stream))
|
|
468
|
+
.then(() => resolveTeleports(context))
|
|
497
469
|
.then(() => stream.push(null))
|
|
498
470
|
.catch(error => {
|
|
499
471
|
stream.destroy(error);
|
|
@@ -571,18 +543,16 @@ function pipeToWebWritable(input, context = {}, writable) {
|
|
|
571
543
|
}
|
|
572
544
|
catch (e) { }
|
|
573
545
|
renderToSimpleStream(input, context, {
|
|
574
|
-
push(content) {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}
|
|
585
|
-
});
|
|
546
|
+
async push(content) {
|
|
547
|
+
if (hasReady) {
|
|
548
|
+
await writer.ready;
|
|
549
|
+
}
|
|
550
|
+
if (content != null) {
|
|
551
|
+
return writer.write(encoder.encode(content));
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
return writer.close();
|
|
555
|
+
}
|
|
586
556
|
},
|
|
587
557
|
destroy(err) {
|
|
588
558
|
// TODO better error handling?
|
|
@@ -599,6 +569,10 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
|
|
|
599
569
|
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
600
570
|
// template-compiled slots are always rendered as fragments
|
|
601
571
|
push(`<!--[-->`);
|
|
572
|
+
ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId);
|
|
573
|
+
push(`<!--]-->`);
|
|
574
|
+
}
|
|
575
|
+
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
602
576
|
const slotFn = slots[slotName];
|
|
603
577
|
if (slotFn) {
|
|
604
578
|
const slotBuffer = [];
|
|
@@ -635,11 +609,10 @@ function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, paren
|
|
|
635
609
|
else if (fallbackRenderFn) {
|
|
636
610
|
fallbackRenderFn();
|
|
637
611
|
}
|
|
638
|
-
push(`<!--]-->`);
|
|
639
612
|
}
|
|
640
|
-
const commentRE =
|
|
613
|
+
const commentRE = /<!--.*?-->/g;
|
|
641
614
|
function isComment(item) {
|
|
642
|
-
return typeof item === 'string' && commentRE.
|
|
615
|
+
return typeof item === 'string' && !item.replace(commentRE, '').trim();
|
|
643
616
|
}
|
|
644
617
|
|
|
645
618
|
function ssrInterpolate(value) {
|
|
@@ -923,15 +896,13 @@ function ssrRenderList(source, renderItem) {
|
|
|
923
896
|
}
|
|
924
897
|
}
|
|
925
898
|
|
|
926
|
-
function ssrRenderSuspense(push, { default: renderContent }) {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
}
|
|
934
|
-
});
|
|
899
|
+
async function ssrRenderSuspense(push, { default: renderContent }) {
|
|
900
|
+
if (renderContent) {
|
|
901
|
+
renderContent();
|
|
902
|
+
}
|
|
903
|
+
else {
|
|
904
|
+
push(`<!---->`);
|
|
905
|
+
}
|
|
935
906
|
}
|
|
936
907
|
|
|
937
908
|
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
@@ -984,4 +955,4 @@ function ssrGetDynamicModelProps(existingProps = {}, model) {
|
|
|
984
955
|
|
|
985
956
|
initDirectivesForSSR();
|
|
986
957
|
|
|
987
|
-
export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
|
|
958
|
+
export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/server-renderer",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.34-beta.1",
|
|
4
4
|
"description": "@vue/server-renderer",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/server-renderer.esm-bundler.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"vue": "3.2.
|
|
34
|
+
"vue": "3.2.34-beta.1"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@vue/shared": "3.2.
|
|
38
|
-
"@vue/compiler-ssr": "3.2.
|
|
37
|
+
"@vue/shared": "3.2.34-beta.1",
|
|
38
|
+
"@vue/compiler-ssr": "3.2.34-beta.1"
|
|
39
39
|
}
|
|
40
40
|
}
|