@vue/server-renderer 3.6.0-beta.7 → 3.6.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/server-renderer v3.6.0-beta.7
2
+ * @vue/server-renderer v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -17,7 +17,6 @@ function makeMap(str) {
17
17
  for (const key of str.split(",")) map[key] = 1;
18
18
  return (val) => val in map;
19
19
  }
20
-
21
20
  //#endregion
22
21
  //#region packages/shared/src/general.ts
23
22
  const EMPTY_OBJ = Object.freeze({});
@@ -123,7 +122,6 @@ const getGlobalThis = () => {
123
122
  function canSetValueDirectly(tagName) {
124
123
  return tagName !== "PROGRESS" && !tagName.includes("-");
125
124
  }
126
-
127
125
  //#endregion
128
126
  //#region packages/shared/src/normalizeProp.ts
129
127
  function normalizeStyle(value) {
@@ -175,7 +173,6 @@ function normalizeClass(value) {
175
173
  }
176
174
  return res.trim();
177
175
  }
178
-
179
176
  //#endregion
180
177
  //#region packages/shared/src/domTagConfig.ts
181
178
  const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
@@ -202,7 +199,6 @@ const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
202
199
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
203
200
  */
204
201
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
205
-
206
202
  //#endregion
207
203
  //#region packages/shared/src/domAttrConfig.ts
208
204
  /**
@@ -260,7 +256,6 @@ function shouldSetAsAttr(tagName, key) {
260
256
  if (key === "sandbox" && tagName === "IFRAME") return true;
261
257
  return false;
262
258
  }
263
-
264
259
  //#endregion
265
260
  //#region packages/shared/src/escapeHtml.ts
266
261
  const escapeRE = /["'&<>]/;
@@ -301,7 +296,6 @@ const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
301
296
  function escapeHtmlComment(src) {
302
297
  return src.replace(commentStripRE, "");
303
298
  }
304
-
305
299
  //#endregion
306
300
  //#region packages/shared/src/looseEqual.ts
307
301
  function looseCompareArrays(a, b) {
@@ -337,7 +331,6 @@ function looseEqual(a, b) {
337
331
  function looseIndexOf(arr, val) {
338
332
  return arr.findIndex((item) => looseEqual(item, val));
339
333
  }
340
-
341
334
  //#endregion
342
335
  //#region packages/shared/src/toDisplayString.ts
343
336
  const isRef$1 = (val) => {
@@ -372,7 +365,6 @@ const stringifySymbol = (v, i = "") => {
372
365
  var _description;
373
366
  return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v;
374
367
  };
375
-
376
368
  //#endregion
377
369
  //#region packages/shared/src/subSequence.ts
378
370
  function getSequence(arr) {
@@ -410,7 +402,6 @@ function getSequence(arr) {
410
402
  }
411
403
  return result;
412
404
  }
413
-
414
405
  //#endregion
415
406
  //#region packages/shared/src/cssVars.ts
416
407
  /**
@@ -423,7 +414,6 @@ function normalizeCssVarValue(value) {
423
414
  if (typeof value !== "number" || !Number.isFinite(value)) console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", value);
424
415
  return String(value);
425
416
  }
426
-
427
417
  //#endregion
428
418
  //#region packages/reactivity/src/debug.ts
429
419
  const triggerEventInfos = [];
@@ -459,31 +449,11 @@ function setupFlagsHandler(target) {
459
449
  }
460
450
  });
461
451
  }
462
-
463
452
  //#endregion
464
453
  //#region packages/reactivity/src/warning.ts
465
454
  function warn$2(msg, ...args) {
466
455
  console.warn(`[Vue warn] ${msg}`, ...args);
467
456
  }
468
-
469
- //#endregion
470
- //#region packages/reactivity/src/system.ts
471
- const ReactiveFlags = {
472
- "None": 0,
473
- "0": "None",
474
- "Mutable": 1,
475
- "1": "Mutable",
476
- "Watching": 2,
477
- "2": "Watching",
478
- "RecursedCheck": 4,
479
- "4": "RecursedCheck",
480
- "Recursed": 8,
481
- "8": "Recursed",
482
- "Dirty": 16,
483
- "16": "Dirty",
484
- "Pending": 32,
485
- "32": "Pending"
486
- };
487
457
  const notifyBuffer = [];
488
458
  let batchDepth = 0;
489
459
  let activeSub = void 0;
@@ -691,7 +661,6 @@ function isValidLink(checkLink, sub) {
691
661
  }
692
662
  return false;
693
663
  }
694
-
695
664
  //#endregion
696
665
  //#region packages/reactivity/src/dep.ts
697
666
  var Dep = class {
@@ -798,7 +767,6 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
798
767
  }
799
768
  endBatch();
800
769
  }
801
-
802
770
  //#endregion
803
771
  //#region packages/reactivity/src/arrayInstrumentations.ts
804
772
  /**
@@ -946,16 +914,25 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
946
914
  }
947
915
  function reduce(self, method, fn, args) {
948
916
  const arr = shallowReadArray(self);
917
+ const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);
949
918
  let wrappedFn = fn;
919
+ let wrapInitialAccumulator = false;
950
920
  if (arr !== self) {
951
- if (!/* @__PURE__ */ isShallow(self)) wrappedFn = function(acc, item, index) {
952
- return fn.call(this, acc, toWrapped(self, item), index, self);
953
- };
954
- else if (fn.length > 3) wrappedFn = function(acc, item, index) {
921
+ if (needsWrap) {
922
+ wrapInitialAccumulator = args.length === 0;
923
+ wrappedFn = function(acc, item, index) {
924
+ if (wrapInitialAccumulator) {
925
+ wrapInitialAccumulator = false;
926
+ acc = toWrapped(self, acc);
927
+ }
928
+ return fn.call(this, acc, toWrapped(self, item), index, self);
929
+ };
930
+ } else if (fn.length > 3) wrappedFn = function(acc, item, index) {
955
931
  return fn.call(this, acc, item, index, self);
956
932
  };
957
933
  }
958
- return arr[method](wrappedFn, ...args);
934
+ const result = arr[method](wrappedFn, ...args);
935
+ return wrapInitialAccumulator ? toWrapped(self, result) : result;
959
936
  }
960
937
  function searchProxy(self, method, args) {
961
938
  const arr = /* @__PURE__ */ toRaw(self);
@@ -975,7 +952,6 @@ function noTracking(self, method, args = []) {
975
952
  endBatch();
976
953
  return res;
977
954
  }
978
-
979
955
  //#endregion
980
956
  //#region packages/reactivity/src/baseHandlers.ts
981
957
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
@@ -1084,7 +1060,6 @@ const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1084
1060
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1085
1061
  const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1086
1062
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1087
-
1088
1063
  //#endregion
1089
1064
  //#region packages/reactivity/src/collectionHandlers.ts
1090
1065
  const toShallow = (value) => value;
@@ -1169,11 +1144,13 @@ function createInstrumentations(readonly, shallow) {
1169
1144
  clear: createReadonlyMethod("clear")
1170
1145
  } : {
1171
1146
  add(value) {
1172
- if (!shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) value = /* @__PURE__ */ toRaw(value);
1173
1147
  const target = /* @__PURE__ */ toRaw(this);
1174
- if (!getProto(target).has.call(target, value)) {
1175
- target.add(value);
1176
- trigger(target, "add", value, value);
1148
+ const proto = getProto(target);
1149
+ const rawValue = /* @__PURE__ */ toRaw(value);
1150
+ const valueToAdd = !shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value) ? rawValue : value;
1151
+ if (!(proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue))) {
1152
+ target.add(valueToAdd);
1153
+ trigger(target, "add", valueToAdd, valueToAdd);
1177
1154
  }
1178
1155
  return this;
1179
1156
  },
@@ -1244,7 +1221,6 @@ function checkIdentityKeys(target, has, key) {
1244
1221
  warn$2(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
1245
1222
  }
1246
1223
  }
1247
-
1248
1224
  //#endregion
1249
1225
  //#region packages/reactivity/src/reactive.ts
1250
1226
  const reactiveMap = /* @__PURE__ */ new WeakMap();
@@ -1508,7 +1484,6 @@ const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value)
1508
1484
  * @param value - The value for which a readonly proxy shall be created.
1509
1485
  */
1510
1486
  const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
1511
-
1512
1487
  //#endregion
1513
1488
  //#region packages/reactivity/src/ref.ts
1514
1489
  /* @__NO_SIDE_EFFECTS__ */
@@ -1555,7 +1530,6 @@ const shallowUnwrapHandlers = {
1555
1530
  function proxyRefs(objectWithRefs) {
1556
1531
  return /* @__PURE__ */ isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1557
1532
  }
1558
-
1559
1533
  //#endregion
1560
1534
  //#region packages/reactivity/src/effect.ts
1561
1535
  var ReactiveEffect = class {
@@ -1625,7 +1599,6 @@ function cleanup(sub) {
1625
1599
  sub.cleanupsLength = 0;
1626
1600
  }
1627
1601
  }
1628
-
1629
1602
  //#endregion
1630
1603
  //#region packages/reactivity/src/effectScope.ts
1631
1604
  let activeEffectScope;
@@ -1703,7 +1676,6 @@ function setCurrentScope(scope) {
1703
1676
  activeEffectScope = scope;
1704
1677
  }
1705
1678
  }
1706
-
1707
1679
  //#endregion
1708
1680
  //#region packages/reactivity/src/computed.ts
1709
1681
  /**
@@ -1727,7 +1699,7 @@ var ComputedRefImpl = class {
1727
1699
  if (flags & 32) if (checkDirty(this.deps, this)) {
1728
1700
  this.flags = flags | 16;
1729
1701
  return true;
1730
- } else this.flags = flags & ~32;
1702
+ } else this.flags = flags & -33;
1731
1703
  return false;
1732
1704
  }
1733
1705
  /**
@@ -1736,7 +1708,7 @@ var ComputedRefImpl = class {
1736
1708
  */
1737
1709
  set _dirty(v) {
1738
1710
  if (v) this.flags |= 16;
1739
- else this.flags &= ~(16 | 32);
1711
+ else this.flags &= -49;
1740
1712
  }
1741
1713
  constructor(fn, setter) {
1742
1714
  this.fn = fn;
@@ -1746,7 +1718,7 @@ var ComputedRefImpl = class {
1746
1718
  this.subsTail = void 0;
1747
1719
  this.deps = void 0;
1748
1720
  this.depsTail = void 0;
1749
- this.flags = 1 | 16;
1721
+ this.flags = 17;
1750
1722
  this.__v_isRef = true;
1751
1723
  this["__v_isReadonly"] = !setter;
1752
1724
  }
@@ -1757,7 +1729,7 @@ var ComputedRefImpl = class {
1757
1729
  const subs = this.subs;
1758
1730
  if (subs !== void 0) shallowPropagate(subs);
1759
1731
  }
1760
- } else if (flags & 32) this.flags = flags & ~32;
1732
+ } else if (flags & 32) this.flags = flags & -33;
1761
1733
  if (activeSub !== void 0) {
1762
1734
  onTrack(activeSub, {
1763
1735
  target: this,
@@ -1804,7 +1776,6 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1804
1776
  }
1805
1777
  return cRef;
1806
1778
  }
1807
-
1808
1779
  //#endregion
1809
1780
  //#region packages/reactivity/src/watch.ts
1810
1781
  const INITIAL_WATCHER_VALUE = {};
@@ -1941,7 +1912,6 @@ function traverse(value, depth = Infinity, seen) {
1941
1912
  }
1942
1913
  return value;
1943
1914
  }
1944
-
1945
1915
  //#endregion
1946
1916
  //#region packages/runtime-core/src/warning.ts
1947
1917
  const stack = [];
@@ -1968,8 +1938,8 @@ function warn$1(msg, ...args) {
1968
1938
  const trace = getComponentTrace();
1969
1939
  if (appWarnHandler) callWithErrorHandling(appWarnHandler, instance, 11, [
1970
1940
  msg + args.map((a) => {
1971
- var _a$toString, _a$toString2;
1972
- return (_a$toString = (_a$toString2 = a.toString) === null || _a$toString2 === void 0 ? void 0 : _a$toString2.call(a)) !== null && _a$toString !== void 0 ? _a$toString : JSON.stringify(a);
1941
+ const toString = a.toString;
1942
+ return toString == null ? JSON.stringify(a) : toString.call(a);
1973
1943
  }).join(""),
1974
1944
  instance && instance.proxy || instance,
1975
1945
  trace.map(({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`).join("\n"),
@@ -2051,7 +2021,6 @@ function formatProp(key, value, raw) {
2051
2021
  }
2052
2022
  }
2053
2023
  /* v8 ignore stop */
2054
-
2055
2024
  //#endregion
2056
2025
  //#region packages/runtime-core/src/errorHandling.ts
2057
2026
  const ErrorTypeStrings = {
@@ -2144,7 +2113,6 @@ function logError(err, type, instance, throwInDev = true, throwInProd = false) {
2144
2113
  else console.error(err);
2145
2114
  }
2146
2115
  }
2147
-
2148
2116
  //#endregion
2149
2117
  //#region packages/runtime-core/src/scheduler.ts
2150
2118
  const jobs = [];
@@ -2297,10 +2265,16 @@ function checkRecursiveUpdates(seen, fn) {
2297
2265
  seen.set(fn, count + 1);
2298
2266
  return false;
2299
2267
  }
2300
-
2301
2268
  //#endregion
2302
2269
  //#region packages/runtime-core/src/hmr.ts
2303
2270
  let isHmrUpdating = false;
2271
+ const setHmrUpdating = (v) => {
2272
+ try {
2273
+ return isHmrUpdating;
2274
+ } finally {
2275
+ isHmrUpdating = v;
2276
+ }
2277
+ };
2304
2278
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2305
2279
  const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
2306
2280
  getGlobalThis().__VUE_HMR_RUNTIME__ = {
@@ -2419,7 +2393,6 @@ function tryWrap(fn) {
2419
2393
  }
2420
2394
  };
2421
2395
  }
2422
-
2423
2396
  //#endregion
2424
2397
  //#region packages/runtime-core/src/devtools.ts
2425
2398
  let devtools;
@@ -2488,7 +2461,6 @@ function createDevtoolsPerformanceHook(hook) {
2488
2461
  function devtoolsComponentEmit(component, event, params) {
2489
2462
  emit$1("component:emit", component.appContext.app, component, event, params);
2490
2463
  }
2491
-
2492
2464
  //#endregion
2493
2465
  //#region packages/runtime-core/src/componentRenderContext.ts
2494
2466
  /**
@@ -2538,7 +2510,6 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2538
2510
  renderFnWithContext._d = true;
2539
2511
  return renderFnWithContext;
2540
2512
  }
2541
-
2542
2513
  //#endregion
2543
2514
  //#region packages/runtime-core/src/directives.ts
2544
2515
  function validateDirectiveName(name) {
@@ -2563,7 +2534,6 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2563
2534
  }
2564
2535
  }
2565
2536
  }
2566
-
2567
2537
  //#endregion
2568
2538
  //#region packages/runtime-core/src/apiInject.ts
2569
2539
  function provide(key, value) {
@@ -2584,7 +2554,6 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
2584
2554
  else warn$1(`injection "${String(key)}" not found.`);
2585
2555
  } else warn$1(`inject() can only be used inside setup() or functional components.`);
2586
2556
  }
2587
-
2588
2557
  //#endregion
2589
2558
  //#region packages/runtime-core/src/helpers/useSsrContext.ts
2590
2559
  const ssrContextKey = Symbol.for("v-scx");
@@ -2595,7 +2564,6 @@ const useSSRContext = () => {
2595
2564
  return ctx;
2596
2565
  }
2597
2566
  };
2598
-
2599
2567
  //#endregion
2600
2568
  //#region packages/runtime-core/src/apiWatch.ts
2601
2569
  function watch(source, cb, options) {
@@ -2687,12 +2655,10 @@ function createPathGetter(ctx, path) {
2687
2655
  return cur;
2688
2656
  };
2689
2657
  }
2690
-
2691
2658
  //#endregion
2692
2659
  //#region packages/runtime-core/src/components/Teleport.ts
2693
2660
  const TeleportEndKey = Symbol("_vte");
2694
2661
  const isTeleport = (type) => type.__isTeleport;
2695
-
2696
2662
  //#endregion
2697
2663
  //#region packages/runtime-core/src/components/BaseTransition.ts
2698
2664
  const leaveCbKey = Symbol("_leaveCb");
@@ -2707,7 +2673,6 @@ function setTransitionHooks(vnode, hooks) {
2707
2673
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2708
2674
  } else vnode.transition = hooks;
2709
2675
  }
2710
-
2711
2676
  //#endregion
2712
2677
  //#region packages/runtime-core/src/helpers/useId.ts
2713
2678
  /**
@@ -2723,7 +2688,6 @@ function markAsyncBoundary(instance) {
2723
2688
  0
2724
2689
  ];
2725
2690
  }
2726
-
2727
2691
  //#endregion
2728
2692
  //#region packages/runtime-core/src/helpers/useTemplateRef.ts
2729
2693
  const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
@@ -2731,7 +2695,6 @@ function isTemplateRefKey(refs, key) {
2731
2695
  let desc;
2732
2696
  return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
2733
2697
  }
2734
-
2735
2698
  //#endregion
2736
2699
  //#region packages/runtime-core/src/rendererTemplateRef.ts
2737
2700
  const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
@@ -2830,11 +2793,9 @@ function invalidatePendingSetRef(rawRef) {
2830
2793
  pendingSetRefMap.delete(rawRef);
2831
2794
  }
2832
2795
  }
2833
-
2834
2796
  //#endregion
2835
2797
  //#region packages/runtime-core/src/apiAsyncComponent.ts
2836
2798
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2837
-
2838
2799
  //#endregion
2839
2800
  //#region packages/runtime-core/src/components/KeepAlive.ts
2840
2801
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
@@ -2869,7 +2830,6 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2869
2830
  remove(keepAliveRoot[type], injected);
2870
2831
  }, target);
2871
2832
  }
2872
-
2873
2833
  //#endregion
2874
2834
  //#region packages/runtime-core/src/apiLifecycle.ts
2875
2835
  function injectHook(type, hook, target = currentInstance, prepend = false) {
@@ -2905,11 +2865,9 @@ const onRenderTracked = /* @__PURE__ */ createHook("rtc");
2905
2865
  function onErrorCaptured(hook, target = currentInstance) {
2906
2866
  injectHook("ec", hook, target);
2907
2867
  }
2908
-
2909
2868
  //#endregion
2910
2869
  //#region packages/runtime-core/src/helpers/resolveAssets.ts
2911
2870
  const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2912
-
2913
2871
  //#endregion
2914
2872
  //#region packages/runtime-core/src/helpers/renderSlot.ts
2915
2873
  function ensureValidVNode$1(vnodes) {
@@ -2920,7 +2878,6 @@ function ensureValidVNode$1(vnodes) {
2920
2878
  return true;
2921
2879
  }) ? vnodes : null;
2922
2880
  }
2923
-
2924
2881
  //#endregion
2925
2882
  //#region packages/runtime-core/src/componentPublicInstance.ts
2926
2883
  /**
@@ -3088,7 +3045,6 @@ function exposeSetupStateOnRenderContext(instance) {
3088
3045
  }
3089
3046
  });
3090
3047
  }
3091
-
3092
3048
  //#endregion
3093
3049
  //#region packages/runtime-core/src/apiSetupHelpers.ts
3094
3050
  /**
@@ -3097,7 +3053,6 @@ function exposeSetupStateOnRenderContext(instance) {
3097
3053
  function normalizePropsOrEmits(props) {
3098
3054
  return isArray(props) ? props.reduce((normalized, p) => (normalized[p] = null, normalized), {}) : props;
3099
3055
  }
3100
-
3101
3056
  //#endregion
3102
3057
  //#region packages/runtime-core/src/componentOptions.ts
3103
3058
  function createDuplicateChecker() {
@@ -3343,7 +3298,6 @@ function mergeWatchOptions(to, from) {
3343
3298
  for (const key in from) merged[key] = mergeAsArray(to[key], from[key]);
3344
3299
  return merged;
3345
3300
  }
3346
-
3347
3301
  //#endregion
3348
3302
  //#region packages/runtime-core/src/apiCreateApp.ts
3349
3303
  function createAppContext() {
@@ -3475,13 +3429,11 @@ function createAppAPI(mount, unmount, getPublicInstance, render) {
3475
3429
  * `app.runWithContext()`.
3476
3430
  */
3477
3431
  let currentApp = null;
3478
-
3479
3432
  //#endregion
3480
3433
  //#region packages/runtime-core/src/helpers/useModel.ts
3481
3434
  const getModelModifiers = (props, modelName, getter) => {
3482
3435
  return getter(props, getModifierPropName(modelName)) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
3483
3436
  };
3484
-
3485
3437
  //#endregion
3486
3438
  //#region packages/runtime-core/src/componentEmits.ts
3487
3439
  function emit(instance, event, ...rawArgs) {
@@ -3571,7 +3523,6 @@ function isEmitListener(options, key) {
3571
3523
  key = key.slice(2).replace(/Once$/, "");
3572
3524
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
3573
3525
  }
3574
-
3575
3526
  //#endregion
3576
3527
  //#region packages/runtime-core/src/componentRenderUtils.ts
3577
3528
  /**
@@ -3753,17 +3704,20 @@ function hasPropValueChanged(nextProps, prevProps, key) {
3753
3704
  if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
3754
3705
  return nextProp !== prevProp;
3755
3706
  }
3756
- function updateHOCHostEl({ vnode, parent }, el) {
3707
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
3757
3708
  while (parent && !parent.vapor) {
3758
3709
  const root = parent.subTree;
3759
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
3710
+ if (root.suspense && root.suspense.activeBranch === vnode) {
3711
+ root.suspense.vnode.el = root.el = el;
3712
+ vnode = root;
3713
+ }
3760
3714
  if (root === vnode) {
3761
3715
  (vnode = parent.vnode).el = el;
3762
3716
  parent = parent.parent;
3763
3717
  } else break;
3764
3718
  }
3719
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
3765
3720
  }
3766
-
3767
3721
  //#endregion
3768
3722
  //#region packages/runtime-core/src/internalObject.ts
3769
3723
  /**
@@ -3775,7 +3729,6 @@ function updateHOCHostEl({ vnode, parent }, el) {
3775
3729
  const internalObjectProto = {};
3776
3730
  const createInternalObject = () => Object.create(internalObjectProto);
3777
3731
  const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
3778
-
3779
3732
  //#endregion
3780
3733
  //#region packages/runtime-core/src/componentProps.ts
3781
3734
  function initProps(instance, rawProps, isStateful, isSSR = false) {
@@ -4071,7 +4024,6 @@ function isExplicable(type) {
4071
4024
  function isBoolean(...args) {
4072
4025
  return args.some((elem) => elem.toLowerCase() === "boolean");
4073
4026
  }
4074
-
4075
4027
  //#endregion
4076
4028
  //#region packages/runtime-core/src/componentSlots.ts
4077
4029
  const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
@@ -4140,7 +4092,6 @@ const updateSlots = (instance, children, optimized) => {
4140
4092
  for (const key in slots) if (!isInternalKey(key) && deletionComparisonTarget[key] == null) delete slots[key];
4141
4093
  }
4142
4094
  };
4143
-
4144
4095
  //#endregion
4145
4096
  //#region packages/runtime-core/src/profiling.ts
4146
4097
  let supported;
@@ -4179,7 +4130,6 @@ function isSupported() {
4179
4130
  } else supported = false;
4180
4131
  return supported;
4181
4132
  }
4182
-
4183
4133
  //#endregion
4184
4134
  //#region packages/runtime-core/src/renderer.ts
4185
4135
  const queuePostRenderEffect = queueEffectWithSuspense;
@@ -4331,10 +4281,19 @@ function baseCreateRenderer(options, createHydrationFns) {
4331
4281
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4332
4282
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
4333
4283
  else hostInsert(el, container, anchor);
4334
- if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
4335
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4336
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4337
- }, void 0, parentSuspense);
4284
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
4285
+ const isHmr = isHmrUpdating;
4286
+ queuePostRenderEffect(() => {
4287
+ let prev;
4288
+ prev = setHmrUpdating(isHmr);
4289
+ try {
4290
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4291
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4292
+ } finally {
4293
+ setHmrUpdating(prev);
4294
+ }
4295
+ }, void 0, parentSuspense);
4296
+ }
4338
4297
  };
4339
4298
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
4340
4299
  if (scopeId) hostSetScopeId(el, scopeId);
@@ -4556,7 +4515,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4556
4515
  if (isAsyncWrapperVNode && type.__asyncHydrate) type.__asyncHydrate(el, instance, hydrateSubTree);
4557
4516
  else hydrateSubTree();
4558
4517
  } else {
4559
- if (root.ce && root.ce._hasShadowRoot()) root.ce._injectChildStyle(type);
4518
+ if (root.ce && root.ce._hasShadowRoot()) root.ce._injectChildStyle(type, instance.parent ? instance.parent.type : void 0);
4560
4519
  startMeasure(instance, `render`);
4561
4520
  const subTree = instance.subTree = renderComponentRoot$1(instance);
4562
4521
  endMeasure(instance, `render`);
@@ -4807,7 +4766,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4807
4766
  else hostInsert(el, container, anchor);
4808
4767
  };
4809
4768
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
4810
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
4769
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
4811
4770
  if (patchFlag === -2) optimized = false;
4812
4771
  if (ref != null) {
4813
4772
  const prevSub = setActiveSub();
@@ -4845,9 +4804,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4845
4804
  }
4846
4805
  if (doRemove) remove(vnode);
4847
4806
  }
4848
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
4807
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
4808
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
4849
4809
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4850
4810
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4811
+ if (shouldInvalidateMemo) vnode.el = null;
4851
4812
  }, void 0, parentSuspense);
4852
4813
  };
4853
4814
  const remove = (vnode) => {
@@ -5070,7 +5031,6 @@ function resolveAsyncComponentPlaceholder(anchorVnode) {
5070
5031
  if (instance) return resolveAsyncComponentPlaceholder(instance.subTree);
5071
5032
  return null;
5072
5033
  }
5073
-
5074
5034
  //#endregion
5075
5035
  //#region packages/runtime-core/src/components/Suspense.ts
5076
5036
  const isSuspense = (type) => type.__isSuspense;
@@ -5079,7 +5039,6 @@ function queueEffectWithSuspense(fn, id, suspense) {
5079
5039
  else suspense.effects.push(fn);
5080
5040
  else queuePostFlushCb(fn, id);
5081
5041
  }
5082
-
5083
5042
  //#endregion
5084
5043
  //#region packages/runtime-core/src/vnode.ts
5085
5044
  const Fragment = Symbol.for("v-fgt");
@@ -5088,7 +5047,6 @@ const Comment = Symbol.for("v-cmt");
5088
5047
  const Static = Symbol.for("v-stc");
5089
5048
  const VaporSlot = Symbol.for("v-vps");
5090
5049
  const blockStack = [];
5091
- let currentBlock = null;
5092
5050
  let isBlockTreeEnabled = 1;
5093
5051
  /**
5094
5052
  * Block tracking sometimes needs to be disabled, for example during the
@@ -5108,7 +5066,6 @@ let isBlockTreeEnabled = 1;
5108
5066
  */
5109
5067
  function setBlockTracking(value, inVOnce = false) {
5110
5068
  isBlockTreeEnabled += value;
5111
- if (value < 0 && currentBlock && inVOnce) currentBlock.hasOnce = true;
5112
5069
  }
5113
5070
  function isVNode$2(value) {
5114
5071
  return value ? value.__v_isVNode === true : false;
@@ -5124,9 +5081,8 @@ function isSameVNodeType(n1, n2) {
5124
5081
  }
5125
5082
  return n1.type === n2.type && n1.key === n2.key;
5126
5083
  }
5127
- let vnodeArgsTransformer;
5128
5084
  const createVNodeWithArgsTransform = (...args) => {
5129
- return _createVNode(...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args);
5085
+ return _createVNode(...args);
5130
5086
  };
5131
5087
  const normalizeKey = ({ key }) => key != null ? key : null;
5132
5088
  const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
@@ -5173,7 +5129,6 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5173
5129
  if (shapeFlag & 128) type.normalize(vnode);
5174
5130
  } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
5175
5131
  if (vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
5176
- if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
5177
5132
  return vnode;
5178
5133
  }
5179
5134
  const createVNode = createVNodeWithArgsTransform;
@@ -5185,8 +5140,6 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5185
5140
  if (isVNode$2(type)) {
5186
5141
  const cloned = cloneVNode(type, props, true);
5187
5142
  if (children) normalizeChildren(cloned, children);
5188
- if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) if (cloned.shapeFlag & 6) currentBlock[currentBlock.indexOf(type)] = cloned;
5189
- else currentBlock.push(cloned);
5190
5143
  cloned.patchFlag = -2;
5191
5144
  return cloned;
5192
5145
  }
@@ -5322,6 +5275,7 @@ function mergeProps(...args) {
5322
5275
  const existing = ret[key];
5323
5276
  const incoming = toMerge[key];
5324
5277
  if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
5278
+ else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
5325
5279
  } else if (key !== "") ret[key] = toMerge[key];
5326
5280
  }
5327
5281
  return ret;
@@ -5329,7 +5283,6 @@ function mergeProps(...args) {
5329
5283
  function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
5330
5284
  callWithAsyncErrorHandling(hook, instance, 7, [vnode, prevVNode]);
5331
5285
  }
5332
-
5333
5286
  //#endregion
5334
5287
  //#region packages/runtime-core/src/componentCurrentInstance.ts
5335
5288
  /**
@@ -5367,7 +5320,6 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
5367
5320
  simpleSetCurrentInstance(instance);
5368
5321
  }
5369
5322
  };
5370
-
5371
5323
  //#endregion
5372
5324
  //#region packages/runtime-core/src/component.ts
5373
5325
  const emptyAppContext = /* @__PURE__ */ createAppContext();
@@ -5520,29 +5472,10 @@ function handleSetupResult(instance, setupResult, isSSR) {
5520
5472
  } else if (setupResult !== void 0) warn$1(`setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`);
5521
5473
  finishComponentSetup(instance, isSSR);
5522
5474
  }
5523
- let compile;
5524
- let installWithProxy;
5525
- const isRuntimeOnly = () => !compile;
5475
+ const isRuntimeOnly = () => true;
5526
5476
  function finishComponentSetup(instance, isSSR, skipOptions) {
5527
5477
  const Component = instance.type;
5528
- if (!instance.render) {
5529
- if (!isSSR && compile && !Component.render) {
5530
- const template = Component.template || resolveMergedOptions(instance).template;
5531
- if (template) {
5532
- startMeasure(instance, `compile`);
5533
- const { isCustomElement, compilerOptions } = instance.appContext.config;
5534
- const { delimiters, compilerOptions: componentCompilerOptions } = Component;
5535
- const finalCompilerOptions = extend(extend({
5536
- isCustomElement,
5537
- delimiters
5538
- }, compilerOptions), componentCompilerOptions);
5539
- Component.render = compile(template, finalCompilerOptions);
5540
- endMeasure(instance, `compile`);
5541
- }
5542
- }
5543
- instance.render = Component.render || NOOP;
5544
- if (installWithProxy) installWithProxy(instance);
5545
- }
5478
+ if (!instance.render) instance.render = Component.render || NOOP;
5546
5479
  {
5547
5480
  const prevInstance = setCurrentInstance(instance);
5548
5481
  const prevSub = setActiveSub();
@@ -5553,7 +5486,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
5553
5486
  setCurrentInstance(...prevInstance);
5554
5487
  }
5555
5488
  }
5556
- if (!Component.render && instance.render === NOOP && !isSSR) if (!compile && Component.template)
5489
+ if (!Component.render && instance.render === NOOP && !isSSR) if (Component.template)
5557
5490
  /* v8 ignore start */
5558
5491
  warn$1("Component provided template option but runtime compilation is not supported in this build of Vue. Use \"vue.esm-browser.js\" instead.");
5559
5492
  else warn$1(`Component is missing template or render function: `, Component);
@@ -5653,18 +5586,20 @@ function formatComponentName(instance, Component, isRoot = false) {
5653
5586
  function isClassComponent(value) {
5654
5587
  return isFunction(value) && "__vccOpts" in value;
5655
5588
  }
5656
-
5657
5589
  //#endregion
5658
5590
  //#region packages/runtime-core/src/apiComputed.ts
5659
5591
  const computed = (getterOrOptions, debugOptions) => {
5660
5592
  return /* @__PURE__ */ computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
5661
5593
  };
5662
-
5663
5594
  //#endregion
5664
5595
  //#region packages/runtime-core/src/index.ts
5665
- const version = "3.6.0-beta.7";
5596
+ const version = "3.6.0-beta.9";
5666
5597
  const warn = warn$1;
5667
- const _ssrUtils = {
5598
+ /**
5599
+ * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
5600
+ * @internal
5601
+ */
5602
+ const ssrUtils = {
5668
5603
  createComponentInstance: createComponentInstance$1,
5669
5604
  setupComponent: setupComponent$1,
5670
5605
  renderComponentRoot: renderComponentRoot$1,
@@ -5676,12 +5611,6 @@ const _ssrUtils = {
5676
5611
  pushWarningContext: pushWarningContext$1,
5677
5612
  popWarningContext: popWarningContext$1
5678
5613
  };
5679
- /**
5680
- * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
5681
- * @internal
5682
- */
5683
- const ssrUtils = _ssrUtils;
5684
-
5685
5614
  //#endregion
5686
5615
  //#region packages/runtime-dom/src/nodeOps.ts
5687
5616
  let policy = void 0;
@@ -5742,11 +5671,9 @@ const nodeOps = {
5742
5671
  return [before ? before.nextSibling : parent.firstChild, anchor ? anchor.previousSibling : parent.lastChild];
5743
5672
  }
5744
5673
  };
5745
-
5746
5674
  //#endregion
5747
5675
  //#region packages/runtime-dom/src/components/Transition.ts
5748
5676
  const vtcKey = Symbol("_vtc");
5749
-
5750
5677
  //#endregion
5751
5678
  //#region packages/runtime-dom/src/modules/class.ts
5752
5679
  function patchClass(el, value, isSVG) {
@@ -5756,7 +5683,6 @@ function patchClass(el, value, isSVG) {
5756
5683
  else if (isSVG) el.setAttribute("class", value);
5757
5684
  else el.className = value;
5758
5685
  }
5759
-
5760
5686
  //#endregion
5761
5687
  //#region packages/runtime-dom/src/directives/vShow.ts
5762
5688
  const vShowOriginalDisplay = Symbol("_vod");
@@ -5795,11 +5721,9 @@ function initVShowForSSR() {
5795
5721
  if (!value) return { style: { display: "none" } };
5796
5722
  };
5797
5723
  }
5798
-
5799
5724
  //#endregion
5800
5725
  //#region packages/runtime-dom/src/helpers/useCssVars.ts
5801
5726
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT");
5802
-
5803
5727
  //#endregion
5804
5728
  //#region packages/runtime-dom/src/modules/style.ts
5805
5729
  const displayRE = /(?:^|;)\s*display\s*:/;
@@ -5864,7 +5788,6 @@ function autoPrefix(style, rawName) {
5864
5788
  }
5865
5789
  return rawName;
5866
5790
  }
5867
-
5868
5791
  //#endregion
5869
5792
  //#region packages/runtime-dom/src/modules/attrs.ts
5870
5793
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -5874,7 +5797,6 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
5874
5797
  else if (value == null || isBoolean && !includeBooleanAttr(value)) el.removeAttribute(key);
5875
5798
  else el.setAttribute(key, isBoolean ? "" : isSymbol(value) ? String(value) : value);
5876
5799
  }
5877
-
5878
5800
  //#endregion
5879
5801
  //#region packages/runtime-dom/src/modules/props.ts
5880
5802
  function patchDOMProp(el, key, value, parentComponent, attrName) {
@@ -5910,7 +5832,6 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
5910
5832
  }
5911
5833
  needRemove && el.removeAttribute(attrName || key);
5912
5834
  }
5913
-
5914
5835
  //#endregion
5915
5836
  //#region packages/runtime-dom/src/modules/events.ts
5916
5837
  function addEventListener(el, event, handler, options) {
@@ -5974,7 +5895,6 @@ function patchStopImmediatePropagation(e, value) {
5974
5895
  return value.map((fn) => (e) => !e._stopped && fn && fn(e));
5975
5896
  } else return value;
5976
5897
  }
5977
-
5978
5898
  //#endregion
5979
5899
  //#region packages/runtime-dom/src/patchProp.ts
5980
5900
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -5986,7 +5906,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
5986
5906
  } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
5987
5907
  patchDOMProp(el, key, nextValue, parentComponent);
5988
5908
  if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
5989
- } else if (el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))) patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
5909
+ } else if (el._isVueCE && (shouldSetAsPropForVueCE(el, key) || el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))) patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
5990
5910
  else {
5991
5911
  if (key === "true-value") el._trueValue = nextValue;
5992
5912
  else if (key === "false-value") el._falseValue = nextValue;
@@ -6003,7 +5923,12 @@ function shouldSetAsProp(el, key, value, isSVG) {
6003
5923
  if (isNativeOn(key) && isString(value)) return false;
6004
5924
  return key in el;
6005
5925
  }
6006
-
5926
+ function shouldSetAsPropForVueCE(el, key) {
5927
+ const props = el._def.props;
5928
+ if (!props) return false;
5929
+ const camelKey = camelize(key);
5930
+ return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
5931
+ }
6007
5932
  //#endregion
6008
5933
  //#region packages/runtime-dom/src/directives/vModel.ts
6009
5934
  const getModelAssigner = (vnode) => {
@@ -6064,7 +5989,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
6064
5989
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
6065
5990
  const newValue = value == null ? "" : value;
6066
5991
  if (elValue === newValue) return;
6067
- if (document.activeElement === el && el.type !== "range") {
5992
+ const rootNode = el.getRootNode();
5993
+ if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
6068
5994
  if (lazy && value === oldValue) return;
6069
5995
  if (trim && el.value.trim() === newValue) return;
6070
5996
  }
@@ -6253,7 +6179,6 @@ function initVModelForSSR() {
6253
6179
  if (modelToUse.getSSRProps) return modelToUse.getSSRProps(binding, vnode);
6254
6180
  };
6255
6181
  }
6256
-
6257
6182
  //#endregion
6258
6183
  //#region packages/runtime-dom/src/index.ts
6259
6184
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -6338,7 +6263,6 @@ const initDirectivesForSSR = () => {
6338
6263
  initVShowForSSR();
6339
6264
  }
6340
6265
  };
6341
-
6342
6266
  //#endregion
6343
6267
  //#region packages/server-renderer/src/helpers/ssrRenderAttrs.ts
6344
6268
  const shouldIgnoreProp = /* @__PURE__ */ makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
@@ -6387,13 +6311,11 @@ function ssrResetCssVars(raw) {
6387
6311
  }
6388
6312
  return raw;
6389
6313
  }
6390
-
6391
6314
  //#endregion
6392
6315
  //#region packages/server-renderer/src/helpers/ssrRenderComponent.ts
6393
6316
  function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
6394
6317
  return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
6395
6318
  }
6396
-
6397
6319
  //#endregion
6398
6320
  //#region packages/server-renderer/src/helpers/ssrRenderSlot.ts
6399
6321
  const { ensureValidVNode } = ssrUtils;
@@ -6445,7 +6367,6 @@ function isComment(item) {
6445
6367
  if (item.length <= 8) return true;
6446
6368
  return !item.replace(commentRE, "").trim();
6447
6369
  }
6448
-
6449
6370
  //#endregion
6450
6371
  //#region packages/server-renderer/src/helpers/ssrRenderTeleport.ts
6451
6372
  function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
@@ -6468,20 +6389,18 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
6468
6389
  targetBuffer.splice(bufferIndex, 0, teleportContent);
6469
6390
  parentPush("<!--teleport end-->");
6470
6391
  }
6471
-
6472
6392
  //#endregion
6473
6393
  //#region packages/server-renderer/src/helpers/ssrInterpolate.ts
6474
6394
  function ssrInterpolate(value) {
6475
6395
  return escapeHtml(toDisplayString(value));
6476
6396
  }
6477
-
6478
6397
  //#endregion
6479
6398
  //#region packages/server-renderer/src/helpers/ssrRenderList.ts
6480
6399
  function ssrRenderList(source, renderItem) {
6481
6400
  if (isArray(source) || isString(source)) for (let i = 0, l = source.length; i < l; i++) renderItem(source[i], i);
6482
6401
  else if (typeof source === "number") {
6483
- if (!Number.isInteger(source)) {
6484
- warn(`The v-for range expect an integer value but got ${source}.`);
6402
+ if (!Number.isInteger(source) || source < 0) {
6403
+ warn(`The v-for range expects a positive integer value but got ${source}.`);
6485
6404
  return;
6486
6405
  }
6487
6406
  for (let i = 0; i < source; i++) renderItem(i + 1, i);
@@ -6496,14 +6415,12 @@ function ssrRenderList(source, renderItem) {
6496
6415
  }
6497
6416
  }
6498
6417
  }
6499
-
6500
6418
  //#endregion
6501
6419
  //#region packages/server-renderer/src/helpers/ssrRenderSuspense.ts
6502
6420
  async function ssrRenderSuspense(push, { default: renderContent }) {
6503
6421
  if (renderContent) renderContent();
6504
6422
  else push(`<!---->`);
6505
6423
  }
6506
-
6507
6424
  //#endregion
6508
6425
  //#region packages/server-renderer/src/helpers/ssrGetDirectiveProps.ts
6509
6426
  function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
@@ -6517,7 +6434,6 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
6517
6434
  }, null) || {};
6518
6435
  return {};
6519
6436
  }
6520
-
6521
6437
  //#endregion
6522
6438
  //#region packages/server-renderer/src/helpers/ssrVModelHelpers.ts
6523
6439
  const ssrLooseEqual = looseEqual;
@@ -6539,16 +6455,34 @@ function ssrGetDynamicModelProps(existingProps = {}, model) {
6539
6455
  default: return { value: model };
6540
6456
  }
6541
6457
  }
6542
-
6543
6458
  //#endregion
6544
6459
  //#region packages/server-renderer/src/helpers/ssrCompile.ts
6545
6460
  function ssrCompile(template, instance) {
6546
6461
  throw new Error("On-the-fly template compilation is not supported in the ESM build of @vue/server-renderer. All templates must be pre-compiled into render functions.");
6547
6462
  }
6548
-
6549
6463
  //#endregion
6550
6464
  //#region packages/server-renderer/src/render.ts
6551
6465
  const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, normalizeVNode, pushWarningContext, popWarningContext } = ssrUtils;
6466
+ function cleanupContext(context) {
6467
+ let firstError;
6468
+ if (context.__watcherHandles) {
6469
+ for (const unwatch of context.__watcherHandles) try {
6470
+ unwatch();
6471
+ } catch (err) {
6472
+ if (firstError === void 0) firstError = err;
6473
+ }
6474
+ context.__watcherHandles.length = 0;
6475
+ }
6476
+ if (context.__instanceScopes) {
6477
+ for (const scope of context.__instanceScopes) try {
6478
+ scope.stop();
6479
+ } catch (err) {
6480
+ if (firstError === void 0) firstError = err;
6481
+ }
6482
+ context.__instanceScopes.length = 0;
6483
+ }
6484
+ if (firstError !== void 0) throw firstError;
6485
+ }
6552
6486
  function createBuffer() {
6553
6487
  let appendable = false;
6554
6488
  const buffer = [];
@@ -6570,6 +6504,8 @@ function createBuffer() {
6570
6504
  }
6571
6505
  function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
6572
6506
  const instance = vnode.component = createComponentInstance(vnode, parentComponent, null);
6507
+ const context = instance.appContext.provides[ssrContextKey];
6508
+ if (context) (context.__instanceScopes || (context.__instanceScopes = [])).push(instance.scope);
6573
6509
  pushWarningContext(vnode);
6574
6510
  const res = setupComponent(instance, true);
6575
6511
  popWarningContext();
@@ -6723,7 +6659,6 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
6723
6659
  renderVNodeChildren(push, vnode.children, parentComponent, slotScopeId);
6724
6660
  }, target, disabled || disabled === "", parentComponent);
6725
6661
  }
6726
-
6727
6662
  //#endregion
6728
6663
  //#region packages/server-renderer/src/renderToString.ts
6729
6664
  const { isVNode: isVNode$1 } = ssrUtils;
@@ -6766,10 +6701,13 @@ async function renderToString(input, context = {}) {
6766
6701
  const vnode = createVNode(input._component, input._props);
6767
6702
  vnode.appContext = input._context;
6768
6703
  input.provide(ssrContextKey, context);
6769
- const result = await unrollBuffer$1(await renderComponentVNode(vnode));
6770
- await resolveTeleports(context);
6771
- if (context.__watcherHandles) for (const unwatch of context.__watcherHandles) unwatch();
6772
- return result;
6704
+ try {
6705
+ const result = await unrollBuffer$1(await renderComponentVNode(vnode));
6706
+ await resolveTeleports(context);
6707
+ return result;
6708
+ } finally {
6709
+ cleanupContext(context);
6710
+ }
6773
6711
  }
6774
6712
  async function resolveTeleports(context) {
6775
6713
  if (context.__teleportBuffers) {
@@ -6777,7 +6715,6 @@ async function resolveTeleports(context) {
6777
6715
  for (const key in context.__teleportBuffers) context.teleports[key] = await unrollBuffer$1(await Promise.all([context.__teleportBuffers[key]]));
6778
6716
  }
6779
6717
  }
6780
-
6781
6718
  //#endregion
6782
6719
  //#region packages/server-renderer/src/renderToStream.ts
6783
6720
  const { isVNode } = ssrUtils;
@@ -6792,7 +6729,7 @@ async function unrollBuffer(buffer, stream) {
6792
6729
  }
6793
6730
  function unrollBufferSync(buffer, stream) {
6794
6731
  for (let i = 0; i < buffer.length; i++) {
6795
- let item = buffer[i];
6732
+ const item = buffer[i];
6796
6733
  if (isString(item)) stream.push(item);
6797
6734
  else unrollBufferSync(item, stream);
6798
6735
  }
@@ -6802,9 +6739,19 @@ function renderToSimpleStream(input, context, stream) {
6802
6739
  const vnode = createVNode(input._component, input._props);
6803
6740
  vnode.appContext = input._context;
6804
6741
  input.provide(ssrContextKey, context);
6805
- Promise.resolve(renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
6806
- if (context.__watcherHandles) for (const unwatch of context.__watcherHandles) unwatch();
6807
- }).then(() => stream.push(null)).catch((error) => {
6742
+ let cleaned = false;
6743
+ const finalize = () => {
6744
+ if (cleaned) return;
6745
+ cleaned = true;
6746
+ cleanupContext(context);
6747
+ };
6748
+ Promise.resolve().then(() => renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
6749
+ finalize();
6750
+ return stream.push(null);
6751
+ }).catch((error) => {
6752
+ try {
6753
+ finalize();
6754
+ } catch {}
6808
6755
  stream.destroy(error);
6809
6756
  });
6810
6757
  return stream;
@@ -6871,10 +6818,8 @@ function pipeToWebWritable(input, context = {}, writable) {
6871
6818
  }
6872
6819
  });
6873
6820
  }
6874
-
6875
6821
  //#endregion
6876
6822
  //#region packages/server-renderer/src/index.ts
6877
6823
  initDirectivesForSSR();
6878
-
6879
6824
  //#endregion
6880
- export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, includeBooleanAttr as ssrIncludeBooleanAttr, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
6825
+ export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, includeBooleanAttr as ssrIncludeBooleanAttr, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };