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.common.dev.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
|
*/
|
|
@@ -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
|
|
1307
|
-
const
|
|
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
|
|
1332
|
-
const existingProxy =
|
|
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
|
-
|
|
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)) {
|
|
@@ -3434,6 +3436,7 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
|
|
|
3434
3436
|
let activeEffectScope;
|
|
3435
3437
|
class EffectScope {
|
|
3436
3438
|
constructor(detached = false) {
|
|
3439
|
+
this.detached = detached;
|
|
3437
3440
|
/**
|
|
3438
3441
|
* @internal
|
|
3439
3442
|
*/
|
|
@@ -3446,8 +3449,8 @@ class EffectScope {
|
|
|
3446
3449
|
* @internal
|
|
3447
3450
|
*/
|
|
3448
3451
|
this.cleanups = [];
|
|
3452
|
+
this.parent = activeEffectScope;
|
|
3449
3453
|
if (!detached && activeEffectScope) {
|
|
3450
|
-
this.parent = activeEffectScope;
|
|
3451
3454
|
this.index =
|
|
3452
3455
|
(activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
3453
3456
|
}
|
|
@@ -3496,7 +3499,7 @@ class EffectScope {
|
|
|
3496
3499
|
}
|
|
3497
3500
|
}
|
|
3498
3501
|
// nested scope, dereference from parent to avoid memory leaks
|
|
3499
|
-
if (this.parent && !fromParent) {
|
|
3502
|
+
if (!this.detached && this.parent && !fromParent) {
|
|
3500
3503
|
// optimized O(1) removal
|
|
3501
3504
|
const last = this.parent.scopes.pop();
|
|
3502
3505
|
if (last && last !== this) {
|
|
@@ -3504,6 +3507,7 @@ class EffectScope {
|
|
|
3504
3507
|
last.index = this.index;
|
|
3505
3508
|
}
|
|
3506
3509
|
}
|
|
3510
|
+
this.parent = undefined;
|
|
3507
3511
|
this.active = false;
|
|
3508
3512
|
}
|
|
3509
3513
|
}
|
|
@@ -3931,7 +3935,7 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
3931
3935
|
/**
|
|
3932
3936
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3933
3937
|
*/
|
|
3934
|
-
const version = '2.7.
|
|
3938
|
+
const version = '2.7.14';
|
|
3935
3939
|
/**
|
|
3936
3940
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3937
3941
|
*/
|
|
@@ -4014,6 +4018,7 @@ function _traverse(val, seen) {
|
|
|
4014
4018
|
let i, keys;
|
|
4015
4019
|
const isA = isArray(val);
|
|
4016
4020
|
if ((!isA && !isObject(val)) ||
|
|
4021
|
+
val.__v_skip /* ReactiveFlags.SKIP */ ||
|
|
4017
4022
|
Object.isFrozen(val) ||
|
|
4018
4023
|
val instanceof VNode) {
|
|
4019
4024
|
return;
|
|
@@ -5120,7 +5125,7 @@ const strats = config.optionMergeStrategies;
|
|
|
5120
5125
|
/**
|
|
5121
5126
|
* Helper that recursively merges two data objects together.
|
|
5122
5127
|
*/
|
|
5123
|
-
function mergeData(to, from) {
|
|
5128
|
+
function mergeData(to, from, recursive = true) {
|
|
5124
5129
|
if (!from)
|
|
5125
5130
|
return to;
|
|
5126
5131
|
let key, toVal, fromVal;
|
|
@@ -5134,7 +5139,7 @@ function mergeData(to, from) {
|
|
|
5134
5139
|
continue;
|
|
5135
5140
|
toVal = to[key];
|
|
5136
5141
|
fromVal = from[key];
|
|
5137
|
-
if (!hasOwn(to, key)) {
|
|
5142
|
+
if (!recursive || !hasOwn(to, key)) {
|
|
5138
5143
|
set(to, key, fromVal);
|
|
5139
5144
|
}
|
|
5140
5145
|
else if (toVal !== fromVal &&
|
|
@@ -5294,7 +5299,19 @@ strats.props =
|
|
|
5294
5299
|
extend(ret, childVal);
|
|
5295
5300
|
return ret;
|
|
5296
5301
|
};
|
|
5297
|
-
strats.provide =
|
|
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
|
+
};
|
|
5298
5315
|
/**
|
|
5299
5316
|
* Default strategy.
|
|
5300
5317
|
*/
|
|
@@ -11019,7 +11036,7 @@ function genFor(el, state, altGen, altHelper) {
|
|
|
11019
11036
|
!el.key) {
|
|
11020
11037
|
state.warn(`<${el.tag} v-for="${alias} in ${exp}">: component lists rendered with ` +
|
|
11021
11038
|
`v-for should have explicit keys. ` +
|
|
11022
|
-
`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 */);
|
|
11023
11040
|
}
|
|
11024
11041
|
el.forProcessed = true; // avoid recursion
|
|
11025
11042
|
return (`${altHelper || '_l'}((${exp}),` +
|