@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.
@@ -428,8 +428,17 @@ function warn(msg, ...args) {
428
428
  let activeEffectScope;
429
429
  class EffectScope {
430
430
  constructor(detached = false) {
431
+ /**
432
+ * @internal
433
+ */
431
434
  this.active = true;
435
+ /**
436
+ * @internal
437
+ */
432
438
  this.effects = [];
439
+ /**
440
+ * @internal
441
+ */
433
442
  this.cleanups = [];
434
443
  if (!detached && activeEffectScope) {
435
444
  this.parent = activeEffectScope;
@@ -439,21 +448,30 @@ class EffectScope {
439
448
  }
440
449
  run(fn) {
441
450
  if (this.active) {
451
+ const currentEffectScope = activeEffectScope;
442
452
  try {
443
453
  activeEffectScope = this;
444
454
  return fn();
445
455
  }
446
456
  finally {
447
- activeEffectScope = this.parent;
457
+ activeEffectScope = currentEffectScope;
448
458
  }
449
459
  }
450
460
  else if ((process.env.NODE_ENV !== 'production')) {
451
461
  warn(`cannot run an inactive effect scope.`);
452
462
  }
453
463
  }
464
+ /**
465
+ * This should only be called on non-detached scopes
466
+ * @internal
467
+ */
454
468
  on() {
455
469
  activeEffectScope = this;
456
470
  }
471
+ /**
472
+ * This should only be called on non-detached scopes
473
+ * @internal
474
+ */
457
475
  off() {
458
476
  activeEffectScope = this.parent;
459
477
  }
@@ -678,9 +696,7 @@ function trackEffects(dep, debuggerEventExtraInfo) {
678
696
  dep.add(activeEffect);
679
697
  activeEffect.deps.push(dep);
680
698
  if ((process.env.NODE_ENV !== 'production') && activeEffect.onTrack) {
681
- activeEffect.onTrack(Object.assign({
682
- effect: activeEffect
683
- }, debuggerEventExtraInfo));
699
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
684
700
  }
685
701
  }
686
702
  }
@@ -3740,13 +3756,11 @@ function watchEffect(effect, options) {
3740
3756
  }
3741
3757
  function watchPostEffect(effect, options) {
3742
3758
  return doWatch(effect, null, ((process.env.NODE_ENV !== 'production')
3743
- ? Object.assign(options || {}, { flush: 'post' })
3744
- : { flush: 'post' }));
3759
+ ? Object.assign(Object.assign({}, options), { flush: 'post' }) : { flush: 'post' }));
3745
3760
  }
3746
3761
  function watchSyncEffect(effect, options) {
3747
3762
  return doWatch(effect, null, ((process.env.NODE_ENV !== 'production')
3748
- ? Object.assign(options || {}, { flush: 'sync' })
3749
- : { flush: 'sync' }));
3763
+ ? Object.assign(Object.assign({}, options), { flush: 'sync' }) : { flush: 'sync' }));
3750
3764
  }
3751
3765
  // initial value for watchers to trigger on undefined initial values
3752
3766
  const INITIAL_WATCHER_VALUE = {};
@@ -4074,7 +4088,9 @@ const BaseTransitionImpl = {
4074
4088
  // check mode
4075
4089
  if ((process.env.NODE_ENV !== 'production') &&
4076
4090
  mode &&
4077
- mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
4091
+ mode !== 'in-out' &&
4092
+ mode !== 'out-in' &&
4093
+ mode !== 'default') {
4078
4094
  warn$1(`invalid <transition> mode: ${mode}`);
4079
4095
  }
4080
4096
  // at this point children has a guaranteed length of 1.
@@ -4304,20 +4320,24 @@ function setTransitionHooks(vnode, hooks) {
4304
4320
  vnode.transition = hooks;
4305
4321
  }
4306
4322
  }
4307
- function getTransitionRawChildren(children, keepComment = false) {
4323
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4308
4324
  let ret = [];
4309
4325
  let keyedFragmentCount = 0;
4310
4326
  for (let i = 0; i < children.length; i++) {
4311
- const child = children[i];
4327
+ let child = children[i];
4328
+ // #5360 inherit parent key in case of <template v-for>
4329
+ const key = parentKey == null
4330
+ ? child.key
4331
+ : String(parentKey) + String(child.key != null ? child.key : i);
4312
4332
  // handle fragment children case, e.g. v-for
4313
4333
  if (child.type === Fragment) {
4314
4334
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
4315
4335
  keyedFragmentCount++;
4316
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
4336
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
4317
4337
  }
4318
4338
  // comment placeholders should be skipped, e.g. v-if
4319
4339
  else if (keepComment || child.type !== Comment) {
4320
- ret.push(child);
4340
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
4321
4341
  }
4322
4342
  }
4323
4343
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -5382,6 +5402,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5382
5402
  const propsToUpdate = instance.vnode.dynamicProps;
5383
5403
  for (let i = 0; i < propsToUpdate.length; i++) {
5384
5404
  let key = propsToUpdate[i];
5405
+ // skip if the prop key is a declared emit event listener
5406
+ if (isEmitListener(instance.emitsOptions, key)) {
5407
+ continue;
5408
+ }
5385
5409
  // PROPS flag guarantees rawProps to be non-null
5386
5410
  const value = rawProps[key];
5387
5411
  if (options) {
@@ -5969,7 +5993,8 @@ function withDirectives(vnode, directives) {
5969
5993
  (process.env.NODE_ENV !== 'production') && warn$1(`withDirectives can only be used inside render functions.`);
5970
5994
  return vnode;
5971
5995
  }
5972
- const instance = internalInstance.proxy;
5996
+ const instance = getExposeProxy(internalInstance) ||
5997
+ internalInstance.proxy;
5973
5998
  const bindings = vnode.dirs || (vnode.dirs = []);
5974
5999
  for (let i = 0; i < directives.length; i++) {
5975
6000
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -6089,7 +6114,7 @@ function createCompatVue(createApp, createSingletonApp) {
6089
6114
  return vm;
6090
6115
  }
6091
6116
  }
6092
- Vue.version = `2.6.14-compat:${"3.2.31"}`;
6117
+ Vue.version = `2.6.14-compat:${"3.2.32"}`;
6093
6118
  Vue.config = singletonApp.config;
6094
6119
  Vue.use = (p, ...options) => {
6095
6120
  if (p && isFunction(p.install)) {
@@ -6518,6 +6543,9 @@ function createAppContext() {
6518
6543
  let uid = 0;
6519
6544
  function createAppAPI(render, hydrate) {
6520
6545
  return function createApp(rootComponent, rootProps = null) {
6546
+ if (!isFunction(rootComponent)) {
6547
+ rootComponent = Object.assign({}, rootComponent);
6548
+ }
6521
6549
  if (rootProps != null && !isObject(rootProps)) {
6522
6550
  (process.env.NODE_ENV !== 'production') && warn$1(`root props passed to app.mount() must be an object.`);
6523
6551
  rootProps = null;
@@ -6720,6 +6748,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6720
6748
  if (!isArray(existing)) {
6721
6749
  if (_isString) {
6722
6750
  refs[ref] = [refValue];
6751
+ if (hasOwn(setupState, ref)) {
6752
+ setupState[ref] = refs[ref];
6753
+ }
6723
6754
  }
6724
6755
  else {
6725
6756
  ref.value = [refValue];
@@ -7096,7 +7127,7 @@ function startMeasure(instance, type) {
7096
7127
  perf.mark(`vue-${type}-${instance.uid}`);
7097
7128
  }
7098
7129
  if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
7099
- devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
7130
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
7100
7131
  }
7101
7132
  }
7102
7133
  function endMeasure(instance, type) {
@@ -7109,7 +7140,7 @@ function endMeasure(instance, type) {
7109
7140
  perf.clearMarks(endTag);
7110
7141
  }
7111
7142
  if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
7112
- devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
7143
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
7113
7144
  }
7114
7145
  }
7115
7146
  function isSupported() {
@@ -10169,9 +10200,10 @@ const PublicInstanceProxyHandlers = {
10169
10200
  },
10170
10201
  defineProperty(target, key, descriptor) {
10171
10202
  if (descriptor.get != null) {
10172
- this.set(target, key, descriptor.get(), null);
10203
+ // invalidate key cache of a getter based property #5417
10204
+ target.$.accessCache[key] = 0;
10173
10205
  }
10174
- else if (descriptor.value != null) {
10206
+ else if (hasOwn(descriptor, 'value')) {
10175
10207
  this.set(target, key, descriptor.value, null);
10176
10208
  }
10177
10209
  return Reflect.defineProperty(target, key, descriptor);
@@ -11089,7 +11121,7 @@ function isMemoSame(cached, memo) {
11089
11121
  }
11090
11122
 
11091
11123
  // Core API ------------------------------------------------------------------
11092
- const version = "3.2.31";
11124
+ const version = "3.2.32";
11093
11125
  const _ssrUtils = {
11094
11126
  createComponentInstance,
11095
11127
  setupComponent,
@@ -430,8 +430,17 @@ var Vue = (function () {
430
430
  let activeEffectScope;
431
431
  class EffectScope {
432
432
  constructor(detached = false) {
433
+ /**
434
+ * @internal
435
+ */
433
436
  this.active = true;
437
+ /**
438
+ * @internal
439
+ */
434
440
  this.effects = [];
441
+ /**
442
+ * @internal
443
+ */
435
444
  this.cleanups = [];
436
445
  if (!detached && activeEffectScope) {
437
446
  this.parent = activeEffectScope;
@@ -441,21 +450,30 @@ var Vue = (function () {
441
450
  }
442
451
  run(fn) {
443
452
  if (this.active) {
453
+ const currentEffectScope = activeEffectScope;
444
454
  try {
445
455
  activeEffectScope = this;
446
456
  return fn();
447
457
  }
448
458
  finally {
449
- activeEffectScope = this.parent;
459
+ activeEffectScope = currentEffectScope;
450
460
  }
451
461
  }
452
462
  else {
453
463
  warn(`cannot run an inactive effect scope.`);
454
464
  }
455
465
  }
466
+ /**
467
+ * This should only be called on non-detached scopes
468
+ * @internal
469
+ */
456
470
  on() {
457
471
  activeEffectScope = this;
458
472
  }
473
+ /**
474
+ * This should only be called on non-detached scopes
475
+ * @internal
476
+ */
459
477
  off() {
460
478
  activeEffectScope = this.parent;
461
479
  }
@@ -679,9 +697,7 @@ var Vue = (function () {
679
697
  dep.add(activeEffect);
680
698
  activeEffect.deps.push(dep);
681
699
  if (activeEffect.onTrack) {
682
- activeEffect.onTrack(Object.assign({
683
- effect: activeEffect
684
- }, debuggerEventExtraInfo));
700
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
685
701
  }
686
702
  }
687
703
  }
@@ -3714,12 +3730,10 @@ var Vue = (function () {
3714
3730
  return doWatch(effect, null, options);
3715
3731
  }
3716
3732
  function watchPostEffect(effect, options) {
3717
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'post' })
3718
- ));
3733
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'post' }) ));
3719
3734
  }
3720
3735
  function watchSyncEffect(effect, options) {
3721
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'sync' })
3722
- ));
3736
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'sync' }) ));
3723
3737
  }
3724
3738
  // initial value for watchers to trigger on undefined initial values
3725
3739
  const INITIAL_WATCHER_VALUE = {};
@@ -4029,7 +4043,9 @@ var Vue = (function () {
4029
4043
  const { mode } = rawProps;
4030
4044
  // check mode
4031
4045
  if (mode &&
4032
- mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
4046
+ mode !== 'in-out' &&
4047
+ mode !== 'out-in' &&
4048
+ mode !== 'default') {
4033
4049
  warn$1(`invalid <transition> mode: ${mode}`);
4034
4050
  }
4035
4051
  // at this point children has a guaranteed length of 1.
@@ -4259,20 +4275,24 @@ var Vue = (function () {
4259
4275
  vnode.transition = hooks;
4260
4276
  }
4261
4277
  }
4262
- function getTransitionRawChildren(children, keepComment = false) {
4278
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4263
4279
  let ret = [];
4264
4280
  let keyedFragmentCount = 0;
4265
4281
  for (let i = 0; i < children.length; i++) {
4266
- const child = children[i];
4282
+ let child = children[i];
4283
+ // #5360 inherit parent key in case of <template v-for>
4284
+ const key = parentKey == null
4285
+ ? child.key
4286
+ : String(parentKey) + String(child.key != null ? child.key : i);
4267
4287
  // handle fragment children case, e.g. v-for
4268
4288
  if (child.type === Fragment) {
4269
4289
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
4270
4290
  keyedFragmentCount++;
4271
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
4291
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
4272
4292
  }
4273
4293
  // comment placeholders should be skipped, e.g. v-if
4274
4294
  else if (keepComment || child.type !== Comment) {
4275
- ret.push(child);
4295
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
4276
4296
  }
4277
4297
  }
4278
4298
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -5330,6 +5350,10 @@ var Vue = (function () {
5330
5350
  const propsToUpdate = instance.vnode.dynamicProps;
5331
5351
  for (let i = 0; i < propsToUpdate.length; i++) {
5332
5352
  let key = propsToUpdate[i];
5353
+ // skip if the prop key is a declared emit event listener
5354
+ if (isEmitListener(instance.emitsOptions, key)) {
5355
+ continue;
5356
+ }
5333
5357
  // PROPS flag guarantees rawProps to be non-null
5334
5358
  const value = rawProps[key];
5335
5359
  if (options) {
@@ -5915,7 +5939,8 @@ var Vue = (function () {
5915
5939
  warn$1(`withDirectives can only be used inside render functions.`);
5916
5940
  return vnode;
5917
5941
  }
5918
- const instance = internalInstance.proxy;
5942
+ const instance = getExposeProxy(internalInstance) ||
5943
+ internalInstance.proxy;
5919
5944
  const bindings = vnode.dirs || (vnode.dirs = []);
5920
5945
  for (let i = 0; i < directives.length; i++) {
5921
5946
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -6035,7 +6060,7 @@ var Vue = (function () {
6035
6060
  return vm;
6036
6061
  }
6037
6062
  }
6038
- Vue.version = `2.6.14-compat:${"3.2.31"}`;
6063
+ Vue.version = `2.6.14-compat:${"3.2.32"}`;
6039
6064
  Vue.config = singletonApp.config;
6040
6065
  Vue.use = (p, ...options) => {
6041
6066
  if (p && isFunction(p.install)) {
@@ -6462,6 +6487,9 @@ var Vue = (function () {
6462
6487
  let uid = 0;
6463
6488
  function createAppAPI(render, hydrate) {
6464
6489
  return function createApp(rootComponent, rootProps = null) {
6490
+ if (!isFunction(rootComponent)) {
6491
+ rootComponent = Object.assign({}, rootComponent);
6492
+ }
6465
6493
  if (rootProps != null && !isObject(rootProps)) {
6466
6494
  warn$1(`root props passed to app.mount() must be an object.`);
6467
6495
  rootProps = null;
@@ -6661,6 +6689,9 @@ var Vue = (function () {
6661
6689
  if (!isArray(existing)) {
6662
6690
  if (_isString) {
6663
6691
  refs[ref] = [refValue];
6692
+ if (hasOwn(setupState, ref)) {
6693
+ setupState[ref] = refs[ref];
6694
+ }
6664
6695
  }
6665
6696
  else {
6666
6697
  ref.value = [refValue];
@@ -7033,7 +7064,7 @@ var Vue = (function () {
7033
7064
  perf.mark(`vue-${type}-${instance.uid}`);
7034
7065
  }
7035
7066
  {
7036
- devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
7067
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
7037
7068
  }
7038
7069
  }
7039
7070
  function endMeasure(instance, type) {
@@ -7046,7 +7077,7 @@ var Vue = (function () {
7046
7077
  perf.clearMarks(endTag);
7047
7078
  }
7048
7079
  {
7049
- devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
7080
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
7050
7081
  }
7051
7082
  }
7052
7083
  function isSupported() {
@@ -10055,9 +10086,10 @@ var Vue = (function () {
10055
10086
  },
10056
10087
  defineProperty(target, key, descriptor) {
10057
10088
  if (descriptor.get != null) {
10058
- this.set(target, key, descriptor.get(), null);
10089
+ // invalidate key cache of a getter based property #5417
10090
+ target.$.accessCache[key] = 0;
10059
10091
  }
10060
- else if (descriptor.value != null) {
10092
+ else if (hasOwn(descriptor, 'value')) {
10061
10093
  this.set(target, key, descriptor.value, null);
10062
10094
  }
10063
10095
  return Reflect.defineProperty(target, key, descriptor);
@@ -10946,7 +10978,7 @@ var Vue = (function () {
10946
10978
  }
10947
10979
 
10948
10980
  // Core API ------------------------------------------------------------------
10949
- const version = "3.2.31";
10981
+ const version = "3.2.32";
10950
10982
  /**
10951
10983
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10952
10984
  * @internal