1- /**
2- * vuex v3.3 .0
1+ /*!
2+ * vuex v3.4 .0
33 * (c) 2020 Evan You
44 * @license MIT
55 */
@@ -201,7 +201,7 @@ ModuleCollection.prototype.register = function register (path, rawModule, runtim
201201 var this$1 = this ;
202202 if ( runtime === void 0 ) runtime = true ;
203203
204- if ( process . env . NODE_ENV !== 'production' ) {
204+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
205205 assertRawModule ( path , rawModule ) ;
206206 }
207207
@@ -237,7 +237,7 @@ ModuleCollection.prototype.isRegistered = function isRegistered (path) {
237237} ;
238238
239239function update ( path , targetModule , newModule ) {
240- if ( process . env . NODE_ENV !== 'production' ) {
240+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
241241 assertRawModule ( path , newModule ) ;
242242 }
243243
@@ -248,7 +248,7 @@ function update (path, targetModule, newModule) {
248248 if ( newModule . modules ) {
249249 for ( var key in newModule . modules ) {
250250 if ( ! targetModule . getChild ( key ) ) {
251- if ( process . env . NODE_ENV !== 'production' ) {
251+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
252252 console . warn (
253253 "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
254254 'manual reload is needed'
@@ -319,7 +319,7 @@ var Store = function Store (options) {
319319 install ( window . Vue ) ;
320320 }
321321
322- if ( process . env . NODE_ENV !== 'production' ) {
322+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
323323 assert ( Vue , "must call Vue.use(Vuex) before creating a store instance." ) ;
324324 assert ( typeof Promise !== 'undefined' , "vuex requires a Promise polyfill in this browser." ) ;
325325 assert ( this instanceof Store , "store must be called with the new operator." ) ;
@@ -382,7 +382,7 @@ prototypeAccessors$1.state.get = function () {
382382} ;
383383
384384prototypeAccessors$1 . state . set = function ( v ) {
385- if ( process . env . NODE_ENV !== 'production' ) {
385+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
386386 assert ( false , "use store.replaceState() to explicit replace store state." ) ;
387387 }
388388} ;
@@ -399,7 +399,7 @@ Store.prototype.commit = function commit (_type, _payload, _options) {
399399 var mutation = { type : type , payload : payload } ;
400400 var entry = this . _mutations [ type ] ;
401401 if ( ! entry ) {
402- if ( process . env . NODE_ENV !== 'production' ) {
402+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
403403 console . error ( ( "[vuex] unknown mutation type: " + type ) ) ;
404404 }
405405 return
@@ -415,7 +415,7 @@ Store.prototype.commit = function commit (_type, _payload, _options) {
415415 . forEach ( function ( sub ) { return sub ( mutation , this$1 . state ) ; } ) ;
416416
417417 if (
418- process . env . NODE_ENV !== 'production' &&
418+ ( process . env . NODE_ENV !== 'production' ) &&
419419 options && options . silent
420420 ) {
421421 console . warn (
@@ -436,7 +436,7 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
436436 var action = { type : type , payload : payload } ;
437437 var entry = this . _actions [ type ] ;
438438 if ( ! entry ) {
439- if ( process . env . NODE_ENV !== 'production' ) {
439+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
440440 console . error ( ( "[vuex] unknown action type: " + type ) ) ;
441441 }
442442 return
@@ -448,7 +448,7 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
448448 . filter ( function ( sub ) { return sub . before ; } )
449449 . forEach ( function ( sub ) { return sub . before ( action , this$1 . state ) ; } ) ;
450450 } catch ( e ) {
451- if ( process . env . NODE_ENV !== 'production' ) {
451+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
452452 console . warn ( "[vuex] error in before action subscribers: " ) ;
453453 console . error ( e ) ;
454454 }
@@ -458,18 +458,32 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
458458 ? Promise . all ( entry . map ( function ( handler ) { return handler ( payload ) ; } ) )
459459 : entry [ 0 ] ( payload ) ;
460460
461- return result . then ( function ( res ) {
462- try {
463- this$1 . _actionSubscribers
464- . filter ( function ( sub ) { return sub . after ; } )
465- . forEach ( function ( sub ) { return sub . after ( action , this$1 . state ) ; } ) ;
466- } catch ( e ) {
467- if ( process . env . NODE_ENV !== 'production' ) {
468- console . warn ( "[vuex] error in after action subscribers: " ) ;
469- console . error ( e ) ;
461+ return new Promise ( function ( resolve , reject ) {
462+ result . then ( function ( res ) {
463+ try {
464+ this$1 . _actionSubscribers
465+ . filter ( function ( sub ) { return sub . after ; } )
466+ . forEach ( function ( sub ) { return sub . after ( action , this$1 . state ) ; } ) ;
467+ } catch ( e ) {
468+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
469+ console . warn ( "[vuex] error in after action subscribers: " ) ;
470+ console . error ( e ) ;
471+ }
470472 }
471- }
472- return res
473+ resolve ( res ) ;
474+ } , function ( error ) {
475+ try {
476+ this$1 . _actionSubscribers
477+ . filter ( function ( sub ) { return sub . error ; } )
478+ . forEach ( function ( sub ) { return sub . error ( action , this$1 . state , error ) ; } ) ;
479+ } catch ( e ) {
480+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
481+ console . warn ( "[vuex] error in error action subscribers: " ) ;
482+ console . error ( e ) ;
483+ }
484+ }
485+ reject ( error ) ;
486+ } ) ;
473487 } )
474488} ;
475489
@@ -485,7 +499,7 @@ Store.prototype.subscribeAction = function subscribeAction (fn, options) {
485499Store . prototype . watch = function watch ( getter , cb , options ) {
486500 var this$1 = this ;
487501
488- if ( process . env . NODE_ENV !== 'production' ) {
502+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
489503 assert ( typeof getter === 'function' , "store.watch only accepts a function." ) ;
490504 }
491505 return this . _watcherVM . $watch ( function ( ) { return getter ( this$1 . state , this$1 . getters ) ; } , cb , options )
@@ -504,7 +518,7 @@ Store.prototype.registerModule = function registerModule (path, rawModule, optio
504518
505519 if ( typeof path === 'string' ) { path = [ path ] ; }
506520
507- if ( process . env . NODE_ENV !== 'production' ) {
521+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
508522 assert ( Array . isArray ( path ) , "module path must be a string or an Array." ) ;
509523 assert ( path . length > 0 , 'cannot register the root module by using registerModule.' ) ;
510524 }
@@ -520,7 +534,7 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
520534
521535 if ( typeof path === 'string' ) { path = [ path ] ; }
522536
523- if ( process . env . NODE_ENV !== 'production' ) {
537+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
524538 assert ( Array . isArray ( path ) , "module path must be a string or an Array." ) ;
525539 }
526540
@@ -535,7 +549,7 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
535549Store . prototype . hasModule = function hasModule ( path ) {
536550 if ( typeof path === 'string' ) { path = [ path ] ; }
537551
538- if ( process . env . NODE_ENV !== 'production' ) {
552+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
539553 assert ( Array . isArray ( path ) , "module path must be a string or an Array." ) ;
540554 }
541555
@@ -638,7 +652,7 @@ function installModule (store, rootState, path, module, hot) {
638652
639653 // register in namespace map
640654 if ( module . namespaced ) {
641- if ( store . _modulesNamespaceMap [ namespace ] && process . env . NODE_ENV !== 'production' ) {
655+ if ( store . _modulesNamespaceMap [ namespace ] && ( process . env . NODE_ENV !== 'production' ) ) {
642656 console . error ( ( "[vuex] duplicate namespace " + namespace + " for the namespaced module " + ( path . join ( '/' ) ) ) ) ;
643657 }
644658 store . _modulesNamespaceMap [ namespace ] = module ;
@@ -649,7 +663,7 @@ function installModule (store, rootState, path, module, hot) {
649663 var parentState = getNestedState ( rootState , path . slice ( 0 , - 1 ) ) ;
650664 var moduleName = path [ path . length - 1 ] ;
651665 store . _withCommit ( function ( ) {
652- if ( process . env . NODE_ENV !== 'production' ) {
666+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
653667 if ( moduleName in parentState ) {
654668 console . warn (
655669 ( "[vuex] state field \"" + moduleName + "\" was overridden by a module with the same name at \"" + ( path . join ( '.' ) ) + "\"" )
@@ -699,7 +713,7 @@ function makeLocalContext (store, namespace, path) {
699713
700714 if ( ! options || ! options . root ) {
701715 type = namespace + type ;
702- if ( process . env . NODE_ENV !== 'production' && ! store . _actions [ type ] ) {
716+ if ( ( process . env . NODE_ENV !== 'production' ) && ! store . _actions [ type ] ) {
703717 console . error ( ( "[vuex] unknown local action type: " + ( args . type ) + ", global type: " + type ) ) ;
704718 return
705719 }
@@ -716,7 +730,7 @@ function makeLocalContext (store, namespace, path) {
716730
717731 if ( ! options || ! options . root ) {
718732 type = namespace + type ;
719- if ( process . env . NODE_ENV !== 'production' && ! store . _mutations [ type ] ) {
733+ if ( ( process . env . NODE_ENV !== 'production' ) && ! store . _mutations [ type ] ) {
720734 console . error ( ( "[vuex] unknown local mutation type: " + ( args . type ) + ", global type: " + type ) ) ;
721735 return
722736 }
@@ -801,7 +815,7 @@ function registerAction (store, type, handler, local) {
801815
802816function registerGetter ( store , type , rawGetter , local ) {
803817 if ( store . _wrappedGetters [ type ] ) {
804- if ( process . env . NODE_ENV !== 'production' ) {
818+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
805819 console . error ( ( "[vuex] duplicate getter key: " + type ) ) ;
806820 }
807821 return
@@ -818,7 +832,7 @@ function registerGetter (store, type, rawGetter, local) {
818832
819833function enableStrictMode ( store ) {
820834 store . _vm . $watch ( function ( ) { return this . _data . $$state } , function ( ) {
821- if ( process . env . NODE_ENV !== 'production' ) {
835+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
822836 assert ( store . _committing , "do not mutate vuex store state outside mutation handlers." ) ;
823837 }
824838 } , { deep : true , sync : true } ) ;
@@ -835,7 +849,7 @@ function unifyObjectStyle (type, payload, options) {
835849 type = type . type ;
836850 }
837851
838- if ( process . env . NODE_ENV !== 'production' ) {
852+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
839853 assert ( typeof type === 'string' , ( "expects string as the type, but found " + ( typeof type ) + "." ) ) ;
840854 }
841855
@@ -844,7 +858,7 @@ function unifyObjectStyle (type, payload, options) {
844858
845859function install ( _Vue ) {
846860 if ( Vue && _Vue === Vue ) {
847- if ( process . env . NODE_ENV !== 'production' ) {
861+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
848862 console . error (
849863 '[vuex] already installed. Vue.use(Vuex) should be called only once.'
850864 ) ;
@@ -863,7 +877,7 @@ function install (_Vue) {
863877 */
864878var mapState = normalizeNamespace ( function ( namespace , states ) {
865879 var res = { } ;
866- if ( process . env . NODE_ENV !== 'production' && ! isValidMap ( states ) ) {
880+ if ( ( process . env . NODE_ENV !== 'production' ) && ! isValidMap ( states ) ) {
867881 console . error ( '[vuex] mapState: mapper parameter must be either an Array or an Object' ) ;
868882 }
869883 normalizeMap ( states ) . forEach ( function ( ref ) {
@@ -899,7 +913,7 @@ var mapState = normalizeNamespace(function (namespace, states) {
899913 */
900914var mapMutations = normalizeNamespace ( function ( namespace , mutations ) {
901915 var res = { } ;
902- if ( process . env . NODE_ENV !== 'production' && ! isValidMap ( mutations ) ) {
916+ if ( ( process . env . NODE_ENV !== 'production' ) && ! isValidMap ( mutations ) ) {
903917 console . error ( '[vuex] mapMutations: mapper parameter must be either an Array or an Object' ) ;
904918 }
905919 normalizeMap ( mutations ) . forEach ( function ( ref ) {
@@ -935,7 +949,7 @@ var mapMutations = normalizeNamespace(function (namespace, mutations) {
935949 */
936950var mapGetters = normalizeNamespace ( function ( namespace , getters ) {
937951 var res = { } ;
938- if ( process . env . NODE_ENV !== 'production' && ! isValidMap ( getters ) ) {
952+ if ( ( process . env . NODE_ENV !== 'production' ) && ! isValidMap ( getters ) ) {
939953 console . error ( '[vuex] mapGetters: mapper parameter must be either an Array or an Object' ) ;
940954 }
941955 normalizeMap ( getters ) . forEach ( function ( ref ) {
@@ -948,7 +962,7 @@ var mapGetters = normalizeNamespace(function (namespace, getters) {
948962 if ( namespace && ! getModuleByNamespace ( this . $store , 'mapGetters' , namespace ) ) {
949963 return
950964 }
951- if ( process . env . NODE_ENV !== 'production' && ! ( val in this . $store . getters ) ) {
965+ if ( ( process . env . NODE_ENV !== 'production' ) && ! ( val in this . $store . getters ) ) {
952966 console . error ( ( "[vuex] unknown getter: " + val ) ) ;
953967 return
954968 }
@@ -968,7 +982,7 @@ var mapGetters = normalizeNamespace(function (namespace, getters) {
968982 */
969983var mapActions = normalizeNamespace ( function ( namespace , actions ) {
970984 var res = { } ;
971- if ( process . env . NODE_ENV !== 'production' && ! isValidMap ( actions ) ) {
985+ if ( ( process . env . NODE_ENV !== 'production' ) && ! isValidMap ( actions ) ) {
972986 console . error ( '[vuex] mapActions: mapper parameter must be either an Array or an Object' ) ;
973987 }
974988 normalizeMap ( actions ) . forEach ( function ( ref ) {
@@ -1059,21 +1073,21 @@ function normalizeNamespace (fn) {
10591073 */
10601074function getModuleByNamespace ( store , helper , namespace ) {
10611075 var module = store . _modulesNamespaceMap [ namespace ] ;
1062- if ( process . env . NODE_ENV !== 'production' && ! module ) {
1076+ if ( ( process . env . NODE_ENV !== 'production' ) && ! module ) {
10631077 console . error ( ( "[vuex] module namespace not found in " + helper + "(): " + namespace ) ) ;
10641078 }
10651079 return module
10661080}
10671081
1068- var index = {
1082+ var index_cjs = {
10691083 Store : Store ,
10701084 install : install ,
1071- version : '3.3 .0' ,
1085+ version : '3.4 .0' ,
10721086 mapState : mapState ,
10731087 mapMutations : mapMutations ,
10741088 mapGetters : mapGetters ,
10751089 mapActions : mapActions ,
10761090 createNamespacedHelpers : createNamespacedHelpers
10771091} ;
10781092
1079- module . exports = index ;
1093+ module . exports = index_cjs ;
0 commit comments