Skip to content

Commit

Permalink
release: v3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsn committed May 11, 2020
1 parent 91e2f7c commit 8691e61
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 150 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# [3.4.0](https://github.com/vuejs/vuex/compare/v3.3.0...v3.4.0) (2020-05-11)


### Features

* Allow action subscribers to catch rejections. ([#1740](https://github.com/vuejs/vuex/issues/1740)) ([6ebbe64](https://github.com/vuejs/vuex/commit/6ebbe64c5821d19e55a41dc8b1d81cfce6cbd195)), closes [#1489](https://github.com/vuejs/vuex/issues/1489) [#1558](https://github.com/vuejs/vuex/issues/1558) [#1625](https://github.com/vuejs/vuex/issues/1625)



# [3.3.0](https://github.com/vuejs/vuex/compare/v3.2.0...v3.3.0) (2020-04-25)


Expand Down
11 changes: 8 additions & 3 deletions dist/logger.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/*!
* vuex v3.4.0
* (c) 2020 Evan You
* @license MIT
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.createVuexLogger = factory());
}(this, function () { 'use strict';
(global = global || self, global.Vuex = factory());
}(this, (function () { 'use strict';

/**
* Get the first item that pass the test
Expand Down Expand Up @@ -147,4 +152,4 @@

return createLogger;

}));
})));
100 changes: 57 additions & 43 deletions dist/vuex.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vuex v3.3.0
/*!
* vuex v3.4.0
* (c) 2020 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -201,7 +201,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);
}

Expand Down Expand Up @@ -237,7 +237,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);
}

Expand All @@ -248,7 +248,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'
Expand Down Expand Up @@ -319,7 +319,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.");
Expand Down Expand Up @@ -382,7 +382,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.");
}
};
Expand All @@ -399,7 +399,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
Expand All @@ -415,7 +415,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(
Expand All @@ -436,7 +436,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
Expand All @@ -448,7 +448,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);
}
Expand All @@ -458,18 +458,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);
});
})
};

Expand All @@ -485,7 +499,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)
Expand All @@ -504,7 +518,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.');
}
Expand All @@ -520,7 +534,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.");
}

Expand All @@ -535,7 +549,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.");
}

Expand Down Expand Up @@ -638,7 +652,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;
Expand All @@ -649,7 +663,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('.')) + "\"")
Expand Down Expand Up @@ -699,7 +713,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
}
Expand All @@ -716,7 +730,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
}
Expand Down Expand Up @@ -801,7 +815,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
Expand All @@ -818,7 +832,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 });
Expand All @@ -835,7 +849,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) + "."));
}

Expand All @@ -844,7 +858,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.'
);
Expand All @@ -863,7 +877,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) {
Expand Down Expand Up @@ -899,7 +913,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) {
Expand Down Expand Up @@ -935,7 +949,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) {
Expand All @@ -948,7 +962,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
}
Expand All @@ -968,7 +982,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) {
Expand Down Expand Up @@ -1059,21 +1073,21 @@ 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 = {
var index_cjs = {
Store: Store,
install: install,
version: '3.3.0',
version: '3.4.0',
mapState: mapState,
mapMutations: mapMutations,
mapGetters: mapGetters,
mapActions: mapActions,
createNamespacedHelpers: createNamespacedHelpers
};

module.exports = index;
module.exports = index_cjs;
Loading

0 comments on commit 8691e61

Please sign in to comment.