@vue/runtime-core 3.2.34-beta.1 → 3.2.34

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.
@@ -2393,7 +2393,10 @@ const KeepAliveImpl = {
2393
2393
  // if the internal renderer is not registered, it indicates that this is server-side rendering,
2394
2394
  // for KeepAlive, we just need to render its children
2395
2395
  if (!sharedContext.renderer) {
2396
- return slots.default;
2396
+ return () => {
2397
+ const children = slots.default && slots.default();
2398
+ return children && children.length === 1 ? children[0] : children;
2399
+ };
2397
2400
  }
2398
2401
  const cache = new Map();
2399
2402
  const keys = new Set();
@@ -4522,7 +4525,7 @@ const isComment = (node) => node.nodeType === 8 /* COMMENT */;
4522
4525
  // Hydration also depends on some renderer internal logic which needs to be
4523
4526
  // passed in via arguments.
4524
4527
  function createHydrationFunctions(rendererInternals) {
4525
- const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
4528
+ const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
4526
4529
  const hydrate = (vnode, container) => {
4527
4530
  if (!container.hasChildNodes()) {
4528
4531
  warn(`Attempting to hydrate existing markup but container is empty. ` +
@@ -4553,7 +4556,15 @@ function createHydrationFunctions(rendererInternals) {
4553
4556
  switch (type) {
4554
4557
  case Text:
4555
4558
  if (domType !== 3 /* TEXT */) {
4556
- nextNode = onMismatch();
4559
+ // #5728 empty text node inside a slot can cause hydration failure
4560
+ // because the server rendered HTML won't contain a text node
4561
+ if (vnode.children === '') {
4562
+ insert((vnode.el = createText('')), node.parentElement, node);
4563
+ nextNode = node;
4564
+ }
4565
+ else {
4566
+ nextNode = onMismatch();
4567
+ }
4557
4568
  }
4558
4569
  else {
4559
4570
  if (node.data !== vnode.children) {
@@ -4627,6 +4638,12 @@ function createHydrationFunctions(rendererInternals) {
4627
4638
  nextNode = isFragmentStart
4628
4639
  ? locateClosingAsyncAnchor(node)
4629
4640
  : nextSibling(node);
4641
+ // #4293 teleport as component root
4642
+ if (nextNode &&
4643
+ isComment(nextNode) &&
4644
+ nextNode.data === 'teleport end') {
4645
+ nextNode = nextSibling(nextNode);
4646
+ }
4630
4647
  // #3787
4631
4648
  // if component is async, it may get moved / unmounted before its
4632
4649
  // inner component is loaded, so we need to give it a placeholder
@@ -5290,8 +5307,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5290
5307
  const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
5291
5308
  const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
5292
5309
  let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
5293
- if (isHmrUpdating) {
5294
- // HMR updated, force full diff
5310
+ if (// #5523 dev root fragment may inherit directives
5311
+ (isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
5312
+ // HMR updated / Dev root fragment (w/ comments), force full diff
5295
5313
  patchFlag = 0;
5296
5314
  optimized = false;
5297
5315
  dynamicChildren = null;
@@ -5313,8 +5331,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5313
5331
  else {
5314
5332
  if (patchFlag > 0 &&
5315
5333
  patchFlag & 64 /* STABLE_FRAGMENT */ &&
5316
- // #5523 dev root fragment may inherit directives so always force update
5317
- !(patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) &&
5318
5334
  dynamicChildren &&
5319
5335
  // #2715 the previous fragment could've been a BAILed one as a result
5320
5336
  // of renderSlot() with no valid children
@@ -6400,10 +6416,23 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
6400
6416
  }
6401
6417
  else {
6402
6418
  vnode.anchor = nextSibling(node);
6403
- vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6419
+ // lookahead until we find the target anchor
6420
+ // we cannot rely on return value of hydrateChildren() because there
6421
+ // could be nested teleports
6422
+ let targetAnchor = targetNode;
6423
+ while (targetAnchor) {
6424
+ targetAnchor = nextSibling(targetAnchor);
6425
+ if (targetAnchor &&
6426
+ targetAnchor.nodeType === 8 &&
6427
+ targetAnchor.data === 'teleport anchor') {
6428
+ vnode.targetAnchor = targetAnchor;
6429
+ target._lpa =
6430
+ vnode.targetAnchor && nextSibling(vnode.targetAnchor);
6431
+ break;
6432
+ }
6433
+ }
6434
+ hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6404
6435
  }
6405
- target._lpa =
6406
- vnode.targetAnchor && nextSibling(vnode.targetAnchor);
6407
6436
  }
6408
6437
  }
6409
6438
  return vnode.anchor && nextSibling(vnode.anchor);
@@ -7695,7 +7724,7 @@ function isMemoSame(cached, memo) {
7695
7724
  }
7696
7725
 
7697
7726
  // Core API ------------------------------------------------------------------
7698
- const version = "3.2.34-beta.1";
7727
+ const version = "3.2.34";
7699
7728
  const _ssrUtils = {
7700
7729
  createComponentInstance,
7701
7730
  setupComponent,
@@ -1899,7 +1899,10 @@ const KeepAliveImpl = {
1899
1899
  // if the internal renderer is not registered, it indicates that this is server-side rendering,
1900
1900
  // for KeepAlive, we just need to render its children
1901
1901
  if (!sharedContext.renderer) {
1902
- return slots.default;
1902
+ return () => {
1903
+ const children = slots.default && slots.default();
1904
+ return children && children.length === 1 ? children[0] : children;
1905
+ };
1903
1906
  }
1904
1907
  const cache = new Map();
1905
1908
  const keys = new Set();
@@ -3548,7 +3551,7 @@ const isComment = (node) => node.nodeType === 8 /* COMMENT */;
3548
3551
  // Hydration also depends on some renderer internal logic which needs to be
3549
3552
  // passed in via arguments.
3550
3553
  function createHydrationFunctions(rendererInternals) {
3551
- const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
3554
+ const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
3552
3555
  const hydrate = (vnode, container) => {
3553
3556
  if (!container.hasChildNodes()) {
3554
3557
  patch(null, vnode, container);
@@ -3577,7 +3580,15 @@ function createHydrationFunctions(rendererInternals) {
3577
3580
  switch (type) {
3578
3581
  case Text:
3579
3582
  if (domType !== 3 /* TEXT */) {
3580
- nextNode = onMismatch();
3583
+ // #5728 empty text node inside a slot can cause hydration failure
3584
+ // because the server rendered HTML won't contain a text node
3585
+ if (vnode.children === '') {
3586
+ insert((vnode.el = createText('')), node.parentElement, node);
3587
+ nextNode = node;
3588
+ }
3589
+ else {
3590
+ nextNode = onMismatch();
3591
+ }
3581
3592
  }
3582
3593
  else {
3583
3594
  if (node.data !== vnode.children) {
@@ -3648,6 +3659,12 @@ function createHydrationFunctions(rendererInternals) {
3648
3659
  nextNode = isFragmentStart
3649
3660
  ? locateClosingAsyncAnchor(node)
3650
3661
  : nextSibling(node);
3662
+ // #4293 teleport as component root
3663
+ if (nextNode &&
3664
+ isComment(nextNode) &&
3665
+ nextNode.data === 'teleport end') {
3666
+ nextNode = nextSibling(nextNode);
3667
+ }
3651
3668
  // #3787
3652
3669
  // if component is async, it may get moved / unmounted before its
3653
3670
  // inner component is loaded, so we need to give it a placeholder
@@ -4229,8 +4246,6 @@ function baseCreateRenderer(options, createHydrationFns) {
4229
4246
  else {
4230
4247
  if (patchFlag > 0 &&
4231
4248
  patchFlag & 64 /* STABLE_FRAGMENT */ &&
4232
- // #5523 dev root fragment may inherit directives so always force update
4233
- !(false /* DEV_ROOT_FRAGMENT */) &&
4234
4249
  dynamicChildren &&
4235
4250
  // #2715 the previous fragment could've been a BAILed one as a result
4236
4251
  // of renderSlot() with no valid children
@@ -5178,10 +5193,23 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
5178
5193
  }
5179
5194
  else {
5180
5195
  vnode.anchor = nextSibling(node);
5181
- vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
5196
+ // lookahead until we find the target anchor
5197
+ // we cannot rely on return value of hydrateChildren() because there
5198
+ // could be nested teleports
5199
+ let targetAnchor = targetNode;
5200
+ while (targetAnchor) {
5201
+ targetAnchor = nextSibling(targetAnchor);
5202
+ if (targetAnchor &&
5203
+ targetAnchor.nodeType === 8 &&
5204
+ targetAnchor.data === 'teleport anchor') {
5205
+ vnode.targetAnchor = targetAnchor;
5206
+ target._lpa =
5207
+ vnode.targetAnchor && nextSibling(vnode.targetAnchor);
5208
+ break;
5209
+ }
5210
+ }
5211
+ hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
5182
5212
  }
5183
- target._lpa =
5184
- vnode.targetAnchor && nextSibling(vnode.targetAnchor);
5185
5213
  }
5186
5214
  }
5187
5215
  return vnode.anchor && nextSibling(vnode.anchor);
@@ -6132,7 +6160,7 @@ function isMemoSame(cached, memo) {
6132
6160
  }
6133
6161
 
6134
6162
  // Core API ------------------------------------------------------------------
6135
- const version = "3.2.34-beta.1";
6163
+ const version = "3.2.34";
6136
6164
  const _ssrUtils = {
6137
6165
  createComponentInstance,
6138
6166
  setupComponent,
@@ -480,7 +480,7 @@ export declare type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D
480
480
 
481
481
  export declare type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
482
482
 
483
- declare type ComponentProvideOptions = ObjectProvideOptions | Function;
483
+ export declare type ComponentProvideOptions = ObjectProvideOptions | Function;
484
484
 
485
485
  export declare type ComponentPublicInstance<P = {}, // props type extracted from props option
486
486
  B = {}, // raw bindings returned from setup()
@@ -657,13 +657,13 @@ export declare type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D
657
657
 
658
658
  export declare function defineComponent<Props, RawBindings = object>(setup: (props: Readonly<Props>, ctx: SetupContext) => RawBindings | RenderFunction): DefineComponent<Props, RawBindings>;
659
659
 
660
- export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Options extends {} = {}>(options: Options & ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide, Options>;
660
+ export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Options extends ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide> = ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>>(options: Options & ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide, Options>;
661
661
 
662
- export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Options extends {} = {}>(options: Options & ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>): DefineComponent<Readonly<{
662
+ export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Options extends ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide> = ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>>(options: Options & ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>): DefineComponent<Readonly<{
663
663
  [key in PropNames]?: any;
664
664
  }>, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide, Options>;
665
665
 
666
- export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Options extends {} = {}>(options: Options & ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide, Options>;
666
+ export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Options extends ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide> = ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>>(options: Options & ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, Provide, Options>;
667
667
 
668
668
  /**
669
669
  * Vue `<script setup>` compiler macro for declaring a component's emitted
@@ -2404,7 +2404,10 @@ const KeepAliveImpl = {
2404
2404
  // if the internal renderer is not registered, it indicates that this is server-side rendering,
2405
2405
  // for KeepAlive, we just need to render its children
2406
2406
  if (!sharedContext.renderer) {
2407
- return slots.default;
2407
+ return () => {
2408
+ const children = slots.default && slots.default();
2409
+ return children && children.length === 1 ? children[0] : children;
2410
+ };
2408
2411
  }
2409
2412
  const cache = new Map();
2410
2413
  const keys = new Set();
@@ -4548,7 +4551,7 @@ const isComment = (node) => node.nodeType === 8 /* COMMENT */;
4548
4551
  // Hydration also depends on some renderer internal logic which needs to be
4549
4552
  // passed in via arguments.
4550
4553
  function createHydrationFunctions(rendererInternals) {
4551
- const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
4554
+ const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
4552
4555
  const hydrate = (vnode, container) => {
4553
4556
  if (!container.hasChildNodes()) {
4554
4557
  (process.env.NODE_ENV !== 'production') &&
@@ -4580,7 +4583,15 @@ function createHydrationFunctions(rendererInternals) {
4580
4583
  switch (type) {
4581
4584
  case Text:
4582
4585
  if (domType !== 3 /* TEXT */) {
4583
- nextNode = onMismatch();
4586
+ // #5728 empty text node inside a slot can cause hydration failure
4587
+ // because the server rendered HTML won't contain a text node
4588
+ if (vnode.children === '') {
4589
+ insert((vnode.el = createText('')), node.parentElement, node);
4590
+ nextNode = node;
4591
+ }
4592
+ else {
4593
+ nextNode = onMismatch();
4594
+ }
4584
4595
  }
4585
4596
  else {
4586
4597
  if (node.data !== vnode.children) {
@@ -4655,6 +4666,12 @@ function createHydrationFunctions(rendererInternals) {
4655
4666
  nextNode = isFragmentStart
4656
4667
  ? locateClosingAsyncAnchor(node)
4657
4668
  : nextSibling(node);
4669
+ // #4293 teleport as component root
4670
+ if (nextNode &&
4671
+ isComment(nextNode) &&
4672
+ nextNode.data === 'teleport end') {
4673
+ nextNode = nextSibling(nextNode);
4674
+ }
4658
4675
  // #3787
4659
4676
  // if component is async, it may get moved / unmounted before its
4660
4677
  // inner component is loaded, so we need to give it a placeholder
@@ -5362,8 +5379,10 @@ function baseCreateRenderer(options, createHydrationFns) {
5362
5379
  const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
5363
5380
  const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
5364
5381
  let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
5365
- if ((process.env.NODE_ENV !== 'production') && isHmrUpdating) {
5366
- // HMR updated, force full diff
5382
+ if ((process.env.NODE_ENV !== 'production') &&
5383
+ // #5523 dev root fragment may inherit directives
5384
+ (isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
5385
+ // HMR updated / Dev root fragment (w/ comments), force full diff
5367
5386
  patchFlag = 0;
5368
5387
  optimized = false;
5369
5388
  dynamicChildren = null;
@@ -5385,8 +5404,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5385
5404
  else {
5386
5405
  if (patchFlag > 0 &&
5387
5406
  patchFlag & 64 /* STABLE_FRAGMENT */ &&
5388
- // #5523 dev root fragment may inherit directives so always force update
5389
- !((process.env.NODE_ENV !== 'production') && patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) &&
5390
5407
  dynamicChildren &&
5391
5408
  // #2715 the previous fragment could've been a BAILed one as a result
5392
5409
  // of renderSlot() with no valid children
@@ -6477,10 +6494,23 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
6477
6494
  }
6478
6495
  else {
6479
6496
  vnode.anchor = nextSibling(node);
6480
- vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6497
+ // lookahead until we find the target anchor
6498
+ // we cannot rely on return value of hydrateChildren() because there
6499
+ // could be nested teleports
6500
+ let targetAnchor = targetNode;
6501
+ while (targetAnchor) {
6502
+ targetAnchor = nextSibling(targetAnchor);
6503
+ if (targetAnchor &&
6504
+ targetAnchor.nodeType === 8 &&
6505
+ targetAnchor.data === 'teleport anchor') {
6506
+ vnode.targetAnchor = targetAnchor;
6507
+ target._lpa =
6508
+ vnode.targetAnchor && nextSibling(vnode.targetAnchor);
6509
+ break;
6510
+ }
6511
+ }
6512
+ hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6481
6513
  }
6482
- target._lpa =
6483
- vnode.targetAnchor && nextSibling(vnode.targetAnchor);
6484
6514
  }
6485
6515
  }
6486
6516
  return vnode.anchor && nextSibling(vnode.anchor);
@@ -7794,7 +7824,7 @@ function isMemoSame(cached, memo) {
7794
7824
  }
7795
7825
 
7796
7826
  // Core API ------------------------------------------------------------------
7797
- const version = "3.2.34-beta.1";
7827
+ const version = "3.2.34";
7798
7828
  const _ssrUtils = {
7799
7829
  createComponentInstance,
7800
7830
  setupComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.2.34-beta.1",
3
+ "version": "3.2.34",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.2.34-beta.1",
36
- "@vue/reactivity": "3.2.34-beta.1"
35
+ "@vue/shared": "3.2.34",
36
+ "@vue/reactivity": "3.2.34"
37
37
  }
38
38
  }