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.
- package/dist/vue.common.dev.js +81 -6
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +81 -7
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +82 -7
- package/dist/vue.js +82 -6
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +81 -6
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +82 -7
- package/dist/vue.runtime.js +82 -6
- package/dist/vue.runtime.min.js +3 -3
- package/dist/vue.runtime.mjs +72 -8602
- package/package.json +2 -2
- package/packages/compiler-sfc/dist/compiler-sfc.js +7 -6
- package/packages/compiler-sfc/package.json +1 -1
- package/packages/compiler-sfc/src/parseComponent.ts +7 -4
- package/packages/compiler-sfc/test/parseComponent.spec.ts +6 -7
- package/src/core/instance/render-helpers/render-static.ts +1 -1
- package/src/core/observer/index.ts +1 -1
- package/src/v3/apiAsyncComponent.ts +117 -0
- package/src/v3/apiWatch.ts +2 -2
- package/src/v3/index.ts +6 -0
- package/types/options.d.ts +3 -3
- package/types/v3-component-public-instance.d.ts +35 -31
- package/types/v3-define-async-component.d.ts +26 -0
- package/types/v3-define-component.d.ts +25 -1
- package/types/v3-generated.d.ts +23 -0
- package/types/vue.d.ts +17 -10
package/dist/vue.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.7.
|
|
2
|
+
* Vue.js v2.7.4
|
|
3
3
|
* (c) 2014-2022 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -2608,7 +2608,7 @@ function renderStatic(index, isInFor) {
|
|
|
2608
2608
|
return tree;
|
|
2609
2609
|
}
|
|
2610
2610
|
// otherwise, render a fresh tree.
|
|
2611
|
-
tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy,
|
|
2611
|
+
tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
|
|
2612
2612
|
);
|
|
2613
2613
|
markStatic$1(tree, "__static__".concat(index), false);
|
|
2614
2614
|
return tree;
|
|
@@ -4404,8 +4404,8 @@ function doWatch(source, cb, _a) {
|
|
|
4404
4404
|
else {
|
|
4405
4405
|
// pre
|
|
4406
4406
|
watcher.update = function () {
|
|
4407
|
-
if (instance && instance === currentInstance) {
|
|
4408
|
-
// pre-watcher triggered
|
|
4407
|
+
if (instance && instance === currentInstance && !instance._isMounted) {
|
|
4408
|
+
// pre-watcher triggered before
|
|
4409
4409
|
var buffer = instance._preWatchers || (instance._preWatchers = []);
|
|
4410
4410
|
if (buffer.indexOf(watcher) < 0)
|
|
4411
4411
|
buffer.push(watcher);
|
|
@@ -4675,6 +4675,78 @@ function useCssVars(getter) {
|
|
|
4675
4675
|
});
|
|
4676
4676
|
}
|
|
4677
4677
|
|
|
4678
|
+
/**
|
|
4679
|
+
* v3-compatible async component API.
|
|
4680
|
+
* @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
|
|
4681
|
+
* because it relies on existing manual types
|
|
4682
|
+
*/
|
|
4683
|
+
function defineAsyncComponent(source) {
|
|
4684
|
+
if (isFunction(source)) {
|
|
4685
|
+
source = { loader: source };
|
|
4686
|
+
}
|
|
4687
|
+
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
|
|
4688
|
+
_b = source.suspensible, // undefined = never times out
|
|
4689
|
+
suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
|
|
4690
|
+
userOnError = source.onError;
|
|
4691
|
+
if (process.env.NODE_ENV !== 'production' && suspensible) {
|
|
4692
|
+
warn$2("The suspensiblbe option for async components is not supported in Vue2. It is ignored.");
|
|
4693
|
+
}
|
|
4694
|
+
var pendingRequest = null;
|
|
4695
|
+
var retries = 0;
|
|
4696
|
+
var retry = function () {
|
|
4697
|
+
retries++;
|
|
4698
|
+
pendingRequest = null;
|
|
4699
|
+
return load();
|
|
4700
|
+
};
|
|
4701
|
+
var load = function () {
|
|
4702
|
+
var thisRequest;
|
|
4703
|
+
return (pendingRequest ||
|
|
4704
|
+
(thisRequest = pendingRequest =
|
|
4705
|
+
loader()
|
|
4706
|
+
.catch(function (err) {
|
|
4707
|
+
err = err instanceof Error ? err : new Error(String(err));
|
|
4708
|
+
if (userOnError) {
|
|
4709
|
+
return new Promise(function (resolve, reject) {
|
|
4710
|
+
var userRetry = function () { return resolve(retry()); };
|
|
4711
|
+
var userFail = function () { return reject(err); };
|
|
4712
|
+
userOnError(err, userRetry, userFail, retries + 1);
|
|
4713
|
+
});
|
|
4714
|
+
}
|
|
4715
|
+
else {
|
|
4716
|
+
throw err;
|
|
4717
|
+
}
|
|
4718
|
+
})
|
|
4719
|
+
.then(function (comp) {
|
|
4720
|
+
if (thisRequest !== pendingRequest && pendingRequest) {
|
|
4721
|
+
return pendingRequest;
|
|
4722
|
+
}
|
|
4723
|
+
if (process.env.NODE_ENV !== 'production' && !comp) {
|
|
4724
|
+
warn$2("Async component loader resolved to undefined. " +
|
|
4725
|
+
"If you are using retry(), make sure to return its return value.");
|
|
4726
|
+
}
|
|
4727
|
+
// interop module default
|
|
4728
|
+
if (comp &&
|
|
4729
|
+
(comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
|
|
4730
|
+
comp = comp.default;
|
|
4731
|
+
}
|
|
4732
|
+
if (process.env.NODE_ENV !== 'production' && comp && !isObject(comp) && !isFunction(comp)) {
|
|
4733
|
+
throw new Error("Invalid async component load result: ".concat(comp));
|
|
4734
|
+
}
|
|
4735
|
+
return comp;
|
|
4736
|
+
})));
|
|
4737
|
+
};
|
|
4738
|
+
return function () {
|
|
4739
|
+
var component = load();
|
|
4740
|
+
return {
|
|
4741
|
+
component: component,
|
|
4742
|
+
delay: delay,
|
|
4743
|
+
timeout: timeout,
|
|
4744
|
+
error: errorComponent,
|
|
4745
|
+
loading: loadingComponent
|
|
4746
|
+
};
|
|
4747
|
+
};
|
|
4748
|
+
}
|
|
4749
|
+
|
|
4678
4750
|
function createLifeCycle(hookName) {
|
|
4679
4751
|
return function (fn, target) {
|
|
4680
4752
|
if (target === void 0) { target = currentInstance; }
|
|
@@ -4714,7 +4786,10 @@ var onServerPrefetch = createLifeCycle('serverPrefetch');
|
|
|
4714
4786
|
var onRenderTracked = createLifeCycle('renderTracked');
|
|
4715
4787
|
var onRenderTriggered = createLifeCycle('renderTriggered');
|
|
4716
4788
|
|
|
4717
|
-
|
|
4789
|
+
/**
|
|
4790
|
+
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
4791
|
+
*/
|
|
4792
|
+
var version = '2.7.4';
|
|
4718
4793
|
/**
|
|
4719
4794
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
4720
4795
|
*/
|
|
@@ -4913,7 +4988,7 @@ function set(target, key, val) {
|
|
|
4913
4988
|
target.length = Math.max(target.length, key);
|
|
4914
4989
|
target.splice(key, 1, val);
|
|
4915
4990
|
// when mocking for SSR, array methods are not hijacked
|
|
4916
|
-
if (!ob.shallow && ob.mock) {
|
|
4991
|
+
if (ob && !ob.shallow && ob.mock) {
|
|
4917
4992
|
observe(val, false, true);
|
|
4918
4993
|
}
|
|
4919
4994
|
return val;
|
|
@@ -11679,4 +11754,4 @@ function getOuterHTML(el) {
|
|
|
11679
11754
|
}
|
|
11680
11755
|
Vue.compile = compileToFunctions;
|
|
11681
11756
|
|
|
11682
|
-
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 };
|
|
11757
|
+
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 };
|
package/dist/vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.7.
|
|
2
|
+
* Vue.js v2.7.4
|
|
3
3
|
* (c) 2014-2022 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -2588,7 +2588,7 @@
|
|
|
2588
2588
|
return tree;
|
|
2589
2589
|
}
|
|
2590
2590
|
// otherwise, render a fresh tree.
|
|
2591
|
-
tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy,
|
|
2591
|
+
tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
|
|
2592
2592
|
);
|
|
2593
2593
|
markStatic$1(tree, "__static__".concat(index), false);
|
|
2594
2594
|
return tree;
|
|
@@ -4373,8 +4373,8 @@
|
|
|
4373
4373
|
else {
|
|
4374
4374
|
// pre
|
|
4375
4375
|
watcher.update = function () {
|
|
4376
|
-
if (instance && instance === currentInstance) {
|
|
4377
|
-
// pre-watcher triggered
|
|
4376
|
+
if (instance && instance === currentInstance && !instance._isMounted) {
|
|
4377
|
+
// pre-watcher triggered before
|
|
4378
4378
|
var buffer = instance._preWatchers || (instance._preWatchers = []);
|
|
4379
4379
|
if (buffer.indexOf(watcher) < 0)
|
|
4380
4380
|
buffer.push(watcher);
|
|
@@ -4634,6 +4634,78 @@
|
|
|
4634
4634
|
});
|
|
4635
4635
|
}
|
|
4636
4636
|
|
|
4637
|
+
/**
|
|
4638
|
+
* v3-compatible async component API.
|
|
4639
|
+
* @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
|
|
4640
|
+
* because it relies on existing manual types
|
|
4641
|
+
*/
|
|
4642
|
+
function defineAsyncComponent(source) {
|
|
4643
|
+
if (isFunction(source)) {
|
|
4644
|
+
source = { loader: source };
|
|
4645
|
+
}
|
|
4646
|
+
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
|
|
4647
|
+
_b = source.suspensible, // undefined = never times out
|
|
4648
|
+
suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
|
|
4649
|
+
userOnError = source.onError;
|
|
4650
|
+
if (suspensible) {
|
|
4651
|
+
warn$2("The suspensiblbe option for async components is not supported in Vue2. It is ignored.");
|
|
4652
|
+
}
|
|
4653
|
+
var pendingRequest = null;
|
|
4654
|
+
var retries = 0;
|
|
4655
|
+
var retry = function () {
|
|
4656
|
+
retries++;
|
|
4657
|
+
pendingRequest = null;
|
|
4658
|
+
return load();
|
|
4659
|
+
};
|
|
4660
|
+
var load = function () {
|
|
4661
|
+
var thisRequest;
|
|
4662
|
+
return (pendingRequest ||
|
|
4663
|
+
(thisRequest = pendingRequest =
|
|
4664
|
+
loader()
|
|
4665
|
+
.catch(function (err) {
|
|
4666
|
+
err = err instanceof Error ? err : new Error(String(err));
|
|
4667
|
+
if (userOnError) {
|
|
4668
|
+
return new Promise(function (resolve, reject) {
|
|
4669
|
+
var userRetry = function () { return resolve(retry()); };
|
|
4670
|
+
var userFail = function () { return reject(err); };
|
|
4671
|
+
userOnError(err, userRetry, userFail, retries + 1);
|
|
4672
|
+
});
|
|
4673
|
+
}
|
|
4674
|
+
else {
|
|
4675
|
+
throw err;
|
|
4676
|
+
}
|
|
4677
|
+
})
|
|
4678
|
+
.then(function (comp) {
|
|
4679
|
+
if (thisRequest !== pendingRequest && pendingRequest) {
|
|
4680
|
+
return pendingRequest;
|
|
4681
|
+
}
|
|
4682
|
+
if (!comp) {
|
|
4683
|
+
warn$2("Async component loader resolved to undefined. " +
|
|
4684
|
+
"If you are using retry(), make sure to return its return value.");
|
|
4685
|
+
}
|
|
4686
|
+
// interop module default
|
|
4687
|
+
if (comp &&
|
|
4688
|
+
(comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
|
|
4689
|
+
comp = comp.default;
|
|
4690
|
+
}
|
|
4691
|
+
if (comp && !isObject(comp) && !isFunction(comp)) {
|
|
4692
|
+
throw new Error("Invalid async component load result: ".concat(comp));
|
|
4693
|
+
}
|
|
4694
|
+
return comp;
|
|
4695
|
+
})));
|
|
4696
|
+
};
|
|
4697
|
+
return function () {
|
|
4698
|
+
var component = load();
|
|
4699
|
+
return {
|
|
4700
|
+
component: component,
|
|
4701
|
+
delay: delay,
|
|
4702
|
+
timeout: timeout,
|
|
4703
|
+
error: errorComponent,
|
|
4704
|
+
loading: loadingComponent
|
|
4705
|
+
};
|
|
4706
|
+
};
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4637
4709
|
function createLifeCycle(hookName) {
|
|
4638
4710
|
return function (fn, target) {
|
|
4639
4711
|
if (target === void 0) { target = currentInstance; }
|
|
@@ -4672,7 +4744,10 @@
|
|
|
4672
4744
|
var onRenderTracked = createLifeCycle('renderTracked');
|
|
4673
4745
|
var onRenderTriggered = createLifeCycle('renderTriggered');
|
|
4674
4746
|
|
|
4675
|
-
|
|
4747
|
+
/**
|
|
4748
|
+
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
4749
|
+
*/
|
|
4750
|
+
var version = '2.7.4';
|
|
4676
4751
|
/**
|
|
4677
4752
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
4678
4753
|
*/
|
|
@@ -4724,6 +4799,7 @@
|
|
|
4724
4799
|
del: del,
|
|
4725
4800
|
useCssModule: useCssModule,
|
|
4726
4801
|
useCssVars: useCssVars,
|
|
4802
|
+
defineAsyncComponent: defineAsyncComponent,
|
|
4727
4803
|
onBeforeMount: onBeforeMount,
|
|
4728
4804
|
onMounted: onMounted,
|
|
4729
4805
|
onBeforeUpdate: onBeforeUpdate,
|
|
@@ -4923,7 +4999,7 @@
|
|
|
4923
4999
|
target.length = Math.max(target.length, key);
|
|
4924
5000
|
target.splice(key, 1, val);
|
|
4925
5001
|
// when mocking for SSR, array methods are not hijacked
|
|
4926
|
-
if (!ob.shallow && ob.mock) {
|
|
5002
|
+
if (ob && !ob.shallow && ob.mock) {
|
|
4927
5003
|
observe(val, false, true);
|
|
4928
5004
|
}
|
|
4929
5005
|
return val;
|