@vue/runtime-core 3.2.18 → 3.2.22

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.
@@ -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, new Set());
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
- [...record].forEach(instance => {
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
- shared.extend(oldComp, newComp);
75
- for (const key in oldComp) {
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,27 +147,52 @@ 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
  }
146
159
  function setDevtoolsHook(hook, target) {
160
+ var _a, _b;
147
161
  exports.devtools = hook;
148
162
  if (exports.devtools) {
149
163
  exports.devtools.enabled = true;
150
164
  buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
151
165
  buffer = [];
152
166
  }
153
- else {
167
+ else if (
168
+ // handle late devtools injection - only do this if we are in an actual
169
+ // browser environment to avoid the timer handle stalling test runner exit
170
+ // (#4815)
171
+ // eslint-disable-next-line no-restricted-globals
172
+ typeof window !== 'undefined' &&
173
+ // some envs mock window but not fully
174
+ window.HTMLElement &&
175
+ // also exclude jsdom
176
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
154
177
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
155
178
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
156
179
  replay.push((newHook) => {
157
180
  setDevtoolsHook(newHook, target);
158
181
  });
182
+ // clear buffer after 3s - the user probably doesn't have devtools installed
183
+ // at all, and keeping the buffer will cause memory leaks (#4738)
184
+ setTimeout(() => {
185
+ if (!exports.devtools) {
186
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
187
+ devtoolsNotInstalled = true;
188
+ buffer = [];
189
+ }
190
+ }, 3000);
191
+ }
192
+ else {
193
+ // non-browser env, assume not installed
194
+ devtoolsNotInstalled = true;
195
+ buffer = [];
159
196
  }
160
197
  }
161
198
  function devtoolsInitApp(app, version) {
@@ -2944,7 +2981,7 @@ return withDirectives(h(comp), [
2944
2981
  [bar, this.y]
2945
2982
  ])
2946
2983
  */
2947
- const isBuiltInDirective = /*#__PURE__*/ shared.makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
2984
+ const isBuiltInDirective = /*#__PURE__*/ shared.makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
2948
2985
  function validateDirectiveName(name) {
2949
2986
  if (isBuiltInDirective(name)) {
2950
2987
  warn('Do not use built-in directive ids as custom directive id: ' + name);
@@ -4861,8 +4898,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
4861
4898
  *
4862
4899
  * #2080
4863
4900
  * Inside keyed `template` fragment static children, if a fragment is moved,
4864
- * the children will always moved so that need inherit el form previous nodes
4865
- * to ensure correct moved position.
4901
+ * the children will always be moved. Therefore, in order to ensure correct move
4902
+ * position, el should be inherited from previous nodes.
4866
4903
  */
4867
4904
  function traverseStaticChildren(n1, n2, shallow = false) {
4868
4905
  const ch1 = n1.children;
@@ -5642,7 +5679,8 @@ function mergeProps(...args) {
5642
5679
  else if (shared.isOn(key)) {
5643
5680
  const existing = ret[key];
5644
5681
  const incoming = toMerge[key];
5645
- if (existing !== incoming) {
5682
+ if (existing !== incoming &&
5683
+ !(shared.isArray(existing) && existing.includes(incoming))) {
5646
5684
  ret[key] = existing
5647
5685
  ? [].concat(existing, incoming)
5648
5686
  : incoming;
@@ -7118,15 +7156,6 @@ function traverse(value, seen) {
7118
7156
  return value;
7119
7157
  }
7120
7158
 
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
7159
  // dev only
7131
7160
  const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
7132
7161
  `<script setup> of a single file component. Its arguments should be ` +
@@ -7204,15 +7233,21 @@ function getContext() {
7204
7233
  * only.
7205
7234
  * @internal
7206
7235
  */
7207
- function mergeDefaults(
7208
- // the base props is compiler-generated and guaranteed to be in this shape.
7209
- props, defaults) {
7236
+ function mergeDefaults(raw, defaults) {
7237
+ const props = shared.isArray(raw)
7238
+ ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
7239
+ : raw;
7210
7240
  for (const key in defaults) {
7211
- const val = props[key];
7212
- if (val) {
7213
- val.default = defaults[key];
7241
+ const opt = props[key];
7242
+ if (opt) {
7243
+ if (shared.isArray(opt) || shared.isFunction(opt)) {
7244
+ props[key] = { type: opt, default: defaults[key] };
7245
+ }
7246
+ else {
7247
+ opt.default = defaults[key];
7248
+ }
7214
7249
  }
7215
- else if (val === null) {
7250
+ else if (opt === null) {
7216
7251
  props[key] = { default: defaults[key] };
7217
7252
  }
7218
7253
  else {
@@ -7221,6 +7256,23 @@ props, defaults) {
7221
7256
  }
7222
7257
  return props;
7223
7258
  }
7259
+ /**
7260
+ * Used to create a proxy for the rest element when destructuring props with
7261
+ * defineProps().
7262
+ * @internal
7263
+ */
7264
+ function createPropsRestProxy(props, excludedKeys) {
7265
+ const ret = {};
7266
+ for (const key in props) {
7267
+ if (!excludedKeys.includes(key)) {
7268
+ Object.defineProperty(ret, key, {
7269
+ enumerable: true,
7270
+ get: () => props[key]
7271
+ });
7272
+ }
7273
+ }
7274
+ return ret;
7275
+ }
7224
7276
  /**
7225
7277
  * `<script setup>` helper for persisting the current instance context over
7226
7278
  * async/await flows.
@@ -7247,7 +7299,7 @@ function withAsyncContext(getAwaitable) {
7247
7299
  }
7248
7300
  let awaitable = getAwaitable();
7249
7301
  unsetCurrentInstance();
7250
- if (isPromise(awaitable)) {
7302
+ if (shared.isPromise(awaitable)) {
7251
7303
  awaitable = awaitable.catch(e => {
7252
7304
  setCurrentInstance(ctx);
7253
7305
  throw e;
@@ -7513,7 +7565,7 @@ function isMemoSame(cached, memo) {
7513
7565
  }
7514
7566
 
7515
7567
  // Core API ------------------------------------------------------------------
7516
- const version = "3.2.18";
7568
+ const version = "3.2.22";
7517
7569
  const _ssrUtils = {
7518
7570
  createComponentInstance,
7519
7571
  setupComponent,
@@ -7586,6 +7638,7 @@ exports.createCommentVNode = createCommentVNode;
7586
7638
  exports.createElementBlock = createElementBlock;
7587
7639
  exports.createElementVNode = createBaseVNode;
7588
7640
  exports.createHydrationRenderer = createHydrationRenderer;
7641
+ exports.createPropsRestProxy = createPropsRestProxy;
7589
7642
  exports.createRenderer = createRenderer;
7590
7643
  exports.createSlots = createSlots;
7591
7644
  exports.createStaticVNode = createStaticVNode;
@@ -7,18 +7,39 @@ var shared = require('@vue/shared');
7
7
 
8
8
  let buffer = [];
9
9
  function setDevtoolsHook(hook, target) {
10
+ var _a, _b;
10
11
  exports.devtools = hook;
11
12
  if (exports.devtools) {
12
13
  exports.devtools.enabled = true;
13
14
  buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
14
15
  buffer = [];
15
16
  }
16
- else {
17
+ else if (
18
+ // handle late devtools injection - only do this if we are in an actual
19
+ // browser environment to avoid the timer handle stalling test runner exit
20
+ // (#4815)
21
+ // eslint-disable-next-line no-restricted-globals
22
+ typeof window !== 'undefined' &&
23
+ // some envs mock window but not fully
24
+ window.HTMLElement &&
25
+ // also exclude jsdom
26
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
17
27
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
18
28
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
19
29
  replay.push((newHook) => {
20
30
  setDevtoolsHook(newHook, target);
21
31
  });
32
+ // clear buffer after 3s - the user probably doesn't have devtools installed
33
+ // at all, and keeping the buffer will cause memory leaks (#4738)
34
+ setTimeout(() => {
35
+ if (!exports.devtools) {
36
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
37
+ buffer = [];
38
+ }
39
+ }, 3000);
40
+ }
41
+ else {
42
+ buffer = [];
22
43
  }
23
44
  }
24
45
 
@@ -3958,8 +3979,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
3958
3979
  *
3959
3980
  * #2080
3960
3981
  * Inside keyed `template` fragment static children, if a fragment is moved,
3961
- * the children will always moved so that need inherit el form previous nodes
3962
- * to ensure correct moved position.
3982
+ * the children will always be moved. Therefore, in order to ensure correct move
3983
+ * position, el should be inherited from previous nodes.
3963
3984
  */
3964
3985
  function traverseStaticChildren(n1, n2, shallow = false) {
3965
3986
  const ch1 = n1.children;
@@ -4659,7 +4680,8 @@ function mergeProps(...args) {
4659
4680
  else if (shared.isOn(key)) {
4660
4681
  const existing = ret[key];
4661
4682
  const incoming = toMerge[key];
4662
- if (existing !== incoming) {
4683
+ if (existing !== incoming &&
4684
+ !(shared.isArray(existing) && existing.includes(incoming))) {
4663
4685
  ret[key] = existing
4664
4686
  ? [].concat(existing, incoming)
4665
4687
  : incoming;
@@ -5811,12 +5833,6 @@ function traverse(value, seen) {
5811
5833
  return value;
5812
5834
  }
5813
5835
 
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
5836
  // implementation
5821
5837
  function defineProps() {
5822
5838
  return null;
@@ -5875,21 +5891,44 @@ function getContext() {
5875
5891
  * only.
5876
5892
  * @internal
5877
5893
  */
5878
- function mergeDefaults(
5879
- // the base props is compiler-generated and guaranteed to be in this shape.
5880
- props, defaults) {
5894
+ function mergeDefaults(raw, defaults) {
5895
+ const props = shared.isArray(raw)
5896
+ ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
5897
+ : raw;
5881
5898
  for (const key in defaults) {
5882
- const val = props[key];
5883
- if (val) {
5884
- val.default = defaults[key];
5899
+ const opt = props[key];
5900
+ if (opt) {
5901
+ if (shared.isArray(opt) || shared.isFunction(opt)) {
5902
+ props[key] = { type: opt, default: defaults[key] };
5903
+ }
5904
+ else {
5905
+ opt.default = defaults[key];
5906
+ }
5885
5907
  }
5886
- else if (val === null) {
5908
+ else if (opt === null) {
5887
5909
  props[key] = { default: defaults[key] };
5888
5910
  }
5889
5911
  else ;
5890
5912
  }
5891
5913
  return props;
5892
5914
  }
5915
+ /**
5916
+ * Used to create a proxy for the rest element when destructuring props with
5917
+ * defineProps().
5918
+ * @internal
5919
+ */
5920
+ function createPropsRestProxy(props, excludedKeys) {
5921
+ const ret = {};
5922
+ for (const key in props) {
5923
+ if (!excludedKeys.includes(key)) {
5924
+ Object.defineProperty(ret, key, {
5925
+ enumerable: true,
5926
+ get: () => props[key]
5927
+ });
5928
+ }
5929
+ }
5930
+ return ret;
5931
+ }
5893
5932
  /**
5894
5933
  * `<script setup>` helper for persisting the current instance context over
5895
5934
  * async/await flows.
@@ -5912,7 +5951,7 @@ function withAsyncContext(getAwaitable) {
5912
5951
  const ctx = getCurrentInstance();
5913
5952
  let awaitable = getAwaitable();
5914
5953
  unsetCurrentInstance();
5915
- if (isPromise(awaitable)) {
5954
+ if (shared.isPromise(awaitable)) {
5916
5955
  awaitable = awaitable.catch(e => {
5917
5956
  setCurrentInstance(ctx);
5918
5957
  throw e;
@@ -5996,7 +6035,7 @@ function isMemoSame(cached, memo) {
5996
6035
  }
5997
6036
 
5998
6037
  // Core API ------------------------------------------------------------------
5999
- const version = "3.2.18";
6038
+ const version = "3.2.22";
6000
6039
  const _ssrUtils = {
6001
6040
  createComponentInstance,
6002
6041
  setupComponent,
@@ -6069,6 +6108,7 @@ exports.createCommentVNode = createCommentVNode;
6069
6108
  exports.createElementBlock = createElementBlock;
6070
6109
  exports.createElementVNode = createBaseVNode;
6071
6110
  exports.createHydrationRenderer = createHydrationRenderer;
6111
+ exports.createPropsRestProxy = createPropsRestProxy;
6072
6112
  exports.createRenderer = createRenderer;
6073
6113
  exports.createSlots = createSlots;
6074
6114
  exports.createStaticVNode = createStaticVNode;
@@ -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
- declare function createRecord(id: string): boolean;
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:
@@ -941,8 +945,10 @@ export declare interface HydrationRenderer extends Renderer<Element | ShadowRoot
941
945
  hydrate: RootHydrateFunction;
942
946
  }
943
947
 
948
+ declare type InferDefault<P, T> = T extends number | string | boolean | symbol | Function ? T : (props: P) => T;
949
+
944
950
  declare type InferDefaults<T> = {
945
- [K in keyof T]?: NotUndefined<T[K]> extends number | string | boolean | symbol | Function ? NotUndefined<T[K]> : (props: T) => NotUndefined<T[K]>;
951
+ [K in keyof T]?: InferDefault<T, NotUndefined<T[K]>>;
946
952
  };
947
953
 
948
954
  declare type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
@@ -1592,6 +1598,8 @@ export declare interface SetupContext<E = EmitsOptions> {
1592
1598
 
1593
1599
  declare type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, optimized: boolean) => void;
1594
1600
 
1601
+ export { ShallowReactive }
1602
+
1595
1603
  export { shallowReactive }
1596
1604
 
1597
1605
  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 as isFunction$1, toNumber, hyphenate, camelize, isArray, isOn, hasOwn, isModelListener, isObject as isObject$1, remove, isString, invokeArrayFns, isPromise as isPromise$1, NOOP, def, isReservedProp, EMPTY_ARR, capitalize, toRawType, makeMap, NO, normalizeClass, normalizeStyle, isGloballyWhitelisted, hasChanged, isSet, isMap, isPlainObject } from '@vue/shared';
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, new Set());
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
- [...record].forEach(instance => {
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
- extend(oldComp, newComp);
73
- for (const key in oldComp) {
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,27 +146,52 @@ 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
  }
145
158
  function setDevtoolsHook(hook, target) {
159
+ var _a, _b;
146
160
  devtools = hook;
147
161
  if (devtools) {
148
162
  devtools.enabled = true;
149
163
  buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
150
164
  buffer = [];
151
165
  }
152
- 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
+ // some envs mock window but not fully
173
+ window.HTMLElement &&
174
+ // also exclude jsdom
175
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
153
176
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
154
177
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
155
178
  replay.push((newHook) => {
156
179
  setDevtoolsHook(newHook, target);
157
180
  });
181
+ // clear buffer after 3s - the user probably doesn't have devtools installed
182
+ // at all, and keeping the buffer will cause memory leaks (#4738)
183
+ setTimeout(() => {
184
+ if (!devtools) {
185
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
186
+ devtoolsNotInstalled = true;
187
+ buffer = [];
188
+ }
189
+ }, 3000);
190
+ }
191
+ else {
192
+ // non-browser env, assume not installed
193
+ devtoolsNotInstalled = true;
194
+ buffer = [];
158
195
  }
159
196
  }
160
197
  function devtoolsInitApp(app, version) {
@@ -203,7 +240,7 @@ function emit$1(instance, event, ...rawArgs) {
203
240
  }
204
241
  else {
205
242
  const validator = emitsOptions[event];
206
- if (isFunction$1(validator)) {
243
+ if (isFunction(validator)) {
207
244
  const isValid = validator(...rawArgs);
208
245
  if (!isValid) {
209
246
  warn(`Invalid event arguments: event validation failed for event "${event}".`);
@@ -273,7 +310,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
273
310
  let normalized = {};
274
311
  // apply mixin/extends props
275
312
  let hasExtends = false;
276
- if (__VUE_OPTIONS_API__ && !isFunction$1(comp)) {
313
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
277
314
  const extendEmits = (raw) => {
278
315
  const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
279
316
  if (normalizedFromExtend) {
@@ -723,7 +760,7 @@ const SuspenseImpl = {
723
760
  const Suspense = (SuspenseImpl );
724
761
  function triggerEvent(vnode, name) {
725
762
  const eventListener = vnode.props && vnode.props[name];
726
- if (isFunction$1(eventListener)) {
763
+ if (isFunction(eventListener)) {
727
764
  eventListener();
728
765
  }
729
766
  }
@@ -1069,7 +1106,7 @@ function normalizeSuspenseChildren(vnode) {
1069
1106
  }
1070
1107
  function normalizeSuspenseSlot(s) {
1071
1108
  let block;
1072
- if (isFunction$1(s)) {
1109
+ if (isFunction(s)) {
1073
1110
  const trackBlock = isBlockTreeEnabled && s._c;
1074
1111
  if (trackBlock) {
1075
1112
  // disableTracking: false
@@ -1160,7 +1197,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
1160
1197
  return provides[key];
1161
1198
  }
1162
1199
  else if (arguments.length > 1) {
1163
- return treatDefaultAsFactory && isFunction$1(defaultValue)
1200
+ return treatDefaultAsFactory && isFunction(defaultValue)
1164
1201
  ? defaultValue.call(instance.proxy)
1165
1202
  : defaultValue;
1166
1203
  }
@@ -1487,12 +1524,12 @@ function getTransitionRawChildren(children, keepComment = false) {
1487
1524
 
1488
1525
  // implementation, close to no-op
1489
1526
  function defineComponent(options) {
1490
- return isFunction$1(options) ? { setup: options, name: options.name } : options;
1527
+ return isFunction(options) ? { setup: options, name: options.name } : options;
1491
1528
  }
1492
1529
 
1493
1530
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1494
1531
  function defineAsyncComponent(source) {
1495
- if (isFunction$1(source)) {
1532
+ if (isFunction(source)) {
1496
1533
  source = { loader: source };
1497
1534
  }
1498
1535
  const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out
@@ -1536,7 +1573,7 @@ function defineAsyncComponent(source) {
1536
1573
  (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
1537
1574
  comp = comp.default;
1538
1575
  }
1539
- if ((process.env.NODE_ENV !== 'production') && comp && !isObject$1(comp) && !isFunction$1(comp)) {
1576
+ if ((process.env.NODE_ENV !== 'production') && comp && !isObject(comp) && !isFunction(comp)) {
1540
1577
  throw new Error(`Invalid async component load result: ${comp}`);
1541
1578
  }
1542
1579
  resolvedComp = comp;
@@ -2022,7 +2059,7 @@ function applyOptions(instance) {
2022
2059
  if (methods) {
2023
2060
  for (const key in methods) {
2024
2061
  const methodHandler = methods[key];
2025
- if (isFunction$1(methodHandler)) {
2062
+ if (isFunction(methodHandler)) {
2026
2063
  // In dev mode, we use the `createRenderContext` function to define
2027
2064
  // methods to the proxy target, and those are read-only but
2028
2065
  // reconfigurable, so it needs to be redefined here
@@ -2048,17 +2085,17 @@ function applyOptions(instance) {
2048
2085
  }
2049
2086
  }
2050
2087
  if (dataOptions) {
2051
- if ((process.env.NODE_ENV !== 'production') && !isFunction$1(dataOptions)) {
2088
+ if ((process.env.NODE_ENV !== 'production') && !isFunction(dataOptions)) {
2052
2089
  warn(`The data option must be a function. ` +
2053
2090
  `Plain object usage is no longer supported.`);
2054
2091
  }
2055
2092
  const data = dataOptions.call(publicThis, publicThis);
2056
- if ((process.env.NODE_ENV !== 'production') && isPromise$1(data)) {
2093
+ if ((process.env.NODE_ENV !== 'production') && isPromise(data)) {
2057
2094
  warn(`data() returned a Promise - note data() cannot be async; If you ` +
2058
2095
  `intend to perform data fetching before component renders, use ` +
2059
2096
  `async setup() + <Suspense>.`);
2060
2097
  }
2061
- if (!isObject$1(data)) {
2098
+ if (!isObject(data)) {
2062
2099
  (process.env.NODE_ENV !== 'production') && warn(`data() should return an object.`);
2063
2100
  }
2064
2101
  else {
@@ -2084,15 +2121,15 @@ function applyOptions(instance) {
2084
2121
  if (computedOptions) {
2085
2122
  for (const key in computedOptions) {
2086
2123
  const opt = computedOptions[key];
2087
- const get = isFunction$1(opt)
2124
+ const get = isFunction(opt)
2088
2125
  ? opt.bind(publicThis, publicThis)
2089
- : isFunction$1(opt.get)
2126
+ : isFunction(opt.get)
2090
2127
  ? opt.get.bind(publicThis, publicThis)
2091
2128
  : NOOP;
2092
2129
  if ((process.env.NODE_ENV !== 'production') && get === NOOP) {
2093
2130
  warn(`Computed property "${key}" has no getter.`);
2094
2131
  }
2095
- const set = !isFunction$1(opt) && isFunction$1(opt.set)
2132
+ const set = !isFunction(opt) && isFunction(opt.set)
2096
2133
  ? opt.set.bind(publicThis)
2097
2134
  : (process.env.NODE_ENV !== 'production')
2098
2135
  ? () => {
@@ -2120,7 +2157,7 @@ function applyOptions(instance) {
2120
2157
  }
2121
2158
  }
2122
2159
  if (provideOptions) {
2123
- const provides = isFunction$1(provideOptions)
2160
+ const provides = isFunction(provideOptions)
2124
2161
  ? provideOptions.call(publicThis)
2125
2162
  : provideOptions;
2126
2163
  Reflect.ownKeys(provides).forEach(key => {
@@ -2185,7 +2222,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
2185
2222
  for (const key in injectOptions) {
2186
2223
  const opt = injectOptions[key];
2187
2224
  let injected;
2188
- if (isObject$1(opt)) {
2225
+ if (isObject(opt)) {
2189
2226
  if ('default' in opt) {
2190
2227
  injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
2191
2228
  }
@@ -2236,25 +2273,25 @@ function createWatcher(raw, ctx, publicThis, key) {
2236
2273
  : () => publicThis[key];
2237
2274
  if (isString(raw)) {
2238
2275
  const handler = ctx[raw];
2239
- if (isFunction$1(handler)) {
2276
+ if (isFunction(handler)) {
2240
2277
  watch(getter, handler);
2241
2278
  }
2242
2279
  else if ((process.env.NODE_ENV !== 'production')) {
2243
2280
  warn(`Invalid watch handler specified by key "${raw}"`, handler);
2244
2281
  }
2245
2282
  }
2246
- else if (isFunction$1(raw)) {
2283
+ else if (isFunction(raw)) {
2247
2284
  watch(getter, raw.bind(publicThis));
2248
2285
  }
2249
- else if (isObject$1(raw)) {
2286
+ else if (isObject(raw)) {
2250
2287
  if (isArray(raw)) {
2251
2288
  raw.forEach(r => createWatcher(r, ctx, publicThis, key));
2252
2289
  }
2253
2290
  else {
2254
- const handler = isFunction$1(raw.handler)
2291
+ const handler = isFunction(raw.handler)
2255
2292
  ? raw.handler.bind(publicThis)
2256
2293
  : ctx[raw.handler];
2257
- if (isFunction$1(handler)) {
2294
+ if (isFunction(handler)) {
2258
2295
  watch(getter, handler, raw);
2259
2296
  }
2260
2297
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -2355,7 +2392,7 @@ function mergeDataFn(to, from) {
2355
2392
  return from;
2356
2393
  }
2357
2394
  return function mergedDataFn() {
2358
- return (extend)(isFunction$1(to) ? to.call(this, this) : to, isFunction$1(from) ? from.call(this, this) : from);
2395
+ return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
2359
2396
  };
2360
2397
  }
2361
2398
  function mergeInject(to, from) {
@@ -2562,7 +2599,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
2562
2599
  // default values
2563
2600
  if (hasDefault && value === undefined) {
2564
2601
  const defaultValue = opt.default;
2565
- if (opt.type !== Function && isFunction$1(defaultValue)) {
2602
+ if (opt.type !== Function && isFunction(defaultValue)) {
2566
2603
  const { propsDefaults } = instance;
2567
2604
  if (key in propsDefaults) {
2568
2605
  value = propsDefaults[key];
@@ -2601,7 +2638,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2601
2638
  const needCastKeys = [];
2602
2639
  // apply mixin/extends props
2603
2640
  let hasExtends = false;
2604
- if (__VUE_OPTIONS_API__ && !isFunction$1(comp)) {
2641
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
2605
2642
  const extendProps = (raw) => {
2606
2643
  hasExtends = true;
2607
2644
  const [props, keys] = normalizePropsOptions(raw, appContext, true);
@@ -2635,7 +2672,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2635
2672
  }
2636
2673
  }
2637
2674
  else if (raw) {
2638
- if ((process.env.NODE_ENV !== 'production') && !isObject$1(raw)) {
2675
+ if ((process.env.NODE_ENV !== 'production') && !isObject(raw)) {
2639
2676
  warn(`invalid props options`, raw);
2640
2677
  }
2641
2678
  for (const key in raw) {
@@ -2643,7 +2680,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2643
2680
  if (validatePropName(normalizedKey)) {
2644
2681
  const opt = raw[key];
2645
2682
  const prop = (normalized[normalizedKey] =
2646
- isArray(opt) || isFunction$1(opt) ? { type: opt } : opt);
2683
+ isArray(opt) || isFunction(opt) ? { type: opt } : opt);
2647
2684
  if (prop) {
2648
2685
  const booleanIndex = getTypeIndex(Boolean, prop.type);
2649
2686
  const stringIndex = getTypeIndex(String, prop.type);
@@ -2684,7 +2721,7 @@ function getTypeIndex(type, expectedTypes) {
2684
2721
  if (isArray(expectedTypes)) {
2685
2722
  return expectedTypes.findIndex(t => isSameType(t, type));
2686
2723
  }
2687
- else if (isFunction$1(expectedTypes)) {
2724
+ else if (isFunction(expectedTypes)) {
2688
2725
  return isSameType(expectedTypes, type) ? 0 : -1;
2689
2726
  }
2690
2727
  return -1;
@@ -2753,7 +2790,7 @@ function assertType(value, type) {
2753
2790
  }
2754
2791
  }
2755
2792
  else if (expectedType === 'Object') {
2756
- valid = isObject$1(value);
2793
+ valid = isObject(value);
2757
2794
  }
2758
2795
  else if (expectedType === 'Array') {
2759
2796
  valid = isArray(value);
@@ -2842,7 +2879,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => {
2842
2879
  if (isInternalKey(key))
2843
2880
  continue;
2844
2881
  const value = rawSlots[key];
2845
- if (isFunction$1(value)) {
2882
+ if (isFunction(value)) {
2846
2883
  slots[key] = normalizeSlot(key, value, ctx);
2847
2884
  }
2848
2885
  else if (value != null) {
@@ -2952,7 +2989,7 @@ return withDirectives(h(comp), [
2952
2989
  [bar, this.y]
2953
2990
  ])
2954
2991
  */
2955
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
2992
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
2956
2993
  function validateDirectiveName(name) {
2957
2994
  if (isBuiltInDirective(name)) {
2958
2995
  warn('Do not use built-in directive ids as custom directive id: ' + name);
@@ -2971,7 +3008,7 @@ function withDirectives(vnode, directives) {
2971
3008
  const bindings = vnode.dirs || (vnode.dirs = []);
2972
3009
  for (let i = 0; i < directives.length; i++) {
2973
3010
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2974
- if (isFunction$1(dir)) {
3011
+ if (isFunction(dir)) {
2975
3012
  dir = {
2976
3013
  mounted: dir,
2977
3014
  updated: dir
@@ -3039,7 +3076,7 @@ function createAppContext() {
3039
3076
  let uid = 0;
3040
3077
  function createAppAPI(render, hydrate) {
3041
3078
  return function createApp(rootComponent, rootProps = null) {
3042
- if (rootProps != null && !isObject$1(rootProps)) {
3079
+ if (rootProps != null && !isObject(rootProps)) {
3043
3080
  (process.env.NODE_ENV !== 'production') && warn(`root props passed to app.mount() must be an object.`);
3044
3081
  rootProps = null;
3045
3082
  }
@@ -3066,11 +3103,11 @@ function createAppAPI(render, hydrate) {
3066
3103
  if (installedPlugins.has(plugin)) {
3067
3104
  (process.env.NODE_ENV !== 'production') && warn(`Plugin has already been applied to target app.`);
3068
3105
  }
3069
- else if (plugin && isFunction$1(plugin.install)) {
3106
+ else if (plugin && isFunction(plugin.install)) {
3070
3107
  installedPlugins.add(plugin);
3071
3108
  plugin.install(app, ...options);
3072
3109
  }
3073
- else if (isFunction$1(plugin)) {
3110
+ else if (isFunction(plugin)) {
3074
3111
  installedPlugins.add(plugin);
3075
3112
  plugin(app, ...options);
3076
3113
  }
@@ -4897,7 +4934,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4897
4934
  doSet();
4898
4935
  }
4899
4936
  }
4900
- else if (isFunction$1(ref)) {
4937
+ else if (isFunction(ref)) {
4901
4938
  callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
4902
4939
  }
4903
4940
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -4918,8 +4955,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
4918
4955
  *
4919
4956
  * #2080
4920
4957
  * Inside keyed `template` fragment static children, if a fragment is moved,
4921
- * the children will always moved so that need inherit el form previous nodes
4922
- * to ensure correct moved position.
4958
+ * the children will always be moved. Therefore, in order to ensure correct move
4959
+ * position, el should be inherited from previous nodes.
4923
4960
  */
4924
4961
  function traverseStaticChildren(n1, n2, shallow = false) {
4925
4962
  const ch1 = n1.children;
@@ -5374,7 +5411,7 @@ const InternalObjectKey = `__vInternal`;
5374
5411
  const normalizeKey = ({ key }) => key != null ? key : null;
5375
5412
  const normalizeRef = ({ ref }) => {
5376
5413
  return (ref != null
5377
- ? isString(ref) || isRef(ref) || isFunction$1(ref)
5414
+ ? isString(ref) || isRef(ref) || isFunction(ref)
5378
5415
  ? { i: currentRenderingInstance, r: ref }
5379
5416
  : ref
5380
5417
  : null);
@@ -5473,7 +5510,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5473
5510
  if (klass && !isString(klass)) {
5474
5511
  props.class = normalizeClass(klass);
5475
5512
  }
5476
- if (isObject$1(style)) {
5513
+ if (isObject(style)) {
5477
5514
  // reactive state objects need to be cloned since they are likely to be
5478
5515
  // mutated
5479
5516
  if (isProxy(style) && !isArray(style)) {
@@ -5489,9 +5526,9 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5489
5526
  ? 128 /* SUSPENSE */
5490
5527
  : isTeleport(type)
5491
5528
  ? 64 /* TELEPORT */
5492
- : isObject$1(type)
5529
+ : isObject(type)
5493
5530
  ? 4 /* STATEFUL_COMPONENT */
5494
- : isFunction$1(type)
5531
+ : isFunction(type)
5495
5532
  ? 2 /* FUNCTIONAL_COMPONENT */
5496
5533
  : 0;
5497
5534
  if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
@@ -5670,7 +5707,7 @@ function normalizeChildren(vnode, children) {
5670
5707
  }
5671
5708
  }
5672
5709
  }
5673
- else if (isFunction$1(children)) {
5710
+ else if (isFunction(children)) {
5674
5711
  children = { default: children, _ctx: currentRenderingInstance };
5675
5712
  type = 32 /* SLOTS_CHILDREN */;
5676
5713
  }
@@ -5704,7 +5741,8 @@ function mergeProps(...args) {
5704
5741
  else if (isOn(key)) {
5705
5742
  const existing = ret[key];
5706
5743
  const incoming = toMerge[key];
5707
- if (existing !== incoming) {
5744
+ if (existing !== incoming &&
5745
+ !(isArray(existing) && existing.includes(incoming))) {
5708
5746
  ret[key] = existing
5709
5747
  ? [].concat(existing, incoming)
5710
5748
  : incoming;
@@ -5740,7 +5778,7 @@ function renderList(source, renderItem, cache, index) {
5740
5778
  ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
5741
5779
  }
5742
5780
  }
5743
- else if (isObject$1(source)) {
5781
+ else if (isObject(source)) {
5744
5782
  if (source[Symbol.iterator]) {
5745
5783
  ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
5746
5784
  }
@@ -5842,7 +5880,7 @@ function ensureValidVNode(vnodes) {
5842
5880
  */
5843
5881
  function toHandlers(obj) {
5844
5882
  const ret = {};
5845
- if ((process.env.NODE_ENV !== 'production') && !isObject$1(obj)) {
5883
+ if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
5846
5884
  warn(`v-on with no argument expects an object value.`);
5847
5885
  return ret;
5848
5886
  }
@@ -6277,7 +6315,7 @@ function setupStatefulComponent(instance, isSSR) {
6277
6315
  const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
6278
6316
  resetTracking();
6279
6317
  unsetCurrentInstance();
6280
- if (isPromise$1(setupResult)) {
6318
+ if (isPromise(setupResult)) {
6281
6319
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
6282
6320
  if (isSSR) {
6283
6321
  // return the promise so server-renderer can wait on it
@@ -6304,7 +6342,7 @@ function setupStatefulComponent(instance, isSSR) {
6304
6342
  }
6305
6343
  }
6306
6344
  function handleSetupResult(instance, setupResult, isSSR) {
6307
- if (isFunction$1(setupResult)) {
6345
+ if (isFunction(setupResult)) {
6308
6346
  // setup returned an inline render function
6309
6347
  if (instance.type.__ssrInlineRender) {
6310
6348
  // when the function's name is `ssrRender` (compiled by SFC inline mode),
@@ -6315,7 +6353,7 @@ function handleSetupResult(instance, setupResult, isSSR) {
6315
6353
  instance.render = setupResult;
6316
6354
  }
6317
6355
  }
6318
- else if (isObject$1(setupResult)) {
6356
+ else if (isObject(setupResult)) {
6319
6357
  if ((process.env.NODE_ENV !== 'production') && isVNode(setupResult)) {
6320
6358
  warn(`setup() should not return VNodes directly - ` +
6321
6359
  `return a render function instead.`);
@@ -6484,7 +6522,7 @@ function getExposeProxy(instance) {
6484
6522
  const classifyRE = /(?:^|[-_])(\w)/g;
6485
6523
  const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
6486
6524
  function getComponentName(Component) {
6487
- return isFunction$1(Component)
6525
+ return isFunction(Component)
6488
6526
  ? Component.displayName || Component.name
6489
6527
  : Component.name;
6490
6528
  }
@@ -6513,7 +6551,7 @@ function formatComponentName(instance, Component, isRoot = false) {
6513
6551
  return name ? classify(name) : isRoot ? `App` : `Anonymous`;
6514
6552
  }
6515
6553
  function isClassComponent(value) {
6516
- return isFunction$1(value) && '__vccOpts' in value;
6554
+ return isFunction(value) && '__vccOpts' in value;
6517
6555
  }
6518
6556
 
6519
6557
  const stack = [];
@@ -6621,7 +6659,7 @@ function formatProp(key, value, raw) {
6621
6659
  value = formatProp(key, toRaw(value.value), true);
6622
6660
  return raw ? value : [`${key}=Ref<`, value, `>`];
6623
6661
  }
6624
- else if (isFunction$1(value)) {
6662
+ else if (isFunction(value)) {
6625
6663
  return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
6626
6664
  }
6627
6665
  else {
@@ -6673,9 +6711,9 @@ function callWithErrorHandling(fn, instance, type, args) {
6673
6711
  return res;
6674
6712
  }
6675
6713
  function callWithAsyncErrorHandling(fn, instance, type, args) {
6676
- if (isFunction$1(fn)) {
6714
+ if (isFunction(fn)) {
6677
6715
  const res = callWithErrorHandling(fn, instance, type, args);
6678
- if (res && isPromise$1(res)) {
6716
+ if (res && isPromise(res)) {
6679
6717
  res.catch(err => {
6680
6718
  handleError(err, instance, type);
6681
6719
  });
@@ -6963,7 +7001,7 @@ function watchSyncEffect(effect, options) {
6963
7001
  const INITIAL_WATCHER_VALUE = {};
6964
7002
  // implementation
6965
7003
  function watch(source, cb, options) {
6966
- if ((process.env.NODE_ENV !== 'production') && !isFunction$1(cb)) {
7004
+ if ((process.env.NODE_ENV !== 'production') && !isFunction(cb)) {
6967
7005
  warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
6968
7006
  `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
6969
7007
  `supports \`watch(source, cb, options?) signature.`);
@@ -7007,7 +7045,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
7007
7045
  else if (isReactive(s)) {
7008
7046
  return traverse(s);
7009
7047
  }
7010
- else if (isFunction$1(s)) {
7048
+ else if (isFunction(s)) {
7011
7049
  return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
7012
7050
  }
7013
7051
  else {
@@ -7015,7 +7053,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
7015
7053
  }
7016
7054
  });
7017
7055
  }
7018
- else if (isFunction$1(source)) {
7056
+ else if (isFunction(source)) {
7019
7057
  if (cb) {
7020
7058
  // getter with cb
7021
7059
  getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
@@ -7155,7 +7193,7 @@ function instanceWatch(source, value, options) {
7155
7193
  : () => publicThis[source]
7156
7194
  : source.bind(publicThis, publicThis);
7157
7195
  let cb;
7158
- if (isFunction$1(value)) {
7196
+ if (isFunction(value)) {
7159
7197
  cb = value;
7160
7198
  }
7161
7199
  else {
@@ -7184,7 +7222,7 @@ function createPathGetter(ctx, path) {
7184
7222
  };
7185
7223
  }
7186
7224
  function traverse(value, seen) {
7187
- if (!isObject$1(value) || value["__v_skip" /* SKIP */]) {
7225
+ if (!isObject(value) || value["__v_skip" /* SKIP */]) {
7188
7226
  return value;
7189
7227
  }
7190
7228
  seen = seen || new Set();
@@ -7213,16 +7251,6 @@ function traverse(value, seen) {
7213
7251
  return value;
7214
7252
  }
7215
7253
 
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
7254
  // dev only
7227
7255
  const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
7228
7256
  `<script setup> of a single file component. Its arguments should be ` +
@@ -7300,15 +7328,21 @@ function getContext() {
7300
7328
  * only.
7301
7329
  * @internal
7302
7330
  */
7303
- function mergeDefaults(
7304
- // the base props is compiler-generated and guaranteed to be in this shape.
7305
- props, defaults) {
7331
+ function mergeDefaults(raw, defaults) {
7332
+ const props = isArray(raw)
7333
+ ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
7334
+ : raw;
7306
7335
  for (const key in defaults) {
7307
- const val = props[key];
7308
- if (val) {
7309
- val.default = defaults[key];
7336
+ const opt = props[key];
7337
+ if (opt) {
7338
+ if (isArray(opt) || isFunction(opt)) {
7339
+ props[key] = { type: opt, default: defaults[key] };
7340
+ }
7341
+ else {
7342
+ opt.default = defaults[key];
7343
+ }
7310
7344
  }
7311
- else if (val === null) {
7345
+ else if (opt === null) {
7312
7346
  props[key] = { default: defaults[key] };
7313
7347
  }
7314
7348
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -7317,6 +7351,23 @@ props, defaults) {
7317
7351
  }
7318
7352
  return props;
7319
7353
  }
7354
+ /**
7355
+ * Used to create a proxy for the rest element when destructuring props with
7356
+ * defineProps().
7357
+ * @internal
7358
+ */
7359
+ function createPropsRestProxy(props, excludedKeys) {
7360
+ const ret = {};
7361
+ for (const key in props) {
7362
+ if (!excludedKeys.includes(key)) {
7363
+ Object.defineProperty(ret, key, {
7364
+ enumerable: true,
7365
+ get: () => props[key]
7366
+ });
7367
+ }
7368
+ }
7369
+ return ret;
7370
+ }
7320
7371
  /**
7321
7372
  * `<script setup>` helper for persisting the current instance context over
7322
7373
  * async/await flows.
@@ -7356,7 +7407,7 @@ function withAsyncContext(getAwaitable) {
7356
7407
  function h(type, propsOrChildren, children) {
7357
7408
  const l = arguments.length;
7358
7409
  if (l === 2) {
7359
- if (isObject$1(propsOrChildren) && !isArray(propsOrChildren)) {
7410
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
7360
7411
  // single vnode without props
7361
7412
  if (isVNode(propsOrChildren)) {
7362
7413
  return createVNode(type, null, [propsOrChildren]);
@@ -7406,7 +7457,7 @@ function initCustomFormatter() {
7406
7457
  const formatter = {
7407
7458
  header(obj) {
7408
7459
  // TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
7409
- if (!isObject$1(obj)) {
7460
+ if (!isObject(obj)) {
7410
7461
  return null;
7411
7462
  }
7412
7463
  if (obj.__isVue) {
@@ -7531,7 +7582,7 @@ function initCustomFormatter() {
7531
7582
  else if (typeof v === 'boolean') {
7532
7583
  return ['span', keywordStyle, v];
7533
7584
  }
7534
- else if (isObject$1(v)) {
7585
+ else if (isObject(v)) {
7535
7586
  return ['object', { object: asRaw ? toRaw(v) : v }];
7536
7587
  }
7537
7588
  else {
@@ -7540,7 +7591,7 @@ function initCustomFormatter() {
7540
7591
  }
7541
7592
  function extractKeys(instance, type) {
7542
7593
  const Comp = instance.type;
7543
- if (isFunction$1(Comp)) {
7594
+ if (isFunction(Comp)) {
7544
7595
  return;
7545
7596
  }
7546
7597
  const extracted = {};
@@ -7554,7 +7605,7 @@ function initCustomFormatter() {
7554
7605
  function isKeyOfType(Comp, key, type) {
7555
7606
  const opts = Comp[type];
7556
7607
  if ((isArray(opts) && opts.includes(key)) ||
7557
- (isObject$1(opts) && key in opts)) {
7608
+ (isObject(opts) && key in opts)) {
7558
7609
  return true;
7559
7610
  }
7560
7611
  if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
@@ -7609,7 +7660,7 @@ function isMemoSame(cached, memo) {
7609
7660
  }
7610
7661
 
7611
7662
  // Core API ------------------------------------------------------------------
7612
- const version = "3.2.18";
7663
+ const version = "3.2.22";
7613
7664
  const _ssrUtils = {
7614
7665
  createComponentInstance,
7615
7666
  setupComponent,
@@ -7632,4 +7683,4 @@ const resolveFilter = null;
7632
7683
  */
7633
7684
  const compatUtils = (null);
7634
7685
 
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 };
7686
+ 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.18",
3
+ "version": "3.2.22",
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.18",
36
- "@vue/reactivity": "3.2.18"
35
+ "@vue/shared": "3.2.22",
36
+ "@vue/reactivity": "3.2.22"
37
37
  }
38
38
  }