vue 2.7.3 → 2.7.4

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,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.7.3
2
+ * Vue.js v2.7.4
3
3
  * (c) 2014-2022 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -2526,7 +2526,7 @@ function renderStatic(index, isInFor) {
2526
2526
  return tree;
2527
2527
  }
2528
2528
  // otherwise, render a fresh tree.
2529
- tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, null, this // for render fns generated for functional component templates
2529
+ tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
2530
2530
  );
2531
2531
  markStatic$1(tree, `__static__${index}`, false);
2532
2532
  return tree;
@@ -4299,8 +4299,8 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
4299
4299
  else {
4300
4300
  // pre
4301
4301
  watcher.update = () => {
4302
- if (instance && instance === currentInstance) {
4303
- // pre-watcher triggered inside setup()
4302
+ if (instance && instance === currentInstance && !instance._isMounted) {
4303
+ // pre-watcher triggered before
4304
4304
  const buffer = instance._preWatchers || (instance._preWatchers = []);
4305
4305
  if (buffer.indexOf(watcher) < 0)
4306
4306
  buffer.push(watcher);
@@ -4560,6 +4560,77 @@ function useCssVars(getter) {
4560
4560
  });
4561
4561
  }
4562
4562
 
4563
+ /**
4564
+ * v3-compatible async component API.
4565
+ * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
4566
+ * because it relies on existing manual types
4567
+ */
4568
+ function defineAsyncComponent(source) {
4569
+ if (isFunction(source)) {
4570
+ source = { loader: source };
4571
+ }
4572
+ const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out
4573
+ suspensible = false, // in Vue 3 default is true
4574
+ onError: userOnError } = source;
4575
+ if (suspensible) {
4576
+ warn$2(`The suspensiblbe option for async components is not supported in Vue2. It is ignored.`);
4577
+ }
4578
+ let pendingRequest = null;
4579
+ let retries = 0;
4580
+ const retry = () => {
4581
+ retries++;
4582
+ pendingRequest = null;
4583
+ return load();
4584
+ };
4585
+ const load = () => {
4586
+ let thisRequest;
4587
+ return (pendingRequest ||
4588
+ (thisRequest = pendingRequest =
4589
+ loader()
4590
+ .catch(err => {
4591
+ err = err instanceof Error ? err : new Error(String(err));
4592
+ if (userOnError) {
4593
+ return new Promise((resolve, reject) => {
4594
+ const userRetry = () => resolve(retry());
4595
+ const userFail = () => reject(err);
4596
+ userOnError(err, userRetry, userFail, retries + 1);
4597
+ });
4598
+ }
4599
+ else {
4600
+ throw err;
4601
+ }
4602
+ })
4603
+ .then((comp) => {
4604
+ if (thisRequest !== pendingRequest && pendingRequest) {
4605
+ return pendingRequest;
4606
+ }
4607
+ if (!comp) {
4608
+ warn$2(`Async component loader resolved to undefined. ` +
4609
+ `If you are using retry(), make sure to return its return value.`);
4610
+ }
4611
+ // interop module default
4612
+ if (comp &&
4613
+ (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
4614
+ comp = comp.default;
4615
+ }
4616
+ if (comp && !isObject(comp) && !isFunction(comp)) {
4617
+ throw new Error(`Invalid async component load result: ${comp}`);
4618
+ }
4619
+ return comp;
4620
+ })));
4621
+ };
4622
+ return () => {
4623
+ const component = load();
4624
+ return {
4625
+ component,
4626
+ delay,
4627
+ timeout,
4628
+ error: errorComponent,
4629
+ loading: loadingComponent
4630
+ };
4631
+ };
4632
+ }
4633
+
4563
4634
  function createLifeCycle(hookName) {
4564
4635
  return (fn, target = currentInstance) => {
4565
4636
  if (!target) {
@@ -4597,7 +4668,10 @@ const onServerPrefetch = createLifeCycle('serverPrefetch');
4597
4668
  const onRenderTracked = createLifeCycle('renderTracked');
4598
4669
  const onRenderTriggered = createLifeCycle('renderTriggered');
4599
4670
 
4600
- const version = '2.7.3';
4671
+ /**
4672
+ * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
4673
+ */
4674
+ const version = '2.7.4';
4601
4675
  /**
4602
4676
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
4603
4677
  */
@@ -4787,7 +4861,7 @@ function set(target, key, val) {
4787
4861
  target.length = Math.max(target.length, key);
4788
4862
  target.splice(key, 1, val);
4789
4863
  // when mocking for SSR, array methods are not hijacked
4790
- if (!ob.shallow && ob.mock) {
4864
+ if (ob && !ob.shallow && ob.mock) {
4791
4865
  observe(val, false, true);
4792
4866
  }
4793
4867
  return val;
@@ -11500,4 +11574,4 @@ function getOuterHTML(el) {
11500
11574
  }
11501
11575
  Vue.compile = compileToFunctions;
11502
11576
 
11503
- export { EffectScope, computed, customRef, Vue as default, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref$1 as ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };
11577
+ export { EffectScope, computed, customRef, Vue as default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref$1 as ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };