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.
- package/dist/vue.common.dev.js +97 -83
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +97 -83
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +98 -83
- package/dist/vue.js +98 -83
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +96 -82
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +97 -82
- package/dist/vue.runtime.js +97 -82
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +2 -2
- package/packages/compiler-sfc/dist/compiler-sfc.js +25 -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/util/options.ts +19 -3
- package/src/v3/reactivity/reactive.ts +4 -6
- package/src/v3/reactivity/readonly.ts +11 -5
- package/types/jsx.d.ts +3 -1
- package/types/vnode.d.ts +2 -1
package/src/core/util/options.ts
CHANGED
|
@@ -51,7 +51,8 @@ if (__DEV__) {
|
|
|
51
51
|
*/
|
|
52
52
|
function mergeData(
|
|
53
53
|
to: Record<string | symbol, any>,
|
|
54
|
-
from: Record<string | symbol, any> | null
|
|
54
|
+
from: Record<string | symbol, any> | null,
|
|
55
|
+
recursive = true
|
|
55
56
|
): Record<PropertyKey, any> {
|
|
56
57
|
if (!from) return to
|
|
57
58
|
let key, toVal, fromVal
|
|
@@ -66,7 +67,7 @@ function mergeData(
|
|
|
66
67
|
if (key === '__ob__') continue
|
|
67
68
|
toVal = to[key]
|
|
68
69
|
fromVal = from[key]
|
|
69
|
-
if (!hasOwn(to, key)) {
|
|
70
|
+
if (!recursive || !hasOwn(to, key)) {
|
|
70
71
|
set(to, key, fromVal)
|
|
71
72
|
} else if (
|
|
72
73
|
toVal !== fromVal &&
|
|
@@ -262,7 +263,22 @@ strats.props =
|
|
|
262
263
|
if (childVal) extend(ret, childVal)
|
|
263
264
|
return ret
|
|
264
265
|
}
|
|
265
|
-
|
|
266
|
+
|
|
267
|
+
strats.provide = function (parentVal: Object | null, childVal: Object | null) {
|
|
268
|
+
if (!parentVal) return childVal
|
|
269
|
+
return function () {
|
|
270
|
+
const ret = Object.create(null)
|
|
271
|
+
mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal)
|
|
272
|
+
if (childVal) {
|
|
273
|
+
mergeData(
|
|
274
|
+
ret,
|
|
275
|
+
isFunction(childVal) ? childVal.call(this) : childVal,
|
|
276
|
+
false // non-recursive
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
return ret
|
|
280
|
+
}
|
|
281
|
+
}
|
|
266
282
|
|
|
267
283
|
/**
|
|
268
284
|
* Default strategy.
|
|
@@ -5,13 +5,10 @@ import {
|
|
|
5
5
|
isPrimitive,
|
|
6
6
|
warn,
|
|
7
7
|
toRawType,
|
|
8
|
-
isServerRendering
|
|
9
|
-
isObject
|
|
8
|
+
isServerRendering
|
|
10
9
|
} from 'core/util'
|
|
11
10
|
import type { Ref, UnwrapRefSimple, RawSymbol } from './ref'
|
|
12
11
|
|
|
13
|
-
export const rawMap = new WeakMap()
|
|
14
|
-
|
|
15
12
|
export const enum ReactiveFlags {
|
|
16
13
|
SKIP = '__v_skip',
|
|
17
14
|
IS_READONLY = '__v_isReadonly',
|
|
@@ -122,8 +119,9 @@ export function toRaw<T>(observed: T): T {
|
|
|
122
119
|
export function markRaw<T extends object>(
|
|
123
120
|
value: T
|
|
124
121
|
): T & { [RawSymbol]?: true } {
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
// non-extensible objects won't be observed anyway
|
|
123
|
+
if (Object.isExtensible(value)) {
|
|
124
|
+
def(value, ReactiveFlags.SKIP, true)
|
|
127
125
|
}
|
|
128
126
|
return value
|
|
129
127
|
}
|
|
@@ -32,8 +32,8 @@ export type DeepReadonly<T> = T extends Builtin
|
|
|
32
32
|
? { readonly [K in keyof T]: DeepReadonly<T[K]> }
|
|
33
33
|
: Readonly<T>
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
const
|
|
35
|
+
const rawToReadonlyFlag = `__v_rawToReadonly`
|
|
36
|
+
const rawToShallowReadonlyFlag = `__v_rawToShallowReadonly`
|
|
37
37
|
|
|
38
38
|
export function readonly<T extends object>(
|
|
39
39
|
target: T
|
|
@@ -57,20 +57,26 @@ function createReadonly(target: any, shallow: boolean) {
|
|
|
57
57
|
return target as any
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
if (__DEV__ && !Object.isExtensible(target)) {
|
|
61
|
+
warn(
|
|
62
|
+
`Vue 2 does not support creating readonly proxy for non-extensible object.`
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
// already a readonly object
|
|
61
67
|
if (isReadonly(target)) {
|
|
62
68
|
return target as any
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
// already has a readonly proxy
|
|
66
|
-
const
|
|
67
|
-
const existingProxy =
|
|
72
|
+
const existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag
|
|
73
|
+
const existingProxy = target[existingFlag]
|
|
68
74
|
if (existingProxy) {
|
|
69
75
|
return existingProxy
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
const proxy = Object.create(Object.getPrototypeOf(target))
|
|
73
|
-
|
|
79
|
+
def(target, existingFlag, proxy)
|
|
74
80
|
|
|
75
81
|
def(proxy, ReactiveFlags.IS_READONLY, true)
|
|
76
82
|
def(proxy, ReactiveFlags.RAW, target)
|
package/types/jsx.d.ts
CHANGED
|
@@ -1297,7 +1297,9 @@ export interface Events {
|
|
|
1297
1297
|
}
|
|
1298
1298
|
|
|
1299
1299
|
type EventHandlers<E> = {
|
|
1300
|
-
[K in keyof E]?: E[K] extends
|
|
1300
|
+
[K in keyof E]?: E[K] extends (...args: any) => any
|
|
1301
|
+
? E[K]
|
|
1302
|
+
: (payload: E[K]) => void
|
|
1301
1303
|
}
|
|
1302
1304
|
|
|
1303
1305
|
type ReservedProps = {
|
package/types/vnode.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StyleValue } from './jsx'
|
|
1
2
|
import { Vue } from './vue'
|
|
2
3
|
import { DirectiveFunction, DirectiveOptions } from './options'
|
|
3
4
|
import { Ref } from './v3-generated'
|
|
@@ -85,7 +86,7 @@ export interface VNodeData {
|
|
|
85
86
|
staticClass?: string
|
|
86
87
|
class?: any
|
|
87
88
|
staticStyle?: { [key: string]: any }
|
|
88
|
-
style?:
|
|
89
|
+
style?: StyleValue
|
|
89
90
|
props?: { [key: string]: any }
|
|
90
91
|
attrs?: { [key: string]: any }
|
|
91
92
|
domProps?: { [key: string]: any }
|