@vue/runtime-core 3.2.8 → 3.2.12

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.
@@ -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, isFunction as isFunction$1, isArray, hasOwn, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isOn, 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 { 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';
4
4
  export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
5
5
 
6
6
  /* eslint-disable no-restricted-globals */
@@ -30,41 +30,33 @@ function registerHMR(instance) {
30
30
  const id = instance.type.__hmrId;
31
31
  let record = map.get(id);
32
32
  if (!record) {
33
- createRecord(id, instance.type);
33
+ createRecord(id);
34
34
  record = map.get(id);
35
35
  }
36
- record.instances.add(instance);
36
+ record.add(instance);
37
37
  }
38
38
  function unregisterHMR(instance) {
39
- map.get(instance.type.__hmrId).instances.delete(instance);
39
+ map.get(instance.type.__hmrId).delete(instance);
40
40
  }
41
- function createRecord(id, component) {
42
- if (!component) {
43
- warn(`HMR API usage is out of date.\n` +
44
- `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
45
- `dependency that handles Vue SFC compilation.`);
46
- component = {};
47
- }
41
+ function createRecord(id) {
48
42
  if (map.has(id)) {
49
43
  return false;
50
44
  }
51
- map.set(id, {
52
- component: isClassComponent(component) ? component.__vccOpts : component,
53
- instances: new Set()
54
- });
45
+ map.set(id, new Set());
55
46
  return true;
56
47
  }
48
+ function normalizeClassComponent(component) {
49
+ return isClassComponent(component) ? component.__vccOpts : component;
50
+ }
57
51
  function rerender(id, newRender) {
58
52
  const record = map.get(id);
59
- if (!record)
53
+ if (!record) {
60
54
  return;
61
- if (newRender)
62
- record.component.render = newRender;
63
- // Array.from creates a snapshot which avoids the set being mutated during
64
- // updates
65
- Array.from(record.instances).forEach(instance => {
55
+ }
56
+ [...record].forEach(instance => {
66
57
  if (newRender) {
67
58
  instance.render = newRender;
59
+ normalizeClassComponent(instance.type).render = newRender;
68
60
  }
69
61
  instance.renderCache = [];
70
62
  // this flag forces child components with slot content to update
@@ -77,34 +69,31 @@ function reload(id, newComp) {
77
69
  const record = map.get(id);
78
70
  if (!record)
79
71
  return;
80
- // Array.from creates a snapshot which avoids the set being mutated during
81
- // updates
82
- const { component, instances } = record;
83
- if (!hmrDirtyComponents.has(component)) {
84
- // 1. Update existing comp definition to match new one
85
- newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
86
- extend(component, newComp);
87
- for (const key in component) {
88
- if (key !== '__file' && !(key in newComp)) {
89
- delete component[key];
90
- }
91
- }
92
- // 2. Mark component dirty. This forces the renderer to replace the component
93
- // on patch.
94
- hmrDirtyComponents.add(component);
95
- // 3. Make sure to unmark the component after the reload.
96
- queuePostFlushCb(() => {
97
- hmrDirtyComponents.delete(component);
98
- });
99
- }
100
- Array.from(instances).forEach(instance => {
101
- // invalidate options resolution cache
72
+ newComp = normalizeClassComponent(newComp);
73
+ // create a snapshot which avoids the set being mutated during updates
74
+ const instances = [...record];
75
+ for (const instance of instances) {
76
+ const oldComp = normalizeClassComponent(instance.type);
77
+ if (!hmrDirtyComponents.has(oldComp)) {
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
+ }
84
+ }
85
+ // 2. mark definition dirty. This forces the renderer to replace the
86
+ // component on patch.
87
+ hmrDirtyComponents.add(oldComp);
88
+ }
89
+ // 3. invalidate options resolution cache
102
90
  instance.appContext.optionsCache.delete(instance.type);
91
+ // 4. actually update
103
92
  if (instance.ceReload) {
104
93
  // custom element
105
- hmrDirtyComponents.add(component);
94
+ hmrDirtyComponents.add(oldComp);
106
95
  instance.ceReload(newComp.styles);
107
- hmrDirtyComponents.delete(component);
96
+ hmrDirtyComponents.delete(oldComp);
108
97
  }
109
98
  else if (instance.parent) {
110
99
  // 4. Force the parent instance to re-render. This will cause all updated
@@ -129,6 +118,12 @@ function reload(id, newComp) {
129
118
  else {
130
119
  console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
131
120
  }
121
+ }
122
+ // 5. make sure to cleanup dirty hmr components after update
123
+ queuePostFlushCb(() => {
124
+ for (const instance of instances) {
125
+ hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
126
+ }
132
127
  });
133
128
  }
134
129
  function tryWrap(fn) {
@@ -191,338 +186,6 @@ function devtoolsComponentEmit(component, event, params) {
191
186
  devtools.emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
192
187
  }
193
188
 
194
- const deprecationData = {
195
- ["GLOBAL_MOUNT" /* GLOBAL_MOUNT */]: {
196
- message: `The global app bootstrapping API has changed: vm.$mount() and the "el" ` +
197
- `option have been removed. Use createApp(RootComponent).mount() instead.`,
198
- link: `https://v3.vuejs.org/guide/migration/global-api.html#mounting-app-instance`
199
- },
200
- ["GLOBAL_MOUNT_CONTAINER" /* GLOBAL_MOUNT_CONTAINER */]: {
201
- message: `Vue detected directives on the mount container. ` +
202
- `In Vue 3, the container is no longer considered part of the template ` +
203
- `and will not be processed/replaced.`,
204
- link: `https://v3.vuejs.org/guide/migration/mount-changes.html`
205
- },
206
- ["GLOBAL_EXTEND" /* GLOBAL_EXTEND */]: {
207
- message: `Vue.extend() has been removed in Vue 3. ` +
208
- `Use defineComponent() instead.`,
209
- link: `https://v3.vuejs.org/api/global-api.html#definecomponent`
210
- },
211
- ["GLOBAL_PROTOTYPE" /* GLOBAL_PROTOTYPE */]: {
212
- message: `Vue.prototype is no longer available in Vue 3. ` +
213
- `Use app.config.globalProperties instead.`,
214
- link: `https://v3.vuejs.org/guide/migration/global-api.html#vue-prototype-replaced-by-config-globalproperties`
215
- },
216
- ["GLOBAL_SET" /* GLOBAL_SET */]: {
217
- message: `Vue.set() has been removed as it is no longer needed in Vue 3. ` +
218
- `Simply use native JavaScript mutations.`
219
- },
220
- ["GLOBAL_DELETE" /* GLOBAL_DELETE */]: {
221
- message: `Vue.delete() has been removed as it is no longer needed in Vue 3. ` +
222
- `Simply use native JavaScript mutations.`
223
- },
224
- ["GLOBAL_OBSERVABLE" /* GLOBAL_OBSERVABLE */]: {
225
- message: `Vue.observable() has been removed. ` +
226
- `Use \`import { reactive } from "vue"\` from Composition API instead.`,
227
- link: `https://v3.vuejs.org/api/basic-reactivity.html`
228
- },
229
- ["GLOBAL_PRIVATE_UTIL" /* GLOBAL_PRIVATE_UTIL */]: {
230
- message: `Vue.util has been removed. Please refactor to avoid its usage ` +
231
- `since it was an internal API even in Vue 2.`
232
- },
233
- ["CONFIG_SILENT" /* CONFIG_SILENT */]: {
234
- message: `config.silent has been removed because it is not good practice to ` +
235
- `intentionally suppress warnings. You can use your browser console's ` +
236
- `filter features to focus on relevant messages.`
237
- },
238
- ["CONFIG_DEVTOOLS" /* CONFIG_DEVTOOLS */]: {
239
- message: `config.devtools has been removed. To enable devtools for ` +
240
- `production, configure the __VUE_PROD_DEVTOOLS__ compile-time flag.`,
241
- link: `https://github.com/vuejs/vue-next/tree/master/packages/vue#bundler-build-feature-flags`
242
- },
243
- ["CONFIG_KEY_CODES" /* CONFIG_KEY_CODES */]: {
244
- message: `config.keyCodes has been removed. ` +
245
- `In Vue 3, you can directly use the kebab-case key names as v-on modifiers.`,
246
- link: `https://v3.vuejs.org/guide/migration/keycode-modifiers.html`
247
- },
248
- ["CONFIG_PRODUCTION_TIP" /* CONFIG_PRODUCTION_TIP */]: {
249
- message: `config.productionTip has been removed.`,
250
- link: `https://v3.vuejs.org/guide/migration/global-api.html#config-productiontip-removed`
251
- },
252
- ["CONFIG_IGNORED_ELEMENTS" /* CONFIG_IGNORED_ELEMENTS */]: {
253
- message: () => {
254
- let msg = `config.ignoredElements has been removed.`;
255
- if (isRuntimeOnly()) {
256
- msg += ` Pass the "isCustomElement" option to @vue/compiler-dom instead.`;
257
- }
258
- else {
259
- msg += ` Use config.isCustomElement instead.`;
260
- }
261
- return msg;
262
- },
263
- link: `https://v3.vuejs.org/guide/migration/global-api.html#config-ignoredelements-is-now-config-iscustomelement`
264
- },
265
- ["CONFIG_WHITESPACE" /* CONFIG_WHITESPACE */]: {
266
- // this warning is only relevant in the full build when using runtime
267
- // compilation, so it's put in the runtime compatConfig list.
268
- message: `Vue 3 compiler's whitespace option will default to "condense" instead of ` +
269
- `"preserve". To suppress this warning, provide an explicit value for ` +
270
- `\`config.compilerOptions.whitespace\`.`
271
- },
272
- ["CONFIG_OPTION_MERGE_STRATS" /* CONFIG_OPTION_MERGE_STRATS */]: {
273
- message: `config.optionMergeStrategies no longer exposes internal strategies. ` +
274
- `Use custom merge functions instead.`
275
- },
276
- ["INSTANCE_SET" /* INSTANCE_SET */]: {
277
- message: `vm.$set() has been removed as it is no longer needed in Vue 3. ` +
278
- `Simply use native JavaScript mutations.`
279
- },
280
- ["INSTANCE_DELETE" /* INSTANCE_DELETE */]: {
281
- message: `vm.$delete() has been removed as it is no longer needed in Vue 3. ` +
282
- `Simply use native JavaScript mutations.`
283
- },
284
- ["INSTANCE_DESTROY" /* INSTANCE_DESTROY */]: {
285
- message: `vm.$destroy() has been removed. Use app.unmount() instead.`,
286
- link: `https://v3.vuejs.org/api/application-api.html#unmount`
287
- },
288
- ["INSTANCE_EVENT_EMITTER" /* INSTANCE_EVENT_EMITTER */]: {
289
- message: `vm.$on/$once/$off() have been removed. ` +
290
- `Use an external event emitter library instead.`,
291
- link: `https://v3.vuejs.org/guide/migration/events-api.html`
292
- },
293
- ["INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */]: {
294
- message: event => `"${event}" lifecycle events are no longer supported. From templates, ` +
295
- `use the "vnode" prefix instead of "hook:". For example, @${event} ` +
296
- `should be changed to @vnode-${event.slice(5)}. ` +
297
- `From JavaScript, use Composition API to dynamically register lifecycle ` +
298
- `hooks.`,
299
- link: `https://v3.vuejs.org/guide/migration/vnode-lifecycle-events.html`
300
- },
301
- ["INSTANCE_CHILDREN" /* INSTANCE_CHILDREN */]: {
302
- message: `vm.$children has been removed. Consider refactoring your logic ` +
303
- `to avoid relying on direct access to child components.`,
304
- link: `https://v3.vuejs.org/guide/migration/children.html`
305
- },
306
- ["INSTANCE_LISTENERS" /* INSTANCE_LISTENERS */]: {
307
- message: `vm.$listeners has been removed. In Vue 3, parent v-on listeners are ` +
308
- `included in vm.$attrs and it is no longer necessary to separately use ` +
309
- `v-on="$listeners" if you are already using v-bind="$attrs". ` +
310
- `(Note: the Vue 3 behavior only applies if this compat config is disabled)`,
311
- link: `https://v3.vuejs.org/guide/migration/listeners-removed.html`
312
- },
313
- ["INSTANCE_SCOPED_SLOTS" /* INSTANCE_SCOPED_SLOTS */]: {
314
- message: `vm.$scopedSlots has been removed. Use vm.$slots instead.`,
315
- link: `https://v3.vuejs.org/guide/migration/slots-unification.html`
316
- },
317
- ["INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */]: {
318
- message: componentName => `Component <${componentName || 'Anonymous'}> has \`inheritAttrs: false\` but is ` +
319
- `relying on class/style fallthrough from parent. In Vue 3, class/style ` +
320
- `are now included in $attrs and will no longer fallthrough when ` +
321
- `inheritAttrs is false. If you are already using v-bind="$attrs" on ` +
322
- `component root it should render the same end result. ` +
323
- `If you are binding $attrs to a non-root element and expecting ` +
324
- `class/style to fallthrough on root, you will need to now manually bind ` +
325
- `them on root via :class="$attrs.class".`,
326
- link: `https://v3.vuejs.org/guide/migration/attrs-includes-class-style.html`
327
- },
328
- ["OPTIONS_DATA_FN" /* OPTIONS_DATA_FN */]: {
329
- message: `The "data" option can no longer be a plain object. ` +
330
- `Always use a function.`,
331
- link: `https://v3.vuejs.org/guide/migration/data-option.html`
332
- },
333
- ["OPTIONS_DATA_MERGE" /* OPTIONS_DATA_MERGE */]: {
334
- message: (key) => `Detected conflicting key "${key}" when merging data option values. ` +
335
- `In Vue 3, data keys are merged shallowly and will override one another.`,
336
- link: `https://v3.vuejs.org/guide/migration/data-option.html#mixin-merge-behavior-change`
337
- },
338
- ["OPTIONS_BEFORE_DESTROY" /* OPTIONS_BEFORE_DESTROY */]: {
339
- message: `\`beforeDestroy\` has been renamed to \`beforeUnmount\`.`
340
- },
341
- ["OPTIONS_DESTROYED" /* OPTIONS_DESTROYED */]: {
342
- message: `\`destroyed\` has been renamed to \`unmounted\`.`
343
- },
344
- ["WATCH_ARRAY" /* WATCH_ARRAY */]: {
345
- message: `"watch" option or vm.$watch on an array value will no longer ` +
346
- `trigger on array mutation unless the "deep" option is specified. ` +
347
- `If current usage is intended, you can disable the compat behavior and ` +
348
- `suppress this warning with:` +
349
- `\n\n configureCompat({ ${"WATCH_ARRAY" /* WATCH_ARRAY */}: false })\n`,
350
- link: `https://v3.vuejs.org/guide/migration/watch.html`
351
- },
352
- ["PROPS_DEFAULT_THIS" /* PROPS_DEFAULT_THIS */]: {
353
- message: (key) => `props default value function no longer has access to "this". The compat ` +
354
- `build only offers access to this.$options.` +
355
- `(found in prop "${key}")`,
356
- link: `https://v3.vuejs.org/guide/migration/props-default-this.html`
357
- },
358
- ["CUSTOM_DIR" /* CUSTOM_DIR */]: {
359
- message: (legacyHook, newHook) => `Custom directive hook "${legacyHook}" has been removed. ` +
360
- `Use "${newHook}" instead.`,
361
- link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
362
- },
363
- ["V_FOR_REF" /* V_FOR_REF */]: {
364
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
365
- `Consider using function refs or refactor to avoid ref usage altogether.`,
366
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
367
- },
368
- ["V_ON_KEYCODE_MODIFIER" /* V_ON_KEYCODE_MODIFIER */]: {
369
- message: `Using keyCode as v-on modifier is no longer supported. ` +
370
- `Use kebab-case key name modifiers instead.`,
371
- link: `https://v3.vuejs.org/guide/migration/keycode-modifiers.html`
372
- },
373
- ["ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */]: {
374
- message: (name) => `Attribute "${name}" with v-bind value \`false\` will render ` +
375
- `${name}="false" instead of removing it in Vue 3. To remove the attribute, ` +
376
- `use \`null\` or \`undefined\` instead. If the usage is intended, ` +
377
- `you can disable the compat behavior and suppress this warning with:` +
378
- `\n\n configureCompat({ ${"ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */}: false })\n`,
379
- link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
380
- },
381
- ["ATTR_ENUMERATED_COERCION" /* ATTR_ENUMERATED_COERCION */]: {
382
- message: (name, value, coerced) => `Enumerated attribute "${name}" with v-bind value \`${value}\` will ` +
383
- `${value === null ? `be removed` : `render the value as-is`} instead of coercing the value to "${coerced}" in Vue 3. ` +
384
- `Always use explicit "true" or "false" values for enumerated attributes. ` +
385
- `If the usage is intended, ` +
386
- `you can disable the compat behavior and suppress this warning with:` +
387
- `\n\n configureCompat({ ${"ATTR_ENUMERATED_COERCION" /* ATTR_ENUMERATED_COERCION */}: false })\n`,
388
- link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
389
- },
390
- ["TRANSITION_CLASSES" /* TRANSITION_CLASSES */]: {
391
- message: `` // this feature cannot be runtime-detected
392
- },
393
- ["TRANSITION_GROUP_ROOT" /* TRANSITION_GROUP_ROOT */]: {
394
- message: `<TransitionGroup> no longer renders a root <span> element by ` +
395
- `default if no "tag" prop is specified. If you do not rely on the span ` +
396
- `for styling, you can disable the compat behavior and suppress this ` +
397
- `warning with:` +
398
- `\n\n configureCompat({ ${"TRANSITION_GROUP_ROOT" /* TRANSITION_GROUP_ROOT */}: false })\n`,
399
- link: `https://v3.vuejs.org/guide/migration/transition-group.html`
400
- },
401
- ["COMPONENT_ASYNC" /* COMPONENT_ASYNC */]: {
402
- message: (comp) => {
403
- const name = getComponentName(comp);
404
- return (`Async component${name ? ` <${name}>` : `s`} should be explicitly created via \`defineAsyncComponent()\` ` +
405
- `in Vue 3. Plain functions will be treated as functional components in ` +
406
- `non-compat build. If you have already migrated all async component ` +
407
- `usage and intend to use plain functions for functional components, ` +
408
- `you can disable the compat behavior and suppress this ` +
409
- `warning with:` +
410
- `\n\n configureCompat({ ${"COMPONENT_ASYNC" /* COMPONENT_ASYNC */}: false })\n`);
411
- },
412
- link: `https://v3.vuejs.org/guide/migration/async-components.html`
413
- },
414
- ["COMPONENT_FUNCTIONAL" /* COMPONENT_FUNCTIONAL */]: {
415
- message: (comp) => {
416
- const name = getComponentName(comp);
417
- return (`Functional component${name ? ` <${name}>` : `s`} should be defined as a plain function in Vue 3. The "functional" ` +
418
- `option has been removed. NOTE: Before migrating to use plain ` +
419
- `functions for functional components, first make sure that all async ` +
420
- `components usage have been migrated and its compat behavior has ` +
421
- `been disabled.`);
422
- },
423
- link: `https://v3.vuejs.org/guide/migration/functional-components.html`
424
- },
425
- ["COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */]: {
426
- message: (comp) => {
427
- const configMsg = `opt-in to ` +
428
- `Vue 3 behavior on a per-component basis with \`compatConfig: { ${"COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */}: false }\`.`;
429
- if (comp.props &&
430
- (isArray(comp.props)
431
- ? comp.props.includes('modelValue')
432
- : hasOwn(comp.props, 'modelValue'))) {
433
- return (`Component delcares "modelValue" prop, which is Vue 3 usage, but ` +
434
- `is running under Vue 2 compat v-model behavior. You can ${configMsg}`);
435
- }
436
- return (`v-model usage on component has changed in Vue 3. Component that expects ` +
437
- `to work with v-model should now use the "modelValue" prop and emit the ` +
438
- `"update:modelValue" event. You can update the usage and then ${configMsg}`);
439
- },
440
- link: `https://v3.vuejs.org/guide/migration/v-model.html`
441
- },
442
- ["RENDER_FUNCTION" /* RENDER_FUNCTION */]: {
443
- message: `Vue 3's render function API has changed. ` +
444
- `You can opt-in to the new API with:` +
445
- `\n\n configureCompat({ ${"RENDER_FUNCTION" /* RENDER_FUNCTION */}: false })\n` +
446
- `\n (This can also be done per-component via the "compatConfig" option.)`,
447
- link: `https://v3.vuejs.org/guide/migration/render-function-api.html`
448
- },
449
- ["FILTERS" /* FILTERS */]: {
450
- message: `filters have been removed in Vue 3. ` +
451
- `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
452
- `Use method calls or computed properties instead.`,
453
- link: `https://v3.vuejs.org/guide/migration/filters.html`
454
- },
455
- ["PRIVATE_APIS" /* PRIVATE_APIS */]: {
456
- message: name => `"${name}" is a Vue 2 private API that no longer exists in Vue 3. ` +
457
- `If you are seeing this warning only due to a dependency, you can ` +
458
- `suppress this warning via { PRIVATE_APIS: 'supress-warning' }.`
459
- }
460
- };
461
- const instanceWarned = Object.create(null);
462
- const warnCount = Object.create(null);
463
- function warnDeprecation(key, instance, ...args) {
464
- if (!(process.env.NODE_ENV !== 'production')) {
465
- return;
466
- }
467
- instance = instance || getCurrentInstance();
468
- // check user config
469
- const config = getCompatConfigForKey(key, instance);
470
- if (config === 'suppress-warning') {
471
- return;
472
- }
473
- const dupKey = key + args.join('');
474
- let compId = instance && formatComponentName(instance, instance.type);
475
- if (compId === 'Anonymous' && instance) {
476
- compId = instance.uid;
477
- }
478
- // skip if the same warning is emitted for the same component type
479
- const componentDupKey = dupKey + compId;
480
- if (componentDupKey in instanceWarned) {
481
- return;
482
- }
483
- instanceWarned[componentDupKey] = true;
484
- // same warning, but different component. skip the long message and just
485
- // log the key and count.
486
- if (dupKey in warnCount) {
487
- warn(`(deprecation ${key}) (${++warnCount[dupKey] + 1})`);
488
- return;
489
- }
490
- warnCount[dupKey] = 0;
491
- const { message, link } = deprecationData[key];
492
- warn(`(deprecation ${key}) ${typeof message === 'function' ? message(...args) : message}${link ? `\n Details: ${link}` : ``}`);
493
- if (!isCompatEnabled(key, instance, true)) {
494
- console.error(`^ The above deprecation's compat behavior is disabled and will likely ` +
495
- `lead to runtime errors.`);
496
- }
497
- }
498
- const globalCompatConfig = {
499
- MODE: 2
500
- };
501
- function getCompatConfigForKey(key, instance) {
502
- const instanceConfig = instance && instance.type.compatConfig;
503
- if (instanceConfig && key in instanceConfig) {
504
- return instanceConfig[key];
505
- }
506
- return globalCompatConfig[key];
507
- }
508
- function isCompatEnabled(key, instance, enableForBuiltIn = false) {
509
- // skip compat for built-in components
510
- if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
511
- return false;
512
- }
513
- const rawMode = getCompatConfigForKey('MODE', instance) || 2;
514
- const val = getCompatConfigForKey(key, instance);
515
- const mode = isFunction$1(rawMode)
516
- ? rawMode(instance && instance.type)
517
- : rawMode;
518
- if (mode === 2) {
519
- return val !== false;
520
- }
521
- else {
522
- return val === true || val === 'suppress-warning';
523
- }
524
- }
525
-
526
189
  function emit(instance, event, ...rawArgs) {
527
190
  const props = instance.vnode.props || EMPTY_OBJ;
528
191
  if ((process.env.NODE_ENV !== 'production')) {
@@ -748,12 +411,12 @@ function markAttrsAccessed() {
748
411
  function renderComponentRoot(instance) {
749
412
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
750
413
  let result;
414
+ let fallthroughAttrs;
751
415
  const prev = setCurrentRenderingInstance(instance);
752
416
  if ((process.env.NODE_ENV !== 'production')) {
753
417
  accessedAttrs = false;
754
418
  }
755
419
  try {
756
- let fallthroughAttrs;
757
420
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
758
421
  // withProxy is a proxy with a different `has` trap only for
759
422
  // runtime-compiled render functions using `with` block.
@@ -784,97 +447,92 @@ function renderComponentRoot(instance) {
784
447
  ? attrs
785
448
  : getFunctionalFallthrough(attrs);
786
449
  }
787
- // attr merging
788
- // in dev mode, comments are preserved, and it's possible for a template
789
- // to have comments along side the root element which makes it a fragment
790
- let root = result;
791
- let setRoot = undefined;
792
- if ((process.env.NODE_ENV !== 'production') &&
793
- result.patchFlag > 0 &&
794
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
795
- ;
796
- [root, setRoot] = getChildRoot(result);
797
- }
798
- if (fallthroughAttrs && inheritAttrs !== false) {
799
- const keys = Object.keys(fallthroughAttrs);
800
- const { shapeFlag } = root;
801
- if (keys.length) {
802
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
803
- if (propsOptions && keys.some(isModelListener)) {
804
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
805
- // prop, it indicates this component expects to handle v-model and
806
- // it should not fallthrough.
807
- // related: #1543, #1643, #1989
808
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
809
- }
810
- root = cloneVNode(root, fallthroughAttrs);
811
- }
812
- else if ((process.env.NODE_ENV !== 'production') && !accessedAttrs && root.type !== Comment) {
813
- const allAttrs = Object.keys(attrs);
814
- const eventAttrs = [];
815
- const extraAttrs = [];
816
- for (let i = 0, l = allAttrs.length; i < l; i++) {
817
- const key = allAttrs[i];
818
- if (isOn(key)) {
819
- // ignore v-model handlers when they fail to fallthrough
820
- if (!isModelListener(key)) {
821
- // remove `on`, lowercase first letter to reflect event casing
822
- // accurately
823
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
824
- }
825
- }
826
- else {
827
- extraAttrs.push(key);
450
+ }
451
+ catch (err) {
452
+ blockStack.length = 0;
453
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
454
+ result = createVNode(Comment);
455
+ }
456
+ // attr merging
457
+ // in dev mode, comments are preserved, and it's possible for a template
458
+ // to have comments along side the root element which makes it a fragment
459
+ let root = result;
460
+ let setRoot = undefined;
461
+ if ((process.env.NODE_ENV !== 'production') &&
462
+ result.patchFlag > 0 &&
463
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
464
+ [root, setRoot] = getChildRoot(result);
465
+ }
466
+ if (fallthroughAttrs && inheritAttrs !== false) {
467
+ const keys = Object.keys(fallthroughAttrs);
468
+ const { shapeFlag } = root;
469
+ if (keys.length) {
470
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
471
+ if (propsOptions && keys.some(isModelListener)) {
472
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
473
+ // prop, it indicates this component expects to handle v-model and
474
+ // it should not fallthrough.
475
+ // related: #1543, #1643, #1989
476
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
477
+ }
478
+ root = cloneVNode(root, fallthroughAttrs);
479
+ }
480
+ else if ((process.env.NODE_ENV !== 'production') && !accessedAttrs && root.type !== Comment) {
481
+ const allAttrs = Object.keys(attrs);
482
+ const eventAttrs = [];
483
+ const extraAttrs = [];
484
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
485
+ const key = allAttrs[i];
486
+ if (isOn(key)) {
487
+ // ignore v-model handlers when they fail to fallthrough
488
+ if (!isModelListener(key)) {
489
+ // remove `on`, lowercase first letter to reflect event casing
490
+ // accurately
491
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
828
492
  }
829
493
  }
830
- if (extraAttrs.length) {
831
- warn(`Extraneous non-props attributes (` +
832
- `${extraAttrs.join(', ')}) ` +
833
- `were passed to component but could not be automatically inherited ` +
834
- `because component renders fragment or text root nodes.`);
835
- }
836
- if (eventAttrs.length) {
837
- warn(`Extraneous non-emits event listeners (` +
838
- `${eventAttrs.join(', ')}) ` +
839
- `were passed to component but could not be automatically inherited ` +
840
- `because component renders fragment or text root nodes. ` +
841
- `If the listener is intended to be a component custom event listener only, ` +
842
- `declare it using the "emits" option.`);
494
+ else {
495
+ extraAttrs.push(key);
843
496
  }
844
497
  }
498
+ if (extraAttrs.length) {
499
+ warn(`Extraneous non-props attributes (` +
500
+ `${extraAttrs.join(', ')}) ` +
501
+ `were passed to component but could not be automatically inherited ` +
502
+ `because component renders fragment or text root nodes.`);
503
+ }
504
+ if (eventAttrs.length) {
505
+ warn(`Extraneous non-emits event listeners (` +
506
+ `${eventAttrs.join(', ')}) ` +
507
+ `were passed to component but could not be automatically inherited ` +
508
+ `because component renders fragment or text root nodes. ` +
509
+ `If the listener is intended to be a component custom event listener only, ` +
510
+ `declare it using the "emits" option.`);
511
+ }
845
512
  }
846
513
  }
847
- if (false &&
848
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
849
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
850
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) ;
851
- // inherit directives
852
- if (vnode.dirs) {
853
- if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
854
- warn(`Runtime directive used on component with non-element root node. ` +
855
- `The directives will not function as intended.`);
856
- }
857
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
858
- }
859
- // inherit transition data
860
- if (vnode.transition) {
861
- if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
862
- warn(`Component inside <Transition> renders non-element root node ` +
863
- `that cannot be animated.`);
864
- }
865
- root.transition = vnode.transition;
866
- }
867
- if ((process.env.NODE_ENV !== 'production') && setRoot) {
868
- setRoot(root);
514
+ }
515
+ // inherit directives
516
+ if (vnode.dirs) {
517
+ if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
518
+ warn(`Runtime directive used on component with non-element root node. ` +
519
+ `The directives will not function as intended.`);
869
520
  }
870
- else {
871
- result = root;
521
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
522
+ }
523
+ // inherit transition data
524
+ if (vnode.transition) {
525
+ if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
526
+ warn(`Component inside <Transition> renders non-element root node ` +
527
+ `that cannot be animated.`);
872
528
  }
529
+ root.transition = vnode.transition;
873
530
  }
874
- catch (err) {
875
- blockStack.length = 0;
876
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
877
- result = createVNode(Comment);
531
+ if ((process.env.NODE_ENV !== 'production') && setRoot) {
532
+ setRoot(root);
533
+ }
534
+ else {
535
+ result = root;
878
536
  }
879
537
  setCurrentRenderingInstance(prev);
880
538
  return result;
@@ -1409,8 +1067,8 @@ function normalizeSuspenseChildren(vnode) {
1409
1067
  function normalizeSuspenseSlot(s) {
1410
1068
  let block;
1411
1069
  if (isFunction$1(s)) {
1412
- const isCompiledSlot = s._c;
1413
- if (isCompiledSlot) {
1070
+ const trackBlock = isBlockTreeEnabled && s._c;
1071
+ if (trackBlock) {
1414
1072
  // disableTracking: false
1415
1073
  // allow block tracking for compiled slots
1416
1074
  // (see ./componentRenderContext.ts)
@@ -1418,7 +1076,7 @@ function normalizeSuspenseSlot(s) {
1418
1076
  openBlock();
1419
1077
  }
1420
1078
  s = s();
1421
- if (isCompiledSlot) {
1079
+ if (trackBlock) {
1422
1080
  s._d = true;
1423
1081
  block = currentBlock;
1424
1082
  closeBlock();
@@ -5573,7 +5231,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
5573
5231
  return Component;
5574
5232
  }
5575
5233
  if ((process.env.NODE_ENV !== 'production') && warnMissing && !res) {
5576
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
5234
+ const extra = type === COMPONENTS
5235
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
5236
+ `component resolution via compilerOptions.isCustomElement.`
5237
+ : ``;
5238
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
5577
5239
  }
5578
5240
  return res;
5579
5241
  }
@@ -6433,17 +6095,19 @@ function exposePropsOnRenderContext(instance) {
6433
6095
  function exposeSetupStateOnRenderContext(instance) {
6434
6096
  const { ctx, setupState } = instance;
6435
6097
  Object.keys(toRaw(setupState)).forEach(key => {
6436
- if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
6437
- warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
6438
- `which are reserved prefixes for Vue internals.`);
6439
- return;
6098
+ if (!setupState.__isScriptSetup) {
6099
+ if (key[0] === '$' || key[0] === '_') {
6100
+ warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
6101
+ `which are reserved prefixes for Vue internals.`);
6102
+ return;
6103
+ }
6104
+ Object.defineProperty(ctx, key, {
6105
+ enumerable: true,
6106
+ configurable: true,
6107
+ get: () => setupState[key],
6108
+ set: NOOP
6109
+ });
6440
6110
  }
6441
- Object.defineProperty(ctx, key, {
6442
- enumerable: true,
6443
- configurable: true,
6444
- get: () => setupState[key],
6445
- set: NOOP
6446
- });
6447
6111
  });
6448
6112
  }
6449
6113
 
@@ -7212,11 +6876,19 @@ function flushJobs(seen) {
7212
6876
  // 2. If a component is unmounted during a parent component's update,
7213
6877
  // its update can be skipped.
7214
6878
  queue.sort((a, b) => getId(a) - getId(b));
6879
+ // conditional usage of checkRecursiveUpdate must be determined out of
6880
+ // try ... catch block since Rollup by default de-optimizes treeshaking
6881
+ // inside try-catch. This can leave all warning code unshaked. Although
6882
+ // they would get eventually shaken by a minifier like terser, some minifiers
6883
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
6884
+ const check = (process.env.NODE_ENV !== 'production')
6885
+ ? (job) => checkRecursiveUpdates(seen, job)
6886
+ : NOOP;
7215
6887
  try {
7216
6888
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
7217
6889
  const job = queue[flushIndex];
7218
6890
  if (job && job.active !== false) {
7219
- if ((process.env.NODE_ENV !== 'production') && checkRecursiveUpdates(seen, job)) {
6891
+ if ((process.env.NODE_ENV !== 'production') && check(job)) {
7220
6892
  continue;
7221
6893
  }
7222
6894
  // console.log(`running:`, job.id)
@@ -7559,7 +7231,7 @@ function defineExpose(exposed) {
7559
7231
  }
7560
7232
  /**
7561
7233
  * Vue `<script setup>` compiler macro for providing props default values when
7562
- * using type-based `defineProps` decalration.
7234
+ * using type-based `defineProps` declaration.
7563
7235
  *
7564
7236
  * Example usage:
7565
7237
  * ```ts
@@ -7908,7 +7580,7 @@ function isMemoSame(cached, memo) {
7908
7580
  }
7909
7581
 
7910
7582
  // Core API ------------------------------------------------------------------
7911
- const version = "3.2.8";
7583
+ const version = "3.2.12";
7912
7584
  const _ssrUtils = {
7913
7585
  createComponentInstance,
7914
7586
  setupComponent,