Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vue-router
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.1.2
Choose a base ref
...
head repository: vuejs/vue-router
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.1.3
Choose a head ref
  • 14 commits
  • 23 files changed
  • 7 contributors

Commits on Aug 8, 2019

  1. chore(changelog): 3.1.2

    posva committed Aug 8, 2019
    Copy the full SHA
    5141def View commit details

Commits on Aug 21, 2019

  1. Copy the full SHA
    5ef5d73 View commit details
  2. Copy the full SHA
    e0d4dc4 View commit details

Commits on Aug 22, 2019

  1. docs(zh): add promise based push/replace (#2898)

    * docs(zh): add promise based push/replace
    
    * docs(zh): clarifying omit the 2nd and 3rd parameter behaviour
    
    * Update docs/zh/guide/essentials/navigation.md
    
    Co-Authored-By: GU Yiling <[email protected]>
    2 people authored and posva committed Aug 22, 2019
    Copy the full SHA
    a8fe4fc View commit details

Commits on Aug 23, 2019

  1. chore: add funding.yml

    posva committed Aug 23, 2019
    Copy the full SHA
    8ca7e74 View commit details
  2. chore: upgrade rollup

    posva committed Aug 23, 2019
    Copy the full SHA
    0491cf2 View commit details
  3. Copy the full SHA
    be66504 View commit details
  4. chore(test): remove useless code and comments (#2808)

    * chore(test): remove useless code and comments
    
    * chore: comment
    zrh122 authored and posva committed Aug 23, 2019
    Copy the full SHA
    842a760 View commit details
  5. style(test): add eslint configuration for unit tests (#2518)

    * style(test): add eslint configuration for unit tests
    
    * style(test): move test-specific eslint configuration to test/unit
    rchl authored and posva committed Aug 23, 2019
    Copy the full SHA
    b3592b6 View commit details
  6. docs(guards): wording (#2190)

    Be consistent with referring to guard function names.
    trainiac authored and posva committed Aug 23, 2019
    Copy the full SHA
    fdf5756 View commit details

Commits on Aug 26, 2019

  1. Copy the full SHA
    638278b View commit details

Commits on Aug 30, 2019

  1. feat: warn about root paths without a leading slash (#2591)

    * fix(create-matcher): warn about root paths without a leading slash
    
    close #2550
    
    * fix(create-route-map): warn about root paths without a leading slash
    
    close #2550
    
    * fix(create-route-map): only warn about first route without slash
    
    * fix(create-route-map): handle case of '' route
    
    * fix(create-route-map): remove leftover console.log
    
    * fix(create-route-map): warn about root paths only
    
    * fix(create-route-map): show prettier warning message
    Sayegh7 authored and posva committed Aug 30, 2019
    Copy the full SHA
    7d7e048 View commit details
  2. build: bundle 3.1.3

    posva committed Aug 30, 2019
    Copy the full SHA
    ec2e1fe View commit details
  3. chore(release): 3.1.3

    posva committed Aug 30, 2019
    Copy the full SHA
    745a33d View commit details
3 changes: 3 additions & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github: [posva, yyx990803]
patreon: posva
open_collective: vuejs
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [3.1.2](https://github.com/vuejs/vue-router/compare/v3.1.1...v3.1.2) (2019-08-08)

### Bug Fixes

- **types:** prioritize promise based push/replace ([1243e8b](https://github.com/vuejs/vue-router/commit/1243e8b))

### Reverts

- "fix(hash): correctly place query if placed before hash ([#2851](https://github.com/vuejs/vue-router/issues/2851))" ([9b30e4c](https://github.com/vuejs/vue-router/commit/9b30e4c)), closes [#2876](https://github.com/vuejs/vue-router/issues/2876). See more information at https://github.com/vuejs/vue-router/issues/2125#issuecomment-519521424

## [3.1.1](https://github.com/vuejs/vue-router/compare/v3.1.0...v3.1.1) (2019-08-06)

### Bug Fixes
48 changes: 30 additions & 18 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -15,12 +15,14 @@ function build (builds) {
let built = 0
const total = builds.length
const next = () => {
buildEntry(builds[built]).then(() => {
built++
if (built < total) {
next()
}
}).catch(logError)
buildEntry(builds[built])
.then(() => {
built++
if (built < total) {
next()
}
})
.catch(logError)
}

next()
@@ -29,19 +31,24 @@ function build (builds) {
function buildEntry ({ input, output }) {
const { file, banner } = output
const isProd = /min\.js$/.test(file)
return rollup.rollup(input)
return rollup
.rollup(input)
.then(bundle => bundle.generate(output))
.then(({ code }) => {
.then(bundle => {
// console.log(bundle)
const code = bundle.output[0].code
if (isProd) {
const minified = (banner ? banner + '\n' : '') + terser.minify(code, {
toplevel: true,
output: {
ascii_only: true
},
compress: {
pure_funcs: ['makeMap']
}
}).code
const minified =
(banner ? banner + '\n' : '') +
terser.minify(code, {
toplevel: true,
output: {
ascii_only: true
},
compress: {
pure_funcs: ['makeMap']
}
}).code
return write(file, minified, true)
} else {
return write(file, code)
@@ -52,7 +59,12 @@ function buildEntry ({ input, output }) {
function write (dest, code, zip) {
return new Promise((resolve, reject) => {
function report (extra) {
console.log(blue(path.relative(process.cwd(), dest)) + ' ' + getSize(code) + (extra || ''))
console.log(
blue(path.relative(process.cwd(), dest)) +
' ' +
getSize(code) +
(extra || '')
)
resolve()
}

158 changes: 101 additions & 57 deletions dist/vue-router.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-router v3.1.2
* vue-router v3.1.3
* (c) 2019 Evan You
* @license MIT
*/
@@ -142,7 +142,7 @@ var View = {

return h(component, data, children)
}
}
};

function resolveProps (route, config) {
switch (typeof config) {
@@ -271,7 +271,7 @@ function createRoute (
redirectedFrom,
router
) {
var stringifyQuery$$1 = router && router.options.stringifyQuery;
var stringifyQuery = router && router.options.stringifyQuery;

var query = location.query || {};
try {
@@ -285,11 +285,11 @@ function createRoute (
hash: location.hash || '',
query: query,
params: location.params || {},
fullPath: getFullPath(location, stringifyQuery$$1),
fullPath: getFullPath(location, stringifyQuery),
matched: record ? formatMatch(record) : []
};
if (redirectedFrom) {
route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery$$1);
route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
}
return Object.freeze(route)
}
@@ -1116,7 +1116,24 @@ var Link = {
// in case the <a> is a static node
a.isStatic = false;
var aData = (a.data = extend({}, a.data));
aData.on = on;
aData.on = aData.on || {};
// transform existing events in both objects into arrays so we can push later
for (var event in aData.on) {
var handler$1 = aData.on[event];
if (event in on) {
aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
}
}
// append new listeners for router-link
for (var event$1 in on) {
if (event$1 in aData.on) {
// on[event] is always a function
aData.on[event$1].push(on[event$1]);
} else {
aData.on[event$1] = handler;
}
}

var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
aAttrs.href = href;
} else {
@@ -1127,7 +1144,7 @@ var Link = {

return h(this.tag, data, this.$slots.default)
}
}
};

function guardEvent (e) {
// don't redirect with control keys
@@ -1245,6 +1262,18 @@ function createRouteMap (
}
}

if (process.env.NODE_ENV === 'development') {
// warn if routes do not include leading slashes
var found = pathList
// check for missing leading slash
.filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });

if (found.length > 0) {
var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
}
}

return {
pathList: pathList,
pathMap: pathMap,
@@ -1600,6 +1629,28 @@ function resolveRecordPath (path, record) {

/* */

// use User Timing api (if present) for more accurate key precision
var Time =
inBrowser && window.performance && window.performance.now
? window.performance
: Date;

function genStateKey () {
return Time.now().toFixed(3)
}

var _key = genStateKey();

function getStateKey () {
return _key
}

function setStateKey (key) {
return (_key = key)
}

/* */

var positionStore = Object.create(null);

function setupScroll () {
@@ -1749,39 +1800,22 @@ function scrollToPosition (shouldScroll, position) {

/* */

var supportsPushState = inBrowser && (function () {
var ua = window.navigator.userAgent;

if (
(ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
ua.indexOf('Mobile Safari') !== -1 &&
ua.indexOf('Chrome') === -1 &&
ua.indexOf('Windows Phone') === -1
) {
return false
}

return window.history && 'pushState' in window.history
})();

// use User Timing api (if present) for more accurate key precision
var Time = inBrowser && window.performance && window.performance.now
? window.performance
: Date;

var _key = genKey();

function genKey () {
return Time.now().toFixed(3)
}

function getStateKey () {
return _key
}
var supportsPushState =
inBrowser &&
(function () {
var ua = window.navigator.userAgent;

if (
(ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
ua.indexOf('Mobile Safari') !== -1 &&
ua.indexOf('Chrome') === -1 &&
ua.indexOf('Windows Phone') === -1
) {
return false
}

function setStateKey (key) {
_key = key;
}
return window.history && 'pushState' in window.history
})();

function pushState (url, replace) {
saveScrollPosition();
@@ -1790,10 +1824,9 @@ function pushState (url, replace) {
var history = window.history;
try {
if (replace) {
history.replaceState({ key: _key }, '', url);
history.replaceState({ key: getStateKey() }, '', url);
} else {
_key = genKey();
history.pushState({ key: _key }, '', url);
history.pushState({ key: setStateKey(genStateKey()) }, '', url);
}
} catch (e) {
window.location[replace ? 'replace' : 'assign'](url);
@@ -1933,9 +1966,20 @@ function once (fn) {
}

var NavigationDuplicated = /*@__PURE__*/(function (Error) {
function NavigationDuplicated () {
Error.call(this, 'Navigating to current location is not allowed');
function NavigationDuplicated (normalizedLocation) {
Error.call(this);
this.name = this._name = 'NavigationDuplicated';
// passing the message to super() doesn't seem to work in the transpiled version
this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
// add a stack property so services like Sentry can correctly display it
Object.defineProperty(this, 'stack', {
value: new Error().stack,
writable: true,
configurable: true
});
// we could also have used
// Error.captureStackTrace(this, this.constructor)
// but it only exists on node and chrome
}

if ( Error ) NavigationDuplicated.__proto__ = Error;
@@ -2275,11 +2319,11 @@ function poll (

/* */

var HTML5History = /*@__PURE__*/(function (History$$1) {
var HTML5History = /*@__PURE__*/(function (History) {
function HTML5History (router, base) {
var this$1 = this;

History$$1.call(this, router, base);
History.call(this, router, base);

var expectScroll = router.options.scrollBehavior;
var supportsScroll = supportsPushState && expectScroll;
@@ -2307,8 +2351,8 @@ var HTML5History = /*@__PURE__*/(function (History$$1) {
});
}

if ( History$$1 ) HTML5History.__proto__ = History$$1;
HTML5History.prototype = Object.create( History$$1 && History$$1.prototype );
if ( History ) HTML5History.__proto__ = History;
HTML5History.prototype = Object.create( History && History.prototype );
HTML5History.prototype.constructor = HTML5History;

HTML5History.prototype.go = function go (n) {
@@ -2363,18 +2407,18 @@ function getLocation (base) {

/* */

var HashHistory = /*@__PURE__*/(function (History$$1) {
var HashHistory = /*@__PURE__*/(function (History) {
function HashHistory (router, base, fallback) {
History$$1.call(this, router, base);
History.call(this, router, base);
// check history fallback deeplinking
if (fallback && checkFallback(this.base)) {
return
}
ensureSlash();
}

if ( History$$1 ) HashHistory.__proto__ = History$$1;
HashHistory.prototype = Object.create( History$$1 && History$$1.prototype );
if ( History ) HashHistory.__proto__ = History;
HashHistory.prototype = Object.create( History && History.prototype );
HashHistory.prototype.constructor = HashHistory;

// this is delayed until the app mounts
@@ -2528,15 +2572,15 @@ function replaceHash (path) {

/* */

var AbstractHistory = /*@__PURE__*/(function (History$$1) {
var AbstractHistory = /*@__PURE__*/(function (History) {
function AbstractHistory (router, base) {
History$$1.call(this, router, base);
History.call(this, router, base);
this.stack = [];
this.index = -1;
}

if ( History$$1 ) AbstractHistory.__proto__ = History$$1;
AbstractHistory.prototype = Object.create( History$$1 && History$$1.prototype );
if ( History ) AbstractHistory.__proto__ = History;
AbstractHistory.prototype = Object.create( History && History.prototype );
AbstractHistory.prototype.constructor = AbstractHistory;

AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
@@ -2831,7 +2875,7 @@ function createHref (base, fullPath, mode) {
}

VueRouter.install = install;
VueRouter.version = '3.1.2';
VueRouter.version = '3.1.3';

if (inBrowser && window.Vue) {
window.Vue.use(VueRouter);
Loading