11/*!
2- * vue-router v3.1.2
2+ * vue-router v3.1.3
33 * (c) 2019 Evan You
44 * @license MIT
55 */
@@ -142,7 +142,7 @@ var View = {
142142
143143 return h ( component , data , children )
144144 }
145- }
145+ } ;
146146
147147function resolveProps ( route , config ) {
148148 switch ( typeof config ) {
@@ -271,7 +271,7 @@ function createRoute (
271271 redirectedFrom ,
272272 router
273273) {
274- var stringifyQuery$$1 = router && router . options . stringifyQuery ;
274+ var stringifyQuery = router && router . options . stringifyQuery ;
275275
276276 var query = location . query || { } ;
277277 try {
@@ -285,11 +285,11 @@ function createRoute (
285285 hash : location . hash || '' ,
286286 query : query ,
287287 params : location . params || { } ,
288- fullPath : getFullPath ( location , stringifyQuery$$1 ) ,
288+ fullPath : getFullPath ( location , stringifyQuery ) ,
289289 matched : record ? formatMatch ( record ) : [ ]
290290 } ;
291291 if ( redirectedFrom ) {
292- route . redirectedFrom = getFullPath ( redirectedFrom , stringifyQuery$$1 ) ;
292+ route . redirectedFrom = getFullPath ( redirectedFrom , stringifyQuery ) ;
293293 }
294294 return Object . freeze ( route )
295295}
@@ -1116,7 +1116,24 @@ var Link = {
11161116 // in case the <a> is a static node
11171117 a . isStatic = false ;
11181118 var aData = ( a . data = extend ( { } , a . data ) ) ;
1119- aData . on = on ;
1119+ aData . on = aData . on || { } ;
1120+ // transform existing events in both objects into arrays so we can push later
1121+ for ( var event in aData . on ) {
1122+ var handler$1 = aData . on [ event ] ;
1123+ if ( event in on ) {
1124+ aData . on [ event ] = Array . isArray ( handler$1 ) ? handler$1 : [ handler$1 ] ;
1125+ }
1126+ }
1127+ // append new listeners for router-link
1128+ for ( var event$1 in on ) {
1129+ if ( event$1 in aData . on ) {
1130+ // on[event] is always a function
1131+ aData . on [ event$1 ] . push ( on [ event$1 ] ) ;
1132+ } else {
1133+ aData . on [ event$1 ] = handler ;
1134+ }
1135+ }
1136+
11201137 var aAttrs = ( a . data . attrs = extend ( { } , a . data . attrs ) ) ;
11211138 aAttrs . href = href ;
11221139 } else {
@@ -1127,7 +1144,7 @@ var Link = {
11271144
11281145 return h ( this . tag , data , this . $slots . default )
11291146 }
1130- }
1147+ } ;
11311148
11321149function guardEvent ( e ) {
11331150 // don't redirect with control keys
@@ -1245,6 +1262,18 @@ function createRouteMap (
12451262 }
12461263 }
12471264
1265+ if ( process . env . NODE_ENV === 'development' ) {
1266+ // warn if routes do not include leading slashes
1267+ var found = pathList
1268+ // check for missing leading slash
1269+ . filter ( function ( path ) { return path && path . charAt ( 0 ) !== '*' && path . charAt ( 0 ) !== '/' ; } ) ;
1270+
1271+ if ( found . length > 0 ) {
1272+ var pathNames = found . map ( function ( path ) { return ( "- " + path ) ; } ) . join ( '\n' ) ;
1273+ warn ( false , ( "Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames ) ) ;
1274+ }
1275+ }
1276+
12481277 return {
12491278 pathList : pathList ,
12501279 pathMap : pathMap ,
@@ -1600,6 +1629,28 @@ function resolveRecordPath (path, record) {
16001629
16011630/* */
16021631
1632+ // use User Timing api (if present) for more accurate key precision
1633+ var Time =
1634+ inBrowser && window . performance && window . performance . now
1635+ ? window . performance
1636+ : Date ;
1637+
1638+ function genStateKey ( ) {
1639+ return Time . now ( ) . toFixed ( 3 )
1640+ }
1641+
1642+ var _key = genStateKey ( ) ;
1643+
1644+ function getStateKey ( ) {
1645+ return _key
1646+ }
1647+
1648+ function setStateKey ( key ) {
1649+ return ( _key = key )
1650+ }
1651+
1652+ /* */
1653+
16031654var positionStore = Object . create ( null ) ;
16041655
16051656function setupScroll ( ) {
@@ -1749,39 +1800,22 @@ function scrollToPosition (shouldScroll, position) {
17491800
17501801/* */
17511802
1752- var supportsPushState = inBrowser && ( function ( ) {
1753- var ua = window . navigator . userAgent ;
1754-
1755- if (
1756- ( ua . indexOf ( 'Android 2.' ) !== - 1 || ua . indexOf ( 'Android 4.0' ) !== - 1 ) &&
1757- ua . indexOf ( 'Mobile Safari' ) !== - 1 &&
1758- ua . indexOf ( 'Chrome' ) === - 1 &&
1759- ua . indexOf ( 'Windows Phone' ) === - 1
1760- ) {
1761- return false
1762- }
1763-
1764- return window . history && 'pushState' in window . history
1765- } ) ( ) ;
1766-
1767- // use User Timing api (if present) for more accurate key precision
1768- var Time = inBrowser && window . performance && window . performance . now
1769- ? window . performance
1770- : Date ;
1771-
1772- var _key = genKey ( ) ;
1773-
1774- function genKey ( ) {
1775- return Time . now ( ) . toFixed ( 3 )
1776- }
1777-
1778- function getStateKey ( ) {
1779- return _key
1780- }
1803+ var supportsPushState =
1804+ inBrowser &&
1805+ ( function ( ) {
1806+ var ua = window . navigator . userAgent ;
1807+
1808+ if (
1809+ ( ua . indexOf ( 'Android 2.' ) !== - 1 || ua . indexOf ( 'Android 4.0' ) !== - 1 ) &&
1810+ ua . indexOf ( 'Mobile Safari' ) !== - 1 &&
1811+ ua . indexOf ( 'Chrome' ) === - 1 &&
1812+ ua . indexOf ( 'Windows Phone' ) === - 1
1813+ ) {
1814+ return false
1815+ }
17811816
1782- function setStateKey ( key ) {
1783- _key = key ;
1784- }
1817+ return window . history && 'pushState' in window . history
1818+ } ) ( ) ;
17851819
17861820function pushState ( url , replace ) {
17871821 saveScrollPosition ( ) ;
@@ -1790,10 +1824,9 @@ function pushState (url, replace) {
17901824 var history = window . history ;
17911825 try {
17921826 if ( replace ) {
1793- history . replaceState ( { key : _key } , '' , url ) ;
1827+ history . replaceState ( { key : getStateKey ( ) } , '' , url ) ;
17941828 } else {
1795- _key = genKey ( ) ;
1796- history . pushState ( { key : _key } , '' , url ) ;
1829+ history . pushState ( { key : setStateKey ( genStateKey ( ) ) } , '' , url ) ;
17971830 }
17981831 } catch ( e ) {
17991832 window . location [ replace ? 'replace' : 'assign' ] ( url ) ;
@@ -1933,9 +1966,20 @@ function once (fn) {
19331966}
19341967
19351968var NavigationDuplicated = /*@__PURE__ */ ( function ( Error ) {
1936- function NavigationDuplicated ( ) {
1937- Error . call ( this , 'Navigating to current location is not allowed' ) ;
1969+ function NavigationDuplicated ( normalizedLocation ) {
1970+ Error . call ( this ) ;
19381971 this . name = this . _name = 'NavigationDuplicated' ;
1972+ // passing the message to super() doesn't seem to work in the transpiled version
1973+ this . message = "Navigating to current location (\"" + ( normalizedLocation . fullPath ) + "\") is not allowed" ;
1974+ // add a stack property so services like Sentry can correctly display it
1975+ Object . defineProperty ( this , 'stack' , {
1976+ value : new Error ( ) . stack ,
1977+ writable : true ,
1978+ configurable : true
1979+ } ) ;
1980+ // we could also have used
1981+ // Error.captureStackTrace(this, this.constructor)
1982+ // but it only exists on node and chrome
19391983 }
19401984
19411985 if ( Error ) NavigationDuplicated . __proto__ = Error ;
@@ -2275,11 +2319,11 @@ function poll (
22752319
22762320/* */
22772321
2278- var HTML5History = /*@__PURE__ */ ( function ( History$$1 ) {
2322+ var HTML5History = /*@__PURE__ */ ( function ( History ) {
22792323 function HTML5History ( router , base ) {
22802324 var this$1 = this ;
22812325
2282- History$$1 . call ( this , router , base ) ;
2326+ History . call ( this , router , base ) ;
22832327
22842328 var expectScroll = router . options . scrollBehavior ;
22852329 var supportsScroll = supportsPushState && expectScroll ;
@@ -2307,8 +2351,8 @@ var HTML5History = /*@__PURE__*/(function (History$$1) {
23072351 } ) ;
23082352 }
23092353
2310- if ( History$$1 ) HTML5History . __proto__ = History$$1 ;
2311- HTML5History . prototype = Object . create ( History$$1 && History$$1 . prototype ) ;
2354+ if ( History ) HTML5History . __proto__ = History ;
2355+ HTML5History . prototype = Object . create ( History && History . prototype ) ;
23122356 HTML5History . prototype . constructor = HTML5History ;
23132357
23142358 HTML5History . prototype . go = function go ( n ) {
@@ -2363,18 +2407,18 @@ function getLocation (base) {
23632407
23642408/* */
23652409
2366- var HashHistory = /*@__PURE__ */ ( function ( History$$1 ) {
2410+ var HashHistory = /*@__PURE__ */ ( function ( History ) {
23672411 function HashHistory ( router , base , fallback ) {
2368- History$$1 . call ( this , router , base ) ;
2412+ History . call ( this , router , base ) ;
23692413 // check history fallback deeplinking
23702414 if ( fallback && checkFallback ( this . base ) ) {
23712415 return
23722416 }
23732417 ensureSlash ( ) ;
23742418 }
23752419
2376- if ( History$$1 ) HashHistory . __proto__ = History$$1 ;
2377- HashHistory . prototype = Object . create ( History$$1 && History$$1 . prototype ) ;
2420+ if ( History ) HashHistory . __proto__ = History ;
2421+ HashHistory . prototype = Object . create ( History && History . prototype ) ;
23782422 HashHistory . prototype . constructor = HashHistory ;
23792423
23802424 // this is delayed until the app mounts
@@ -2528,15 +2572,15 @@ function replaceHash (path) {
25282572
25292573/* */
25302574
2531- var AbstractHistory = /*@__PURE__ */ ( function ( History$$1 ) {
2575+ var AbstractHistory = /*@__PURE__ */ ( function ( History ) {
25322576 function AbstractHistory ( router , base ) {
2533- History$$1 . call ( this , router , base ) ;
2577+ History . call ( this , router , base ) ;
25342578 this . stack = [ ] ;
25352579 this . index = - 1 ;
25362580 }
25372581
2538- if ( History$$1 ) AbstractHistory . __proto__ = History$$1 ;
2539- AbstractHistory . prototype = Object . create ( History$$1 && History$$1 . prototype ) ;
2582+ if ( History ) AbstractHistory . __proto__ = History ;
2583+ AbstractHistory . prototype = Object . create ( History && History . prototype ) ;
25402584 AbstractHistory . prototype . constructor = AbstractHistory ;
25412585
25422586 AbstractHistory . prototype . push = function push ( location , onComplete , onAbort ) {
@@ -2831,7 +2875,7 @@ function createHref (base, fullPath, mode) {
28312875}
28322876
28332877VueRouter . install = install ;
2834- VueRouter . version = '3.1.2 ' ;
2878+ VueRouter . version = '3.1.3 ' ;
28352879
28362880if ( inBrowser && window . Vue ) {
28372881 window . Vue . use ( VueRouter ) ;
0 commit comments