@vue/runtime-core 3.2.19 → 3.2.20
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/runtime-core.cjs.js +62 -30
- package/dist/runtime-core.cjs.prod.js +38 -15
- package/dist/runtime-core.d.ts +4 -1
- package/dist/runtime-core.esm-bundler.js +122 -92
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -25,19 +25,22 @@ function registerHMR(instance) {
|
|
|
25
25
|
const id = instance.type.__hmrId;
|
|
26
26
|
let record = map.get(id);
|
|
27
27
|
if (!record) {
|
|
28
|
-
createRecord(id);
|
|
28
|
+
createRecord(id, instance.type);
|
|
29
29
|
record = map.get(id);
|
|
30
30
|
}
|
|
31
|
-
record.add(instance);
|
|
31
|
+
record.instances.add(instance);
|
|
32
32
|
}
|
|
33
33
|
function unregisterHMR(instance) {
|
|
34
|
-
map.get(instance.type.__hmrId).delete(instance);
|
|
34
|
+
map.get(instance.type.__hmrId).instances.delete(instance);
|
|
35
35
|
}
|
|
36
|
-
function createRecord(id) {
|
|
36
|
+
function createRecord(id, initialDef) {
|
|
37
37
|
if (map.has(id)) {
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
|
-
map.set(id,
|
|
40
|
+
map.set(id, {
|
|
41
|
+
initialDef: normalizeClassComponent(initialDef),
|
|
42
|
+
instances: new Set()
|
|
43
|
+
});
|
|
41
44
|
return true;
|
|
42
45
|
}
|
|
43
46
|
function normalizeClassComponent(component) {
|
|
@@ -48,7 +51,9 @@ function rerender(id, newRender) {
|
|
|
48
51
|
if (!record) {
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
|
-
|
|
54
|
+
// update initial record (for not-yet-rendered component)
|
|
55
|
+
record.initialDef.render = newRender;
|
|
56
|
+
[...record.instances].forEach(instance => {
|
|
52
57
|
if (newRender) {
|
|
53
58
|
instance.render = newRender;
|
|
54
59
|
normalizeClassComponent(instance.type).render = newRender;
|
|
@@ -65,17 +70,16 @@ function reload(id, newComp) {
|
|
|
65
70
|
if (!record)
|
|
66
71
|
return;
|
|
67
72
|
newComp = normalizeClassComponent(newComp);
|
|
73
|
+
// update initial def (for not-yet-rendered components)
|
|
74
|
+
updateComponentDef(record.initialDef, newComp);
|
|
68
75
|
// create a snapshot which avoids the set being mutated during updates
|
|
69
|
-
const instances = [...record];
|
|
76
|
+
const instances = [...record.instances];
|
|
70
77
|
for (const instance of instances) {
|
|
71
78
|
const oldComp = normalizeClassComponent(instance.type);
|
|
72
79
|
if (!hmrDirtyComponents.has(oldComp)) {
|
|
73
80
|
// 1. Update existing comp definition to match new one
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (key !== '__file' && !(key in newComp)) {
|
|
77
|
-
delete oldComp[key];
|
|
78
|
-
}
|
|
81
|
+
if (oldComp !== record.initialDef) {
|
|
82
|
+
updateComponentDef(oldComp, newComp);
|
|
79
83
|
}
|
|
80
84
|
// 2. mark definition dirty. This forces the renderer to replace the
|
|
81
85
|
// component on patch.
|
|
@@ -121,6 +125,14 @@ function reload(id, newComp) {
|
|
|
121
125
|
}
|
|
122
126
|
});
|
|
123
127
|
}
|
|
128
|
+
function updateComponentDef(oldComp, newComp) {
|
|
129
|
+
shared.extend(oldComp, newComp);
|
|
130
|
+
for (const key in oldComp) {
|
|
131
|
+
if (key !== '__file' && !(key in newComp)) {
|
|
132
|
+
delete oldComp[key];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
124
136
|
function tryWrap(fn) {
|
|
125
137
|
return (id, arg) => {
|
|
126
138
|
try {
|
|
@@ -156,6 +168,11 @@ function setDevtoolsHook(hook, target) {
|
|
|
156
168
|
replay.push((newHook) => {
|
|
157
169
|
setDevtoolsHook(newHook, target);
|
|
158
170
|
});
|
|
171
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
172
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
buffer = [];
|
|
175
|
+
}, 3000);
|
|
159
176
|
}
|
|
160
177
|
}
|
|
161
178
|
function devtoolsInitApp(app, version) {
|
|
@@ -7118,15 +7135,6 @@ function traverse(value, seen) {
|
|
|
7118
7135
|
return value;
|
|
7119
7136
|
}
|
|
7120
7137
|
|
|
7121
|
-
Object.freeze({})
|
|
7122
|
-
;
|
|
7123
|
-
Object.freeze([]) ;
|
|
7124
|
-
const isFunction = (val) => typeof val === 'function';
|
|
7125
|
-
const isObject = (val) => val !== null && typeof val === 'object';
|
|
7126
|
-
const isPromise = (val) => {
|
|
7127
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
7128
|
-
};
|
|
7129
|
-
|
|
7130
7138
|
// dev only
|
|
7131
7139
|
const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
|
|
7132
7140
|
`<script setup> of a single file component. Its arguments should be ` +
|
|
@@ -7204,15 +7212,21 @@ function getContext() {
|
|
|
7204
7212
|
* only.
|
|
7205
7213
|
* @internal
|
|
7206
7214
|
*/
|
|
7207
|
-
function mergeDefaults(
|
|
7208
|
-
|
|
7209
|
-
|
|
7215
|
+
function mergeDefaults(raw, defaults) {
|
|
7216
|
+
const props = shared.isArray(raw)
|
|
7217
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
7218
|
+
: raw;
|
|
7210
7219
|
for (const key in defaults) {
|
|
7211
|
-
const
|
|
7212
|
-
if (
|
|
7213
|
-
|
|
7220
|
+
const opt = props[key];
|
|
7221
|
+
if (opt) {
|
|
7222
|
+
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
7223
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
7224
|
+
}
|
|
7225
|
+
else {
|
|
7226
|
+
opt.default = defaults[key];
|
|
7227
|
+
}
|
|
7214
7228
|
}
|
|
7215
|
-
else if (
|
|
7229
|
+
else if (opt === null) {
|
|
7216
7230
|
props[key] = { default: defaults[key] };
|
|
7217
7231
|
}
|
|
7218
7232
|
else {
|
|
@@ -7221,6 +7235,23 @@ props, defaults) {
|
|
|
7221
7235
|
}
|
|
7222
7236
|
return props;
|
|
7223
7237
|
}
|
|
7238
|
+
/**
|
|
7239
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
7240
|
+
* defineProps().
|
|
7241
|
+
* @internal
|
|
7242
|
+
*/
|
|
7243
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
7244
|
+
const ret = {};
|
|
7245
|
+
for (const key in props) {
|
|
7246
|
+
if (!excludedKeys.includes(key)) {
|
|
7247
|
+
Object.defineProperty(ret, key, {
|
|
7248
|
+
enumerable: true,
|
|
7249
|
+
get: () => props[key]
|
|
7250
|
+
});
|
|
7251
|
+
}
|
|
7252
|
+
}
|
|
7253
|
+
return ret;
|
|
7254
|
+
}
|
|
7224
7255
|
/**
|
|
7225
7256
|
* `<script setup>` helper for persisting the current instance context over
|
|
7226
7257
|
* async/await flows.
|
|
@@ -7247,7 +7278,7 @@ function withAsyncContext(getAwaitable) {
|
|
|
7247
7278
|
}
|
|
7248
7279
|
let awaitable = getAwaitable();
|
|
7249
7280
|
unsetCurrentInstance();
|
|
7250
|
-
if (isPromise(awaitable)) {
|
|
7281
|
+
if (shared.isPromise(awaitable)) {
|
|
7251
7282
|
awaitable = awaitable.catch(e => {
|
|
7252
7283
|
setCurrentInstance(ctx);
|
|
7253
7284
|
throw e;
|
|
@@ -7513,7 +7544,7 @@ function isMemoSame(cached, memo) {
|
|
|
7513
7544
|
}
|
|
7514
7545
|
|
|
7515
7546
|
// Core API ------------------------------------------------------------------
|
|
7516
|
-
const version = "3.2.
|
|
7547
|
+
const version = "3.2.20";
|
|
7517
7548
|
const _ssrUtils = {
|
|
7518
7549
|
createComponentInstance,
|
|
7519
7550
|
setupComponent,
|
|
@@ -7586,6 +7617,7 @@ exports.createCommentVNode = createCommentVNode;
|
|
|
7586
7617
|
exports.createElementBlock = createElementBlock;
|
|
7587
7618
|
exports.createElementVNode = createBaseVNode;
|
|
7588
7619
|
exports.createHydrationRenderer = createHydrationRenderer;
|
|
7620
|
+
exports.createPropsRestProxy = createPropsRestProxy;
|
|
7589
7621
|
exports.createRenderer = createRenderer;
|
|
7590
7622
|
exports.createSlots = createSlots;
|
|
7591
7623
|
exports.createStaticVNode = createStaticVNode;
|
|
@@ -19,6 +19,11 @@ function setDevtoolsHook(hook, target) {
|
|
|
19
19
|
replay.push((newHook) => {
|
|
20
20
|
setDevtoolsHook(newHook, target);
|
|
21
21
|
});
|
|
22
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
23
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
buffer = [];
|
|
26
|
+
}, 3000);
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
|
|
@@ -5811,12 +5816,6 @@ function traverse(value, seen) {
|
|
|
5811
5816
|
return value;
|
|
5812
5817
|
}
|
|
5813
5818
|
|
|
5814
|
-
const isFunction = (val) => typeof val === 'function';
|
|
5815
|
-
const isObject = (val) => val !== null && typeof val === 'object';
|
|
5816
|
-
const isPromise = (val) => {
|
|
5817
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
5818
|
-
};
|
|
5819
|
-
|
|
5820
5819
|
// implementation
|
|
5821
5820
|
function defineProps() {
|
|
5822
5821
|
return null;
|
|
@@ -5875,21 +5874,44 @@ function getContext() {
|
|
|
5875
5874
|
* only.
|
|
5876
5875
|
* @internal
|
|
5877
5876
|
*/
|
|
5878
|
-
function mergeDefaults(
|
|
5879
|
-
|
|
5880
|
-
|
|
5877
|
+
function mergeDefaults(raw, defaults) {
|
|
5878
|
+
const props = shared.isArray(raw)
|
|
5879
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
5880
|
+
: raw;
|
|
5881
5881
|
for (const key in defaults) {
|
|
5882
|
-
const
|
|
5883
|
-
if (
|
|
5884
|
-
|
|
5882
|
+
const opt = props[key];
|
|
5883
|
+
if (opt) {
|
|
5884
|
+
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
5885
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
5886
|
+
}
|
|
5887
|
+
else {
|
|
5888
|
+
opt.default = defaults[key];
|
|
5889
|
+
}
|
|
5885
5890
|
}
|
|
5886
|
-
else if (
|
|
5891
|
+
else if (opt === null) {
|
|
5887
5892
|
props[key] = { default: defaults[key] };
|
|
5888
5893
|
}
|
|
5889
5894
|
else ;
|
|
5890
5895
|
}
|
|
5891
5896
|
return props;
|
|
5892
5897
|
}
|
|
5898
|
+
/**
|
|
5899
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
5900
|
+
* defineProps().
|
|
5901
|
+
* @internal
|
|
5902
|
+
*/
|
|
5903
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
5904
|
+
const ret = {};
|
|
5905
|
+
for (const key in props) {
|
|
5906
|
+
if (!excludedKeys.includes(key)) {
|
|
5907
|
+
Object.defineProperty(ret, key, {
|
|
5908
|
+
enumerable: true,
|
|
5909
|
+
get: () => props[key]
|
|
5910
|
+
});
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
return ret;
|
|
5914
|
+
}
|
|
5893
5915
|
/**
|
|
5894
5916
|
* `<script setup>` helper for persisting the current instance context over
|
|
5895
5917
|
* async/await flows.
|
|
@@ -5912,7 +5934,7 @@ function withAsyncContext(getAwaitable) {
|
|
|
5912
5934
|
const ctx = getCurrentInstance();
|
|
5913
5935
|
let awaitable = getAwaitable();
|
|
5914
5936
|
unsetCurrentInstance();
|
|
5915
|
-
if (isPromise(awaitable)) {
|
|
5937
|
+
if (shared.isPromise(awaitable)) {
|
|
5916
5938
|
awaitable = awaitable.catch(e => {
|
|
5917
5939
|
setCurrentInstance(ctx);
|
|
5918
5940
|
throw e;
|
|
@@ -5996,7 +6018,7 @@ function isMemoSame(cached, memo) {
|
|
|
5996
6018
|
}
|
|
5997
6019
|
|
|
5998
6020
|
// Core API ------------------------------------------------------------------
|
|
5999
|
-
const version = "3.2.
|
|
6021
|
+
const version = "3.2.20";
|
|
6000
6022
|
const _ssrUtils = {
|
|
6001
6023
|
createComponentInstance,
|
|
6002
6024
|
setupComponent,
|
|
@@ -6069,6 +6091,7 @@ exports.createCommentVNode = createCommentVNode;
|
|
|
6069
6091
|
exports.createElementBlock = createElementBlock;
|
|
6070
6092
|
exports.createElementVNode = createBaseVNode;
|
|
6071
6093
|
exports.createHydrationRenderer = createHydrationRenderer;
|
|
6094
|
+
exports.createPropsRestProxy = createPropsRestProxy;
|
|
6072
6095
|
exports.createRenderer = createRenderer;
|
|
6073
6096
|
exports.createSlots = createSlots;
|
|
6074
6097
|
exports.createStaticVNode = createStaticVNode;
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { camelize } from '@vue/shared';
|
|
2
2
|
import { capitalize } from '@vue/shared';
|
|
3
|
+
import { ComponentPropsOptions as ComponentPropsOptions_2 } from '@vue/runtime-core';
|
|
3
4
|
import { computed } from '@vue/reactivity';
|
|
4
5
|
import { ComputedGetter } from '@vue/reactivity';
|
|
5
6
|
import { ComputedRef } from '@vue/reactivity';
|
|
@@ -547,7 +548,9 @@ export declare function createElementVNode(type: VNodeTypes | ClassComponent | t
|
|
|
547
548
|
|
|
548
549
|
export declare function createHydrationRenderer(options: RendererOptions<Node, Element>): HydrationRenderer;
|
|
549
550
|
|
|
550
|
-
|
|
551
|
+
/* Excluded from this release type: createPropsRestProxy */
|
|
552
|
+
|
|
553
|
+
declare function createRecord(id: string, initialDef: HMRComponent): boolean;
|
|
551
554
|
|
|
552
555
|
/**
|
|
553
556
|
* The createRenderer function accepts two generic arguments:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toRaw, ref, pauseTracking, resetTracking, reactive, computed, isRef, shallowReactive, trigger, ReactiveEffect, isProxy, shallowReadonly, track, EffectScope, markRaw, proxyRefs, isReactive, isReadonly } from '@vue/reactivity';
|
|
2
2
|
export { EffectScope, ReactiveEffect, computed, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, triggerRef, unref } from '@vue/reactivity';
|
|
3
|
-
import { getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, isFunction
|
|
3
|
+
import { getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, isFunction, toNumber, hyphenate, camelize, isArray, isOn, hasOwn, isModelListener, isObject, remove, isString, invokeArrayFns, isPromise, NOOP, def, isReservedProp, EMPTY_ARR, capitalize, toRawType, makeMap, NO, normalizeClass, normalizeStyle, isGloballyWhitelisted, hasChanged, isSet, isMap, isPlainObject } from '@vue/shared';
|
|
4
4
|
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
|
|
5
5
|
|
|
6
6
|
/* eslint-disable no-restricted-globals */
|
|
@@ -23,19 +23,22 @@ function registerHMR(instance) {
|
|
|
23
23
|
const id = instance.type.__hmrId;
|
|
24
24
|
let record = map.get(id);
|
|
25
25
|
if (!record) {
|
|
26
|
-
createRecord(id);
|
|
26
|
+
createRecord(id, instance.type);
|
|
27
27
|
record = map.get(id);
|
|
28
28
|
}
|
|
29
|
-
record.add(instance);
|
|
29
|
+
record.instances.add(instance);
|
|
30
30
|
}
|
|
31
31
|
function unregisterHMR(instance) {
|
|
32
|
-
map.get(instance.type.__hmrId).delete(instance);
|
|
32
|
+
map.get(instance.type.__hmrId).instances.delete(instance);
|
|
33
33
|
}
|
|
34
|
-
function createRecord(id) {
|
|
34
|
+
function createRecord(id, initialDef) {
|
|
35
35
|
if (map.has(id)) {
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
|
-
map.set(id,
|
|
38
|
+
map.set(id, {
|
|
39
|
+
initialDef: normalizeClassComponent(initialDef),
|
|
40
|
+
instances: new Set()
|
|
41
|
+
});
|
|
39
42
|
return true;
|
|
40
43
|
}
|
|
41
44
|
function normalizeClassComponent(component) {
|
|
@@ -46,7 +49,9 @@ function rerender(id, newRender) {
|
|
|
46
49
|
if (!record) {
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
// update initial record (for not-yet-rendered component)
|
|
53
|
+
record.initialDef.render = newRender;
|
|
54
|
+
[...record.instances].forEach(instance => {
|
|
50
55
|
if (newRender) {
|
|
51
56
|
instance.render = newRender;
|
|
52
57
|
normalizeClassComponent(instance.type).render = newRender;
|
|
@@ -63,17 +68,16 @@ function reload(id, newComp) {
|
|
|
63
68
|
if (!record)
|
|
64
69
|
return;
|
|
65
70
|
newComp = normalizeClassComponent(newComp);
|
|
71
|
+
// update initial def (for not-yet-rendered components)
|
|
72
|
+
updateComponentDef(record.initialDef, newComp);
|
|
66
73
|
// create a snapshot which avoids the set being mutated during updates
|
|
67
|
-
const instances = [...record];
|
|
74
|
+
const instances = [...record.instances];
|
|
68
75
|
for (const instance of instances) {
|
|
69
76
|
const oldComp = normalizeClassComponent(instance.type);
|
|
70
77
|
if (!hmrDirtyComponents.has(oldComp)) {
|
|
71
78
|
// 1. Update existing comp definition to match new one
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (key !== '__file' && !(key in newComp)) {
|
|
75
|
-
delete oldComp[key];
|
|
76
|
-
}
|
|
79
|
+
if (oldComp !== record.initialDef) {
|
|
80
|
+
updateComponentDef(oldComp, newComp);
|
|
77
81
|
}
|
|
78
82
|
// 2. mark definition dirty. This forces the renderer to replace the
|
|
79
83
|
// component on patch.
|
|
@@ -119,6 +123,14 @@ function reload(id, newComp) {
|
|
|
119
123
|
}
|
|
120
124
|
});
|
|
121
125
|
}
|
|
126
|
+
function updateComponentDef(oldComp, newComp) {
|
|
127
|
+
extend(oldComp, newComp);
|
|
128
|
+
for (const key in oldComp) {
|
|
129
|
+
if (key !== '__file' && !(key in newComp)) {
|
|
130
|
+
delete oldComp[key];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
122
134
|
function tryWrap(fn) {
|
|
123
135
|
return (id, arg) => {
|
|
124
136
|
try {
|
|
@@ -155,6 +167,11 @@ function setDevtoolsHook(hook, target) {
|
|
|
155
167
|
replay.push((newHook) => {
|
|
156
168
|
setDevtoolsHook(newHook, target);
|
|
157
169
|
});
|
|
170
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
171
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
buffer = [];
|
|
174
|
+
}, 3000);
|
|
158
175
|
}
|
|
159
176
|
}
|
|
160
177
|
function devtoolsInitApp(app, version) {
|
|
@@ -203,7 +220,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
203
220
|
}
|
|
204
221
|
else {
|
|
205
222
|
const validator = emitsOptions[event];
|
|
206
|
-
if (isFunction
|
|
223
|
+
if (isFunction(validator)) {
|
|
207
224
|
const isValid = validator(...rawArgs);
|
|
208
225
|
if (!isValid) {
|
|
209
226
|
warn(`Invalid event arguments: event validation failed for event "${event}".`);
|
|
@@ -273,7 +290,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
273
290
|
let normalized = {};
|
|
274
291
|
// apply mixin/extends props
|
|
275
292
|
let hasExtends = false;
|
|
276
|
-
if (__VUE_OPTIONS_API__ && !isFunction
|
|
293
|
+
if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
|
|
277
294
|
const extendEmits = (raw) => {
|
|
278
295
|
const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
|
|
279
296
|
if (normalizedFromExtend) {
|
|
@@ -723,7 +740,7 @@ const SuspenseImpl = {
|
|
|
723
740
|
const Suspense = (SuspenseImpl );
|
|
724
741
|
function triggerEvent(vnode, name) {
|
|
725
742
|
const eventListener = vnode.props && vnode.props[name];
|
|
726
|
-
if (isFunction
|
|
743
|
+
if (isFunction(eventListener)) {
|
|
727
744
|
eventListener();
|
|
728
745
|
}
|
|
729
746
|
}
|
|
@@ -1069,7 +1086,7 @@ function normalizeSuspenseChildren(vnode) {
|
|
|
1069
1086
|
}
|
|
1070
1087
|
function normalizeSuspenseSlot(s) {
|
|
1071
1088
|
let block;
|
|
1072
|
-
if (isFunction
|
|
1089
|
+
if (isFunction(s)) {
|
|
1073
1090
|
const trackBlock = isBlockTreeEnabled && s._c;
|
|
1074
1091
|
if (trackBlock) {
|
|
1075
1092
|
// disableTracking: false
|
|
@@ -1160,7 +1177,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
|
1160
1177
|
return provides[key];
|
|
1161
1178
|
}
|
|
1162
1179
|
else if (arguments.length > 1) {
|
|
1163
|
-
return treatDefaultAsFactory && isFunction
|
|
1180
|
+
return treatDefaultAsFactory && isFunction(defaultValue)
|
|
1164
1181
|
? defaultValue.call(instance.proxy)
|
|
1165
1182
|
: defaultValue;
|
|
1166
1183
|
}
|
|
@@ -1487,12 +1504,12 @@ function getTransitionRawChildren(children, keepComment = false) {
|
|
|
1487
1504
|
|
|
1488
1505
|
// implementation, close to no-op
|
|
1489
1506
|
function defineComponent(options) {
|
|
1490
|
-
return isFunction
|
|
1507
|
+
return isFunction(options) ? { setup: options, name: options.name } : options;
|
|
1491
1508
|
}
|
|
1492
1509
|
|
|
1493
1510
|
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
1494
1511
|
function defineAsyncComponent(source) {
|
|
1495
|
-
if (isFunction
|
|
1512
|
+
if (isFunction(source)) {
|
|
1496
1513
|
source = { loader: source };
|
|
1497
1514
|
}
|
|
1498
1515
|
const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out
|
|
@@ -1536,7 +1553,7 @@ function defineAsyncComponent(source) {
|
|
|
1536
1553
|
(comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
|
|
1537
1554
|
comp = comp.default;
|
|
1538
1555
|
}
|
|
1539
|
-
if ((process.env.NODE_ENV !== 'production') && comp && !isObject
|
|
1556
|
+
if ((process.env.NODE_ENV !== 'production') && comp && !isObject(comp) && !isFunction(comp)) {
|
|
1540
1557
|
throw new Error(`Invalid async component load result: ${comp}`);
|
|
1541
1558
|
}
|
|
1542
1559
|
resolvedComp = comp;
|
|
@@ -2022,7 +2039,7 @@ function applyOptions(instance) {
|
|
|
2022
2039
|
if (methods) {
|
|
2023
2040
|
for (const key in methods) {
|
|
2024
2041
|
const methodHandler = methods[key];
|
|
2025
|
-
if (isFunction
|
|
2042
|
+
if (isFunction(methodHandler)) {
|
|
2026
2043
|
// In dev mode, we use the `createRenderContext` function to define
|
|
2027
2044
|
// methods to the proxy target, and those are read-only but
|
|
2028
2045
|
// reconfigurable, so it needs to be redefined here
|
|
@@ -2048,17 +2065,17 @@ function applyOptions(instance) {
|
|
|
2048
2065
|
}
|
|
2049
2066
|
}
|
|
2050
2067
|
if (dataOptions) {
|
|
2051
|
-
if ((process.env.NODE_ENV !== 'production') && !isFunction
|
|
2068
|
+
if ((process.env.NODE_ENV !== 'production') && !isFunction(dataOptions)) {
|
|
2052
2069
|
warn(`The data option must be a function. ` +
|
|
2053
2070
|
`Plain object usage is no longer supported.`);
|
|
2054
2071
|
}
|
|
2055
2072
|
const data = dataOptions.call(publicThis, publicThis);
|
|
2056
|
-
if ((process.env.NODE_ENV !== 'production') && isPromise
|
|
2073
|
+
if ((process.env.NODE_ENV !== 'production') && isPromise(data)) {
|
|
2057
2074
|
warn(`data() returned a Promise - note data() cannot be async; If you ` +
|
|
2058
2075
|
`intend to perform data fetching before component renders, use ` +
|
|
2059
2076
|
`async setup() + <Suspense>.`);
|
|
2060
2077
|
}
|
|
2061
|
-
if (!isObject
|
|
2078
|
+
if (!isObject(data)) {
|
|
2062
2079
|
(process.env.NODE_ENV !== 'production') && warn(`data() should return an object.`);
|
|
2063
2080
|
}
|
|
2064
2081
|
else {
|
|
@@ -2084,15 +2101,15 @@ function applyOptions(instance) {
|
|
|
2084
2101
|
if (computedOptions) {
|
|
2085
2102
|
for (const key in computedOptions) {
|
|
2086
2103
|
const opt = computedOptions[key];
|
|
2087
|
-
const get = isFunction
|
|
2104
|
+
const get = isFunction(opt)
|
|
2088
2105
|
? opt.bind(publicThis, publicThis)
|
|
2089
|
-
: isFunction
|
|
2106
|
+
: isFunction(opt.get)
|
|
2090
2107
|
? opt.get.bind(publicThis, publicThis)
|
|
2091
2108
|
: NOOP;
|
|
2092
2109
|
if ((process.env.NODE_ENV !== 'production') && get === NOOP) {
|
|
2093
2110
|
warn(`Computed property "${key}" has no getter.`);
|
|
2094
2111
|
}
|
|
2095
|
-
const set = !isFunction
|
|
2112
|
+
const set = !isFunction(opt) && isFunction(opt.set)
|
|
2096
2113
|
? opt.set.bind(publicThis)
|
|
2097
2114
|
: (process.env.NODE_ENV !== 'production')
|
|
2098
2115
|
? () => {
|
|
@@ -2120,7 +2137,7 @@ function applyOptions(instance) {
|
|
|
2120
2137
|
}
|
|
2121
2138
|
}
|
|
2122
2139
|
if (provideOptions) {
|
|
2123
|
-
const provides = isFunction
|
|
2140
|
+
const provides = isFunction(provideOptions)
|
|
2124
2141
|
? provideOptions.call(publicThis)
|
|
2125
2142
|
: provideOptions;
|
|
2126
2143
|
Reflect.ownKeys(provides).forEach(key => {
|
|
@@ -2185,7 +2202,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
|
|
|
2185
2202
|
for (const key in injectOptions) {
|
|
2186
2203
|
const opt = injectOptions[key];
|
|
2187
2204
|
let injected;
|
|
2188
|
-
if (isObject
|
|
2205
|
+
if (isObject(opt)) {
|
|
2189
2206
|
if ('default' in opt) {
|
|
2190
2207
|
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
2191
2208
|
}
|
|
@@ -2236,25 +2253,25 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
2236
2253
|
: () => publicThis[key];
|
|
2237
2254
|
if (isString(raw)) {
|
|
2238
2255
|
const handler = ctx[raw];
|
|
2239
|
-
if (isFunction
|
|
2256
|
+
if (isFunction(handler)) {
|
|
2240
2257
|
watch(getter, handler);
|
|
2241
2258
|
}
|
|
2242
2259
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
2243
2260
|
warn(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
2244
2261
|
}
|
|
2245
2262
|
}
|
|
2246
|
-
else if (isFunction
|
|
2263
|
+
else if (isFunction(raw)) {
|
|
2247
2264
|
watch(getter, raw.bind(publicThis));
|
|
2248
2265
|
}
|
|
2249
|
-
else if (isObject
|
|
2266
|
+
else if (isObject(raw)) {
|
|
2250
2267
|
if (isArray(raw)) {
|
|
2251
2268
|
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
2252
2269
|
}
|
|
2253
2270
|
else {
|
|
2254
|
-
const handler = isFunction
|
|
2271
|
+
const handler = isFunction(raw.handler)
|
|
2255
2272
|
? raw.handler.bind(publicThis)
|
|
2256
2273
|
: ctx[raw.handler];
|
|
2257
|
-
if (isFunction
|
|
2274
|
+
if (isFunction(handler)) {
|
|
2258
2275
|
watch(getter, handler, raw);
|
|
2259
2276
|
}
|
|
2260
2277
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -2355,7 +2372,7 @@ function mergeDataFn(to, from) {
|
|
|
2355
2372
|
return from;
|
|
2356
2373
|
}
|
|
2357
2374
|
return function mergedDataFn() {
|
|
2358
|
-
return (extend)(isFunction
|
|
2375
|
+
return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
|
2359
2376
|
};
|
|
2360
2377
|
}
|
|
2361
2378
|
function mergeInject(to, from) {
|
|
@@ -2562,7 +2579,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
2562
2579
|
// default values
|
|
2563
2580
|
if (hasDefault && value === undefined) {
|
|
2564
2581
|
const defaultValue = opt.default;
|
|
2565
|
-
if (opt.type !== Function && isFunction
|
|
2582
|
+
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
2566
2583
|
const { propsDefaults } = instance;
|
|
2567
2584
|
if (key in propsDefaults) {
|
|
2568
2585
|
value = propsDefaults[key];
|
|
@@ -2601,7 +2618,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
2601
2618
|
const needCastKeys = [];
|
|
2602
2619
|
// apply mixin/extends props
|
|
2603
2620
|
let hasExtends = false;
|
|
2604
|
-
if (__VUE_OPTIONS_API__ && !isFunction
|
|
2621
|
+
if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
|
|
2605
2622
|
const extendProps = (raw) => {
|
|
2606
2623
|
hasExtends = true;
|
|
2607
2624
|
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
@@ -2635,7 +2652,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
2635
2652
|
}
|
|
2636
2653
|
}
|
|
2637
2654
|
else if (raw) {
|
|
2638
|
-
if ((process.env.NODE_ENV !== 'production') && !isObject
|
|
2655
|
+
if ((process.env.NODE_ENV !== 'production') && !isObject(raw)) {
|
|
2639
2656
|
warn(`invalid props options`, raw);
|
|
2640
2657
|
}
|
|
2641
2658
|
for (const key in raw) {
|
|
@@ -2643,7 +2660,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
2643
2660
|
if (validatePropName(normalizedKey)) {
|
|
2644
2661
|
const opt = raw[key];
|
|
2645
2662
|
const prop = (normalized[normalizedKey] =
|
|
2646
|
-
isArray(opt) || isFunction
|
|
2663
|
+
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
2647
2664
|
if (prop) {
|
|
2648
2665
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
2649
2666
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
@@ -2684,7 +2701,7 @@ function getTypeIndex(type, expectedTypes) {
|
|
|
2684
2701
|
if (isArray(expectedTypes)) {
|
|
2685
2702
|
return expectedTypes.findIndex(t => isSameType(t, type));
|
|
2686
2703
|
}
|
|
2687
|
-
else if (isFunction
|
|
2704
|
+
else if (isFunction(expectedTypes)) {
|
|
2688
2705
|
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
2689
2706
|
}
|
|
2690
2707
|
return -1;
|
|
@@ -2753,7 +2770,7 @@ function assertType(value, type) {
|
|
|
2753
2770
|
}
|
|
2754
2771
|
}
|
|
2755
2772
|
else if (expectedType === 'Object') {
|
|
2756
|
-
valid = isObject
|
|
2773
|
+
valid = isObject(value);
|
|
2757
2774
|
}
|
|
2758
2775
|
else if (expectedType === 'Array') {
|
|
2759
2776
|
valid = isArray(value);
|
|
@@ -2842,7 +2859,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
|
2842
2859
|
if (isInternalKey(key))
|
|
2843
2860
|
continue;
|
|
2844
2861
|
const value = rawSlots[key];
|
|
2845
|
-
if (isFunction
|
|
2862
|
+
if (isFunction(value)) {
|
|
2846
2863
|
slots[key] = normalizeSlot(key, value, ctx);
|
|
2847
2864
|
}
|
|
2848
2865
|
else if (value != null) {
|
|
@@ -2971,7 +2988,7 @@ function withDirectives(vnode, directives) {
|
|
|
2971
2988
|
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
2972
2989
|
for (let i = 0; i < directives.length; i++) {
|
|
2973
2990
|
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
|
2974
|
-
if (isFunction
|
|
2991
|
+
if (isFunction(dir)) {
|
|
2975
2992
|
dir = {
|
|
2976
2993
|
mounted: dir,
|
|
2977
2994
|
updated: dir
|
|
@@ -3039,7 +3056,7 @@ function createAppContext() {
|
|
|
3039
3056
|
let uid = 0;
|
|
3040
3057
|
function createAppAPI(render, hydrate) {
|
|
3041
3058
|
return function createApp(rootComponent, rootProps = null) {
|
|
3042
|
-
if (rootProps != null && !isObject
|
|
3059
|
+
if (rootProps != null && !isObject(rootProps)) {
|
|
3043
3060
|
(process.env.NODE_ENV !== 'production') && warn(`root props passed to app.mount() must be an object.`);
|
|
3044
3061
|
rootProps = null;
|
|
3045
3062
|
}
|
|
@@ -3066,11 +3083,11 @@ function createAppAPI(render, hydrate) {
|
|
|
3066
3083
|
if (installedPlugins.has(plugin)) {
|
|
3067
3084
|
(process.env.NODE_ENV !== 'production') && warn(`Plugin has already been applied to target app.`);
|
|
3068
3085
|
}
|
|
3069
|
-
else if (plugin && isFunction
|
|
3086
|
+
else if (plugin && isFunction(plugin.install)) {
|
|
3070
3087
|
installedPlugins.add(plugin);
|
|
3071
3088
|
plugin.install(app, ...options);
|
|
3072
3089
|
}
|
|
3073
|
-
else if (isFunction
|
|
3090
|
+
else if (isFunction(plugin)) {
|
|
3074
3091
|
installedPlugins.add(plugin);
|
|
3075
3092
|
plugin(app, ...options);
|
|
3076
3093
|
}
|
|
@@ -4897,7 +4914,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4897
4914
|
doSet();
|
|
4898
4915
|
}
|
|
4899
4916
|
}
|
|
4900
|
-
else if (isFunction
|
|
4917
|
+
else if (isFunction(ref)) {
|
|
4901
4918
|
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4902
4919
|
}
|
|
4903
4920
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -5374,7 +5391,7 @@ const InternalObjectKey = `__vInternal`;
|
|
|
5374
5391
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
5375
5392
|
const normalizeRef = ({ ref }) => {
|
|
5376
5393
|
return (ref != null
|
|
5377
|
-
? isString(ref) || isRef(ref) || isFunction
|
|
5394
|
+
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
5378
5395
|
? { i: currentRenderingInstance, r: ref }
|
|
5379
5396
|
: ref
|
|
5380
5397
|
: null);
|
|
@@ -5473,7 +5490,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5473
5490
|
if (klass && !isString(klass)) {
|
|
5474
5491
|
props.class = normalizeClass(klass);
|
|
5475
5492
|
}
|
|
5476
|
-
if (isObject
|
|
5493
|
+
if (isObject(style)) {
|
|
5477
5494
|
// reactive state objects need to be cloned since they are likely to be
|
|
5478
5495
|
// mutated
|
|
5479
5496
|
if (isProxy(style) && !isArray(style)) {
|
|
@@ -5489,9 +5506,9 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5489
5506
|
? 128 /* SUSPENSE */
|
|
5490
5507
|
: isTeleport(type)
|
|
5491
5508
|
? 64 /* TELEPORT */
|
|
5492
|
-
: isObject
|
|
5509
|
+
: isObject(type)
|
|
5493
5510
|
? 4 /* STATEFUL_COMPONENT */
|
|
5494
|
-
: isFunction
|
|
5511
|
+
: isFunction(type)
|
|
5495
5512
|
? 2 /* FUNCTIONAL_COMPONENT */
|
|
5496
5513
|
: 0;
|
|
5497
5514
|
if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
@@ -5670,7 +5687,7 @@ function normalizeChildren(vnode, children) {
|
|
|
5670
5687
|
}
|
|
5671
5688
|
}
|
|
5672
5689
|
}
|
|
5673
|
-
else if (isFunction
|
|
5690
|
+
else if (isFunction(children)) {
|
|
5674
5691
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
5675
5692
|
type = 32 /* SLOTS_CHILDREN */;
|
|
5676
5693
|
}
|
|
@@ -5740,7 +5757,7 @@ function renderList(source, renderItem, cache, index) {
|
|
|
5740
5757
|
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
5741
5758
|
}
|
|
5742
5759
|
}
|
|
5743
|
-
else if (isObject
|
|
5760
|
+
else if (isObject(source)) {
|
|
5744
5761
|
if (source[Symbol.iterator]) {
|
|
5745
5762
|
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
5746
5763
|
}
|
|
@@ -5842,7 +5859,7 @@ function ensureValidVNode(vnodes) {
|
|
|
5842
5859
|
*/
|
|
5843
5860
|
function toHandlers(obj) {
|
|
5844
5861
|
const ret = {};
|
|
5845
|
-
if ((process.env.NODE_ENV !== 'production') && !isObject
|
|
5862
|
+
if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
|
|
5846
5863
|
warn(`v-on with no argument expects an object value.`);
|
|
5847
5864
|
return ret;
|
|
5848
5865
|
}
|
|
@@ -6277,7 +6294,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6277
6294
|
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
|
|
6278
6295
|
resetTracking();
|
|
6279
6296
|
unsetCurrentInstance();
|
|
6280
|
-
if (isPromise
|
|
6297
|
+
if (isPromise(setupResult)) {
|
|
6281
6298
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
6282
6299
|
if (isSSR) {
|
|
6283
6300
|
// return the promise so server-renderer can wait on it
|
|
@@ -6304,7 +6321,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6304
6321
|
}
|
|
6305
6322
|
}
|
|
6306
6323
|
function handleSetupResult(instance, setupResult, isSSR) {
|
|
6307
|
-
if (isFunction
|
|
6324
|
+
if (isFunction(setupResult)) {
|
|
6308
6325
|
// setup returned an inline render function
|
|
6309
6326
|
if (instance.type.__ssrInlineRender) {
|
|
6310
6327
|
// when the function's name is `ssrRender` (compiled by SFC inline mode),
|
|
@@ -6315,7 +6332,7 @@ function handleSetupResult(instance, setupResult, isSSR) {
|
|
|
6315
6332
|
instance.render = setupResult;
|
|
6316
6333
|
}
|
|
6317
6334
|
}
|
|
6318
|
-
else if (isObject
|
|
6335
|
+
else if (isObject(setupResult)) {
|
|
6319
6336
|
if ((process.env.NODE_ENV !== 'production') && isVNode(setupResult)) {
|
|
6320
6337
|
warn(`setup() should not return VNodes directly - ` +
|
|
6321
6338
|
`return a render function instead.`);
|
|
@@ -6484,7 +6501,7 @@ function getExposeProxy(instance) {
|
|
|
6484
6501
|
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
6485
6502
|
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
6486
6503
|
function getComponentName(Component) {
|
|
6487
|
-
return isFunction
|
|
6504
|
+
return isFunction(Component)
|
|
6488
6505
|
? Component.displayName || Component.name
|
|
6489
6506
|
: Component.name;
|
|
6490
6507
|
}
|
|
@@ -6513,7 +6530,7 @@ function formatComponentName(instance, Component, isRoot = false) {
|
|
|
6513
6530
|
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
6514
6531
|
}
|
|
6515
6532
|
function isClassComponent(value) {
|
|
6516
|
-
return isFunction
|
|
6533
|
+
return isFunction(value) && '__vccOpts' in value;
|
|
6517
6534
|
}
|
|
6518
6535
|
|
|
6519
6536
|
const stack = [];
|
|
@@ -6621,7 +6638,7 @@ function formatProp(key, value, raw) {
|
|
|
6621
6638
|
value = formatProp(key, toRaw(value.value), true);
|
|
6622
6639
|
return raw ? value : [`${key}=Ref<`, value, `>`];
|
|
6623
6640
|
}
|
|
6624
|
-
else if (isFunction
|
|
6641
|
+
else if (isFunction(value)) {
|
|
6625
6642
|
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
|
6626
6643
|
}
|
|
6627
6644
|
else {
|
|
@@ -6673,9 +6690,9 @@ function callWithErrorHandling(fn, instance, type, args) {
|
|
|
6673
6690
|
return res;
|
|
6674
6691
|
}
|
|
6675
6692
|
function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
6676
|
-
if (isFunction
|
|
6693
|
+
if (isFunction(fn)) {
|
|
6677
6694
|
const res = callWithErrorHandling(fn, instance, type, args);
|
|
6678
|
-
if (res && isPromise
|
|
6695
|
+
if (res && isPromise(res)) {
|
|
6679
6696
|
res.catch(err => {
|
|
6680
6697
|
handleError(err, instance, type);
|
|
6681
6698
|
});
|
|
@@ -6963,7 +6980,7 @@ function watchSyncEffect(effect, options) {
|
|
|
6963
6980
|
const INITIAL_WATCHER_VALUE = {};
|
|
6964
6981
|
// implementation
|
|
6965
6982
|
function watch(source, cb, options) {
|
|
6966
|
-
if ((process.env.NODE_ENV !== 'production') && !isFunction
|
|
6983
|
+
if ((process.env.NODE_ENV !== 'production') && !isFunction(cb)) {
|
|
6967
6984
|
warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
|
|
6968
6985
|
`Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
|
|
6969
6986
|
`supports \`watch(source, cb, options?) signature.`);
|
|
@@ -7007,7 +7024,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
7007
7024
|
else if (isReactive(s)) {
|
|
7008
7025
|
return traverse(s);
|
|
7009
7026
|
}
|
|
7010
|
-
else if (isFunction
|
|
7027
|
+
else if (isFunction(s)) {
|
|
7011
7028
|
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
7012
7029
|
}
|
|
7013
7030
|
else {
|
|
@@ -7015,7 +7032,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
7015
7032
|
}
|
|
7016
7033
|
});
|
|
7017
7034
|
}
|
|
7018
|
-
else if (isFunction
|
|
7035
|
+
else if (isFunction(source)) {
|
|
7019
7036
|
if (cb) {
|
|
7020
7037
|
// getter with cb
|
|
7021
7038
|
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
@@ -7155,7 +7172,7 @@ function instanceWatch(source, value, options) {
|
|
|
7155
7172
|
: () => publicThis[source]
|
|
7156
7173
|
: source.bind(publicThis, publicThis);
|
|
7157
7174
|
let cb;
|
|
7158
|
-
if (isFunction
|
|
7175
|
+
if (isFunction(value)) {
|
|
7159
7176
|
cb = value;
|
|
7160
7177
|
}
|
|
7161
7178
|
else {
|
|
@@ -7184,7 +7201,7 @@ function createPathGetter(ctx, path) {
|
|
|
7184
7201
|
};
|
|
7185
7202
|
}
|
|
7186
7203
|
function traverse(value, seen) {
|
|
7187
|
-
if (!isObject
|
|
7204
|
+
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
7188
7205
|
return value;
|
|
7189
7206
|
}
|
|
7190
7207
|
seen = seen || new Set();
|
|
@@ -7213,16 +7230,6 @@ function traverse(value, seen) {
|
|
|
7213
7230
|
return value;
|
|
7214
7231
|
}
|
|
7215
7232
|
|
|
7216
|
-
(process.env.NODE_ENV !== 'production')
|
|
7217
|
-
? Object.freeze({})
|
|
7218
|
-
: {};
|
|
7219
|
-
(process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
|
|
7220
|
-
const isFunction = (val) => typeof val === 'function';
|
|
7221
|
-
const isObject = (val) => val !== null && typeof val === 'object';
|
|
7222
|
-
const isPromise = (val) => {
|
|
7223
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
7224
|
-
};
|
|
7225
|
-
|
|
7226
7233
|
// dev only
|
|
7227
7234
|
const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
|
|
7228
7235
|
`<script setup> of a single file component. Its arguments should be ` +
|
|
@@ -7300,15 +7307,21 @@ function getContext() {
|
|
|
7300
7307
|
* only.
|
|
7301
7308
|
* @internal
|
|
7302
7309
|
*/
|
|
7303
|
-
function mergeDefaults(
|
|
7304
|
-
|
|
7305
|
-
|
|
7310
|
+
function mergeDefaults(raw, defaults) {
|
|
7311
|
+
const props = isArray(raw)
|
|
7312
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
7313
|
+
: raw;
|
|
7306
7314
|
for (const key in defaults) {
|
|
7307
|
-
const
|
|
7308
|
-
if (
|
|
7309
|
-
|
|
7315
|
+
const opt = props[key];
|
|
7316
|
+
if (opt) {
|
|
7317
|
+
if (isArray(opt) || isFunction(opt)) {
|
|
7318
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
7319
|
+
}
|
|
7320
|
+
else {
|
|
7321
|
+
opt.default = defaults[key];
|
|
7322
|
+
}
|
|
7310
7323
|
}
|
|
7311
|
-
else if (
|
|
7324
|
+
else if (opt === null) {
|
|
7312
7325
|
props[key] = { default: defaults[key] };
|
|
7313
7326
|
}
|
|
7314
7327
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -7317,6 +7330,23 @@ props, defaults) {
|
|
|
7317
7330
|
}
|
|
7318
7331
|
return props;
|
|
7319
7332
|
}
|
|
7333
|
+
/**
|
|
7334
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
7335
|
+
* defineProps().
|
|
7336
|
+
* @internal
|
|
7337
|
+
*/
|
|
7338
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
7339
|
+
const ret = {};
|
|
7340
|
+
for (const key in props) {
|
|
7341
|
+
if (!excludedKeys.includes(key)) {
|
|
7342
|
+
Object.defineProperty(ret, key, {
|
|
7343
|
+
enumerable: true,
|
|
7344
|
+
get: () => props[key]
|
|
7345
|
+
});
|
|
7346
|
+
}
|
|
7347
|
+
}
|
|
7348
|
+
return ret;
|
|
7349
|
+
}
|
|
7320
7350
|
/**
|
|
7321
7351
|
* `<script setup>` helper for persisting the current instance context over
|
|
7322
7352
|
* async/await flows.
|
|
@@ -7356,7 +7386,7 @@ function withAsyncContext(getAwaitable) {
|
|
|
7356
7386
|
function h(type, propsOrChildren, children) {
|
|
7357
7387
|
const l = arguments.length;
|
|
7358
7388
|
if (l === 2) {
|
|
7359
|
-
if (isObject
|
|
7389
|
+
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
|
7360
7390
|
// single vnode without props
|
|
7361
7391
|
if (isVNode(propsOrChildren)) {
|
|
7362
7392
|
return createVNode(type, null, [propsOrChildren]);
|
|
@@ -7406,7 +7436,7 @@ function initCustomFormatter() {
|
|
|
7406
7436
|
const formatter = {
|
|
7407
7437
|
header(obj) {
|
|
7408
7438
|
// TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
|
|
7409
|
-
if (!isObject
|
|
7439
|
+
if (!isObject(obj)) {
|
|
7410
7440
|
return null;
|
|
7411
7441
|
}
|
|
7412
7442
|
if (obj.__isVue) {
|
|
@@ -7531,7 +7561,7 @@ function initCustomFormatter() {
|
|
|
7531
7561
|
else if (typeof v === 'boolean') {
|
|
7532
7562
|
return ['span', keywordStyle, v];
|
|
7533
7563
|
}
|
|
7534
|
-
else if (isObject
|
|
7564
|
+
else if (isObject(v)) {
|
|
7535
7565
|
return ['object', { object: asRaw ? toRaw(v) : v }];
|
|
7536
7566
|
}
|
|
7537
7567
|
else {
|
|
@@ -7540,7 +7570,7 @@ function initCustomFormatter() {
|
|
|
7540
7570
|
}
|
|
7541
7571
|
function extractKeys(instance, type) {
|
|
7542
7572
|
const Comp = instance.type;
|
|
7543
|
-
if (isFunction
|
|
7573
|
+
if (isFunction(Comp)) {
|
|
7544
7574
|
return;
|
|
7545
7575
|
}
|
|
7546
7576
|
const extracted = {};
|
|
@@ -7554,7 +7584,7 @@ function initCustomFormatter() {
|
|
|
7554
7584
|
function isKeyOfType(Comp, key, type) {
|
|
7555
7585
|
const opts = Comp[type];
|
|
7556
7586
|
if ((isArray(opts) && opts.includes(key)) ||
|
|
7557
|
-
(isObject
|
|
7587
|
+
(isObject(opts) && key in opts)) {
|
|
7558
7588
|
return true;
|
|
7559
7589
|
}
|
|
7560
7590
|
if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
|
@@ -7609,7 +7639,7 @@ function isMemoSame(cached, memo) {
|
|
|
7609
7639
|
}
|
|
7610
7640
|
|
|
7611
7641
|
// Core API ------------------------------------------------------------------
|
|
7612
|
-
const version = "3.2.
|
|
7642
|
+
const version = "3.2.20";
|
|
7613
7643
|
const _ssrUtils = {
|
|
7614
7644
|
createComponentInstance,
|
|
7615
7645
|
setupComponent,
|
|
@@ -7632,4 +7662,4 @@ const resolveFilter = null;
|
|
|
7632
7662
|
*/
|
|
7633
7663
|
const compatUtils = (null);
|
|
7634
7664
|
|
|
7635
|
-
export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
|
|
7665
|
+
export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-core",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.20",
|
|
4
4
|
"description": "@vue/runtime-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-core.esm-bundler.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.2.
|
|
36
|
-
"@vue/reactivity": "3.2.
|
|
35
|
+
"@vue/shared": "3.2.20",
|
|
36
|
+
"@vue/reactivity": "3.2.20"
|
|
37
37
|
}
|
|
38
38
|
}
|