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