@nuxt/vue-app
Advanced tools
Comparing version 2.14.9 to 2.14.10
/*! | ||
* @nuxt/vue-app v2.14.9 (c) 2016-2020 | ||
* @nuxt/vue-app v2.14.10 (c) 2016-2020 | ||
@@ -19,2 +19,3 @@ * - All the amazing contributors | ||
var dependencies = { | ||
"@nuxt/ufo": "^0.0.3", | ||
"node-fetch": "^2.6.1", | ||
@@ -21,0 +22,0 @@ unfetch: "^4.2.0", |
{ | ||
"name": "@nuxt/vue-app", | ||
"version": "2.14.9", | ||
"version": "2.14.10", | ||
"repository": "nuxt/nuxt.js", | ||
@@ -16,2 +16,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@nuxt/ufo": "^0.0.3", | ||
"node-fetch": "^2.6.1", | ||
@@ -18,0 +19,0 @@ "unfetch": "^4.2.0", |
import Vue from 'vue' | ||
import Router from 'vue-router' | ||
import { normalizeURL } from '@nuxt/ufo' | ||
import { interopDefault } from './utils'<%= isTest ? '// eslint-disable-line no-unused-vars' : '' %> | ||
@@ -108,12 +109,23 @@ import scrollBehavior from './router.scrollBehavior.js' | ||
function decodeObj(obj) { | ||
for (const key in obj) { | ||
if (typeof obj[key] === 'string') { | ||
obj[key] = decodeURIComponent(obj[key]) | ||
} | ||
} | ||
} | ||
export function createRouter () { | ||
const router = new Router(routerOptions) | ||
const resolve = router.resolve.bind(router) | ||
// encodeURI(decodeURI()) ~> support both encoded and non-encoded urls | ||
router.resolve = (to, current, append) => { | ||
if (typeof to === 'string') { | ||
to = encodeURI(decodeURI(to)) | ||
to = normalizeURL(to) | ||
} | ||
return resolve(to, current, append) | ||
const r = resolve(to, current, append) | ||
if (r && r.resolved && r.resolved.query) { | ||
decodeObj(r.resolved.query) | ||
} | ||
return r | ||
} | ||
@@ -120,0 +132,0 @@ |
import { stringify } from 'querystring' | ||
import Vue from 'vue' | ||
import { normalizeURL } from '@nuxt/ufo' | ||
<% if (fetch.server) { %>import fetch from 'node-fetch'<% } %> | ||
@@ -53,3 +54,3 @@ <% if (features.middleware) { %>import middleware from './middleware.js'<% } %> | ||
// Avoid loop redirect | ||
if (encodeURI(decodeURI(opts.path)) === ssrContext.url) { | ||
if (decodeURI(opts.path) === decodeURI(ssrContext.url)) { | ||
ssrContext.redirected = false | ||
@@ -59,3 +60,3 @@ return | ||
ssrContext.res.writeHead(opts.status, { | ||
Location: opts.path | ||
Location: normalizeURL(opts.path) | ||
}) | ||
@@ -62,0 +63,0 @@ ssrContext.res.end() |
import Vue from 'vue' | ||
import { normalizeURL } from '@nuxt/ufo' | ||
@@ -312,3 +313,3 @@ // window.{{globals.loadedCallback}} hook | ||
return encodeURI(fullPath) | ||
return normalizeURL(fullPath) | ||
} | ||
@@ -696,1 +697,2 @@ | ||
} | ||
168859
3649
10
+ Added@nuxt/ufo@^0.0.3
+ Added@nuxt/ufo@0.0.3(transitive)