@vue/server-renderer 3.6.0-beta.9 → 3.6.0-rc.10

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,12 +1,12 @@
1
1
  /**
2
- * @vue/server-renderer v3.6.0-beta.9
2
+ * @vue/server-renderer v3.6.0-rc.10
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
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, isModelListener, isObject, isOn, isPromise, isRenderableAttrValue, isSSRSafeAttrName, isSVGTag, isString, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeCssVarValue, normalizeStyle, propsToAttrMap, stringifyStyle, toDisplayString } from "@vue/shared";
6
+ import { Comment, Fragment, Static, Text, createApp, createVNode, getCurrentInstance, handleError, initDirectivesForSSR, mergeProps, ssrContextKey, ssrUtils, warn } from "@vue/runtime-dom";
7
+ import { NOOP, escapeHtml, escapeHtmlComment, hasOwn, 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
8
  //#region packages/server-renderer/src/helpers/ssrRenderAttrs.ts
9
- const shouldIgnoreProp = /* @__PURE__ */ makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
9
+ const shouldIgnoreProp = /*@__PURE__*/ makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
10
10
  function ssrRenderAttrs(props, tag) {
11
11
  let ret = "";
12
12
  for (let key in props) {
@@ -24,7 +24,7 @@ function ssrRenderAttrs(props, tag) {
24
24
  function ssrRenderDynamicAttr(key, value, tag) {
25
25
  if (!isRenderableAttrValue(value)) return ``;
26
26
  const attrKey = tag && (tag.indexOf("-") > 0 || isSVGTag(tag)) ? key : propsToAttrMap[key] || key.toLowerCase();
27
- if (isBooleanAttr(attrKey)) return includeBooleanAttr(value) ? ` ${attrKey}` : ``;
27
+ if (isBooleanAttr(attrKey) || attrKey === "hidden" && (typeof value === "boolean" || typeof value === "number")) return includeBooleanAttr(value) ? ` ${attrKey}` : ``;
28
28
  else if (isSSRSafeAttrName(attrKey)) return value === "" ? ` ${attrKey}` : ` ${attrKey}="${escapeHtml(value)}"`;
29
29
  else {
30
30
  console.warn(`[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`);
@@ -41,7 +41,8 @@ function ssrRenderClass(raw) {
41
41
  function ssrRenderStyle(raw) {
42
42
  if (!raw) return "";
43
43
  if (isString(raw)) return escapeHtml(raw);
44
- return escapeHtml(stringifyStyle(normalizeStyle(ssrResetCssVars(raw))));
44
+ const styles = normalizeStyle(ssrResetCssVars(raw));
45
+ return escapeHtml(stringifyStyle(styles));
45
46
  }
46
47
  function ssrResetCssVars(raw) {
47
48
  if (!isArray(raw) && isObject(raw)) {
@@ -53,53 +54,76 @@ function ssrResetCssVars(raw) {
53
54
  return raw;
54
55
  }
55
56
  //#endregion
56
- //#region packages/server-renderer/src/helpers/ssrRenderComponent.ts
57
- function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
58
- return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
59
- }
60
- //#endregion
61
57
  //#region packages/server-renderer/src/helpers/ssrRenderSlot.ts
62
- const { ensureValidVNode } = ssrUtils;
58
+ const { ensureValidVNode, rawVaporSlotKey: rawVaporSlotKey$1 } = ssrUtils;
59
+ let vaporSlots = 0;
63
60
  function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
64
- push(`<!--[-->`);
65
61
  ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId);
66
- push(`<!--]-->`);
67
62
  }
68
63
  function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId, transition) {
69
64
  const slotFn = slots[slotName];
65
+ let fallback = false;
70
66
  if (slotFn) {
67
+ if (slotFn[rawVaporSlotKey$1]) vaporSlots++;
68
+ const before = vaporSlots;
71
69
  const slotBuffer = [];
72
70
  const bufferedPush = (item) => {
73
71
  slotBuffer.push(item);
74
72
  };
75
- const ret = slotFn(slotProps, bufferedPush, parentComponent, slotScopeId ? " " + slotScopeId : "");
73
+ const ret = slotFn(slotProps || {}, bufferedPush, parentComponent, slotScopeId ? " " + slotScopeId : "");
74
+ let vnodes;
76
75
  if (isArray(ret)) {
77
- const validSlotContent = ensureValidVNode(ret);
78
- if (validSlotContent) renderVNodeChildren(push, validSlotContent, parentComponent, slotScopeId);
76
+ vnodes = ensureValidVNode(ret);
77
+ if (vnodes && isVaporSlotContent(vnodes)) {
78
+ renderVNodeChildren(bufferedPush, vnodes, parentComponent, slotScopeId);
79
+ vnodes = void 0;
80
+ }
81
+ }
82
+ if (vnodes !== void 0) {
83
+ if (!transition) {
84
+ fallback = !vnodes && !!fallbackRenderFn;
85
+ push(fallback ? `<!--(-->` : `<!--[-->`);
86
+ }
87
+ if (vnodes) renderVNodeChildren(push, vnodes, parentComponent, slotScopeId);
79
88
  else if (fallbackRenderFn) fallbackRenderFn();
80
89
  else if (transition) push(`<!---->`);
81
90
  } else {
82
91
  let isEmptySlot = true;
83
- if (transition) isEmptySlot = false;
92
+ const owner = getCurrentInstance();
93
+ if (transition || !(owner && owner.type.__vapor) && !fallbackRenderFn && vaporSlots !== before) isEmptySlot = false;
84
94
  else for (let i = 0; i < slotBuffer.length; i++) if (!isComment(slotBuffer[i])) {
85
95
  isEmptySlot = false;
86
96
  break;
87
97
  }
98
+ if (!transition) {
99
+ fallback = isEmptySlot && !!fallbackRenderFn;
100
+ push(fallback ? `<!--(-->` : `<!--[-->`);
101
+ }
88
102
  if (isEmptySlot) {
89
103
  if (fallbackRenderFn) fallbackRenderFn();
90
104
  } else {
91
105
  let start = 0;
92
106
  let end = slotBuffer.length;
93
- if (transition && slotBuffer[0] === "<!--[-->" && slotBuffer[end - 1] === "<!--]-->") {
94
- start++;
95
- end--;
107
+ if (transition) {
108
+ const first = slotBuffer[0];
109
+ if ((first === "<!--[-->" || first === "<!--(-->") && slotBuffer[end - 1] === (first === "<!--(-->" ? "<!--)-->" : "<!--]-->")) {
110
+ start++;
111
+ end--;
112
+ }
96
113
  }
97
114
  if (start < end) for (let i = start; i < end; i++) push(slotBuffer[i]);
98
115
  else if (transition) push(`<!---->`);
99
116
  }
100
117
  }
101
- } else if (fallbackRenderFn) fallbackRenderFn();
102
- else if (transition) push(`<!---->`);
118
+ } else {
119
+ if (!transition) {
120
+ fallback = !!fallbackRenderFn;
121
+ push(fallback ? `<!--(-->` : `<!--[-->`);
122
+ }
123
+ if (fallbackRenderFn) fallbackRenderFn();
124
+ else if (transition) push(`<!---->`);
125
+ }
126
+ if (!transition) push(fallback ? `<!--)-->` : `<!--]-->`);
103
127
  }
104
128
  const commentTestRE = /^<!--[\s\S]*-->$/;
105
129
  const commentRE = /<!--[^]*?-->/gm;
@@ -109,6 +133,16 @@ function isComment(item) {
109
133
  return !item.replace(commentRE, "").trim();
110
134
  }
111
135
  //#endregion
136
+ //#region packages/server-renderer/src/helpers/ssrRenderComponent.ts
137
+ function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
138
+ if (isString(comp)) {
139
+ const { getBuffer, push } = createBuffer();
140
+ renderVNode(push, createVNode(comp, props, children), parentComponent, slotScopeId);
141
+ return getBuffer();
142
+ }
143
+ return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
144
+ }
145
+ //#endregion
112
146
  //#region packages/server-renderer/src/helpers/ssrRenderTeleport.ts
113
147
  function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
114
148
  parentPush("<!--teleport start-->");
@@ -128,6 +162,7 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
128
162
  teleportContent = getBuffer();
129
163
  }
130
164
  targetBuffer.splice(bufferIndex, 0, teleportContent);
165
+ if (isPromise(teleportContent) || isArray(teleportContent) && teleportContent.hasAsync) targetBuffer.hasAsync = true;
131
166
  parentPush("<!--teleport end-->");
132
167
  }
133
168
  //#endregion
@@ -136,806 +171,31 @@ function ssrInterpolate(value) {
136
171
  return escapeHtml(toDisplayString(value));
137
172
  }
138
173
  //#endregion
139
- //#region packages/reactivity/src/system.ts
140
- let activeSub = void 0;
141
- function setActiveSub(sub) {
142
- try {
143
- return activeSub;
144
- } finally {
145
- activeSub = sub;
146
- }
147
- }
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" : "");
151
- //#endregion
152
- //#region packages/reactivity/src/reactive.ts
153
- /**
154
- * Checks if an object is a proxy created by {@link reactive},
155
- * {@link readonly}, {@link shallowReactive} or {@link shallowReadonly}.
156
- *
157
- * @param value - The value to check.
158
- * @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
159
- */
160
- /* @__NO_SIDE_EFFECTS__ */
161
- function isProxy(value) {
162
- return value ? !!value["__v_raw"] : false;
163
- }
164
- /**
165
- * Returns the raw, original object of a Vue-created proxy.
166
- *
167
- * `toRaw()` can return the original object from proxies created by
168
- * {@link reactive}, {@link readonly}, {@link shallowReactive} or
169
- * {@link shallowReadonly}.
170
- *
171
- * This is an escape hatch that can be used to temporarily read without
172
- * incurring proxy access / tracking overhead or write without triggering
173
- * changes. It is **not** recommended to hold a persistent reference to the
174
- * original object. Use with caution.
175
- *
176
- * @example
177
- * ```js
178
- * const foo = {}
179
- * const reactiveFoo = reactive(foo)
180
- *
181
- * console.log(toRaw(reactiveFoo) === foo) // true
182
- * ```
183
- *
184
- * @param observed - The object for which the "raw" value is requested.
185
- * @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
186
- */
187
- /* @__NO_SIDE_EFFECTS__ */
188
- function toRaw(observed) {
189
- const raw = observed && observed["__v_raw"];
190
- return raw ? /* @__PURE__ */ toRaw(raw) : observed;
191
- }
192
- //#endregion
193
- //#region packages/reactivity/src/ref.ts
194
- /* @__NO_SIDE_EFFECTS__ */
195
- function isRef(r) {
196
- return r ? r["__v_isRef"] === true : false;
197
- }
198
- //#endregion
199
- //#region packages/runtime-core/src/warning.ts
200
- const stack = [];
201
- /**
202
- * @internal
203
- */
204
- function pushWarningContext$1(ctx) {
205
- stack.push(ctx);
206
- }
207
- /**
208
- * @internal
209
- */
210
- function popWarningContext$1() {
211
- stack.pop();
212
- }
213
- let isWarning = false;
214
- function warn$2(msg, ...args) {
215
- if (isWarning) return;
216
- isWarning = true;
217
- const prevSub = setActiveSub();
218
- const entry = stack.length ? stack[stack.length - 1] : null;
219
- const instance = isVNode$2(entry) ? entry.component : entry;
220
- const appWarnHandler = instance && instance.appContext.config.warnHandler;
221
- const trace = getComponentTrace();
222
- if (appWarnHandler) callWithErrorHandling(appWarnHandler, instance, 11, [
223
- msg + args.map((a) => {
224
- const toString = a.toString;
225
- return toString == null ? JSON.stringify(a) : toString.call(a);
226
- }).join(""),
227
- instance && instance.proxy || instance,
228
- trace.map(({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`).join("\n"),
229
- trace
230
- ]);
231
- else {
232
- const warnArgs = [`[Vue warn]: ${msg}`, ...args];
233
- if (trace.length && true)
234
- /* v8 ignore next 2 */
235
- warnArgs.push(`\n`, ...formatTrace(trace));
236
- console.warn(...warnArgs);
237
- }
238
- setActiveSub(prevSub);
239
- isWarning = false;
240
- }
241
- function getComponentTrace() {
242
- let currentCtx = stack[stack.length - 1];
243
- if (!currentCtx) return [];
244
- const normalizedStack = [];
245
- while (currentCtx) {
246
- const last = normalizedStack[0];
247
- if (last && last.ctx === currentCtx) last.recurseCount++;
248
- else normalizedStack.push({
249
- ctx: currentCtx,
250
- recurseCount: 0
251
- });
252
- if (isVNode$2(currentCtx)) {
253
- const parent = currentCtx.component && currentCtx.component.parent;
254
- currentCtx = parent && parent.vnode || parent;
255
- } else currentCtx = currentCtx.parent;
256
- }
257
- return normalizedStack;
258
- }
259
- /* v8 ignore start */
260
- function formatTrace(trace) {
261
- const logs = [];
262
- trace.forEach((entry, i) => {
263
- logs.push(...i === 0 ? [] : [`\n`], ...formatTraceEntry(entry));
264
- });
265
- return logs;
266
- }
267
- function formatTraceEntry({ ctx, recurseCount }) {
268
- const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
269
- const instance = isVNode$2(ctx) ? ctx.component : ctx;
270
- const isRoot = instance ? instance.parent == null : false;
271
- const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
272
- const close = `>` + postfix;
273
- return ctx.props ? [
274
- open,
275
- ...formatProps(ctx.props),
276
- close
277
- ] : [open + close];
278
- }
279
- function formatProps(props) {
280
- const res = [];
281
- const keys = Object.keys(props);
282
- keys.slice(0, 3).forEach((key) => {
283
- res.push(...formatProp(key, props[key]));
284
- });
285
- if (keys.length > 3) res.push(` ...`);
286
- return res;
287
- }
288
- function formatProp(key, value, raw) {
289
- if (isString(value)) {
290
- value = JSON.stringify(value);
291
- return raw ? value : [`${key}=${value}`];
292
- } else if (typeof value === "number" || typeof value === "boolean" || value == null) return raw ? value : [`${key}=${value}`];
293
- else if (/* @__PURE__ */ isRef(value)) {
294
- value = formatProp(key, /* @__PURE__ */ toRaw(value.value), true);
295
- return raw ? value : [
296
- `${key}=Ref<`,
297
- value,
298
- `>`
299
- ];
300
- } else if (isFunction(value)) return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
301
- else {
302
- value = /* @__PURE__ */ toRaw(value);
303
- return raw ? value : [`${key}=`, value];
304
- }
305
- }
306
- /* v8 ignore stop */
307
- //#endregion
308
- //#region packages/runtime-core/src/errorHandling.ts
309
- const ErrorTypeStrings = {
310
- ["sp"]: "serverPrefetch hook",
311
- ["bc"]: "beforeCreate hook",
312
- ["c"]: "created hook",
313
- ["bm"]: "beforeMount hook",
314
- ["m"]: "mounted hook",
315
- ["bu"]: "beforeUpdate hook",
316
- ["u"]: "updated",
317
- ["bum"]: "beforeUnmount hook",
318
- ["um"]: "unmounted hook",
319
- ["a"]: "activated hook",
320
- ["da"]: "deactivated hook",
321
- ["ec"]: "errorCaptured hook",
322
- ["rtc"]: "renderTracked hook",
323
- ["rtg"]: "renderTriggered hook",
324
- [0]: "setup function",
325
- [1]: "render function",
326
- [2]: "watcher getter",
327
- [3]: "watcher callback",
328
- [4]: "watcher cleanup function",
329
- [5]: "native event handler",
330
- [6]: "component event handler",
331
- [7]: "vnode hook",
332
- [8]: "directive hook",
333
- [9]: "transition hook",
334
- [10]: "app errorHandler",
335
- [11]: "app warnHandler",
336
- [12]: "ref function",
337
- [13]: "async component loader",
338
- [14]: "scheduler flush",
339
- [15]: "component update",
340
- [16]: "app unmount cleanup function"
341
- };
342
- function callWithErrorHandling(fn, instance, type, args) {
343
- try {
344
- return args ? fn(...args) : fn();
345
- } catch (err) {
346
- handleError(err, instance, type);
347
- }
348
- }
349
- function handleError(err, instance, type, throwInDev = true) {
350
- const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
351
- if (instance) {
352
- let cur = instance.parent;
353
- const exposedInstance = instance.proxy || instance;
354
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
355
- while (cur) {
356
- const errorCapturedHooks = cur.ec;
357
- if (errorCapturedHooks) {
358
- for (let i = 0; i < errorCapturedHooks.length; i++) if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) return;
359
- }
360
- cur = cur.parent;
361
- }
362
- if (errorHandler) {
363
- const prevSub = setActiveSub();
364
- callWithErrorHandling(errorHandler, null, 10, [
365
- err,
366
- exposedInstance,
367
- errorInfo
368
- ]);
369
- setActiveSub(prevSub);
370
- return;
371
- }
372
- }
373
- logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
374
- }
375
- function logError(err, type, instance, throwInDev = true, throwInProd = false) {
376
- if (!!(process.env.NODE_ENV !== "production")) {
377
- const info = ErrorTypeStrings[type];
378
- if (instance) pushWarningContext$1(instance);
379
- warn$2(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
380
- if (instance) popWarningContext$1();
381
- if (throwInDev) throw err;
382
- else console.error(err);
383
- } else if (throwInProd) throw err;
384
- else console.error(err);
385
- }
386
- //#endregion
387
- //#region packages/runtime-core/src/scheduler.ts
388
- const jobs = [];
389
- let postJobs = [];
390
- let activePostJobs = null;
391
- let currentFlushPromise = null;
392
- let jobsLength = 0;
393
- let flushIndex = 0;
394
- let postFlushIndex = 0;
395
- const resolvedPromise = /* @__PURE__ */ Promise.resolve();
396
- const RECURSION_LIMIT = 100;
397
- function nextTick(fn) {
398
- const p = currentFlushPromise || resolvedPromise;
399
- return fn ? p.then(this ? fn.bind(this) : fn) : p;
400
- }
401
- function findInsertionIndex(order, queue, start, end) {
402
- while (start < end) {
403
- const middle = start + end >>> 1;
404
- if (queue[middle].order <= order) start = middle + 1;
405
- else end = middle;
406
- }
407
- return start;
408
- }
409
- /**
410
- * @internal for runtime-vapor only
411
- */
412
- function queueJob(job, id, isPre = false) {
413
- if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
414
- jobsLength++;
415
- queueFlush();
416
- }
417
- }
418
- function queueJobWorker(job, order, queue, length, flushIndex) {
419
- const flags = job.flags;
420
- if (!(flags & 1)) {
421
- job.flags = flags | 1;
422
- job.order = order;
423
- if (flushIndex === length || order >= queue[length - 1].order) queue[length] = job;
424
- else queue.splice(findInsertionIndex(order, queue, flushIndex, length), 0, job);
425
- return true;
426
- }
427
- return false;
428
- }
429
- const doFlushJobs = () => {
430
- try {
431
- flushJobs();
432
- } catch (e) {
433
- currentFlushPromise = null;
434
- throw e;
435
- }
436
- };
437
- function queueFlush() {
438
- if (!currentFlushPromise) currentFlushPromise = resolvedPromise.then(doFlushJobs);
439
- }
440
- function queuePostFlushCb(jobs, id = Infinity) {
441
- if (!isArray(jobs)) if (activePostJobs && id === -1) activePostJobs.splice(postFlushIndex, 0, jobs);
442
- else queueJobWorker(jobs, id, postJobs, postJobs.length, 0);
443
- else for (const job of jobs) queueJobWorker(job, id, postJobs, postJobs.length, 0);
444
- queueFlush();
445
- }
446
- function flushPostFlushCbs(seen) {
447
- if (postJobs.length) {
448
- if (activePostJobs) {
449
- activePostJobs.push(...postJobs);
450
- postJobs.length = 0;
451
- return;
452
- }
453
- activePostJobs = postJobs;
454
- postJobs = [];
455
- if (!!(process.env.NODE_ENV !== "production")) seen = seen || /* @__PURE__ */ new Map();
456
- while (postFlushIndex < activePostJobs.length) {
457
- const cb = activePostJobs[postFlushIndex++];
458
- if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) continue;
459
- if (cb.flags & 2) cb.flags &= -2;
460
- if (!(cb.flags & 4)) try {
461
- cb();
462
- } finally {
463
- cb.flags &= -2;
464
- }
465
- }
466
- activePostJobs = null;
467
- postFlushIndex = 0;
468
- }
469
- }
470
- function flushJobs(seen) {
471
- if (!!(process.env.NODE_ENV !== "production")) seen || (seen = /* @__PURE__ */ new Map());
472
- try {
473
- while (flushIndex < jobsLength) {
474
- const job = jobs[flushIndex];
475
- jobs[flushIndex++] = void 0;
476
- if (!(job.flags & 4)) {
477
- if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, job)) continue;
478
- if (job.flags & 2) job.flags &= -2;
479
- try {
480
- job();
481
- } catch (err) {
482
- handleError(err, job.i, job.i ? 15 : 14);
483
- } finally {
484
- if (!(job.flags & 2)) job.flags &= -2;
485
- }
486
- }
487
- }
488
- } finally {
489
- while (flushIndex < jobsLength) {
490
- jobs[flushIndex].flags &= -2;
491
- jobs[flushIndex++] = void 0;
492
- }
493
- flushIndex = 0;
494
- jobsLength = 0;
495
- flushPostFlushCbs(seen);
496
- currentFlushPromise = null;
497
- if (jobsLength || postJobs.length) flushJobs(seen);
498
- }
499
- }
500
- function checkRecursiveUpdates(seen, fn) {
501
- const count = seen.get(fn) || 0;
502
- if (count > RECURSION_LIMIT) {
503
- const instance = fn.i;
504
- const componentName = instance && getComponentName(instance.type);
505
- handleError(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`, null, 10);
506
- return true;
507
- }
508
- seen.set(fn, count + 1);
509
- return false;
510
- }
511
- //#endregion
512
- //#region packages/runtime-core/src/hmr.ts
513
- let isHmrUpdating = false;
514
- const hmrDirtyComponents = /* @__PURE__ */ new Map();
515
- const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
516
- if (!!(process.env.NODE_ENV !== "production")) getGlobalThis().__VUE_HMR_RUNTIME__ = {
517
- createRecord: tryWrap(createRecord),
518
- rerender: tryWrap(rerender),
519
- reload: tryWrap(reload)
520
- };
521
- const map = /* @__PURE__ */ new Map();
522
- function createRecord(id, initialDef) {
523
- if (map.has(id)) return false;
524
- map.set(id, {
525
- initialDef: normalizeClassComponent(initialDef),
526
- instances: /* @__PURE__ */ new Set()
527
- });
528
- return true;
529
- }
530
- function normalizeClassComponent(component) {
531
- return isClassComponent(component) ? component.__vccOpts : component;
532
- }
533
- function rerender(id, newRender) {
534
- const record = map.get(id);
535
- if (!record) return;
536
- record.initialDef.render = newRender;
537
- [...record.instances].forEach((instance) => {
538
- if (newRender) {
539
- instance.render = newRender;
540
- normalizeClassComponent(instance.type).render = newRender;
541
- }
542
- isHmrUpdating = true;
543
- if (instance.vapor) {
544
- if (!instance.isUnmounted) instance.hmrRerender();
545
- } else {
546
- const i = instance;
547
- if (!(i.effect.flags & 1024)) {
548
- i.renderCache = [];
549
- i.effect.run();
550
- }
551
- }
552
- nextTick(() => {
553
- isHmrUpdating = false;
554
- });
555
- });
556
- }
557
- function reload(id, newComp) {
558
- const record = map.get(id);
559
- if (!record) return;
560
- newComp = normalizeClassComponent(newComp);
561
- const isVapor = record.initialDef.__vapor;
562
- updateComponentDef(record.initialDef, newComp);
563
- const instances = [...record.instances];
564
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
565
- for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
566
- for (const instance of instances) instance.hmrReload(newComp);
567
- } else for (const instance of instances) {
568
- const oldComp = normalizeClassComponent(instance.type);
569
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
570
- if (!dirtyInstances) {
571
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
572
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
573
- }
574
- dirtyInstances.add(instance);
575
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
576
- instance.appContext.propsCache.delete(instance.type);
577
- instance.appContext.emitsCache.delete(instance.type);
578
- instance.appContext.optionsCache.delete(instance.type);
579
- if (instance.ceReload) {
580
- dirtyInstances.add(instance);
581
- instance.ceReload(newComp.styles);
582
- dirtyInstances.delete(instance);
583
- } else if (instance.parent) queueJob(() => {
584
- isHmrUpdating = true;
585
- const parent = instance.parent;
586
- if (parent.vapor) parent.hmrRerender();
587
- else if (!(parent.effect.flags & 1024)) {
588
- parent.renderCache = [];
589
- parent.effect.run();
590
- }
591
- nextTick(() => {
592
- isHmrUpdating = false;
593
- });
594
- dirtyInstances.delete(instance);
595
- });
596
- else if (instance.appContext.reload) instance.appContext.reload();
597
- else if (typeof window !== "undefined") window.location.reload();
598
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
599
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
600
- }
601
- queuePostFlushCb(() => {
602
- hmrDirtyComponents.clear();
603
- hmrDirtyComponentsMode.clear();
604
- });
605
- }
606
- function updateComponentDef(oldComp, newComp) {
607
- extend(oldComp, newComp);
608
- for (const key in oldComp) if (key !== "__file" && !(key in newComp)) delete oldComp[key];
609
- }
610
- function tryWrap(fn) {
611
- return (id, arg) => {
612
- try {
613
- return fn(id, arg);
614
- } catch (e) {
615
- console.error(e);
616
- console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.");
617
- }
618
- };
619
- }
620
- //#endregion
621
- //#region packages/runtime-core/src/devtools.ts
622
- let devtools$1;
623
- let buffer = [];
624
- function setDevtoolsHook$1(hook, target) {
625
- var _window$navigator;
626
- devtools$1 = hook;
627
- if (devtools$1) {
628
- devtools$1.enabled = true;
629
- buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
630
- buffer = [];
631
- } else if (typeof window !== "undefined" && window.HTMLElement && !((_window$navigator = window.navigator) === null || _window$navigator === void 0 || (_window$navigator = _window$navigator.userAgent) === null || _window$navigator === void 0 ? void 0 : _window$navigator.includes("jsdom"))) {
632
- (target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((newHook) => {
633
- setDevtoolsHook$1(newHook, target);
634
- });
635
- setTimeout(() => {
636
- if (!devtools$1) {
637
- target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
638
- buffer = [];
639
- }
640
- }, 3e3);
641
- } else buffer = [];
642
- }
643
- //#endregion
644
- //#region packages/runtime-core/src/componentRenderContext.ts
645
- /**
646
- * mark the current rendering instance for asset resolution (e.g.
647
- * resolveComponent, resolveDirective) during render
648
- */
649
- let currentRenderingInstance = null;
650
- let currentScopeId = null;
651
- //#endregion
652
- //#region packages/runtime-core/src/components/Teleport.ts
653
- const isTeleport = (type) => type.__isTeleport;
654
- //#endregion
655
- //#region packages/runtime-core/src/components/BaseTransition.ts
656
- function setTransitionHooks(vnode, hooks) {
657
- if (vnode.shapeFlag & 6 && vnode.component) if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
658
- else {
659
- vnode.transition = hooks;
660
- setTransitionHooks(vnode.component.subTree, hooks);
661
- }
662
- else if (vnode.shapeFlag & 128) {
663
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
664
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
665
- } else vnode.transition = hooks;
666
- }
667
- //#endregion
668
- //#region packages/runtime-core/src/helpers/resolveAssets.ts
669
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
670
- //#endregion
671
- //#region packages/runtime-core/src/internalObject.ts
672
- /**
673
- * Used during vnode props/slots normalization to check if the vnode props/slots
674
- * are the internal attrs / slots object of a component via
675
- * `Object.getPrototypeOf`. This is more performant than defining a
676
- * non-enumerable property. (one of the optimizations done for ssr-benchmark)
677
- */
678
- const internalObjectProto = {};
679
- const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
680
- //#endregion
681
- //#region packages/runtime-core/src/renderer.ts
682
- function getVaporInterface(instance, vnode) {
683
- const ctx = instance ? instance.appContext : vnode.appContext;
684
- const res = ctx && ctx.vapor;
685
- if (!!(process.env.NODE_ENV !== "production") && !res) warn$2("Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:\n```\nimport { vaporInteropPlugin } from 'vue'\napp.use(vaporInteropPlugin)\n```");
686
- return res;
687
- }
688
- function isVaporComponent(type) {
689
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating && hmrDirtyComponentsMode.has(type)) return hmrDirtyComponentsMode.get(type);
690
- return type.__vapor;
691
- }
692
- //#endregion
693
- //#region packages/runtime-core/src/components/Suspense.ts
694
- const isSuspense = (type) => type.__isSuspense;
695
- //#endregion
696
- //#region packages/runtime-core/src/vnode.ts
697
- const Fragment$1 = Symbol.for("v-fgt");
698
- const Text$1 = Symbol.for("v-txt");
699
- const Comment$1 = Symbol.for("v-cmt");
700
- function isVNode$2(value) {
701
- return value ? value.__v_isVNode === true : false;
702
- }
703
- const createVNodeWithArgsTransform = (...args) => {
704
- return _createVNode(...args);
705
- };
706
- const normalizeKey = ({ key }) => key != null ? key : null;
707
- const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
708
- if (typeof ref === "number") ref = "" + ref;
709
- return ref != null ? isString(ref) || /* @__PURE__ */ isRef(ref) || isFunction(ref) ? {
710
- i,
711
- r: ref,
712
- k: ref_key,
713
- f: !!ref_for
714
- } : ref : null;
715
- };
716
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment$1 ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
717
- const vnode = {
718
- __v_isVNode: true,
719
- __v_skip: true,
720
- type,
721
- props,
722
- key: props && normalizeKey(props),
723
- ref: props && normalizeRef(props),
724
- scopeId: currentScopeId,
725
- slotScopeIds: null,
726
- children,
727
- component: null,
728
- suspense: null,
729
- ssContent: null,
730
- ssFallback: null,
731
- dirs: null,
732
- transition: null,
733
- el: null,
734
- anchor: null,
735
- target: null,
736
- targetStart: null,
737
- targetAnchor: null,
738
- staticCount: 0,
739
- shapeFlag,
740
- patchFlag,
741
- dynamicProps,
742
- dynamicChildren: null,
743
- appContext: null,
744
- ctx: currentRenderingInstance
745
- };
746
- if (needFullChildrenNormalization) {
747
- normalizeChildren(vnode, children);
748
- if (shapeFlag & 128) type.normalize(vnode);
749
- } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
750
- if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) warn$2(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
751
- return vnode;
752
- }
753
- const createVNode$1 = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
754
- function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
755
- if (!type || type === NULL_DYNAMIC_COMPONENT) {
756
- if (!!(process.env.NODE_ENV !== "production") && !type) warn$2(`Invalid vnode type when creating vnode: ${type}.`);
757
- type = Comment$1;
758
- }
759
- if (isVNode$2(type)) {
760
- const cloned = cloneVNode(type, props, true);
761
- if (children) normalizeChildren(cloned, children);
762
- cloned.patchFlag = -2;
763
- return cloned;
764
- }
765
- if (isClassComponent(type)) type = type.__vccOpts;
766
- if (props) {
767
- props = guardReactiveProps(props);
768
- let { class: klass, style } = props;
769
- if (klass && !isString(klass)) props.class = normalizeClass(klass);
770
- if (isObject(style)) {
771
- if (/* @__PURE__ */ isProxy(style) && !isArray(style)) style = extend({}, style);
772
- props.style = normalizeStyle(style);
773
- }
774
- }
775
- const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
776
- if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && /* @__PURE__ */ isProxy(type)) {
777
- type = /* @__PURE__ */ toRaw(type);
778
- warn$2("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`.", `\nComponent that was made reactive: `, type);
779
- }
780
- return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);
781
- }
782
- function guardReactiveProps(props) {
783
- if (!props) return null;
784
- return /* @__PURE__ */ isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
785
- }
786
- function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
787
- const { props, ref, patchFlag, children, transition } = vnode;
788
- const mergedProps = extraProps ? mergeProps$1(props || {}, extraProps) : props;
789
- const cloned = {
790
- __v_isVNode: true,
791
- __v_skip: true,
792
- type: vnode.type,
793
- props: mergedProps,
794
- key: mergedProps && normalizeKey(mergedProps),
795
- ref: extraProps && extraProps.ref ? mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref,
796
- scopeId: vnode.scopeId,
797
- slotScopeIds: vnode.slotScopeIds,
798
- children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
799
- target: vnode.target,
800
- targetStart: vnode.targetStart,
801
- targetAnchor: vnode.targetAnchor,
802
- staticCount: vnode.staticCount,
803
- shapeFlag: vnode.shapeFlag,
804
- patchFlag: extraProps && vnode.type !== Fragment$1 ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
805
- dynamicProps: vnode.dynamicProps,
806
- dynamicChildren: vnode.dynamicChildren,
807
- appContext: vnode.appContext,
808
- dirs: vnode.dirs,
809
- transition,
810
- component: vnode.component,
811
- suspense: vnode.suspense,
812
- ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
813
- ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
814
- placeholder: vnode.placeholder,
815
- el: vnode.el,
816
- anchor: vnode.anchor,
817
- ctx: vnode.ctx,
818
- ce: vnode.ce
819
- };
820
- if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
821
- return cloned;
822
- }
823
- /**
824
- * Dev only, for HMR of hoisted vnodes reused in v-for
825
- * https://github.com/vitejs/vite/issues/2022
826
- */
827
- function deepCloneVNode(vnode) {
828
- const cloned = cloneVNode(vnode);
829
- if (isArray(vnode.children)) cloned.children = vnode.children.map(deepCloneVNode);
830
- return cloned;
831
- }
832
- /**
833
- * @private
834
- */
835
- function createTextVNode(text = " ", flag = 0) {
836
- return createVNode$1(Text$1, null, text, flag);
837
- }
838
- function normalizeChildren(vnode, children) {
839
- let type = 0;
840
- const { shapeFlag } = vnode;
841
- if (children == null) children = null;
842
- else if (isArray(children)) type = 16;
843
- else if (typeof children === "object") if (shapeFlag & 65) {
844
- const slot = children.default;
845
- if (slot) {
846
- slot._c && (slot._d = false);
847
- normalizeChildren(vnode, slot());
848
- slot._c && (slot._d = true);
849
- }
850
- return;
851
- } else {
852
- type = 32;
853
- if (!children._ && !isInternalObject(children)) children._ctx = currentRenderingInstance;
854
- }
855
- else if (isFunction(children)) {
856
- children = {
857
- default: children,
858
- _ctx: currentRenderingInstance
859
- };
860
- type = 32;
861
- } else {
862
- children = String(children);
863
- if (shapeFlag & 64) {
864
- type = 16;
865
- children = [createTextVNode(children)];
866
- } else type = 8;
867
- }
868
- vnode.children = children;
869
- vnode.shapeFlag |= type;
870
- }
871
- function mergeProps$1(...args) {
872
- const ret = {};
873
- for (let i = 0; i < args.length; i++) {
874
- const toMerge = args[i];
875
- for (const key in toMerge) if (key === "class") {
876
- if (ret.class !== toMerge.class) ret.class = normalizeClass([ret.class, toMerge.class]);
877
- } else if (key === "style") ret.style = normalizeStyle([ret.style, toMerge.style]);
878
- else if (isOn(key)) {
879
- const existing = ret[key];
880
- const incoming = toMerge[key];
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;
883
- } else if (key !== "") ret[key] = toMerge[key];
884
- }
885
- return ret;
886
- }
887
- process.env.NODE_ENV;
888
- const classifyRE = /(?:^|[-_])\w/g;
889
- const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
890
- function getComponentName(Component, includeInferred = true) {
891
- return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
892
- }
893
- function formatComponentName(instance, Component, isRoot = false) {
894
- let name = getComponentName(Component);
895
- if (!name && Component.__file) {
896
- const match = Component.__file.match(/([^/\\]+)\.\w+$/);
897
- if (match) name = match[1];
898
- }
899
- if (!name && instance) {
900
- const inferFromRegistry = (registry) => {
901
- for (const key in registry) if (registry[key] === Component) return key;
902
- };
903
- name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
904
- }
905
- return name ? classify(name) : isRoot ? `App` : `Anonymous`;
906
- }
907
- function isClassComponent(value) {
908
- return isFunction(value) && "__vccOpts" in value;
909
- }
910
- //#endregion
911
- //#region packages/runtime-core/src/index.ts
912
- const warn$1 = !!(process.env.NODE_ENV !== "production") ? warn$2 : NOOP;
913
- process.env.NODE_ENV;
914
- process.env.NODE_ENV;
915
- //#endregion
916
174
  //#region packages/server-renderer/src/helpers/ssrRenderList.ts
917
175
  function ssrRenderList(source, renderItem) {
918
176
  if (isArray(source) || isString(source)) for (let i = 0, l = source.length; i < l; i++) renderItem(source[i], i);
919
177
  else if (typeof source === "number") {
920
178
  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}.`);
179
+ warn(`The v-for range expects a positive integer value but got ${source}.`);
922
180
  return;
923
181
  }
924
182
  for (let i = 0; i < source; i++) renderItem(i + 1, i);
925
- } else if (isObject(source)) if (source[Symbol.iterator]) {
926
- const arr = Array.from(source);
927
- for (let i = 0, l = arr.length; i < l; i++) renderItem(arr[i], i);
928
- } else {
929
- const keys = Object.keys(source);
930
- for (let i = 0, l = keys.length; i < l; i++) {
931
- const key = keys[i];
932
- renderItem(source[key], key, i);
183
+ } else if (isObject(source)) {
184
+ if (source[Symbol.iterator]) {
185
+ let i = 0;
186
+ for (const item of source) renderItem(item, i++);
187
+ } else {
188
+ const keys = Object.keys(source);
189
+ for (let i = 0, l = keys.length; i < l; i++) {
190
+ const key = keys[i];
191
+ renderItem(source[key], key, i);
192
+ }
933
193
  }
934
194
  }
935
195
  }
936
196
  //#endregion
937
197
  //#region packages/server-renderer/src/helpers/ssrRenderSuspense.ts
938
- async function ssrRenderSuspense(push, { default: renderContent }) {
198
+ function ssrRenderSuspense(push, { default: renderContent }) {
939
199
  if (renderContent) renderContent();
940
200
  else push(`<!---->`);
941
201
  }
@@ -980,7 +240,7 @@ function ssrCompile(template, instance) {
980
240
  }
981
241
  //#endregion
982
242
  //#region packages/server-renderer/src/render.ts
983
- const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, normalizeVNode, pushWarningContext, popWarningContext } = ssrUtils;
243
+ const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, isVNode: isVNode$2, normalizeVNode, pushWarningContext, popWarningContext, VaporSlot, rawVaporSlotKey, invokeSlotFallback } = ssrUtils;
984
244
  function cleanupContext(context) {
985
245
  let firstError;
986
246
  if (context.__watcherHandles) {
@@ -1020,7 +280,41 @@ function createBuffer() {
1020
280
  }
1021
281
  };
1022
282
  }
283
+ const vaporOutlets = /* @__PURE__ */ new WeakMap();
284
+ const vaporInterface = { attachSlotOutlet(content, fallback, owner) {
285
+ const lone = isVaporSlotContent(content);
286
+ if (lone) vaporOutlets.set(content, {
287
+ fallback,
288
+ owner
289
+ });
290
+ return lone;
291
+ } };
292
+ function isVaporSlotContent(children) {
293
+ const lone = findVaporSlot(children);
294
+ vaporSlot = null;
295
+ return lone;
296
+ }
297
+ let vaporSlot = null;
298
+ function findVaporSlot(children) {
299
+ for (let i = 0; i < children.length; i++) {
300
+ const child = children[i];
301
+ if (!isVNode$2(child)) return false;
302
+ if (child.type === VaporSlot) {
303
+ if (vaporSlot) return false;
304
+ vaporSlot = child;
305
+ } else if (child.type === Fragment) {
306
+ if (child.patchFlag > 0 && child.patchFlag & 384 || !findVaporSlot(child.children)) return false;
307
+ } else if (child.type !== Comment) return false;
308
+ }
309
+ return true;
310
+ }
1023
311
  function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
312
+ const ctx = vnode.ctx;
313
+ if (vnode.shapeFlag & 32 && ctx && ctx.type.__vapor) {
314
+ const slots = vnode.children;
315
+ for (const name in slots) if (isFunction(slots[name])) slots[name][rawVaporSlotKey] = slots[name];
316
+ if (!ctx.appContext.vapor) ctx.appContext.vapor = vaporInterface;
317
+ }
1024
318
  const instance = vnode.component = createComponentInstance(vnode, parentComponent, null);
1025
319
  const context = instance.appContext.provides[ssrContextKey];
1026
320
  if (context) (context.__instanceScopes || (context.__instanceScopes = [])).push(instance.scope);
@@ -1033,7 +327,11 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
1033
327
  if (hasAsyncSetup) prefetches = instance.sp;
1034
328
  if (prefetches) return Promise.all(prefetches.map((prefetch) => prefetch.call(instance.proxy)));
1035
329
  }).catch(NOOP).then(() => renderComponentSubTree(instance, slotScopeId));
1036
- else return renderComponentSubTree(instance, slotScopeId);
330
+ else try {
331
+ return renderComponentSubTree(instance, slotScopeId);
332
+ } catch (err) {
333
+ return Promise.reject(err);
334
+ }
1037
335
  }
1038
336
  function renderComponentSubTree(instance, slotScopeId) {
1039
337
  if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(instance.vnode);
@@ -1073,12 +371,15 @@ function renderComponentSubTree(instance, slotScopeId) {
1073
371
  const prev = setCurrentRenderingInstance(instance);
1074
372
  try {
1075
373
  ssrRender(instance.proxy, push, instance, attrs, instance.props, instance.setupState, instance.data, instance.ctx);
374
+ } catch (err) {
375
+ handleError(err, instance, 1);
1076
376
  } finally {
1077
377
  setCurrentRenderingInstance(prev);
1078
378
  }
1079
379
  } else if (instance.render && instance.render !== NOOP) renderVNode(push, instance.subTree = renderComponentRoot(instance), instance, slotScopeId);
1080
380
  else {
1081
- warn(`Component ${comp.name || comp.__file || `<Anonymous>`} is missing template or render function.`);
381
+ const componentName = comp.name || comp.__file || `<Anonymous>`;
382
+ warn(`Component ${componentName} is missing template or render function.`);
1082
383
  push(`<!---->`);
1083
384
  }
1084
385
  }
@@ -1098,12 +399,25 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
1098
399
  case Static:
1099
400
  push(children);
1100
401
  break;
1101
- case Fragment:
402
+ case Fragment: {
1102
403
  if (vnode.slotScopeIds) slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
1103
- push(`<!--[-->`);
404
+ const outlet = vnode.vo && vaporOutlets.get(children);
405
+ if (outlet) {
406
+ renderVaporOutlet(push, (_, push) => renderVNodeChildren(push, children, parentComponent, slotScopeId), null, outlet, parentComponent, slotScopeId);
407
+ break;
408
+ }
409
+ const isFallback = shapeFlag & 1024;
410
+ push(isFallback ? `<!--(-->` : `<!--[-->`);
1104
411
  renderVNodeChildren(push, children, parentComponent, slotScopeId);
1105
- push(`<!--]-->`);
412
+ push(isFallback ? `<!--)-->` : `<!--]-->`);
413
+ break;
414
+ }
415
+ case VaporSlot: {
416
+ if (vnode.slotScopeIds) slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
417
+ const { slot, outlets } = vnode.vs;
418
+ renderVaporOutlet(push, slot, vnode.props, outlets && outlets[0], parentComponent, slotScopeId);
1106
419
  break;
420
+ }
1107
421
  default: if (shapeFlag & 1) renderElementVNode(push, vnode, parentComponent, slotScopeId);
1108
422
  else if (shapeFlag & 6) push(renderComponentVNode(vnode, parentComponent, slotScopeId));
1109
423
  else if (shapeFlag & 64) renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
@@ -1111,6 +425,11 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
1111
425
  else warn("[@vue/server-renderer] Invalid VNode type:", type, `(${typeof type})`);
1112
426
  }
1113
427
  }
428
+ function renderVaporOutlet(push, slot, props, outlet, parentComponent, slotScopeId) {
429
+ const prev = setCurrentRenderingInstance(parentComponent);
430
+ ssrRenderSlot({ default: slot }, "default", props, outlet ? () => renderVNodeChildren(push, invokeSlotFallback(outlet.fallback, outlet.owner), parentComponent, slotScopeId) : null, push, parentComponent, slotScopeId);
431
+ setCurrentRenderingInstance(prev);
432
+ }
1114
433
  function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
1115
434
  for (let i = 0; i < children.length; i++) renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
1116
435
  }
@@ -1119,15 +438,25 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
1119
438
  let { props, children, shapeFlag, scopeId } = vnode;
1120
439
  let openTag = `<${tag}`;
1121
440
  if (props) openTag += ssrRenderAttrs(props, tag);
1122
- if (scopeId) openTag += ` ${scopeId}`;
441
+ const renderedScopeIds = [];
442
+ const appendScopeId = (id) => {
443
+ if (id && (!props || !hasOwn(props, id)) && !renderedScopeIds.includes(id)) {
444
+ openTag += ` ${id}`;
445
+ renderedScopeIds.push(id);
446
+ }
447
+ };
448
+ if (scopeId) appendScopeId(scopeId);
1123
449
  let curParent = parentComponent;
1124
450
  let curVnode = vnode;
1125
451
  while (curParent && curVnode === curParent.subTree) {
1126
452
  curVnode = curParent.vnode;
1127
- if (curVnode.scopeId) openTag += ` ${curVnode.scopeId}`;
453
+ if (curVnode.scopeId) appendScopeId(curVnode.scopeId);
1128
454
  curParent = curParent.parent;
1129
455
  }
1130
- if (slotScopeId) openTag += ` ${slotScopeId}`;
456
+ if (slotScopeId) {
457
+ const slotScopeIdList = slotScopeId.trim().split(" ");
458
+ for (let i = 0; i < slotScopeIdList.length; i++) appendScopeId(slotScopeIdList[i]);
459
+ }
1131
460
  push(openTag + `>`);
1132
461
  if (!isVoidTag(tag)) {
1133
462
  let hasChildrenOverride = false;
@@ -1230,7 +559,7 @@ async function renderToString(input, context = {}) {
1230
559
  async function resolveTeleports(context) {
1231
560
  if (context.__teleportBuffers) {
1232
561
  context.teleports = context.teleports || {};
1233
- for (const key in context.__teleportBuffers) context.teleports[key] = await unrollBuffer$1(await Promise.all([context.__teleportBuffers[key]]));
562
+ for (const key in context.__teleportBuffers) context.teleports[key] = await unrollBuffer$1(context.__teleportBuffers[key]);
1234
563
  }
1235
564
  }
1236
565
  //#endregion