@vue/runtime-core 3.2.31 → 3.2.32

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.
@@ -1637,12 +1637,10 @@ function watchEffect(effect, options) {
1637
1637
  return doWatch(effect, null, options);
1638
1638
  }
1639
1639
  function watchPostEffect(effect, options) {
1640
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'post' })
1641
- ));
1640
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'post' }) ));
1642
1641
  }
1643
1642
  function watchSyncEffect(effect, options) {
1644
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'sync' })
1645
- ));
1643
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'sync' }) ));
1646
1644
  }
1647
1645
  // initial value for watchers to trigger on undefined initial values
1648
1646
  const INITIAL_WATCHER_VALUE = {};
@@ -1956,7 +1954,9 @@ const BaseTransitionImpl = {
1956
1954
  const { mode } = rawProps;
1957
1955
  // check mode
1958
1956
  if (mode &&
1959
- mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
1957
+ mode !== 'in-out' &&
1958
+ mode !== 'out-in' &&
1959
+ mode !== 'default') {
1960
1960
  warn(`invalid <transition> mode: ${mode}`);
1961
1961
  }
1962
1962
  // at this point children has a guaranteed length of 1.
@@ -2183,20 +2183,24 @@ function setTransitionHooks(vnode, hooks) {
2183
2183
  vnode.transition = hooks;
2184
2184
  }
2185
2185
  }
2186
- function getTransitionRawChildren(children, keepComment = false) {
2186
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2187
2187
  let ret = [];
2188
2188
  let keyedFragmentCount = 0;
2189
2189
  for (let i = 0; i < children.length; i++) {
2190
- const child = children[i];
2190
+ let child = children[i];
2191
+ // #5360 inherit parent key in case of <template v-for>
2192
+ const key = parentKey == null
2193
+ ? child.key
2194
+ : String(parentKey) + String(child.key != null ? child.key : i);
2191
2195
  // handle fragment children case, e.g. v-for
2192
2196
  if (child.type === Fragment) {
2193
2197
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
2194
2198
  keyedFragmentCount++;
2195
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
2199
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
2196
2200
  }
2197
2201
  // comment placeholders should be skipped, e.g. v-if
2198
2202
  else if (keepComment || child.type !== Comment) {
2199
- ret.push(child);
2203
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
2200
2204
  }
2201
2205
  }
2202
2206
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -3162,6 +3166,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3162
3166
  const propsToUpdate = instance.vnode.dynamicProps;
3163
3167
  for (let i = 0; i < propsToUpdate.length; i++) {
3164
3168
  let key = propsToUpdate[i];
3169
+ // skip if the prop key is a declared emit event listener
3170
+ if (isEmitListener(instance.emitsOptions, key)) {
3171
+ continue;
3172
+ }
3165
3173
  // PROPS flag guarantees rawProps to be non-null
3166
3174
  const value = rawProps[key];
3167
3175
  if (options) {
@@ -3686,7 +3694,8 @@ function withDirectives(vnode, directives) {
3686
3694
  warn(`withDirectives can only be used inside render functions.`);
3687
3695
  return vnode;
3688
3696
  }
3689
- const instance = internalInstance.proxy;
3697
+ const instance = getExposeProxy(internalInstance) ||
3698
+ internalInstance.proxy;
3690
3699
  const bindings = vnode.dirs || (vnode.dirs = []);
3691
3700
  for (let i = 0; i < directives.length; i++) {
3692
3701
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -3758,6 +3767,9 @@ function createAppContext() {
3758
3767
  let uid = 0;
3759
3768
  function createAppAPI(render, hydrate) {
3760
3769
  return function createApp(rootComponent, rootProps = null) {
3770
+ if (!shared.isFunction(rootComponent)) {
3771
+ rootComponent = Object.assign({}, rootComponent);
3772
+ }
3761
3773
  if (rootProps != null && !shared.isObject(rootProps)) {
3762
3774
  warn(`root props passed to app.mount() must be an object.`);
3763
3775
  rootProps = null;
@@ -3954,6 +3966,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3954
3966
  if (!shared.isArray(existing)) {
3955
3967
  if (_isString) {
3956
3968
  refs[ref] = [refValue];
3969
+ if (shared.hasOwn(setupState, ref)) {
3970
+ setupState[ref] = refs[ref];
3971
+ }
3957
3972
  }
3958
3973
  else {
3959
3974
  ref.value = [refValue];
@@ -4326,7 +4341,7 @@ function startMeasure(instance, type) {
4326
4341
  perf.mark(`vue-${type}-${instance.uid}`);
4327
4342
  }
4328
4343
  {
4329
- devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
4344
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
4330
4345
  }
4331
4346
  }
4332
4347
  function endMeasure(instance, type) {
@@ -4339,7 +4354,7 @@ function endMeasure(instance, type) {
4339
4354
  perf.clearMarks(endTag);
4340
4355
  }
4341
4356
  {
4342
- devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
4357
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
4343
4358
  }
4344
4359
  }
4345
4360
  function isSupported() {
@@ -6728,9 +6743,10 @@ const PublicInstanceProxyHandlers = {
6728
6743
  },
6729
6744
  defineProperty(target, key, descriptor) {
6730
6745
  if (descriptor.get != null) {
6731
- this.set(target, key, descriptor.get(), null);
6746
+ // invalidate key cache of a getter based property #5417
6747
+ target.$.accessCache[key] = 0;
6732
6748
  }
6733
- else if (descriptor.value != null) {
6749
+ else if (shared.hasOwn(descriptor, 'value')) {
6734
6750
  this.set(target, key, descriptor.value, null);
6735
6751
  }
6736
6752
  return Reflect.defineProperty(target, key, descriptor);
@@ -7617,7 +7633,7 @@ function isMemoSame(cached, memo) {
7617
7633
  }
7618
7634
 
7619
7635
  // Core API ------------------------------------------------------------------
7620
- const version = "3.2.31";
7636
+ const version = "3.2.32";
7621
7637
  const _ssrUtils = {
7622
7638
  createComponentInstance,
7623
7639
  setupComponent,
@@ -1700,20 +1700,24 @@ function setTransitionHooks(vnode, hooks) {
1700
1700
  vnode.transition = hooks;
1701
1701
  }
1702
1702
  }
1703
- function getTransitionRawChildren(children, keepComment = false) {
1703
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1704
1704
  let ret = [];
1705
1705
  let keyedFragmentCount = 0;
1706
1706
  for (let i = 0; i < children.length; i++) {
1707
- const child = children[i];
1707
+ let child = children[i];
1708
+ // #5360 inherit parent key in case of <template v-for>
1709
+ const key = parentKey == null
1710
+ ? child.key
1711
+ : String(parentKey) + String(child.key != null ? child.key : i);
1708
1712
  // handle fragment children case, e.g. v-for
1709
1713
  if (child.type === Fragment) {
1710
1714
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
1711
1715
  keyedFragmentCount++;
1712
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
1716
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
1713
1717
  }
1714
1718
  // comment placeholders should be skipped, e.g. v-if
1715
1719
  else if (keepComment || child.type !== Comment) {
1716
- ret.push(child);
1720
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
1717
1721
  }
1718
1722
  }
1719
1723
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -2557,6 +2561,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
2557
2561
  const propsToUpdate = instance.vnode.dynamicProps;
2558
2562
  for (let i = 0; i < propsToUpdate.length; i++) {
2559
2563
  let key = propsToUpdate[i];
2564
+ // skip if the prop key is a declared emit event listener
2565
+ if (isEmitListener(instance.emitsOptions, key)) {
2566
+ continue;
2567
+ }
2560
2568
  // PROPS flag guarantees rawProps to be non-null
2561
2569
  const value = rawProps[key];
2562
2570
  if (options) {
@@ -2914,7 +2922,8 @@ function withDirectives(vnode, directives) {
2914
2922
  if (internalInstance === null) {
2915
2923
  return vnode;
2916
2924
  }
2917
- const instance = internalInstance.proxy;
2925
+ const instance = getExposeProxy(internalInstance) ||
2926
+ internalInstance.proxy;
2918
2927
  const bindings = vnode.dirs || (vnode.dirs = []);
2919
2928
  for (let i = 0; i < directives.length; i++) {
2920
2929
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -2986,6 +2995,9 @@ function createAppContext() {
2986
2995
  let uid = 0;
2987
2996
  function createAppAPI(render, hydrate) {
2988
2997
  return function createApp(rootComponent, rootProps = null) {
2998
+ if (!shared.isFunction(rootComponent)) {
2999
+ rootComponent = Object.assign({}, rootComponent);
3000
+ }
2989
3001
  if (rootProps != null && !shared.isObject(rootProps)) {
2990
3002
  rootProps = null;
2991
3003
  }
@@ -3125,6 +3137,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3125
3137
  if (!shared.isArray(existing)) {
3126
3138
  if (_isString) {
3127
3139
  refs[ref] = [refValue];
3140
+ if (shared.hasOwn(setupState, ref)) {
3141
+ setupState[ref] = refs[ref];
3142
+ }
3128
3143
  }
3129
3144
  else {
3130
3145
  ref.value = [refValue];
@@ -5555,9 +5570,10 @@ const PublicInstanceProxyHandlers = {
5555
5570
  },
5556
5571
  defineProperty(target, key, descriptor) {
5557
5572
  if (descriptor.get != null) {
5558
- this.set(target, key, descriptor.get(), null);
5573
+ // invalidate key cache of a getter based property #5417
5574
+ target.$.accessCache[key] = 0;
5559
5575
  }
5560
- else if (descriptor.value != null) {
5576
+ else if (shared.hasOwn(descriptor, 'value')) {
5561
5577
  this.set(target, key, descriptor.value, null);
5562
5578
  }
5563
5579
  return Reflect.defineProperty(target, key, descriptor);
@@ -6081,7 +6097,7 @@ function isMemoSame(cached, memo) {
6081
6097
  }
6082
6098
 
6083
6099
  // Core API ------------------------------------------------------------------
6084
- const version = "3.2.31";
6100
+ const version = "3.2.32";
6085
6101
  const _ssrUtils = {
6086
6102
  createComponentInstance,
6087
6103
  setupComponent,
@@ -904,7 +904,7 @@ export declare const getCurrentInstance: () => ComponentInternalInstance | null;
904
904
 
905
905
  export { getCurrentScope }
906
906
 
907
- export declare function getTransitionRawChildren(children: VNode[], keepComment?: boolean): VNode[];
907
+ export declare function getTransitionRawChildren(children: VNode[], keepComment?: boolean, parentKey?: VNode['key']): VNode[];
908
908
 
909
909
  export declare function guardReactiveProps(props: (Data & VNodeProps) | null): (Data & VNodeProps) | null;
910
910
 
@@ -1645,13 +1645,11 @@ function watchEffect(effect, options) {
1645
1645
  }
1646
1646
  function watchPostEffect(effect, options) {
1647
1647
  return doWatch(effect, null, ((process.env.NODE_ENV !== 'production')
1648
- ? Object.assign(options || {}, { flush: 'post' })
1649
- : { flush: 'post' }));
1648
+ ? Object.assign(Object.assign({}, options), { flush: 'post' }) : { flush: 'post' }));
1650
1649
  }
1651
1650
  function watchSyncEffect(effect, options) {
1652
1651
  return doWatch(effect, null, ((process.env.NODE_ENV !== 'production')
1653
- ? Object.assign(options || {}, { flush: 'sync' })
1654
- : { flush: 'sync' }));
1652
+ ? Object.assign(Object.assign({}, options), { flush: 'sync' }) : { flush: 'sync' }));
1655
1653
  }
1656
1654
  // initial value for watchers to trigger on undefined initial values
1657
1655
  const INITIAL_WATCHER_VALUE = {};
@@ -1966,7 +1964,9 @@ const BaseTransitionImpl = {
1966
1964
  // check mode
1967
1965
  if ((process.env.NODE_ENV !== 'production') &&
1968
1966
  mode &&
1969
- mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
1967
+ mode !== 'in-out' &&
1968
+ mode !== 'out-in' &&
1969
+ mode !== 'default') {
1970
1970
  warn(`invalid <transition> mode: ${mode}`);
1971
1971
  }
1972
1972
  // at this point children has a guaranteed length of 1.
@@ -2193,20 +2193,24 @@ function setTransitionHooks(vnode, hooks) {
2193
2193
  vnode.transition = hooks;
2194
2194
  }
2195
2195
  }
2196
- function getTransitionRawChildren(children, keepComment = false) {
2196
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2197
2197
  let ret = [];
2198
2198
  let keyedFragmentCount = 0;
2199
2199
  for (let i = 0; i < children.length; i++) {
2200
- const child = children[i];
2200
+ let child = children[i];
2201
+ // #5360 inherit parent key in case of <template v-for>
2202
+ const key = parentKey == null
2203
+ ? child.key
2204
+ : String(parentKey) + String(child.key != null ? child.key : i);
2201
2205
  // handle fragment children case, e.g. v-for
2202
2206
  if (child.type === Fragment) {
2203
2207
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
2204
2208
  keyedFragmentCount++;
2205
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
2209
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
2206
2210
  }
2207
2211
  // comment placeholders should be skipped, e.g. v-if
2208
2212
  else if (keepComment || child.type !== Comment) {
2209
- ret.push(child);
2213
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
2210
2214
  }
2211
2215
  }
2212
2216
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -3178,6 +3182,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3178
3182
  const propsToUpdate = instance.vnode.dynamicProps;
3179
3183
  for (let i = 0; i < propsToUpdate.length; i++) {
3180
3184
  let key = propsToUpdate[i];
3185
+ // skip if the prop key is a declared emit event listener
3186
+ if (isEmitListener(instance.emitsOptions, key)) {
3187
+ continue;
3188
+ }
3181
3189
  // PROPS flag guarantees rawProps to be non-null
3182
3190
  const value = rawProps[key];
3183
3191
  if (options) {
@@ -3704,7 +3712,8 @@ function withDirectives(vnode, directives) {
3704
3712
  (process.env.NODE_ENV !== 'production') && warn(`withDirectives can only be used inside render functions.`);
3705
3713
  return vnode;
3706
3714
  }
3707
- const instance = internalInstance.proxy;
3715
+ const instance = getExposeProxy(internalInstance) ||
3716
+ internalInstance.proxy;
3708
3717
  const bindings = vnode.dirs || (vnode.dirs = []);
3709
3718
  for (let i = 0; i < directives.length; i++) {
3710
3719
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -3776,6 +3785,9 @@ function createAppContext() {
3776
3785
  let uid = 0;
3777
3786
  function createAppAPI(render, hydrate) {
3778
3787
  return function createApp(rootComponent, rootProps = null) {
3788
+ if (!isFunction(rootComponent)) {
3789
+ rootComponent = Object.assign({}, rootComponent);
3790
+ }
3779
3791
  if (rootProps != null && !isObject(rootProps)) {
3780
3792
  (process.env.NODE_ENV !== 'production') && warn(`root props passed to app.mount() must be an object.`);
3781
3793
  rootProps = null;
@@ -3975,6 +3987,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3975
3987
  if (!isArray(existing)) {
3976
3988
  if (_isString) {
3977
3989
  refs[ref] = [refValue];
3990
+ if (hasOwn(setupState, ref)) {
3991
+ setupState[ref] = refs[ref];
3992
+ }
3978
3993
  }
3979
3994
  else {
3980
3995
  ref.value = [refValue];
@@ -4351,7 +4366,7 @@ function startMeasure(instance, type) {
4351
4366
  perf.mark(`vue-${type}-${instance.uid}`);
4352
4367
  }
4353
4368
  if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
4354
- devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
4369
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
4355
4370
  }
4356
4371
  }
4357
4372
  function endMeasure(instance, type) {
@@ -4364,7 +4379,7 @@ function endMeasure(instance, type) {
4364
4379
  perf.clearMarks(endTag);
4365
4380
  }
4366
4381
  if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
4367
- devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
4382
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
4368
4383
  }
4369
4384
  }
4370
4385
  function isSupported() {
@@ -6804,9 +6819,10 @@ const PublicInstanceProxyHandlers = {
6804
6819
  },
6805
6820
  defineProperty(target, key, descriptor) {
6806
6821
  if (descriptor.get != null) {
6807
- this.set(target, key, descriptor.get(), null);
6822
+ // invalidate key cache of a getter based property #5417
6823
+ target.$.accessCache[key] = 0;
6808
6824
  }
6809
- else if (descriptor.value != null) {
6825
+ else if (hasOwn(descriptor, 'value')) {
6810
6826
  this.set(target, key, descriptor.value, null);
6811
6827
  }
6812
6828
  return Reflect.defineProperty(target, key, descriptor);
@@ -7713,7 +7729,7 @@ function isMemoSame(cached, memo) {
7713
7729
  }
7714
7730
 
7715
7731
  // Core API ------------------------------------------------------------------
7716
- const version = "3.2.31";
7732
+ const version = "3.2.32";
7717
7733
  const _ssrUtils = {
7718
7734
  createComponentInstance,
7719
7735
  setupComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.2.31",
3
+ "version": "3.2.32",
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.31",
36
- "@vue/reactivity": "3.2.31"
35
+ "@vue/shared": "3.2.32",
36
+ "@vue/reactivity": "3.2.32"
37
37
  }
38
38
  }