|
@@ -1,5 +1,5 @@
|
|
|
-/**
|
|
|
- * vuex v3.3.0
|
|
|
+/*!
|
|
|
+ * vuex v3.4.0
|
|
|
* (c) 2020 Evan You
|
|
|
* @license MIT
|
|
|
*/
|
|
@@ -199,7 +199,7 @@ ModuleCollection.prototype.register = function register (path, rawModule, runtim
|
|
|
var this$1 = this;
|
|
|
if ( runtime === void 0 ) runtime = true;
|
|
|
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assertRawModule(path, rawModule);
|
|
|
}
|
|
|
|
|
@@ -235,7 +235,7 @@ ModuleCollection.prototype.isRegistered = function isRegistered (path) {
|
|
|
};
|
|
|
|
|
|
function update (path, targetModule, newModule) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assertRawModule(path, newModule);
|
|
|
}
|
|
|
|
|
@@ -246,7 +246,7 @@ function update (path, targetModule, newModule) {
|
|
|
if (newModule.modules) {
|
|
|
for (var key in newModule.modules) {
|
|
|
if (!targetModule.getChild(key)) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
console.warn(
|
|
|
"[vuex] trying to add a new module '" + key + "' on hot reloading, " +
|
|
|
'manual reload is needed'
|
|
@@ -317,7 +317,7 @@ var Store = function Store (options) {
|
|
|
install(window.Vue);
|
|
|
}
|
|
|
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
|
|
|
assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
|
|
|
assert(this instanceof Store, "store must be called with the new operator.");
|
|
@@ -380,7 +380,7 @@ prototypeAccessors$1.state.get = function () {
|
|
|
};
|
|
|
|
|
|
prototypeAccessors$1.state.set = function (v) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assert(false, "use store.replaceState() to explicit replace store state.");
|
|
|
}
|
|
|
};
|
|
@@ -397,7 +397,7 @@ Store.prototype.commit = function commit (_type, _payload, _options) {
|
|
|
var mutation = { type: type, payload: payload };
|
|
|
var entry = this._mutations[type];
|
|
|
if (!entry) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
console.error(("[vuex] unknown mutation type: " + type));
|
|
|
}
|
|
|
return
|
|
@@ -413,7 +413,7 @@ Store.prototype.commit = function commit (_type, _payload, _options) {
|
|
|
.forEach(function (sub) { return sub(mutation, this$1.state); });
|
|
|
|
|
|
if (
|
|
|
- process.env.NODE_ENV !== 'production' &&
|
|
|
+ (process.env.NODE_ENV !== 'production') &&
|
|
|
options && options.silent
|
|
|
) {
|
|
|
console.warn(
|
|
@@ -434,7 +434,7 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
|
|
|
var action = { type: type, payload: payload };
|
|
|
var entry = this._actions[type];
|
|
|
if (!entry) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
console.error(("[vuex] unknown action type: " + type));
|
|
|
}
|
|
|
return
|
|
@@ -446,7 +446,7 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
|
|
|
.filter(function (sub) { return sub.before; })
|
|
|
.forEach(function (sub) { return sub.before(action, this$1.state); });
|
|
|
} catch (e) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
console.warn("[vuex] error in before action subscribers: ");
|
|
|
console.error(e);
|
|
|
}
|
|
@@ -456,18 +456,32 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
|
|
|
? Promise.all(entry.map(function (handler) { return handler(payload); }))
|
|
|
: entry[0](payload);
|
|
|
|
|
|
- return result.then(function (res) {
|
|
|
- try {
|
|
|
- this$1._actionSubscribers
|
|
|
- .filter(function (sub) { return sub.after; })
|
|
|
- .forEach(function (sub) { return sub.after(action, this$1.state); });
|
|
|
- } catch (e) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
- console.warn("[vuex] error in after action subscribers: ");
|
|
|
- console.error(e);
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ result.then(function (res) {
|
|
|
+ try {
|
|
|
+ this$1._actionSubscribers
|
|
|
+ .filter(function (sub) { return sub.after; })
|
|
|
+ .forEach(function (sub) { return sub.after(action, this$1.state); });
|
|
|
+ } catch (e) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
+ console.warn("[vuex] error in after action subscribers: ");
|
|
|
+ console.error(e);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- return res
|
|
|
+ resolve(res);
|
|
|
+ }, function (error) {
|
|
|
+ try {
|
|
|
+ this$1._actionSubscribers
|
|
|
+ .filter(function (sub) { return sub.error; })
|
|
|
+ .forEach(function (sub) { return sub.error(action, this$1.state, error); });
|
|
|
+ } catch (e) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
+ console.warn("[vuex] error in error action subscribers: ");
|
|
|
+ console.error(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
})
|
|
|
};
|
|
|
|
|
@@ -483,7 +497,7 @@ Store.prototype.subscribeAction = function subscribeAction (fn, options) {
|
|
|
Store.prototype.watch = function watch (getter, cb, options) {
|
|
|
var this$1 = this;
|
|
|
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assert(typeof getter === 'function', "store.watch only accepts a function.");
|
|
|
}
|
|
|
return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
|
|
@@ -502,7 +516,7 @@ Store.prototype.registerModule = function registerModule (path, rawModule, optio
|
|
|
|
|
|
if (typeof path === 'string') { path = [path]; }
|
|
|
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assert(Array.isArray(path), "module path must be a string or an Array.");
|
|
|
assert(path.length > 0, 'cannot register the root module by using registerModule.');
|
|
|
}
|
|
@@ -518,7 +532,7 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
|
|
|
|
|
|
if (typeof path === 'string') { path = [path]; }
|
|
|
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assert(Array.isArray(path), "module path must be a string or an Array.");
|
|
|
}
|
|
|
|
|
@@ -533,7 +547,7 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
|
|
|
Store.prototype.hasModule = function hasModule (path) {
|
|
|
if (typeof path === 'string') { path = [path]; }
|
|
|
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assert(Array.isArray(path), "module path must be a string or an Array.");
|
|
|
}
|
|
|
|
|
@@ -636,7 +650,7 @@ function installModule (store, rootState, path, module, hot) {
|
|
|
|
|
|
// register in namespace map
|
|
|
if (module.namespaced) {
|
|
|
- if (store._modulesNamespaceMap[namespace] && process.env.NODE_ENV !== 'production') {
|
|
|
+ if (store._modulesNamespaceMap[namespace] && (process.env.NODE_ENV !== 'production')) {
|
|
|
console.error(("[vuex] duplicate namespace " + namespace + " for the namespaced module " + (path.join('/'))));
|
|
|
}
|
|
|
store._modulesNamespaceMap[namespace] = module;
|
|
@@ -647,7 +661,7 @@ function installModule (store, rootState, path, module, hot) {
|
|
|
var parentState = getNestedState(rootState, path.slice(0, -1));
|
|
|
var moduleName = path[path.length - 1];
|
|
|
store._withCommit(function () {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
if (moduleName in parentState) {
|
|
|
console.warn(
|
|
|
("[vuex] state field \"" + moduleName + "\" was overridden by a module with the same name at \"" + (path.join('.')) + "\"")
|
|
@@ -697,7 +711,7 @@ function makeLocalContext (store, namespace, path) {
|
|
|
|
|
|
if (!options || !options.root) {
|
|
|
type = namespace + type;
|
|
|
- if (process.env.NODE_ENV !== 'production' && !store._actions[type]) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production') && !store._actions[type]) {
|
|
|
console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
|
|
|
return
|
|
|
}
|
|
@@ -714,7 +728,7 @@ function makeLocalContext (store, namespace, path) {
|
|
|
|
|
|
if (!options || !options.root) {
|
|
|
type = namespace + type;
|
|
|
- if (process.env.NODE_ENV !== 'production' && !store._mutations[type]) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production') && !store._mutations[type]) {
|
|
|
console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
|
|
|
return
|
|
|
}
|
|
@@ -799,7 +813,7 @@ function registerAction (store, type, handler, local) {
|
|
|
|
|
|
function registerGetter (store, type, rawGetter, local) {
|
|
|
if (store._wrappedGetters[type]) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
console.error(("[vuex] duplicate getter key: " + type));
|
|
|
}
|
|
|
return
|
|
@@ -816,7 +830,7 @@ function registerGetter (store, type, rawGetter, local) {
|
|
|
|
|
|
function enableStrictMode (store) {
|
|
|
store._vm.$watch(function () { return this._data.$$state }, function () {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assert(store._committing, "do not mutate vuex store state outside mutation handlers.");
|
|
|
}
|
|
|
}, { deep: true, sync: true });
|
|
@@ -833,7 +847,7 @@ function unifyObjectStyle (type, payload, options) {
|
|
|
type = type.type;
|
|
|
}
|
|
|
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + "."));
|
|
|
}
|
|
|
|
|
@@ -842,7 +856,7 @@ function unifyObjectStyle (type, payload, options) {
|
|
|
|
|
|
function install (_Vue) {
|
|
|
if (Vue && _Vue === Vue) {
|
|
|
- if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if ((process.env.NODE_ENV !== 'production')) {
|
|
|
console.error(
|
|
|
'[vuex] already installed. Vue.use(Vuex) should be called only once.'
|
|
|
);
|
|
@@ -861,7 +875,7 @@ function install (_Vue) {
|
|
|
*/
|
|
|
var mapState = normalizeNamespace(function (namespace, states) {
|
|
|
var res = {};
|
|
|
- if (process.env.NODE_ENV !== 'production' && !isValidMap(states)) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(states)) {
|
|
|
console.error('[vuex] mapState: mapper parameter must be either an Array or an Object');
|
|
|
}
|
|
|
normalizeMap(states).forEach(function (ref) {
|
|
@@ -897,7 +911,7 @@ var mapState = normalizeNamespace(function (namespace, states) {
|
|
|
*/
|
|
|
var mapMutations = normalizeNamespace(function (namespace, mutations) {
|
|
|
var res = {};
|
|
|
- if (process.env.NODE_ENV !== 'production' && !isValidMap(mutations)) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(mutations)) {
|
|
|
console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object');
|
|
|
}
|
|
|
normalizeMap(mutations).forEach(function (ref) {
|
|
@@ -933,7 +947,7 @@ var mapMutations = normalizeNamespace(function (namespace, mutations) {
|
|
|
*/
|
|
|
var mapGetters = normalizeNamespace(function (namespace, getters) {
|
|
|
var res = {};
|
|
|
- if (process.env.NODE_ENV !== 'production' && !isValidMap(getters)) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(getters)) {
|
|
|
console.error('[vuex] mapGetters: mapper parameter must be either an Array or an Object');
|
|
|
}
|
|
|
normalizeMap(getters).forEach(function (ref) {
|
|
@@ -946,7 +960,7 @@ var mapGetters = normalizeNamespace(function (namespace, getters) {
|
|
|
if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
|
|
|
return
|
|
|
}
|
|
|
- if (process.env.NODE_ENV !== 'production' && !(val in this.$store.getters)) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production') && !(val in this.$store.getters)) {
|
|
|
console.error(("[vuex] unknown getter: " + val));
|
|
|
return
|
|
|
}
|
|
@@ -966,7 +980,7 @@ var mapGetters = normalizeNamespace(function (namespace, getters) {
|
|
|
*/
|
|
|
var mapActions = normalizeNamespace(function (namespace, actions) {
|
|
|
var res = {};
|
|
|
- if (process.env.NODE_ENV !== 'production' && !isValidMap(actions)) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(actions)) {
|
|
|
console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object');
|
|
|
}
|
|
|
normalizeMap(actions).forEach(function (ref) {
|
|
@@ -1057,16 +1071,16 @@ function normalizeNamespace (fn) {
|
|
|
*/
|
|
|
function getModuleByNamespace (store, helper, namespace) {
|
|
|
var module = store._modulesNamespaceMap[namespace];
|
|
|
- if (process.env.NODE_ENV !== 'production' && !module) {
|
|
|
+ if ((process.env.NODE_ENV !== 'production') && !module) {
|
|
|
console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace));
|
|
|
}
|
|
|
return module
|
|
|
}
|
|
|
|
|
|
-var index_esm = {
|
|
|
+var index = {
|
|
|
Store: Store,
|
|
|
install: install,
|
|
|
- version: '3.3.0',
|
|
|
+ version: '3.4.0',
|
|
|
mapState: mapState,
|
|
|
mapMutations: mapMutations,
|
|
|
mapGetters: mapGetters,
|
|
@@ -1074,5 +1088,5 @@ var index_esm = {
|
|
|
createNamespacedHelpers: createNamespacedHelpers
|
|
|
};
|
|
|
|
|
|
-export default index_esm;
|
|
|
-export { Store, install, mapState, mapMutations, mapGetters, mapActions, createNamespacedHelpers };
|
|
|
+export default index;
|
|
|
+export { Store, createNamespacedHelpers, install, mapActions, mapGetters, mapMutations, mapState };
|