@vue/runtime-core 3.2.17 → 3.2.21
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 +81 -33
- package/dist/runtime-core.cjs.prod.js +51 -16
- package/dist/runtime-core.d.ts +7 -1
- package/dist/runtime-core.esm-bundler.js +141 -95
- 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 {
|
|
@@ -135,11 +147,12 @@ function tryWrap(fn) {
|
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
let buffer = [];
|
|
150
|
+
let devtoolsNotInstalled = false;
|
|
138
151
|
function emit(event, ...args) {
|
|
139
152
|
if (exports.devtools) {
|
|
140
153
|
exports.devtools.emit(event, ...args);
|
|
141
154
|
}
|
|
142
|
-
else {
|
|
155
|
+
else if (!devtoolsNotInstalled) {
|
|
143
156
|
buffer.push({ event, args });
|
|
144
157
|
}
|
|
145
158
|
}
|
|
@@ -150,12 +163,32 @@ function setDevtoolsHook(hook, target) {
|
|
|
150
163
|
buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
|
|
151
164
|
buffer = [];
|
|
152
165
|
}
|
|
153
|
-
else
|
|
166
|
+
else if (
|
|
167
|
+
// handle late devtools injection - only do this if we are in an actual
|
|
168
|
+
// browser environment to avoid the timer handle stalling test runner exit
|
|
169
|
+
// (#4815)
|
|
170
|
+
// eslint-disable-next-line no-restricted-globals
|
|
171
|
+
typeof window !== 'undefined' &&
|
|
172
|
+
!navigator.userAgent.includes('jsdom')) {
|
|
154
173
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
155
174
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
156
175
|
replay.push((newHook) => {
|
|
157
176
|
setDevtoolsHook(newHook, target);
|
|
158
177
|
});
|
|
178
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
179
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
180
|
+
setTimeout(() => {
|
|
181
|
+
if (!exports.devtools) {
|
|
182
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
183
|
+
devtoolsNotInstalled = true;
|
|
184
|
+
buffer = [];
|
|
185
|
+
}
|
|
186
|
+
}, 3000);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// non-browser env, assume not installed
|
|
190
|
+
devtoolsNotInstalled = true;
|
|
191
|
+
buffer = [];
|
|
159
192
|
}
|
|
160
193
|
}
|
|
161
194
|
function devtoolsInitApp(app, version) {
|
|
@@ -2944,7 +2977,7 @@ return withDirectives(h(comp), [
|
|
|
2944
2977
|
[bar, this.y]
|
|
2945
2978
|
])
|
|
2946
2979
|
*/
|
|
2947
|
-
const isBuiltInDirective = /*#__PURE__*/ shared.makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
|
|
2980
|
+
const isBuiltInDirective = /*#__PURE__*/ shared.makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
|
2948
2981
|
function validateDirectiveName(name) {
|
|
2949
2982
|
if (isBuiltInDirective(name)) {
|
|
2950
2983
|
warn('Do not use built-in directive ids as custom directive id: ' + name);
|
|
@@ -7118,15 +7151,6 @@ function traverse(value, seen) {
|
|
|
7118
7151
|
return value;
|
|
7119
7152
|
}
|
|
7120
7153
|
|
|
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
7154
|
// dev only
|
|
7131
7155
|
const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
|
|
7132
7156
|
`<script setup> of a single file component. Its arguments should be ` +
|
|
@@ -7204,15 +7228,21 @@ function getContext() {
|
|
|
7204
7228
|
* only.
|
|
7205
7229
|
* @internal
|
|
7206
7230
|
*/
|
|
7207
|
-
function mergeDefaults(
|
|
7208
|
-
|
|
7209
|
-
|
|
7231
|
+
function mergeDefaults(raw, defaults) {
|
|
7232
|
+
const props = shared.isArray(raw)
|
|
7233
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
7234
|
+
: raw;
|
|
7210
7235
|
for (const key in defaults) {
|
|
7211
|
-
const
|
|
7212
|
-
if (
|
|
7213
|
-
|
|
7236
|
+
const opt = props[key];
|
|
7237
|
+
if (opt) {
|
|
7238
|
+
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
7239
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
7240
|
+
}
|
|
7241
|
+
else {
|
|
7242
|
+
opt.default = defaults[key];
|
|
7243
|
+
}
|
|
7214
7244
|
}
|
|
7215
|
-
else if (
|
|
7245
|
+
else if (opt === null) {
|
|
7216
7246
|
props[key] = { default: defaults[key] };
|
|
7217
7247
|
}
|
|
7218
7248
|
else {
|
|
@@ -7221,6 +7251,23 @@ props, defaults) {
|
|
|
7221
7251
|
}
|
|
7222
7252
|
return props;
|
|
7223
7253
|
}
|
|
7254
|
+
/**
|
|
7255
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
7256
|
+
* defineProps().
|
|
7257
|
+
* @internal
|
|
7258
|
+
*/
|
|
7259
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
7260
|
+
const ret = {};
|
|
7261
|
+
for (const key in props) {
|
|
7262
|
+
if (!excludedKeys.includes(key)) {
|
|
7263
|
+
Object.defineProperty(ret, key, {
|
|
7264
|
+
enumerable: true,
|
|
7265
|
+
get: () => props[key]
|
|
7266
|
+
});
|
|
7267
|
+
}
|
|
7268
|
+
}
|
|
7269
|
+
return ret;
|
|
7270
|
+
}
|
|
7224
7271
|
/**
|
|
7225
7272
|
* `<script setup>` helper for persisting the current instance context over
|
|
7226
7273
|
* async/await flows.
|
|
@@ -7247,7 +7294,7 @@ function withAsyncContext(getAwaitable) {
|
|
|
7247
7294
|
}
|
|
7248
7295
|
let awaitable = getAwaitable();
|
|
7249
7296
|
unsetCurrentInstance();
|
|
7250
|
-
if (isPromise(awaitable)) {
|
|
7297
|
+
if (shared.isPromise(awaitable)) {
|
|
7251
7298
|
awaitable = awaitable.catch(e => {
|
|
7252
7299
|
setCurrentInstance(ctx);
|
|
7253
7300
|
throw e;
|
|
@@ -7513,7 +7560,7 @@ function isMemoSame(cached, memo) {
|
|
|
7513
7560
|
}
|
|
7514
7561
|
|
|
7515
7562
|
// Core API ------------------------------------------------------------------
|
|
7516
|
-
const version = "3.2.
|
|
7563
|
+
const version = "3.2.21";
|
|
7517
7564
|
const _ssrUtils = {
|
|
7518
7565
|
createComponentInstance,
|
|
7519
7566
|
setupComponent,
|
|
@@ -7586,6 +7633,7 @@ exports.createCommentVNode = createCommentVNode;
|
|
|
7586
7633
|
exports.createElementBlock = createElementBlock;
|
|
7587
7634
|
exports.createElementVNode = createBaseVNode;
|
|
7588
7635
|
exports.createHydrationRenderer = createHydrationRenderer;
|
|
7636
|
+
exports.createPropsRestProxy = createPropsRestProxy;
|
|
7589
7637
|
exports.createRenderer = createRenderer;
|
|
7590
7638
|
exports.createSlots = createSlots;
|
|
7591
7639
|
exports.createStaticVNode = createStaticVNode;
|
|
@@ -13,12 +13,29 @@ function setDevtoolsHook(hook, target) {
|
|
|
13
13
|
buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
|
|
14
14
|
buffer = [];
|
|
15
15
|
}
|
|
16
|
-
else
|
|
16
|
+
else if (
|
|
17
|
+
// handle late devtools injection - only do this if we are in an actual
|
|
18
|
+
// browser environment to avoid the timer handle stalling test runner exit
|
|
19
|
+
// (#4815)
|
|
20
|
+
// eslint-disable-next-line no-restricted-globals
|
|
21
|
+
typeof window !== 'undefined' &&
|
|
22
|
+
!navigator.userAgent.includes('jsdom')) {
|
|
17
23
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
18
24
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
19
25
|
replay.push((newHook) => {
|
|
20
26
|
setDevtoolsHook(newHook, target);
|
|
21
27
|
});
|
|
28
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
29
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
if (!exports.devtools) {
|
|
32
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
33
|
+
buffer = [];
|
|
34
|
+
}
|
|
35
|
+
}, 3000);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
buffer = [];
|
|
22
39
|
}
|
|
23
40
|
}
|
|
24
41
|
|
|
@@ -5811,12 +5828,6 @@ function traverse(value, seen) {
|
|
|
5811
5828
|
return value;
|
|
5812
5829
|
}
|
|
5813
5830
|
|
|
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
5831
|
// implementation
|
|
5821
5832
|
function defineProps() {
|
|
5822
5833
|
return null;
|
|
@@ -5875,21 +5886,44 @@ function getContext() {
|
|
|
5875
5886
|
* only.
|
|
5876
5887
|
* @internal
|
|
5877
5888
|
*/
|
|
5878
|
-
function mergeDefaults(
|
|
5879
|
-
|
|
5880
|
-
|
|
5889
|
+
function mergeDefaults(raw, defaults) {
|
|
5890
|
+
const props = shared.isArray(raw)
|
|
5891
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
5892
|
+
: raw;
|
|
5881
5893
|
for (const key in defaults) {
|
|
5882
|
-
const
|
|
5883
|
-
if (
|
|
5884
|
-
|
|
5894
|
+
const opt = props[key];
|
|
5895
|
+
if (opt) {
|
|
5896
|
+
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
5897
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
5898
|
+
}
|
|
5899
|
+
else {
|
|
5900
|
+
opt.default = defaults[key];
|
|
5901
|
+
}
|
|
5885
5902
|
}
|
|
5886
|
-
else if (
|
|
5903
|
+
else if (opt === null) {
|
|
5887
5904
|
props[key] = { default: defaults[key] };
|
|
5888
5905
|
}
|
|
5889
5906
|
else ;
|
|
5890
5907
|
}
|
|
5891
5908
|
return props;
|
|
5892
5909
|
}
|
|
5910
|
+
/**
|
|
5911
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
5912
|
+
* defineProps().
|
|
5913
|
+
* @internal
|
|
5914
|
+
*/
|
|
5915
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
5916
|
+
const ret = {};
|
|
5917
|
+
for (const key in props) {
|
|
5918
|
+
if (!excludedKeys.includes(key)) {
|
|
5919
|
+
Object.defineProperty(ret, key, {
|
|
5920
|
+
enumerable: true,
|
|
5921
|
+
get: () => props[key]
|
|
5922
|
+
});
|
|
5923
|
+
}
|
|
5924
|
+
}
|
|
5925
|
+
return ret;
|
|
5926
|
+
}
|
|
5893
5927
|
/**
|
|
5894
5928
|
* `<script setup>` helper for persisting the current instance context over
|
|
5895
5929
|
* async/await flows.
|
|
@@ -5912,7 +5946,7 @@ function withAsyncContext(getAwaitable) {
|
|
|
5912
5946
|
const ctx = getCurrentInstance();
|
|
5913
5947
|
let awaitable = getAwaitable();
|
|
5914
5948
|
unsetCurrentInstance();
|
|
5915
|
-
if (isPromise(awaitable)) {
|
|
5949
|
+
if (shared.isPromise(awaitable)) {
|
|
5916
5950
|
awaitable = awaitable.catch(e => {
|
|
5917
5951
|
setCurrentInstance(ctx);
|
|
5918
5952
|
throw e;
|
|
@@ -5996,7 +6030,7 @@ function isMemoSame(cached, memo) {
|
|
|
5996
6030
|
}
|
|
5997
6031
|
|
|
5998
6032
|
// Core API ------------------------------------------------------------------
|
|
5999
|
-
const version = "3.2.
|
|
6033
|
+
const version = "3.2.21";
|
|
6000
6034
|
const _ssrUtils = {
|
|
6001
6035
|
createComponentInstance,
|
|
6002
6036
|
setupComponent,
|
|
@@ -6069,6 +6103,7 @@ exports.createCommentVNode = createCommentVNode;
|
|
|
6069
6103
|
exports.createElementBlock = createElementBlock;
|
|
6070
6104
|
exports.createElementVNode = createBaseVNode;
|
|
6071
6105
|
exports.createHydrationRenderer = createHydrationRenderer;
|
|
6106
|
+
exports.createPropsRestProxy = createPropsRestProxy;
|
|
6072
6107
|
exports.createRenderer = createRenderer;
|
|
6073
6108
|
exports.createSlots = createSlots;
|
|
6074
6109
|
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';
|
|
@@ -28,6 +29,7 @@ import { ReactiveFlags } from '@vue/reactivity';
|
|
|
28
29
|
import { readonly } from '@vue/reactivity';
|
|
29
30
|
import { Ref } from '@vue/reactivity';
|
|
30
31
|
import { ref } from '@vue/reactivity';
|
|
32
|
+
import { ShallowReactive } from '@vue/reactivity';
|
|
31
33
|
import { shallowReactive } from '@vue/reactivity';
|
|
32
34
|
import { shallowReadonly } from '@vue/reactivity';
|
|
33
35
|
import { shallowRef } from '@vue/reactivity';
|
|
@@ -547,7 +549,9 @@ export declare function createElementVNode(type: VNodeTypes | ClassComponent | t
|
|
|
547
549
|
|
|
548
550
|
export declare function createHydrationRenderer(options: RendererOptions<Node, Element>): HydrationRenderer;
|
|
549
551
|
|
|
550
|
-
|
|
552
|
+
/* Excluded from this release type: createPropsRestProxy */
|
|
553
|
+
|
|
554
|
+
declare function createRecord(id: string, initialDef: HMRComponent): boolean;
|
|
551
555
|
|
|
552
556
|
/**
|
|
553
557
|
* The createRenderer function accepts two generic arguments:
|
|
@@ -1592,6 +1596,8 @@ export declare interface SetupContext<E = EmitsOptions> {
|
|
|
1592
1596
|
|
|
1593
1597
|
declare type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, optimized: boolean) => void;
|
|
1594
1598
|
|
|
1599
|
+
export { ShallowReactive }
|
|
1600
|
+
|
|
1595
1601
|
export { shallowReactive }
|
|
1596
1602
|
|
|
1597
1603
|
export { shallowReadonly }
|
|
@@ -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 {
|
|
@@ -134,11 +146,12 @@ function tryWrap(fn) {
|
|
|
134
146
|
|
|
135
147
|
let devtools;
|
|
136
148
|
let buffer = [];
|
|
149
|
+
let devtoolsNotInstalled = false;
|
|
137
150
|
function emit(event, ...args) {
|
|
138
151
|
if (devtools) {
|
|
139
152
|
devtools.emit(event, ...args);
|
|
140
153
|
}
|
|
141
|
-
else {
|
|
154
|
+
else if (!devtoolsNotInstalled) {
|
|
142
155
|
buffer.push({ event, args });
|
|
143
156
|
}
|
|
144
157
|
}
|
|
@@ -149,12 +162,32 @@ function setDevtoolsHook(hook, target) {
|
|
|
149
162
|
buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
|
|
150
163
|
buffer = [];
|
|
151
164
|
}
|
|
152
|
-
else
|
|
165
|
+
else if (
|
|
166
|
+
// handle late devtools injection - only do this if we are in an actual
|
|
167
|
+
// browser environment to avoid the timer handle stalling test runner exit
|
|
168
|
+
// (#4815)
|
|
169
|
+
// eslint-disable-next-line no-restricted-globals
|
|
170
|
+
typeof window !== 'undefined' &&
|
|
171
|
+
!navigator.userAgent.includes('jsdom')) {
|
|
153
172
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
154
173
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
155
174
|
replay.push((newHook) => {
|
|
156
175
|
setDevtoolsHook(newHook, target);
|
|
157
176
|
});
|
|
177
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
178
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
179
|
+
setTimeout(() => {
|
|
180
|
+
if (!devtools) {
|
|
181
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
182
|
+
devtoolsNotInstalled = true;
|
|
183
|
+
buffer = [];
|
|
184
|
+
}
|
|
185
|
+
}, 3000);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// non-browser env, assume not installed
|
|
189
|
+
devtoolsNotInstalled = true;
|
|
190
|
+
buffer = [];
|
|
158
191
|
}
|
|
159
192
|
}
|
|
160
193
|
function devtoolsInitApp(app, version) {
|
|
@@ -203,7 +236,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
203
236
|
}
|
|
204
237
|
else {
|
|
205
238
|
const validator = emitsOptions[event];
|
|
206
|
-
if (isFunction
|
|
239
|
+
if (isFunction(validator)) {
|
|
207
240
|
const isValid = validator(...rawArgs);
|
|
208
241
|
if (!isValid) {
|
|
209
242
|
warn(`Invalid event arguments: event validation failed for event "${event}".`);
|
|
@@ -273,7 +306,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
273
306
|
let normalized = {};
|
|
274
307
|
// apply mixin/extends props
|
|
275
308
|
let hasExtends = false;
|
|
276
|
-
if (__VUE_OPTIONS_API__ && !isFunction
|
|
309
|
+
if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
|
|
277
310
|
const extendEmits = (raw) => {
|
|
278
311
|
const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
|
|
279
312
|
if (normalizedFromExtend) {
|
|
@@ -723,7 +756,7 @@ const SuspenseImpl = {
|
|
|
723
756
|
const Suspense = (SuspenseImpl );
|
|
724
757
|
function triggerEvent(vnode, name) {
|
|
725
758
|
const eventListener = vnode.props && vnode.props[name];
|
|
726
|
-
if (isFunction
|
|
759
|
+
if (isFunction(eventListener)) {
|
|
727
760
|
eventListener();
|
|
728
761
|
}
|
|
729
762
|
}
|
|
@@ -1069,7 +1102,7 @@ function normalizeSuspenseChildren(vnode) {
|
|
|
1069
1102
|
}
|
|
1070
1103
|
function normalizeSuspenseSlot(s) {
|
|
1071
1104
|
let block;
|
|
1072
|
-
if (isFunction
|
|
1105
|
+
if (isFunction(s)) {
|
|
1073
1106
|
const trackBlock = isBlockTreeEnabled && s._c;
|
|
1074
1107
|
if (trackBlock) {
|
|
1075
1108
|
// disableTracking: false
|
|
@@ -1160,7 +1193,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
|
1160
1193
|
return provides[key];
|
|
1161
1194
|
}
|
|
1162
1195
|
else if (arguments.length > 1) {
|
|
1163
|
-
return treatDefaultAsFactory && isFunction
|
|
1196
|
+
return treatDefaultAsFactory && isFunction(defaultValue)
|
|
1164
1197
|
? defaultValue.call(instance.proxy)
|
|
1165
1198
|
: defaultValue;
|
|
1166
1199
|
}
|
|
@@ -1487,12 +1520,12 @@ function getTransitionRawChildren(children, keepComment = false) {
|
|
|
1487
1520
|
|
|
1488
1521
|
// implementation, close to no-op
|
|
1489
1522
|
function defineComponent(options) {
|
|
1490
|
-
return isFunction
|
|
1523
|
+
return isFunction(options) ? { setup: options, name: options.name } : options;
|
|
1491
1524
|
}
|
|
1492
1525
|
|
|
1493
1526
|
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
1494
1527
|
function defineAsyncComponent(source) {
|
|
1495
|
-
if (isFunction
|
|
1528
|
+
if (isFunction(source)) {
|
|
1496
1529
|
source = { loader: source };
|
|
1497
1530
|
}
|
|
1498
1531
|
const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out
|
|
@@ -1536,7 +1569,7 @@ function defineAsyncComponent(source) {
|
|
|
1536
1569
|
(comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
|
|
1537
1570
|
comp = comp.default;
|
|
1538
1571
|
}
|
|
1539
|
-
if ((process.env.NODE_ENV !== 'production') && comp && !isObject
|
|
1572
|
+
if ((process.env.NODE_ENV !== 'production') && comp && !isObject(comp) && !isFunction(comp)) {
|
|
1540
1573
|
throw new Error(`Invalid async component load result: ${comp}`);
|
|
1541
1574
|
}
|
|
1542
1575
|
resolvedComp = comp;
|
|
@@ -2022,7 +2055,7 @@ function applyOptions(instance) {
|
|
|
2022
2055
|
if (methods) {
|
|
2023
2056
|
for (const key in methods) {
|
|
2024
2057
|
const methodHandler = methods[key];
|
|
2025
|
-
if (isFunction
|
|
2058
|
+
if (isFunction(methodHandler)) {
|
|
2026
2059
|
// In dev mode, we use the `createRenderContext` function to define
|
|
2027
2060
|
// methods to the proxy target, and those are read-only but
|
|
2028
2061
|
// reconfigurable, so it needs to be redefined here
|
|
@@ -2048,17 +2081,17 @@ function applyOptions(instance) {
|
|
|
2048
2081
|
}
|
|
2049
2082
|
}
|
|
2050
2083
|
if (dataOptions) {
|
|
2051
|
-
if ((process.env.NODE_ENV !== 'production') && !isFunction
|
|
2084
|
+
if ((process.env.NODE_ENV !== 'production') && !isFunction(dataOptions)) {
|
|
2052
2085
|
warn(`The data option must be a function. ` +
|
|
2053
2086
|
`Plain object usage is no longer supported.`);
|
|
2054
2087
|
}
|
|
2055
2088
|
const data = dataOptions.call(publicThis, publicThis);
|
|
2056
|
-
if ((process.env.NODE_ENV !== 'production') && isPromise
|
|
2089
|
+
if ((process.env.NODE_ENV !== 'production') && isPromise(data)) {
|
|
2057
2090
|
warn(`data() returned a Promise - note data() cannot be async; If you ` +
|
|
2058
2091
|
`intend to perform data fetching before component renders, use ` +
|
|
2059
2092
|
`async setup() + <Suspense>.`);
|
|
2060
2093
|
}
|
|
2061
|
-
if (!isObject
|
|
2094
|
+
if (!isObject(data)) {
|
|
2062
2095
|
(process.env.NODE_ENV !== 'production') && warn(`data() should return an object.`);
|
|
2063
2096
|
}
|
|
2064
2097
|
else {
|
|
@@ -2084,15 +2117,15 @@ function applyOptions(instance) {
|
|
|
2084
2117
|
if (computedOptions) {
|
|
2085
2118
|
for (const key in computedOptions) {
|
|
2086
2119
|
const opt = computedOptions[key];
|
|
2087
|
-
const get = isFunction
|
|
2120
|
+
const get = isFunction(opt)
|
|
2088
2121
|
? opt.bind(publicThis, publicThis)
|
|
2089
|
-
: isFunction
|
|
2122
|
+
: isFunction(opt.get)
|
|
2090
2123
|
? opt.get.bind(publicThis, publicThis)
|
|
2091
2124
|
: NOOP;
|
|
2092
2125
|
if ((process.env.NODE_ENV !== 'production') && get === NOOP) {
|
|
2093
2126
|
warn(`Computed property "${key}" has no getter.`);
|
|
2094
2127
|
}
|
|
2095
|
-
const set = !isFunction
|
|
2128
|
+
const set = !isFunction(opt) && isFunction(opt.set)
|
|
2096
2129
|
? opt.set.bind(publicThis)
|
|
2097
2130
|
: (process.env.NODE_ENV !== 'production')
|
|
2098
2131
|
? () => {
|
|
@@ -2120,7 +2153,7 @@ function applyOptions(instance) {
|
|
|
2120
2153
|
}
|
|
2121
2154
|
}
|
|
2122
2155
|
if (provideOptions) {
|
|
2123
|
-
const provides = isFunction
|
|
2156
|
+
const provides = isFunction(provideOptions)
|
|
2124
2157
|
? provideOptions.call(publicThis)
|
|
2125
2158
|
: provideOptions;
|
|
2126
2159
|
Reflect.ownKeys(provides).forEach(key => {
|
|
@@ -2185,7 +2218,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
|
|
|
2185
2218
|
for (const key in injectOptions) {
|
|
2186
2219
|
const opt = injectOptions[key];
|
|
2187
2220
|
let injected;
|
|
2188
|
-
if (isObject
|
|
2221
|
+
if (isObject(opt)) {
|
|
2189
2222
|
if ('default' in opt) {
|
|
2190
2223
|
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
2191
2224
|
}
|
|
@@ -2236,25 +2269,25 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
2236
2269
|
: () => publicThis[key];
|
|
2237
2270
|
if (isString(raw)) {
|
|
2238
2271
|
const handler = ctx[raw];
|
|
2239
|
-
if (isFunction
|
|
2272
|
+
if (isFunction(handler)) {
|
|
2240
2273
|
watch(getter, handler);
|
|
2241
2274
|
}
|
|
2242
2275
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
2243
2276
|
warn(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
2244
2277
|
}
|
|
2245
2278
|
}
|
|
2246
|
-
else if (isFunction
|
|
2279
|
+
else if (isFunction(raw)) {
|
|
2247
2280
|
watch(getter, raw.bind(publicThis));
|
|
2248
2281
|
}
|
|
2249
|
-
else if (isObject
|
|
2282
|
+
else if (isObject(raw)) {
|
|
2250
2283
|
if (isArray(raw)) {
|
|
2251
2284
|
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
2252
2285
|
}
|
|
2253
2286
|
else {
|
|
2254
|
-
const handler = isFunction
|
|
2287
|
+
const handler = isFunction(raw.handler)
|
|
2255
2288
|
? raw.handler.bind(publicThis)
|
|
2256
2289
|
: ctx[raw.handler];
|
|
2257
|
-
if (isFunction
|
|
2290
|
+
if (isFunction(handler)) {
|
|
2258
2291
|
watch(getter, handler, raw);
|
|
2259
2292
|
}
|
|
2260
2293
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -2355,7 +2388,7 @@ function mergeDataFn(to, from) {
|
|
|
2355
2388
|
return from;
|
|
2356
2389
|
}
|
|
2357
2390
|
return function mergedDataFn() {
|
|
2358
|
-
return (extend)(isFunction
|
|
2391
|
+
return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
|
2359
2392
|
};
|
|
2360
2393
|
}
|
|
2361
2394
|
function mergeInject(to, from) {
|
|
@@ -2562,7 +2595,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
2562
2595
|
// default values
|
|
2563
2596
|
if (hasDefault && value === undefined) {
|
|
2564
2597
|
const defaultValue = opt.default;
|
|
2565
|
-
if (opt.type !== Function && isFunction
|
|
2598
|
+
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
2566
2599
|
const { propsDefaults } = instance;
|
|
2567
2600
|
if (key in propsDefaults) {
|
|
2568
2601
|
value = propsDefaults[key];
|
|
@@ -2601,7 +2634,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
2601
2634
|
const needCastKeys = [];
|
|
2602
2635
|
// apply mixin/extends props
|
|
2603
2636
|
let hasExtends = false;
|
|
2604
|
-
if (__VUE_OPTIONS_API__ && !isFunction
|
|
2637
|
+
if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
|
|
2605
2638
|
const extendProps = (raw) => {
|
|
2606
2639
|
hasExtends = true;
|
|
2607
2640
|
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
@@ -2635,7 +2668,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
2635
2668
|
}
|
|
2636
2669
|
}
|
|
2637
2670
|
else if (raw) {
|
|
2638
|
-
if ((process.env.NODE_ENV !== 'production') && !isObject
|
|
2671
|
+
if ((process.env.NODE_ENV !== 'production') && !isObject(raw)) {
|
|
2639
2672
|
warn(`invalid props options`, raw);
|
|
2640
2673
|
}
|
|
2641
2674
|
for (const key in raw) {
|
|
@@ -2643,7 +2676,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
2643
2676
|
if (validatePropName(normalizedKey)) {
|
|
2644
2677
|
const opt = raw[key];
|
|
2645
2678
|
const prop = (normalized[normalizedKey] =
|
|
2646
|
-
isArray(opt) || isFunction
|
|
2679
|
+
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
2647
2680
|
if (prop) {
|
|
2648
2681
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
2649
2682
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
@@ -2684,7 +2717,7 @@ function getTypeIndex(type, expectedTypes) {
|
|
|
2684
2717
|
if (isArray(expectedTypes)) {
|
|
2685
2718
|
return expectedTypes.findIndex(t => isSameType(t, type));
|
|
2686
2719
|
}
|
|
2687
|
-
else if (isFunction
|
|
2720
|
+
else if (isFunction(expectedTypes)) {
|
|
2688
2721
|
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
2689
2722
|
}
|
|
2690
2723
|
return -1;
|
|
@@ -2753,7 +2786,7 @@ function assertType(value, type) {
|
|
|
2753
2786
|
}
|
|
2754
2787
|
}
|
|
2755
2788
|
else if (expectedType === 'Object') {
|
|
2756
|
-
valid = isObject
|
|
2789
|
+
valid = isObject(value);
|
|
2757
2790
|
}
|
|
2758
2791
|
else if (expectedType === 'Array') {
|
|
2759
2792
|
valid = isArray(value);
|
|
@@ -2842,7 +2875,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
|
2842
2875
|
if (isInternalKey(key))
|
|
2843
2876
|
continue;
|
|
2844
2877
|
const value = rawSlots[key];
|
|
2845
|
-
if (isFunction
|
|
2878
|
+
if (isFunction(value)) {
|
|
2846
2879
|
slots[key] = normalizeSlot(key, value, ctx);
|
|
2847
2880
|
}
|
|
2848
2881
|
else if (value != null) {
|
|
@@ -2952,7 +2985,7 @@ return withDirectives(h(comp), [
|
|
|
2952
2985
|
[bar, this.y]
|
|
2953
2986
|
])
|
|
2954
2987
|
*/
|
|
2955
|
-
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
|
|
2988
|
+
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
|
2956
2989
|
function validateDirectiveName(name) {
|
|
2957
2990
|
if (isBuiltInDirective(name)) {
|
|
2958
2991
|
warn('Do not use built-in directive ids as custom directive id: ' + name);
|
|
@@ -2971,7 +3004,7 @@ function withDirectives(vnode, directives) {
|
|
|
2971
3004
|
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
2972
3005
|
for (let i = 0; i < directives.length; i++) {
|
|
2973
3006
|
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
|
2974
|
-
if (isFunction
|
|
3007
|
+
if (isFunction(dir)) {
|
|
2975
3008
|
dir = {
|
|
2976
3009
|
mounted: dir,
|
|
2977
3010
|
updated: dir
|
|
@@ -3039,7 +3072,7 @@ function createAppContext() {
|
|
|
3039
3072
|
let uid = 0;
|
|
3040
3073
|
function createAppAPI(render, hydrate) {
|
|
3041
3074
|
return function createApp(rootComponent, rootProps = null) {
|
|
3042
|
-
if (rootProps != null && !isObject
|
|
3075
|
+
if (rootProps != null && !isObject(rootProps)) {
|
|
3043
3076
|
(process.env.NODE_ENV !== 'production') && warn(`root props passed to app.mount() must be an object.`);
|
|
3044
3077
|
rootProps = null;
|
|
3045
3078
|
}
|
|
@@ -3066,11 +3099,11 @@ function createAppAPI(render, hydrate) {
|
|
|
3066
3099
|
if (installedPlugins.has(plugin)) {
|
|
3067
3100
|
(process.env.NODE_ENV !== 'production') && warn(`Plugin has already been applied to target app.`);
|
|
3068
3101
|
}
|
|
3069
|
-
else if (plugin && isFunction
|
|
3102
|
+
else if (plugin && isFunction(plugin.install)) {
|
|
3070
3103
|
installedPlugins.add(plugin);
|
|
3071
3104
|
plugin.install(app, ...options);
|
|
3072
3105
|
}
|
|
3073
|
-
else if (isFunction
|
|
3106
|
+
else if (isFunction(plugin)) {
|
|
3074
3107
|
installedPlugins.add(plugin);
|
|
3075
3108
|
plugin(app, ...options);
|
|
3076
3109
|
}
|
|
@@ -4897,7 +4930,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4897
4930
|
doSet();
|
|
4898
4931
|
}
|
|
4899
4932
|
}
|
|
4900
|
-
else if (isFunction
|
|
4933
|
+
else if (isFunction(ref)) {
|
|
4901
4934
|
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4902
4935
|
}
|
|
4903
4936
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -5374,7 +5407,7 @@ const InternalObjectKey = `__vInternal`;
|
|
|
5374
5407
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
5375
5408
|
const normalizeRef = ({ ref }) => {
|
|
5376
5409
|
return (ref != null
|
|
5377
|
-
? isString(ref) || isRef(ref) || isFunction
|
|
5410
|
+
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
5378
5411
|
? { i: currentRenderingInstance, r: ref }
|
|
5379
5412
|
: ref
|
|
5380
5413
|
: null);
|
|
@@ -5473,7 +5506,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5473
5506
|
if (klass && !isString(klass)) {
|
|
5474
5507
|
props.class = normalizeClass(klass);
|
|
5475
5508
|
}
|
|
5476
|
-
if (isObject
|
|
5509
|
+
if (isObject(style)) {
|
|
5477
5510
|
// reactive state objects need to be cloned since they are likely to be
|
|
5478
5511
|
// mutated
|
|
5479
5512
|
if (isProxy(style) && !isArray(style)) {
|
|
@@ -5489,9 +5522,9 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5489
5522
|
? 128 /* SUSPENSE */
|
|
5490
5523
|
: isTeleport(type)
|
|
5491
5524
|
? 64 /* TELEPORT */
|
|
5492
|
-
: isObject
|
|
5525
|
+
: isObject(type)
|
|
5493
5526
|
? 4 /* STATEFUL_COMPONENT */
|
|
5494
|
-
: isFunction
|
|
5527
|
+
: isFunction(type)
|
|
5495
5528
|
? 2 /* FUNCTIONAL_COMPONENT */
|
|
5496
5529
|
: 0;
|
|
5497
5530
|
if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
@@ -5670,7 +5703,7 @@ function normalizeChildren(vnode, children) {
|
|
|
5670
5703
|
}
|
|
5671
5704
|
}
|
|
5672
5705
|
}
|
|
5673
|
-
else if (isFunction
|
|
5706
|
+
else if (isFunction(children)) {
|
|
5674
5707
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
5675
5708
|
type = 32 /* SLOTS_CHILDREN */;
|
|
5676
5709
|
}
|
|
@@ -5740,7 +5773,7 @@ function renderList(source, renderItem, cache, index) {
|
|
|
5740
5773
|
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
5741
5774
|
}
|
|
5742
5775
|
}
|
|
5743
|
-
else if (isObject
|
|
5776
|
+
else if (isObject(source)) {
|
|
5744
5777
|
if (source[Symbol.iterator]) {
|
|
5745
5778
|
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
5746
5779
|
}
|
|
@@ -5842,7 +5875,7 @@ function ensureValidVNode(vnodes) {
|
|
|
5842
5875
|
*/
|
|
5843
5876
|
function toHandlers(obj) {
|
|
5844
5877
|
const ret = {};
|
|
5845
|
-
if ((process.env.NODE_ENV !== 'production') && !isObject
|
|
5878
|
+
if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
|
|
5846
5879
|
warn(`v-on with no argument expects an object value.`);
|
|
5847
5880
|
return ret;
|
|
5848
5881
|
}
|
|
@@ -6277,7 +6310,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6277
6310
|
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
|
|
6278
6311
|
resetTracking();
|
|
6279
6312
|
unsetCurrentInstance();
|
|
6280
|
-
if (isPromise
|
|
6313
|
+
if (isPromise(setupResult)) {
|
|
6281
6314
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
6282
6315
|
if (isSSR) {
|
|
6283
6316
|
// return the promise so server-renderer can wait on it
|
|
@@ -6304,7 +6337,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6304
6337
|
}
|
|
6305
6338
|
}
|
|
6306
6339
|
function handleSetupResult(instance, setupResult, isSSR) {
|
|
6307
|
-
if (isFunction
|
|
6340
|
+
if (isFunction(setupResult)) {
|
|
6308
6341
|
// setup returned an inline render function
|
|
6309
6342
|
if (instance.type.__ssrInlineRender) {
|
|
6310
6343
|
// when the function's name is `ssrRender` (compiled by SFC inline mode),
|
|
@@ -6315,7 +6348,7 @@ function handleSetupResult(instance, setupResult, isSSR) {
|
|
|
6315
6348
|
instance.render = setupResult;
|
|
6316
6349
|
}
|
|
6317
6350
|
}
|
|
6318
|
-
else if (isObject
|
|
6351
|
+
else if (isObject(setupResult)) {
|
|
6319
6352
|
if ((process.env.NODE_ENV !== 'production') && isVNode(setupResult)) {
|
|
6320
6353
|
warn(`setup() should not return VNodes directly - ` +
|
|
6321
6354
|
`return a render function instead.`);
|
|
@@ -6484,7 +6517,7 @@ function getExposeProxy(instance) {
|
|
|
6484
6517
|
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
6485
6518
|
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
6486
6519
|
function getComponentName(Component) {
|
|
6487
|
-
return isFunction
|
|
6520
|
+
return isFunction(Component)
|
|
6488
6521
|
? Component.displayName || Component.name
|
|
6489
6522
|
: Component.name;
|
|
6490
6523
|
}
|
|
@@ -6513,7 +6546,7 @@ function formatComponentName(instance, Component, isRoot = false) {
|
|
|
6513
6546
|
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
6514
6547
|
}
|
|
6515
6548
|
function isClassComponent(value) {
|
|
6516
|
-
return isFunction
|
|
6549
|
+
return isFunction(value) && '__vccOpts' in value;
|
|
6517
6550
|
}
|
|
6518
6551
|
|
|
6519
6552
|
const stack = [];
|
|
@@ -6621,7 +6654,7 @@ function formatProp(key, value, raw) {
|
|
|
6621
6654
|
value = formatProp(key, toRaw(value.value), true);
|
|
6622
6655
|
return raw ? value : [`${key}=Ref<`, value, `>`];
|
|
6623
6656
|
}
|
|
6624
|
-
else if (isFunction
|
|
6657
|
+
else if (isFunction(value)) {
|
|
6625
6658
|
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
|
6626
6659
|
}
|
|
6627
6660
|
else {
|
|
@@ -6673,9 +6706,9 @@ function callWithErrorHandling(fn, instance, type, args) {
|
|
|
6673
6706
|
return res;
|
|
6674
6707
|
}
|
|
6675
6708
|
function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
6676
|
-
if (isFunction
|
|
6709
|
+
if (isFunction(fn)) {
|
|
6677
6710
|
const res = callWithErrorHandling(fn, instance, type, args);
|
|
6678
|
-
if (res && isPromise
|
|
6711
|
+
if (res && isPromise(res)) {
|
|
6679
6712
|
res.catch(err => {
|
|
6680
6713
|
handleError(err, instance, type);
|
|
6681
6714
|
});
|
|
@@ -6963,7 +6996,7 @@ function watchSyncEffect(effect, options) {
|
|
|
6963
6996
|
const INITIAL_WATCHER_VALUE = {};
|
|
6964
6997
|
// implementation
|
|
6965
6998
|
function watch(source, cb, options) {
|
|
6966
|
-
if ((process.env.NODE_ENV !== 'production') && !isFunction
|
|
6999
|
+
if ((process.env.NODE_ENV !== 'production') && !isFunction(cb)) {
|
|
6967
7000
|
warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
|
|
6968
7001
|
`Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
|
|
6969
7002
|
`supports \`watch(source, cb, options?) signature.`);
|
|
@@ -7007,7 +7040,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
7007
7040
|
else if (isReactive(s)) {
|
|
7008
7041
|
return traverse(s);
|
|
7009
7042
|
}
|
|
7010
|
-
else if (isFunction
|
|
7043
|
+
else if (isFunction(s)) {
|
|
7011
7044
|
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
7012
7045
|
}
|
|
7013
7046
|
else {
|
|
@@ -7015,7 +7048,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
7015
7048
|
}
|
|
7016
7049
|
});
|
|
7017
7050
|
}
|
|
7018
|
-
else if (isFunction
|
|
7051
|
+
else if (isFunction(source)) {
|
|
7019
7052
|
if (cb) {
|
|
7020
7053
|
// getter with cb
|
|
7021
7054
|
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
@@ -7155,7 +7188,7 @@ function instanceWatch(source, value, options) {
|
|
|
7155
7188
|
: () => publicThis[source]
|
|
7156
7189
|
: source.bind(publicThis, publicThis);
|
|
7157
7190
|
let cb;
|
|
7158
|
-
if (isFunction
|
|
7191
|
+
if (isFunction(value)) {
|
|
7159
7192
|
cb = value;
|
|
7160
7193
|
}
|
|
7161
7194
|
else {
|
|
@@ -7184,7 +7217,7 @@ function createPathGetter(ctx, path) {
|
|
|
7184
7217
|
};
|
|
7185
7218
|
}
|
|
7186
7219
|
function traverse(value, seen) {
|
|
7187
|
-
if (!isObject
|
|
7220
|
+
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
7188
7221
|
return value;
|
|
7189
7222
|
}
|
|
7190
7223
|
seen = seen || new Set();
|
|
@@ -7213,16 +7246,6 @@ function traverse(value, seen) {
|
|
|
7213
7246
|
return value;
|
|
7214
7247
|
}
|
|
7215
7248
|
|
|
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
7249
|
// dev only
|
|
7227
7250
|
const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
|
|
7228
7251
|
`<script setup> of a single file component. Its arguments should be ` +
|
|
@@ -7300,15 +7323,21 @@ function getContext() {
|
|
|
7300
7323
|
* only.
|
|
7301
7324
|
* @internal
|
|
7302
7325
|
*/
|
|
7303
|
-
function mergeDefaults(
|
|
7304
|
-
|
|
7305
|
-
|
|
7326
|
+
function mergeDefaults(raw, defaults) {
|
|
7327
|
+
const props = isArray(raw)
|
|
7328
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
7329
|
+
: raw;
|
|
7306
7330
|
for (const key in defaults) {
|
|
7307
|
-
const
|
|
7308
|
-
if (
|
|
7309
|
-
|
|
7331
|
+
const opt = props[key];
|
|
7332
|
+
if (opt) {
|
|
7333
|
+
if (isArray(opt) || isFunction(opt)) {
|
|
7334
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
7335
|
+
}
|
|
7336
|
+
else {
|
|
7337
|
+
opt.default = defaults[key];
|
|
7338
|
+
}
|
|
7310
7339
|
}
|
|
7311
|
-
else if (
|
|
7340
|
+
else if (opt === null) {
|
|
7312
7341
|
props[key] = { default: defaults[key] };
|
|
7313
7342
|
}
|
|
7314
7343
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -7317,6 +7346,23 @@ props, defaults) {
|
|
|
7317
7346
|
}
|
|
7318
7347
|
return props;
|
|
7319
7348
|
}
|
|
7349
|
+
/**
|
|
7350
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
7351
|
+
* defineProps().
|
|
7352
|
+
* @internal
|
|
7353
|
+
*/
|
|
7354
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
7355
|
+
const ret = {};
|
|
7356
|
+
for (const key in props) {
|
|
7357
|
+
if (!excludedKeys.includes(key)) {
|
|
7358
|
+
Object.defineProperty(ret, key, {
|
|
7359
|
+
enumerable: true,
|
|
7360
|
+
get: () => props[key]
|
|
7361
|
+
});
|
|
7362
|
+
}
|
|
7363
|
+
}
|
|
7364
|
+
return ret;
|
|
7365
|
+
}
|
|
7320
7366
|
/**
|
|
7321
7367
|
* `<script setup>` helper for persisting the current instance context over
|
|
7322
7368
|
* async/await flows.
|
|
@@ -7356,7 +7402,7 @@ function withAsyncContext(getAwaitable) {
|
|
|
7356
7402
|
function h(type, propsOrChildren, children) {
|
|
7357
7403
|
const l = arguments.length;
|
|
7358
7404
|
if (l === 2) {
|
|
7359
|
-
if (isObject
|
|
7405
|
+
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
|
7360
7406
|
// single vnode without props
|
|
7361
7407
|
if (isVNode(propsOrChildren)) {
|
|
7362
7408
|
return createVNode(type, null, [propsOrChildren]);
|
|
@@ -7406,7 +7452,7 @@ function initCustomFormatter() {
|
|
|
7406
7452
|
const formatter = {
|
|
7407
7453
|
header(obj) {
|
|
7408
7454
|
// TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
|
|
7409
|
-
if (!isObject
|
|
7455
|
+
if (!isObject(obj)) {
|
|
7410
7456
|
return null;
|
|
7411
7457
|
}
|
|
7412
7458
|
if (obj.__isVue) {
|
|
@@ -7531,7 +7577,7 @@ function initCustomFormatter() {
|
|
|
7531
7577
|
else if (typeof v === 'boolean') {
|
|
7532
7578
|
return ['span', keywordStyle, v];
|
|
7533
7579
|
}
|
|
7534
|
-
else if (isObject
|
|
7580
|
+
else if (isObject(v)) {
|
|
7535
7581
|
return ['object', { object: asRaw ? toRaw(v) : v }];
|
|
7536
7582
|
}
|
|
7537
7583
|
else {
|
|
@@ -7540,7 +7586,7 @@ function initCustomFormatter() {
|
|
|
7540
7586
|
}
|
|
7541
7587
|
function extractKeys(instance, type) {
|
|
7542
7588
|
const Comp = instance.type;
|
|
7543
|
-
if (isFunction
|
|
7589
|
+
if (isFunction(Comp)) {
|
|
7544
7590
|
return;
|
|
7545
7591
|
}
|
|
7546
7592
|
const extracted = {};
|
|
@@ -7554,7 +7600,7 @@ function initCustomFormatter() {
|
|
|
7554
7600
|
function isKeyOfType(Comp, key, type) {
|
|
7555
7601
|
const opts = Comp[type];
|
|
7556
7602
|
if ((isArray(opts) && opts.includes(key)) ||
|
|
7557
|
-
(isObject
|
|
7603
|
+
(isObject(opts) && key in opts)) {
|
|
7558
7604
|
return true;
|
|
7559
7605
|
}
|
|
7560
7606
|
if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
|
@@ -7609,7 +7655,7 @@ function isMemoSame(cached, memo) {
|
|
|
7609
7655
|
}
|
|
7610
7656
|
|
|
7611
7657
|
// Core API ------------------------------------------------------------------
|
|
7612
|
-
const version = "3.2.
|
|
7658
|
+
const version = "3.2.21";
|
|
7613
7659
|
const _ssrUtils = {
|
|
7614
7660
|
createComponentInstance,
|
|
7615
7661
|
setupComponent,
|
|
@@ -7632,4 +7678,4 @@ const resolveFilter = null;
|
|
|
7632
7678
|
*/
|
|
7633
7679
|
const compatUtils = (null);
|
|
7634
7680
|
|
|
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 };
|
|
7681
|
+
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.21",
|
|
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.21",
|
|
36
|
+
"@vue/reactivity": "3.2.21"
|
|
37
37
|
}
|
|
38
38
|
}
|