@vue/server-renderer 3.5.39 → 3.5.41

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.39
2
+ * @vue/server-renderer v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -177,7 +177,7 @@ const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
177
177
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
178
178
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
179
179
  const isBooleanAttr = /* @__PURE__ */ makeMap(
180
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
180
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
181
181
  );
182
182
  function includeBooleanAttr(value) {
183
183
  return !!value || value === "";
@@ -247,9 +247,14 @@ function escapeHtml(string) {
247
247
  }
248
248
  return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
249
249
  }
250
- const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
250
+ const commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;
251
251
  function escapeHtmlComment(src) {
252
- return src.replace(commentStripRE, "");
252
+ let prev;
253
+ do {
254
+ prev = src;
255
+ src = src.replace(commentStripRE, "");
256
+ } while (src !== prev);
257
+ return src;
253
258
  }
254
259
 
255
260
  function looseCompareArrays(a, b) {
@@ -407,8 +412,9 @@ class EffectScope {
407
412
  this._isPaused = true;
408
413
  let i, l;
409
414
  if (this.scopes) {
410
- for (i = 0, l = this.scopes.length; i < l; i++) {
411
- this.scopes[i].pause();
415
+ const scopes = this.scopes.slice();
416
+ for (i = 0, l = scopes.length; i < l; i++) {
417
+ scopes[i].pause();
412
418
  }
413
419
  }
414
420
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -425,12 +431,14 @@ class EffectScope {
425
431
  this._isPaused = false;
426
432
  let i, l;
427
433
  if (this.scopes) {
428
- for (i = 0, l = this.scopes.length; i < l; i++) {
429
- this.scopes[i].resume();
434
+ const scopes = this.scopes.slice();
435
+ for (i = 0, l = scopes.length; i < l; i++) {
436
+ scopes[i].resume();
430
437
  }
431
438
  }
432
- for (i = 0, l = this.effects.length; i < l; i++) {
433
- this.effects[i].resume();
439
+ const effects = this.effects.slice();
440
+ for (i = 0, l = effects.length; i < l; i++) {
441
+ effects[i].resume();
434
442
  }
435
443
  }
436
444
  }
@@ -492,8 +500,9 @@ class EffectScope {
492
500
  }
493
501
  this.cleanups.length = 0;
494
502
  if (this.scopes) {
495
- for (i = 0, l = this.scopes.length; i < l; i++) {
496
- this.scopes[i].stop(true);
503
+ const scopes = this.scopes.slice();
504
+ for (i = 0, l = scopes.length; i < l; i++) {
505
+ scopes[i].stop(true);
497
506
  }
498
507
  this.scopes.length = 0;
499
508
  }
@@ -2368,7 +2377,9 @@ function queuePostFlushCb(cb) {
2368
2377
  cb.flags |= 1;
2369
2378
  }
2370
2379
  } else {
2371
- pendingPostFlushCbs.push(...cb);
2380
+ for (let i = 0; i < cb.length; i++) {
2381
+ pendingPostFlushCbs.push(cb[i]);
2382
+ }
2372
2383
  }
2373
2384
  queueFlush();
2374
2385
  }
@@ -2404,7 +2415,9 @@ function flushPostFlushCbs(seen) {
2404
2415
  );
2405
2416
  pendingPostFlushCbs.length = 0;
2406
2417
  if (activePostFlushCbs) {
2407
- activePostFlushCbs.push(...deduped);
2418
+ for (let i = 0; i < deduped.length; i++) {
2419
+ activePostFlushCbs.push(deduped[i]);
2420
+ }
2408
2421
  return;
2409
2422
  }
2410
2423
  activePostFlushCbs = deduped;
@@ -2727,10 +2740,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2727
2740
  setBlockTracking(-1);
2728
2741
  }
2729
2742
  const prevInstance = setCurrentRenderingInstance$1(ctx);
2743
+ const prevStackSize = blockStack.length;
2730
2744
  let res;
2731
2745
  try {
2732
2746
  res = fn(...args);
2733
2747
  } finally {
2748
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
2734
2749
  setCurrentRenderingInstance$1(prevInstance);
2735
2750
  if (renderFnWithContext._d) {
2736
2751
  setBlockTracking(1);
@@ -2931,10 +2946,53 @@ const TeleportEndKey = /* @__PURE__ */ Symbol("_vte");
2931
2946
  const isTeleport = (type) => type.__isTeleport;
2932
2947
 
2933
2948
  const leaveCbKey = /* @__PURE__ */ Symbol("_leaveCb");
2949
+ function findNonCommentChild(children) {
2950
+ let child = children[0];
2951
+ if (children.length > 1) {
2952
+ let hasFound = false;
2953
+ for (const c of children) {
2954
+ if (c.type !== Comment) {
2955
+ if (hasFound) {
2956
+ warn$1(
2957
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
2958
+ );
2959
+ break;
2960
+ }
2961
+ child = c;
2962
+ hasFound = true;
2963
+ }
2964
+ }
2965
+ }
2966
+ return child;
2967
+ }
2968
+ function getInnerChild(vnode) {
2969
+ if (!isKeepAlive(vnode)) {
2970
+ if (isTeleport(vnode.type) && vnode.children) {
2971
+ return findNonCommentChild(vnode.children);
2972
+ }
2973
+ return vnode;
2974
+ }
2975
+ if (vnode.component) {
2976
+ return vnode.component.subTree;
2977
+ }
2978
+ const { shapeFlag, children } = vnode;
2979
+ if (children) {
2980
+ if (shapeFlag & 16) {
2981
+ return children[0];
2982
+ }
2983
+ if (shapeFlag & 32 && isFunction(children.default)) {
2984
+ return children.default();
2985
+ }
2986
+ }
2987
+ }
2934
2988
  function setTransitionHooks(vnode, hooks) {
2935
2989
  if (vnode.shapeFlag & 6 && vnode.component) {
2936
2990
  vnode.transition = hooks;
2937
- setTransitionHooks(vnode.component.subTree, hooks);
2991
+ const subTree = vnode.component.subTree;
2992
+ setTransitionHooks(
2993
+ isTeleport(subTree.type) ? getInnerChild(subTree) || subTree : subTree,
2994
+ hooks
2995
+ );
2938
2996
  } else if (vnode.shapeFlag & 128) {
2939
2997
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2940
2998
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -3027,12 +3085,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3027
3085
  }
3028
3086
  }
3029
3087
  if (isFunction(ref)) {
3030
- pauseTracking();
3031
- try {
3032
- callWithErrorHandling(ref, owner, 12, [value, refs]);
3033
- } finally {
3034
- resetTracking();
3035
- }
3088
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
3036
3089
  } else {
3037
3090
  const _isString = isString(ref);
3038
3091
  const _isRef = isRef(ref);
@@ -4269,6 +4322,7 @@ function renderComponentRoot$1(instance) {
4269
4322
  fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
4270
4323
  }
4271
4324
  } catch (err) {
4325
+ blockStack.length = 0;
4272
4326
  handleError(err, instance, 1);
4273
4327
  result = createVNode(Comment);
4274
4328
  }
@@ -4326,12 +4380,13 @@ function renderComponentRoot$1(instance) {
4326
4380
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
4327
4381
  }
4328
4382
  if (vnode.transition) {
4329
- if (!isElementRoot(root)) {
4383
+ const child = isTeleport(root.type) ? getInnerChild(root) || root : root;
4384
+ if (!isElementRoot(child)) {
4330
4385
  warn$1(
4331
4386
  `Component inside <Transition> renders non-element root node that cannot be animated.`
4332
4387
  );
4333
4388
  }
4334
- setTransitionHooks(root, vnode.transition);
4389
+ setTransitionHooks(child, vnode.transition);
4335
4390
  }
4336
4391
  if (setRoot) {
4337
4392
  setRoot(root);
@@ -6584,7 +6639,12 @@ const Fragment = /* @__PURE__ */ Symbol.for("v-fgt");
6584
6639
  const Text = /* @__PURE__ */ Symbol.for("v-txt");
6585
6640
  const Comment = /* @__PURE__ */ Symbol.for("v-cmt");
6586
6641
  const Static = /* @__PURE__ */ Symbol.for("v-stc");
6642
+ const blockStack = [];
6587
6643
  let currentBlock = null;
6644
+ function closeBlock() {
6645
+ blockStack.pop();
6646
+ currentBlock = blockStack[blockStack.length - 1] || null;
6647
+ }
6588
6648
  let isBlockTreeEnabled = 1;
6589
6649
  function setBlockTracking(value, inVOnce = false) {
6590
6650
  isBlockTreeEnabled += value;
@@ -6663,6 +6723,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
6663
6723
  if (vnode.key !== vnode.key) {
6664
6724
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
6665
6725
  }
6726
+ if (props && vnode.shapeFlag & 1) {
6727
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
6728
+ if (overwritingProp && hasContentChildren(vnode.children)) {
6729
+ warn$1(
6730
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
6731
+ );
6732
+ }
6733
+ }
6666
6734
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
6667
6735
  !isBlockNode && // has current parent block
6668
6736
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -6676,6 +6744,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
6676
6744
  }
6677
6745
  return vnode;
6678
6746
  }
6747
+ function hasContentChildren(children) {
6748
+ if (isString(children)) return children !== "";
6749
+ if (isArray(children)) return children.length > 0;
6750
+ return false;
6751
+ }
6679
6752
  const createVNode = createVNodeWithArgsTransform ;
6680
6753
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
6681
6754
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -7116,7 +7189,12 @@ function setupStatefulComponent(instance, isSSR) {
7116
7189
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
7117
7190
  if (isSSR) {
7118
7191
  return setupResult.then((resolvedResult) => {
7119
- handleSetupResult(instance, resolvedResult, isSSR);
7192
+ setInSSRSetupState(true);
7193
+ try {
7194
+ handleSetupResult(instance, resolvedResult, isSSR);
7195
+ } finally {
7196
+ setInSSRSetupState(false);
7197
+ }
7120
7198
  }).catch((e) => {
7121
7199
  handleError(e, instance, 0);
7122
7200
  });
@@ -7313,7 +7391,7 @@ const computed = (getterOrOptions, debugOptions) => {
7313
7391
  return c;
7314
7392
  };
7315
7393
 
7316
- const version = "3.5.39";
7394
+ const version = "3.5.41";
7317
7395
  const warn = warn$1 ;
7318
7396
  const _ssrUtils = {
7319
7397
  createComponentInstance: createComponentInstance$1,
@@ -7952,7 +8030,7 @@ function ssrRenderDynamicAttr(key, value, tag) {
7952
8030
  return ``;
7953
8031
  }
7954
8032
  const attrKey = tag && (tag.indexOf("-") > 0 || isSVGTag(tag)) ? key : propsToAttrMap[key] || key.toLowerCase();
7955
- if (isBooleanAttr(attrKey)) {
8033
+ if (isBooleanAttr(attrKey) || attrKey === "hidden" && (typeof value === "boolean" || typeof value === "number")) {
7956
8034
  return includeBooleanAttr(value) ? ` ${attrKey}` : ``;
7957
8035
  } else if (isSSRSafeAttrName(attrKey)) {
7958
8036
  return value === "" ? ` ${attrKey}` : ` ${attrKey}="${escapeHtml(value)}"`;
@@ -8027,7 +8105,9 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
8027
8105
  slotBuffer.push(item);
8028
8106
  };
8029
8107
  const ret = slotFn(
8030
- slotProps,
8108
+ // keep the slot function's contract in sync with `renderSlot`, which also
8109
+ // normalizes nullish props before invoking the slot
8110
+ slotProps || {},
8031
8111
  bufferedPush,
8032
8112
  parentComponent,
8033
8113
  slotScopeId ? " " + slotScopeId : ""
@@ -8266,7 +8346,11 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
8266
8346
  }).catch(NOOP);
8267
8347
  return p.then(() => renderComponentSubTree(instance, slotScopeId));
8268
8348
  } else {
8269
- return renderComponentSubTree(instance, slotScopeId);
8349
+ try {
8350
+ return renderComponentSubTree(instance, slotScopeId);
8351
+ } catch (err) {
8352
+ return Promise.reject(err);
8353
+ }
8270
8354
  }
8271
8355
  }
8272
8356
  function renderComponentSubTree(instance, slotScopeId) {
@@ -8328,6 +8412,8 @@ function renderComponentSubTree(instance, slotScopeId) {
8328
8412
  instance.data,
8329
8413
  instance.ctx
8330
8414
  );
8415
+ } catch (err) {
8416
+ handleError(err, instance, 1);
8331
8417
  } finally {
8332
8418
  setCurrentRenderingInstance(prev);
8333
8419
  }