mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 06:35:10 +00:00
Merge branch 'dev' into missing-chunk-reload
This commit is contained in:
commit
c4cfd08185
2
LICENSE
2
LICENSE
@ -5,6 +5,8 @@ Copyright (c) 2016-2018 Nuxt.js Team
|
||||
- Alexandre Chopin ([@alexchopin](https://github.com/alexchopin))
|
||||
- Pooya Parsa ([@pi0](https://github.com/pi0))
|
||||
- Clark Du ([@clarkdo](https://github.com/clarkdo))
|
||||
- Jonas Galvez ([@galvez](https://github.com/galvez))
|
||||
- Alexander Lichter ([@manniL](https://github.com/manniL))
|
||||
- All the amazing contributors (https://github.com/nuxt/nuxt.js/graphs/contributors)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -207,8 +207,8 @@ Note: we recommend putting `.nuxt` in `.npmignore` or `.gitignore`.
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||
<!-- prettier-ignore -->
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/904724?v=4" width="150px;"/><br /><sub><b>Sébastien Chopin</b></sub>](https://github.com/atinux)<br />[📝](#blog-Atinux "Blogposts") [🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3AAtinux "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=Atinux "Code") [🎨](#design-Atinux "Design") [📖](https://github.com/Atinux/Nuxt.js/commits?author=Atinux "Documentation") [💬](#question-Atinux "Answering Questions") [👀](#review-Atinux "Reviewed Pull Requests") [📢](#talk-Atinux "Talks") | [<img src="https://avatars2.githubusercontent.com/u/4084277?v=4" width="150px;"/><br /><sub><b>Alexandre Chopin</b></sub>](https://github.com/alexchopin)<br />[🎨](#design-alexchopin "Design") [📖](https://github.com/Atinux/Nuxt.js/commits?author=alexchopin "Documentation") [📋](#eventOrganizing-alexchopin "Event Organizing") [📦](#platform-alexchopin "Packaging/porting to new platform") [💬](#question-alexchopin "Answering Questions") [📢](#talk-alexchopin "Talks") | [<img src="https://avatars0.githubusercontent.com/u/5158436?v=4" width="150px;"/><br /><sub><b>Pooya Parsa</b></sub>](https://github.com/pi0)<br />[🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3Api0 "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=pi0 "Code") [🔌](#plugin-pi0 "Plugin/utility libraries") [💬](#question-pi0 "Answering Questions") [👀](#review-pi0 "Reviewed Pull Requests") [🔧](#tool-pi0 "Tools") | [<img src="https://avatars3.githubusercontent.com/u/4312154?v=4" width="150px;"/><br /><sub><b>Clark Du</b></sub>](https://github.com/clarkdo)<br />[🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3Aclarkdo "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=clarkdo "Code") [💡](#example-clarkdo "Examples") [👀](#review-clarkdo "Reviewed Pull Requests") [⚠️](https://github.com/Atinux/Nuxt.js/commits?author=clarkdo "Tests") [🔧](#tool-clarkdo "Tools") |
|
||||
| :---: | :---: | :---: | :---: |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/904724?v=4" width="150px;"/><br /><sub><b>Sébastien Chopin</b></sub>](https://github.com/atinux)<br />[📝](#blog-Atinux "Blogposts") [🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3AAtinux "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=Atinux "Code") [🎨](#design-Atinux "Design") [📖](https://github.com/Atinux/Nuxt.js/commits?author=Atinux "Documentation") [💬](#question-Atinux "Answering Questions") [👀](#review-Atinux "Reviewed Pull Requests") [📢](#talk-Atinux "Talks") | [<img src="https://avatars2.githubusercontent.com/u/4084277?v=4" width="150px;"/><br /><sub><b>Alexandre Chopin</b></sub>](https://github.com/alexchopin)<br />[🎨](#design-alexchopin "Design") [📖](https://github.com/Atinux/Nuxt.js/commits?author=alexchopin "Documentation") [📋](#eventOrganizing-alexchopin "Event Organizing") [📦](#platform-alexchopin "Packaging/porting to new platform") [💬](#question-alexchopin "Answering Questions") [📢](#talk-alexchopin "Talks") | [<img src="https://avatars0.githubusercontent.com/u/5158436?v=4" width="150px;"/><br /><sub><b>Pooya Parsa</b></sub>](https://github.com/pi0)<br />[🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3Api0 "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=pi0 "Code") [🔌](#plugin-pi0 "Plugin/utility libraries") [💬](#question-pi0 "Answering Questions") [👀](#review-pi0 "Reviewed Pull Requests") [🔧](#tool-pi0 "Tools") | [<img src="https://avatars3.githubusercontent.com/u/4312154?v=4" width="150px;"/><br /><sub><b>Clark Du</b></sub>](https://github.com/clarkdo)<br />[🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3Aclarkdo "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=clarkdo "Code") [💡](#example-clarkdo "Examples") [👀](#review-clarkdo "Reviewed Pull Requests") [⚠️](https://github.com/Atinux/Nuxt.js/commits?author=clarkdo "Tests") [🔧](#tool-clarkdo "Tools") | [<img src="https://avatars0.githubusercontent.com/u/640208?s=460&v=4" width="150px;"/><br /><sub><b>Alexander Lichter</b></sub>](https://github.com/manniL)<br />[💬](#question-manniL "Answering Questions") [🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3AmanniL "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=manniL "Code") [💡](#example-manniL "Examples") [👀](#review-manniL "Reviewed Pull Requests") [⚠️](https://github.com/Atinux/Nuxt.js/commits?author=manniL "Tests") | [<img src="https://avatars1.githubusercontent.com/u/12291?s=460&v=4" width="150px;"/><br /><sub><b>Jonas Galvez</b></sub>](https://github.com/galvez)<br />[💬](#question-galvez "Answering Questions") [🐛](https://github.com/Atinux/Nuxt.js/issues?q=author%3Agalvez "Bug reports") [💻](https://github.com/Atinux/Nuxt.js/commits?author=galvez "Code") [💡](#example-galvez "Examples") [👀](#review-galvez "Reviewed Pull Requests") [⚠️](https://github.com/Atinux/Nuxt.js/commits?author=galvez "Tests") |
|
||||
| :---: | :---: | :---: | :---: | :---: | :---: |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
## Contributors
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "example-hello-world",
|
||||
"dependencies": {
|
||||
"nuxt-edge": "latest"
|
||||
"nuxt": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
|
@ -175,7 +175,7 @@ function resolveComponents(router) {
|
||||
}
|
||||
|
||||
function callMiddleware (Components, context, layout) {
|
||||
let midd = <%= serialize(router.middleware, { isJSON: true }) %>
|
||||
let midd = <%= devalue(router.middleware) %>
|
||||
let unknownMiddleware = false
|
||||
|
||||
// If layout is undefined, only call global middleware
|
||||
|
@ -17,7 +17,7 @@ export default {
|
||||
percent: 0,
|
||||
show: false,
|
||||
canSuccess: true,
|
||||
throttle: 200,
|
||||
throttle: <%= loading.throttle %>,
|
||||
duration: <%= loading.duration %>,
|
||||
height: '<%= loading.height %>',
|
||||
color: '<%= loading.color %>',
|
||||
|
@ -8,6 +8,7 @@ import fsExtra from 'fs-extra'
|
||||
import hash from 'hash-sum'
|
||||
import webpack from 'webpack'
|
||||
import serialize from 'serialize-javascript'
|
||||
import devalue from 'devalue'
|
||||
import MFS from 'memory-fs'
|
||||
import webpackDevMiddleware from 'webpack-dev-middleware'
|
||||
import webpackHotMiddleware from 'webpack-hot-middleware'
|
||||
@ -398,6 +399,7 @@ export default class Builder {
|
||||
const template = _.template(fileContent, {
|
||||
imports: {
|
||||
serialize,
|
||||
devalue,
|
||||
hash,
|
||||
r,
|
||||
wp,
|
||||
|
@ -175,6 +175,7 @@ export default {
|
||||
color: 'black',
|
||||
failedColor: 'red',
|
||||
height: '2px',
|
||||
throttle: 200,
|
||||
duration: 5000,
|
||||
rtl: false
|
||||
},
|
||||
|
@ -21,6 +21,7 @@ export default function errorMiddleware(err, req, res, next) {
|
||||
res.statusMessage = err.name
|
||||
res.setHeader('Content-Type', type + '; charset=utf-8')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(content))
|
||||
res.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
|
||||
|
||||
// Send Response
|
||||
res.end(content, 'utf-8')
|
||||
|
@ -1,7 +1,7 @@
|
||||
import path from 'path'
|
||||
import crypto from 'crypto'
|
||||
|
||||
import serialize from 'serialize-javascript'
|
||||
import devalue from 'devalue'
|
||||
import serveStatic from 'serve-static'
|
||||
import _ from 'lodash'
|
||||
import fs from 'fs-extra'
|
||||
@ -361,9 +361,7 @@ export default class Renderer {
|
||||
|
||||
await this.nuxt.callHook('render:routeContext', context.nuxt)
|
||||
|
||||
const serializedSession = `window.__NUXT__=${serialize(context.nuxt, {
|
||||
isJSON: true
|
||||
})};`
|
||||
const serializedSession = `window.__NUXT__=${devalue(context.nuxt)};`
|
||||
|
||||
const cspScriptSrcHashSet = new Set()
|
||||
if (this.options.render.csp) {
|
||||
|
21
package.json
21
package.json
@ -14,6 +14,12 @@
|
||||
},
|
||||
{
|
||||
"name": "Clark Du (@clarkdo)"
|
||||
},
|
||||
{
|
||||
"name": "Jonas Galvez (@galvez)"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Lichter (@manniL}"
|
||||
}
|
||||
],
|
||||
"main": "index.js",
|
||||
@ -78,8 +84,9 @@
|
||||
"connect": "^3.6.5",
|
||||
"consola": "^1.4.3",
|
||||
"css-loader": "^1.0.0",
|
||||
"cssnano": "^4.0.5",
|
||||
"cssnano": "^4.1.4",
|
||||
"debug": "^4.0.1",
|
||||
"devalue": "^1.0.4",
|
||||
"esm": "^3.0.84",
|
||||
"etag": "^1.8.1",
|
||||
"file-loader": "^2.0.0",
|
||||
@ -117,15 +124,15 @@
|
||||
"url-loader": "^1.1.1",
|
||||
"vue": "^2.5.17",
|
||||
"vue-loader": "^15.4.2",
|
||||
"vue-meta": "^1.5.4",
|
||||
"vue-meta": "1.5.3",
|
||||
"vue-no-ssr": "^1.0.0",
|
||||
"vue-router": "^3.0.1",
|
||||
"vue-server-renderer": "^2.5.17",
|
||||
"vue-template-compiler": "^2.5.17",
|
||||
"vuex": "^3.0.1",
|
||||
"webpack": "^4.19.1",
|
||||
"webpack-bundle-analyzer": "^3.0.1",
|
||||
"webpack-dev-middleware": "^3.3.0",
|
||||
"webpack": "^4.20.2",
|
||||
"webpack-bundle-analyzer": "^3.0.2",
|
||||
"webpack-dev-middleware": "^3.4.0",
|
||||
"webpack-hot-middleware": "^2.24.2",
|
||||
"webpack-node-externals": "^1.7.2",
|
||||
"webpackbar": "^2.6.3"
|
||||
@ -133,9 +140,9 @@
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"babel-core": "^7.0.0-0",
|
||||
"babel-eslint": "^9.0.0",
|
||||
"babel-eslint": "^10.0.0",
|
||||
"babel-jest": "^23.6.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.0.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.1.0",
|
||||
"codecov": "^3.1.0",
|
||||
"cross-env": "^5.2.0",
|
||||
"cross-spawn": "^6.0.5",
|
||||
|
@ -20,6 +20,12 @@
|
||||
},
|
||||
{
|
||||
"name": "Clark Du (@clarkdo)"
|
||||
},
|
||||
{
|
||||
"name": "Jonas Galvez (@galvez)"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Lichter (@manniL}"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
@ -64,8 +70,9 @@
|
||||
"connect": "^3.6.5",
|
||||
"consola": "^1.4.3",
|
||||
"css-loader": "^1.0.0",
|
||||
"cssnano": "^4.0.5",
|
||||
"cssnano": "^4.1.4",
|
||||
"debug": "^4.0.1",
|
||||
"devalue": "^1.0.4",
|
||||
"esm": "^3.0.84",
|
||||
"etag": "^1.8.1",
|
||||
"file-loader": "^2.0.0",
|
||||
@ -103,15 +110,15 @@
|
||||
"url-loader": "^1.1.1",
|
||||
"vue": "^2.5.17",
|
||||
"vue-loader": "^15.4.2",
|
||||
"vue-meta": "^1.5.3",
|
||||
"vue-meta": "^1.5.4",
|
||||
"vue-no-ssr": "^1.0.0",
|
||||
"vue-router": "^3.0.1",
|
||||
"vue-server-renderer": "^2.5.17",
|
||||
"vue-template-compiler": "^2.5.17",
|
||||
"vuex": "^3.0.1",
|
||||
"webpack": "^4.19.1",
|
||||
"webpack-bundle-analyzer": "^3.0.1",
|
||||
"webpack-dev-middleware": "^3.3.0",
|
||||
"webpack": "^4.20.2",
|
||||
"webpack-bundle-analyzer": "^3.0.2",
|
||||
"webpack-dev-middleware": "^3.4.0",
|
||||
"webpack-hot-middleware": "^2.24.2",
|
||||
"webpack-node-externals": "^1.7.2",
|
||||
"webpackbar": "^2.6.3"
|
||||
|
@ -20,6 +20,12 @@
|
||||
},
|
||||
{
|
||||
"name": "Clark Du (@clarkdo)"
|
||||
},
|
||||
{
|
||||
"name": "Jonas Galvez (@galvez)"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Lichter (@manniL}"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
@ -54,6 +60,7 @@
|
||||
"compression": "^1.7.3",
|
||||
"connect": "^3.6.5",
|
||||
"consola": "^1.4.3",
|
||||
"devalue": "^1.0.4",
|
||||
"esm": "^3.0.84",
|
||||
"etag": "^1.8.1",
|
||||
"fresh": "^0.5.2",
|
||||
@ -64,7 +71,6 @@
|
||||
"lodash": "^4.17.11",
|
||||
"lru-cache": "^4.1.3",
|
||||
"minimist": "^1.2.0",
|
||||
"serialize-javascript": "^1.5.0",
|
||||
"serve-static": "^1.13.2",
|
||||
"server-destroy": "^1.0.1",
|
||||
"std-env": "^1.3.1",
|
||||
|
5
renovate.json
Normal file
5
renovate.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": [
|
||||
"@nuxtjs"
|
||||
]
|
||||
}
|
3
test/fixtures/ssr/store/index.js
vendored
3
test/fixtures/ssr/store/index.js
vendored
@ -3,7 +3,8 @@ import { nextId } from '@/lib/db'
|
||||
export const state = () => {
|
||||
return {
|
||||
id: nextId(),
|
||||
id2: 0
|
||||
id2: 0,
|
||||
idUndefined: undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ describe('basic ssr', () => {
|
||||
|
||||
test('/meta', async () => {
|
||||
const { html } = await nuxt.renderRoute('/meta')
|
||||
expect(html.includes('"meta":[{"works":true}]')).toBe(true)
|
||||
expect(/<pre>.*"works": true.*<\/pre>/s.test(html)).toBe(true)
|
||||
})
|
||||
|
||||
test('/fn-midd', async () => {
|
||||
|
@ -5,8 +5,9 @@ import { promisify } from 'util'
|
||||
const readFile = promisify(fs.readFile)
|
||||
|
||||
describe('extract css', () => {
|
||||
// TODO: make css chunk name predictive
|
||||
test('Verify global.css has been extracted and minified', async () => {
|
||||
const pathToMinifiedGlobalCss = resolve(__dirname, '..', 'fixtures/extract-css/.nuxt/dist/client/09b0b6942acf2c3ab923.css')
|
||||
const pathToMinifiedGlobalCss = resolve(__dirname, '..', 'fixtures/extract-css/.nuxt/dist/client/7dc53e76acc7df734a24.css')
|
||||
const content = await readFile(pathToMinifiedGlobalCss, 'utf-8')
|
||||
const expectedContent = 'h1[data-v-180e2718]{color:red}.container[data-v-180e2718]{-ms-grid-columns:60px 60px 60px 60px 60px;-ms-grid-rows:30px 30px;display:-ms-grid;display:grid;grid-auto-flow:row;grid-template-columns:60px 60px 60px 60px 60px;grid-template-rows:30px 30px}'
|
||||
expect(content).toBe(expectedContent)
|
||||
|
@ -97,6 +97,12 @@ describe('ssr', () => {
|
||||
await uniqueTest('/fetch')
|
||||
})
|
||||
|
||||
test('store undefined variable response', async () => {
|
||||
const window = await nuxt.renderAndGetWindow(url('/store'))
|
||||
expect('idUndefined' in window.__NUXT__.state).toBe(true)
|
||||
expect(window.__NUXT__.state.idUndefined).toEqual(undefined)
|
||||
})
|
||||
|
||||
test('stress test with asyncData', async () => {
|
||||
await stressTest('/asyncData')
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user