vue 2.7.13 → 2.7.14

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.7.13
2
+ * Vue.js v2.7.14
3
3
  * (c) 2014-2022 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -838,77 +838,6 @@ methodsToPatch.forEach(function (method) {
838
838
  });
839
839
  });
840
840
 
841
- const rawMap = new WeakMap();
842
- function reactive(target) {
843
- makeReactive(target, false);
844
- return target;
845
- }
846
- /**
847
- * Return a shallowly-reactive copy of the original object, where only the root
848
- * level properties are reactive. It also does not auto-unwrap refs (even at the
849
- * root level).
850
- */
851
- function shallowReactive(target) {
852
- makeReactive(target, true);
853
- def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
854
- return target;
855
- }
856
- function makeReactive(target, shallow) {
857
- // if trying to observe a readonly proxy, return the readonly version.
858
- if (!isReadonly(target)) {
859
- {
860
- if (isArray(target)) {
861
- warn$2(`Avoid using Array as root value for ${shallow ? `shallowReactive()` : `reactive()`} as it cannot be tracked in watch() or watchEffect(). Use ${shallow ? `shallowRef()` : `ref()`} instead. This is a Vue-2-only limitation.`);
862
- }
863
- const existingOb = target && target.__ob__;
864
- if (existingOb && existingOb.shallow !== shallow) {
865
- warn$2(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`);
866
- }
867
- }
868
- const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
869
- if (!ob) {
870
- if (target == null || isPrimitive(target)) {
871
- warn$2(`value cannot be made reactive: ${String(target)}`);
872
- }
873
- if (isCollectionType(target)) {
874
- warn$2(`Vue 2 does not support reactive collection types such as Map or Set.`);
875
- }
876
- }
877
- }
878
- }
879
- function isReactive(value) {
880
- if (isReadonly(value)) {
881
- return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
882
- }
883
- return !!(value && value.__ob__);
884
- }
885
- function isShallow(value) {
886
- return !!(value && value.__v_isShallow);
887
- }
888
- function isReadonly(value) {
889
- return !!(value && value.__v_isReadonly);
890
- }
891
- function isProxy(value) {
892
- return isReactive(value) || isReadonly(value);
893
- }
894
- function toRaw(observed) {
895
- const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
896
- return raw ? toRaw(raw) : observed;
897
- }
898
- function markRaw(value) {
899
- if (isObject(value)) {
900
- rawMap.set(value, true);
901
- }
902
- return value;
903
- }
904
- /**
905
- * @internal
906
- */
907
- function isCollectionType(value) {
908
- const type = toRawType(value);
909
- return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
910
- }
911
-
912
841
  const arrayKeys = Object.getOwnPropertyNames(arrayMethods);
913
842
  const NO_INIITIAL_VALUE = {};
914
843
  /**
@@ -995,7 +924,6 @@ function observe(value, shallow, ssrMockReactivity) {
995
924
  (isArray(value) || isPlainObject(value)) &&
996
925
  Object.isExtensible(value) &&
997
926
  !value.__v_skip /* ReactiveFlags.SKIP */ &&
998
- !rawMap.has(value) &&
999
927
  !isRef(value) &&
1000
928
  !(value instanceof VNode)) {
1001
929
  return new Observer(value, shallow, ssrMockReactivity);
@@ -1168,6 +1096,77 @@ function dependArray(value) {
1168
1096
  }
1169
1097
  }
1170
1098
 
1099
+ function reactive(target) {
1100
+ makeReactive(target, false);
1101
+ return target;
1102
+ }
1103
+ /**
1104
+ * Return a shallowly-reactive copy of the original object, where only the root
1105
+ * level properties are reactive. It also does not auto-unwrap refs (even at the
1106
+ * root level).
1107
+ */
1108
+ function shallowReactive(target) {
1109
+ makeReactive(target, true);
1110
+ def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
1111
+ return target;
1112
+ }
1113
+ function makeReactive(target, shallow) {
1114
+ // if trying to observe a readonly proxy, return the readonly version.
1115
+ if (!isReadonly(target)) {
1116
+ {
1117
+ if (isArray(target)) {
1118
+ warn$2(`Avoid using Array as root value for ${shallow ? `shallowReactive()` : `reactive()`} as it cannot be tracked in watch() or watchEffect(). Use ${shallow ? `shallowRef()` : `ref()`} instead. This is a Vue-2-only limitation.`);
1119
+ }
1120
+ const existingOb = target && target.__ob__;
1121
+ if (existingOb && existingOb.shallow !== shallow) {
1122
+ warn$2(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`);
1123
+ }
1124
+ }
1125
+ const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
1126
+ if (!ob) {
1127
+ if (target == null || isPrimitive(target)) {
1128
+ warn$2(`value cannot be made reactive: ${String(target)}`);
1129
+ }
1130
+ if (isCollectionType(target)) {
1131
+ warn$2(`Vue 2 does not support reactive collection types such as Map or Set.`);
1132
+ }
1133
+ }
1134
+ }
1135
+ }
1136
+ function isReactive(value) {
1137
+ if (isReadonly(value)) {
1138
+ return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
1139
+ }
1140
+ return !!(value && value.__ob__);
1141
+ }
1142
+ function isShallow(value) {
1143
+ return !!(value && value.__v_isShallow);
1144
+ }
1145
+ function isReadonly(value) {
1146
+ return !!(value && value.__v_isReadonly);
1147
+ }
1148
+ function isProxy(value) {
1149
+ return isReactive(value) || isReadonly(value);
1150
+ }
1151
+ function toRaw(observed) {
1152
+ const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
1153
+ return raw ? toRaw(raw) : observed;
1154
+ }
1155
+ function markRaw(value) {
1156
+ // non-extensible objects won't be observed anyway
1157
+ if (Object.isExtensible(value)) {
1158
+ def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
1159
+ }
1160
+ return value;
1161
+ }
1162
+ /**
1163
+ * @internal
1164
+ */
1165
+ function isCollectionType(value) {
1166
+ const type = toRawType(value);
1167
+ return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
1168
+ }
1169
+
1171
1170
  /**
1172
1171
  * @internal
1173
1172
  */
@@ -1303,8 +1302,8 @@ function toRef(object, key, defaultValue) {
1303
1302
  return ref;
1304
1303
  }
1305
1304
 
1306
- const rawToReadonlyMap = new WeakMap();
1307
- const rawToShallowReadonlyMap = new WeakMap();
1305
+ const rawToReadonlyFlag = `__v_rawToReadonly`;
1306
+ const rawToShallowReadonlyFlag = `__v_rawToShallowReadonly`;
1308
1307
  function readonly(target) {
1309
1308
  return createReadonly(target, false);
1310
1309
  }
@@ -1323,18 +1322,21 @@ function createReadonly(target, shallow) {
1323
1322
  }
1324
1323
  return target;
1325
1324
  }
1325
+ if (!Object.isExtensible(target)) {
1326
+ warn$2(`Vue 2 does not support creating readonly proxy for non-extensible object.`);
1327
+ }
1326
1328
  // already a readonly object
1327
1329
  if (isReadonly(target)) {
1328
1330
  return target;
1329
1331
  }
1330
1332
  // already has a readonly proxy
1331
- const map = shallow ? rawToShallowReadonlyMap : rawToReadonlyMap;
1332
- const existingProxy = map.get(target);
1333
+ const existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
1334
+ const existingProxy = target[existingFlag];
1333
1335
  if (existingProxy) {
1334
1336
  return existingProxy;
1335
1337
  }
1336
1338
  const proxy = Object.create(Object.getPrototypeOf(target));
1337
- map.set(target, proxy);
1339
+ def(target, existingFlag, proxy);
1338
1340
  def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
1339
1341
  def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
1340
1342
  if (isRef(target)) {
@@ -3933,7 +3935,7 @@ function onErrorCaptured(hook, target = currentInstance) {
3933
3935
  /**
3934
3936
  * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
3935
3937
  */
3936
- const version = '2.7.13';
3938
+ const version = '2.7.14';
3937
3939
  /**
3938
3940
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
3939
3941
  */
@@ -5123,7 +5125,7 @@ const strats = config.optionMergeStrategies;
5123
5125
  /**
5124
5126
  * Helper that recursively merges two data objects together.
5125
5127
  */
5126
- function mergeData(to, from) {
5128
+ function mergeData(to, from, recursive = true) {
5127
5129
  if (!from)
5128
5130
  return to;
5129
5131
  let key, toVal, fromVal;
@@ -5137,7 +5139,7 @@ function mergeData(to, from) {
5137
5139
  continue;
5138
5140
  toVal = to[key];
5139
5141
  fromVal = from[key];
5140
- if (!hasOwn(to, key)) {
5142
+ if (!recursive || !hasOwn(to, key)) {
5141
5143
  set(to, key, fromVal);
5142
5144
  }
5143
5145
  else if (toVal !== fromVal &&
@@ -5297,7 +5299,19 @@ strats.props =
5297
5299
  extend(ret, childVal);
5298
5300
  return ret;
5299
5301
  };
5300
- strats.provide = mergeDataOrFn;
5302
+ strats.provide = function (parentVal, childVal) {
5303
+ if (!parentVal)
5304
+ return childVal;
5305
+ return function () {
5306
+ const ret = Object.create(null);
5307
+ mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
5308
+ if (childVal) {
5309
+ mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
5310
+ );
5311
+ }
5312
+ return ret;
5313
+ };
5314
+ };
5301
5315
  /**
5302
5316
  * Default strategy.
5303
5317
  */
@@ -11022,7 +11036,7 @@ function genFor(el, state, altGen, altHelper) {
11022
11036
  !el.key) {
11023
11037
  state.warn(`<${el.tag} v-for="${alias} in ${exp}">: component lists rendered with ` +
11024
11038
  `v-for should have explicit keys. ` +
11025
- `See https://vuejs.org/guide/list.html#key for more info.`, el.rawAttrsMap['v-for'], true /* tip */);
11039
+ `See https://v2.vuejs.org/v2/guide/list.html#key for more info.`, el.rawAttrsMap['v-for'], true /* tip */);
11026
11040
  }
11027
11041
  el.forProcessed = true; // avoid recursion
11028
11042
  return (`${altHelper || '_l'}((${exp}),` +