@vue/runtime-core 3.2.16 → 3.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,14 +14,7 @@ const hmrDirtyComponents = new Set();
14
14
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
15
15
  // to be set so that its instances can be registered / removed.
16
16
  {
17
- const globalObject = typeof global !== 'undefined'
18
- ? global
19
- : typeof self !== 'undefined'
20
- ? self
21
- : typeof window !== 'undefined'
22
- ? window
23
- : {};
24
- globalObject.__VUE_HMR_RUNTIME__ = {
17
+ shared.getGlobalThis().__VUE_HMR_RUNTIME__ = {
25
18
  createRecord: tryWrap(createRecord),
26
19
  rerender: tryWrap(rerender),
27
20
  reload: tryWrap(reload)
@@ -32,19 +25,22 @@ function registerHMR(instance) {
32
25
  const id = instance.type.__hmrId;
33
26
  let record = map.get(id);
34
27
  if (!record) {
35
- createRecord(id);
28
+ createRecord(id, instance.type);
36
29
  record = map.get(id);
37
30
  }
38
- record.add(instance);
31
+ record.instances.add(instance);
39
32
  }
40
33
  function unregisterHMR(instance) {
41
- map.get(instance.type.__hmrId).delete(instance);
34
+ map.get(instance.type.__hmrId).instances.delete(instance);
42
35
  }
43
- function createRecord(id) {
36
+ function createRecord(id, initialDef) {
44
37
  if (map.has(id)) {
45
38
  return false;
46
39
  }
47
- map.set(id, new Set());
40
+ map.set(id, {
41
+ initialDef: normalizeClassComponent(initialDef),
42
+ instances: new Set()
43
+ });
48
44
  return true;
49
45
  }
50
46
  function normalizeClassComponent(component) {
@@ -55,7 +51,9 @@ function rerender(id, newRender) {
55
51
  if (!record) {
56
52
  return;
57
53
  }
58
- [...record].forEach(instance => {
54
+ // update initial record (for not-yet-rendered component)
55
+ record.initialDef.render = newRender;
56
+ [...record.instances].forEach(instance => {
59
57
  if (newRender) {
60
58
  instance.render = newRender;
61
59
  normalizeClassComponent(instance.type).render = newRender;
@@ -72,17 +70,16 @@ function reload(id, newComp) {
72
70
  if (!record)
73
71
  return;
74
72
  newComp = normalizeClassComponent(newComp);
73
+ // update initial def (for not-yet-rendered components)
74
+ updateComponentDef(record.initialDef, newComp);
75
75
  // create a snapshot which avoids the set being mutated during updates
76
- const instances = [...record];
76
+ const instances = [...record.instances];
77
77
  for (const instance of instances) {
78
78
  const oldComp = normalizeClassComponent(instance.type);
79
79
  if (!hmrDirtyComponents.has(oldComp)) {
80
80
  // 1. Update existing comp definition to match new one
81
- shared.extend(oldComp, newComp);
82
- for (const key in oldComp) {
83
- if (key !== '__file' && !(key in newComp)) {
84
- delete oldComp[key];
85
- }
81
+ if (oldComp !== record.initialDef) {
82
+ updateComponentDef(oldComp, newComp);
86
83
  }
87
84
  // 2. mark definition dirty. This forces the renderer to replace the
88
85
  // component on patch.
@@ -128,6 +125,14 @@ function reload(id, newComp) {
128
125
  }
129
126
  });
130
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
+ }
131
136
  function tryWrap(fn) {
132
137
  return (id, arg) => {
133
138
  try {
@@ -163,6 +168,11 @@ function setDevtoolsHook(hook, target) {
163
168
  replay.push((newHook) => {
164
169
  setDevtoolsHook(newHook, target);
165
170
  });
171
+ // clear buffer after 3s - the user probably doesn't have devtools installed
172
+ // at all, and keeping the buffer will cause memory leaks (#4738)
173
+ setTimeout(() => {
174
+ buffer = [];
175
+ }, 3000);
166
176
  }
167
177
  }
168
178
  function devtoolsInitApp(app, version) {
@@ -6292,19 +6302,11 @@ const isRuntimeOnly = () => !compile;
6292
6302
  function finishComponentSetup(instance, isSSR, skipOptions) {
6293
6303
  const Component = instance.type;
6294
6304
  // template / render function normalization
6295
- if (isSSR) {
6296
- // 1. the render function may already exist, returned by `setup`
6297
- // 2. otherwise try to use the `Component.render`
6298
- // 3. if the component doesn't have a render function,
6299
- // set `instance.render` to NOOP so that it can inherit the render
6300
- // function from mixins/extend
6301
- instance.render = (instance.render ||
6302
- Component.render ||
6303
- shared.NOOP);
6304
- }
6305
- else if (!instance.render) {
6306
- // could be set from setup()
6307
- if (compile && !Component.render) {
6305
+ // could be already set when returned from setup()
6306
+ if (!instance.render) {
6307
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
6308
+ // is done by server-renderer
6309
+ if (!isSSR && compile && !Component.render) {
6308
6310
  const template = Component.template;
6309
6311
  if (template) {
6310
6312
  {
@@ -7133,15 +7135,6 @@ function traverse(value, seen) {
7133
7135
  return value;
7134
7136
  }
7135
7137
 
7136
- Object.freeze({})
7137
- ;
7138
- Object.freeze([]) ;
7139
- const isFunction = (val) => typeof val === 'function';
7140
- const isObject = (val) => val !== null && typeof val === 'object';
7141
- const isPromise = (val) => {
7142
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
7143
- };
7144
-
7145
7138
  // dev only
7146
7139
  const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
7147
7140
  `<script setup> of a single file component. Its arguments should be ` +
@@ -7219,15 +7212,21 @@ function getContext() {
7219
7212
  * only.
7220
7213
  * @internal
7221
7214
  */
7222
- function mergeDefaults(
7223
- // the base props is compiler-generated and guaranteed to be in this shape.
7224
- props, defaults) {
7215
+ function mergeDefaults(raw, defaults) {
7216
+ const props = shared.isArray(raw)
7217
+ ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
7218
+ : raw;
7225
7219
  for (const key in defaults) {
7226
- const val = props[key];
7227
- if (val) {
7228
- val.default = defaults[key];
7220
+ const opt = props[key];
7221
+ if (opt) {
7222
+ if (shared.isArray(opt) || shared.isFunction(opt)) {
7223
+ props[key] = { type: opt, default: defaults[key] };
7224
+ }
7225
+ else {
7226
+ opt.default = defaults[key];
7227
+ }
7229
7228
  }
7230
- else if (val === null) {
7229
+ else if (opt === null) {
7231
7230
  props[key] = { default: defaults[key] };
7232
7231
  }
7233
7232
  else {
@@ -7236,6 +7235,23 @@ props, defaults) {
7236
7235
  }
7237
7236
  return props;
7238
7237
  }
7238
+ /**
7239
+ * Used to create a proxy for the rest element when destructuring props with
7240
+ * defineProps().
7241
+ * @internal
7242
+ */
7243
+ function createPropsRestProxy(props, excludedKeys) {
7244
+ const ret = {};
7245
+ for (const key in props) {
7246
+ if (!excludedKeys.includes(key)) {
7247
+ Object.defineProperty(ret, key, {
7248
+ enumerable: true,
7249
+ get: () => props[key]
7250
+ });
7251
+ }
7252
+ }
7253
+ return ret;
7254
+ }
7239
7255
  /**
7240
7256
  * `<script setup>` helper for persisting the current instance context over
7241
7257
  * async/await flows.
@@ -7262,7 +7278,7 @@ function withAsyncContext(getAwaitable) {
7262
7278
  }
7263
7279
  let awaitable = getAwaitable();
7264
7280
  unsetCurrentInstance();
7265
- if (isPromise(awaitable)) {
7281
+ if (shared.isPromise(awaitable)) {
7266
7282
  awaitable = awaitable.catch(e => {
7267
7283
  setCurrentInstance(ctx);
7268
7284
  throw e;
@@ -7528,7 +7544,7 @@ function isMemoSame(cached, memo) {
7528
7544
  }
7529
7545
 
7530
7546
  // Core API ------------------------------------------------------------------
7531
- const version = "3.2.16";
7547
+ const version = "3.2.20";
7532
7548
  const _ssrUtils = {
7533
7549
  createComponentInstance,
7534
7550
  setupComponent,
@@ -7601,6 +7617,7 @@ exports.createCommentVNode = createCommentVNode;
7601
7617
  exports.createElementBlock = createElementBlock;
7602
7618
  exports.createElementVNode = createBaseVNode;
7603
7619
  exports.createHydrationRenderer = createHydrationRenderer;
7620
+ exports.createPropsRestProxy = createPropsRestProxy;
7604
7621
  exports.createRenderer = createRenderer;
7605
7622
  exports.createSlots = createSlots;
7606
7623
  exports.createStaticVNode = createStaticVNode;
@@ -19,6 +19,11 @@ function setDevtoolsHook(hook, target) {
19
19
  replay.push((newHook) => {
20
20
  setDevtoolsHook(newHook, target);
21
21
  });
22
+ // clear buffer after 3s - the user probably doesn't have devtools installed
23
+ // at all, and keeping the buffer will cause memory leaks (#4738)
24
+ setTimeout(() => {
25
+ buffer = [];
26
+ }, 3000);
22
27
  }
23
28
  }
24
29
 
@@ -5135,19 +5140,11 @@ const isRuntimeOnly = () => !compile;
5135
5140
  function finishComponentSetup(instance, isSSR, skipOptions) {
5136
5141
  const Component = instance.type;
5137
5142
  // template / render function normalization
5138
- if (isSSR) {
5139
- // 1. the render function may already exist, returned by `setup`
5140
- // 2. otherwise try to use the `Component.render`
5141
- // 3. if the component doesn't have a render function,
5142
- // set `instance.render` to NOOP so that it can inherit the render
5143
- // function from mixins/extend
5144
- instance.render = (instance.render ||
5145
- Component.render ||
5146
- shared.NOOP);
5147
- }
5148
- else if (!instance.render) {
5149
- // could be set from setup()
5150
- if (compile && !Component.render) {
5143
+ // could be already set when returned from setup()
5144
+ if (!instance.render) {
5145
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
5146
+ // is done by server-renderer
5147
+ if (!isSSR && compile && !Component.render) {
5151
5148
  const template = Component.template;
5152
5149
  if (template) {
5153
5150
  const { isCustomElement, compilerOptions } = instance.appContext.config;
@@ -5819,12 +5816,6 @@ function traverse(value, seen) {
5819
5816
  return value;
5820
5817
  }
5821
5818
 
5822
- const isFunction = (val) => typeof val === 'function';
5823
- const isObject = (val) => val !== null && typeof val === 'object';
5824
- const isPromise = (val) => {
5825
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
5826
- };
5827
-
5828
5819
  // implementation
5829
5820
  function defineProps() {
5830
5821
  return null;
@@ -5883,21 +5874,44 @@ function getContext() {
5883
5874
  * only.
5884
5875
  * @internal
5885
5876
  */
5886
- function mergeDefaults(
5887
- // the base props is compiler-generated and guaranteed to be in this shape.
5888
- props, defaults) {
5877
+ function mergeDefaults(raw, defaults) {
5878
+ const props = shared.isArray(raw)
5879
+ ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
5880
+ : raw;
5889
5881
  for (const key in defaults) {
5890
- const val = props[key];
5891
- if (val) {
5892
- val.default = defaults[key];
5882
+ const opt = props[key];
5883
+ if (opt) {
5884
+ if (shared.isArray(opt) || shared.isFunction(opt)) {
5885
+ props[key] = { type: opt, default: defaults[key] };
5886
+ }
5887
+ else {
5888
+ opt.default = defaults[key];
5889
+ }
5893
5890
  }
5894
- else if (val === null) {
5891
+ else if (opt === null) {
5895
5892
  props[key] = { default: defaults[key] };
5896
5893
  }
5897
5894
  else ;
5898
5895
  }
5899
5896
  return props;
5900
5897
  }
5898
+ /**
5899
+ * Used to create a proxy for the rest element when destructuring props with
5900
+ * defineProps().
5901
+ * @internal
5902
+ */
5903
+ function createPropsRestProxy(props, excludedKeys) {
5904
+ const ret = {};
5905
+ for (const key in props) {
5906
+ if (!excludedKeys.includes(key)) {
5907
+ Object.defineProperty(ret, key, {
5908
+ enumerable: true,
5909
+ get: () => props[key]
5910
+ });
5911
+ }
5912
+ }
5913
+ return ret;
5914
+ }
5901
5915
  /**
5902
5916
  * `<script setup>` helper for persisting the current instance context over
5903
5917
  * async/await flows.
@@ -5920,7 +5934,7 @@ function withAsyncContext(getAwaitable) {
5920
5934
  const ctx = getCurrentInstance();
5921
5935
  let awaitable = getAwaitable();
5922
5936
  unsetCurrentInstance();
5923
- if (isPromise(awaitable)) {
5937
+ if (shared.isPromise(awaitable)) {
5924
5938
  awaitable = awaitable.catch(e => {
5925
5939
  setCurrentInstance(ctx);
5926
5940
  throw e;
@@ -6004,7 +6018,7 @@ function isMemoSame(cached, memo) {
6004
6018
  }
6005
6019
 
6006
6020
  // Core API ------------------------------------------------------------------
6007
- const version = "3.2.16";
6021
+ const version = "3.2.20";
6008
6022
  const _ssrUtils = {
6009
6023
  createComponentInstance,
6010
6024
  setupComponent,
@@ -6077,6 +6091,7 @@ exports.createCommentVNode = createCommentVNode;
6077
6091
  exports.createElementBlock = createElementBlock;
6078
6092
  exports.createElementVNode = createBaseVNode;
6079
6093
  exports.createHydrationRenderer = createHydrationRenderer;
6094
+ exports.createPropsRestProxy = createPropsRestProxy;
6080
6095
  exports.createRenderer = createRenderer;
6081
6096
  exports.createSlots = createSlots;
6082
6097
  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';
@@ -547,7 +548,9 @@ export declare function createElementVNode(type: VNodeTypes | ClassComponent | t
547
548
 
548
549
  export declare function createHydrationRenderer(options: RendererOptions<Node, Element>): HydrationRenderer;
549
550
 
550
- declare function createRecord(id: string): boolean;
551
+ /* Excluded from this release type: createPropsRestProxy */
552
+
553
+ declare function createRecord(id: string, initialDef: HMRComponent): boolean;
551
554
 
552
555
  /**
553
556
  * The createRenderer function accepts two generic arguments:
@@ -1,6 +1,6 @@
1
1
  import { toRaw, ref, pauseTracking, resetTracking, reactive, computed, isRef, shallowReactive, trigger, ReactiveEffect, isProxy, shallowReadonly, track, EffectScope, markRaw, proxyRefs, isReactive, isReadonly } from '@vue/reactivity';
2
2
  export { EffectScope, ReactiveEffect, computed, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, triggerRef, unref } from '@vue/reactivity';
3
- import { 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, getGlobalThis, 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 */
@@ -12,14 +12,7 @@ const hmrDirtyComponents = new Set();
12
12
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
13
13
  // to be set so that its instances can be registered / removed.
14
14
  if ((process.env.NODE_ENV !== 'production')) {
15
- const globalObject = typeof global !== 'undefined'
16
- ? global
17
- : typeof self !== 'undefined'
18
- ? self
19
- : typeof window !== 'undefined'
20
- ? window
21
- : {};
22
- globalObject.__VUE_HMR_RUNTIME__ = {
15
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
23
16
  createRecord: tryWrap(createRecord),
24
17
  rerender: tryWrap(rerender),
25
18
  reload: tryWrap(reload)
@@ -30,19 +23,22 @@ function registerHMR(instance) {
30
23
  const id = instance.type.__hmrId;
31
24
  let record = map.get(id);
32
25
  if (!record) {
33
- createRecord(id);
26
+ createRecord(id, instance.type);
34
27
  record = map.get(id);
35
28
  }
36
- record.add(instance);
29
+ record.instances.add(instance);
37
30
  }
38
31
  function unregisterHMR(instance) {
39
- map.get(instance.type.__hmrId).delete(instance);
32
+ map.get(instance.type.__hmrId).instances.delete(instance);
40
33
  }
41
- function createRecord(id) {
34
+ function createRecord(id, initialDef) {
42
35
  if (map.has(id)) {
43
36
  return false;
44
37
  }
45
- map.set(id, new Set());
38
+ map.set(id, {
39
+ initialDef: normalizeClassComponent(initialDef),
40
+ instances: new Set()
41
+ });
46
42
  return true;
47
43
  }
48
44
  function normalizeClassComponent(component) {
@@ -53,7 +49,9 @@ function rerender(id, newRender) {
53
49
  if (!record) {
54
50
  return;
55
51
  }
56
- [...record].forEach(instance => {
52
+ // update initial record (for not-yet-rendered component)
53
+ record.initialDef.render = newRender;
54
+ [...record.instances].forEach(instance => {
57
55
  if (newRender) {
58
56
  instance.render = newRender;
59
57
  normalizeClassComponent(instance.type).render = newRender;
@@ -70,17 +68,16 @@ function reload(id, newComp) {
70
68
  if (!record)
71
69
  return;
72
70
  newComp = normalizeClassComponent(newComp);
71
+ // update initial def (for not-yet-rendered components)
72
+ updateComponentDef(record.initialDef, newComp);
73
73
  // create a snapshot which avoids the set being mutated during updates
74
- const instances = [...record];
74
+ const instances = [...record.instances];
75
75
  for (const instance of instances) {
76
76
  const oldComp = normalizeClassComponent(instance.type);
77
77
  if (!hmrDirtyComponents.has(oldComp)) {
78
78
  // 1. Update existing comp definition to match new one
79
- extend(oldComp, newComp);
80
- for (const key in oldComp) {
81
- if (key !== '__file' && !(key in newComp)) {
82
- delete oldComp[key];
83
- }
79
+ if (oldComp !== record.initialDef) {
80
+ updateComponentDef(oldComp, newComp);
84
81
  }
85
82
  // 2. mark definition dirty. This forces the renderer to replace the
86
83
  // component on patch.
@@ -126,6 +123,14 @@ function reload(id, newComp) {
126
123
  }
127
124
  });
128
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
+ }
129
134
  function tryWrap(fn) {
130
135
  return (id, arg) => {
131
136
  try {
@@ -162,6 +167,11 @@ function setDevtoolsHook(hook, target) {
162
167
  replay.push((newHook) => {
163
168
  setDevtoolsHook(newHook, target);
164
169
  });
170
+ // clear buffer after 3s - the user probably doesn't have devtools installed
171
+ // at all, and keeping the buffer will cause memory leaks (#4738)
172
+ setTimeout(() => {
173
+ buffer = [];
174
+ }, 3000);
165
175
  }
166
176
  }
167
177
  function devtoolsInitApp(app, version) {
@@ -210,7 +220,7 @@ function emit$1(instance, event, ...rawArgs) {
210
220
  }
211
221
  else {
212
222
  const validator = emitsOptions[event];
213
- if (isFunction$1(validator)) {
223
+ if (isFunction(validator)) {
214
224
  const isValid = validator(...rawArgs);
215
225
  if (!isValid) {
216
226
  warn(`Invalid event arguments: event validation failed for event "${event}".`);
@@ -280,7 +290,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
280
290
  let normalized = {};
281
291
  // apply mixin/extends props
282
292
  let hasExtends = false;
283
- if (__VUE_OPTIONS_API__ && !isFunction$1(comp)) {
293
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
284
294
  const extendEmits = (raw) => {
285
295
  const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
286
296
  if (normalizedFromExtend) {
@@ -730,7 +740,7 @@ const SuspenseImpl = {
730
740
  const Suspense = (SuspenseImpl );
731
741
  function triggerEvent(vnode, name) {
732
742
  const eventListener = vnode.props && vnode.props[name];
733
- if (isFunction$1(eventListener)) {
743
+ if (isFunction(eventListener)) {
734
744
  eventListener();
735
745
  }
736
746
  }
@@ -1076,7 +1086,7 @@ function normalizeSuspenseChildren(vnode) {
1076
1086
  }
1077
1087
  function normalizeSuspenseSlot(s) {
1078
1088
  let block;
1079
- if (isFunction$1(s)) {
1089
+ if (isFunction(s)) {
1080
1090
  const trackBlock = isBlockTreeEnabled && s._c;
1081
1091
  if (trackBlock) {
1082
1092
  // disableTracking: false
@@ -1167,7 +1177,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
1167
1177
  return provides[key];
1168
1178
  }
1169
1179
  else if (arguments.length > 1) {
1170
- return treatDefaultAsFactory && isFunction$1(defaultValue)
1180
+ return treatDefaultAsFactory && isFunction(defaultValue)
1171
1181
  ? defaultValue.call(instance.proxy)
1172
1182
  : defaultValue;
1173
1183
  }
@@ -1494,12 +1504,12 @@ function getTransitionRawChildren(children, keepComment = false) {
1494
1504
 
1495
1505
  // implementation, close to no-op
1496
1506
  function defineComponent(options) {
1497
- return isFunction$1(options) ? { setup: options, name: options.name } : options;
1507
+ return isFunction(options) ? { setup: options, name: options.name } : options;
1498
1508
  }
1499
1509
 
1500
1510
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1501
1511
  function defineAsyncComponent(source) {
1502
- if (isFunction$1(source)) {
1512
+ if (isFunction(source)) {
1503
1513
  source = { loader: source };
1504
1514
  }
1505
1515
  const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out
@@ -1543,7 +1553,7 @@ function defineAsyncComponent(source) {
1543
1553
  (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
1544
1554
  comp = comp.default;
1545
1555
  }
1546
- if ((process.env.NODE_ENV !== 'production') && comp && !isObject$1(comp) && !isFunction$1(comp)) {
1556
+ if ((process.env.NODE_ENV !== 'production') && comp && !isObject(comp) && !isFunction(comp)) {
1547
1557
  throw new Error(`Invalid async component load result: ${comp}`);
1548
1558
  }
1549
1559
  resolvedComp = comp;
@@ -1568,7 +1578,7 @@ function defineAsyncComponent(source) {
1568
1578
  };
1569
1579
  // suspense-controlled or SSR.
1570
1580
  if ((suspensible && instance.suspense) ||
1571
- (false )) {
1581
+ (isInSSRComponentSetup)) {
1572
1582
  return load()
1573
1583
  .then(comp => {
1574
1584
  return () => createInnerComp(comp, instance);
@@ -2029,7 +2039,7 @@ function applyOptions(instance) {
2029
2039
  if (methods) {
2030
2040
  for (const key in methods) {
2031
2041
  const methodHandler = methods[key];
2032
- if (isFunction$1(methodHandler)) {
2042
+ if (isFunction(methodHandler)) {
2033
2043
  // In dev mode, we use the `createRenderContext` function to define
2034
2044
  // methods to the proxy target, and those are read-only but
2035
2045
  // reconfigurable, so it needs to be redefined here
@@ -2055,17 +2065,17 @@ function applyOptions(instance) {
2055
2065
  }
2056
2066
  }
2057
2067
  if (dataOptions) {
2058
- if ((process.env.NODE_ENV !== 'production') && !isFunction$1(dataOptions)) {
2068
+ if ((process.env.NODE_ENV !== 'production') && !isFunction(dataOptions)) {
2059
2069
  warn(`The data option must be a function. ` +
2060
2070
  `Plain object usage is no longer supported.`);
2061
2071
  }
2062
2072
  const data = dataOptions.call(publicThis, publicThis);
2063
- if ((process.env.NODE_ENV !== 'production') && isPromise$1(data)) {
2073
+ if ((process.env.NODE_ENV !== 'production') && isPromise(data)) {
2064
2074
  warn(`data() returned a Promise - note data() cannot be async; If you ` +
2065
2075
  `intend to perform data fetching before component renders, use ` +
2066
2076
  `async setup() + <Suspense>.`);
2067
2077
  }
2068
- if (!isObject$1(data)) {
2078
+ if (!isObject(data)) {
2069
2079
  (process.env.NODE_ENV !== 'production') && warn(`data() should return an object.`);
2070
2080
  }
2071
2081
  else {
@@ -2091,15 +2101,15 @@ function applyOptions(instance) {
2091
2101
  if (computedOptions) {
2092
2102
  for (const key in computedOptions) {
2093
2103
  const opt = computedOptions[key];
2094
- const get = isFunction$1(opt)
2104
+ const get = isFunction(opt)
2095
2105
  ? opt.bind(publicThis, publicThis)
2096
- : isFunction$1(opt.get)
2106
+ : isFunction(opt.get)
2097
2107
  ? opt.get.bind(publicThis, publicThis)
2098
2108
  : NOOP;
2099
2109
  if ((process.env.NODE_ENV !== 'production') && get === NOOP) {
2100
2110
  warn(`Computed property "${key}" has no getter.`);
2101
2111
  }
2102
- const set = !isFunction$1(opt) && isFunction$1(opt.set)
2112
+ const set = !isFunction(opt) && isFunction(opt.set)
2103
2113
  ? opt.set.bind(publicThis)
2104
2114
  : (process.env.NODE_ENV !== 'production')
2105
2115
  ? () => {
@@ -2127,7 +2137,7 @@ function applyOptions(instance) {
2127
2137
  }
2128
2138
  }
2129
2139
  if (provideOptions) {
2130
- const provides = isFunction$1(provideOptions)
2140
+ const provides = isFunction(provideOptions)
2131
2141
  ? provideOptions.call(publicThis)
2132
2142
  : provideOptions;
2133
2143
  Reflect.ownKeys(provides).forEach(key => {
@@ -2192,7 +2202,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
2192
2202
  for (const key in injectOptions) {
2193
2203
  const opt = injectOptions[key];
2194
2204
  let injected;
2195
- if (isObject$1(opt)) {
2205
+ if (isObject(opt)) {
2196
2206
  if ('default' in opt) {
2197
2207
  injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
2198
2208
  }
@@ -2243,25 +2253,25 @@ function createWatcher(raw, ctx, publicThis, key) {
2243
2253
  : () => publicThis[key];
2244
2254
  if (isString(raw)) {
2245
2255
  const handler = ctx[raw];
2246
- if (isFunction$1(handler)) {
2256
+ if (isFunction(handler)) {
2247
2257
  watch(getter, handler);
2248
2258
  }
2249
2259
  else if ((process.env.NODE_ENV !== 'production')) {
2250
2260
  warn(`Invalid watch handler specified by key "${raw}"`, handler);
2251
2261
  }
2252
2262
  }
2253
- else if (isFunction$1(raw)) {
2263
+ else if (isFunction(raw)) {
2254
2264
  watch(getter, raw.bind(publicThis));
2255
2265
  }
2256
- else if (isObject$1(raw)) {
2266
+ else if (isObject(raw)) {
2257
2267
  if (isArray(raw)) {
2258
2268
  raw.forEach(r => createWatcher(r, ctx, publicThis, key));
2259
2269
  }
2260
2270
  else {
2261
- const handler = isFunction$1(raw.handler)
2271
+ const handler = isFunction(raw.handler)
2262
2272
  ? raw.handler.bind(publicThis)
2263
2273
  : ctx[raw.handler];
2264
- if (isFunction$1(handler)) {
2274
+ if (isFunction(handler)) {
2265
2275
  watch(getter, handler, raw);
2266
2276
  }
2267
2277
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -2362,7 +2372,7 @@ function mergeDataFn(to, from) {
2362
2372
  return from;
2363
2373
  }
2364
2374
  return function mergedDataFn() {
2365
- return (extend)(isFunction$1(to) ? to.call(this, this) : to, isFunction$1(from) ? from.call(this, this) : from);
2375
+ return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
2366
2376
  };
2367
2377
  }
2368
2378
  function mergeInject(to, from) {
@@ -2569,7 +2579,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
2569
2579
  // default values
2570
2580
  if (hasDefault && value === undefined) {
2571
2581
  const defaultValue = opt.default;
2572
- if (opt.type !== Function && isFunction$1(defaultValue)) {
2582
+ if (opt.type !== Function && isFunction(defaultValue)) {
2573
2583
  const { propsDefaults } = instance;
2574
2584
  if (key in propsDefaults) {
2575
2585
  value = propsDefaults[key];
@@ -2608,7 +2618,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2608
2618
  const needCastKeys = [];
2609
2619
  // apply mixin/extends props
2610
2620
  let hasExtends = false;
2611
- if (__VUE_OPTIONS_API__ && !isFunction$1(comp)) {
2621
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
2612
2622
  const extendProps = (raw) => {
2613
2623
  hasExtends = true;
2614
2624
  const [props, keys] = normalizePropsOptions(raw, appContext, true);
@@ -2642,7 +2652,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2642
2652
  }
2643
2653
  }
2644
2654
  else if (raw) {
2645
- if ((process.env.NODE_ENV !== 'production') && !isObject$1(raw)) {
2655
+ if ((process.env.NODE_ENV !== 'production') && !isObject(raw)) {
2646
2656
  warn(`invalid props options`, raw);
2647
2657
  }
2648
2658
  for (const key in raw) {
@@ -2650,7 +2660,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2650
2660
  if (validatePropName(normalizedKey)) {
2651
2661
  const opt = raw[key];
2652
2662
  const prop = (normalized[normalizedKey] =
2653
- isArray(opt) || isFunction$1(opt) ? { type: opt } : opt);
2663
+ isArray(opt) || isFunction(opt) ? { type: opt } : opt);
2654
2664
  if (prop) {
2655
2665
  const booleanIndex = getTypeIndex(Boolean, prop.type);
2656
2666
  const stringIndex = getTypeIndex(String, prop.type);
@@ -2691,7 +2701,7 @@ function getTypeIndex(type, expectedTypes) {
2691
2701
  if (isArray(expectedTypes)) {
2692
2702
  return expectedTypes.findIndex(t => isSameType(t, type));
2693
2703
  }
2694
- else if (isFunction$1(expectedTypes)) {
2704
+ else if (isFunction(expectedTypes)) {
2695
2705
  return isSameType(expectedTypes, type) ? 0 : -1;
2696
2706
  }
2697
2707
  return -1;
@@ -2760,7 +2770,7 @@ function assertType(value, type) {
2760
2770
  }
2761
2771
  }
2762
2772
  else if (expectedType === 'Object') {
2763
- valid = isObject$1(value);
2773
+ valid = isObject(value);
2764
2774
  }
2765
2775
  else if (expectedType === 'Array') {
2766
2776
  valid = isArray(value);
@@ -2849,7 +2859,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => {
2849
2859
  if (isInternalKey(key))
2850
2860
  continue;
2851
2861
  const value = rawSlots[key];
2852
- if (isFunction$1(value)) {
2862
+ if (isFunction(value)) {
2853
2863
  slots[key] = normalizeSlot(key, value, ctx);
2854
2864
  }
2855
2865
  else if (value != null) {
@@ -2978,7 +2988,7 @@ function withDirectives(vnode, directives) {
2978
2988
  const bindings = vnode.dirs || (vnode.dirs = []);
2979
2989
  for (let i = 0; i < directives.length; i++) {
2980
2990
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2981
- if (isFunction$1(dir)) {
2991
+ if (isFunction(dir)) {
2982
2992
  dir = {
2983
2993
  mounted: dir,
2984
2994
  updated: dir
@@ -3046,7 +3056,7 @@ function createAppContext() {
3046
3056
  let uid = 0;
3047
3057
  function createAppAPI(render, hydrate) {
3048
3058
  return function createApp(rootComponent, rootProps = null) {
3049
- if (rootProps != null && !isObject$1(rootProps)) {
3059
+ if (rootProps != null && !isObject(rootProps)) {
3050
3060
  (process.env.NODE_ENV !== 'production') && warn(`root props passed to app.mount() must be an object.`);
3051
3061
  rootProps = null;
3052
3062
  }
@@ -3073,11 +3083,11 @@ function createAppAPI(render, hydrate) {
3073
3083
  if (installedPlugins.has(plugin)) {
3074
3084
  (process.env.NODE_ENV !== 'production') && warn(`Plugin has already been applied to target app.`);
3075
3085
  }
3076
- else if (plugin && isFunction$1(plugin.install)) {
3086
+ else if (plugin && isFunction(plugin.install)) {
3077
3087
  installedPlugins.add(plugin);
3078
3088
  plugin.install(app, ...options);
3079
3089
  }
3080
- else if (isFunction$1(plugin)) {
3090
+ else if (isFunction(plugin)) {
3081
3091
  installedPlugins.add(plugin);
3082
3092
  plugin(app, ...options);
3083
3093
  }
@@ -3563,20 +3573,22 @@ function isSupported() {
3563
3573
  * istanbul-ignore-next
3564
3574
  */
3565
3575
  function initFeatureFlags() {
3566
- let needWarn = false;
3576
+ const needWarn = [];
3567
3577
  if (typeof __VUE_OPTIONS_API__ !== 'boolean') {
3568
- needWarn = true;
3578
+ (process.env.NODE_ENV !== 'production') && needWarn.push(`__VUE_OPTIONS_API__`);
3569
3579
  getGlobalThis().__VUE_OPTIONS_API__ = true;
3570
3580
  }
3571
3581
  if (typeof __VUE_PROD_DEVTOOLS__ !== 'boolean') {
3572
- needWarn = true;
3582
+ (process.env.NODE_ENV !== 'production') && needWarn.push(`__VUE_PROD_DEVTOOLS__`);
3573
3583
  getGlobalThis().__VUE_PROD_DEVTOOLS__ = false;
3574
3584
  }
3575
- if ((process.env.NODE_ENV !== 'production') && needWarn) {
3576
- console.warn(`You are running the esm-bundler build of Vue. It is recommended to ` +
3577
- `configure your bundler to explicitly replace feature flag globals ` +
3578
- `with boolean literals to get proper tree-shaking in the final bundle. ` +
3579
- `See http://link.vuejs.org/feature-flags for more details.`);
3585
+ if ((process.env.NODE_ENV !== 'production') && needWarn.length) {
3586
+ const multi = needWarn.length > 1;
3587
+ console.warn(`Feature flag${multi ? `s` : ``} ${needWarn.join(', ')} ${multi ? `are` : `is`} not explicitly defined. You are running the esm-bundler build of Vue, ` +
3588
+ `which expects these compile-time feature flags to be globally injected ` +
3589
+ `via the bundler config in order to get better tree-shaking in the ` +
3590
+ `production bundle.\n\n` +
3591
+ `For more details, see http://link.vuejs.org/feature-flags.`);
3580
3592
  }
3581
3593
  }
3582
3594
 
@@ -4902,7 +4914,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4902
4914
  doSet();
4903
4915
  }
4904
4916
  }
4905
- else if (isFunction$1(ref)) {
4917
+ else if (isFunction(ref)) {
4906
4918
  callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
4907
4919
  }
4908
4920
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -5379,7 +5391,7 @@ const InternalObjectKey = `__vInternal`;
5379
5391
  const normalizeKey = ({ key }) => key != null ? key : null;
5380
5392
  const normalizeRef = ({ ref }) => {
5381
5393
  return (ref != null
5382
- ? isString(ref) || isRef(ref) || isFunction$1(ref)
5394
+ ? isString(ref) || isRef(ref) || isFunction(ref)
5383
5395
  ? { i: currentRenderingInstance, r: ref }
5384
5396
  : ref
5385
5397
  : null);
@@ -5478,7 +5490,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5478
5490
  if (klass && !isString(klass)) {
5479
5491
  props.class = normalizeClass(klass);
5480
5492
  }
5481
- if (isObject$1(style)) {
5493
+ if (isObject(style)) {
5482
5494
  // reactive state objects need to be cloned since they are likely to be
5483
5495
  // mutated
5484
5496
  if (isProxy(style) && !isArray(style)) {
@@ -5494,9 +5506,9 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5494
5506
  ? 128 /* SUSPENSE */
5495
5507
  : isTeleport(type)
5496
5508
  ? 64 /* TELEPORT */
5497
- : isObject$1(type)
5509
+ : isObject(type)
5498
5510
  ? 4 /* STATEFUL_COMPONENT */
5499
- : isFunction$1(type)
5511
+ : isFunction(type)
5500
5512
  ? 2 /* FUNCTIONAL_COMPONENT */
5501
5513
  : 0;
5502
5514
  if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
@@ -5675,7 +5687,7 @@ function normalizeChildren(vnode, children) {
5675
5687
  }
5676
5688
  }
5677
5689
  }
5678
- else if (isFunction$1(children)) {
5690
+ else if (isFunction(children)) {
5679
5691
  children = { default: children, _ctx: currentRenderingInstance };
5680
5692
  type = 32 /* SLOTS_CHILDREN */;
5681
5693
  }
@@ -5745,7 +5757,7 @@ function renderList(source, renderItem, cache, index) {
5745
5757
  ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
5746
5758
  }
5747
5759
  }
5748
- else if (isObject$1(source)) {
5760
+ else if (isObject(source)) {
5749
5761
  if (source[Symbol.iterator]) {
5750
5762
  ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
5751
5763
  }
@@ -5847,7 +5859,7 @@ function ensureValidVNode(vnodes) {
5847
5859
  */
5848
5860
  function toHandlers(obj) {
5849
5861
  const ret = {};
5850
- if ((process.env.NODE_ENV !== 'production') && !isObject$1(obj)) {
5862
+ if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
5851
5863
  warn(`v-on with no argument expects an object value.`);
5852
5864
  return ret;
5853
5865
  }
@@ -6282,7 +6294,7 @@ function setupStatefulComponent(instance, isSSR) {
6282
6294
  const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
6283
6295
  resetTracking();
6284
6296
  unsetCurrentInstance();
6285
- if (isPromise$1(setupResult)) {
6297
+ if (isPromise(setupResult)) {
6286
6298
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
6287
6299
  if (isSSR) {
6288
6300
  // return the promise so server-renderer can wait on it
@@ -6309,13 +6321,18 @@ function setupStatefulComponent(instance, isSSR) {
6309
6321
  }
6310
6322
  }
6311
6323
  function handleSetupResult(instance, setupResult, isSSR) {
6312
- if (isFunction$1(setupResult)) {
6324
+ if (isFunction(setupResult)) {
6313
6325
  // setup returned an inline render function
6314
- {
6326
+ if (instance.type.__ssrInlineRender) {
6327
+ // when the function's name is `ssrRender` (compiled by SFC inline mode),
6328
+ // set it as ssrRender instead.
6329
+ instance.ssrRender = setupResult;
6330
+ }
6331
+ else {
6315
6332
  instance.render = setupResult;
6316
6333
  }
6317
6334
  }
6318
- else if (isObject$1(setupResult)) {
6335
+ else if (isObject(setupResult)) {
6319
6336
  if ((process.env.NODE_ENV !== 'production') && isVNode(setupResult)) {
6320
6337
  warn(`setup() should not return VNodes directly - ` +
6321
6338
  `return a render function instead.`);
@@ -6354,9 +6371,11 @@ const isRuntimeOnly = () => !compile;
6354
6371
  function finishComponentSetup(instance, isSSR, skipOptions) {
6355
6372
  const Component = instance.type;
6356
6373
  // template / render function normalization
6374
+ // could be already set when returned from setup()
6357
6375
  if (!instance.render) {
6358
- // could be set from setup()
6359
- if (compile && !Component.render) {
6376
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
6377
+ // is done by server-renderer
6378
+ if (!isSSR && compile && !Component.render) {
6360
6379
  const template = Component.template;
6361
6380
  if (template) {
6362
6381
  if ((process.env.NODE_ENV !== 'production')) {
@@ -6482,7 +6501,7 @@ function getExposeProxy(instance) {
6482
6501
  const classifyRE = /(?:^|[-_])(\w)/g;
6483
6502
  const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
6484
6503
  function getComponentName(Component) {
6485
- return isFunction$1(Component)
6504
+ return isFunction(Component)
6486
6505
  ? Component.displayName || Component.name
6487
6506
  : Component.name;
6488
6507
  }
@@ -6511,7 +6530,7 @@ function formatComponentName(instance, Component, isRoot = false) {
6511
6530
  return name ? classify(name) : isRoot ? `App` : `Anonymous`;
6512
6531
  }
6513
6532
  function isClassComponent(value) {
6514
- return isFunction$1(value) && '__vccOpts' in value;
6533
+ return isFunction(value) && '__vccOpts' in value;
6515
6534
  }
6516
6535
 
6517
6536
  const stack = [];
@@ -6619,7 +6638,7 @@ function formatProp(key, value, raw) {
6619
6638
  value = formatProp(key, toRaw(value.value), true);
6620
6639
  return raw ? value : [`${key}=Ref<`, value, `>`];
6621
6640
  }
6622
- else if (isFunction$1(value)) {
6641
+ else if (isFunction(value)) {
6623
6642
  return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
6624
6643
  }
6625
6644
  else {
@@ -6671,9 +6690,9 @@ function callWithErrorHandling(fn, instance, type, args) {
6671
6690
  return res;
6672
6691
  }
6673
6692
  function callWithAsyncErrorHandling(fn, instance, type, args) {
6674
- if (isFunction$1(fn)) {
6693
+ if (isFunction(fn)) {
6675
6694
  const res = callWithErrorHandling(fn, instance, type, args);
6676
- if (res && isPromise$1(res)) {
6695
+ if (res && isPromise(res)) {
6677
6696
  res.catch(err => {
6678
6697
  handleError(err, instance, type);
6679
6698
  });
@@ -6961,7 +6980,7 @@ function watchSyncEffect(effect, options) {
6961
6980
  const INITIAL_WATCHER_VALUE = {};
6962
6981
  // implementation
6963
6982
  function watch(source, cb, options) {
6964
- if ((process.env.NODE_ENV !== 'production') && !isFunction$1(cb)) {
6983
+ if ((process.env.NODE_ENV !== 'production') && !isFunction(cb)) {
6965
6984
  warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
6966
6985
  `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
6967
6986
  `supports \`watch(source, cb, options?) signature.`);
@@ -7005,7 +7024,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
7005
7024
  else if (isReactive(s)) {
7006
7025
  return traverse(s);
7007
7026
  }
7008
- else if (isFunction$1(s)) {
7027
+ else if (isFunction(s)) {
7009
7028
  return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
7010
7029
  }
7011
7030
  else {
@@ -7013,7 +7032,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
7013
7032
  }
7014
7033
  });
7015
7034
  }
7016
- else if (isFunction$1(source)) {
7035
+ else if (isFunction(source)) {
7017
7036
  if (cb) {
7018
7037
  // getter with cb
7019
7038
  getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
@@ -7045,6 +7064,23 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
7045
7064
  callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
7046
7065
  };
7047
7066
  };
7067
+ // in SSR there is no need to setup an actual effect, and it should be noop
7068
+ // unless it's eager
7069
+ if (isInSSRComponentSetup) {
7070
+ // we will also not call the invalidate callback (+ runner is not set up)
7071
+ onInvalidate = NOOP;
7072
+ if (!cb) {
7073
+ getter();
7074
+ }
7075
+ else if (immediate) {
7076
+ callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
7077
+ getter(),
7078
+ isMultiSource ? [] : undefined,
7079
+ onInvalidate
7080
+ ]);
7081
+ }
7082
+ return NOOP;
7083
+ }
7048
7084
  let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
7049
7085
  const job = () => {
7050
7086
  if (!effect.active) {
@@ -7136,7 +7172,7 @@ function instanceWatch(source, value, options) {
7136
7172
  : () => publicThis[source]
7137
7173
  : source.bind(publicThis, publicThis);
7138
7174
  let cb;
7139
- if (isFunction$1(value)) {
7175
+ if (isFunction(value)) {
7140
7176
  cb = value;
7141
7177
  }
7142
7178
  else {
@@ -7165,7 +7201,7 @@ function createPathGetter(ctx, path) {
7165
7201
  };
7166
7202
  }
7167
7203
  function traverse(value, seen) {
7168
- if (!isObject$1(value) || value["__v_skip" /* SKIP */]) {
7204
+ if (!isObject(value) || value["__v_skip" /* SKIP */]) {
7169
7205
  return value;
7170
7206
  }
7171
7207
  seen = seen || new Set();
@@ -7194,16 +7230,6 @@ function traverse(value, seen) {
7194
7230
  return value;
7195
7231
  }
7196
7232
 
7197
- (process.env.NODE_ENV !== 'production')
7198
- ? Object.freeze({})
7199
- : {};
7200
- (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
7201
- const isFunction = (val) => typeof val === 'function';
7202
- const isObject = (val) => val !== null && typeof val === 'object';
7203
- const isPromise = (val) => {
7204
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
7205
- };
7206
-
7207
7233
  // dev only
7208
7234
  const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
7209
7235
  `<script setup> of a single file component. Its arguments should be ` +
@@ -7281,15 +7307,21 @@ function getContext() {
7281
7307
  * only.
7282
7308
  * @internal
7283
7309
  */
7284
- function mergeDefaults(
7285
- // the base props is compiler-generated and guaranteed to be in this shape.
7286
- props, defaults) {
7310
+ function mergeDefaults(raw, defaults) {
7311
+ const props = isArray(raw)
7312
+ ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
7313
+ : raw;
7287
7314
  for (const key in defaults) {
7288
- const val = props[key];
7289
- if (val) {
7290
- val.default = defaults[key];
7315
+ const opt = props[key];
7316
+ if (opt) {
7317
+ if (isArray(opt) || isFunction(opt)) {
7318
+ props[key] = { type: opt, default: defaults[key] };
7319
+ }
7320
+ else {
7321
+ opt.default = defaults[key];
7322
+ }
7291
7323
  }
7292
- else if (val === null) {
7324
+ else if (opt === null) {
7293
7325
  props[key] = { default: defaults[key] };
7294
7326
  }
7295
7327
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -7298,6 +7330,23 @@ props, defaults) {
7298
7330
  }
7299
7331
  return props;
7300
7332
  }
7333
+ /**
7334
+ * Used to create a proxy for the rest element when destructuring props with
7335
+ * defineProps().
7336
+ * @internal
7337
+ */
7338
+ function createPropsRestProxy(props, excludedKeys) {
7339
+ const ret = {};
7340
+ for (const key in props) {
7341
+ if (!excludedKeys.includes(key)) {
7342
+ Object.defineProperty(ret, key, {
7343
+ enumerable: true,
7344
+ get: () => props[key]
7345
+ });
7346
+ }
7347
+ }
7348
+ return ret;
7349
+ }
7301
7350
  /**
7302
7351
  * `<script setup>` helper for persisting the current instance context over
7303
7352
  * async/await flows.
@@ -7337,7 +7386,7 @@ function withAsyncContext(getAwaitable) {
7337
7386
  function h(type, propsOrChildren, children) {
7338
7387
  const l = arguments.length;
7339
7388
  if (l === 2) {
7340
- if (isObject$1(propsOrChildren) && !isArray(propsOrChildren)) {
7389
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
7341
7390
  // single vnode without props
7342
7391
  if (isVNode(propsOrChildren)) {
7343
7392
  return createVNode(type, null, [propsOrChildren]);
@@ -7387,7 +7436,7 @@ function initCustomFormatter() {
7387
7436
  const formatter = {
7388
7437
  header(obj) {
7389
7438
  // TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
7390
- if (!isObject$1(obj)) {
7439
+ if (!isObject(obj)) {
7391
7440
  return null;
7392
7441
  }
7393
7442
  if (obj.__isVue) {
@@ -7512,7 +7561,7 @@ function initCustomFormatter() {
7512
7561
  else if (typeof v === 'boolean') {
7513
7562
  return ['span', keywordStyle, v];
7514
7563
  }
7515
- else if (isObject$1(v)) {
7564
+ else if (isObject(v)) {
7516
7565
  return ['object', { object: asRaw ? toRaw(v) : v }];
7517
7566
  }
7518
7567
  else {
@@ -7521,7 +7570,7 @@ function initCustomFormatter() {
7521
7570
  }
7522
7571
  function extractKeys(instance, type) {
7523
7572
  const Comp = instance.type;
7524
- if (isFunction$1(Comp)) {
7573
+ if (isFunction(Comp)) {
7525
7574
  return;
7526
7575
  }
7527
7576
  const extracted = {};
@@ -7535,7 +7584,7 @@ function initCustomFormatter() {
7535
7584
  function isKeyOfType(Comp, key, type) {
7536
7585
  const opts = Comp[type];
7537
7586
  if ((isArray(opts) && opts.includes(key)) ||
7538
- (isObject$1(opts) && key in opts)) {
7587
+ (isObject(opts) && key in opts)) {
7539
7588
  return true;
7540
7589
  }
7541
7590
  if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
@@ -7590,7 +7639,7 @@ function isMemoSame(cached, memo) {
7590
7639
  }
7591
7640
 
7592
7641
  // Core API ------------------------------------------------------------------
7593
- const version = "3.2.16";
7642
+ const version = "3.2.20";
7594
7643
  const _ssrUtils = {
7595
7644
  createComponentInstance,
7596
7645
  setupComponent,
@@ -7613,4 +7662,4 @@ const resolveFilter = null;
7613
7662
  */
7614
7663
  const compatUtils = (null);
7615
7664
 
7616
- export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
7665
+ export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.2.16",
3
+ "version": "3.2.20",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.2.16",
36
- "@vue/reactivity": "3.2.16"
35
+ "@vue/shared": "3.2.20",
36
+ "@vue/reactivity": "3.2.20"
37
37
  }
38
38
  }