Skip to content

Commit

Permalink
v2.14.10 [hotfix]
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Dec 7, 2020
2 parents 1e67130 + e97051a commit 85bb979
Show file tree
Hide file tree
Showing 32 changed files with 256 additions and 189 deletions.
8 changes: 4 additions & 4 deletions distributions/nuxt-start/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-start",
"version": "2.14.9",
"version": "2.14.10",
"description": "Starts Nuxt Application in production mode",
"keywords": [
"nuxt",
Expand Down Expand Up @@ -55,9 +55,9 @@
"dist"
],
"dependencies": {
"@nuxt/cli": "2.14.9",
"@nuxt/core": "2.14.9",
"@nuxt/telemetry": "^1.2.3",
"@nuxt/cli": "2.14.10",
"@nuxt/core": "2.14.10",
"@nuxt/telemetry": "^1.3.0",
"node-fetch": "^2.6.1",
"vue": "^2.6.12",
"vue-client-only": "^2.0.0",
Expand Down
14 changes: 7 additions & 7 deletions distributions/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt",
"version": "2.14.9",
"version": "2.14.10",
"description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)",
"keywords": [
"nuxt",
Expand Down Expand Up @@ -58,15 +58,15 @@
"postinstall": "opencollective || exit 0"
},
"dependencies": {
"@nuxt/builder": "2.14.9",
"@nuxt/cli": "2.14.9",
"@nuxt/builder": "2.14.10",
"@nuxt/cli": "2.14.10",
"@nuxt/components": "^1.2.1",
"@nuxt/core": "2.14.9",
"@nuxt/generator": "2.14.9",
"@nuxt/core": "2.14.10",
"@nuxt/generator": "2.14.10",
"@nuxt/loading-screen": "^2.0.3",
"@nuxt/opencollective": "^0.3.2",
"@nuxt/telemetry": "^1.2.3",
"@nuxt/webpack": "2.14.9"
"@nuxt/telemetry": "^1.3.0",
"@nuxt/webpack": "2.14.10"
},
"engines": {
"node": ">=10.13.0",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.14.9",
"version": "2.14.10",
"npmClient": "yarn",
"useWorkspaces": true,
"conventionalCommits": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxt/babel-preset-app",
"version": "2.14.9",
"version": "2.14.10",
"description": "babel-preset-app for nuxt",
"repository": "nuxt/nuxt.js",
"license": "MIT",
Expand Down
8 changes: 4 additions & 4 deletions packages/builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxt/builder",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/builder.js",
Expand All @@ -9,9 +9,9 @@
],
"dependencies": {
"@nuxt/devalue": "^1.2.4",
"@nuxt/utils": "2.14.9",
"@nuxt/vue-app": "2.14.9",
"@nuxt/webpack": "2.14.9",
"@nuxt/utils": "2.14.10",
"@nuxt/vue-app": "2.14.10",
"@nuxt/webpack": "2.14.10",
"chalk": "^4.1.0",
"chokidar": "^3.4.3",
"consola": "^2.15.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxt/cli",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/cli.js",
Expand All @@ -12,8 +12,8 @@
"dist"
],
"dependencies": {
"@nuxt/config": "2.14.9",
"@nuxt/utils": "2.14.9",
"@nuxt/config": "2.14.10",
"@nuxt/utils": "2.14.10",
"boxen": "^4.2.0",
"chalk": "^4.1.0",
"compression": "^1.7.4",
Expand Down
5 changes: 3 additions & 2 deletions packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxt/config",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/config.js",
Expand All @@ -10,7 +10,8 @@
"index.d.ts"
],
"dependencies": {
"@nuxt/utils": "2.14.9",
"@nuxt/ufo": "^0.0.3",
"@nuxt/utils": "2.14.10",
"consola": "^2.15.0",
"create-require": "^1.1.1",
"defu": "^3.2.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/config/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import uniq from 'lodash/uniq'
import consola from 'consola'
import destr from 'destr'
import { TARGETS, MODES, guardDir, isNonEmptyString, isPureObject, isUrl, getMainModule, urlJoin, getPKG } from '@nuxt/utils'
import { normalizeURL } from '@nuxt/ufo'
import { defaultNuxtConfigFile, getDefaultNuxtConfig } from './config'

export function getNuxtConfig (_options) {
Expand Down Expand Up @@ -126,7 +127,7 @@ export function getNuxtConfig (_options) {
if (!/\/$/.test(options.router.base)) {
options.router.base += '/'
}
options.router.base = encodeURI(decodeURI(options.router.base))
options.router.base = normalizeURL(options.router.base)

// Legacy support for export
if (options.export) {
Expand Down
10 changes: 5 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@nuxt/core",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/core.js",
"files": [
"dist"
],
"dependencies": {
"@nuxt/config": "2.14.9",
"@nuxt/config": "2.14.10",
"@nuxt/devalue": "^1.2.4",
"@nuxt/server": "2.14.9",
"@nuxt/utils": "2.14.9",
"@nuxt/vue-renderer": "2.14.9",
"@nuxt/server": "2.14.10",
"@nuxt/utils": "2.14.10",
"@nuxt/vue-renderer": "2.14.10",
"consola": "^2.15.0",
"debug": "^4.2.0",
"esm": "^3.2.25",
Expand Down
4 changes: 2 additions & 2 deletions packages/generator/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@nuxt/generator",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/generator.js",
"files": [
"dist"
],
"dependencies": {
"@nuxt/utils": "2.14.9",
"@nuxt/utils": "2.14.10",
"chalk": "^4.1.0",
"consola": "^2.15.0",
"devalue": "^2.0.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@nuxt/server",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/server.js",
"files": [
"dist"
],
"dependencies": {
"@nuxt/config": "2.14.9",
"@nuxt/utils": "2.14.9",
"@nuxt/vue-renderer": "2.14.9",
"@nuxt/config": "2.14.10",
"@nuxt/utils": "2.14.10",
"@nuxt/vue-renderer": "2.14.10",
"@nuxtjs/youch": "^4.2.3",
"chalk": "^4.1.0",
"compression": "^1.7.4",
Expand Down
12 changes: 8 additions & 4 deletions packages/server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,16 @@ export default class Server {
}))

// DX: redirect if router.base in development
if (this.options.dev && this.nuxt.options.router.base !== '/') {
const routerBase = this.nuxt.options.router.base
if (this.options.dev && routerBase !== '/') {
this.useMiddleware({
prefix: false,
handler: (req, res) => {
const to = urlJoin(this.nuxt.options.router.base, req.url)
consola.info(`[Development] Redirecting from \`${decodeURI(req.url)}\` to \`${decodeURI(to)}\` (router.base specified).`)
handler: (req, res, next) => {
if (decodeURI(req.url).startsWith(decodeURI(routerBase))) {
return next()
}
const to = urlJoin(routerBase, req.url)
consola.info(`[Development] Redirecting from \`${decodeURI(req.url)}\` to \`${decodeURI(to)}\` (router.base specified)`)
res.writeHead(302, {
Location: to
})
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxt/types",
"version": "2.14.9",
"version": "2.14.10",
"description": "Nuxt types",
"repository": "nuxt/nuxt.js",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@nuxt/utils",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/utils.js",
"files": [
"dist"
],
"dependencies": {
"@nuxt/ufo": "^0.0.3",
"consola": "^2.15.0",
"fs-extra": "^9.0.1",
"hash-sum": "^2.0.0",
Expand Down
8 changes: 3 additions & 5 deletions packages/utils/src/route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import get from 'lodash/get'
import consola from 'consola'

import { normalizeURL } from '@nuxt/ufo'
import { r } from './resolve'

const routeChildren = function (route) {
Expand Down Expand Up @@ -201,10 +201,8 @@ export const createRoutes = function createRoutes ({
} else if (key === 'index' && i + 1 === keys.length) {
route.path += i > 0 ? '' : '/'
} else {
const isDynamic = key.startsWith('_')
route.path += '/' + getRoutePathExtension(isDynamic ? key : encodeURIComponent(decodeURIComponent(key)))

if (isDynamic && key.length > 1) {
route.path += normalizeURL(getRoutePathExtension(key))
if (key.startsWith('_') && key.length > 1) {
route.path += '?'
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/vue-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxt/vue-app",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/vue-app.js",
Expand All @@ -13,6 +13,7 @@
"index.d.ts"
],
"dependencies": {
"@nuxt/ufo": "^0.0.3",
"node-fetch": "^2.6.1",
"unfetch": "^4.2.0",
"vue": "^2.6.12",
Expand Down
20 changes: 16 additions & 4 deletions packages/vue-app/template/router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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' : '' %>
import scrollBehavior from './router.scrollBehavior.js'

Expand Down Expand Up @@ -105,16 +106,27 @@ export const routerOptions = {
fallback: <%= router.fallback %>
}

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
const resolve = router.resolve.bind(router)
router.resolve = (to, current, append) => {
if (typeof to === 'string') {
to = encodeURI(decodeURI(to))
to = normalizeURL(to)
}
const r = resolve(to, current, append)
if (r && r.resolved && r.resolved.query) {
decodeObj(r.resolved.query)
}
return resolve(to, current, append)
return r
}

return router
Expand Down
5 changes: 3 additions & 2 deletions packages/vue-app/template/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { stringify } from 'querystring'
import Vue from 'vue'
import { normalizeURL } from '@nuxt/ufo'
<% if (fetch.server) { %>import fetch from 'node-fetch'<% } %>
<% if (features.middleware) { %>import middleware from './middleware.js'<% } %>
import {
Expand Down Expand Up @@ -50,12 +51,12 @@ const createNext = ssrContext => (opts) => {
opts.path = urlJoin(routerBase, opts.path)
}
// Avoid loop redirect
if (encodeURI(decodeURI(opts.path)) === ssrContext.url) {
if (decodeURI(opts.path) === decodeURI(ssrContext.url)) {
ssrContext.redirected = false
return
}
ssrContext.res.writeHead(opts.status, {
Location: opts.path
Location: normalizeURL(opts.path)
})
ssrContext.res.end()
}
Expand Down
4 changes: 3 additions & 1 deletion packages/vue-app/template/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Vue from 'vue'
import { normalizeURL } from '@nuxt/ufo'

// window.{{globals.loadedCallback}} hook
// Useful for jsdom testing or plugins (https://github.com/tmpvar/jsdom#dealing-with-asynchronous-script-loading)
Expand Down Expand Up @@ -309,7 +310,7 @@ export function getLocation (base, mode) {

const fullPath = (path || '/') + window.location.search + window.location.hash

return encodeURI(fullPath)
return normalizeURL(fullPath)
}

// Imported from path-to-regexp
Expand Down Expand Up @@ -692,3 +693,4 @@ export function setScrollRestoration (newVal) {
window.history.scrollRestoration = newVal;
} catch(e) {}
}

4 changes: 2 additions & 2 deletions packages/vue-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxt/vue-renderer",
"version": "2.14.9",
"version": "2.14.10",
"repository": "nuxt/nuxt.js",
"license": "MIT",
"main": "dist/vue-renderer.js",
Expand All @@ -9,7 +9,7 @@
],
"dependencies": {
"@nuxt/devalue": "^1.2.4",
"@nuxt/utils": "2.14.9",
"@nuxt/utils": "2.14.10",
"consola": "^2.15.0",
"fs-extra": "^9.0.1",
"lru-cache": "^5.1.1",
Expand Down

0 comments on commit 85bb979

Please sign in to comment.