@vue/server-renderer 3.5.43 → 3.5.44

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,5 +1,5 @@
1
1
  /**
2
- * @vue/server-renderer v3.5.43
2
+ * @vue/server-renderer v3.5.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -174,7 +174,7 @@ const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
174
174
  const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
175
175
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
176
176
 
177
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
177
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
178
178
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
179
179
  const isBooleanAttr = /* @__PURE__ */ makeMap(
180
180
  specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
@@ -1238,19 +1238,41 @@ const arrayInstrumentations = {
1238
1238
  };
1239
1239
  function iterator(self, method, wrapValue) {
1240
1240
  const arr = shallowReadArray(self);
1241
- const iter = arr[method]();
1241
+ const methodFn = arr[method];
1242
+ const iter = methodFn.call(arr);
1242
1243
  if (arr !== self && !isShallow(self)) {
1243
- iter._next = iter.next;
1244
- iter.next = () => {
1245
- const result = iter._next();
1246
- if (!result.done) {
1247
- result.value = wrapValue(result.value);
1244
+ if (iter[Symbol.toStringTag] === "Array Iterator") {
1245
+ const wrapped = Object.create(Object.getPrototypeOf(iter));
1246
+ wrapped.next = () => wrapResult(iter.next(), wrapValue);
1247
+ if (methodFn !== arrayProto[method]) {
1248
+ Object.defineProperties(wrapped, {
1249
+ return: {
1250
+ get() {
1251
+ const fn = iter.return;
1252
+ return typeof fn === "function" ? fn.bind(iter) : fn;
1253
+ }
1254
+ },
1255
+ throw: {
1256
+ get() {
1257
+ const fn = iter.throw;
1258
+ return typeof fn === "function" ? fn.bind(iter) : fn;
1259
+ }
1260
+ }
1261
+ });
1248
1262
  }
1249
- return result;
1250
- };
1263
+ return wrapped;
1264
+ }
1265
+ iter._next = iter.next;
1266
+ iter.next = () => wrapResult(iter._next(), wrapValue);
1251
1267
  }
1252
1268
  return iter;
1253
1269
  }
1270
+ function wrapResult(result, wrapValue) {
1271
+ if (!result.done) {
1272
+ result.value = wrapValue(result.value);
1273
+ }
1274
+ return result;
1275
+ }
1254
1276
  const arrayProto = Array.prototype;
1255
1277
  function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1256
1278
  const arr = shallowReadArray(self);
@@ -1673,6 +1695,8 @@ function createInstrumentationGetter(isReadonly2, shallow) {
1673
1695
  return !isReadonly2;
1674
1696
  } else if (key === "__v_isReadonly") {
1675
1697
  return isReadonly2;
1698
+ } else if (key === "__v_isShallow") {
1699
+ return shallow;
1676
1700
  } else if (key === "__v_raw") {
1677
1701
  return target;
1678
1702
  }
@@ -2038,9 +2062,11 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2038
2062
  if (once && cb) {
2039
2063
  const _cb = cb;
2040
2064
  cb = (...args) => {
2041
- const res = _cb(...args);
2042
- watchHandle();
2043
- return res;
2065
+ try {
2066
+ return _cb(...args);
2067
+ } finally {
2068
+ watchHandle();
2069
+ }
2044
2070
  };
2045
2071
  }
2046
2072
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -2051,12 +2077,13 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2051
2077
  if (cb) {
2052
2078
  const newValue = effect.run();
2053
2079
  if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2054
- if (cleanup) {
2055
- cleanup();
2056
- }
2057
2080
  const currentWatcher = activeWatcher;
2058
- activeWatcher = effect;
2081
+ pauseTracking();
2059
2082
  try {
2083
+ if (cleanup) {
2084
+ cleanup();
2085
+ }
2086
+ activeWatcher = effect;
2060
2087
  const args = [
2061
2088
  newValue,
2062
2089
  // pass undefined as the old value when it's changed for the first time
@@ -2070,6 +2097,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2070
2097
  );
2071
2098
  } finally {
2072
2099
  activeWatcher = currentWatcher;
2100
+ resetTracking();
2073
2101
  }
2074
2102
  }
2075
2103
  } else {
@@ -2431,21 +2459,21 @@ function queuePostFlushCb(cb) {
2431
2459
  }
2432
2460
  queueFlush();
2433
2461
  }
2434
- function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2462
+ function flushPreFlushCbs(instance, minUid, seen, i = flushIndex + 1) {
2435
2463
  {
2436
2464
  seen = seen || /* @__PURE__ */ new Map();
2437
2465
  }
2438
2466
  for (; i < queue.length; i++) {
2439
2467
  const cb = queue[i];
2440
2468
  if (cb && cb.flags & 2) {
2441
- if (instance && cb.id !== instance.uid) {
2469
+ if (instance && cb.id !== instance.uid || minUid !== void 0 && !(cb.id >= minUid)) {
2442
2470
  continue;
2443
2471
  }
2444
2472
  if (checkRecursiveUpdates(seen, cb)) {
2445
2473
  continue;
2446
2474
  }
2447
2475
  queue.splice(i, 1);
2448
- i--;
2476
+ i = instance ? i - 1 : flushIndex;
2449
2477
  if (cb.flags & 4) {
2450
2478
  cb.flags &= -2;
2451
2479
  }
@@ -2456,12 +2484,23 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2456
2484
  }
2457
2485
  }
2458
2486
  }
2459
- function flushPostFlushCbs(seen) {
2487
+ function flushPostFlushCbs(seen, skip, minUid = 0) {
2460
2488
  if (pendingPostFlushCbs.length) {
2461
- const deduped = [...new Set(pendingPostFlushCbs)].sort(
2462
- (a, b) => getId(a) - getId(b)
2463
- );
2464
- pendingPostFlushCbs.length = 0;
2489
+ let cbs = pendingPostFlushCbs;
2490
+ let kept = 0;
2491
+ if (skip) {
2492
+ cbs = [];
2493
+ for (let i = 0; i < pendingPostFlushCbs.length; i++) {
2494
+ const cb = pendingPostFlushCbs[i];
2495
+ if (cb.i !== void 0 ? !cb.i || cb.i.uid < minUid : skip.has(cb)) {
2496
+ pendingPostFlushCbs[kept++] = cb;
2497
+ } else {
2498
+ cbs.push(cb);
2499
+ }
2500
+ }
2501
+ }
2502
+ const deduped = [...new Set(cbs)].sort((a, b) => getId(a) - getId(b));
2503
+ pendingPostFlushCbs.length = kept;
2465
2504
  if (activePostFlushCbs) {
2466
2505
  for (let i = 0; i < deduped.length; i++) {
2467
2506
  activePostFlushCbs.push(deduped[i]);
@@ -2487,6 +2526,22 @@ function flushPostFlushCbs(seen) {
2487
2526
  postFlushIndex = 0;
2488
2527
  }
2489
2528
  }
2529
+ let isFlushing = false;
2530
+ function flushOnAppMount(fn, minUid) {
2531
+ if (isFlushing) {
2532
+ fn();
2533
+ return;
2534
+ }
2535
+ const queued = minUid === void 0 ? void 0 : new Set(pendingPostFlushCbs);
2536
+ fn();
2537
+ isFlushing = true;
2538
+ try {
2539
+ flushPreFlushCbs(void 0, minUid);
2540
+ flushPostFlushCbs(void 0, queued, minUid);
2541
+ } finally {
2542
+ isFlushing = false;
2543
+ }
2544
+ }
2490
2545
  const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2491
2546
  function flushJobs(seen) {
2492
2547
  {
@@ -2930,6 +2985,7 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
2930
2985
  let isPre = false;
2931
2986
  if (flush === "post") {
2932
2987
  baseWatchOptions.scheduler = (job) => {
2988
+ job.i = instance;
2933
2989
  queuePostRenderEffect(job, instance && instance.suspense);
2934
2990
  };
2935
2991
  } else if (flush !== "sync") {
@@ -3046,6 +3102,24 @@ function setTransitionHooks(vnode, hooks) {
3046
3102
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3047
3103
  } else {
3048
3104
  vnode.transition = hooks;
3105
+ if (vnode.type === Fragment && isArray(vnode.children)) {
3106
+ const child = filterSingleRoot(vnode.children, false);
3107
+ if (child) {
3108
+ setTransitionHooks(child, hooks);
3109
+ }
3110
+ }
3111
+ }
3112
+ }
3113
+ function getTransitionRoot(vnode) {
3114
+ if (vnode.component) {
3115
+ return getTransitionRoot(vnode.component.subTree);
3116
+ }
3117
+ if (vnode.type === Fragment) {
3118
+ const child = isArray(vnode.children) && filterSingleRoot(vnode.children, false);
3119
+ return child ? getTransitionRoot(child) : void 0;
3120
+ }
3121
+ if (vnode.type !== Comment) {
3122
+ return vnode;
3049
3123
  }
3050
3124
  }
3051
3125
 
@@ -4592,7 +4666,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
4592
4666
  }
4593
4667
  for (let i = 0; i < nextKeys.length; i++) {
4594
4668
  const key = nextKeys[i];
4595
- if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
4669
+ if (!hasOwn(prevProps, key) || hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
4596
4670
  return true;
4597
4671
  }
4598
4672
  }
@@ -5628,15 +5702,16 @@ function baseCreateRenderer(options, createHydrationFns) {
5628
5702
  for (let i = 0; i < newChildren.length; i++) {
5629
5703
  const oldVNode = oldChildren[i];
5630
5704
  const newVNode = newChildren[i];
5705
+ const oldEl = oldVNode.el || resolveAsyncComponentPlaceholder(oldVNode);
5631
5706
  const container = (
5632
5707
  // oldVNode may be an errored async setup() component inside Suspense
5633
5708
  // which will not have a mounted element
5634
- oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
5709
+ oldEl && // - In the case of a Fragment, we need to provide the actual parent
5635
5710
  // of the Fragment itself so it can move its children.
5636
5711
  (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
5637
5712
  // which also requires the correct parent container
5638
5713
  !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
5639
- oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
5714
+ oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldEl) : (
5640
5715
  // In other cases, the parent container is not actually used so we
5641
5716
  // just pass the block element here to avoid a DOM parentNode call.
5642
5717
  fallbackContainer
@@ -5800,7 +5875,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5800
5875
  }
5801
5876
  if (isHmrUpdating) initialVNode.el = null;
5802
5877
  if (instance.asyncDep) {
5803
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
5878
+ parentSuspense && parentSuspense.registerDep(
5879
+ instance,
5880
+ setupRenderEffect,
5881
+ optimized,
5882
+ namespace
5883
+ );
5804
5884
  if (!initialVNode.el) {
5805
5885
  const placeholder = instance.subTree = createVNode(Comment);
5806
5886
  processCommentNode(null, placeholder, container, anchor);
@@ -5830,6 +5910,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5830
5910
  pushWarningContext$1(n2);
5831
5911
  }
5832
5912
  n2.el = n1.el;
5913
+ n2.placeholder = n1.placeholder;
5833
5914
  updateComponentPreRender(instance, n2, optimized);
5834
5915
  {
5835
5916
  popWarningContext$1();
@@ -5841,6 +5922,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5841
5922
  }
5842
5923
  } else {
5843
5924
  n2.el = n1.el;
5925
+ n2.placeholder = n1.placeholder;
5844
5926
  instance.vnode = n2;
5845
5927
  }
5846
5928
  };
@@ -6462,18 +6544,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6462
6544
  };
6463
6545
  const remove = (vnode) => {
6464
6546
  const { type, el, anchor, transition } = vnode;
6465
- if (type === Fragment) {
6466
- if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
6467
- vnode.children.forEach((child) => {
6468
- if (child.type === Comment) {
6469
- hostRemove(child.el);
6470
- } else {
6471
- remove(child);
6472
- }
6473
- });
6474
- } else {
6475
- removeFragment(el, anchor);
6476
- }
6547
+ const isFragment = type === Fragment;
6548
+ if (isFragment && !transition) {
6549
+ removeFragment(el, anchor);
6477
6550
  return;
6478
6551
  }
6479
6552
  if (type === Static) {
@@ -6483,17 +6556,25 @@ function baseCreateRenderer(options, createHydrationFns) {
6483
6556
  }
6484
6557
  return;
6485
6558
  }
6559
+ const leavingNode = isFragment ? getTransitionRoot(vnode) : vnode;
6486
6560
  const performRemove = () => {
6487
- hostRemove(el);
6561
+ if (isFragment) {
6562
+ if (hostParentNode(el)) {
6563
+ removeFragment(el, anchor);
6564
+ }
6565
+ } else {
6566
+ hostRemove(el);
6567
+ }
6488
6568
  if (transition && !transition.persisted && transition.afterLeave) {
6489
6569
  transition.afterLeave();
6490
6570
  }
6491
6571
  };
6492
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
6572
+ if (leavingNode && leavingNode.shapeFlag & 1 && transition && !transition.persisted) {
6493
6573
  const { leave, delayLeave } = transition;
6494
- const performLeave = () => leave(el, performRemove);
6574
+ const leavingEl = leavingNode.el;
6575
+ const performLeave = () => leave(leavingEl, performRemove);
6495
6576
  if (delayLeave) {
6496
- delayLeave(vnode.el, performRemove, performLeave);
6577
+ delayLeave(leavingEl, performRemove, performLeave);
6497
6578
  } else {
6498
6579
  performLeave();
6499
6580
  }
@@ -6554,32 +6635,26 @@ function baseCreateRenderer(options, createHydrationFns) {
6554
6635
  const teleportEnd = el && el[TeleportEndKey];
6555
6636
  return teleportEnd ? hostNextSibling(teleportEnd) : el;
6556
6637
  };
6557
- let isFlushing = false;
6558
6638
  const render = (vnode, container, namespace) => {
6559
- let instance;
6560
- if (vnode == null) {
6561
- if (container._vnode) {
6562
- unmount(container._vnode, null, null, true);
6563
- instance = container._vnode.component;
6639
+ const minUid = vnode && container._vnode ? void 0 : vnode && vnode.component ? vnode.component.uid : getNextUid();
6640
+ flushOnAppMount(() => {
6641
+ if (vnode == null) {
6642
+ if (container._vnode) {
6643
+ unmount(container._vnode, null, null, true);
6644
+ }
6645
+ } else {
6646
+ patch(
6647
+ container._vnode || null,
6648
+ vnode,
6649
+ container,
6650
+ null,
6651
+ null,
6652
+ null,
6653
+ namespace
6654
+ );
6564
6655
  }
6565
- } else {
6566
- patch(
6567
- container._vnode || null,
6568
- vnode,
6569
- container,
6570
- null,
6571
- null,
6572
- null,
6573
- namespace
6574
- );
6575
- }
6576
- container._vnode = vnode;
6577
- if (!isFlushing) {
6578
- isFlushing = true;
6579
- flushPreFlushCbs(instance);
6580
- flushPostFlushCbs();
6581
- isFlushing = false;
6582
- }
6656
+ container._vnode = vnode;
6657
+ }, minUid);
6583
6658
  };
6584
6659
  const internals = {
6585
6660
  p: patch,
@@ -7079,6 +7154,9 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
7079
7154
 
7080
7155
  const emptyAppContext = createAppContext();
7081
7156
  let uid = 0;
7157
+ function getNextUid() {
7158
+ return uid;
7159
+ }
7082
7160
  function createComponentInstance$1(vnode, parent, suspense) {
7083
7161
  const type = vnode.type;
7084
7162
  const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
@@ -7482,7 +7560,7 @@ const computed = (getterOrOptions, debugOptions) => {
7482
7560
  return c;
7483
7561
  };
7484
7562
 
7485
- const version = "3.5.43";
7563
+ const version = "3.5.44";
7486
7564
  const warn = warn$1 ;
7487
7565
  const _ssrUtils = {
7488
7566
  createComponentInstance: createComponentInstance$1,
@@ -7655,7 +7733,9 @@ function patchStyle(el, prev, next) {
7655
7733
  }
7656
7734
  }
7657
7735
  if (vShowOriginalDisplay in el) {
7658
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
7736
+ if (!isCssString || prev !== next) {
7737
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
7738
+ }
7659
7739
  if (el[vShowHidden]) {
7660
7740
  style.display = "none";
7661
7741
  }
@@ -8302,9 +8382,11 @@ function ssrRenderList(source, renderItem) {
8302
8382
  }
8303
8383
  } else if (typeof source === "number") {
8304
8384
  if (!Number.isInteger(source) || source < 0) {
8305
- warn(
8306
- `The v-for range expects a positive integer value but got ${source}.`
8307
- );
8385
+ {
8386
+ warn(
8387
+ `The v-for range expects a positive integer value but got ${source}.`
8388
+ );
8389
+ }
8308
8390
  return;
8309
8391
  }
8310
8392
  for (let i = 0; i < source; i++) {
@@ -8430,23 +8512,28 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
8430
8512
  popWarningContext();
8431
8513
  const hasAsyncSetup = isPromise(res);
8432
8514
  let prefetches = instance.sp;
8515
+ let p;
8433
8516
  if (hasAsyncSetup || prefetches) {
8434
- const p = Promise.resolve(res).then(() => {
8517
+ p = Promise.resolve(res).then(() => {
8435
8518
  if (hasAsyncSetup) prefetches = instance.sp;
8436
8519
  if (prefetches) {
8437
- return Promise.all(
8438
- prefetches.map((prefetch) => prefetch.call(instance.proxy))
8439
- );
8520
+ try {
8521
+ return Promise.all(
8522
+ prefetches.map((prefetch) => prefetch.call(instance.proxy))
8523
+ ).catch(NOOP);
8524
+ } catch {
8525
+ }
8440
8526
  }
8441
- }).catch(NOOP);
8442
- return p.then(() => renderComponentSubTree(instance, slotScopeId));
8527
+ }).then(() => renderComponentSubTree(instance, slotScopeId));
8443
8528
  } else {
8444
8529
  try {
8445
8530
  return renderComponentSubTree(instance, slotScopeId);
8446
8531
  } catch (err) {
8447
- return Promise.reject(err);
8532
+ p = Promise.reject(err);
8448
8533
  }
8449
8534
  }
8535
+ p.catch(NOOP);
8536
+ return p;
8450
8537
  }
8451
8538
  function renderComponentSubTree(instance, slotScopeId) {
8452
8539
  pushWarningContext(instance.vnode);
@@ -8617,13 +8704,13 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
8617
8704
  if (!isVoidTag(tag)) {
8618
8705
  let hasChildrenOverride = false;
8619
8706
  if (props) {
8620
- if (props.innerHTML) {
8707
+ if (props.innerHTML != null) {
8621
8708
  hasChildrenOverride = true;
8622
- push(props.innerHTML);
8623
- } else if (props.textContent) {
8709
+ push(String(props.innerHTML));
8710
+ } else if (props.textContent != null) {
8624
8711
  hasChildrenOverride = true;
8625
8712
  push(escapeHtml(props.textContent));
8626
- } else if (tag === "textarea" && props.value) {
8713
+ } else if (tag === "textarea" && props.value != null) {
8627
8714
  hasChildrenOverride = true;
8628
8715
  push(escapeHtml(props.value));
8629
8716
  }
@@ -8739,16 +8826,51 @@ async function renderToString(input, context = {}) {
8739
8826
  const vnode = createVNode(input._component, input._props);
8740
8827
  vnode.appContext = input._context;
8741
8828
  input.provide(ssrContextKey, context);
8742
- const buffer = await renderComponentVNode(vnode);
8743
- const result = await unrollBuffer$1(buffer);
8744
- await resolveTeleports(context);
8745
- if (context.__watcherHandles) {
8746
- for (const unwatch of context.__watcherHandles) {
8747
- unwatch();
8748
- }
8829
+ let buffer;
8830
+ let result;
8831
+ try {
8832
+ buffer = await renderComponentVNode(vnode);
8833
+ result = await unrollBuffer$1(buffer);
8834
+ await resolveTeleports(context);
8835
+ } catch (err) {
8836
+ cleanupFailedRender(buffer, context);
8837
+ throw err;
8749
8838
  }
8839
+ stopWatchers(context);
8750
8840
  return result;
8751
8841
  }
8842
+ function stopWatchers(context, start = 0) {
8843
+ const handles = context.__watcherHandles;
8844
+ if (handles) {
8845
+ for (let i = start; i < handles.length; i++) {
8846
+ handles[i]();
8847
+ }
8848
+ }
8849
+ }
8850
+ function cleanupFailedRender(buffer, context) {
8851
+ const stopped = context.__watcherHandles ? context.__watcherHandles.length : 0;
8852
+ try {
8853
+ stopWatchers(context);
8854
+ } catch {
8855
+ }
8856
+ (async () => {
8857
+ if (buffer) await settleBuffer(buffer);
8858
+ for (const key in context.__teleportBuffers) {
8859
+ await settleBuffer(context.__teleportBuffers[key]);
8860
+ }
8861
+ stopWatchers(context, stopped);
8862
+ })().catch(NOOP);
8863
+ }
8864
+ async function settleBuffer(buffer) {
8865
+ if (!buffer.hasAsync) return;
8866
+ for (let item of buffer) {
8867
+ try {
8868
+ if (isPromise(item)) item = await item;
8869
+ if (!isString(item)) await settleBuffer(item);
8870
+ } catch {
8871
+ }
8872
+ }
8873
+ }
8752
8874
  async function resolveTeleports(context) {
8753
8875
  if (context.__teleportBuffers) {
8754
8876
  context.teleports = context.teleports || {};
@@ -8799,13 +8921,17 @@ function renderToSimpleStream(input, context, stream) {
8799
8921
  const vnode = createVNode(input._component, input._props);
8800
8922
  vnode.appContext = input._context;
8801
8923
  input.provide(ssrContextKey, context);
8802
- Promise.resolve(renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
8803
- if (context.__watcherHandles) {
8804
- for (const unwatch of context.__watcherHandles) {
8805
- unwatch();
8806
- }
8924
+ let buffer;
8925
+ Promise.resolve(renderComponentVNode(vnode)).then((b) => unrollBuffer(buffer = b, stream)).then(() => resolveTeleports(context)).then(
8926
+ () => {
8927
+ stopWatchers(context);
8928
+ stream.push(null);
8929
+ },
8930
+ (error) => {
8931
+ cleanupFailedRender(buffer, context);
8932
+ throw error;
8807
8933
  }
8808
- }).then(() => stream.push(null)).catch((error) => {
8934
+ ).catch((error) => {
8809
8935
  stream.destroy(error);
8810
8936
  });
8811
8937
  return stream;