🔧 npm update
This commit is contained in:
359
node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js
generated
vendored
359
node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js
generated
vendored
@@ -1,13 +1,13 @@
|
||||
/**
|
||||
* @vue/server-renderer v3.4.15
|
||||
* @vue/server-renderer v3.5.13
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
import { createVNode, ssrContextKey, warn as warn$2, Fragment, Static, Comment, Text, mergeProps, ssrUtils, createApp, initDirectivesForSSR } from 'vue';
|
||||
import { makeMap, isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, isArray, toDisplayString, isFunction, getGlobalThis, NOOP, isObject, looseEqual, looseIndexOf, isPromise, escapeHtmlComment, isVoidTag } from '@vue/shared';
|
||||
import { createVNode, ssrUtils, ssrContextKey, warn as warn$2, Fragment, Static, Comment, Text, mergeProps, createApp, initDirectivesForSSR } from 'vue';
|
||||
import { isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, makeMap, isArray, toDisplayString, extend, isFunction, EMPTY_OBJ, getGlobalThis, NOOP, isObject, looseEqual, looseIndexOf, isPromise, escapeHtmlComment, isVoidTag } from '@vue/shared';
|
||||
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
||||
|
||||
const shouldIgnoreProp = makeMap(
|
||||
const shouldIgnoreProp = /* @__PURE__ */ makeMap(
|
||||
`,key,ref,innerHTML,textContent,ref_key,ref_for`
|
||||
);
|
||||
function ssrRenderAttrs(props, tag) {
|
||||
@@ -21,6 +21,8 @@ function ssrRenderAttrs(props, tag) {
|
||||
ret += ` class="${ssrRenderClass(value)}"`;
|
||||
} else if (key === "style") {
|
||||
ret += ` style="${ssrRenderStyle(value)}"`;
|
||||
} else if (key === "className") {
|
||||
ret += ` class="${String(value)}"`;
|
||||
} else {
|
||||
ret += ssrRenderDynamicAttr(key, value, tag);
|
||||
}
|
||||
@@ -71,6 +73,7 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
|
||||
);
|
||||
}
|
||||
|
||||
const { ensureValidVNode } = ssrUtils;
|
||||
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
||||
push(`<!--[-->`);
|
||||
ssrRenderSlotInner(
|
||||
@@ -98,7 +101,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
||||
slotScopeId ? " " + slotScopeId : ""
|
||||
);
|
||||
if (isArray(ret)) {
|
||||
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
|
||||
const validSlotContent = ensureValidVNode(ret);
|
||||
if (validSlotContent) {
|
||||
renderVNodeChildren(
|
||||
push,
|
||||
validSlotContent,
|
||||
parentComponent,
|
||||
slotScopeId
|
||||
);
|
||||
} else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
}
|
||||
} else {
|
||||
let isEmptySlot = true;
|
||||
if (transition) {
|
||||
@@ -131,13 +144,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
||||
fallbackRenderFn();
|
||||
}
|
||||
}
|
||||
const commentTestRE = /^<!--.*-->$/s;
|
||||
const commentTestRE = /^<!--[\s\S]*-->$/;
|
||||
const commentRE = /<!--[^]*?-->/gm;
|
||||
function isComment(item) {
|
||||
if (typeof item !== "string" || !commentTestRE.test(item))
|
||||
return false;
|
||||
if (item.length <= 8)
|
||||
return true;
|
||||
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
|
||||
if (item.length <= 8) return true;
|
||||
return !item.replace(commentRE, "").trim();
|
||||
}
|
||||
|
||||
@@ -150,9 +161,10 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
|
||||
let teleportContent;
|
||||
if (disabled) {
|
||||
contentRenderFn(parentPush);
|
||||
teleportContent = `<!--teleport anchor-->`;
|
||||
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
|
||||
} else {
|
||||
const { getBuffer, push } = createBuffer();
|
||||
push(`<!--teleport start anchor-->`);
|
||||
contentRenderFn(push);
|
||||
push(`<!--teleport anchor-->`);
|
||||
teleportContent = getBuffer();
|
||||
@@ -165,6 +177,37 @@ function ssrInterpolate(value) {
|
||||
return escapeHtml(toDisplayString(value));
|
||||
}
|
||||
|
||||
let activeSub;
|
||||
let batchDepth = 0;
|
||||
let batchedSub;
|
||||
function startBatch() {
|
||||
batchDepth++;
|
||||
}
|
||||
function endBatch() {
|
||||
if (--batchDepth > 0) {
|
||||
return;
|
||||
}
|
||||
let error;
|
||||
while (batchedSub) {
|
||||
let e = batchedSub;
|
||||
batchedSub = void 0;
|
||||
while (e) {
|
||||
const next = e.next;
|
||||
e.next = void 0;
|
||||
e.flags &= ~8;
|
||||
if (e.flags & 1) {
|
||||
try {
|
||||
;
|
||||
e.trigger();
|
||||
} catch (err) {
|
||||
if (!error) error = err;
|
||||
}
|
||||
}
|
||||
e = next;
|
||||
}
|
||||
}
|
||||
if (error) throw error;
|
||||
}
|
||||
let shouldTrack = true;
|
||||
const trackStack = [];
|
||||
function pauseTracking() {
|
||||
@@ -176,23 +219,125 @@ function resetTracking() {
|
||||
shouldTrack = last === void 0 ? true : last;
|
||||
}
|
||||
|
||||
class Dep {
|
||||
constructor(computed) {
|
||||
this.computed = computed;
|
||||
this.version = 0;
|
||||
/**
|
||||
* Link between this dep and the current active effect
|
||||
*/
|
||||
this.activeLink = void 0;
|
||||
/**
|
||||
* Doubly linked list representing the subscribing effects (tail)
|
||||
*/
|
||||
this.subs = void 0;
|
||||
/**
|
||||
* For object property deps cleanup
|
||||
*/
|
||||
this.map = void 0;
|
||||
this.key = void 0;
|
||||
/**
|
||||
* Subscriber counter
|
||||
*/
|
||||
this.sc = 0;
|
||||
if (!!(process.env.NODE_ENV !== "production")) {
|
||||
this.subsHead = void 0;
|
||||
}
|
||||
}
|
||||
track(debugInfo) {
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
trigger(debugInfo) {
|
||||
this.version++;
|
||||
this.notify(debugInfo);
|
||||
}
|
||||
notify(debugInfo) {
|
||||
startBatch();
|
||||
try {
|
||||
if (!!(process.env.NODE_ENV !== "production")) {
|
||||
for (let head = this.subsHead; head; head = head.nextSub) {
|
||||
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
||||
head.sub.onTrigger(
|
||||
extend(
|
||||
{
|
||||
effect: head.sub
|
||||
},
|
||||
debugInfo
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let link = this.subs; link; link = link.prevSub) {
|
||||
if (link.sub.notify()) {
|
||||
;
|
||||
link.sub.dep.notify();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
endBatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
const targetMap = /* @__PURE__ */ new WeakMap();
|
||||
Symbol(
|
||||
!!(process.env.NODE_ENV !== "production") ? "Object iterate" : ""
|
||||
);
|
||||
Symbol(
|
||||
!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : ""
|
||||
);
|
||||
Symbol(
|
||||
!!(process.env.NODE_ENV !== "production") ? "Array iterate" : ""
|
||||
);
|
||||
function track(target, type, key) {
|
||||
if (shouldTrack && activeSub) {
|
||||
let depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
||||
}
|
||||
let dep = depsMap.get(key);
|
||||
if (!dep) {
|
||||
depsMap.set(key, dep = new Dep());
|
||||
dep.map = depsMap;
|
||||
dep.key = key;
|
||||
}
|
||||
if (!!(process.env.NODE_ENV !== "production")) {
|
||||
dep.track({
|
||||
target,
|
||||
type,
|
||||
key
|
||||
});
|
||||
} else {
|
||||
dep.track();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isProxy(value) {
|
||||
return value ? !!value["__v_raw"] : false;
|
||||
}
|
||||
function toRaw(observed) {
|
||||
const raw = observed && observed["__v_raw"];
|
||||
return raw ? toRaw(raw) : observed;
|
||||
}
|
||||
|
||||
function isRef(r) {
|
||||
return !!(r && r.__v_isRef === true);
|
||||
return r ? r["__v_isRef"] === true : false;
|
||||
}
|
||||
|
||||
const stack = [];
|
||||
function pushWarningContext(vnode) {
|
||||
function pushWarningContext$1(vnode) {
|
||||
stack.push(vnode);
|
||||
}
|
||||
function popWarningContext() {
|
||||
function popWarningContext$1() {
|
||||
stack.pop();
|
||||
}
|
||||
let isWarning = false;
|
||||
function warn$1(msg, ...args) {
|
||||
if (isWarning) return;
|
||||
isWarning = true;
|
||||
pauseTracking();
|
||||
const instance = stack.length ? stack[stack.length - 1].component : null;
|
||||
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
||||
@@ -203,7 +348,11 @@ function warn$1(msg, ...args) {
|
||||
instance,
|
||||
11,
|
||||
[
|
||||
msg + args.join(""),
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
msg + args.map((a) => {
|
||||
var _a, _b;
|
||||
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
||||
}).join(""),
|
||||
instance && instance.proxy,
|
||||
trace.map(
|
||||
({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
|
||||
@@ -221,6 +370,7 @@ function warn$1(msg, ...args) {
|
||||
console.warn(...warnArgs);
|
||||
}
|
||||
resetTracking();
|
||||
isWarning = false;
|
||||
}
|
||||
function getComponentTrace() {
|
||||
let currentVNode = stack[stack.length - 1];
|
||||
@@ -319,19 +469,20 @@ const ErrorTypeStrings = {
|
||||
[11]: "app warnHandler",
|
||||
[12]: "ref function",
|
||||
[13]: "async component loader",
|
||||
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
||||
[14]: "scheduler flush",
|
||||
[15]: "component update",
|
||||
[16]: "app unmount cleanup function"
|
||||
};
|
||||
function callWithErrorHandling(fn, instance, type, args) {
|
||||
let res;
|
||||
try {
|
||||
res = args ? fn(...args) : fn();
|
||||
return args ? fn(...args) : fn();
|
||||
} catch (err) {
|
||||
handleError(err, instance, type);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function handleError(err, instance, type, throwInDev = true) {
|
||||
const contextVNode = instance ? instance.vnode : null;
|
||||
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
||||
if (instance) {
|
||||
let cur = instance.parent;
|
||||
const exposedInstance = instance.proxy;
|
||||
@@ -347,34 +498,36 @@ function handleError(err, instance, type, throwInDev = true) {
|
||||
}
|
||||
cur = cur.parent;
|
||||
}
|
||||
const appErrorHandler = instance.appContext.config.errorHandler;
|
||||
if (appErrorHandler) {
|
||||
callWithErrorHandling(
|
||||
appErrorHandler,
|
||||
null,
|
||||
10,
|
||||
[err, exposedInstance, errorInfo]
|
||||
);
|
||||
if (errorHandler) {
|
||||
pauseTracking();
|
||||
callWithErrorHandling(errorHandler, null, 10, [
|
||||
err,
|
||||
exposedInstance,
|
||||
errorInfo
|
||||
]);
|
||||
resetTracking();
|
||||
return;
|
||||
}
|
||||
}
|
||||
logError(err, type, contextVNode, throwInDev);
|
||||
logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
|
||||
}
|
||||
function logError(err, type, contextVNode, throwInDev = true) {
|
||||
function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
|
||||
if (!!(process.env.NODE_ENV !== "production")) {
|
||||
const info = ErrorTypeStrings[type];
|
||||
if (contextVNode) {
|
||||
pushWarningContext(contextVNode);
|
||||
pushWarningContext$1(contextVNode);
|
||||
}
|
||||
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
||||
if (contextVNode) {
|
||||
popWarningContext();
|
||||
popWarningContext$1();
|
||||
}
|
||||
if (throwInDev) {
|
||||
throw err;
|
||||
} else {
|
||||
console.error(err);
|
||||
}
|
||||
} else if (throwInProd) {
|
||||
throw err;
|
||||
} else {
|
||||
console.error(err);
|
||||
}
|
||||
@@ -395,6 +548,7 @@ function setDevtoolsHook(hook, target) {
|
||||
// (#4815)
|
||||
typeof window !== "undefined" && // some envs mock window but not fully
|
||||
window.HTMLElement && // also exclude jsdom
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
!((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
|
||||
) {
|
||||
const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
||||
@@ -416,14 +570,11 @@ function setDevtoolsHook(hook, target) {
|
||||
const g = getGlobalThis();
|
||||
const registerGlobalSetter = (key, setter) => {
|
||||
let setters;
|
||||
if (!(setters = g[key]))
|
||||
setters = g[key] = [];
|
||||
if (!(setters = g[key])) setters = g[key] = [];
|
||||
setters.push(setter);
|
||||
return (v) => {
|
||||
if (setters.length > 1)
|
||||
setters.forEach((set) => set(v));
|
||||
else
|
||||
setters[0](v);
|
||||
if (setters.length > 1) setters.forEach((set) => set(v));
|
||||
else setters[0](v);
|
||||
};
|
||||
};
|
||||
registerGlobalSetter(
|
||||
@@ -435,6 +586,25 @@ function setDevtoolsHook(hook, target) {
|
||||
(v) => v
|
||||
);
|
||||
}
|
||||
!!(process.env.NODE_ENV !== "production") ? {
|
||||
get(target, key) {
|
||||
track(target, "get", "");
|
||||
return target[key];
|
||||
},
|
||||
set() {
|
||||
warn$1(`setupContext.attrs is readonly.`);
|
||||
return false;
|
||||
},
|
||||
deleteProperty() {
|
||||
warn$1(`setupContext.attrs is readonly.`);
|
||||
return false;
|
||||
}
|
||||
} : {
|
||||
get(target, key) {
|
||||
track(target, "get", "");
|
||||
return target[key];
|
||||
}
|
||||
};
|
||||
const classifyRE = /(?:^|[-_])(\w)/g;
|
||||
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
||||
function getComponentName(Component, includeInferred = true) {
|
||||
@@ -462,6 +632,9 @@ function formatComponentName(instance, Component, isRoot = false) {
|
||||
}
|
||||
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
||||
}
|
||||
function isClassComponent(value) {
|
||||
return isFunction(value) && "__vccOpts" in value;
|
||||
}
|
||||
|
||||
const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
||||
!!(process.env.NODE_ENV !== "production") || true ? devtools : void 0;
|
||||
@@ -509,7 +682,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
||||
return dir.getSSRProps(
|
||||
{
|
||||
dir,
|
||||
instance,
|
||||
instance: ssrUtils.getComponentPublicInstance(instance.$),
|
||||
value,
|
||||
oldValue: void 0,
|
||||
arg,
|
||||
@@ -560,7 +733,9 @@ const {
|
||||
setCurrentRenderingInstance,
|
||||
setupComponent,
|
||||
renderComponentRoot,
|
||||
normalizeVNode
|
||||
normalizeVNode,
|
||||
pushWarningContext,
|
||||
popWarningContext
|
||||
} = ssrUtils;
|
||||
function createBuffer() {
|
||||
let appendable = false;
|
||||
@@ -573,9 +748,9 @@ function createBuffer() {
|
||||
const isStringItem = isString(item);
|
||||
if (appendable && isStringItem) {
|
||||
buffer[buffer.length - 1] += item;
|
||||
} else {
|
||||
buffer.push(item);
|
||||
return;
|
||||
}
|
||||
buffer.push(item);
|
||||
appendable = isStringItem;
|
||||
if (isPromise(item) || isArray(item) && item.hasAsync) {
|
||||
buffer.hasAsync = true;
|
||||
@@ -584,29 +759,36 @@ function createBuffer() {
|
||||
};
|
||||
}
|
||||
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
||||
const instance = createComponentInstance(vnode, parentComponent, null);
|
||||
const instance = vnode.component = createComponentInstance(
|
||||
vnode,
|
||||
parentComponent,
|
||||
null
|
||||
);
|
||||
if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(vnode);
|
||||
const res = setupComponent(
|
||||
instance,
|
||||
true
|
||||
/* isSSR */
|
||||
);
|
||||
if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
|
||||
const hasAsyncSetup = isPromise(res);
|
||||
const prefetches = instance.sp;
|
||||
let prefetches = instance.sp;
|
||||
if (hasAsyncSetup || prefetches) {
|
||||
let p = hasAsyncSetup ? res : Promise.resolve();
|
||||
if (prefetches) {
|
||||
p = p.then(
|
||||
() => Promise.all(
|
||||
const p = Promise.resolve(res).then(() => {
|
||||
if (hasAsyncSetup) prefetches = instance.sp;
|
||||
if (prefetches) {
|
||||
return Promise.all(
|
||||
prefetches.map((prefetch) => prefetch.call(instance.proxy))
|
||||
)
|
||||
).catch(NOOP);
|
||||
}
|
||||
);
|
||||
}
|
||||
}).catch(NOOP);
|
||||
return p.then(() => renderComponentSubTree(instance, slotScopeId));
|
||||
} else {
|
||||
return renderComponentSubTree(instance, slotScopeId);
|
||||
}
|
||||
}
|
||||
function renderComponentSubTree(instance, slotScopeId) {
|
||||
if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(instance.vnode);
|
||||
const comp = instance.type;
|
||||
const { getBuffer, push } = createBuffer();
|
||||
if (isFunction(comp)) {
|
||||
@@ -623,12 +805,6 @@ function renderComponentSubTree(instance, slotScopeId) {
|
||||
if ((!instance.render || instance.render === NOOP) && !instance.ssrRender && !comp.ssrRender && isString(comp.template)) {
|
||||
comp.ssrRender = ssrCompile(comp.template);
|
||||
}
|
||||
for (const e of instance.scope.effects) {
|
||||
if (e.computed) {
|
||||
e.computed._dirty = true;
|
||||
e.computed._cacheable = true;
|
||||
}
|
||||
}
|
||||
const ssrRender = instance.ssrRender || comp.ssrRender;
|
||||
if (ssrRender) {
|
||||
let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
|
||||
@@ -651,9 +827,11 @@ function renderComponentSubTree(instance, slotScopeId) {
|
||||
}
|
||||
}
|
||||
if (slotScopeId) {
|
||||
if (!hasCloned)
|
||||
attrs = { ...attrs };
|
||||
attrs[slotScopeId.trim()] = "";
|
||||
if (!hasCloned) attrs = { ...attrs };
|
||||
const slotScopeIdList = slotScopeId.trim().split(" ");
|
||||
for (let i = 0; i < slotScopeIdList.length; i++) {
|
||||
attrs[slotScopeIdList[i]] = "";
|
||||
}
|
||||
}
|
||||
const prev = setCurrentRenderingInstance(instance);
|
||||
try {
|
||||
@@ -684,10 +862,14 @@ function renderComponentSubTree(instance, slotScopeId) {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
|
||||
return getBuffer();
|
||||
}
|
||||
function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const { type, shapeFlag, children } = vnode;
|
||||
const { type, shapeFlag, children, dirs, props } = vnode;
|
||||
if (dirs) {
|
||||
vnode.props = applySSRDirectives(vnode, props, dirs);
|
||||
}
|
||||
switch (type) {
|
||||
case Text:
|
||||
push(escapeHtml(children));
|
||||
@@ -738,11 +920,8 @@ function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
|
||||
}
|
||||
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const tag = vnode.type;
|
||||
let { props, children, shapeFlag, scopeId, dirs } = vnode;
|
||||
let { props, children, shapeFlag, scopeId } = vnode;
|
||||
let openTag = `<${tag}`;
|
||||
if (dirs) {
|
||||
props = applySSRDirectives(vnode, props, dirs);
|
||||
}
|
||||
if (props) {
|
||||
openTag += ssrRenderAttrs(props, tag);
|
||||
}
|
||||
@@ -800,8 +979,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
|
||||
} = binding;
|
||||
if (getSSRProps) {
|
||||
const props = getSSRProps(binding, vnode);
|
||||
if (props)
|
||||
toMerge.push(props);
|
||||
if (props) toMerge.push(props);
|
||||
}
|
||||
}
|
||||
return mergeProps(rawProps || {}, ...toMerge);
|
||||
@@ -838,24 +1016,36 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
}
|
||||
|
||||
const { isVNode: isVNode$1 } = ssrUtils;
|
||||
async function unrollBuffer$1(buffer) {
|
||||
if (buffer.hasAsync) {
|
||||
let ret = "";
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (isString(item)) {
|
||||
ret += item;
|
||||
} else {
|
||||
ret += await unrollBuffer$1(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
return unrollBufferSync$1(buffer);
|
||||
function nestedUnrollBuffer(buffer, parentRet, startIndex) {
|
||||
if (!buffer.hasAsync) {
|
||||
return parentRet + unrollBufferSync$1(buffer);
|
||||
}
|
||||
let ret = parentRet;
|
||||
for (let i = startIndex; i < buffer.length; i += 1) {
|
||||
const item = buffer[i];
|
||||
if (isString(item)) {
|
||||
ret += item;
|
||||
continue;
|
||||
}
|
||||
if (isPromise(item)) {
|
||||
return item.then((nestedItem) => {
|
||||
buffer[i] = nestedItem;
|
||||
return nestedUnrollBuffer(buffer, ret, i);
|
||||
});
|
||||
}
|
||||
const result = nestedUnrollBuffer(item, ret, 0);
|
||||
if (isPromise(result)) {
|
||||
return result.then((nestedItem) => {
|
||||
buffer[i] = nestedItem;
|
||||
return nestedUnrollBuffer(buffer, "", i);
|
||||
});
|
||||
}
|
||||
ret = result;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function unrollBuffer$1(buffer) {
|
||||
return nestedUnrollBuffer(buffer, "", 0);
|
||||
}
|
||||
function unrollBufferSync$1(buffer) {
|
||||
let ret = "";
|
||||
@@ -986,8 +1176,7 @@ function renderToWebStream(input, context = {}) {
|
||||
start(controller) {
|
||||
renderToSimpleStream(input, context, {
|
||||
push(content) {
|
||||
if (cancelled)
|
||||
return;
|
||||
if (cancelled) return;
|
||||
if (content != null) {
|
||||
controller.enqueue(encoder.encode(content));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user