1
- /**
2
- * vuex v3.3 .0
1
+ /*!
2
+ * vuex v3.4 .0
3
3
* (c) 2020 Evan You
4
4
* @license MIT
5
5
*/
@@ -201,7 +201,7 @@ ModuleCollection.prototype.register = function register (path, rawModule, runtim
201
201
var this$1 = this ;
202
202
if ( runtime === void 0 ) runtime = true ;
203
203
204
- if ( process . env . NODE_ENV !== 'production' ) {
204
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
205
205
assertRawModule ( path , rawModule ) ;
206
206
}
207
207
@@ -237,7 +237,7 @@ ModuleCollection.prototype.isRegistered = function isRegistered (path) {
237
237
} ;
238
238
239
239
function update ( path , targetModule , newModule ) {
240
- if ( process . env . NODE_ENV !== 'production' ) {
240
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
241
241
assertRawModule ( path , newModule ) ;
242
242
}
243
243
@@ -248,7 +248,7 @@ function update (path, targetModule, newModule) {
248
248
if ( newModule . modules ) {
249
249
for ( var key in newModule . modules ) {
250
250
if ( ! targetModule . getChild ( key ) ) {
251
- if ( process . env . NODE_ENV !== 'production' ) {
251
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
252
252
console . warn (
253
253
"[vuex] trying to add a new module '" + key + "' on hot reloading, " +
254
254
'manual reload is needed'
@@ -319,7 +319,7 @@ var Store = function Store (options) {
319
319
install ( window . Vue ) ;
320
320
}
321
321
322
- if ( process . env . NODE_ENV !== 'production' ) {
322
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
323
323
assert ( Vue , "must call Vue.use(Vuex) before creating a store instance." ) ;
324
324
assert ( typeof Promise !== 'undefined' , "vuex requires a Promise polyfill in this browser." ) ;
325
325
assert ( this instanceof Store , "store must be called with the new operator." ) ;
@@ -382,7 +382,7 @@ prototypeAccessors$1.state.get = function () {
382
382
} ;
383
383
384
384
prototypeAccessors$1 . state . set = function ( v ) {
385
- if ( process . env . NODE_ENV !== 'production' ) {
385
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
386
386
assert ( false , "use store.replaceState() to explicit replace store state." ) ;
387
387
}
388
388
} ;
@@ -399,7 +399,7 @@ Store.prototype.commit = function commit (_type, _payload, _options) {
399
399
var mutation = { type : type , payload : payload } ;
400
400
var entry = this . _mutations [ type ] ;
401
401
if ( ! entry ) {
402
- if ( process . env . NODE_ENV !== 'production' ) {
402
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
403
403
console . error ( ( "[vuex] unknown mutation type: " + type ) ) ;
404
404
}
405
405
return
@@ -415,7 +415,7 @@ Store.prototype.commit = function commit (_type, _payload, _options) {
415
415
. forEach ( function ( sub ) { return sub ( mutation , this$1 . state ) ; } ) ;
416
416
417
417
if (
418
- process . env . NODE_ENV !== 'production' &&
418
+ ( process . env . NODE_ENV !== 'production' ) &&
419
419
options && options . silent
420
420
) {
421
421
console . warn (
@@ -436,7 +436,7 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
436
436
var action = { type : type , payload : payload } ;
437
437
var entry = this . _actions [ type ] ;
438
438
if ( ! entry ) {
439
- if ( process . env . NODE_ENV !== 'production' ) {
439
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
440
440
console . error ( ( "[vuex] unknown action type: " + type ) ) ;
441
441
}
442
442
return
@@ -448,7 +448,7 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
448
448
. filter ( function ( sub ) { return sub . before ; } )
449
449
. forEach ( function ( sub ) { return sub . before ( action , this$1 . state ) ; } ) ;
450
450
} catch ( e ) {
451
- if ( process . env . NODE_ENV !== 'production' ) {
451
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
452
452
console . warn ( "[vuex] error in before action subscribers: " ) ;
453
453
console . error ( e ) ;
454
454
}
@@ -458,18 +458,32 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
458
458
? Promise . all ( entry . map ( function ( handler ) { return handler ( payload ) ; } ) )
459
459
: entry [ 0 ] ( payload ) ;
460
460
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
+ }
470
472
}
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
+ } ) ;
473
487
} )
474
488
} ;
475
489
@@ -485,7 +499,7 @@ Store.prototype.subscribeAction = function subscribeAction (fn, options) {
485
499
Store . prototype . watch = function watch ( getter , cb , options ) {
486
500
var this$1 = this ;
487
501
488
- if ( process . env . NODE_ENV !== 'production' ) {
502
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
489
503
assert ( typeof getter === 'function' , "store.watch only accepts a function." ) ;
490
504
}
491
505
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
504
518
505
519
if ( typeof path === 'string' ) { path = [ path ] ; }
506
520
507
- if ( process . env . NODE_ENV !== 'production' ) {
521
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
508
522
assert ( Array . isArray ( path ) , "module path must be a string or an Array." ) ;
509
523
assert ( path . length > 0 , 'cannot register the root module by using registerModule.' ) ;
510
524
}
@@ -520,7 +534,7 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
520
534
521
535
if ( typeof path === 'string' ) { path = [ path ] ; }
522
536
523
- if ( process . env . NODE_ENV !== 'production' ) {
537
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
524
538
assert ( Array . isArray ( path ) , "module path must be a string or an Array." ) ;
525
539
}
526
540
@@ -535,7 +549,7 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
535
549
Store . prototype . hasModule = function hasModule ( path ) {
536
550
if ( typeof path === 'string' ) { path = [ path ] ; }
537
551
538
- if ( process . env . NODE_ENV !== 'production' ) {
552
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
539
553
assert ( Array . isArray ( path ) , "module path must be a string or an Array." ) ;
540
554
}
541
555
@@ -638,7 +652,7 @@ function installModule (store, rootState, path, module, hot) {
638
652
639
653
// register in namespace map
640
654
if ( module . namespaced ) {
641
- if ( store . _modulesNamespaceMap [ namespace ] && process . env . NODE_ENV !== 'production' ) {
655
+ if ( store . _modulesNamespaceMap [ namespace ] && ( process . env . NODE_ENV !== 'production' ) ) {
642
656
console . error ( ( "[vuex] duplicate namespace " + namespace + " for the namespaced module " + ( path . join ( '/' ) ) ) ) ;
643
657
}
644
658
store . _modulesNamespaceMap [ namespace ] = module ;
@@ -649,7 +663,7 @@ function installModule (store, rootState, path, module, hot) {
649
663
var parentState = getNestedState ( rootState , path . slice ( 0 , - 1 ) ) ;
650
664
var moduleName = path [ path . length - 1 ] ;
651
665
store . _withCommit ( function ( ) {
652
- if ( process . env . NODE_ENV !== 'production' ) {
666
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
653
667
if ( moduleName in parentState ) {
654
668
console . warn (
655
669
( "[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) {
699
713
700
714
if ( ! options || ! options . root ) {
701
715
type = namespace + type ;
702
- if ( process . env . NODE_ENV !== 'production' && ! store . _actions [ type ] ) {
716
+ if ( ( process . env . NODE_ENV !== 'production' ) && ! store . _actions [ type ] ) {
703
717
console . error ( ( "[vuex] unknown local action type: " + ( args . type ) + ", global type: " + type ) ) ;
704
718
return
705
719
}
@@ -716,7 +730,7 @@ function makeLocalContext (store, namespace, path) {
716
730
717
731
if ( ! options || ! options . root ) {
718
732
type = namespace + type ;
719
- if ( process . env . NODE_ENV !== 'production' && ! store . _mutations [ type ] ) {
733
+ if ( ( process . env . NODE_ENV !== 'production' ) && ! store . _mutations [ type ] ) {
720
734
console . error ( ( "[vuex] unknown local mutation type: " + ( args . type ) + ", global type: " + type ) ) ;
721
735
return
722
736
}
@@ -801,7 +815,7 @@ function registerAction (store, type, handler, local) {
801
815
802
816
function registerGetter ( store , type , rawGetter , local ) {
803
817
if ( store . _wrappedGetters [ type ] ) {
804
- if ( process . env . NODE_ENV !== 'production' ) {
818
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
805
819
console . error ( ( "[vuex] duplicate getter key: " + type ) ) ;
806
820
}
807
821
return
@@ -818,7 +832,7 @@ function registerGetter (store, type, rawGetter, local) {
818
832
819
833
function enableStrictMode ( store ) {
820
834
store . _vm . $watch ( function ( ) { return this . _data . $$state } , function ( ) {
821
- if ( process . env . NODE_ENV !== 'production' ) {
835
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
822
836
assert ( store . _committing , "do not mutate vuex store state outside mutation handlers." ) ;
823
837
}
824
838
} , { deep : true , sync : true } ) ;
@@ -835,7 +849,7 @@ function unifyObjectStyle (type, payload, options) {
835
849
type = type . type ;
836
850
}
837
851
838
- if ( process . env . NODE_ENV !== 'production' ) {
852
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
839
853
assert ( typeof type === 'string' , ( "expects string as the type, but found " + ( typeof type ) + "." ) ) ;
840
854
}
841
855
@@ -844,7 +858,7 @@ function unifyObjectStyle (type, payload, options) {
844
858
845
859
function install ( _Vue ) {
846
860
if ( Vue && _Vue === Vue ) {
847
- if ( process . env . NODE_ENV !== 'production' ) {
861
+ if ( ( process . env . NODE_ENV !== 'production' ) ) {
848
862
console . error (
849
863
'[vuex] already installed. Vue.use(Vuex) should be called only once.'
850
864
) ;
@@ -863,7 +877,7 @@ function install (_Vue) {
863
877
*/
864
878
var mapState = normalizeNamespace ( function ( namespace , states ) {
865
879
var res = { } ;
866
- if ( process . env . NODE_ENV !== 'production' && ! isValidMap ( states ) ) {
880
+ if ( ( process . env . NODE_ENV !== 'production' ) && ! isValidMap ( states ) ) {
867
881
console . error ( '[vuex] mapState: mapper parameter must be either an Array or an Object' ) ;
868
882
}
869
883
normalizeMap ( states ) . forEach ( function ( ref ) {
@@ -899,7 +913,7 @@ var mapState = normalizeNamespace(function (namespace, states) {
899
913
*/
900
914
var mapMutations = normalizeNamespace ( function ( namespace , mutations ) {
901
915
var res = { } ;
902
- if ( process . env . NODE_ENV !== 'production' && ! isValidMap ( mutations ) ) {
916
+ if ( ( process . env . NODE_ENV !== 'production' ) && ! isValidMap ( mutations ) ) {
903
917
console . error ( '[vuex] mapMutations: mapper parameter must be either an Array or an Object' ) ;
904
918
}
905
919
normalizeMap ( mutations ) . forEach ( function ( ref ) {
@@ -935,7 +949,7 @@ var mapMutations = normalizeNamespace(function (namespace, mutations) {
935
949
*/
936
950
var mapGetters = normalizeNamespace ( function ( namespace , getters ) {
937
951
var res = { } ;
938
- if ( process . env . NODE_ENV !== 'production' && ! isValidMap ( getters ) ) {
952
+ if ( ( process . env . NODE_ENV !== 'production' ) && ! isValidMap ( getters ) ) {
939
953
console . error ( '[vuex] mapGetters: mapper parameter must be either an Array or an Object' ) ;
940
954
}
941
955
normalizeMap ( getters ) . forEach ( function ( ref ) {
@@ -948,7 +962,7 @@ var mapGetters = normalizeNamespace(function (namespace, getters) {
948
962
if ( namespace && ! getModuleByNamespace ( this . $store , 'mapGetters' , namespace ) ) {
949
963
return
950
964
}
951
- if ( process . env . NODE_ENV !== 'production' && ! ( val in this . $store . getters ) ) {
965
+ if ( ( process . env . NODE_ENV !== 'production' ) && ! ( val in this . $store . getters ) ) {
952
966
console . error ( ( "[vuex] unknown getter: " + val ) ) ;
953
967
return
954
968
}
@@ -968,7 +982,7 @@ var mapGetters = normalizeNamespace(function (namespace, getters) {
968
982
*/
969
983
var mapActions = normalizeNamespace ( function ( namespace , actions ) {
970
984
var res = { } ;
971
- if ( process . env . NODE_ENV !== 'production' && ! isValidMap ( actions ) ) {
985
+ if ( ( process . env . NODE_ENV !== 'production' ) && ! isValidMap ( actions ) ) {
972
986
console . error ( '[vuex] mapActions: mapper parameter must be either an Array or an Object' ) ;
973
987
}
974
988
normalizeMap ( actions ) . forEach ( function ( ref ) {
@@ -1059,21 +1073,21 @@ function normalizeNamespace (fn) {
1059
1073
*/
1060
1074
function getModuleByNamespace ( store , helper , namespace ) {
1061
1075
var module = store . _modulesNamespaceMap [ namespace ] ;
1062
- if ( process . env . NODE_ENV !== 'production' && ! module ) {
1076
+ if ( ( process . env . NODE_ENV !== 'production' ) && ! module ) {
1063
1077
console . error ( ( "[vuex] module namespace not found in " + helper + "(): " + namespace ) ) ;
1064
1078
}
1065
1079
return module
1066
1080
}
1067
1081
1068
- var index = {
1082
+ var index_cjs = {
1069
1083
Store : Store ,
1070
1084
install : install ,
1071
- version : '3.3 .0' ,
1085
+ version : '3.4 .0' ,
1072
1086
mapState : mapState ,
1073
1087
mapMutations : mapMutations ,
1074
1088
mapGetters : mapGetters ,
1075
1089
mapActions : mapActions ,
1076
1090
createNamespacedHelpers : createNamespacedHelpers
1077
1091
} ;
1078
1092
1079
- module . exports = index ;
1093
+ module . exports = index_cjs ;
0 commit comments