vue 3.2.29 → 3.2.30

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.
@@ -277,13 +277,15 @@ function looseIndexOf(arr, val) {
277
277
  * @private
278
278
  */
279
279
  const toDisplayString = (val) => {
280
- return val == null
281
- ? ''
282
- : isArray(val) ||
283
- (isObject(val) &&
284
- (val.toString === objectToString || !isFunction(val.toString)))
285
- ? JSON.stringify(val, replacer, 2)
286
- : String(val);
280
+ return isString(val)
281
+ ? val
282
+ : val == null
283
+ ? ''
284
+ : isArray(val) ||
285
+ (isObject(val) &&
286
+ (val.toString === objectToString || !isFunction(val.toString)))
287
+ ? JSON.stringify(val, replacer, 2)
288
+ : String(val);
287
289
  };
288
290
  const replacer = (_key, val) => {
289
291
  // can't use isRef here since @vue/shared has no deps
@@ -357,6 +359,7 @@ const isReservedProp = /*#__PURE__*/ makeMap(
357
359
  'onVnodeBeforeMount,onVnodeMounted,' +
358
360
  'onVnodeBeforeUpdate,onVnodeUpdated,' +
359
361
  'onVnodeBeforeUnmount,onVnodeUnmounted');
362
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
360
363
  const cacheStringFunction = (fn) => {
361
364
  const cache = Object.create(null);
362
365
  return ((str) => {
@@ -422,7 +425,6 @@ function warn(msg, ...args) {
422
425
  }
423
426
 
424
427
  let activeEffectScope;
425
- const effectScopeStack = [];
426
428
  class EffectScope {
427
429
  constructor(detached = false) {
428
430
  this.active = true;
@@ -437,11 +439,11 @@ class EffectScope {
437
439
  run(fn) {
438
440
  if (this.active) {
439
441
  try {
440
- this.on();
442
+ activeEffectScope = this;
441
443
  return fn();
442
444
  }
443
445
  finally {
444
- this.off();
446
+ activeEffectScope = this.parent;
445
447
  }
446
448
  }
447
449
  else {
@@ -449,23 +451,24 @@ class EffectScope {
449
451
  }
450
452
  }
451
453
  on() {
452
- if (this.active) {
453
- effectScopeStack.push(this);
454
- activeEffectScope = this;
455
- }
454
+ activeEffectScope = this;
456
455
  }
457
456
  off() {
458
- if (this.active) {
459
- effectScopeStack.pop();
460
- activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
461
- }
457
+ activeEffectScope = this.parent;
462
458
  }
463
459
  stop(fromParent) {
464
460
  if (this.active) {
465
- this.effects.forEach(e => e.stop());
466
- this.cleanups.forEach(cleanup => cleanup());
461
+ let i, l;
462
+ for (i = 0, l = this.effects.length; i < l; i++) {
463
+ this.effects[i].stop();
464
+ }
465
+ for (i = 0, l = this.cleanups.length; i < l; i++) {
466
+ this.cleanups[i]();
467
+ }
467
468
  if (this.scopes) {
468
- this.scopes.forEach(e => e.stop(true));
469
+ for (i = 0, l = this.scopes.length; i < l; i++) {
470
+ this.scopes[i].stop(true);
471
+ }
469
472
  }
470
473
  // nested scope, dereference from parent to avoid memory leaks
471
474
  if (this.parent && !fromParent) {
@@ -483,8 +486,7 @@ class EffectScope {
483
486
  function effectScope(detached) {
484
487
  return new EffectScope(detached);
485
488
  }
486
- function recordEffectScope(effect, scope) {
487
- scope = scope || activeEffectScope;
489
+ function recordEffectScope(effect, scope = activeEffectScope) {
488
490
  if (scope && scope.active) {
489
491
  scope.effects.push(effect);
490
492
  }
@@ -547,7 +549,6 @@ let trackOpBit = 1;
547
549
  * When recursion depth is greater, fall back to using a full cleanup.
548
550
  */
549
551
  const maxMarkerBits = 30;
550
- const effectStack = [];
551
552
  let activeEffect;
552
553
  const ITERATE_KEY = Symbol('iterate' );
553
554
  const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
@@ -557,35 +558,42 @@ class ReactiveEffect {
557
558
  this.scheduler = scheduler;
558
559
  this.active = true;
559
560
  this.deps = [];
561
+ this.parent = undefined;
560
562
  recordEffectScope(this, scope);
561
563
  }
562
564
  run() {
563
565
  if (!this.active) {
564
566
  return this.fn();
565
567
  }
566
- if (!effectStack.length || !effectStack.includes(this)) {
567
- try {
568
- effectStack.push((activeEffect = this));
569
- enableTracking();
570
- trackOpBit = 1 << ++effectTrackDepth;
571
- if (effectTrackDepth <= maxMarkerBits) {
572
- initDepMarkers(this);
573
- }
574
- else {
575
- cleanupEffect(this);
576
- }
577
- return this.fn();
568
+ let parent = activeEffect;
569
+ let lastShouldTrack = shouldTrack;
570
+ while (parent) {
571
+ if (parent === this) {
572
+ return;
578
573
  }
579
- finally {
580
- if (effectTrackDepth <= maxMarkerBits) {
581
- finalizeDepMarkers(this);
582
- }
583
- trackOpBit = 1 << --effectTrackDepth;
584
- resetTracking();
585
- effectStack.pop();
586
- const n = effectStack.length;
587
- activeEffect = n > 0 ? effectStack[n - 1] : undefined;
574
+ parent = parent.parent;
575
+ }
576
+ try {
577
+ this.parent = activeEffect;
578
+ activeEffect = this;
579
+ shouldTrack = true;
580
+ trackOpBit = 1 << ++effectTrackDepth;
581
+ if (effectTrackDepth <= maxMarkerBits) {
582
+ initDepMarkers(this);
588
583
  }
584
+ else {
585
+ cleanupEffect(this);
586
+ }
587
+ return this.fn();
588
+ }
589
+ finally {
590
+ if (effectTrackDepth <= maxMarkerBits) {
591
+ finalizeDepMarkers(this);
592
+ }
593
+ trackOpBit = 1 << --effectTrackDepth;
594
+ activeEffect = this.parent;
595
+ shouldTrack = lastShouldTrack;
596
+ this.parent = undefined;
589
597
  }
590
598
  }
591
599
  stop() {
@@ -633,32 +641,24 @@ function pauseTracking() {
633
641
  trackStack.push(shouldTrack);
634
642
  shouldTrack = false;
635
643
  }
636
- function enableTracking() {
637
- trackStack.push(shouldTrack);
638
- shouldTrack = true;
639
- }
640
644
  function resetTracking() {
641
645
  const last = trackStack.pop();
642
646
  shouldTrack = last === undefined ? true : last;
643
647
  }
644
648
  function track(target, type, key) {
645
- if (!isTracking()) {
646
- return;
647
- }
648
- let depsMap = targetMap.get(target);
649
- if (!depsMap) {
650
- targetMap.set(target, (depsMap = new Map()));
651
- }
652
- let dep = depsMap.get(key);
653
- if (!dep) {
654
- depsMap.set(key, (dep = createDep()));
649
+ if (shouldTrack && activeEffect) {
650
+ let depsMap = targetMap.get(target);
651
+ if (!depsMap) {
652
+ targetMap.set(target, (depsMap = new Map()));
653
+ }
654
+ let dep = depsMap.get(key);
655
+ if (!dep) {
656
+ depsMap.set(key, (dep = createDep()));
657
+ }
658
+ const eventInfo = { effect: activeEffect, target, type, key }
659
+ ;
660
+ trackEffects(dep, eventInfo);
655
661
  }
656
- const eventInfo = { effect: activeEffect, target, type, key }
657
- ;
658
- trackEffects(dep, eventInfo);
659
- }
660
- function isTracking() {
661
- return shouldTrack && activeEffect !== undefined;
662
662
  }
663
663
  function trackEffects(dep, debuggerEventExtraInfo) {
664
664
  let shouldTrack = false;
@@ -1343,13 +1343,10 @@ const toReactive = (value) => isObject(value) ? reactive(value) : value;
1343
1343
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1344
1344
 
1345
1345
  function trackRefValue(ref) {
1346
- if (isTracking()) {
1346
+ if (shouldTrack && activeEffect) {
1347
1347
  ref = toRaw(ref);
1348
- if (!ref.dep) {
1349
- ref.dep = createDep();
1350
- }
1351
1348
  {
1352
- trackEffects(ref.dep, {
1349
+ trackEffects(ref.dep || (ref.dep = createDep()), {
1353
1350
  target: ref,
1354
1351
  type: "get" /* GET */,
1355
1352
  key: 'value'
@@ -1371,7 +1368,7 @@ function triggerRefValue(ref, newVal) {
1371
1368
  }
1372
1369
  }
1373
1370
  function isRef(r) {
1374
- return Boolean(r && r.__v_isRef === true);
1371
+ return !!(r && r.__v_isRef === true);
1375
1372
  }
1376
1373
  function ref(value) {
1377
1374
  return createRef(value, false);
@@ -5184,7 +5181,6 @@ return withDirectives(h(comp), [
5184
5181
  [bar, this.y]
5185
5182
  ])
5186
5183
  */
5187
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
5188
5184
  function validateDirectiveName(name) {
5189
5185
  if (isBuiltInDirective(name)) {
5190
5186
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -9110,7 +9106,7 @@ function isMemoSame(cached, memo) {
9110
9106
  }
9111
9107
 
9112
9108
  // Core API ------------------------------------------------------------------
9113
- const version = "3.2.29";
9109
+ const version = "3.2.30";
9114
9110
  /**
9115
9111
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9116
9112
  * @internal
@@ -11538,13 +11534,13 @@ const deprecationData = {
11538
11534
  message: `Platform-native elements with "is" prop will no longer be ` +
11539
11535
  `treated as components in Vue 3 unless the "is" value is explicitly ` +
11540
11536
  `prefixed with "vue:".`,
11541
- link: `https://v3.vuejs.org/guide/migration/custom-elements-interop.html`
11537
+ link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
11542
11538
  },
11543
11539
  ["COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */]: {
11544
11540
  message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
11545
11541
  `argument instead. \`v-bind:${key}.sync\` should be changed to ` +
11546
11542
  `\`v-model:${key}\`.`,
11547
- link: `https://v3.vuejs.org/guide/migration/v-model.html`
11543
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
11548
11544
  },
11549
11545
  ["COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */]: {
11550
11546
  message: `.prop modifier for v-bind has been removed and no longer necessary. ` +
@@ -11556,11 +11552,11 @@ const deprecationData = {
11556
11552
  `that appears before v-bind in the case of conflict. ` +
11557
11553
  `To retain 2.x behavior, move v-bind to make it the first attribute. ` +
11558
11554
  `You can also suppress this warning if the usage is intended.`,
11559
- link: `https://v3.vuejs.org/guide/migration/v-bind.html`
11555
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
11560
11556
  },
11561
11557
  ["COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */]: {
11562
11558
  message: `.native modifier for v-on has been removed as is no longer necessary.`,
11563
- link: `https://v3.vuejs.org/guide/migration/v-on-native-modifier-removed.html`
11559
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
11564
11560
  },
11565
11561
  ["COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
11566
11562
  message: `v-if / v-for precedence when used on the same element has changed ` +
@@ -11568,7 +11564,7 @@ const deprecationData = {
11568
11564
  `access to v-for scope variables. It is best to avoid the ambiguity ` +
11569
11565
  `with <template> tags or use a computed property that filters v-for ` +
11570
11566
  `data source.`,
11571
- link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
11567
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
11572
11568
  },
11573
11569
  ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
11574
11570
  message: `<template> with no special directives will render as a native template ` +
@@ -11576,13 +11572,13 @@ const deprecationData = {
11576
11572
  },
11577
11573
  ["COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */]: {
11578
11574
  message: `"inline-template" has been removed in Vue 3.`,
11579
- link: `https://v3.vuejs.org/guide/migration/inline-template-attribute.html`
11575
+ link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
11580
11576
  },
11581
11577
  ["COMPILER_FILTER" /* COMPILER_FILTERS */]: {
11582
11578
  message: `filters have been removed in Vue 3. ` +
11583
11579
  `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
11584
11580
  `Use method calls or computed properties instead.`,
11585
- link: `https://v3.vuejs.org/guide/migration/filters.html`
11581
+ link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
11586
11582
  }
11587
11583
  };
11588
11584
  function getCompatValue(key, context) {
@@ -14586,7 +14582,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
14586
14582
  }
14587
14583
  }
14588
14584
  }
14589
- else {
14585
+ else if (!isBuiltInDirective(name)) {
14590
14586
  // no built-in transform, this is a user custom directive.
14591
14587
  runtimeDirectives.push(prop);
14592
14588
  // custom dirs may use beforeUpdate so they need to force blocks