vue 2.7.13 → 2.7.15
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 +219 -200
- package/dist/vue.common.prod.js +5 -5
- package/dist/vue.esm.browser.js +219 -200
- package/dist/vue.esm.browser.min.js +5 -5
- package/dist/vue.esm.js +223 -203
- package/dist/vue.js +223 -203
- package/dist/vue.min.js +5 -5
- package/dist/vue.runtime.common.dev.js +113 -92
- package/dist/vue.runtime.common.prod.js +5 -5
- package/dist/vue.runtime.esm.js +114 -92
- package/dist/vue.runtime.js +114 -92
- package/dist/vue.runtime.min.js +5 -5
- package/package.json +7 -7
- package/packages/compiler-sfc/dist/compiler-sfc.js +43 -28
- package/packages/compiler-sfc/node_modules/.bin/lessc +4 -4
- package/packages/compiler-sfc/node_modules/.bin/parser +4 -4
- package/packages/compiler-sfc/node_modules/.bin/sass +4 -4
- package/packages/compiler-sfc/node_modules/.bin/stylus +4 -4
- package/packages/compiler-sfc/package.json +1 -1
- package/packages/compiler-sfc/src/compileScript.ts +13 -8
- package/packages/compiler-sfc/test/__snapshots__/compileScript.spec.ts.snap +41 -9
- package/packages/compiler-sfc/test/__snapshots__/cssVars.spec.ts.snap +1 -1
- package/packages/compiler-sfc/test/compileScript.spec.ts +45 -1
- package/src/compiler/codegen/index.ts +1 -1
- package/src/compiler/parser/html-parser.ts +1 -1
- package/src/compiler/parser/index.ts +1 -1
- package/src/core/instance/lifecycle.ts +8 -2
- package/src/core/observer/index.ts +3 -5
- package/src/core/util/options.ts +19 -3
- package/src/core/vdom/patch.ts +5 -2
- package/src/platforms/web/util/element.ts +1 -1
- package/src/shared/util.ts +1 -3
- package/src/types/utils.ts +1 -1
- package/src/v3/apiAsyncComponent.ts +1 -1
- package/src/v3/reactivity/reactive.ts +4 -6
- package/src/v3/reactivity/readonly.ts +11 -5
- package/types/common.d.ts +1 -1
- package/types/jsx.d.ts +3 -1
- package/types/options.d.ts +1 -1
- package/types/v3-setup-helpers.d.ts +5 -1
- package/types/vnode.d.ts +2 -1
- package/dist/compiler-sfc.js +0 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.7.
|
|
3
|
-
* (c) 2014-
|
|
2
|
+
* Vue.js v2.7.15
|
|
3
|
+
* (c) 2014-2023 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
@@ -751,79 +751,8 @@ methodsToPatch.forEach(function (method) {
|
|
|
751
751
|
});
|
|
752
752
|
});
|
|
753
753
|
|
|
754
|
-
const rawMap = new WeakMap();
|
|
755
|
-
function reactive(target) {
|
|
756
|
-
makeReactive(target, false);
|
|
757
|
-
return target;
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* Return a shallowly-reactive copy of the original object, where only the root
|
|
761
|
-
* level properties are reactive. It also does not auto-unwrap refs (even at the
|
|
762
|
-
* root level).
|
|
763
|
-
*/
|
|
764
|
-
function shallowReactive(target) {
|
|
765
|
-
makeReactive(target, true);
|
|
766
|
-
def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
|
|
767
|
-
return target;
|
|
768
|
-
}
|
|
769
|
-
function makeReactive(target, shallow) {
|
|
770
|
-
// if trying to observe a readonly proxy, return the readonly version.
|
|
771
|
-
if (!isReadonly(target)) {
|
|
772
|
-
{
|
|
773
|
-
if (isArray(target)) {
|
|
774
|
-
warn(`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.`);
|
|
775
|
-
}
|
|
776
|
-
const existingOb = target && target.__ob__;
|
|
777
|
-
if (existingOb && existingOb.shallow !== shallow) {
|
|
778
|
-
warn(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
|
|
782
|
-
if (!ob) {
|
|
783
|
-
if (target == null || isPrimitive(target)) {
|
|
784
|
-
warn(`value cannot be made reactive: ${String(target)}`);
|
|
785
|
-
}
|
|
786
|
-
if (isCollectionType(target)) {
|
|
787
|
-
warn(`Vue 2 does not support reactive collection types such as Map or Set.`);
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
function isReactive(value) {
|
|
793
|
-
if (isReadonly(value)) {
|
|
794
|
-
return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
|
|
795
|
-
}
|
|
796
|
-
return !!(value && value.__ob__);
|
|
797
|
-
}
|
|
798
|
-
function isShallow(value) {
|
|
799
|
-
return !!(value && value.__v_isShallow);
|
|
800
|
-
}
|
|
801
|
-
function isReadonly(value) {
|
|
802
|
-
return !!(value && value.__v_isReadonly);
|
|
803
|
-
}
|
|
804
|
-
function isProxy(value) {
|
|
805
|
-
return isReactive(value) || isReadonly(value);
|
|
806
|
-
}
|
|
807
|
-
function toRaw(observed) {
|
|
808
|
-
const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
809
|
-
return raw ? toRaw(raw) : observed;
|
|
810
|
-
}
|
|
811
|
-
function markRaw(value) {
|
|
812
|
-
if (isObject(value)) {
|
|
813
|
-
rawMap.set(value, true);
|
|
814
|
-
}
|
|
815
|
-
return value;
|
|
816
|
-
}
|
|
817
|
-
/**
|
|
818
|
-
* @internal
|
|
819
|
-
*/
|
|
820
|
-
function isCollectionType(value) {
|
|
821
|
-
const type = toRawType(value);
|
|
822
|
-
return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
|
|
823
|
-
}
|
|
824
|
-
|
|
825
754
|
const arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
|
826
|
-
const
|
|
755
|
+
const NO_INITIAL_VALUE = {};
|
|
827
756
|
/**
|
|
828
757
|
* In some cases we may want to disable observation inside a component's
|
|
829
758
|
* update computation.
|
|
@@ -880,7 +809,7 @@ class Observer {
|
|
|
880
809
|
const keys = Object.keys(value);
|
|
881
810
|
for (let i = 0; i < keys.length; i++) {
|
|
882
811
|
const key = keys[i];
|
|
883
|
-
defineReactive(value, key,
|
|
812
|
+
defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);
|
|
884
813
|
}
|
|
885
814
|
}
|
|
886
815
|
}
|
|
@@ -908,7 +837,6 @@ function observe(value, shallow, ssrMockReactivity) {
|
|
|
908
837
|
(isArray(value) || isPlainObject(value)) &&
|
|
909
838
|
Object.isExtensible(value) &&
|
|
910
839
|
!value.__v_skip /* ReactiveFlags.SKIP */ &&
|
|
911
|
-
!rawMap.has(value) &&
|
|
912
840
|
!isRef(value) &&
|
|
913
841
|
!(value instanceof VNode)) {
|
|
914
842
|
return new Observer(value, shallow, ssrMockReactivity);
|
|
@@ -927,7 +855,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
|
|
|
927
855
|
const getter = property && property.get;
|
|
928
856
|
const setter = property && property.set;
|
|
929
857
|
if ((!getter || setter) &&
|
|
930
|
-
(val ===
|
|
858
|
+
(val === NO_INITIAL_VALUE || arguments.length === 2)) {
|
|
931
859
|
val = obj[key];
|
|
932
860
|
}
|
|
933
861
|
let childOb = !shallow && observe(val, false, mock);
|
|
@@ -1081,6 +1009,77 @@ function dependArray(value) {
|
|
|
1081
1009
|
}
|
|
1082
1010
|
}
|
|
1083
1011
|
|
|
1012
|
+
function reactive(target) {
|
|
1013
|
+
makeReactive(target, false);
|
|
1014
|
+
return target;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Return a shallowly-reactive copy of the original object, where only the root
|
|
1018
|
+
* level properties are reactive. It also does not auto-unwrap refs (even at the
|
|
1019
|
+
* root level).
|
|
1020
|
+
*/
|
|
1021
|
+
function shallowReactive(target) {
|
|
1022
|
+
makeReactive(target, true);
|
|
1023
|
+
def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
|
|
1024
|
+
return target;
|
|
1025
|
+
}
|
|
1026
|
+
function makeReactive(target, shallow) {
|
|
1027
|
+
// if trying to observe a readonly proxy, return the readonly version.
|
|
1028
|
+
if (!isReadonly(target)) {
|
|
1029
|
+
{
|
|
1030
|
+
if (isArray(target)) {
|
|
1031
|
+
warn(`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.`);
|
|
1032
|
+
}
|
|
1033
|
+
const existingOb = target && target.__ob__;
|
|
1034
|
+
if (existingOb && existingOb.shallow !== shallow) {
|
|
1035
|
+
warn(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
|
|
1039
|
+
if (!ob) {
|
|
1040
|
+
if (target == null || isPrimitive(target)) {
|
|
1041
|
+
warn(`value cannot be made reactive: ${String(target)}`);
|
|
1042
|
+
}
|
|
1043
|
+
if (isCollectionType(target)) {
|
|
1044
|
+
warn(`Vue 2 does not support reactive collection types such as Map or Set.`);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
function isReactive(value) {
|
|
1050
|
+
if (isReadonly(value)) {
|
|
1051
|
+
return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
|
|
1052
|
+
}
|
|
1053
|
+
return !!(value && value.__ob__);
|
|
1054
|
+
}
|
|
1055
|
+
function isShallow(value) {
|
|
1056
|
+
return !!(value && value.__v_isShallow);
|
|
1057
|
+
}
|
|
1058
|
+
function isReadonly(value) {
|
|
1059
|
+
return !!(value && value.__v_isReadonly);
|
|
1060
|
+
}
|
|
1061
|
+
function isProxy(value) {
|
|
1062
|
+
return isReactive(value) || isReadonly(value);
|
|
1063
|
+
}
|
|
1064
|
+
function toRaw(observed) {
|
|
1065
|
+
const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
1066
|
+
return raw ? toRaw(raw) : observed;
|
|
1067
|
+
}
|
|
1068
|
+
function markRaw(value) {
|
|
1069
|
+
// non-extensible objects won't be observed anyway
|
|
1070
|
+
if (Object.isExtensible(value)) {
|
|
1071
|
+
def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
|
|
1072
|
+
}
|
|
1073
|
+
return value;
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* @internal
|
|
1077
|
+
*/
|
|
1078
|
+
function isCollectionType(value) {
|
|
1079
|
+
const type = toRawType(value);
|
|
1080
|
+
return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1084
1083
|
/**
|
|
1085
1084
|
* @internal
|
|
1086
1085
|
*/
|
|
@@ -1216,8 +1215,8 @@ function toRef(object, key, defaultValue) {
|
|
|
1216
1215
|
return ref;
|
|
1217
1216
|
}
|
|
1218
1217
|
|
|
1219
|
-
const
|
|
1220
|
-
const
|
|
1218
|
+
const rawToReadonlyFlag = `__v_rawToReadonly`;
|
|
1219
|
+
const rawToShallowReadonlyFlag = `__v_rawToShallowReadonly`;
|
|
1221
1220
|
function readonly(target) {
|
|
1222
1221
|
return createReadonly(target, false);
|
|
1223
1222
|
}
|
|
@@ -1236,18 +1235,21 @@ function createReadonly(target, shallow) {
|
|
|
1236
1235
|
}
|
|
1237
1236
|
return target;
|
|
1238
1237
|
}
|
|
1238
|
+
if (!Object.isExtensible(target)) {
|
|
1239
|
+
warn(`Vue 2 does not support creating readonly proxy for non-extensible object.`);
|
|
1240
|
+
}
|
|
1239
1241
|
// already a readonly object
|
|
1240
1242
|
if (isReadonly(target)) {
|
|
1241
1243
|
return target;
|
|
1242
1244
|
}
|
|
1243
1245
|
// already has a readonly proxy
|
|
1244
|
-
const
|
|
1245
|
-
const existingProxy =
|
|
1246
|
+
const existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
|
|
1247
|
+
const existingProxy = target[existingFlag];
|
|
1246
1248
|
if (existingProxy) {
|
|
1247
1249
|
return existingProxy;
|
|
1248
1250
|
}
|
|
1249
1251
|
const proxy = Object.create(Object.getPrototypeOf(target));
|
|
1250
|
-
|
|
1252
|
+
def(target, existingFlag, proxy);
|
|
1251
1253
|
def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
|
|
1252
1254
|
def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
|
|
1253
1255
|
if (isRef(target)) {
|
|
@@ -3115,7 +3117,7 @@ function defineAsyncComponent(source) {
|
|
|
3115
3117
|
suspensible = false, // in Vue 3 default is true
|
|
3116
3118
|
onError: userOnError } = source;
|
|
3117
3119
|
if (suspensible) {
|
|
3118
|
-
warn(`The
|
|
3120
|
+
warn(`The suspensible option for async components is not supported in Vue2. It is ignored.`);
|
|
3119
3121
|
}
|
|
3120
3122
|
let pendingRequest = null;
|
|
3121
3123
|
let retries = 0;
|
|
@@ -3216,7 +3218,7 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
3216
3218
|
/**
|
|
3217
3219
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3218
3220
|
*/
|
|
3219
|
-
const version = '2.7.
|
|
3221
|
+
const version = '2.7.15';
|
|
3220
3222
|
/**
|
|
3221
3223
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3222
3224
|
*/
|
|
@@ -3972,7 +3974,8 @@ function deactivateChildComponent(vm, direct) {
|
|
|
3972
3974
|
function callHook$1(vm, hook, args, setContext = true) {
|
|
3973
3975
|
// #7573 disable dep collection when invoking lifecycle hooks
|
|
3974
3976
|
pushTarget();
|
|
3975
|
-
const
|
|
3977
|
+
const prevInst = currentInstance;
|
|
3978
|
+
const prevScope = getCurrentScope();
|
|
3976
3979
|
setContext && setCurrentInstance(vm);
|
|
3977
3980
|
const handlers = vm.$options[hook];
|
|
3978
3981
|
const info = `${hook} hook`;
|
|
@@ -3984,7 +3987,10 @@ function callHook$1(vm, hook, args, setContext = true) {
|
|
|
3984
3987
|
if (vm._hasHookEvent) {
|
|
3985
3988
|
vm.$emit('hook:' + hook);
|
|
3986
3989
|
}
|
|
3987
|
-
|
|
3990
|
+
if (setContext) {
|
|
3991
|
+
setCurrentInstance(prevInst);
|
|
3992
|
+
prevScope && prevScope.on();
|
|
3993
|
+
}
|
|
3988
3994
|
popTarget();
|
|
3989
3995
|
}
|
|
3990
3996
|
|
|
@@ -4634,7 +4640,7 @@ const strats = config.optionMergeStrategies;
|
|
|
4634
4640
|
/**
|
|
4635
4641
|
* Helper that recursively merges two data objects together.
|
|
4636
4642
|
*/
|
|
4637
|
-
function mergeData(to, from) {
|
|
4643
|
+
function mergeData(to, from, recursive = true) {
|
|
4638
4644
|
if (!from)
|
|
4639
4645
|
return to;
|
|
4640
4646
|
let key, toVal, fromVal;
|
|
@@ -4648,7 +4654,7 @@ function mergeData(to, from) {
|
|
|
4648
4654
|
continue;
|
|
4649
4655
|
toVal = to[key];
|
|
4650
4656
|
fromVal = from[key];
|
|
4651
|
-
if (!hasOwn(to, key)) {
|
|
4657
|
+
if (!recursive || !hasOwn(to, key)) {
|
|
4652
4658
|
set(to, key, fromVal);
|
|
4653
4659
|
}
|
|
4654
4660
|
else if (toVal !== fromVal &&
|
|
@@ -4808,7 +4814,19 @@ strats.props =
|
|
|
4808
4814
|
extend(ret, childVal);
|
|
4809
4815
|
return ret;
|
|
4810
4816
|
};
|
|
4811
|
-
strats.provide =
|
|
4817
|
+
strats.provide = function (parentVal, childVal) {
|
|
4818
|
+
if (!parentVal)
|
|
4819
|
+
return childVal;
|
|
4820
|
+
return function () {
|
|
4821
|
+
const ret = Object.create(null);
|
|
4822
|
+
mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
|
|
4823
|
+
if (childVal) {
|
|
4824
|
+
mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
|
|
4825
|
+
);
|
|
4826
|
+
}
|
|
4827
|
+
return ret;
|
|
4828
|
+
};
|
|
4829
|
+
};
|
|
4812
4830
|
/**
|
|
4813
4831
|
* Default strategy.
|
|
4814
4832
|
*/
|
|
@@ -6162,7 +6180,7 @@ function isUnknownElement(tag) {
|
|
|
6162
6180
|
}
|
|
6163
6181
|
const el = document.createElement(tag);
|
|
6164
6182
|
if (tag.indexOf('-') > -1) {
|
|
6165
|
-
//
|
|
6183
|
+
// https://stackoverflow.com/a/28210364/1070244
|
|
6166
6184
|
return (unknownElementCache[tag] =
|
|
6167
6185
|
el.constructor === window.HTMLUnknownElement ||
|
|
6168
6186
|
el.constructor === window.HTMLElement);
|
|
@@ -7036,8 +7054,11 @@ function createPatchFunction(backend) {
|
|
|
7036
7054
|
const insert = ancestor.data.hook.insert;
|
|
7037
7055
|
if (insert.merged) {
|
|
7038
7056
|
// start at index 1 to avoid re-invoking component mounted hook
|
|
7039
|
-
|
|
7040
|
-
|
|
7057
|
+
// clone insert hooks to avoid being mutated during iteration.
|
|
7058
|
+
// e.g. for customed directives under transition group.
|
|
7059
|
+
const cloned = insert.fns.slice(1);
|
|
7060
|
+
for (let i = 0; i < cloned.length; i++) {
|
|
7061
|
+
cloned[i]();
|
|
7041
7062
|
}
|
|
7042
7063
|
}
|
|
7043
7064
|
}
|