vue 2.7.12 → 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.
- package/dist/vue.common.dev.js +102 -85
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +102 -85
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +103 -85
- package/dist/vue.js +103 -85
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +101 -84
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +102 -84
- package/dist/vue.runtime.js +102 -84
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +2 -2
- package/packages/compiler-sfc/dist/compiler-sfc.js +26 -13
- package/packages/compiler-sfc/package.json +1 -1
- package/packages/compiler-sfc/src/compileScript.ts +3 -1
- package/packages/compiler-sfc/test/compileScript.spec.ts +17 -1
- package/src/compiler/codegen/index.ts +1 -1
- package/src/compiler/parser/index.ts +1 -1
- package/src/core/observer/index.ts +0 -2
- package/src/core/observer/traverse.ts +1 -0
- package/src/core/util/options.ts +19 -3
- package/src/v3/reactivity/effectScope.ts +4 -5
- package/src/v3/reactivity/reactive.ts +4 -6
- package/src/v3/reactivity/readonly.ts +11 -5
- package/types/jsx.d.ts +4 -2
- package/types/v3-generated.d.ts +1 -0
- package/types/vnode.d.ts +2 -1
package/dist/vue.esm.browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.7.
|
|
2
|
+
* Vue.js v2.7.14
|
|
3
3
|
* (c) 2014-2022 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -836,77 +836,6 @@ methodsToPatch.forEach(function (method) {
|
|
|
836
836
|
});
|
|
837
837
|
});
|
|
838
838
|
|
|
839
|
-
const rawMap = new WeakMap();
|
|
840
|
-
function reactive(target) {
|
|
841
|
-
makeReactive(target, false);
|
|
842
|
-
return target;
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* Return a shallowly-reactive copy of the original object, where only the root
|
|
846
|
-
* level properties are reactive. It also does not auto-unwrap refs (even at the
|
|
847
|
-
* root level).
|
|
848
|
-
*/
|
|
849
|
-
function shallowReactive(target) {
|
|
850
|
-
makeReactive(target, true);
|
|
851
|
-
def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
|
|
852
|
-
return target;
|
|
853
|
-
}
|
|
854
|
-
function makeReactive(target, shallow) {
|
|
855
|
-
// if trying to observe a readonly proxy, return the readonly version.
|
|
856
|
-
if (!isReadonly(target)) {
|
|
857
|
-
{
|
|
858
|
-
if (isArray(target)) {
|
|
859
|
-
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.`);
|
|
860
|
-
}
|
|
861
|
-
const existingOb = target && target.__ob__;
|
|
862
|
-
if (existingOb && existingOb.shallow !== shallow) {
|
|
863
|
-
warn$2(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
|
|
867
|
-
if (!ob) {
|
|
868
|
-
if (target == null || isPrimitive(target)) {
|
|
869
|
-
warn$2(`value cannot be made reactive: ${String(target)}`);
|
|
870
|
-
}
|
|
871
|
-
if (isCollectionType(target)) {
|
|
872
|
-
warn$2(`Vue 2 does not support reactive collection types such as Map or Set.`);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
function isReactive(value) {
|
|
878
|
-
if (isReadonly(value)) {
|
|
879
|
-
return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
|
|
880
|
-
}
|
|
881
|
-
return !!(value && value.__ob__);
|
|
882
|
-
}
|
|
883
|
-
function isShallow(value) {
|
|
884
|
-
return !!(value && value.__v_isShallow);
|
|
885
|
-
}
|
|
886
|
-
function isReadonly(value) {
|
|
887
|
-
return !!(value && value.__v_isReadonly);
|
|
888
|
-
}
|
|
889
|
-
function isProxy(value) {
|
|
890
|
-
return isReactive(value) || isReadonly(value);
|
|
891
|
-
}
|
|
892
|
-
function toRaw(observed) {
|
|
893
|
-
const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
894
|
-
return raw ? toRaw(raw) : observed;
|
|
895
|
-
}
|
|
896
|
-
function markRaw(value) {
|
|
897
|
-
if (isObject(value)) {
|
|
898
|
-
rawMap.set(value, true);
|
|
899
|
-
}
|
|
900
|
-
return value;
|
|
901
|
-
}
|
|
902
|
-
/**
|
|
903
|
-
* @internal
|
|
904
|
-
*/
|
|
905
|
-
function isCollectionType(value) {
|
|
906
|
-
const type = toRawType(value);
|
|
907
|
-
return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
|
|
908
|
-
}
|
|
909
|
-
|
|
910
839
|
const arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
|
911
840
|
const NO_INIITIAL_VALUE = {};
|
|
912
841
|
/**
|
|
@@ -993,7 +922,6 @@ function observe(value, shallow, ssrMockReactivity) {
|
|
|
993
922
|
(isArray(value) || isPlainObject(value)) &&
|
|
994
923
|
Object.isExtensible(value) &&
|
|
995
924
|
!value.__v_skip /* ReactiveFlags.SKIP */ &&
|
|
996
|
-
!rawMap.has(value) &&
|
|
997
925
|
!isRef(value) &&
|
|
998
926
|
!(value instanceof VNode)) {
|
|
999
927
|
return new Observer(value, shallow, ssrMockReactivity);
|
|
@@ -1166,6 +1094,77 @@ function dependArray(value) {
|
|
|
1166
1094
|
}
|
|
1167
1095
|
}
|
|
1168
1096
|
|
|
1097
|
+
function reactive(target) {
|
|
1098
|
+
makeReactive(target, false);
|
|
1099
|
+
return target;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Return a shallowly-reactive copy of the original object, where only the root
|
|
1103
|
+
* level properties are reactive. It also does not auto-unwrap refs (even at the
|
|
1104
|
+
* root level).
|
|
1105
|
+
*/
|
|
1106
|
+
function shallowReactive(target) {
|
|
1107
|
+
makeReactive(target, true);
|
|
1108
|
+
def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
|
|
1109
|
+
return target;
|
|
1110
|
+
}
|
|
1111
|
+
function makeReactive(target, shallow) {
|
|
1112
|
+
// if trying to observe a readonly proxy, return the readonly version.
|
|
1113
|
+
if (!isReadonly(target)) {
|
|
1114
|
+
{
|
|
1115
|
+
if (isArray(target)) {
|
|
1116
|
+
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.`);
|
|
1117
|
+
}
|
|
1118
|
+
const existingOb = target && target.__ob__;
|
|
1119
|
+
if (existingOb && existingOb.shallow !== shallow) {
|
|
1120
|
+
warn$2(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
|
|
1124
|
+
if (!ob) {
|
|
1125
|
+
if (target == null || isPrimitive(target)) {
|
|
1126
|
+
warn$2(`value cannot be made reactive: ${String(target)}`);
|
|
1127
|
+
}
|
|
1128
|
+
if (isCollectionType(target)) {
|
|
1129
|
+
warn$2(`Vue 2 does not support reactive collection types such as Map or Set.`);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
function isReactive(value) {
|
|
1135
|
+
if (isReadonly(value)) {
|
|
1136
|
+
return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
|
|
1137
|
+
}
|
|
1138
|
+
return !!(value && value.__ob__);
|
|
1139
|
+
}
|
|
1140
|
+
function isShallow(value) {
|
|
1141
|
+
return !!(value && value.__v_isShallow);
|
|
1142
|
+
}
|
|
1143
|
+
function isReadonly(value) {
|
|
1144
|
+
return !!(value && value.__v_isReadonly);
|
|
1145
|
+
}
|
|
1146
|
+
function isProxy(value) {
|
|
1147
|
+
return isReactive(value) || isReadonly(value);
|
|
1148
|
+
}
|
|
1149
|
+
function toRaw(observed) {
|
|
1150
|
+
const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
1151
|
+
return raw ? toRaw(raw) : observed;
|
|
1152
|
+
}
|
|
1153
|
+
function markRaw(value) {
|
|
1154
|
+
// non-extensible objects won't be observed anyway
|
|
1155
|
+
if (Object.isExtensible(value)) {
|
|
1156
|
+
def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
|
|
1157
|
+
}
|
|
1158
|
+
return value;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* @internal
|
|
1162
|
+
*/
|
|
1163
|
+
function isCollectionType(value) {
|
|
1164
|
+
const type = toRawType(value);
|
|
1165
|
+
return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1169
1168
|
/**
|
|
1170
1169
|
* @internal
|
|
1171
1170
|
*/
|
|
@@ -1301,8 +1300,8 @@ function toRef(object, key, defaultValue) {
|
|
|
1301
1300
|
return ref;
|
|
1302
1301
|
}
|
|
1303
1302
|
|
|
1304
|
-
const
|
|
1305
|
-
const
|
|
1303
|
+
const rawToReadonlyFlag = `__v_rawToReadonly`;
|
|
1304
|
+
const rawToShallowReadonlyFlag = `__v_rawToShallowReadonly`;
|
|
1306
1305
|
function readonly(target) {
|
|
1307
1306
|
return createReadonly(target, false);
|
|
1308
1307
|
}
|
|
@@ -1321,18 +1320,21 @@ function createReadonly(target, shallow) {
|
|
|
1321
1320
|
}
|
|
1322
1321
|
return target;
|
|
1323
1322
|
}
|
|
1323
|
+
if (!Object.isExtensible(target)) {
|
|
1324
|
+
warn$2(`Vue 2 does not support creating readonly proxy for non-extensible object.`);
|
|
1325
|
+
}
|
|
1324
1326
|
// already a readonly object
|
|
1325
1327
|
if (isReadonly(target)) {
|
|
1326
1328
|
return target;
|
|
1327
1329
|
}
|
|
1328
1330
|
// already has a readonly proxy
|
|
1329
|
-
const
|
|
1330
|
-
const existingProxy =
|
|
1331
|
+
const existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
|
|
1332
|
+
const existingProxy = target[existingFlag];
|
|
1331
1333
|
if (existingProxy) {
|
|
1332
1334
|
return existingProxy;
|
|
1333
1335
|
}
|
|
1334
1336
|
const proxy = Object.create(Object.getPrototypeOf(target));
|
|
1335
|
-
|
|
1337
|
+
def(target, existingFlag, proxy);
|
|
1336
1338
|
def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
|
|
1337
1339
|
def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
|
|
1338
1340
|
if (isRef(target)) {
|
|
@@ -3432,6 +3434,7 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
|
|
|
3432
3434
|
let activeEffectScope;
|
|
3433
3435
|
class EffectScope {
|
|
3434
3436
|
constructor(detached = false) {
|
|
3437
|
+
this.detached = detached;
|
|
3435
3438
|
/**
|
|
3436
3439
|
* @internal
|
|
3437
3440
|
*/
|
|
@@ -3444,8 +3447,8 @@ class EffectScope {
|
|
|
3444
3447
|
* @internal
|
|
3445
3448
|
*/
|
|
3446
3449
|
this.cleanups = [];
|
|
3450
|
+
this.parent = activeEffectScope;
|
|
3447
3451
|
if (!detached && activeEffectScope) {
|
|
3448
|
-
this.parent = activeEffectScope;
|
|
3449
3452
|
this.index =
|
|
3450
3453
|
(activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
3451
3454
|
}
|
|
@@ -3494,7 +3497,7 @@ class EffectScope {
|
|
|
3494
3497
|
}
|
|
3495
3498
|
}
|
|
3496
3499
|
// nested scope, dereference from parent to avoid memory leaks
|
|
3497
|
-
if (this.parent && !fromParent) {
|
|
3500
|
+
if (!this.detached && this.parent && !fromParent) {
|
|
3498
3501
|
// optimized O(1) removal
|
|
3499
3502
|
const last = this.parent.scopes.pop();
|
|
3500
3503
|
if (last && last !== this) {
|
|
@@ -3502,6 +3505,7 @@ class EffectScope {
|
|
|
3502
3505
|
last.index = this.index;
|
|
3503
3506
|
}
|
|
3504
3507
|
}
|
|
3508
|
+
this.parent = undefined;
|
|
3505
3509
|
this.active = false;
|
|
3506
3510
|
}
|
|
3507
3511
|
}
|
|
@@ -3923,7 +3927,7 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
3923
3927
|
/**
|
|
3924
3928
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3925
3929
|
*/
|
|
3926
|
-
const version = '2.7.
|
|
3930
|
+
const version = '2.7.14';
|
|
3927
3931
|
/**
|
|
3928
3932
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3929
3933
|
*/
|
|
@@ -3946,6 +3950,7 @@ function _traverse(val, seen) {
|
|
|
3946
3950
|
let i, keys;
|
|
3947
3951
|
const isA = isArray(val);
|
|
3948
3952
|
if ((!isA && !isObject(val)) ||
|
|
3953
|
+
val.__v_skip /* ReactiveFlags.SKIP */ ||
|
|
3949
3954
|
Object.isFrozen(val) ||
|
|
3950
3955
|
val instanceof VNode) {
|
|
3951
3956
|
return;
|
|
@@ -5052,7 +5057,7 @@ const strats = config.optionMergeStrategies;
|
|
|
5052
5057
|
/**
|
|
5053
5058
|
* Helper that recursively merges two data objects together.
|
|
5054
5059
|
*/
|
|
5055
|
-
function mergeData(to, from) {
|
|
5060
|
+
function mergeData(to, from, recursive = true) {
|
|
5056
5061
|
if (!from)
|
|
5057
5062
|
return to;
|
|
5058
5063
|
let key, toVal, fromVal;
|
|
@@ -5066,7 +5071,7 @@ function mergeData(to, from) {
|
|
|
5066
5071
|
continue;
|
|
5067
5072
|
toVal = to[key];
|
|
5068
5073
|
fromVal = from[key];
|
|
5069
|
-
if (!hasOwn(to, key)) {
|
|
5074
|
+
if (!recursive || !hasOwn(to, key)) {
|
|
5070
5075
|
set(to, key, fromVal);
|
|
5071
5076
|
}
|
|
5072
5077
|
else if (toVal !== fromVal &&
|
|
@@ -5226,7 +5231,19 @@ strats.props =
|
|
|
5226
5231
|
extend(ret, childVal);
|
|
5227
5232
|
return ret;
|
|
5228
5233
|
};
|
|
5229
|
-
strats.provide =
|
|
5234
|
+
strats.provide = function (parentVal, childVal) {
|
|
5235
|
+
if (!parentVal)
|
|
5236
|
+
return childVal;
|
|
5237
|
+
return function () {
|
|
5238
|
+
const ret = Object.create(null);
|
|
5239
|
+
mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
|
|
5240
|
+
if (childVal) {
|
|
5241
|
+
mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
|
|
5242
|
+
);
|
|
5243
|
+
}
|
|
5244
|
+
return ret;
|
|
5245
|
+
};
|
|
5246
|
+
};
|
|
5230
5247
|
/**
|
|
5231
5248
|
* Default strategy.
|
|
5232
5249
|
*/
|
|
@@ -10951,7 +10968,7 @@ function genFor(el, state, altGen, altHelper) {
|
|
|
10951
10968
|
!el.key) {
|
|
10952
10969
|
state.warn(`<${el.tag} v-for="${alias} in ${exp}">: component lists rendered with ` +
|
|
10953
10970
|
`v-for should have explicit keys. ` +
|
|
10954
|
-
`See https://vuejs.org/guide/list.html#key for more info.`, el.rawAttrsMap['v-for'], true /* tip */);
|
|
10971
|
+
`See https://v2.vuejs.org/v2/guide/list.html#key for more info.`, el.rawAttrsMap['v-for'], true /* tip */);
|
|
10955
10972
|
}
|
|
10956
10973
|
el.forProcessed = true; // avoid recursion
|
|
10957
10974
|
return (`${altHelper || '_l'}((${exp}),` +
|