@vue/server-renderer 3.6.0-beta.7 → 3.6.0-beta.9
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,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.6.0-beta.
|
|
2
|
+
* @vue/server-renderer v3.6.0-beta.9
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
6
|
import { Comment, Fragment, Static, Text, createApp, createVNode, initDirectivesForSSR, mergeProps, ssrContextKey, ssrUtils, warn } from "vue";
|
|
7
|
-
import { EMPTY_OBJ, NOOP, escapeHtml, escapeHtmlComment, extend, getGlobalThis, includeBooleanAttr, includeBooleanAttr as ssrIncludeBooleanAttr, isArray, isBooleanAttr, isFunction, isObject, isOn, isPromise, isRenderableAttrValue, isSSRSafeAttrName, isSVGTag, isString, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeCssVarValue, normalizeStyle, propsToAttrMap, stringifyStyle, toDisplayString } from "@vue/shared";
|
|
8
|
-
|
|
7
|
+
import { EMPTY_OBJ, NOOP, escapeHtml, escapeHtmlComment, extend, getGlobalThis, includeBooleanAttr, includeBooleanAttr as ssrIncludeBooleanAttr, isArray, isBooleanAttr, isFunction, isModelListener, isObject, isOn, isPromise, isRenderableAttrValue, isSSRSafeAttrName, isSVGTag, isString, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeCssVarValue, normalizeStyle, propsToAttrMap, stringifyStyle, toDisplayString } from "@vue/shared";
|
|
9
8
|
//#region packages/server-renderer/src/helpers/ssrRenderAttrs.ts
|
|
10
9
|
const shouldIgnoreProp = /* @__PURE__ */ makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
|
|
11
10
|
function ssrRenderAttrs(props, tag) {
|
|
@@ -53,13 +52,11 @@ function ssrResetCssVars(raw) {
|
|
|
53
52
|
}
|
|
54
53
|
return raw;
|
|
55
54
|
}
|
|
56
|
-
|
|
57
55
|
//#endregion
|
|
58
56
|
//#region packages/server-renderer/src/helpers/ssrRenderComponent.ts
|
|
59
57
|
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
|
60
58
|
return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
|
|
61
59
|
}
|
|
62
|
-
|
|
63
60
|
//#endregion
|
|
64
61
|
//#region packages/server-renderer/src/helpers/ssrRenderSlot.ts
|
|
65
62
|
const { ensureValidVNode } = ssrUtils;
|
|
@@ -111,7 +108,6 @@ function isComment(item) {
|
|
|
111
108
|
if (item.length <= 8) return true;
|
|
112
109
|
return !item.replace(commentRE, "").trim();
|
|
113
110
|
}
|
|
114
|
-
|
|
115
111
|
//#endregion
|
|
116
112
|
//#region packages/server-renderer/src/helpers/ssrRenderTeleport.ts
|
|
117
113
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
|
@@ -134,24 +130,14 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
|
|
|
134
130
|
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
|
135
131
|
parentPush("<!--teleport end-->");
|
|
136
132
|
}
|
|
137
|
-
|
|
138
133
|
//#endregion
|
|
139
134
|
//#region packages/server-renderer/src/helpers/ssrInterpolate.ts
|
|
140
135
|
function ssrInterpolate(value) {
|
|
141
136
|
return escapeHtml(toDisplayString(value));
|
|
142
137
|
}
|
|
143
|
-
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region packages/reactivity/src/debug.ts
|
|
146
|
-
function onTrack(sub, debugInfo) {
|
|
147
|
-
if (!!!(process.env.NODE_ENV !== "production")) throw new Error(`Internal error: onTrack should be called only in development.`);
|
|
148
|
-
if (sub.onTrack) sub.onTrack(extend({ effect: sub }, debugInfo));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
138
|
//#endregion
|
|
152
139
|
//#region packages/reactivity/src/system.ts
|
|
153
140
|
let activeSub = void 0;
|
|
154
|
-
let globalVersion = 0;
|
|
155
141
|
function setActiveSub(sub) {
|
|
156
142
|
try {
|
|
157
143
|
return activeSub;
|
|
@@ -159,80 +145,9 @@ function setActiveSub(sub) {
|
|
|
159
145
|
activeSub = sub;
|
|
160
146
|
}
|
|
161
147
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
|
|
166
|
-
if (nextDep !== void 0 && nextDep.dep === dep) {
|
|
167
|
-
nextDep.version = globalVersion;
|
|
168
|
-
sub.depsTail = nextDep;
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const prevSub = dep.subsTail;
|
|
172
|
-
if (prevSub !== void 0 && prevSub.version === globalVersion && prevSub.sub === sub) return;
|
|
173
|
-
const newLink = sub.depsTail = dep.subsTail = {
|
|
174
|
-
version: globalVersion,
|
|
175
|
-
dep,
|
|
176
|
-
sub,
|
|
177
|
-
prevDep,
|
|
178
|
-
nextDep,
|
|
179
|
-
prevSub,
|
|
180
|
-
nextSub: void 0
|
|
181
|
-
};
|
|
182
|
-
if (nextDep !== void 0) nextDep.prevDep = newLink;
|
|
183
|
-
if (prevDep !== void 0) prevDep.nextDep = newLink;
|
|
184
|
-
else sub.deps = newLink;
|
|
185
|
-
if (prevSub !== void 0) prevSub.nextSub = newLink;
|
|
186
|
-
else dep.subs = newLink;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region packages/reactivity/src/dep.ts
|
|
191
|
-
var Dep = class {
|
|
192
|
-
constructor(map, key) {
|
|
193
|
-
this.map = map;
|
|
194
|
-
this.key = key;
|
|
195
|
-
this._subs = void 0;
|
|
196
|
-
this.subsTail = void 0;
|
|
197
|
-
this.flags = 0;
|
|
198
|
-
}
|
|
199
|
-
get subs() {
|
|
200
|
-
return this._subs;
|
|
201
|
-
}
|
|
202
|
-
set subs(value) {
|
|
203
|
-
this._subs = value;
|
|
204
|
-
if (value === void 0) this.map.delete(this.key);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
208
|
-
const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Object iterate" : "");
|
|
209
|
-
const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : "");
|
|
210
|
-
const ARRAY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Array iterate" : "");
|
|
211
|
-
/**
|
|
212
|
-
* Tracks access to a reactive property.
|
|
213
|
-
*
|
|
214
|
-
* This will check which effect is running at the moment and record it as dep
|
|
215
|
-
* which records all effects that depend on the reactive property.
|
|
216
|
-
*
|
|
217
|
-
* @param target - Object holding the reactive property.
|
|
218
|
-
* @param type - Defines the type of access to the reactive property.
|
|
219
|
-
* @param key - Identifier of the reactive property to track.
|
|
220
|
-
*/
|
|
221
|
-
function track(target, type, key) {
|
|
222
|
-
if (activeSub !== void 0) {
|
|
223
|
-
let depsMap = targetMap.get(target);
|
|
224
|
-
if (!depsMap) targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
225
|
-
let dep = depsMap.get(key);
|
|
226
|
-
if (!dep) depsMap.set(key, dep = new Dep(depsMap, key));
|
|
227
|
-
if (!!(process.env.NODE_ENV !== "production")) onTrack(activeSub, {
|
|
228
|
-
target,
|
|
229
|
-
type,
|
|
230
|
-
key
|
|
231
|
-
});
|
|
232
|
-
link(dep, activeSub);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
148
|
+
Symbol(!!(process.env.NODE_ENV !== "production") ? "Object iterate" : "");
|
|
149
|
+
Symbol(!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : "");
|
|
150
|
+
Symbol(!!(process.env.NODE_ENV !== "production") ? "Array iterate" : "");
|
|
236
151
|
//#endregion
|
|
237
152
|
//#region packages/reactivity/src/reactive.ts
|
|
238
153
|
/**
|
|
@@ -274,14 +189,12 @@ function toRaw(observed) {
|
|
|
274
189
|
const raw = observed && observed["__v_raw"];
|
|
275
190
|
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
276
191
|
}
|
|
277
|
-
|
|
278
192
|
//#endregion
|
|
279
193
|
//#region packages/reactivity/src/ref.ts
|
|
280
194
|
/* @__NO_SIDE_EFFECTS__ */
|
|
281
195
|
function isRef(r) {
|
|
282
196
|
return r ? r["__v_isRef"] === true : false;
|
|
283
197
|
}
|
|
284
|
-
|
|
285
198
|
//#endregion
|
|
286
199
|
//#region packages/runtime-core/src/warning.ts
|
|
287
200
|
const stack = [];
|
|
@@ -308,8 +221,8 @@ function warn$2(msg, ...args) {
|
|
|
308
221
|
const trace = getComponentTrace();
|
|
309
222
|
if (appWarnHandler) callWithErrorHandling(appWarnHandler, instance, 11, [
|
|
310
223
|
msg + args.map((a) => {
|
|
311
|
-
|
|
312
|
-
return
|
|
224
|
+
const toString = a.toString;
|
|
225
|
+
return toString == null ? JSON.stringify(a) : toString.call(a);
|
|
313
226
|
}).join(""),
|
|
314
227
|
instance && instance.proxy || instance,
|
|
315
228
|
trace.map(({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`).join("\n"),
|
|
@@ -391,7 +304,6 @@ function formatProp(key, value, raw) {
|
|
|
391
304
|
}
|
|
392
305
|
}
|
|
393
306
|
/* v8 ignore stop */
|
|
394
|
-
|
|
395
307
|
//#endregion
|
|
396
308
|
//#region packages/runtime-core/src/errorHandling.ts
|
|
397
309
|
const ErrorTypeStrings = {
|
|
@@ -471,7 +383,6 @@ function logError(err, type, instance, throwInDev = true, throwInProd = false) {
|
|
|
471
383
|
} else if (throwInProd) throw err;
|
|
472
384
|
else console.error(err);
|
|
473
385
|
}
|
|
474
|
-
|
|
475
386
|
//#endregion
|
|
476
387
|
//#region packages/runtime-core/src/scheduler.ts
|
|
477
388
|
const jobs = [];
|
|
@@ -597,7 +508,6 @@ function checkRecursiveUpdates(seen, fn) {
|
|
|
597
508
|
seen.set(fn, count + 1);
|
|
598
509
|
return false;
|
|
599
510
|
}
|
|
600
|
-
|
|
601
511
|
//#endregion
|
|
602
512
|
//#region packages/runtime-core/src/hmr.ts
|
|
603
513
|
let isHmrUpdating = false;
|
|
@@ -707,12 +617,10 @@ function tryWrap(fn) {
|
|
|
707
617
|
}
|
|
708
618
|
};
|
|
709
619
|
}
|
|
710
|
-
|
|
711
620
|
//#endregion
|
|
712
621
|
//#region packages/runtime-core/src/devtools.ts
|
|
713
622
|
let devtools$1;
|
|
714
623
|
let buffer = [];
|
|
715
|
-
let devtoolsNotInstalled = false;
|
|
716
624
|
function setDevtoolsHook$1(hook, target) {
|
|
717
625
|
var _window$navigator;
|
|
718
626
|
devtools$1 = hook;
|
|
@@ -727,16 +635,11 @@ function setDevtoolsHook$1(hook, target) {
|
|
|
727
635
|
setTimeout(() => {
|
|
728
636
|
if (!devtools$1) {
|
|
729
637
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
730
|
-
devtoolsNotInstalled = true;
|
|
731
638
|
buffer = [];
|
|
732
639
|
}
|
|
733
640
|
}, 3e3);
|
|
734
|
-
} else
|
|
735
|
-
devtoolsNotInstalled = true;
|
|
736
|
-
buffer = [];
|
|
737
|
-
}
|
|
641
|
+
} else buffer = [];
|
|
738
642
|
}
|
|
739
|
-
|
|
740
643
|
//#endregion
|
|
741
644
|
//#region packages/runtime-core/src/componentRenderContext.ts
|
|
742
645
|
/**
|
|
@@ -745,11 +648,9 @@ function setDevtoolsHook$1(hook, target) {
|
|
|
745
648
|
*/
|
|
746
649
|
let currentRenderingInstance = null;
|
|
747
650
|
let currentScopeId = null;
|
|
748
|
-
|
|
749
651
|
//#endregion
|
|
750
652
|
//#region packages/runtime-core/src/components/Teleport.ts
|
|
751
653
|
const isTeleport = (type) => type.__isTeleport;
|
|
752
|
-
|
|
753
654
|
//#endregion
|
|
754
655
|
//#region packages/runtime-core/src/components/BaseTransition.ts
|
|
755
656
|
function setTransitionHooks(vnode, hooks) {
|
|
@@ -763,23 +664,9 @@ function setTransitionHooks(vnode, hooks) {
|
|
|
763
664
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
764
665
|
} else vnode.transition = hooks;
|
|
765
666
|
}
|
|
766
|
-
|
|
767
667
|
//#endregion
|
|
768
668
|
//#region packages/runtime-core/src/helpers/resolveAssets.ts
|
|
769
669
|
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
770
|
-
|
|
771
|
-
//#endregion
|
|
772
|
-
//#region packages/runtime-core/src/componentRenderUtils.ts
|
|
773
|
-
/**
|
|
774
|
-
* dev only flag to track whether $attrs was used during render.
|
|
775
|
-
* If $attrs was used during render then the warning for failed attrs
|
|
776
|
-
* fallthrough can be suppressed.
|
|
777
|
-
*/
|
|
778
|
-
let accessedAttrs = false;
|
|
779
|
-
function markAttrsAccessed() {
|
|
780
|
-
accessedAttrs = true;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
670
|
//#endregion
|
|
784
671
|
//#region packages/runtime-core/src/internalObject.ts
|
|
785
672
|
/**
|
|
@@ -790,7 +677,6 @@ function markAttrsAccessed() {
|
|
|
790
677
|
*/
|
|
791
678
|
const internalObjectProto = {};
|
|
792
679
|
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
793
|
-
|
|
794
680
|
//#endregion
|
|
795
681
|
//#region packages/runtime-core/src/renderer.ts
|
|
796
682
|
function getVaporInterface(instance, vnode) {
|
|
@@ -803,26 +689,19 @@ function isVaporComponent(type) {
|
|
|
803
689
|
if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating && hmrDirtyComponentsMode.has(type)) return hmrDirtyComponentsMode.get(type);
|
|
804
690
|
return type.__vapor;
|
|
805
691
|
}
|
|
806
|
-
|
|
807
692
|
//#endregion
|
|
808
693
|
//#region packages/runtime-core/src/components/Suspense.ts
|
|
809
694
|
const isSuspense = (type) => type.__isSuspense;
|
|
810
|
-
|
|
811
695
|
//#endregion
|
|
812
696
|
//#region packages/runtime-core/src/vnode.ts
|
|
813
697
|
const Fragment$1 = Symbol.for("v-fgt");
|
|
814
698
|
const Text$1 = Symbol.for("v-txt");
|
|
815
699
|
const Comment$1 = Symbol.for("v-cmt");
|
|
816
|
-
const Static$1 = Symbol.for("v-stc");
|
|
817
|
-
const VaporSlot = Symbol.for("v-vps");
|
|
818
|
-
let currentBlock = null;
|
|
819
|
-
let isBlockTreeEnabled = 1;
|
|
820
700
|
function isVNode$2(value) {
|
|
821
701
|
return value ? value.__v_isVNode === true : false;
|
|
822
702
|
}
|
|
823
|
-
let vnodeArgsTransformer;
|
|
824
703
|
const createVNodeWithArgsTransform = (...args) => {
|
|
825
|
-
return _createVNode(...
|
|
704
|
+
return _createVNode(...args);
|
|
826
705
|
};
|
|
827
706
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
828
707
|
const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
|
|
@@ -869,7 +748,6 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
869
748
|
if (shapeFlag & 128) type.normalize(vnode);
|
|
870
749
|
} else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
|
|
871
750
|
if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) warn$2(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
872
|
-
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
|
|
873
751
|
return vnode;
|
|
874
752
|
}
|
|
875
753
|
const createVNode$1 = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
|
|
@@ -881,8 +759,6 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
881
759
|
if (isVNode$2(type)) {
|
|
882
760
|
const cloned = cloneVNode(type, props, true);
|
|
883
761
|
if (children) normalizeChildren(cloned, children);
|
|
884
|
-
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) if (cloned.shapeFlag & 6) currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
885
|
-
else currentBlock.push(cloned);
|
|
886
762
|
cloned.patchFlag = -2;
|
|
887
763
|
return cloned;
|
|
888
764
|
}
|
|
@@ -974,13 +850,7 @@ function normalizeChildren(vnode, children) {
|
|
|
974
850
|
return;
|
|
975
851
|
} else {
|
|
976
852
|
type = 32;
|
|
977
|
-
|
|
978
|
-
if (!slotFlag && !isInternalObject(children)) children._ctx = currentRenderingInstance;
|
|
979
|
-
else if (slotFlag === 3 && currentRenderingInstance) if (currentRenderingInstance.slots._ === 1) children._ = 1;
|
|
980
|
-
else {
|
|
981
|
-
children._ = 2;
|
|
982
|
-
vnode.patchFlag |= 1024;
|
|
983
|
-
}
|
|
853
|
+
if (!children._ && !isInternalObject(children)) children._ctx = currentRenderingInstance;
|
|
984
854
|
}
|
|
985
855
|
else if (isFunction(children)) {
|
|
986
856
|
children = {
|
|
@@ -1009,31 +879,12 @@ function mergeProps$1(...args) {
|
|
|
1009
879
|
const existing = ret[key];
|
|
1010
880
|
const incoming = toMerge[key];
|
|
1011
881
|
if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
882
|
+
else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
|
|
1012
883
|
} else if (key !== "") ret[key] = toMerge[key];
|
|
1013
884
|
}
|
|
1014
885
|
return ret;
|
|
1015
886
|
}
|
|
1016
|
-
|
|
1017
|
-
//#endregion
|
|
1018
|
-
//#region packages/runtime-core/src/component.ts
|
|
1019
|
-
const attrsProxyHandlers = !!(process.env.NODE_ENV !== "production") ? {
|
|
1020
|
-
get(target, key) {
|
|
1021
|
-
markAttrsAccessed();
|
|
1022
|
-
track(target, "get", "");
|
|
1023
|
-
return target[key];
|
|
1024
|
-
},
|
|
1025
|
-
set() {
|
|
1026
|
-
warn$2(`setupContext.attrs is readonly.`);
|
|
1027
|
-
return false;
|
|
1028
|
-
},
|
|
1029
|
-
deleteProperty() {
|
|
1030
|
-
warn$2(`setupContext.attrs is readonly.`);
|
|
1031
|
-
return false;
|
|
1032
|
-
}
|
|
1033
|
-
} : { get(target, key) {
|
|
1034
|
-
track(target, "get", "");
|
|
1035
|
-
return target[key];
|
|
1036
|
-
} };
|
|
887
|
+
process.env.NODE_ENV;
|
|
1037
888
|
const classifyRE = /(?:^|[-_])\w/g;
|
|
1038
889
|
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
|
1039
890
|
function getComponentName(Component, includeInferred = true) {
|
|
@@ -1056,20 +907,18 @@ function formatComponentName(instance, Component, isRoot = false) {
|
|
|
1056
907
|
function isClassComponent(value) {
|
|
1057
908
|
return isFunction(value) && "__vccOpts" in value;
|
|
1058
909
|
}
|
|
1059
|
-
|
|
1060
910
|
//#endregion
|
|
1061
911
|
//#region packages/runtime-core/src/index.ts
|
|
1062
912
|
const warn$1 = !!(process.env.NODE_ENV !== "production") ? warn$2 : NOOP;
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
913
|
+
process.env.NODE_ENV;
|
|
914
|
+
process.env.NODE_ENV;
|
|
1066
915
|
//#endregion
|
|
1067
916
|
//#region packages/server-renderer/src/helpers/ssrRenderList.ts
|
|
1068
917
|
function ssrRenderList(source, renderItem) {
|
|
1069
918
|
if (isArray(source) || isString(source)) for (let i = 0, l = source.length; i < l; i++) renderItem(source[i], i);
|
|
1070
919
|
else if (typeof source === "number") {
|
|
1071
|
-
if (!!(process.env.NODE_ENV !== "production") && !Number.isInteger(source)) {
|
|
1072
|
-
warn$1(`The v-for range
|
|
920
|
+
if (!!(process.env.NODE_ENV !== "production") && (!Number.isInteger(source) || source < 0)) {
|
|
921
|
+
warn$1(`The v-for range expects a positive integer value but got ${source}.`);
|
|
1073
922
|
return;
|
|
1074
923
|
}
|
|
1075
924
|
for (let i = 0; i < source; i++) renderItem(i + 1, i);
|
|
@@ -1084,14 +933,12 @@ function ssrRenderList(source, renderItem) {
|
|
|
1084
933
|
}
|
|
1085
934
|
}
|
|
1086
935
|
}
|
|
1087
|
-
|
|
1088
936
|
//#endregion
|
|
1089
937
|
//#region packages/server-renderer/src/helpers/ssrRenderSuspense.ts
|
|
1090
938
|
async function ssrRenderSuspense(push, { default: renderContent }) {
|
|
1091
939
|
if (renderContent) renderContent();
|
|
1092
940
|
else push(`<!---->`);
|
|
1093
941
|
}
|
|
1094
|
-
|
|
1095
942
|
//#endregion
|
|
1096
943
|
//#region packages/server-renderer/src/helpers/ssrGetDirectiveProps.ts
|
|
1097
944
|
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
@@ -1105,7 +952,6 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
|
1105
952
|
}, null) || {};
|
|
1106
953
|
return {};
|
|
1107
954
|
}
|
|
1108
|
-
|
|
1109
955
|
//#endregion
|
|
1110
956
|
//#region packages/server-renderer/src/helpers/ssrVModelHelpers.ts
|
|
1111
957
|
const ssrLooseEqual = looseEqual;
|
|
@@ -1127,16 +973,34 @@ function ssrGetDynamicModelProps(existingProps = {}, model) {
|
|
|
1127
973
|
default: return { value: model };
|
|
1128
974
|
}
|
|
1129
975
|
}
|
|
1130
|
-
|
|
1131
976
|
//#endregion
|
|
1132
977
|
//#region packages/server-renderer/src/helpers/ssrCompile.ts
|
|
1133
978
|
function ssrCompile(template, instance) {
|
|
1134
979
|
throw new Error("On-the-fly template compilation is not supported in the ESM build of @vue/server-renderer. All templates must be pre-compiled into render functions.");
|
|
1135
980
|
}
|
|
1136
|
-
|
|
1137
981
|
//#endregion
|
|
1138
982
|
//#region packages/server-renderer/src/render.ts
|
|
1139
983
|
const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, normalizeVNode, pushWarningContext, popWarningContext } = ssrUtils;
|
|
984
|
+
function cleanupContext(context) {
|
|
985
|
+
let firstError;
|
|
986
|
+
if (context.__watcherHandles) {
|
|
987
|
+
for (const unwatch of context.__watcherHandles) try {
|
|
988
|
+
unwatch();
|
|
989
|
+
} catch (err) {
|
|
990
|
+
if (firstError === void 0) firstError = err;
|
|
991
|
+
}
|
|
992
|
+
context.__watcherHandles.length = 0;
|
|
993
|
+
}
|
|
994
|
+
if (context.__instanceScopes) {
|
|
995
|
+
for (const scope of context.__instanceScopes) try {
|
|
996
|
+
scope.stop();
|
|
997
|
+
} catch (err) {
|
|
998
|
+
if (firstError === void 0) firstError = err;
|
|
999
|
+
}
|
|
1000
|
+
context.__instanceScopes.length = 0;
|
|
1001
|
+
}
|
|
1002
|
+
if (firstError !== void 0) throw firstError;
|
|
1003
|
+
}
|
|
1140
1004
|
function createBuffer() {
|
|
1141
1005
|
let appendable = false;
|
|
1142
1006
|
const buffer = [];
|
|
@@ -1158,6 +1022,8 @@ function createBuffer() {
|
|
|
1158
1022
|
}
|
|
1159
1023
|
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
|
1160
1024
|
const instance = vnode.component = createComponentInstance(vnode, parentComponent, null);
|
|
1025
|
+
const context = instance.appContext.provides[ssrContextKey];
|
|
1026
|
+
if (context) (context.__instanceScopes || (context.__instanceScopes = [])).push(instance.scope);
|
|
1161
1027
|
if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(vnode);
|
|
1162
1028
|
const res = setupComponent(instance, true);
|
|
1163
1029
|
if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
|
|
@@ -1311,7 +1177,6 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
1311
1177
|
renderVNodeChildren(push, vnode.children, parentComponent, slotScopeId);
|
|
1312
1178
|
}, target, disabled || disabled === "", parentComponent);
|
|
1313
1179
|
}
|
|
1314
|
-
|
|
1315
1180
|
//#endregion
|
|
1316
1181
|
//#region packages/server-renderer/src/renderToString.ts
|
|
1317
1182
|
const { isVNode: isVNode$1 } = ssrUtils;
|
|
@@ -1354,10 +1219,13 @@ async function renderToString(input, context = {}) {
|
|
|
1354
1219
|
const vnode = createVNode(input._component, input._props);
|
|
1355
1220
|
vnode.appContext = input._context;
|
|
1356
1221
|
input.provide(ssrContextKey, context);
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1222
|
+
try {
|
|
1223
|
+
const result = await unrollBuffer$1(await renderComponentVNode(vnode));
|
|
1224
|
+
await resolveTeleports(context);
|
|
1225
|
+
return result;
|
|
1226
|
+
} finally {
|
|
1227
|
+
cleanupContext(context);
|
|
1228
|
+
}
|
|
1361
1229
|
}
|
|
1362
1230
|
async function resolveTeleports(context) {
|
|
1363
1231
|
if (context.__teleportBuffers) {
|
|
@@ -1365,7 +1233,6 @@ async function resolveTeleports(context) {
|
|
|
1365
1233
|
for (const key in context.__teleportBuffers) context.teleports[key] = await unrollBuffer$1(await Promise.all([context.__teleportBuffers[key]]));
|
|
1366
1234
|
}
|
|
1367
1235
|
}
|
|
1368
|
-
|
|
1369
1236
|
//#endregion
|
|
1370
1237
|
//#region packages/server-renderer/src/renderToStream.ts
|
|
1371
1238
|
const { isVNode } = ssrUtils;
|
|
@@ -1380,7 +1247,7 @@ async function unrollBuffer(buffer, stream) {
|
|
|
1380
1247
|
}
|
|
1381
1248
|
function unrollBufferSync(buffer, stream) {
|
|
1382
1249
|
for (let i = 0; i < buffer.length; i++) {
|
|
1383
|
-
|
|
1250
|
+
const item = buffer[i];
|
|
1384
1251
|
if (isString(item)) stream.push(item);
|
|
1385
1252
|
else unrollBufferSync(item, stream);
|
|
1386
1253
|
}
|
|
@@ -1390,9 +1257,19 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
1390
1257
|
const vnode = createVNode(input._component, input._props);
|
|
1391
1258
|
vnode.appContext = input._context;
|
|
1392
1259
|
input.provide(ssrContextKey, context);
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1260
|
+
let cleaned = false;
|
|
1261
|
+
const finalize = () => {
|
|
1262
|
+
if (cleaned) return;
|
|
1263
|
+
cleaned = true;
|
|
1264
|
+
cleanupContext(context);
|
|
1265
|
+
};
|
|
1266
|
+
Promise.resolve().then(() => renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
|
|
1267
|
+
finalize();
|
|
1268
|
+
return stream.push(null);
|
|
1269
|
+
}).catch((error) => {
|
|
1270
|
+
try {
|
|
1271
|
+
finalize();
|
|
1272
|
+
} catch {}
|
|
1396
1273
|
stream.destroy(error);
|
|
1397
1274
|
});
|
|
1398
1275
|
return stream;
|
|
@@ -1459,10 +1336,8 @@ function pipeToWebWritable(input, context = {}, writable) {
|
|
|
1459
1336
|
}
|
|
1460
1337
|
});
|
|
1461
1338
|
}
|
|
1462
|
-
|
|
1463
1339
|
//#endregion
|
|
1464
1340
|
//#region packages/server-renderer/src/index.ts
|
|
1465
1341
|
initDirectivesForSSR();
|
|
1466
|
-
|
|
1467
1342
|
//#endregion
|
|
1468
|
-
export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, ssrIncludeBooleanAttr, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
|
|
1343
|
+
export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, ssrIncludeBooleanAttr, 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.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.9",
|
|
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.6.0-beta.
|
|
49
|
+
"vue": "3.6.0-beta.9"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@vue/shared": "3.6.0-beta.
|
|
53
|
-
"@vue/compiler-ssr": "3.6.0-beta.
|
|
52
|
+
"@vue/shared": "3.6.0-beta.9",
|
|
53
|
+
"@vue/compiler-ssr": "3.6.0-beta.9"
|
|
54
54
|
}
|
|
55
55
|
}
|