Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.13.2 #7615

Merged
merged 11 commits into from Jun 26, 2020
Merged

v2.13.2 #7615

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion distributions/nuxt-start/package.json
Expand Up @@ -57,7 +57,7 @@
"dependencies": {
"@nuxt/cli": "2.13.1",
"@nuxt/core": "2.13.1",
"@nuxt/telemetry": "^1.1.0",
"@nuxt/telemetry": "^1.2.0",
"node-fetch": "^2.6.0",
"vue": "^2.6.11",
"vue-client-only": "^2.0.0",
Expand Down
6 changes: 3 additions & 3 deletions distributions/nuxt/package.json
Expand Up @@ -60,12 +60,12 @@
"dependencies": {
"@nuxt/builder": "2.13.1",
"@nuxt/cli": "2.13.1",
"@nuxt/components": "^1.0.4",
"@nuxt/components": "^1.0.5",
"@nuxt/core": "2.13.1",
"@nuxt/generator": "2.13.1",
"@nuxt/loading-screen": "^2.0.1",
"@nuxt/loading-screen": "^2.0.2",
"@nuxt/opencollective": "^0.3.0",
"@nuxt/telemetry": "^1.1.0",
"@nuxt/telemetry": "^1.2.0",
"@nuxt/webpack": "2.13.1"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -49,7 +49,7 @@
"@vue/test-utils": "^1.0.3",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.1.0",
"consola": "^2.13.0",
"consola": "^2.14.0",
"create-require": "^1.0.2",
"cross-spawn": "^7.0.3",
"eslint": "^7.3.1",
Expand All @@ -72,7 +72,7 @@
"lodash": "^4.17.15",
"node-fetch": "^2.6.0",
"node-sass": "^4.14.1",
"puppeteer-core": "^4.0.0",
"puppeteer-core": "^4.0.1",
"request": "^2.88.2",
"rimraf": "^3.0.2",
"rollup": "2.18.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/builder/package.json
Expand Up @@ -14,7 +14,7 @@
"@nuxt/webpack": "2.13.1",
"chalk": "^3.0.0",
"chokidar": "^3.4.0",
"consola": "^2.13.0",
"consola": "^2.14.0",
"fs-extra": "^8.1.0",
"glob": "^7.1.6",
"hash-sum": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Expand Up @@ -18,7 +18,7 @@
"chalk": "^3.0.0",
"compression": "^1.7.4",
"connect": "^3.7.0",
"consola": "^2.13.0",
"consola": "^2.14.0",
"esm": "^3.2.25",
"execa": "^3.4.0",
"exit": "^0.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/export.js
Expand Up @@ -34,7 +34,7 @@ export default {
}

const generator = await cmd.getGenerator(nuxt)
await nuxt.server.listen()
await nuxt.server.listen(0)

const { errors } = await generator.generate({
init: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/generate.js
Expand Up @@ -95,7 +95,7 @@ export default {
}

const generator = await cmd.getGenerator(nuxt)
await nuxt.server.listen()
await nuxt.server.listen(0)

const { errors } = await generator.generate({
init: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Expand Up @@ -11,7 +11,7 @@
],
"dependencies": {
"@nuxt/utils": "2.13.1",
"consola": "^2.13.0",
"consola": "^2.14.0",
"create-require": "^1.0.2",
"defu": "^2.0.4",
"destr": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Expand Up @@ -13,7 +13,7 @@
"@nuxt/server": "2.13.1",
"@nuxt/utils": "2.13.1",
"@nuxt/vue-renderer": "2.13.1",
"consola": "^2.13.0",
"consola": "^2.14.0",
"debug": "^4.1.1",
"esm": "^3.2.25",
"fs-extra": "^8.1.0",
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/module.js
Expand Up @@ -191,10 +191,16 @@ export default class ModuleContainer {
}

// Ensure module is required once
const key = (handler.meta && handler.meta.name) || src
const metaKey = handler.meta && handler.meta.name
const key = metaKey || src
if (typeof key === 'string') {
if (this.requiredModules[key]) {
return
if (!metaKey) {
// TODO: Skip with nuxt3
consola.warn('Modules should be only specified once:', key)
} else {
return
}
}
this.requiredModules[key] = { src, options, handler }
}
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/package.json
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@nuxt/utils": "2.13.1",
"chalk": "^3.0.0",
"consola": "^2.13.0",
"consola": "^2.14.0",
"fs-extra": "^8.1.0",
"html-minifier": "^4.0.0",
"node-html-parser": "^1.2.20"
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Expand Up @@ -15,7 +15,7 @@
"chalk": "^3.0.0",
"compression": "^1.7.4",
"connect": "^3.7.0",
"consola": "^2.13.0",
"consola": "^2.14.0",
"etag": "^1.8.1",
"fresh": "^0.5.2",
"fs-extra": "^8.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Expand Up @@ -23,7 +23,7 @@
"@types/pug": "^2.0.4",
"@types/serve-static": "^1.13.4",
"@types/terser-webpack-plugin": "^2.2.0",
"@types/webpack": "^4.41.17",
"@types/webpack": "^4.41.18",
"@types/webpack-bundle-analyzer": "^3.8.0",
"@types/webpack-dev-middleware": "^3.7.1",
"@types/webpack-hot-middleware": "^2.25.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Expand Up @@ -8,7 +8,7 @@
"dist"
],
"dependencies": {
"consola": "^2.13.0",
"consola": "^2.14.0",
"fs-extra": "^8.1.0",
"hash-sum": "^2.0.0",
"proper-lockfile": "^4.1.1",
Expand Down
7 changes: 3 additions & 4 deletions packages/utils/src/resolve.js
Expand Up @@ -18,10 +18,9 @@ export const wp = function wp (p = '') {
}

export const wChunk = function wChunk (p = '') {
if (isWindows) {
return p.replace(/\//g, '_')
}
return p
// workaround for SplitChunksPlugin that generate names starting from . for catchAll pages _.vue
// consider using https://webpack.js.org/configuration/output/#outputfilename for more robust control over filename generation
return p.replace('_', '[_]')
}

const reqSep = /\//g
Expand Down
15 changes: 10 additions & 5 deletions packages/utils/src/route.js
Expand Up @@ -13,14 +13,19 @@ export const flatRoutes = function flatRoutes (router, fileName = '', routes = [
if (fileName === '' && r.path === '/') {
routes.push('/')
}

return flatRoutes(r.children, fileName + r.path + '/', routes)
}
fileName = fileName.replace(/\/+/g, '/')
routes.push(
(r.path === '' && fileName[fileName.length - 1] === '/'
? fileName.slice(0, -1)
: fileName) + r.path
)

// if child path is already absolute, do not make any concatenations
if (r.path && r.path.startsWith('/')) {
routes.push(r.path)
} else if (r.path === '' && fileName[fileName.length - 1] === '/') {
routes.push(fileName.slice(0, -1) + r.path)
} else {
routes.push(fileName + r.path)
}
})
return routes
}
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/test/resolve.win.test.js
Expand Up @@ -12,7 +12,7 @@ describe.win('util: resolve windows', () => {
})

test('should format windows path', () => {
expect(wChunk('nuxt/layout/test')).toEqual('nuxt_layout_test')
expect(wChunk('nuxt/layout/test')).toEqual('nuxt/layout/test')
})

test('should resolve alias path', () => {
Expand Down
31 changes: 31 additions & 0 deletions packages/utils/test/route.test.js
Expand Up @@ -40,6 +40,37 @@ describe('util: route', () => {
expect(routes).toEqual(['/', '/foo/bar', '/foo/baz'])
})

test('should flat absolute routes', () => {
const routes = flatRoutes([
{
name: 'foo',
path: '/foo',
children: [
{ name: 'foo-bar', path: '/foo/bar' },
{ name: 'foo-baz', path: '/foo/baz' }
]
}
])

expect(routes).toEqual(['/foo/bar', '/foo/baz'])
})

test('should flat absolute routes with empty path', () => {
const routes = flatRoutes([
{
name: 'foo',
path: '/foo',
children: [
{ name: 'foo-root', path: '' },
{ name: 'foo-bar', path: '/foo/bar' },
{ name: 'foo-baz', path: '/foo/baz' }
]
}
])

expect(routes).toEqual(['/foo', '/foo/bar', '/foo/baz'])
})

describe('util: route guard', () => {
test('should guard parent dir', () => {
expect(() => {
Expand Down
17 changes: 2 additions & 15 deletions packages/vue-app/template/App.js
Expand Up @@ -41,25 +41,12 @@ export default {
render (h, props) {
<% if (loading) { %>const loadingEl = h('NuxtLoading', { ref: 'loading' })<% } %>
<% if (features.layouts) { %>
<% if (components.ErrorPage) { %>
if (this.nuxt.err && NuxtError) {
const errorLayout = (NuxtError.options || NuxtError).layout
if (errorLayout) {
this.setLayout(
typeof errorLayout === 'function'
? errorLayout.call(NuxtError, this.context)
: errorLayout
)
}
}
<% } %>
const layoutEl = h(this.layout || 'nuxt')
const templateEl = h('div', {
domProps: {
id: '__layout'
},

key: this.layoutName
key: this.layoutName
}, [layoutEl])
<% } else { %>
const templateEl = h('nuxt')
Expand Down Expand Up @@ -308,7 +295,7 @@ export default {
if (base && route.startsWith(base)) {
route = route.substr(base.length)
}
route = (route.replace(/\/+$/, '') || '/').split('?')[0]
route = (route.replace(/\/+$/, '') || '/').split('?')[0].split('#')[0]
const src = urlJoin(base, staticAssetsBase, route, 'payload.js')
try {
const payload = await window.__NUXT_IMPORT__(decodeURI(route), encodeURI(src))
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-renderer/package.json
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@nuxt/devalue": "^1.2.4",
"@nuxt/utils": "2.13.1",
"consola": "^2.13.0",
"consola": "^2.14.0",
"fs-extra": "^8.1.0",
"lru-cache": "^5.1.1",
"vue": "^2.6.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/package.json
Expand Up @@ -16,7 +16,7 @@
"cache-loader": "^4.1.0",
"caniuse-lite": "^1.0.30001088",
"chalk": "^3.0.0",
"consola": "^2.13.0",
"consola": "^2.14.0",
"css-loader": "^3.6.0",
"cssnano": "^4.1.10",
"eventsource-polyfill": "^0.9.6",
Expand Down
1 change: 1 addition & 0 deletions packages/webpack/src/builder.js
Expand Up @@ -176,6 +176,7 @@ export class WebpackBundler {
stats: false,
logLevel: 'silent',
watchOptions: this.buildContext.options.watchers.webpack,
fs: compiler.outputFileSystem,
...buildOptions.devMiddleware
})
)
Expand Down
3 changes: 1 addition & 2 deletions test/dev/extract-css.test.js
Expand Up @@ -5,7 +5,6 @@ import { loadFixture, getPort, Nuxt } from '../utils'

let nuxt = null
const readFile = promisify(fs.readFile)
const isWindows = process.platform.startsWith('win')

describe('extract css', () => {
beforeAll(async () => {
Expand All @@ -17,7 +16,7 @@ describe('extract css', () => {
})

test('Verify global.css has been extracted and minified', async () => {
const fileName = isWindows ? 'pages_index.css' : 'pages/index.css'
const fileName = 'pages/index.css'
const extractedIndexCss = resolve(__dirname, '..', 'fixtures/extract-css/.nuxt/dist/client', fileName)
const content = await readFile(extractedIndexCss, 'utf-8')

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/full-static/layouts/default.vue
Expand Up @@ -10,7 +10,7 @@
<NLink to="/pagination/1">
Pagination
</NLink>
<NLink to="/dynamic/foo bar">
<NLink to="/dynamic/foo bar#hash">
Dynamic route 1
</NLink>
<NLink to="/dynamic/foo%20bar">
Expand Down