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
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.
|
package/src/core/vdom/patch.ts
CHANGED
|
@@ -878,8 +878,11 @@ export function createPatchFunction(backend) {
|
|
|
878
878
|
const insert = ancestor.data.hook.insert
|
|
879
879
|
if (insert.merged) {
|
|
880
880
|
// start at index 1 to avoid re-invoking component mounted hook
|
|
881
|
-
|
|
882
|
-
|
|
881
|
+
// clone insert hooks to avoid being mutated during iteration.
|
|
882
|
+
// e.g. for customed directives under transition group.
|
|
883
|
+
const cloned = insert.fns.slice(1)
|
|
884
|
+
for (let i = 0; i < cloned.length; i++) {
|
|
885
|
+
cloned[i]()
|
|
883
886
|
}
|
|
884
887
|
}
|
|
885
888
|
} else {
|
|
@@ -62,7 +62,7 @@ export function isUnknownElement(tag: string): boolean {
|
|
|
62
62
|
}
|
|
63
63
|
const el = document.createElement(tag)
|
|
64
64
|
if (tag.indexOf('-') > -1) {
|
|
65
|
-
//
|
|
65
|
+
// https://stackoverflow.com/a/28210364/1070244
|
|
66
66
|
return (unknownElementCache[tag] =
|
|
67
67
|
el.constructor === window.HTMLUnknownElement ||
|
|
68
68
|
el.constructor === window.HTMLElement)
|
package/src/shared/util.ts
CHANGED
|
@@ -286,9 +286,7 @@ export function genStaticKeys(
|
|
|
286
286
|
modules: Array<{ staticKeys?: string[] } /* ModuleOptions */>
|
|
287
287
|
): string {
|
|
288
288
|
return modules
|
|
289
|
-
.reduce((keys, m) =>
|
|
290
|
-
return keys.concat(m.staticKeys || [])
|
|
291
|
-
}, [] as string[])
|
|
289
|
+
.reduce<string[]>((keys, m) => keys.concat(m.staticKeys || []), [])
|
|
292
290
|
.join(',')
|
|
293
291
|
}
|
|
294
292
|
|
package/src/types/utils.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// If the
|
|
1
|
+
// If the type T accepts type "any", output type Y, otherwise output type N.
|
|
2
2
|
// https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
|
|
3
3
|
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N
|
|
@@ -47,7 +47,7 @@ export function defineAsyncComponent(
|
|
|
47
47
|
|
|
48
48
|
if (__DEV__ && suspensible) {
|
|
49
49
|
warn(
|
|
50
|
-
`The
|
|
50
|
+
`The suspensible option for async components is not supported in Vue2. It is ignored.`
|
|
51
51
|
)
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -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/common.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ type Equal<Left, Right> =
|
|
|
14
14
|
|
|
15
15
|
export type HasDefined<T> = Equal<T, unknown> extends true ? false : true
|
|
16
16
|
|
|
17
|
-
// If the
|
|
17
|
+
// If the type T accepts type "any", output type Y, otherwise output type N.
|
|
18
18
|
// https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
|
|
19
19
|
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N
|
|
20
20
|
|
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/options.d.ts
CHANGED
|
@@ -210,7 +210,7 @@ export interface ComponentOptions<
|
|
|
210
210
|
activated?(): void
|
|
211
211
|
deactivated?(): void
|
|
212
212
|
errorCaptured?(err: Error, vm: Vue, info: string): boolean | void
|
|
213
|
-
serverPrefetch?(
|
|
213
|
+
serverPrefetch?(): Promise<void>
|
|
214
214
|
renderTracked?(e: DebuggerEvent): void
|
|
215
215
|
renderTriggerd?(e: DebuggerEvent): void
|
|
216
216
|
|
|
@@ -110,7 +110,11 @@ type InferDefault<P, T> = T extends
|
|
|
110
110
|
: (props: P) => T
|
|
111
111
|
|
|
112
112
|
type PropsWithDefaults<Base, Defaults> = Base & {
|
|
113
|
-
[K in keyof Defaults]: K extends keyof Base
|
|
113
|
+
[K in keyof Defaults]: K extends keyof Base
|
|
114
|
+
? Defaults[K] extends undefined
|
|
115
|
+
? Base[K]
|
|
116
|
+
: NotUndefined<Base[K]>
|
|
117
|
+
: never
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
/**
|
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 }
|
package/dist/compiler-sfc.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var compilerSfc = require('@vue/compiler-sfc');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.keys(compilerSfc).forEach(function (k) {
|
|
10
|
-
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () { return compilerSfc[k]; }
|
|
13
|
-
});
|
|
14
|
-
});
|