@vue/runtime-core 3.2.11 → 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.
@@ -9,39 +9,6 @@ function setDevtoolsHook(hook) {
9
9
  exports.devtools = hook;
10
10
  }
11
11
 
12
- function warnDeprecation(key, instance, ...args) {
13
- {
14
- return;
15
- }
16
- }
17
- const globalCompatConfig = {
18
- MODE: 2
19
- };
20
- function getCompatConfigForKey(key, instance) {
21
- const instanceConfig = instance && instance.type.compatConfig;
22
- if (instanceConfig && key in instanceConfig) {
23
- return instanceConfig[key];
24
- }
25
- return globalCompatConfig[key];
26
- }
27
- function isCompatEnabled(key, instance, enableForBuiltIn = false) {
28
- // skip compat for built-in components
29
- if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
30
- return false;
31
- }
32
- const rawMode = getCompatConfigForKey('MODE', instance) || 2;
33
- const val = getCompatConfigForKey(key, instance);
34
- const mode = shared.isFunction(rawMode)
35
- ? rawMode(instance && instance.type)
36
- : rawMode;
37
- if (mode === 2) {
38
- return val !== false;
39
- }
40
- else {
41
- return val === true || val === 'suppress-warning';
42
- }
43
- }
44
-
45
12
  function emit(instance, event, ...rawArgs) {
46
13
  const props = instance.vnode.props || shared.EMPTY_OBJ;
47
14
  let args = rawArgs;
@@ -218,21 +185,14 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false on
218
185
  return renderFnWithContext;
219
186
  }
220
187
 
221
- /**
222
- * dev only flag to track whether $attrs was used during render.
223
- * If $attrs was used during render then the warning for failed attrs
224
- * fallthrough can be suppressed.
225
- */
226
- let accessedAttrs = false;
227
188
  function markAttrsAccessed() {
228
- accessedAttrs = true;
229
189
  }
230
190
  function renderComponentRoot(instance) {
231
191
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
232
192
  let result;
193
+ let fallthroughAttrs;
233
194
  const prev = setCurrentRenderingInstance(instance);
234
195
  try {
235
- let fallthroughAttrs;
236
196
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
237
197
  // withProxy is a proxy with a different `has` trap only for
238
198
  // runtime-compiled render functions using `with` block.
@@ -261,86 +221,46 @@ function renderComponentRoot(instance) {
261
221
  ? attrs
262
222
  : getFunctionalFallthrough(attrs);
263
223
  }
264
- // attr merging
265
- // in dev mode, comments are preserved, and it's possible for a template
266
- // to have comments along side the root element which makes it a fragment
267
- let root = result;
268
- let setRoot = undefined;
269
- if (false &&
270
- result.patchFlag > 0 &&
271
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) ;
272
- if (fallthroughAttrs && inheritAttrs !== false) {
273
- const keys = Object.keys(fallthroughAttrs);
274
- const { shapeFlag } = root;
275
- if (keys.length) {
276
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
277
- if (propsOptions && keys.some(shared.isModelListener)) {
278
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
279
- // prop, it indicates this component expects to handle v-model and
280
- // it should not fallthrough.
281
- // related: #1543, #1643, #1989
282
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
283
- }
284
- root = cloneVNode(root, fallthroughAttrs);
285
- }
286
- else if (false && !accessedAttrs && root.type !== Comment) ;
287
- }
288
- }
289
- if (false &&
290
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
291
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
292
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) ;
293
- // inherit directives
294
- if (vnode.dirs) {
295
- if (false && !isElementRoot(root)) ;
296
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
297
- }
298
- // inherit transition data
299
- if (vnode.transition) {
300
- if (false && !isElementRoot(root)) ;
301
- root.transition = vnode.transition;
302
- }
303
- if (false && setRoot) ;
304
- else {
305
- result = root;
306
- }
307
224
  }
308
225
  catch (err) {
309
226
  blockStack.length = 0;
310
227
  handleError(err, instance, 1 /* RENDER_FUNCTION */);
311
228
  result = createVNode(Comment);
312
229
  }
230
+ // attr merging
231
+ // in dev mode, comments are preserved, and it's possible for a template
232
+ // to have comments along side the root element which makes it a fragment
233
+ let root = result;
234
+ if (fallthroughAttrs && inheritAttrs !== false) {
235
+ const keys = Object.keys(fallthroughAttrs);
236
+ const { shapeFlag } = root;
237
+ if (keys.length) {
238
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
239
+ if (propsOptions && keys.some(shared.isModelListener)) {
240
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
241
+ // prop, it indicates this component expects to handle v-model and
242
+ // it should not fallthrough.
243
+ // related: #1543, #1643, #1989
244
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
245
+ }
246
+ root = cloneVNode(root, fallthroughAttrs);
247
+ }
248
+ }
249
+ }
250
+ // inherit directives
251
+ if (vnode.dirs) {
252
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
253
+ }
254
+ // inherit transition data
255
+ if (vnode.transition) {
256
+ root.transition = vnode.transition;
257
+ }
258
+ {
259
+ result = root;
260
+ }
313
261
  setCurrentRenderingInstance(prev);
314
262
  return result;
315
263
  }
316
- /**
317
- * dev only
318
- * In dev mode, template root level comments are rendered, which turns the
319
- * template into a fragment root, but we need to locate the single element
320
- * root for attrs and scope id processing.
321
- */
322
- const getChildRoot = (vnode) => {
323
- const rawChildren = vnode.children;
324
- const dynamicChildren = vnode.dynamicChildren;
325
- const childRoot = filterSingleRoot(rawChildren);
326
- if (!childRoot) {
327
- return [vnode, undefined];
328
- }
329
- const index = rawChildren.indexOf(childRoot);
330
- const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
331
- const setRoot = (updatedRoot) => {
332
- rawChildren[index] = updatedRoot;
333
- if (dynamicChildren) {
334
- if (dynamicIndex > -1) {
335
- dynamicChildren[dynamicIndex] = updatedRoot;
336
- }
337
- else if (updatedRoot.patchFlag > 0) {
338
- vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
339
- }
340
- }
341
- };
342
- return [normalizeVNode(childRoot), setRoot];
343
- };
344
264
  function filterSingleRoot(children) {
345
265
  let singleRoot;
346
266
  for (let i = 0; i < children.length; i++) {
@@ -381,11 +301,6 @@ const filterModelListeners = (attrs, props) => {
381
301
  }
382
302
  return res;
383
303
  };
384
- const isElementRoot = (vnode) => {
385
- return (vnode.shapeFlag & (6 /* COMPONENT */ | 1 /* ELEMENT */) ||
386
- vnode.type === Comment // potential v-if branch switch
387
- );
388
- };
389
304
  function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
390
305
  const { props: prevProps, children: prevChildren, component } = prevVNode;
391
306
  const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
@@ -816,8 +731,8 @@ function normalizeSuspenseChildren(vnode) {
816
731
  function normalizeSuspenseSlot(s) {
817
732
  let block;
818
733
  if (shared.isFunction(s)) {
819
- const isCompiledSlot = s._c;
820
- if (isCompiledSlot) {
734
+ const trackBlock = isBlockTreeEnabled && s._c;
735
+ if (trackBlock) {
821
736
  // disableTracking: false
822
737
  // allow block tracking for compiled slots
823
738
  // (see ./componentRenderContext.ts)
@@ -825,7 +740,7 @@ function normalizeSuspenseSlot(s) {
825
740
  openBlock();
826
741
  }
827
742
  s = s();
828
- if (isCompiledSlot) {
743
+ if (trackBlock) {
829
744
  s._d = true;
830
745
  block = currentBlock;
831
746
  closeBlock();
@@ -5502,7 +5417,6 @@ let postFlushIndex = 0;
5502
5417
  const resolvedPromise = Promise.resolve();
5503
5418
  let currentFlushPromise = null;
5504
5419
  let currentPreFlushParentJob = null;
5505
- const RECURSION_LIMIT = 100;
5506
5420
  function nextTick(fn) {
5507
5421
  const p = currentFlushPromise || resolvedPromise;
5508
5422
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
@@ -5620,11 +5534,17 @@ function flushJobs(seen) {
5620
5534
  // 2. If a component is unmounted during a parent component's update,
5621
5535
  // its update can be skipped.
5622
5536
  queue.sort((a, b) => getId(a) - getId(b));
5537
+ // conditional usage of checkRecursiveUpdate must be determined out of
5538
+ // try ... catch block since Rollup by default de-optimizes treeshaking
5539
+ // inside try-catch. This can leave all warning code unshaked. Although
5540
+ // they would get eventually shaken by a minifier like terser, some minifiers
5541
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
5542
+ const check = shared.NOOP;
5623
5543
  try {
5624
5544
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
5625
5545
  const job = queue[flushIndex];
5626
5546
  if (job && job.active !== false) {
5627
- if (false && checkRecursiveUpdates(seen, job)) ;
5547
+ if (false && check(job)) ;
5628
5548
  // console.log(`running:`, job.id)
5629
5549
  callWithErrorHandling(job, null, 14 /* SCHEDULER */);
5630
5550
  }
@@ -5644,27 +5564,6 @@ function flushJobs(seen) {
5644
5564
  flushJobs(seen);
5645
5565
  }
5646
5566
  }
5647
- }
5648
- function checkRecursiveUpdates(seen, fn) {
5649
- if (!seen.has(fn)) {
5650
- seen.set(fn, 1);
5651
- }
5652
- else {
5653
- const count = seen.get(fn);
5654
- if (count > RECURSION_LIMIT) {
5655
- const instance = fn.ownerInstance;
5656
- const componentName = instance && getComponentName(instance.type);
5657
- warn(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. ` +
5658
- `This means you have a reactive effect that is mutating its own ` +
5659
- `dependencies and thus recursively triggering itself. Possible sources ` +
5660
- `include component template, render function, updated hook or ` +
5661
- `watcher source function.`);
5662
- return true;
5663
- }
5664
- else {
5665
- seen.set(fn, count + 1);
5666
- }
5667
- }
5668
5567
  }
5669
5568
 
5670
5569
  // Simple effect.
@@ -6090,7 +5989,7 @@ function isMemoSame(cached, memo) {
6090
5989
  }
6091
5990
 
6092
5991
  // Core API ------------------------------------------------------------------
6093
- const version = "3.2.11";
5992
+ const version = "3.2.12";
6094
5993
  const _ssrUtils = {
6095
5994
  createComponentInstance,
6096
5995
  setupComponent,