@vue/compat 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.
@@ -349,8 +349,17 @@ function warn(msg, ...args) {
349
349
  let activeEffectScope;
350
350
  class EffectScope {
351
351
  constructor(detached = false) {
352
+ /**
353
+ * @internal
354
+ */
352
355
  this.active = true;
356
+ /**
357
+ * @internal
358
+ */
353
359
  this.effects = [];
360
+ /**
361
+ * @internal
362
+ */
354
363
  this.cleanups = [];
355
364
  if (!detached && activeEffectScope) {
356
365
  this.parent = activeEffectScope;
@@ -360,21 +369,30 @@ class EffectScope {
360
369
  }
361
370
  run(fn) {
362
371
  if (this.active) {
372
+ const currentEffectScope = activeEffectScope;
363
373
  try {
364
374
  activeEffectScope = this;
365
375
  return fn();
366
376
  }
367
377
  finally {
368
- activeEffectScope = this.parent;
378
+ activeEffectScope = currentEffectScope;
369
379
  }
370
380
  }
371
381
  else if ((process.env.NODE_ENV !== 'production')) {
372
382
  warn(`cannot run an inactive effect scope.`);
373
383
  }
374
384
  }
385
+ /**
386
+ * This should only be called on non-detached scopes
387
+ * @internal
388
+ */
375
389
  on() {
376
390
  activeEffectScope = this;
377
391
  }
392
+ /**
393
+ * This should only be called on non-detached scopes
394
+ * @internal
395
+ */
378
396
  off() {
379
397
  activeEffectScope = this.parent;
380
398
  }
@@ -599,9 +617,7 @@ function trackEffects(dep, debuggerEventExtraInfo) {
599
617
  dep.add(activeEffect);
600
618
  activeEffect.deps.push(dep);
601
619
  if ((process.env.NODE_ENV !== 'production') && activeEffect.onTrack) {
602
- activeEffect.onTrack(Object.assign({
603
- effect: activeEffect
604
- }, debuggerEventExtraInfo));
620
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
605
621
  }
606
622
  }
607
623
  }
@@ -3661,13 +3677,11 @@ function watchEffect(effect, options) {
3661
3677
  }
3662
3678
  function watchPostEffect(effect, options) {
3663
3679
  return doWatch(effect, null, ((process.env.NODE_ENV !== 'production')
3664
- ? Object.assign(options || {}, { flush: 'post' })
3665
- : { flush: 'post' }));
3680
+ ? Object.assign(Object.assign({}, options), { flush: 'post' }) : { flush: 'post' }));
3666
3681
  }
3667
3682
  function watchSyncEffect(effect, options) {
3668
3683
  return doWatch(effect, null, ((process.env.NODE_ENV !== 'production')
3669
- ? Object.assign(options || {}, { flush: 'sync' })
3670
- : { flush: 'sync' }));
3684
+ ? Object.assign(Object.assign({}, options), { flush: 'sync' }) : { flush: 'sync' }));
3671
3685
  }
3672
3686
  // initial value for watchers to trigger on undefined initial values
3673
3687
  const INITIAL_WATCHER_VALUE = {};
@@ -3995,7 +4009,9 @@ const BaseTransitionImpl = {
3995
4009
  // check mode
3996
4010
  if ((process.env.NODE_ENV !== 'production') &&
3997
4011
  mode &&
3998
- mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
4012
+ mode !== 'in-out' &&
4013
+ mode !== 'out-in' &&
4014
+ mode !== 'default') {
3999
4015
  warn$1(`invalid <transition> mode: ${mode}`);
4000
4016
  }
4001
4017
  // at this point children has a guaranteed length of 1.
@@ -4225,20 +4241,24 @@ function setTransitionHooks(vnode, hooks) {
4225
4241
  vnode.transition = hooks;
4226
4242
  }
4227
4243
  }
4228
- function getTransitionRawChildren(children, keepComment = false) {
4244
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4229
4245
  let ret = [];
4230
4246
  let keyedFragmentCount = 0;
4231
4247
  for (let i = 0; i < children.length; i++) {
4232
- const child = children[i];
4248
+ let child = children[i];
4249
+ // #5360 inherit parent key in case of <template v-for>
4250
+ const key = parentKey == null
4251
+ ? child.key
4252
+ : String(parentKey) + String(child.key != null ? child.key : i);
4233
4253
  // handle fragment children case, e.g. v-for
4234
4254
  if (child.type === Fragment) {
4235
4255
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
4236
4256
  keyedFragmentCount++;
4237
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
4257
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
4238
4258
  }
4239
4259
  // comment placeholders should be skipped, e.g. v-if
4240
4260
  else if (keepComment || child.type !== Comment) {
4241
- ret.push(child);
4261
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
4242
4262
  }
4243
4263
  }
4244
4264
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -5303,6 +5323,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5303
5323
  const propsToUpdate = instance.vnode.dynamicProps;
5304
5324
  for (let i = 0; i < propsToUpdate.length; i++) {
5305
5325
  let key = propsToUpdate[i];
5326
+ // skip if the prop key is a declared emit event listener
5327
+ if (isEmitListener(instance.emitsOptions, key)) {
5328
+ continue;
5329
+ }
5306
5330
  // PROPS flag guarantees rawProps to be non-null
5307
5331
  const value = rawProps[key];
5308
5332
  if (options) {
@@ -5890,7 +5914,8 @@ function withDirectives(vnode, directives) {
5890
5914
  (process.env.NODE_ENV !== 'production') && warn$1(`withDirectives can only be used inside render functions.`);
5891
5915
  return vnode;
5892
5916
  }
5893
- const instance = internalInstance.proxy;
5917
+ const instance = getExposeProxy(internalInstance) ||
5918
+ internalInstance.proxy;
5894
5919
  const bindings = vnode.dirs || (vnode.dirs = []);
5895
5920
  for (let i = 0; i < directives.length; i++) {
5896
5921
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -6010,7 +6035,7 @@ function createCompatVue(createApp, createSingletonApp) {
6010
6035
  return vm;
6011
6036
  }
6012
6037
  }
6013
- Vue.version = `2.6.14-compat:${"3.2.31"}`;
6038
+ Vue.version = `2.6.14-compat:${"3.2.32"}`;
6014
6039
  Vue.config = singletonApp.config;
6015
6040
  Vue.use = (p, ...options) => {
6016
6041
  if (p && isFunction(p.install)) {
@@ -6439,6 +6464,9 @@ function createAppContext() {
6439
6464
  let uid = 0;
6440
6465
  function createAppAPI(render, hydrate) {
6441
6466
  return function createApp(rootComponent, rootProps = null) {
6467
+ if (!isFunction(rootComponent)) {
6468
+ rootComponent = Object.assign({}, rootComponent);
6469
+ }
6442
6470
  if (rootProps != null && !isObject(rootProps)) {
6443
6471
  (process.env.NODE_ENV !== 'production') && warn$1(`root props passed to app.mount() must be an object.`);
6444
6472
  rootProps = null;
@@ -6641,6 +6669,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6641
6669
  if (!isArray(existing)) {
6642
6670
  if (_isString) {
6643
6671
  refs[ref] = [refValue];
6672
+ if (hasOwn(setupState, ref)) {
6673
+ setupState[ref] = refs[ref];
6674
+ }
6644
6675
  }
6645
6676
  else {
6646
6677
  ref.value = [refValue];
@@ -7017,7 +7048,7 @@ function startMeasure(instance, type) {
7017
7048
  perf.mark(`vue-${type}-${instance.uid}`);
7018
7049
  }
7019
7050
  if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
7020
- devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
7051
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
7021
7052
  }
7022
7053
  }
7023
7054
  function endMeasure(instance, type) {
@@ -7030,7 +7061,7 @@ function endMeasure(instance, type) {
7030
7061
  perf.clearMarks(endTag);
7031
7062
  }
7032
7063
  if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
7033
- devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
7064
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
7034
7065
  }
7035
7066
  }
7036
7067
  function isSupported() {
@@ -10090,9 +10121,10 @@ const PublicInstanceProxyHandlers = {
10090
10121
  },
10091
10122
  defineProperty(target, key, descriptor) {
10092
10123
  if (descriptor.get != null) {
10093
- this.set(target, key, descriptor.get(), null);
10124
+ // invalidate key cache of a getter based property #5417
10125
+ target.$.accessCache[key] = 0;
10094
10126
  }
10095
- else if (descriptor.value != null) {
10127
+ else if (hasOwn(descriptor, 'value')) {
10096
10128
  this.set(target, key, descriptor.value, null);
10097
10129
  }
10098
10130
  return Reflect.defineProperty(target, key, descriptor);
@@ -11010,7 +11042,7 @@ function isMemoSame(cached, memo) {
11010
11042
  }
11011
11043
 
11012
11044
  // Core API ------------------------------------------------------------------
11013
- const version = "3.2.31";
11045
+ const version = "3.2.32";
11014
11046
  const _ssrUtils = {
11015
11047
  createComponentInstance,
11016
11048
  setupComponent,
@@ -351,8 +351,17 @@ var Vue = (function () {
351
351
  let activeEffectScope;
352
352
  class EffectScope {
353
353
  constructor(detached = false) {
354
+ /**
355
+ * @internal
356
+ */
354
357
  this.active = true;
358
+ /**
359
+ * @internal
360
+ */
355
361
  this.effects = [];
362
+ /**
363
+ * @internal
364
+ */
356
365
  this.cleanups = [];
357
366
  if (!detached && activeEffectScope) {
358
367
  this.parent = activeEffectScope;
@@ -362,21 +371,30 @@ var Vue = (function () {
362
371
  }
363
372
  run(fn) {
364
373
  if (this.active) {
374
+ const currentEffectScope = activeEffectScope;
365
375
  try {
366
376
  activeEffectScope = this;
367
377
  return fn();
368
378
  }
369
379
  finally {
370
- activeEffectScope = this.parent;
380
+ activeEffectScope = currentEffectScope;
371
381
  }
372
382
  }
373
383
  else {
374
384
  warn(`cannot run an inactive effect scope.`);
375
385
  }
376
386
  }
387
+ /**
388
+ * This should only be called on non-detached scopes
389
+ * @internal
390
+ */
377
391
  on() {
378
392
  activeEffectScope = this;
379
393
  }
394
+ /**
395
+ * This should only be called on non-detached scopes
396
+ * @internal
397
+ */
380
398
  off() {
381
399
  activeEffectScope = this.parent;
382
400
  }
@@ -600,9 +618,7 @@ var Vue = (function () {
600
618
  dep.add(activeEffect);
601
619
  activeEffect.deps.push(dep);
602
620
  if (activeEffect.onTrack) {
603
- activeEffect.onTrack(Object.assign({
604
- effect: activeEffect
605
- }, debuggerEventExtraInfo));
621
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
606
622
  }
607
623
  }
608
624
  }
@@ -3635,12 +3651,10 @@ var Vue = (function () {
3635
3651
  return doWatch(effect, null, options);
3636
3652
  }
3637
3653
  function watchPostEffect(effect, options) {
3638
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'post' })
3639
- ));
3654
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'post' }) ));
3640
3655
  }
3641
3656
  function watchSyncEffect(effect, options) {
3642
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'sync' })
3643
- ));
3657
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'sync' }) ));
3644
3658
  }
3645
3659
  // initial value for watchers to trigger on undefined initial values
3646
3660
  const INITIAL_WATCHER_VALUE = {};
@@ -3950,7 +3964,9 @@ var Vue = (function () {
3950
3964
  const { mode } = rawProps;
3951
3965
  // check mode
3952
3966
  if (mode &&
3953
- mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3967
+ mode !== 'in-out' &&
3968
+ mode !== 'out-in' &&
3969
+ mode !== 'default') {
3954
3970
  warn$1(`invalid <transition> mode: ${mode}`);
3955
3971
  }
3956
3972
  // at this point children has a guaranteed length of 1.
@@ -4180,20 +4196,24 @@ var Vue = (function () {
4180
4196
  vnode.transition = hooks;
4181
4197
  }
4182
4198
  }
4183
- function getTransitionRawChildren(children, keepComment = false) {
4199
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4184
4200
  let ret = [];
4185
4201
  let keyedFragmentCount = 0;
4186
4202
  for (let i = 0; i < children.length; i++) {
4187
- const child = children[i];
4203
+ let child = children[i];
4204
+ // #5360 inherit parent key in case of <template v-for>
4205
+ const key = parentKey == null
4206
+ ? child.key
4207
+ : String(parentKey) + String(child.key != null ? child.key : i);
4188
4208
  // handle fragment children case, e.g. v-for
4189
4209
  if (child.type === Fragment) {
4190
4210
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
4191
4211
  keyedFragmentCount++;
4192
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
4212
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
4193
4213
  }
4194
4214
  // comment placeholders should be skipped, e.g. v-if
4195
4215
  else if (keepComment || child.type !== Comment) {
4196
- ret.push(child);
4216
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
4197
4217
  }
4198
4218
  }
4199
4219
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -5251,6 +5271,10 @@ var Vue = (function () {
5251
5271
  const propsToUpdate = instance.vnode.dynamicProps;
5252
5272
  for (let i = 0; i < propsToUpdate.length; i++) {
5253
5273
  let key = propsToUpdate[i];
5274
+ // skip if the prop key is a declared emit event listener
5275
+ if (isEmitListener(instance.emitsOptions, key)) {
5276
+ continue;
5277
+ }
5254
5278
  // PROPS flag guarantees rawProps to be non-null
5255
5279
  const value = rawProps[key];
5256
5280
  if (options) {
@@ -5836,7 +5860,8 @@ var Vue = (function () {
5836
5860
  warn$1(`withDirectives can only be used inside render functions.`);
5837
5861
  return vnode;
5838
5862
  }
5839
- const instance = internalInstance.proxy;
5863
+ const instance = getExposeProxy(internalInstance) ||
5864
+ internalInstance.proxy;
5840
5865
  const bindings = vnode.dirs || (vnode.dirs = []);
5841
5866
  for (let i = 0; i < directives.length; i++) {
5842
5867
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -5956,7 +5981,7 @@ var Vue = (function () {
5956
5981
  return vm;
5957
5982
  }
5958
5983
  }
5959
- Vue.version = `2.6.14-compat:${"3.2.31"}`;
5984
+ Vue.version = `2.6.14-compat:${"3.2.32"}`;
5960
5985
  Vue.config = singletonApp.config;
5961
5986
  Vue.use = (p, ...options) => {
5962
5987
  if (p && isFunction(p.install)) {
@@ -6383,6 +6408,9 @@ var Vue = (function () {
6383
6408
  let uid = 0;
6384
6409
  function createAppAPI(render, hydrate) {
6385
6410
  return function createApp(rootComponent, rootProps = null) {
6411
+ if (!isFunction(rootComponent)) {
6412
+ rootComponent = Object.assign({}, rootComponent);
6413
+ }
6386
6414
  if (rootProps != null && !isObject(rootProps)) {
6387
6415
  warn$1(`root props passed to app.mount() must be an object.`);
6388
6416
  rootProps = null;
@@ -6582,6 +6610,9 @@ var Vue = (function () {
6582
6610
  if (!isArray(existing)) {
6583
6611
  if (_isString) {
6584
6612
  refs[ref] = [refValue];
6613
+ if (hasOwn(setupState, ref)) {
6614
+ setupState[ref] = refs[ref];
6615
+ }
6585
6616
  }
6586
6617
  else {
6587
6618
  ref.value = [refValue];
@@ -6954,7 +6985,7 @@ var Vue = (function () {
6954
6985
  perf.mark(`vue-${type}-${instance.uid}`);
6955
6986
  }
6956
6987
  {
6957
- devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
6988
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
6958
6989
  }
6959
6990
  }
6960
6991
  function endMeasure(instance, type) {
@@ -6967,7 +6998,7 @@ var Vue = (function () {
6967
6998
  perf.clearMarks(endTag);
6968
6999
  }
6969
7000
  {
6970
- devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
7001
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
6971
7002
  }
6972
7003
  }
6973
7004
  function isSupported() {
@@ -9976,9 +10007,10 @@ var Vue = (function () {
9976
10007
  },
9977
10008
  defineProperty(target, key, descriptor) {
9978
10009
  if (descriptor.get != null) {
9979
- this.set(target, key, descriptor.get(), null);
10010
+ // invalidate key cache of a getter based property #5417
10011
+ target.$.accessCache[key] = 0;
9980
10012
  }
9981
- else if (descriptor.value != null) {
10013
+ else if (hasOwn(descriptor, 'value')) {
9982
10014
  this.set(target, key, descriptor.value, null);
9983
10015
  }
9984
10016
  return Reflect.defineProperty(target, key, descriptor);
@@ -10867,7 +10899,7 @@ var Vue = (function () {
10867
10899
  }
10868
10900
 
10869
10901
  // Core API ------------------------------------------------------------------
10870
- const version = "3.2.31";
10902
+ const version = "3.2.32";
10871
10903
  /**
10872
10904
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10873
10905
  * @internal