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
  */
@@ -1832,7 +1832,7 @@ function renderStatic(index, isInFor) {
1832
1832
  return tree;
1833
1833
  }
1834
1834
  // otherwise, render a fresh tree.
1835
- tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, null, this // for render fns generated for functional component templates
1835
+ tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
1836
1836
  );
1837
1837
  markStatic(tree, "__static__".concat(index), false);
1838
1838
  return tree;
@@ -3905,8 +3905,8 @@ function doWatch(source, cb, _a) {
3905
3905
  else {
3906
3906
  // pre
3907
3907
  watcher.update = function () {
3908
- if (instance && instance === currentInstance) {
3909
- // pre-watcher triggered inside setup()
3908
+ if (instance && instance === currentInstance && !instance._isMounted) {
3909
+ // pre-watcher triggered before
3910
3910
  var buffer = instance._preWatchers || (instance._preWatchers = []);
3911
3911
  if (buffer.indexOf(watcher) < 0)
3912
3912
  buffer.push(watcher);
@@ -4176,6 +4176,78 @@ function useCssVars(getter) {
4176
4176
  });
4177
4177
  }
4178
4178
 
4179
+ /**
4180
+ * v3-compatible async component API.
4181
+ * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
4182
+ * because it relies on existing manual types
4183
+ */
4184
+ function defineAsyncComponent(source) {
4185
+ if (isFunction(source)) {
4186
+ source = { loader: source };
4187
+ }
4188
+ var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout, // undefined = never times out
4189
+ _b = source.suspensible, // undefined = never times out
4190
+ suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
4191
+ userOnError = source.onError;
4192
+ if (process.env.NODE_ENV !== 'production' && suspensible) {
4193
+ warn("The suspensiblbe option for async components is not supported in Vue2. It is ignored.");
4194
+ }
4195
+ var pendingRequest = null;
4196
+ var retries = 0;
4197
+ var retry = function () {
4198
+ retries++;
4199
+ pendingRequest = null;
4200
+ return load();
4201
+ };
4202
+ var load = function () {
4203
+ var thisRequest;
4204
+ return (pendingRequest ||
4205
+ (thisRequest = pendingRequest =
4206
+ loader()
4207
+ .catch(function (err) {
4208
+ err = err instanceof Error ? err : new Error(String(err));
4209
+ if (userOnError) {
4210
+ return new Promise(function (resolve, reject) {
4211
+ var userRetry = function () { return resolve(retry()); };
4212
+ var userFail = function () { return reject(err); };
4213
+ userOnError(err, userRetry, userFail, retries + 1);
4214
+ });
4215
+ }
4216
+ else {
4217
+ throw err;
4218
+ }
4219
+ })
4220
+ .then(function (comp) {
4221
+ if (thisRequest !== pendingRequest && pendingRequest) {
4222
+ return pendingRequest;
4223
+ }
4224
+ if (process.env.NODE_ENV !== 'production' && !comp) {
4225
+ warn("Async component loader resolved to undefined. " +
4226
+ "If you are using retry(), make sure to return its return value.");
4227
+ }
4228
+ // interop module default
4229
+ if (comp &&
4230
+ (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
4231
+ comp = comp.default;
4232
+ }
4233
+ if (process.env.NODE_ENV !== 'production' && comp && !isObject(comp) && !isFunction(comp)) {
4234
+ throw new Error("Invalid async component load result: ".concat(comp));
4235
+ }
4236
+ return comp;
4237
+ })));
4238
+ };
4239
+ return function () {
4240
+ var component = load();
4241
+ return {
4242
+ component: component,
4243
+ delay: delay,
4244
+ timeout: timeout,
4245
+ error: errorComponent,
4246
+ loading: loadingComponent
4247
+ };
4248
+ };
4249
+ }
4250
+
4179
4251
  function createLifeCycle(hookName) {
4180
4252
  return function (fn, target) {
4181
4253
  if (target === void 0) { target = currentInstance; }
@@ -4215,7 +4287,10 @@ var onServerPrefetch = createLifeCycle('serverPrefetch');
4215
4287
  var onRenderTracked = createLifeCycle('renderTracked');
4216
4288
  var onRenderTriggered = createLifeCycle('renderTriggered');
4217
4289
 
4218
- var version = '2.7.3';
4290
+ /**
4291
+ * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
4292
+ */
4293
+ var version = '2.7.4';
4219
4294
  /**
4220
4295
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
4221
4296
  */
@@ -4414,7 +4489,7 @@ function set(target, key, val) {
4414
4489
  target.length = Math.max(target.length, key);
4415
4490
  target.splice(key, 1, val);
4416
4491
  // when mocking for SSR, array methods are not hijacked
4417
- if (!ob.shallow && ob.mock) {
4492
+ if (ob && !ob.shallow && ob.mock) {
4418
4493
  observe(val, false, true);
4419
4494
  }
4420
4495
  return val;
@@ -8602,4 +8677,4 @@ if (inBrowser) {
8602
8677
  }, 0);
8603
8678
  }
8604
8679
 
8605
- 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 };
8680
+ 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 };
@@ -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
  */
@@ -1820,7 +1820,7 @@
1820
1820
  return tree;
1821
1821
  }
1822
1822
  // otherwise, render a fresh tree.
1823
- tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, null, this // for render fns generated for functional component templates
1823
+ tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
1824
1824
  );
1825
1825
  markStatic(tree, "__static__".concat(index), false);
1826
1826
  return tree;
@@ -3882,8 +3882,8 @@
3882
3882
  else {
3883
3883
  // pre
3884
3884
  watcher.update = function () {
3885
- if (instance && instance === currentInstance) {
3886
- // pre-watcher triggered inside setup()
3885
+ if (instance && instance === currentInstance && !instance._isMounted) {
3886
+ // pre-watcher triggered before
3887
3887
  var buffer = instance._preWatchers || (instance._preWatchers = []);
3888
3888
  if (buffer.indexOf(watcher) < 0)
3889
3889
  buffer.push(watcher);
@@ -4143,6 +4143,78 @@
4143
4143
  });
4144
4144
  }
4145
4145
 
4146
+ /**
4147
+ * v3-compatible async component API.
4148
+ * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
4149
+ * because it relies on existing manual types
4150
+ */
4151
+ function defineAsyncComponent(source) {
4152
+ if (isFunction(source)) {
4153
+ source = { loader: source };
4154
+ }
4155
+ var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout, // undefined = never times out
4156
+ _b = source.suspensible, // undefined = never times out
4157
+ suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
4158
+ userOnError = source.onError;
4159
+ if (suspensible) {
4160
+ warn("The suspensiblbe option for async components is not supported in Vue2. It is ignored.");
4161
+ }
4162
+ var pendingRequest = null;
4163
+ var retries = 0;
4164
+ var retry = function () {
4165
+ retries++;
4166
+ pendingRequest = null;
4167
+ return load();
4168
+ };
4169
+ var load = function () {
4170
+ var thisRequest;
4171
+ return (pendingRequest ||
4172
+ (thisRequest = pendingRequest =
4173
+ loader()
4174
+ .catch(function (err) {
4175
+ err = err instanceof Error ? err : new Error(String(err));
4176
+ if (userOnError) {
4177
+ return new Promise(function (resolve, reject) {
4178
+ var userRetry = function () { return resolve(retry()); };
4179
+ var userFail = function () { return reject(err); };
4180
+ userOnError(err, userRetry, userFail, retries + 1);
4181
+ });
4182
+ }
4183
+ else {
4184
+ throw err;
4185
+ }
4186
+ })
4187
+ .then(function (comp) {
4188
+ if (thisRequest !== pendingRequest && pendingRequest) {
4189
+ return pendingRequest;
4190
+ }
4191
+ if (!comp) {
4192
+ warn("Async component loader resolved to undefined. " +
4193
+ "If you are using retry(), make sure to return its return value.");
4194
+ }
4195
+ // interop module default
4196
+ if (comp &&
4197
+ (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
4198
+ comp = comp.default;
4199
+ }
4200
+ if (comp && !isObject(comp) && !isFunction(comp)) {
4201
+ throw new Error("Invalid async component load result: ".concat(comp));
4202
+ }
4203
+ return comp;
4204
+ })));
4205
+ };
4206
+ return function () {
4207
+ var component = load();
4208
+ return {
4209
+ component: component,
4210
+ delay: delay,
4211
+ timeout: timeout,
4212
+ error: errorComponent,
4213
+ loading: loadingComponent
4214
+ };
4215
+ };
4216
+ }
4217
+
4146
4218
  function createLifeCycle(hookName) {
4147
4219
  return function (fn, target) {
4148
4220
  if (target === void 0) { target = currentInstance; }
@@ -4181,7 +4253,10 @@
4181
4253
  var onRenderTracked = createLifeCycle('renderTracked');
4182
4254
  var onRenderTriggered = createLifeCycle('renderTriggered');
4183
4255
 
4184
- var version = '2.7.3';
4256
+ /**
4257
+ * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
4258
+ */
4259
+ var version = '2.7.4';
4185
4260
  /**
4186
4261
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
4187
4262
  */
@@ -4233,6 +4308,7 @@
4233
4308
  del: del,
4234
4309
  useCssModule: useCssModule,
4235
4310
  useCssVars: useCssVars,
4311
+ defineAsyncComponent: defineAsyncComponent,
4236
4312
  onBeforeMount: onBeforeMount,
4237
4313
  onMounted: onMounted,
4238
4314
  onBeforeUpdate: onBeforeUpdate,
@@ -4432,7 +4508,7 @@
4432
4508
  target.length = Math.max(target.length, key);
4433
4509
  target.splice(key, 1, val);
4434
4510
  // when mocking for SSR, array methods are not hijacked
4435
- if (!ob.shallow && ob.mock) {
4511
+ if (ob && !ob.shallow && ob.mock) {
4436
4512
  observe(val, false, true);
4437
4513
  }
4438
4514
  return val;