Merge branch 'dev' of github.com:nuxt/nuxt.js into dev

This commit is contained in:
Sebastien Chopin 2017-08-21 10:24:00 +02:00
commit 8f3c69569e
23 changed files with 459 additions and 174 deletions

View File

@ -15,10 +15,11 @@ const argv = parseArgs(process.argv.slice(2), {
h: 'help',
c: 'config-file',
a: 'analyze',
m: 'mode'
s: 'spa',
u: 'universal'
},
boolean: ['h', 'a'],
string: ['c', 'm'],
boolean: ['h', 'a', 's', 'u'],
string: ['c'],
default: {
c: 'nuxt.config.js'
}
@ -31,10 +32,11 @@ if (argv.help) {
Usage
$ nuxt build <dir>
Options
--analyze, -a Launch webpack-bundle-analyzer to optimize your bundles.
--mode, -m [spa|universal|ssr-only] Nuxt Mode (default: universal)
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
--analyze, -a Launch webpack-bundle-analyzer to optimize your bundles.
--spa Launch in SPA mode
--universal Launch in Universal mode (default)
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
`)
process.exit(0)
}
@ -56,9 +58,7 @@ if (typeof options.rootDir !== 'string') {
options.dev = false
// Nuxt Mode
if (argv['mode']) {
options.mode = argv['mode']
}
options.mode = (argv['spa'] && 'spa') || (argv['universal'] && 'universal') || options.mode
// Analyze option
options.build = options.build || {}
@ -89,4 +89,3 @@ if (options.mode !== 'spa') {
}
})
}

View File

@ -18,10 +18,11 @@ const argv = parseArgs(process.argv.slice(2), {
H: 'hostname',
p: 'port',
c: 'config-file',
m: 'mode'
s: 'spa',
u: 'universal'
},
boolean: ['h'],
string: ['H', 'c', 'm'],
boolean: ['h', 's', 'u'],
string: ['H', 'c'],
default: {
c: 'nuxt.config.js'
}
@ -40,11 +41,12 @@ if (argv.help) {
Usage
$ nuxt dev <dir> -p <port number> -H <hostname>
Options
--port, -p A port number on which to start the application
--hostname, -H Hostname on which to start the application
--mode, -m [spa|universal|ssr-only] Nuxt Mode (default: universal)
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
--port, -p A port number on which to start the application
--hostname, -H Hostname on which to start the application
--spa Launch in SPA mode
--universal Launch in Universal mode (default)
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
`)
process.exit(0)
}
@ -112,9 +114,7 @@ function loadNuxtConfig () {
options.dev = true
// Nuxt Mode
if (argv['mode']) {
options.mode = argv['mode']
}
options.mode = (argv['spa'] && 'spa') || (argv['universal'] && 'universal') || options.mode
return options
}

View File

@ -14,10 +14,11 @@ const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help',
c: 'config-file',
m: 'mode'
s: 'spa',
u: 'universal'
},
boolean: ['h'],
string: ['c', 'm'],
boolean: ['h', 's', 'u'],
string: ['c'],
default: {
c: 'nuxt.config.js'
}
@ -30,9 +31,11 @@ if (argv.help) {
Usage
$ nuxt generate <dir>
Options
--mode, -m [spa|universal|ssr-only] Nuxt Mode (default: universal)
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
--spa Launch in SPA mode
--spa Launch in SPA mode
--universal Launch in Universal mode (default)
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
`)
process.exit(0)
}
@ -53,9 +56,7 @@ if (typeof options.rootDir !== 'string') {
options.dev = false // Force production mode (no webpack middleware called)
// Nuxt Mode
if (argv['mode']) {
options.mode = argv['mode']
}
options.mode = (argv['spa'] && 'spa') || (argv['universal'] && 'universal') || options.mode
debug('Generating...')
const nuxt = new Nuxt(options)

View File

@ -11,10 +11,11 @@ const argv = parseArgs(process.argv.slice(2), {
H: 'hostname',
p: 'port',
c: 'config-file',
m: 'mode'
s: 'spa',
u: 'universal'
},
boolean: ['h'],
string: ['H', 'c', 'm'],
boolean: ['h', 's', 'u'],
string: ['H', 'c'],
default: {
c: 'nuxt.config.js'
}
@ -33,11 +34,12 @@ if (argv.help) {
Usage
$ nuxt start <dir> -p <port number> -H <hostname>
Options
--port, -p A port number on which to start the application
--hostname, -H Hostname on which to start the application
--mode, -m [spa|universal|ssr-only] Nuxt Mode (default: universal)
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
--port, -p A port number on which to start the application
--hostname, -H Hostname on which to start the application
--spa Launch in SPA mode
--universal Launch in Universal mode (default)
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
`)
process.exit(0)
}
@ -62,18 +64,28 @@ if (typeof options.rootDir !== 'string') {
options.dev = false
// Nuxt Mode
if (argv['mode']) {
options.mode = argv['mode']
}
options.mode = (argv['spa'] && 'spa') || (argv['universal'] && 'universal') || options.mode
const nuxt = new Nuxt(options)
// Check if project is built for production
const distDir = join(options.rootDir, options.buildDir || '.nuxt', 'dist')
const distDir = resolve(nuxt.options.rootDir, nuxt.options.buildDir || '.nuxt', 'dist')
if (!fs.existsSync(distDir)) {
console.error('> No build files found, please run `nuxt build` before launching `nuxt start`') // eslint-disable-line no-console
process.exit(1)
}
const nuxt = new Nuxt(options)
// Check if SSR Bundle is required
if (nuxt.options.render.ssr === true) {
const ssrBundlePath = resolve(distDir, 'server-bundle.json')
if (!fs.existsSync(ssrBundlePath)) {
// eslint-disable-next-line no-console
console.error('> No SSR build! Please start with `nuxt start --spa` or build using `nuxt build --universal`')
process.exit(1)
}
}
const port = argv.port || process.env.PORT || process.env.npm_package_config_nuxt_port
const host = argv.hostname || process.env.HOST || process.env.npm_package_config_nuxt_host
nuxt.listen(port, host)

View File

@ -28,14 +28,15 @@ let router
const NUXT = window.__NUXT__ || {}
NUXT.components = window.__COMPONENTS__ || null
<% if (debug) { %>
<% if (debug || mode === 'spa') { %>
// Setup global Vue error handler
const defaultErrorHandler = Vue.config.errorHandler
Vue.config.errorHandler = function (err, vm, info) {
err.statusCode = err.statusCode || 'Whoops!'
err.statusCode = err.statusCode || err.name || 'Whoops!'
err.message = err.message || err.toString()
// Show Nuxt Error Page
if(vm && vm.$root && vm.$root.$nuxt) {
if(vm && vm.$root && vm.$root.$nuxt && vm.$root.$nuxt.error && info !== 'render function') {
vm.$root.$nuxt.error(err)
}
@ -44,11 +45,12 @@ Vue.config.errorHandler = function (err, vm, info) {
return defaultErrorHandler(...arguments)
}
// Log to console (default vue behavior)
// Log to console
if (process.env.NODE_ENV !== 'production') {
console.warn(('Error in ' + info + ': "' + err.toString() + '"'), vm);
console.error(err)
} else {
console.error(err.message)
}
console.error(err);
}
<% } %>

View File

@ -5,13 +5,15 @@
<div class="row">
<div class="column">
<h1>{{ statusCode }} </h1>
<h4> {{ message }} </h4>
<% if(debug) { %>
<pre class="error-box" v-if="mounted"><code>Route: {{ $route.fullPath }}<br>Query: {{ $route.query }}<br>Params: {{$route.params}}<br>{{ error.stack }}</code></pre>
<% } %>
<h3> {{ message }} </h3>
<p v-if="statusCode === 404">
<nuxt-link class="error-link" to="/">Back to the home page</nuxt-link>
</p>
<% if(debug) { %>
<small v-else>
Open developer tools to view stack trace
</small>
<% } %>
</div>
</div>
@ -55,7 +57,7 @@ export default {
return (this.error && this.error.statusCode) || 500
},
message () {
return (this.error && this.error.message) || 'Nuxt Server Error'
return this.error.message || 'Nuxt Server Error'
}
}
}
@ -81,13 +83,6 @@ export default {
margin: 0 auto;
max-width: 70%;
}
<% if(debug) { %>
.__nuxt-error-page .error-box {
box-shadow: 0px 0px 9px #d3d3d3;
padding: 10px;
text-align: left;
}
<% } %>
.__nuxt-error-page .poweredby {
text-align: center;
margin-top: 10%;
@ -95,11 +90,4 @@ export default {
.__nuxt-error-page a {
color: #42b983 !important;
}
.__nuxt-error-page pre {
border-color: #42b983 !important;
background-color: white;
}
.__nuxt-error-page pre code {
background-color: white;
}
</style>

View File

@ -43,9 +43,6 @@
.__nuxt-error-page a {
color: #42b983 !important;
}
.__nuxt-error-page pre {
border-color: #42b983 !important;
}
</style>
</head>
<body>

View File

@ -178,6 +178,7 @@ export default class Builder extends Tapable {
uniqBy: _.uniqBy,
isDev: this.options.dev,
debug: this.options.debug,
mode: this.options.mode,
router: this.options.router,
env: this.options.env,
head: this.options.head,

View File

@ -73,6 +73,13 @@ export default class Generator extends Tapable {
}))
}
// Copy /index.html to /200.html for surge SPA
// https://surge.sh/help/adding-a-200-page-for-client-side-routing
const _200Path = join(this.distPath, '200.html')
if (!existsSync(_200Path)) {
await copy(join(this.distPath, 'index.html'), _200Path)
}
const duration = Math.round((Date.now() - s) / 100) / 10
debug(`HTML Files generated in ${duration}s`)

View File

@ -18,7 +18,7 @@ export default function webpackBaseConfig ({ isClient, isServer }) {
const config = {
devtool: this.options.dev ? 'cheap-module-source-map' : 'nosources-source-map',
entry: {
vendor: ['vue', 'vue-router', 'vue-meta']
app: null
},
output: {
path: resolve(this.options.buildDir, 'dist'),

View File

@ -5,9 +5,9 @@ import HTMLPlugin from 'html-webpack-plugin'
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'
import ProgressBarPlugin from 'progress-bar-webpack-plugin'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import MinifyPlugin from 'babel-minify-webpack-plugin'
import { resolve } from 'path'
import base from './base.config.js'
import ScriptExtHtmlWebpackPlugin from 'script-ext-html-webpack-plugin'
/*
|--------------------------------------------------------------------------
@ -24,20 +24,28 @@ export default function webpackClientConfig () {
config.name = 'client'
// Entry
// App entry
config.entry.app = resolve(this.options.buildDir, 'client.js')
// Add vendors
if (this.options.store) {
config.entry.vendor.push('vuex')
}
config.entry.vendor = config.entry.vendor.concat(this.options.build.vendor)
// This vendors should explicitly extracted
// Even if not used in 50% of the chunks!
const vendor = [
'vue',
'vue-router',
'vue-meta',
'core-js',
'regenerator-runtime',
'es6-promise',
'babel-runtime',
'vuex'
].concat(this.options.build.vendor).filter(v => v)
// Extract vendor chunks for better caching
const _this = this
config.plugins.push(
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
name: 'common',
filename: this.options.build.filenames.vendor,
minChunks (module, count) {
// In the dev we use on-demand-entries.
@ -47,6 +55,11 @@ export default function webpackClientConfig () {
return false
}
// Extract all explicit vendor modules
if (module.context && vendor.some(v => module.context.includes(v))) {
return true
}
// Total pages
const totalPages = _this.routes ? _this.routes.length : 0
@ -85,22 +98,6 @@ export default function webpackClientConfig () {
})
)
// Resource hints for SPA
config.plugins.push(
new ScriptExtHtmlWebpackPlugin({
preload: [
'app',
'vendor',
'common',
'manifest'
],
prefetch: {
test: /\.js$/,
chunks: 'async'
}
})
)
// Generate output HTML for SSR
if (this.options.build.ssr) {
config.plugins.push(
@ -175,9 +172,17 @@ export default function webpackClientConfig () {
config.plugins.push(new webpack.HashedModuleIdsPlugin())
// Minify JS
// https://github.com/webpack-contrib/babel-minify-webpack-plugin
config.plugins.push(new MinifyPlugin())
// https://github.com/webpack-contrib/uglifyjs-webpack-plugin
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
extractComments: {
filename: 'LICENSES'
},
compress: {
warnings: false
}

View File

@ -8,7 +8,7 @@ export default function styleLoader (ext, loaders = [], isVueLoader = false) {
return {
loader,
options: {
sourceMap: true // Source map is REQUIRED for urlLoader
sourceMap: this.options.build.cssSourceMap
}
}
}
@ -52,18 +52,12 @@ export default function styleLoader (ext, loaders = [], isVueLoader = false) {
}
}
// https://github.com/bholloway/resolve-url-loader
const urlLoader = {
loader: 'resolve-url-loader'
}
if (this.options.build.extractCSS && !isVueLoader && !this.options.dev) {
if (this.options.build.extractCSS && !this.options.dev) {
return ExtractTextPlugin.extract({
fallback: vueStyleLoader,
use: [
cssLoader,
postcssLoader,
urlLoader,
...loaders
].filter(l => l)
})
@ -73,7 +67,6 @@ export default function styleLoader (ext, loaders = [], isVueLoader = false) {
vueStyleLoader,
cssLoader,
postcssLoader,
urlLoader,
...loaders
].filter(l => l)
}

View File

@ -64,6 +64,11 @@ Options.from = function (_options) {
background: 'white'
}, options.loadingIndicator)
// cssSourceMap
if (options.build.cssSourceMap === undefined) {
options.build.cssSourceMap = options.dev
}
// Postcss
// 1. Check if it is explicitly disabled by false value
// ... Disable all postcss loaders
@ -121,17 +126,9 @@ Options.from = function (_options) {
options.debug = options.dev
}
// Resolve mode
let mode = options.mode
if (typeof mode === 'function') {
mode = mode()
}
if (typeof mode === 'string') {
mode = Options.modes[mode]
}
// Apply mode
_.defaultsDeep(options, mode)
// Apply mode preset
let modePreset = Options.modes[options.mode || 'universal'] || Options.modes['universal']
_.defaultsDeep(options, modePreset)
// If no server-side rendering, add appear true transition
if (options.render.ssr === false) {
@ -157,14 +154,6 @@ Options.modes = {
render: {
ssr: false
}
},
static: {
build: {
ssr: true
},
render: {
ssr: 'only'
}
}
}
@ -177,7 +166,7 @@ Options.defaults = {
build: {
analyze: false,
extractCSS: false,
cssSourceMap: true,
cssSourceMap: undefined,
ssr: undefined,
publicPath: '/_nuxt/',
filenames: {

View File

@ -151,6 +151,24 @@ export function flatRoutes (router, path = '', routes = []) {
return routes
}
export function attrsStr (attrObj = {}, exclude = []) {
return Object.keys(attrObj)
.filter(attr => !exclude.includes(attr))
.map(attr => {
if (typeof attrObj[attr] !== 'string') {
return attr
}
const val = attrObj[attr].replace('"', '\'')
if (attr === 'hid') {
attr = 'data-hid'
}
return `${attr}="${val}"`
}).join(' ')
}
export function cleanChildrenRoutes (routes, isChild = false) {
let start = -1
let routesIndex = []

74
lib/core/meta.js Normal file
View File

@ -0,0 +1,74 @@
import { attrsStr } from 'utils'
import LRU from 'lru-cache'
export default class MetaRenderer {
constructor (nuxt, renderer) {
this.nuxt = nuxt
this.renderer = renderer
this.options = nuxt.options
this.cache = LRU({})
}
render ({ url = '/' }) {
let head = this.cache.get(url)
if (head) {
return head
}
head = ''
// Title
if (typeof this.options.head.title === 'string') {
head += `<title data-n-head="true">${this.options.head.title || ''}</title>`
}
// Meta
if (Array.isArray(this.options.head.meta)) {
this.options.head.meta.forEach(meta => {
head += `<meta data-n-head="true" ${attrsStr(meta)}/>`
})
}
// Links
if (Array.isArray(this.options.head.link)) {
this.options.head.link.forEach(link => {
head += `<link data-n-head="true" ${attrsStr(link)}/>`
})
}
// Style
if (Array.isArray(this.options.head.style)) {
this.options.head.style.forEach(style => {
head += `<style data-n-head="true" ${attrsStr(style, ['cssText'])}>${style.cssText || ''}</style>`
})
}
// Script
if (Array.isArray(this.options.head.script)) {
this.options.head.script.forEach(script => {
head += `<script data-n-head="true" ${attrsStr(script, ['innerHTML'])}>${script.innerHTML || ''}</script>`
})
}
// Resource Hints
const clientManifest = this.renderer.resources.clientManifest
if (this.options.render.resourceHints && clientManifest) {
const publicPath = clientManifest.publicPath || '/_nuxt/'
// Pre-Load initial resources
if (Array.isArray(clientManifest.initial)) {
head += clientManifest.initial.map(r => `<link rel="preload" href="${publicPath}${r}" as="script" />`).join('')
}
// Pre-Fetch async resources
if (Array.isArray(clientManifest.async)) {
head += clientManifest.async.map(r => `<link rel="prefetch" href="${publicPath}${r}" />`).join('')
}
}
this.cache.set(url, head)
return head
}
}

View File

@ -32,6 +32,9 @@ export default class Nuxt extends Tapable {
this.renderRoute = this.renderer.renderRoute.bind(this.renderer)
this.renderAndGetWindow = this.renderer.renderAndGetWindow.bind(this.renderer)
// Default Show Open if Nuxt is not listening
this.showOpen = () => {}
this._ready = this.ready().catch(this.errorHandler)
}
@ -49,6 +52,13 @@ export default class Nuxt extends Tapable {
}
listen (port = 3000, host = 'localhost') {
// Update showOpen
this.showOpen = () => {
const _host = host === '0.0.0.0' ? 'localhost' : host
// eslint-disable-next-line no-console
console.log('\n' + chalk.bgGreen.black(' OPEN ') + chalk.green(` http://${_host}:${port}\n`))
}
return new Promise((resolve, reject) => {
const server = this.renderer.app.listen({ port, host, exclusive: false }, err => {
/* istanbul ignore if */
@ -56,11 +66,6 @@ export default class Nuxt extends Tapable {
return reject(err)
}
// Show Open URL
let _host = host === '0.0.0.0' ? 'localhost' : host
// eslint-disable-next-line no-console
console.log('\n' + chalk.bold(chalk.bgGreen.white(' OPEN ') + chalk.green(` http://${_host}:${port}\n`)))
// Close server on nuxt close
this.plugin('close', () => new Promise((resolve, reject) => {
// Destroy server by forcing every connection to be closed

View File

@ -10,12 +10,13 @@ import _ from 'lodash'
import { join, resolve } from 'path'
import fs from 'fs-extra'
import { createBundleRenderer } from 'vue-server-renderer'
import { getContext, setAnsiColors, isUrl } from 'utils'
import { getContext, setAnsiColors, isUrl, attrsStr } from 'utils'
import Debug from 'debug'
import Youch from '@nuxtjs/youch'
import { SourceMapConsumer } from 'source-map'
import connect from 'connect'
import { Options } from 'common'
import MetaRenderer from './meta'
const debug = Debug('nuxt:render')
debug.color = 4 // Force blue color
@ -32,6 +33,7 @@ export default class Renderer extends Tapable {
// Will be set by createRenderer
this.bundleRenderer = null
this.metaRenderer = null
// Will be available on dev
this.webpackDevMiddleware = null
@ -116,25 +118,43 @@ export default class Renderer extends Tapable {
return this.options.render.ssr === false
}
get onlySSR () {
return this.options.render.ssr === 'only'
}
get isReady () {
if (this.noSSR) {
return this.resources.spaTemplate
return Boolean(this.resources.spaTemplate)
}
return this.bundleRenderer && this.resources.ssrTemplate
return Boolean(this.bundleRenderer && this.resources.ssrTemplate)
}
get isResourcesAvailable () {
// Required for both
if (!this.resources.clientManifest) {
return false
}
// Required for SPA rendering
if (this.noSSR) {
return Boolean(this.resources.spaTemplate)
}
// Required for bundle renderer
return Boolean(this.resources.ssrTemplate && this.resources.serverBundle)
}
createRenderer () {
// Skip if SSR is disabled
if (this.noSSR) {
// Ensure resources are available
if (!this.isResourcesAvailable) {
return
}
// If resources are not yet provided
if (!this.resources.serverBundle || !this.resources.clientManifest) {
// Create Meta Renderer
this.metaRenderer = new MetaRenderer(this.nuxt, this)
// Show Open URL
this.nuxt.showOpen()
// Skip following steps if noSSR mode
if (this.noSSR) {
return
}
@ -335,16 +355,17 @@ export default class Renderer extends Tapable {
async readSource (frame) {
const serverBundle = this.resources.serverBundle
// Initialize smc cache
if (!serverBundle.$maps) {
serverBundle.$maps = {}
}
// Remove webpack:/// & query string from the end
const sanitizeName = name => name ? name.replace('webpack:///', '').split('?')[0] : ''
// SourceMap Support for SSR Bundle
if (serverBundle && serverBundle.maps[frame.fileName]) {
// Initialize smc cache
if (!serverBundle.$maps) {
serverBundle.$maps = {}
}
// Read SourceMap object
const smc = serverBundle.$maps[frame.fileName] || new SourceMapConsumer(serverBundle.maps[frame.fileName])
serverBundle.$maps[frame.fileName] = smc
@ -423,17 +444,17 @@ export default class Renderer extends Tapable {
context.isServer = true
// Basic response if SSR is disabled or spa data provided
const SPAData = context.spa || (context.res && context.res.spa)
if (this.noSSR || SPAData) {
const data = {
HTML_ATTRS: '',
BODY_ATTRS: '',
HEAD: '',
APP: `<div id="__nuxt">${this.resources.loadingHTML}</div>`
}
const spa = context.spa || (context.res && context.res.spa)
if (this.noSSR || spa) {
const HEAD = this.metaRenderer.render(context)
const HTML_ATTRS = attrsStr(this.options.head.htmlAttrs)
const APP = `<div id="__nuxt">${this.resources.loadingHTML}</div>`
if (SPAData) {
Object.assign(data, SPAData)
const data = {
HTML_ATTRS,
BODY_ATTRS: '',
HEAD,
APP
}
const html = this.resources.spaTemplate(data)
@ -455,14 +476,12 @@ export default class Renderer extends Tapable {
let resourceHints = ''
if (!this.onlySSR) {
if (this.options.render.resourceHints) {
resourceHints = context.renderResourceHints()
HEAD += resourceHints
}
APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })};</script>`
APP += context.renderScripts()
if (this.options.render.resourceHints) {
resourceHints = context.renderResourceHints()
HEAD += resourceHints
}
APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })};</script>`
APP += context.renderScripts()
HEAD += context.renderStyles()

View File

@ -71,6 +71,7 @@
"autoprefixer": "^7.1.2",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.1",
"babel-minify-webpack-plugin": "^0.2.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-vue-app": "^1.2.1",
"chalk": "^2.1.0",
@ -92,6 +93,7 @@
"html-minifier": "^3.5.3",
"html-webpack-plugin": "^2.30.1",
"lodash": "^4.17.4",
"lru-cache": "^4.1.1",
"memory-fs": "^0.4.1",
"minimist": "^1.2.0",
"opencollective": "^1.0.3",
@ -103,8 +105,6 @@
"postcss-url": "^7.1.2",
"pretty-error": "^2.1.1",
"progress-bar-webpack-plugin": "^1.10.0",
"resolve-url-loader": "^2.1.0",
"script-ext-html-webpack-plugin": "^1.8.5",
"serialize-javascript": "^1.4.0",
"serve-static": "^1.12.4",
"server-destroy": "^1.0.1",

View File

@ -63,7 +63,7 @@
"compression": "^1.7.0",
"fs-extra": "^4.0.1",
"vue-server-renderer": "~2.4.2",
"@nuxtjs/youch": "3.0.1",
"@nuxtjs/youch": "3.0.2",
"source-map": "^0.5.6",
"connect": "^3.6.3",
"server-destroy": "^1.0.1"

View File

@ -87,7 +87,7 @@ test('/test/about-bis (added with extendRoutes)', async t => {
test('Check stats.json generated by build.analyze', t => {
const stats = require(resolve(__dirname, 'fixtures/with-config/.nuxt/dist/stats.json'))
t.is(stats.assets.length, 27)
t.is(stats.assets.length, 28)
})
test('Check /test.txt with custom serve-static options', async t => {

189
yarn.lock
View File

@ -464,7 +464,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
esutils "^2.0.2"
js-tokens "^3.0.2"
babel-core@^6.17.0, babel-core@^6.26.0:
babel-core@^6.17.0, babel-core@^6.24.1, babel-core@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.0.tgz#af32f78b31a6fcef119c87b0fd8d9753f03a0bb8"
dependencies:
@ -544,6 +544,10 @@ babel-helper-define-map@^6.24.1:
babel-types "^6.26.0"
lodash "^4.17.4"
babel-helper-evaluate-path@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.2.0.tgz#0bb2eb01996c0cef53c5e8405e999fe4a0244c08"
babel-helper-explode-assignable-expression@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz#f25b82cf7dc10433c55f70592d5746400ac22caa"
@ -561,6 +565,10 @@ babel-helper-explode-class@^6.24.1:
babel-traverse "^6.24.1"
babel-types "^6.24.1"
babel-helper-flip-expressions@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.2.0.tgz#160d2090a3d9f9c64a750905321a0bc218f884ec"
babel-helper-function-name@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9"
@ -585,6 +593,18 @@ babel-helper-hoist-variables@^6.24.1:
babel-runtime "^6.22.0"
babel-types "^6.24.1"
babel-helper-is-nodes-equiv@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/babel-helper-is-nodes-equiv/-/babel-helper-is-nodes-equiv-0.0.1.tgz#34e9b300b1479ddd98ec77ea0bbe9342dfe39684"
babel-helper-is-void-0@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-helper-is-void-0/-/babel-helper-is-void-0-0.2.0.tgz#6ed0ada8a9b1c5b6e88af6b47c1b3b5c080860eb"
babel-helper-mark-eval-scopes@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.2.0.tgz#7648aaf2ec92aae9b09a20ad91e8df5e1fcc94b2"
babel-helper-optimise-call-expression@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz#f7a13427ba9f73f8f4fa993c54a97882d1244257"
@ -610,6 +630,10 @@ babel-helper-remap-async-to-generator@^6.24.1:
babel-traverse "^6.24.1"
babel-types "^6.24.1"
babel-helper-remove-or-void@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.2.0.tgz#8e46ad5b30560d57d7510b3fd93f332ee7c67386"
babel-helper-replace-supers@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz#bf6dbfe43938d17369a213ca8a8bf74b6a90ab1a"
@ -621,6 +645,10 @@ babel-helper-replace-supers@^6.24.1:
babel-traverse "^6.24.1"
babel-types "^6.24.1"
babel-helper-to-multiple-sequence-expressions@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.2.0.tgz#d1a419634c6cb301f27858c659167cfee0a9d318"
babel-helper-vue-jsx-merge-props@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.2.tgz#aceb1c373588279e2755ea1cfd35c22394fd33f8"
@ -646,6 +674,14 @@ babel-messages@^6.23.0:
dependencies:
babel-runtime "^6.22.0"
babel-minify-webpack-plugin@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-minify-webpack-plugin/-/babel-minify-webpack-plugin-0.2.0.tgz#ef9694d11a1b8ab8f3204d89f5c9278dd28fc2a9"
dependencies:
babel-core "^6.24.1"
babel-preset-minify "^0.2.0"
webpack-sources "^1.0.1"
babel-plugin-array-includes@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/babel-plugin-array-includes/-/babel-plugin-array-includes-2.0.3.tgz#cf5452e81c7b803fb7959f1045ac88e2ec28ff76"
@ -682,6 +718,71 @@ babel-plugin-istanbul@^4.1.4:
istanbul-lib-instrument "^1.7.2"
test-exclude "^4.1.1"
babel-plugin-minify-builtins@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.2.0.tgz#317f824b0907210b6348671bb040ca072e2e0c82"
dependencies:
babel-helper-evaluate-path "^0.2.0"
babel-plugin-minify-constant-folding@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.2.0.tgz#8c70b528b2eb7c13e94d95c8789077d4cdbc3970"
dependencies:
babel-helper-evaluate-path "^0.2.0"
babel-plugin-minify-dead-code-elimination@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.2.0.tgz#e8025ee10a1e5e4f202633a6928ce892c33747e3"
dependencies:
babel-helper-evaluate-path "^0.2.0"
babel-helper-mark-eval-scopes "^0.2.0"
babel-helper-remove-or-void "^0.2.0"
lodash.some "^4.6.0"
babel-plugin-minify-flip-comparisons@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.2.0.tgz#0c9c8e93155c8f09dedad8118b634c259f709ef5"
dependencies:
babel-helper-is-void-0 "^0.2.0"
babel-plugin-minify-guarded-expressions@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.2.0.tgz#8a8c950040fce3e258a12e6eb21eab94ad7235ab"
dependencies:
babel-helper-flip-expressions "^0.2.0"
babel-plugin-minify-infinity@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.2.0.tgz#30960c615ddbc657c045bb00a1d8eb4af257cf03"
babel-plugin-minify-mangle-names@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.2.0.tgz#719892297ff0106a6ec1a4b0fc062f1f8b6a8529"
dependencies:
babel-helper-mark-eval-scopes "^0.2.0"
babel-plugin-minify-numeric-literals@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.2.0.tgz#5746e851700167a380c05e93f289a7070459a0d1"
babel-plugin-minify-replace@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.2.0.tgz#3c1f06bc4e6d3e301eacb763edc1be611efc39b0"
babel-plugin-minify-simplify@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.2.0.tgz#21ceec4857100c5476d7cef121f351156e5c9bc0"
dependencies:
babel-helper-flip-expressions "^0.2.0"
babel-helper-is-nodes-equiv "^0.0.1"
babel-helper-to-multiple-sequence-expressions "^0.2.0"
babel-plugin-minify-type-constructors@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.2.0.tgz#7f3b6458be0863cfd59e9985bed6d134aa7a2e17"
dependencies:
babel-helper-is-void-0 "^0.2.0"
babel-plugin-syntax-async-functions@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95"
@ -929,6 +1030,22 @@ babel-plugin-transform-exponentiation-operator@^6.22.0, babel-plugin-transform-e
babel-plugin-syntax-exponentiation-operator "^6.8.0"
babel-runtime "^6.22.0"
babel-plugin-transform-inline-consecutive-adds@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.2.0.tgz#15dae78921057f4004f8eafd79e15ddc5f12f426"
babel-plugin-transform-member-expression-literals@^6.8.5:
version "6.8.5"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.8.5.tgz#e06ae305cf48d819822e93a70d79269f04d89eec"
babel-plugin-transform-merge-sibling-variables@^6.8.6:
version "6.8.6"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.8.6.tgz#6d21efa5ee4981f71657fae716f9594bb2622aef"
babel-plugin-transform-minify-booleans@^6.8.3:
version "6.8.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.8.3.tgz#5906ed776d3718250519abf1bace44b0b613ddf9"
babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
@ -936,18 +1053,46 @@ babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object
babel-plugin-syntax-object-rest-spread "^6.8.0"
babel-runtime "^6.26.0"
babel-plugin-transform-property-literals@^6.8.5:
version "6.8.5"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.8.5.tgz#67ed5930b34805443452c8b9690c7ebe1e206c40"
dependencies:
esutils "^2.0.2"
babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^6.24.1:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f"
dependencies:
regenerator-transform "^0.10.0"
babel-plugin-transform-regexp-constructors@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.2.0.tgz#6aa5dd0acc515db4be929bbcec4ed4c946c534a3"
babel-plugin-transform-remove-console@^6.8.5:
version "6.8.5"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.8.5.tgz#fde9d2d3d725530b0fadd8d31078402410386810"
babel-plugin-transform-remove-debugger@^6.8.5:
version "6.8.5"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.8.5.tgz#809584d412bf918f071fdf41e1fdb15ea89cdcd5"
babel-plugin-transform-remove-undefined@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.2.0.tgz#94f052062054c707e8d094acefe79416b63452b1"
dependencies:
babel-helper-evaluate-path "^0.2.0"
babel-plugin-transform-runtime@^6.15.0, babel-plugin-transform-runtime@^6.23.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee"
dependencies:
babel-runtime "^6.22.0"
babel-plugin-transform-simplify-comparison-operators@^6.8.5:
version "6.8.5"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.8.5.tgz#a838786baf40cc33a93b95ae09e05591227e43bf"
babel-plugin-transform-strict-mode@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758"
@ -955,6 +1100,10 @@ babel-plugin-transform-strict-mode@^6.24.1:
babel-runtime "^6.22.0"
babel-types "^6.24.1"
babel-plugin-transform-undefined-to-void@^6.8.3:
version "6.8.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.8.3.tgz#fc52707f6ee1ddc71bb91b0d314fbefdeef9beb4"
babel-plugin-transform-vue-jsx@^3.1.2:
version "3.5.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-3.5.0.tgz#6b1ad29351ad753919403675f0bf8b2a43e17671"
@ -1041,6 +1190,34 @@ babel-preset-es2015@^6.24.1, babel-preset-es2015@^6.3.13:
babel-plugin-transform-es2015-unicode-regex "^6.24.1"
babel-plugin-transform-regenerator "^6.24.1"
babel-preset-minify@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babel-preset-minify/-/babel-preset-minify-0.2.0.tgz#006566552d9b83834472273f306c0131062a0acc"
dependencies:
babel-plugin-minify-builtins "^0.2.0"
babel-plugin-minify-constant-folding "^0.2.0"
babel-plugin-minify-dead-code-elimination "^0.2.0"
babel-plugin-minify-flip-comparisons "^0.2.0"
babel-plugin-minify-guarded-expressions "^0.2.0"
babel-plugin-minify-infinity "^0.2.0"
babel-plugin-minify-mangle-names "^0.2.0"
babel-plugin-minify-numeric-literals "^0.2.0"
babel-plugin-minify-replace "^0.2.0"
babel-plugin-minify-simplify "^0.2.0"
babel-plugin-minify-type-constructors "^0.2.0"
babel-plugin-transform-inline-consecutive-adds "^0.2.0"
babel-plugin-transform-member-expression-literals "^6.8.5"
babel-plugin-transform-merge-sibling-variables "^6.8.6"
babel-plugin-transform-minify-booleans "^6.8.3"
babel-plugin-transform-property-literals "^6.8.5"
babel-plugin-transform-regexp-constructors "^0.2.0"
babel-plugin-transform-remove-console "^6.8.5"
babel-plugin-transform-remove-debugger "^6.8.5"
babel-plugin-transform-remove-undefined "^0.2.0"
babel-plugin-transform-simplify-comparison-operators "^6.8.5"
babel-plugin-transform-undefined-to-void "^6.8.3"
lodash.isplainobject "^4.0.6"
babel-preset-stage-2@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz#d9e2960fb3d71187f0e64eec62bc07767219bdc1"
@ -4003,6 +4180,10 @@ lodash.restparam@^3.0.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
lodash.some@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.some/-/lodash.some-4.6.0.tgz#1bb9f314ef6b8baded13b549169b2a945eb68e4d"
lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
@ -5938,12 +6119,6 @@ schema-utils@^0.3.0:
dependencies:
ajv "^5.0.0"
script-ext-html-webpack-plugin@^1.8.5:
version "1.8.5"
resolved "https://registry.yarnpkg.com/script-ext-html-webpack-plugin/-/script-ext-html-webpack-plugin-1.8.5.tgz#7a408383d7f3329da8f59d503be25cc39a53f3f3"
dependencies:
debug "^2.6.8"
semver-diff@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36"