From de76ed3c4b1722b9daa5b45f793ed6d857c241f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Mon, 13 Feb 2017 13:32:20 +0100 Subject: [PATCH 001/126] Add todos --- TODO.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000000..2cbdc6670e --- /dev/null +++ b/TODO.md @@ -0,0 +1,6 @@ +Tasks for `0.9.10`: +- [ ] Use [name].[chunkhash].js for generated js (production) #218 +- [ ] Add expired headers (production) +- [ ] Activate layout only on afterEach #214 +- [ ] Custom layout in layouts/error.vue #172 +- [ ] `build.publicPath` #25 From 4c53c6a66953ac09b608a874337bb92e780d4d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Mon, 13 Feb 2017 13:34:54 +0100 Subject: [PATCH 002/126] start working on publicPath --- TODO.md | 2 +- lib/build.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 2cbdc6670e..4444fdf470 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,6 @@ Tasks for `0.9.10`: +- [ ] `build.publicPath` #25 - [ ] Use [name].[chunkhash].js for generated js (production) #218 - [ ] Add expired headers (production) - [ ] Activate layout only on afterEach #214 - [ ] Custom layout in layouts/error.vue #172 -- [ ] `build.publicPath` #25 diff --git a/lib/build.js b/lib/build.js index 71203675e6..9bb27c54de 100644 --- a/lib/build.js +++ b/lib/build.js @@ -41,6 +41,7 @@ debug.color = 2 const defaults = { analyze: false, + publicPath: '/_nuxt/', filenames: { css: 'style.css', vendor: 'vendor.bundle.js', From 5a500b673571362f4990237daf0f2e048b51d148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 15 Feb 2017 18:19:18 +0100 Subject: [PATCH 003/126] Set publicPath and render always returns a promise --- lib/render.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/render.js b/lib/render.js index a759f1345d..04158e5d3c 100644 --- a/lib/render.js +++ b/lib/render.js @@ -13,14 +13,16 @@ export function render (req, res) { } /* istanbul ignore if */ if (!this.renderer) { - setTimeout(() => { - this.render(req, res) - }, 1000) - return + return new Promise((resolve) => { + setTimeout(() => { + resolve(this.render(req, res)) + }, 1000) + }) } const self = this const context = getContext(req, res) return co(function * () { + res.statusCode = 200 if (self.dev) { // Call webpack middleware only in development yield self.webpackDevMiddleware(req, res) @@ -34,9 +36,9 @@ export function render (req, res) { // Serve static/ files yield self.serveStatic(req, res) // Serve .nuxt/dist/ files (only for production) - if (!self.dev && self._nuxtRegexp.test(req.url)) { + if (!self.dev && self.options.nuxtStatic && req.url.indexOf(self.options.build.publicPath) === 0) { const url = req.url - req.url = req.url.replace(self._nuxtRegexp, '/') + req.url = req.url.replace(self.options.build.publicPath, '/') yield self.serveStaticNuxt(req, res) /* istanbul ignore next */ req.url = url @@ -44,7 +46,7 @@ export function render (req, res) { }) .then(() => { /* istanbul ignore if */ - if (this.dev && this._nuxtRegexp.test(req.url) && req.url.includes('.hot-update.json')) { + if (this.dev && req.url.indexOf(self.options.build.publicPath) === 0 && req.url.includes('.hot-update.json')) { res.statusCode = 404 return res.end() } @@ -57,10 +59,12 @@ export function render (req, res) { res.setHeader('Content-Type', 'text/html; charset=utf-8') res.setHeader('Content-Length', Buffer.byteLength(html)) res.end(html, 'utf8') + return html }) .catch((err) => { res.statusCode = 500 res.end(this.errorTemplate({ err }), 'utf8') + return err }) } @@ -76,15 +80,16 @@ export function renderRoute (url, context = {}) { if (!context.nuxt.serverRendered) { app = '
' } + const publicPath = self.options.build.publicPath.indexOf('http') === 0 ? self.options.build.publicPath : urlJoin(self.options.router.base, self.options.build.publicPath) const html = self.appTemplate({ dev: self.dev, // Use to add the extracted CSS in production baseUrl: self.options.router.base, APP: app, context: context, files: { - css: urlJoin(self.options.router.base, '/_nuxt/', self.options.build.filenames.css), - vendor: urlJoin(self.options.router.base, '/_nuxt/', self.options.build.filenames.vendor), - app: urlJoin(self.options.router.base, '/_nuxt/', self.options.build.filenames.app) + css: urlJoin(publicPath, self.options.build.filenames.css), + vendor: urlJoin(publicPath, self.options.build.filenames.vendor), + app: urlJoin(publicPath, self.options.build.filenames.app) } }) return { From 376362ec39a3ff2e3373530777470a38b7ff9e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 16 Feb 2017 18:16:00 +0100 Subject: [PATCH 004/126] Handle publicPath --- lib/build.js | 8 ++++++++ lib/generate.js | 11 +---------- lib/nuxt.js | 4 ++-- lib/utils.js | 2 +- lib/webpack/base.config.js | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/lib/build.js b/lib/build.js index 9bb27c54de..3d76a5d218 100644 --- a/lib/build.js +++ b/lib/build.js @@ -83,6 +83,14 @@ export function options () { if (this.options.build && !Array.isArray(this.options.build.loaders)) extraDefaults.loaders = defaultsLoaders if (this.options.build && !Array.isArray(this.options.build.postcss)) extraDefaults.postcss = defaultsPostcss this.options.build = _.defaultsDeep(this.options.build, defaults, extraDefaults) + if (this.options.build.publicPath.indexOf('http') === 0) { + // activate only in production mode + if (this.dev) { + this.options.build.publicPath = defaults.publicPath + } else { + this.options.nuxtStatic = false + } + } // Production, create server-renderer if (!this.dev) { const serverConfig = getWebpackServerConfig.call(this) diff --git a/lib/generate.js b/lib/generate.js index 9f37dfc469..1bf2eb38b4 100644 --- a/lib/generate.js +++ b/lib/generate.js @@ -22,15 +22,6 @@ const defaults = { export default function () { const s = Date.now() /* - ** Update loaders config to add router.base path - */ - // this.options.build.loaders.forEach((config) => { - // if (['file', 'url', 'file-loader', 'url-loader'].includes(config.loader)) { - // config.query = config.query || {} - // config.query.publicPath = urlJoin(this.options.router.base, '/_nuxt/') - // } - // }) - /* ** Set variables */ this.options.generate = _.defaultsDeep(this.options.generate, defaults) @@ -38,7 +29,7 @@ export default function () { var srcStaticPath = resolve(this.srcDir, 'static') var srcBuiltPath = resolve(this.dir, '.nuxt', 'dist') var distPath = resolve(this.dir, this.options.generate.dir) - var distNuxtPath = resolve(distPath, '_nuxt') + var distNuxtPath = join(distPath, (this.options.build.publicPath.indexOf('http') === 0 ? '_nuxt' : this.options.build.publicPath)) return co(function * () { /* ** Launch build process diff --git a/lib/nuxt.js b/lib/nuxt.js index 6982b29049..0e2bf46779 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -76,8 +76,8 @@ class Nuxt { this.renderer = null // For serving static/ files to / this.serveStatic = pify(serveStatic(resolve(this.srcDir, 'static'))) - // For serving .nuxt/dist/ files - this._nuxtRegexp = /^\/_nuxt\// + // For serving .nuxt/dist/ files (only when build.publicPath is not an URL) + this.options.nuxtStatic = true this.serveStaticNuxt = pify(serveStatic(resolve(this.dir, '.nuxt', 'dist'))) // Add this.Server Class this.Server = Server diff --git a/lib/utils.js b/lib/utils.js index aac0823475..65ab11edee 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -28,7 +28,7 @@ export function * waitFor (ms) { } export function urlJoin () { - return [].slice.call(arguments).join('/').replace(/\/+/g, '/') + return [].slice.call(arguments).join('/').replace(/\/+/g, '/').replace(':/', '://') } export function promisifyRouteParams (fn) { diff --git a/lib/webpack/base.config.js b/lib/webpack/base.config.js index 017f7e99ae..7e97ebe31d 100644 --- a/lib/webpack/base.config.js +++ b/lib/webpack/base.config.js @@ -21,7 +21,7 @@ export default function ({ isClient, isServer }) { vendor: ['vue', 'vue-router', 'vue-meta'] }, output: { - publicPath: urlJoin(this.options.router.base, '/_nuxt/') + publicPath: (this.options.build.publicPath.indexOf('http') === 0 ? this.options.build.publicPath : urlJoin(this.options.router.base, this.options.build.publicPath)) }, performance: { hints: (this.dev ? false : 'warning') From 1133b9327eb8cd74b4e342cf87dcb69a8b6980b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 16 Feb 2017 18:17:53 +0100 Subject: [PATCH 005/126] Upgrade dependencies --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9296e69439..8fc7d9b501 100644 --- a/package.json +++ b/package.json @@ -76,16 +76,16 @@ "serve-static": "^1.11.2", "url-loader": "^0.5.7", "vue": "^2.1.10", - "vue-loader": "^10.3.0", + "vue-loader": "^11.0.0", "vue-meta": "^0.5.3", - "vue-router": "^2.2.0", + "vue-router": "^2.2.1", "vue-server-renderer": "^2.1.10", "vue-template-compiler": "^2.1.10", "vuex": "^2.1.2", "webpack": "^2.2.1", - "webpack-bundle-analyzer": "^2.2.3", + "webpack-bundle-analyzer": "^2.3.0", "webpack-dev-middleware": "^1.10.0", - "webpack-hot-middleware": "^2.16.1" + "webpack-hot-middleware": "^2.17.0" }, "devDependencies": { "ava": "^0.18.1", @@ -97,7 +97,7 @@ "eslint-plugin-html": "^2.0.0", "eslint-plugin-promise": "^3.4.1", "eslint-plugin-standard": "^2.0.1", - "finalhandler": "^0.5.1", + "finalhandler": "^1.0.0", "jsdom": "^9.10.0", "json-loader": "^0.5.4", "nyc": "^10.1.2", From bea7b73ad5fd627386159ef3a5260ec7247a727a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 17 Feb 2017 16:12:20 +0100 Subject: [PATCH 006/126] Example with JSX --- examples/hello-world-jsx/package.json | 11 +++++++++++ examples/hello-world-jsx/pages/about.vue | 15 +++++++++++++++ examples/hello-world-jsx/pages/index.vue | 10 ++++++++++ 3 files changed, 36 insertions(+) create mode 100644 examples/hello-world-jsx/package.json create mode 100644 examples/hello-world-jsx/pages/about.vue create mode 100644 examples/hello-world-jsx/pages/index.vue diff --git a/examples/hello-world-jsx/package.json b/examples/hello-world-jsx/package.json new file mode 100644 index 0000000000..067dc72f52 --- /dev/null +++ b/examples/hello-world-jsx/package.json @@ -0,0 +1,11 @@ +{ + "name": "hello-nuxt-jsx", + "dependencies": { + "nuxt": "latest" + }, + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt" + } +} diff --git a/examples/hello-world-jsx/pages/about.vue b/examples/hello-world-jsx/pages/about.vue new file mode 100644 index 0000000000..37d63ccbea --- /dev/null +++ b/examples/hello-world-jsx/pages/about.vue @@ -0,0 +1,15 @@ + diff --git a/examples/hello-world-jsx/pages/index.vue b/examples/hello-world-jsx/pages/index.vue new file mode 100644 index 0000000000..2786fa37ed --- /dev/null +++ b/examples/hello-world-jsx/pages/index.vue @@ -0,0 +1,10 @@ + From 2bb8f1fd587f7ea69c91a3871b341d55d4fda033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 17 Feb 2017 16:13:51 +0100 Subject: [PATCH 007/126] Use vue-app preset for babel --- lib/webpack/base.config.js | 9 +-------- lib/webpack/vue-loader.config.js | 10 ++-------- package.json | 6 +----- webpack.config.js | 10 +--------- 4 files changed, 5 insertions(+), 30 deletions(-) diff --git a/lib/webpack/base.config.js b/lib/webpack/base.config.js index 7e97ebe31d..d5f22033f8 100644 --- a/lib/webpack/base.config.js +++ b/lib/webpack/base.config.js @@ -64,14 +64,7 @@ export default function ({ isClient, isServer }) { loader: 'babel-loader', exclude: /node_modules/, query: defaults(this.options.build.babel, { - plugins: [ - 'transform-async-to-generator', - 'transform-runtime' - ], - presets: [ - ['es2015', { modules: false }], - 'stage-2' - ], + presets: ['vue-app'], cacheDirectory: !!this.dev }) } diff --git a/lib/webpack/vue-loader.config.js b/lib/webpack/vue-loader.config.js index b045d1a29c..e755a1fc96 100644 --- a/lib/webpack/vue-loader.config.js +++ b/lib/webpack/vue-loader.config.js @@ -4,14 +4,8 @@ import { defaults } from 'lodash' export default function ({ isClient }) { let babelOptions = JSON.stringify(defaults(this.options.build.babel, { - plugins: [ - 'transform-async-to-generator', - 'transform-runtime' - ], - presets: [ - ['es2015', { modules: false }], - 'stage-2' - ] + presets: ['vue-app'], + cacheDirectory: !!this.dev })) let config = { postcss: this.options.build.postcss, diff --git a/package.json b/package.json index 8fc7d9b501..d2bd7d3db1 100644 --- a/package.json +++ b/package.json @@ -51,11 +51,7 @@ "autoprefixer": "^6.7.2", "babel-core": "^6.22.1", "babel-loader": "^6.2.10", - "babel-plugin-array-includes": "^2.0.3", - "babel-plugin-transform-async-to-generator": "^6.22.0", - "babel-plugin-transform-runtime": "^6.22.0", - "babel-preset-es2015": "^6.22.0", - "babel-preset-stage-2": "^6.22.0", + "babel-preset-vue-app": "^0.4.0", "chokidar": "^1.6.1", "co": "^4.6.0", "css-loader": "^0.26.1", diff --git a/webpack.config.js b/webpack.config.js index 53c731ff72..bc77a1e10f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -31,15 +31,7 @@ module.exports = { loader: 'babel-loader', exclude: /node_modules/, query: { - plugins: [ - 'transform-async-to-generator', - 'array-includes', - 'transform-runtime' - ], - presets: [ - ['es2015', { modules: false }], - 'stage-2' - ], + presets: ['vue-app'], cacheDirectory: true } } From 00c9abb8061e56de96658d8ba9ef541678636b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 17 Feb 2017 17:31:09 +0100 Subject: [PATCH 008/126] Revert to basic presets for build --- package.json | 5 +++++ webpack.config.js | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d2bd7d3db1..ea932cc00e 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,11 @@ "devDependencies": { "ava": "^0.18.1", "babel-eslint": "^7.1.1", + "babel-plugin-array-includes": "^2.0.3", + "babel-plugin-transform-async-to-generator": "^6.22.0", + "babel-plugin-transform-runtime": "^6.22.0", + "babel-preset-es2015": "^6.22.0", + "babel-preset-stage-2": "^6.22.0", "codecov": "^1.0.1", "copy-webpack-plugin": "^4.0.1", "eslint": "^3.15.0", diff --git a/webpack.config.js b/webpack.config.js index bc77a1e10f..53c731ff72 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -31,7 +31,15 @@ module.exports = { loader: 'babel-loader', exclude: /node_modules/, query: { - presets: ['vue-app'], + plugins: [ + 'transform-async-to-generator', + 'array-includes', + 'transform-runtime' + ], + presets: [ + ['es2015', { modules: false }], + 'stage-2' + ], cacheDirectory: true } } From 7d630bf5d985579929f7b0dd5a83fd6b829b49ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Mon, 20 Feb 2017 18:59:15 +0100 Subject: [PATCH 009/126] Remove extra line --- lib/build.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/build.js b/lib/build.js index 6cb958d44c..f1a4d33cb0 100644 --- a/lib/build.js +++ b/lib/build.js @@ -353,7 +353,6 @@ function createWebpackMiddleware () { new webpack.NoEmitOnErrorsPlugin(), new PostCompilePlugin(stats => { process.stdout.write('\x1Bc') - if (stats.hasErrors() || stats.hasWarnings()) { console.log(stats.toString('errors-only')) // eslint-disable-line no-console console.log() // eslint-disable-line no-console From 9a2767ac908b149461482bb967aba920f0e5d050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Mon, 20 Feb 2017 22:11:34 +0000 Subject: [PATCH 010/126] Layout on afterEach --- TODO.md | 6 ++++-- lib/app/App.vue | 15 ++++++++------- lib/app/client.js | 22 +++++++++++++++------- lib/app/components/nuxt.vue | 2 +- lib/app/index.js | 3 ++- lib/app/server.js | 4 ++-- lib/build.js | 2 +- 7 files changed, 33 insertions(+), 21 deletions(-) diff --git a/TODO.md b/TODO.md index 4444fdf470..e83d88f9fa 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,8 @@ Tasks for `0.9.10`: -- [ ] `build.publicPath` #25 +- [x] `build.publicPath` #25 - [ ] Use [name].[chunkhash].js for generated js (production) #218 - [ ] Add expired headers (production) -- [ ] Activate layout only on afterEach #214 +- [x] Activate layout only on afterEach #214 - [ ] Custom layout in layouts/error.vue #172 + +-> Not possible to have custom layout for a page, it should do the condition inside the layout itself (because of the middleware strategy) diff --git a/lib/app/App.vue b/lib/app/App.vue index 6821f73894..080aa3a689 100644 --- a/lib/app/App.vue +++ b/lib/app/App.vue @@ -33,18 +33,19 @@ export default { if (!layout || !layouts['_' + layout]) layout = 'default' this.layoutName = layout let _layout = '_' + layout - if (typeof layouts[_layout] === 'function') { - return this.loadLayout(_layout) - } this.layout = layouts[_layout] - return Promise.resolve(this.layout) + return this.layout }, - loadLayout (_layout) { + loadLayout (layout) { + if (!layout || !layouts['_' + layout]) layout = 'default' + let _layout = '_' + layout + if (typeof layouts[_layout] !== 'function') { + return Promise.resolve(layouts[_layout]) + } return layouts[_layout]() .then((Component) => { layouts[_layout] = Component - this.layout = layouts[_layout] - return this.layout + return layouts[_layout] }) .catch((e) => { if (this.$nuxt) { diff --git a/lib/app/client.js b/lib/app/client.js index 21e189e631..8a3a1a739b 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -2,7 +2,7 @@ import Vue from 'vue' import middleware from './middleware' -import { app, router<%= (store ? ', store' : '') %> } from './index' +import { app, router<%= (store ? ', store' : '') %>, NuxtError } from './index' import { getMatchedComponents, getMatchedComponentsInstances, flatMapComponents, getContext, promiseSeries, promisify, getLocation, compile } from './utils' const noopData = () => { return {} } const noopFetch = () => {} @@ -88,7 +88,7 @@ function render (to, from, next) { this._hadError = !!this.$options._nuxt.err if (!Components.length) { // Default layout - this.setLayout() + this.loadLayout(NuxtError.layout) .then(callMiddleware.bind(this, Components, context)) .then(() => { this.error({ statusCode: 404, message: 'This page could not be found.' }) @@ -117,7 +117,7 @@ function render (to, from, next) { this.setTransitions(mapTransitions(Components, to, from)) let nextCalled = false // Set layout - this.setLayout(Components[0].options.layout) + this.loadLayout(Components[0].options.layout) .then(callMiddleware.bind(this, Components, context)) .then(() => { // Pass validation? @@ -175,8 +175,11 @@ function render (to, from, next) { .catch((error) => { _lastPaths = [] error.statusCode = error.statusCode || error.status || (error.response && error.response.status) || 500 - this.error(error) - next(false) + this.loadLayout(NuxtError.layout) + .then(() => { + this.error(error) + next(false) + }) }) } @@ -213,6 +216,8 @@ function fixPrepatch (to, ___) { if (this._hadError && this._dateLastError === this.$options._nuxt.dateErr) { this.error() } + // Set layout + this.setLayout(this.$options._nuxt.err ? NuxtError.layout : to.matched[0].components.default.options.layout) // hot reloading hotReloadAPI(this) }) @@ -234,8 +239,9 @@ function hotReloadAPI (_app) { let promises = [] // If layout changed if (_app.layoutName !== Component.options.layout) { - let promise = _app.setLayout(Component.options.layout) + let promise = _app.loadLayout(Component.options.layout) promise.then(() => { + _app.setLayout(Component.options.layout) hotReloadAPI(_app) }) promises.push(promise) @@ -338,8 +344,10 @@ Promise.all(resolveComponents) .then((Components) => { const _app = new Vue(app) - return _app.setLayout(Components.length ? Components[0].options.layout : '') + let layout = Components.length ? Components[0].options.layout : NuxtError.layout + return _app.loadLayout(layout) .then(() => { + _app.setLayout(layout) return { _app, Components } }) }) diff --git a/lib/app/components/nuxt.vue b/lib/app/components/nuxt.vue index be1682f050..b6eb339a31 100644 --- a/lib/app/components/nuxt.vue +++ b/lib/app/components/nuxt.vue @@ -6,7 +6,7 @@ ` const html = self.appTemplate({ - dev: self.dev, // Use to add the extracted CSS in production - baseUrl: self.options.router.base, - APP: app, - context: context, - files: { - css: urlJoin(publicPath, self.options.build.filenames.css), - vendor: urlJoin(publicPath, self.options.build.filenames.vendor), - app: urlJoin(publicPath, self.options.build.filenames.app) - } + HTML_ATTRS: 'n-head-ssr ' + m.htmlAttrs.text(), + BODY_ATTRS: m.bodyAttrs.text(), + HEAD, + APP }) return { html, diff --git a/lib/views/app.html b/lib/views/app.html deleted file mode 100644 index fcf4f15ede..0000000000 --- a/lib/views/app.html +++ /dev/null @@ -1,19 +0,0 @@ -<% var m = context.meta.inject() %> -> - - <%= m.meta.text() %> - <%= m.title.text() %> - <%= m.link.text() %> - <%= m.style.text() %> - <%= m.script.text() %> - <%= m.noscript.text() %> - <% if (baseUrl !== '/') { %><% } %> - <% if (!dev) { %><% } %> - - > - <%= APP %> - - - - - diff --git a/lib/views/app.template.html b/lib/views/app.template.html new file mode 100644 index 0000000000..3ef8d3b0fc --- /dev/null +++ b/lib/views/app.template.html @@ -0,0 +1,9 @@ + + + + {{ HEAD }} + + + {{ APP }} + + diff --git a/lib/views/error.html b/lib/views/error.html index e752bece5f..dd2f8d2d71 100644 --- a/lib/views/error.html +++ b/lib/views/error.html @@ -2,10 +2,10 @@ - Vue.js error + Nuxt.js error -

Vue.js error

-
<%= ansiHTML(encodeHtml(err.stack)) %>
+

Nuxt.js error

+
{{ stack }}
diff --git a/lib/webpack/client.config.js b/lib/webpack/client.config.js index 8cee34438e..2023e5b0fa 100644 --- a/lib/webpack/client.config.js +++ b/lib/webpack/client.config.js @@ -2,6 +2,9 @@ import { each } from 'lodash' import webpack from 'webpack' +import HTMLPlugin from 'html-webpack-plugin' +import ScriptExtHtmlWebpackPlugin from 'script-ext-html-webpack-plugin' +import PreloadWebpackPlugin from 'preload-webpack-plugin' import ExtractTextPlugin from 'extract-text-webpack-plugin' import ProgressBarPlugin from 'progress-bar-webpack-plugin' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' @@ -40,7 +43,7 @@ export default function () { }) // Webpack plugins config.plugins = (config.plugins || []).concat([ - // strip comments in Vue code + // Strip comments in Vue code new webpack.DefinePlugin(Object.assign(env, { 'process.env.NODE_ENV': JSON.stringify(this.dev ? 'development' : 'production'), 'process.BROWSER_BUILD': true, @@ -50,6 +53,18 @@ export default function () { new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: this.options.build.filenames.vendor + }), + // Generate output HTML + new HTMLPlugin({ + template: resolve(__dirname, 'views/app.template.html') + }), + // Add defer to scripts + new ScriptExtHtmlWebpackPlugin({ + defaultAttribute: 'defer' + }), + // Add prefetch code-splitted routes + new PreloadWebpackPlugin({ + rel: 'prefetch' }) ]) diff --git a/package.json b/package.json index bd927a9b77..c68915f5a2 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "chalk": "^1.1.3", "chokidar": "^1.6.1", "co": "^4.6.0", + "compression": "^1.6.2", "css-loader": "^0.26.1", "debug": "^2.6.1", "extract-text-webpack-plugin": "2.0.0-beta.4", @@ -63,13 +64,16 @@ "glob": "^7.1.1", "hash-sum": "^1.0.2", "html-minifier": "^3.3.1", + "html-webpack-plugin": "^2.28.0", "lodash": "^4.17.4", "lru-cache": "^4.0.2", "memory-fs": "^0.4.1", "path-to-regexp": "^1.7.0", "pify": "^2.3.0", "post-compile-webpack-plugin": "^0.1.1", + "preload-webpack-plugin": "^1.2.0", "progress-bar-webpack-plugin": "^1.9.3", + "script-ext-html-webpack-plugin": "^1.7.1", "serialize-javascript": "^1.3.0", "serve-static": "^1.11.2", "url-loader": "^0.5.7", From 6cc1231eb2c51806cc3ef9689b29b4d9b4b76462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 21 Feb 2017 17:39:29 +0000 Subject: [PATCH 014/126] Add performance option --- lib/nuxt.js | 4 ++++ lib/render.js | 3 ++- lib/webpack/client.config.js | 12 ++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/nuxt.js b/lib/nuxt.js index 4ae4be41a2..ff97870b41 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -41,6 +41,10 @@ class Nuxt { extendRoutes: null, scrollBehavior: null }, + performance: { + gzip: true, + prefetch: true + }, build: {} } // Sanitization diff --git a/lib/render.js b/lib/render.js index e1db3d9fbd..105b3dc352 100644 --- a/lib/render.js +++ b/lib/render.js @@ -30,7 +30,8 @@ export function render (req, res) { // Call webpack middleware only in development yield self.webpackDevMiddleware(req, res) yield self.webpackHotMiddleware(req, res) - } else { + } + if (!self.dev && self.options.performance.gzip === true) { yield self.gzipMiddleware(req, res) } // If base in req.url, remove it for the middleware and vue-router diff --git a/lib/webpack/client.config.js b/lib/webpack/client.config.js index 2023e5b0fa..dffff99230 100644 --- a/lib/webpack/client.config.js +++ b/lib/webpack/client.config.js @@ -61,13 +61,17 @@ export default function () { // Add defer to scripts new ScriptExtHtmlWebpackPlugin({ defaultAttribute: 'defer' - }), - // Add prefetch code-splitted routes - new PreloadWebpackPlugin({ - rel: 'prefetch' }) ]) + if (this.options.performance.prefetch === true) { + // Add prefetch code-splitted routes + config.plugins.push( + new PreloadWebpackPlugin({ + rel: 'prefetch' + }) + ) + } // client bundle progress bar config.plugins.push( new ProgressBarPlugin() From 8dfae9fa54e12d948877398c42168d9501f56689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 21 Feb 2017 18:22:27 +0000 Subject: [PATCH 015/126] Fix headers sent --- lib/render.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/render.js b/lib/render.js index 105b3dc352..59f9199dc7 100644 --- a/lib/render.js +++ b/lib/render.js @@ -54,11 +54,12 @@ export function render (req, res) { /* istanbul ignore if */ if (this.dev && req.url.indexOf(self.options.build.publicPath) === 0 && req.url.includes('.hot-update.json')) { res.statusCode = 404 - return res.end() + return { html: '' } } return this.renderRoute(req.url, context) }) - .then(({ html, error }) => { + .then(({ html, error, redirected }) => { + if (redirected) return html if (error) { res.statusCode = context.nuxt.error.statusCode || 500 } From 591ef50a0641ef4f7ca167aeae0fe2a4860b3702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 21 Feb 2017 18:22:57 +0000 Subject: [PATCH 016/126] Fix template not built --- lib/build.js | 11 +++++++++++ lib/nuxt.js | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/build.js b/lib/build.js index 488fda67b9..d3596cb3e9 100644 --- a/lib/build.js +++ b/lib/build.js @@ -101,6 +101,7 @@ export function options () { if (fs.existsSync(bundlePath)) { const bundle = fs.readFileSync(bundlePath, 'utf8') createRenderer.call(this, bundle) + addAppTemplate.call(this) } } } @@ -142,6 +143,16 @@ function * buildFiles () { webpackRunClient.call(this), webpackRunServer.call(this) ] + addAppTemplate.call(this) + } +} + +function addAppTemplate () { + let templatePath = resolve(this.dir, '.nuxt', 'dist', 'index.html') + if (fs.existsSync(templatePath)) { + this.appTemplate = _.template(fs.readFileSync(templatePath, 'utf8'), { + interpolate: /{{([\s\S]+?)}}/g + }) } } diff --git a/lib/nuxt.js b/lib/nuxt.js index ff97870b41..a049290ee9 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -84,12 +84,7 @@ class Nuxt { // Add this.build build.options.call(this) // Add build options this.build = () => co(build.build.bind(this)) - // Template - if (!this.dev && this.renderer) { - this.appTemplate = _.template(fs.readFileSync(resolve(this.dir, '.nuxt', 'dist', 'index.html'), 'utf8'), { - interpolate: /{{([\s\S]+?)}}/g - }) - } + // Error template this.errorTemplate = _.template(fs.readFileSync(resolve(__dirname, 'views', 'error.html'), 'utf8'), { interpolate: /{{([\s\S]+?)}}/g }) From 749673c99b7eb7d3b7ffd39c2931cdb69ba1ac37 Mon Sep 17 00:00:00 2001 From: Alexandre Chopin Date: Wed, 22 Feb 2017 18:13:23 +0100 Subject: [PATCH 017/126] fix pathToRegexp generate routes --- lib/generate.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/generate.js b/lib/generate.js index 1bf2eb38b4..61bde5e933 100644 --- a/lib/generate.js +++ b/lib/generate.js @@ -67,10 +67,9 @@ export default function () { console.error(`Could not generate the dynamic route ${route}, please add the mapping params in nuxt.config.js (generate.routeParams).`) // eslint-disable-line no-console return process.exit(1) } - route = route + '?' - const toPath = pathToRegexp.compile(route) + const toPathRegexp = pathToRegexp.compile(route) routes = routes.concat(routeParams.map((params) => { - return toPath(params) + return toPathRegexp(params) })) } else { routes.push(route) From 66c5aad09db81c90b29d4a1ed57d5b7b5a603ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 22 Feb 2017 18:19:17 +0000 Subject: [PATCH 018/126] Fix redirected --- lib/app/server.js | 2 +- lib/render.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/app/server.js b/lib/app/server.js index a4977a9dc4..241dd03cca 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -25,9 +25,9 @@ export default context => { // create context.next for simulate next() of beforeEach() when wanted to redirect context.redirected = false context.next = function (opts) { + context.redirected = opts // if nuxt generate if (!context.res) { - context.redirected = opts context.nuxt.serverRendered = false return } diff --git a/lib/render.js b/lib/render.js index 59f9199dc7..e8e25e149e 100644 --- a/lib/render.js +++ b/lib/render.js @@ -59,7 +59,9 @@ export function render (req, res) { return this.renderRoute(req.url, context) }) .then(({ html, error, redirected }) => { - if (redirected) return html + if (redirected) { + return html + } if (error) { res.statusCode = context.nuxt.error.statusCode || 500 } From 0e2474c681a480d40cbad6cbadb151786ec0a680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 22 Feb 2017 18:19:49 +0000 Subject: [PATCH 019/126] Check if app.html exists --- lib/nuxt.js | 5 +++++ lib/webpack/client.config.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/nuxt.js b/lib/nuxt.js index a049290ee9..660cbc48c5 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -65,6 +65,11 @@ class Nuxt { if (fs.existsSync(join(this.srcDir, 'middleware'))) { this.options.middleware = true } + // If app.html is defined, set the template path to the user template + this.options.appTemplatePath = resolve(__dirname, 'views/app.template.html') + if (fs.existsSync(join(this.srcDir, 'app.html'))) { + this.options.appTemplatePath = join(this.srcDir, 'app.html') + } // renderer used by Vue.js (via createBundleRenderer) this.renderer = null // For serving static/ files to / diff --git a/lib/webpack/client.config.js b/lib/webpack/client.config.js index dffff99230..5df452bc07 100644 --- a/lib/webpack/client.config.js +++ b/lib/webpack/client.config.js @@ -56,7 +56,7 @@ export default function () { }), // Generate output HTML new HTMLPlugin({ - template: resolve(__dirname, 'views/app.template.html') + template: this.options.appTemplatePath }), // Add defer to scripts new ScriptExtHtmlWebpackPlugin({ From 457c23d1dd23e8bd3ff9f45e89f9004811a3158b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 22 Feb 2017 18:20:01 +0000 Subject: [PATCH 020/126] Use verbose mode --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c68915f5a2..ca35a5bb60 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "nuxt": "./bin/nuxt" }, "scripts": { - "test": "nyc ava --serial test/", + "test": "nyc ava --verbose --serial test/", "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "eslint --ext .js,.vue bin lib pages test/*.js --ignore-pattern lib/app", "build": "webpack", From 6e2fb4642e54bc0fe001a895cb6928f59be7569a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 22 Feb 2017 18:20:17 +0000 Subject: [PATCH 021/126] Fix tests --- TODO.md | 9 ++++++--- test/fixtures/basic/nuxt.config.js | 2 +- test/with-config.test.js | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index e83d88f9fa..b5ad3ca12b 100644 --- a/TODO.md +++ b/TODO.md @@ -1,8 +1,11 @@ Tasks for `0.9.10`: - [x] `build.publicPath` #25 -- [ ] Use [name].[chunkhash].js for generated js (production) #218 -- [ ] Add expired headers (production) +- [x] Use [name].[chunkhash].js for generated js (production) #218 +- [x] Add expired headers (production) - [x] Activate layout only on afterEach #214 -- [ ] Custom layout in layouts/error.vue #172 +- [x] Custom layout in layouts/error.vue #172 +- [ ] Test + Coverage performance, cache, filenames +- [ ] Manual tests on router.base & publicPath +- [ ] Add Doc for build.filenames, performance.gzip and performance.prefetch -> Not possible to have custom layout for a page, it should do the condition inside the layout itself (because of the middleware strategy) diff --git a/test/fixtures/basic/nuxt.config.js b/test/fixtures/basic/nuxt.config.js index 1793846e1f..13d5d0cef5 100644 --- a/test/fixtures/basic/nuxt.config.js +++ b/test/fixtures/basic/nuxt.config.js @@ -1,7 +1,7 @@ module.exports = { generate: { routeParams: { - '/users/:id': [ + '/users/:id?': [ { id: 1 }, { id: 2 }, { id: 3 } diff --git a/test/with-config.test.js b/test/with-config.test.js index d79c91450a..5f16a6ac66 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -62,7 +62,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, 11) + t.is(stats.assets.length, 12) }) // Close server and ask nuxt to stop listening to file changes From fd966485ee1754c148be41c3084a39e7d5f39927 Mon Sep 17 00:00:00 2001 From: Alexandre Chopin Date: Thu, 23 Feb 2017 11:02:11 +0100 Subject: [PATCH 022/126] extendRoutes add resolve func as param for window --- lib/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/build.js b/lib/build.js index d3596cb3e9..6f5e1c5a1a 100644 --- a/lib/build.js +++ b/lib/build.js @@ -210,7 +210,7 @@ function * generateRoutesAndFiles () { templateVars.router.routes = createRoutes(files, this.srcDir) if (typeof this.options.router.extendRoutes === 'function') { // let the user extend the routes - this.options.router.extendRoutes(templateVars.router.routes) + this.options.router.extendRoutes(templateVars.router.routes, r) } // Routes for Generate command this.routes = flatRoutes(templateVars.router.routes, '') From 996613ce8bbebeba3991395d3e09c6da5ee79e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 23 Feb 2017 13:43:57 +0000 Subject: [PATCH 023/126] prefetch only in production --- lib/webpack/client.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/webpack/client.config.js b/lib/webpack/client.config.js index 5df452bc07..6ea9ac2d27 100644 --- a/lib/webpack/client.config.js +++ b/lib/webpack/client.config.js @@ -64,7 +64,7 @@ export default function () { }) ]) - if (this.options.performance.prefetch === true) { + if (!this.dev && this.options.performance.prefetch === true) { // Add prefetch code-splitted routes config.plugins.push( new PreloadWebpackPlugin({ From 40d52645e8db656c6a4e62aba5c3c89a2b158750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 28 Feb 2017 13:10:58 +0100 Subject: [PATCH 024/126] asyncData --- TODO.md | 10 +++++++- lib/app/client.js | 44 +++++++++++++++--------------------- lib/app/server.js | 26 +++++++++++++-------- lib/webpack/client.config.js | 4 +++- lib/webpack/server.config.js | 6 +++-- 5 files changed, 51 insertions(+), 39 deletions(-) diff --git a/TODO.md b/TODO.md index b5ad3ca12b..475654d31d 100644 --- a/TODO.md +++ b/TODO.md @@ -4,8 +4,16 @@ Tasks for `0.9.10`: - [x] Add expired headers (production) - [x] Activate layout only on afterEach #214 - [x] Custom layout in layouts/error.vue #172 +- [x] Add Doc for build.filenames, performance.gzip and performance.prefetch +- [ ] Fork preload-webpack-plugin and use it in package.json - [ ] Test + Coverage performance, cache, filenames - [ ] Manual tests on router.base & publicPath -- [ ] Add Doc for build.filenames, performance.gzip and performance.prefetch -> Not possible to have custom layout for a page, it should do the condition inside the layout itself (because of the middleware strategy) + + +Release: + +## Deprecated +- `process.BROWSER_BUILD` is deprecated in favour of `process.browser` (`BROWSER_BUILD` will be removed for the 1.0) +- `process.SERVER_BUILD` is deprecated in favour of `process.server` (`SERVER_BUILD` will be removed for the 1.0) diff --git a/lib/app/client.js b/lib/app/client.js index 8a3a1a739b..030013a4cc 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -98,20 +98,9 @@ function render (to, from, next) { } // Update ._data and other properties if hot reloaded Components.forEach(function (Component) { - if (!Component._data) { - Component._data = Component.options.data || noopData - } if (Component._Ctor && Component._Ctor.options) { + Component.options.asyncData = Component._Ctor.options.asyncData Component.options.fetch = Component._Ctor.options.fetch - if (Component._dataFn) { - const originalDataFn = Component._data.toString().replace(/\s/g, '') - const dataFn = Component._dataFn - const newDataFn = (Component._Ctor.options.data || noopData).toString().replace(/\s/g, '') - // If component data method changed - if (newDataFn !== originalDataFn && newDataFn !== dataFn) { - Component._data = Component._Ctor.options.data || noopData - } - } } }) this.setTransitions(mapTransitions(Components, to, from)) @@ -141,13 +130,21 @@ function render (to, from, next) { return Promise.resolve() } let promises = [] - // Validate method - if (Component._data && typeof Component._data === 'function') { - var promise = promisify(Component._data, context) - promise.then((data) => { - Component._cData = () => data || {} - Component.options.data = Component._cData - Component._dataFn = Component.options.data.toString().replace(/\s/g, '') + // asyncData method + if (Component.options.asyncData && typeof Component.options.asyncData === 'function') { + var promise = promisify(Component.options.asyncData, context) + promise.then((asyncDataResult) => { + let data = {} + // keep asyncData() result + Component._asyncDataResult = asyncDataResult + // Call data() if defined + if (Component.options.data && typeof Component.options.data === 'function') { + data = Component.options.data() + } + // Merge data() and asyncData() results + data = Object.assign(data, asyncDataResult) + // Overwrite .data() method with merged data + Component.options.data = () => data if (Component._Ctor && Component._Ctor.options) { Component._Ctor.options.data = Component.options.data } @@ -308,13 +305,8 @@ const resolveComponents = flatMapComponents(router.match(path), (Component, _, m Component._Ctor = Component Component.extendOptions = Component.options } - if (Component.options.data && typeof Component.options.data === 'function') { - Component._data = Component.options.data - if (NUXT.serverRendered) { - Component._cData = () => NUXT.data[index] || {} - Component.options.data = Component._cData - Component._dataFn = Component.options.data.toString().replace(/\s/g, '') - } + if (NUXT.serverRendered) { + Component.options.data = () => NUXT.data[index] if (Component._Ctor && Component._Ctor.options) { Component._Ctor.options.data = Component.options.data } diff --git a/lib/app/server.js b/lib/app/server.js index 241dd03cca..ee2dfdc21d 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -3,6 +3,7 @@ const debug = require('debug')('nuxt:render') debug.color = 4 // force blue color import Vue from 'vue' + import { stringify } from 'querystring' import { omit } from 'lodash' import middleware from './middleware' @@ -114,19 +115,24 @@ export default context => { Components = [] return _app } - // Call data & fetch hooks on components matched by the route. + // Call asyncData & fetch hooks on components matched by the route. return Promise.all(Components.map((Component) => { let promises = [] - if (Component.options.data && typeof Component.options.data === 'function') { - Component._data = Component.options.data - let promise = promisify(Component._data, ctx) - promise.then((data) => { + if (Component.options.asyncData && typeof Component.options.asyncData === 'function') { + let promise = promisify(Component.options.asyncData, ctx) + // Call asyncData(context) + promise.then((asyncDataResult) => { + let data = {} + // Call data() if defined + if (Component.options.data && typeof Component.options.data === 'function') { + data = Component.options.data() + } + // Merge data() and asyncData() results + data = Object.assign(data, asyncDataResult) Component.options.data = () => data Component._Ctor.options.data = Component.options.data }) promises.push(promise) - } else { - promises.push(null) } if (Component.options.fetch) { promises.push(Component.options.fetch(ctx)) @@ -134,7 +140,7 @@ export default context => { return Promise.all(promises) })) }) - .then((res) => { + .then(() => { if (!Components.length) { context.nuxt.error = context.error({ statusCode: 404, message: 'This page could not be found.' }) <%= (store ? 'context.nuxt.state = store.state' : '') %> @@ -144,7 +150,9 @@ export default context => { debug('Data fetching ' + context.req.url + ': ' + (Date.now() - s) + 'ms') <% } %> // datas are the first row of each - context.nuxt.data = res.map((tab) => tab[0]) + context.nuxt.data = Components.map((Component) => { + return (typeof Component.options.data === 'function' ? Component.options.data() : {}) + }) context.nuxt.error = _app.$options._nuxt.err <%= (store ? '// Add the state from the vuex store' : '') %> <%= (store ? 'context.nuxt.state = store.state' : '') %> diff --git a/lib/webpack/client.config.js b/lib/webpack/client.config.js index 6ea9ac2d27..0cb8066080 100644 --- a/lib/webpack/client.config.js +++ b/lib/webpack/client.config.js @@ -47,7 +47,9 @@ export default function () { new webpack.DefinePlugin(Object.assign(env, { 'process.env.NODE_ENV': JSON.stringify(this.dev ? 'development' : 'production'), 'process.BROWSER_BUILD': true, - 'process.SERVER_BUILD': false + 'process.SERVER_BUILD': false, + 'process.browser': true, + 'process.server': true })), // Extract vendor chunks for better caching new webpack.optimize.CommonsChunkPlugin({ diff --git a/lib/webpack/server.config.js b/lib/webpack/server.config.js index e8f1323f67..bcbbce1092 100644 --- a/lib/webpack/server.config.js +++ b/lib/webpack/server.config.js @@ -32,8 +32,10 @@ export default function () { plugins: (config.plugins || []).concat([ new webpack.DefinePlugin(Object.assign(env, { 'process.env.NODE_ENV': JSON.stringify(this.dev ? 'development' : 'production'), - 'process.BROWSER_BUILD': false, - 'process.SERVER_BUILD': true + 'process.BROWSER_BUILD': false, // deprecated + 'process.SERVER_BUILD': true, // deprecated + 'process.browser': false, + 'process.server': true })) ]) }) From 7f925c22faf851f61c08efa26948e8b984672db7 Mon Sep 17 00:00:00 2001 From: Alexandre Chopin Date: Tue, 28 Feb 2017 15:17:38 +0100 Subject: [PATCH 025/126] update vue ecosystem versions --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index aa78c4f318..c18c8db0e5 100644 --- a/package.json +++ b/package.json @@ -81,13 +81,13 @@ "serialize-javascript": "^1.3.0", "serve-static": "^1.11.2", "url-loader": "^0.5.7", - "vue": "^2.1.10", + "vue": "^2.2.1", "vue-loader": "^11.0.0", "vue-meta": "^0.5.3", - "vue-router": "^2.2.1", - "vue-server-renderer": "^2.1.10", - "vue-template-compiler": "^2.1.10", - "vuex": "^2.1.2", + "vue-router": "^2.3.0", + "vue-server-renderer": "^2.2.0", + "vue-template-compiler": "^2.2.0", + "vuex": "^2.2.0", "webpack": "^2.2.1", "webpack-bundle-analyzer": "^2.3.0", "webpack-dev-middleware": "^1.10.0", From a4461ff590eb83f910b8f5a143384cb0a0eb5db1 Mon Sep 17 00:00:00 2001 From: Alexandre Chopin Date: Tue, 28 Feb 2017 15:17:49 +0100 Subject: [PATCH 026/126] update examples for asyncData --- examples/async-data/pages/index.vue | 2 +- examples/async-data/pages/posts/_id.vue | 2 +- examples/async-data/pages/posts/index.vue | 2 +- examples/custom-layouts/pages/about.vue | 2 +- examples/custom-loading/pages/about.vue | 2 +- examples/custom-loading/pages/index.vue | 2 +- examples/custom-routes/pages/index.vue | 2 +- examples/custom-routes/pages/users/_id.vue | 2 +- examples/hello-world-jsx/pages/about.vue | 2 +- examples/hello-world/pages/about.vue | 2 +- examples/middleware/pages/_slug.vue | 2 +- examples/nested-routes/pages/index.vue | 2 +- examples/nested-routes/pages/index/_id.vue | 2 +- examples/plugins-vendor/pages/about.vue | 2 +- examples/routes-transitions/pages/users.vue | 2 +- examples/static-images/pages/about.vue | 2 +- examples/with-feathers/pages/about.vue | 2 +- examples/with-sockets/pages/index.vue | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/async-data/pages/index.vue b/examples/async-data/pages/index.vue index 387a5725e5..0dd6050846 100644 --- a/examples/async-data/pages/index.vue +++ b/examples/async-data/pages/index.vue @@ -9,7 +9,7 @@ + From c3bcd0529566dca3b6e05671a4d96368930d5317 Mon Sep 17 00:00:00 2001 From: Pierre RAMBAUD Date: Wed, 15 Mar 2017 15:01:44 +0100 Subject: [PATCH 036/126] Add config file option - Add optional --config-file and -c argv parameters - Display log message if file isn't found Issue: #391 --- bin/nuxt-build | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/nuxt-build b/bin/nuxt-build index 445480b6a2..a1529fa933 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -15,13 +15,29 @@ if (process.argv.indexOf('--analyze') !== -1 || process.argv.indexOf('-a') !== - process.argv = without(process.argv, '--analyze', '-a') } +var nuxtConfigFileName = 'nuxt.config.js' +var indexOfConfig = false +if (process.argv.indexOf('--config-file') !== -1) { + indexOfConfig = process.argv.indexOf('--config-file') +} else if (process.argv.indexOf('-c') !== -1) { + indexOfConfig = process.argv.indexOf('-c') +} + +if (indexOfConfig !== false) { + nuxtConfigFileName = process.argv.slice(indexOfConfig)[1] + process.argv = without(process.argv, '--config-file', '-c', nuxtConfigFileName) +} + var rootDir = resolve(process.argv.slice(2)[0] || '.') -var nuxtConfigFile = resolve(rootDir, 'nuxt.config.js') +var nuxtConfigFilePath = resolve(rootDir, nuxtConfigFileName) var options = {} -if (fs.existsSync(nuxtConfigFile)) { - options = require(nuxtConfigFile) +if (fs.existsSync(nuxtConfigFilePath)) { + options = require(nuxtConfigFilePath) +} else { + console.log(`Could not locate ${nuxtConfigFilePath}`) // eslint-disable-line no-console } + if (typeof options.rootDir !== 'string') { options.rootDir = rootDir } From fbd1c609fd3dfe51f564bd380d813b7c6192a6e0 Mon Sep 17 00:00:00 2001 From: Pierre RAMBAUD Date: Wed, 15 Mar 2017 15:14:16 +0100 Subject: [PATCH 037/126] Add missing comments --- bin/nuxt-build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/nuxt-build b/bin/nuxt-build index a1529fa933..50dbc246b8 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -16,6 +16,8 @@ if (process.argv.indexOf('--analyze') !== -1 || process.argv.indexOf('-a') !== - } var nuxtConfigFileName = 'nuxt.config.js' + +// --config-file option var indexOfConfig = false if (process.argv.indexOf('--config-file') !== -1) { indexOfConfig = process.argv.indexOf('--config-file') @@ -28,6 +30,7 @@ if (indexOfConfig !== false) { process.argv = without(process.argv, '--config-file', '-c', nuxtConfigFileName) } +// Root directory parameter var rootDir = resolve(process.argv.slice(2)[0] || '.') var nuxtConfigFilePath = resolve(rootDir, nuxtConfigFileName) From 65eeff332e2beef59546b754a351d11d6c9035b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 16 Mar 2017 18:52:06 +0100 Subject: [PATCH 038/126] Fix hotReloading for children --- lib/app/client.js | 62 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index b85e261bbd..463fd33f9e 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -135,8 +135,6 @@ function render (to, from, next) { var promise = promisify(Component.options.asyncData, context) promise.then((asyncDataResult) => { let data = {} - // keep asyncData() result - Component._asyncDataResult = asyncDataResult // Call data() if defined if (Component.options.data && typeof Component.options.data === 'function') { data = Component.options.data() @@ -220,38 +218,61 @@ function fixPrepatch (to, ___) { }) } -// Special hot reload with data(context) +// Special hot reload with asyncData(context) function hotReloadAPI (_app) { if (!module.hot) return - const $nuxt = _app.$nuxt - if ($nuxt._hasHotReload) return - $nuxt._hasHotReload = true - var _forceUpdate = $nuxt.$forceUpdate.bind($nuxt) - $nuxt.$forceUpdate = function () { - let Component = getMatchedComponents(router.currentRoute)[0] + let $components = [] + let $nuxt = _app.$nuxt + while ($nuxt && $nuxt.$children && $nuxt.$children.length) { + $nuxt.$children.forEach(function (child, i) { + if (child.$vnode.data.nuxtChild) { + let hasAlready = false + $components.forEach(function (component) { + if (component.$options.__file === child.$options.__file) { + hasAlready = true + } + }) + if (!hasAlready) { + $components.push(child) + } + } + $nuxt = child + }) + } + $components.forEach(addHotReload.bind(_app)) +} + +function addHotReload ($component, depth) { + if ($component.$vnode.data._hasHotReload) return + $component.$vnode.data._hasHotReload = true + var _forceUpdate = $component.$forceUpdate.bind($component.$parent) + $component.$vnode.context.$forceUpdate = () => { + let Component = getMatchedComponents(router.currentRoute)[depth] if (!Component) return _forceUpdate() if (typeof Component === 'object' && !Component.options) { // Updated via vue-router resolveAsyncComponents() Component = Vue.extend(Component) Component._Ctor = Component } - _app.error() + this.error() let promises = [] - // If layout changed - Component.options.layout = Component.options.layout || 'default' - if (_app.layoutName !== Component.options.layout) { - let promise = _app.loadLayout(Component.options.layout) - promise.then(() => { - _app.setLayout(Component.options.layout) - Vue.nextTick(() => hotReloadAPI(_app)) - }) - promises.push(promise) + if (depth === 0) { + // If layout changed + Component.options.layout = Component.options.layout || 'default' + if (this.layoutName !== Component.options.layout) { + let promise = this.loadLayout(Component.options.layout) + promise.then(() => { + this.setLayout(Component.options.layout) + Vue.nextTick(() => hotReloadAPI(this)) + }) + promises.push(promise) + } } const next = function (path) { <%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %> router.push(path) } - const context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, next: next.bind(this), error: _app.error }) + const context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, next: next.bind(this), error: this.error }) // Call asyncData() let pAsyncData = promisify(Component.options.asyncData || noopData, context) pAsyncData.then((asyncDataResult) => { @@ -272,6 +293,7 @@ function hotReloadAPI (_app) { return Promise.all(promises).then(() => { <%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %> _forceUpdate() + setTimeout(() => hotReloadAPI(this), 100) }) } } From e8056f67ebcede872847725be9eb99ee49b0d0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 16 Mar 2017 18:52:38 +0100 Subject: [PATCH 039/126] Fix url starting with double slash --- lib/build.js | 3 ++- lib/generate.js | 4 ++-- lib/utils.js | 4 ++++ lib/webpack/base.config.js | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/build.js b/lib/build.js index d48bead79b..dbe7578060 100644 --- a/lib/build.js +++ b/lib/build.js @@ -11,6 +11,7 @@ import webpack from 'webpack' import serialize from 'serialize-javascript' import { createBundleRenderer } from 'vue-server-renderer' import { join, resolve, sep } from 'path' +import { isUrl } from './utils' import clientWebpackConfig from './webpack/client.config.js' import serverWebpackConfig from './webpack/server.config.js' import chalk from 'chalk' @@ -86,7 +87,7 @@ export function options () { if (this.options.build && !Array.isArray(this.options.build.loaders)) extraDefaults.loaders = defaultsLoaders if (this.options.build && !Array.isArray(this.options.build.postcss)) extraDefaults.postcss = defaultsPostcss this.options.build = _.defaultsDeep(this.options.build, defaults, extraDefaults) - if (this.options.build.publicPath.indexOf('http') === 0 && this.dev) { + if (this.dev && isUrl(this.options.build.publicPath)) { this.options.build.publicPath = defaults.publicPath } // Production, create server-renderer diff --git a/lib/generate.js b/lib/generate.js index 61bde5e933..c290eee09d 100644 --- a/lib/generate.js +++ b/lib/generate.js @@ -7,7 +7,7 @@ import pify from 'pify' import pathToRegexp from 'path-to-regexp' import _ from 'lodash' import { resolve, join, dirname, sep } from 'path' -import { promisifyRouteParams } from './utils' +import { isUrl, promisifyRouteParams } from './utils' import { minify } from 'html-minifier' const copy = pify(fs.copy) const remove = pify(fs.remove) @@ -29,7 +29,7 @@ export default function () { var srcStaticPath = resolve(this.srcDir, 'static') var srcBuiltPath = resolve(this.dir, '.nuxt', 'dist') var distPath = resolve(this.dir, this.options.generate.dir) - var distNuxtPath = join(distPath, (this.options.build.publicPath.indexOf('http') === 0 ? '_nuxt' : this.options.build.publicPath)) + var distNuxtPath = join(distPath, (isUrl(this.options.build.publicPath) ? '_nuxt' : this.options.build.publicPath)) return co(function * () { /* ** Launch build process diff --git a/lib/utils.js b/lib/utils.js index 65ab11edee..34b280bc9e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -31,6 +31,10 @@ export function urlJoin () { return [].slice.call(arguments).join('/').replace(/\/+/g, '/').replace(':/', '://') } +export function isUrl (url) { + return (url.indexOf('http') === 0 || url.indexOf('//') === 0) +} + export function promisifyRouteParams (fn) { // If routeParams[route] is an array if (Array.isArray(fn)) { diff --git a/lib/webpack/base.config.js b/lib/webpack/base.config.js index d5f22033f8..b4832f6b73 100644 --- a/lib/webpack/base.config.js +++ b/lib/webpack/base.config.js @@ -3,7 +3,7 @@ import vueLoaderConfig from './vue-loader.config' import { defaults } from 'lodash' import { join } from 'path' -import { urlJoin } from '../utils' +import { isUrl, urlJoin } from '../utils' /* |-------------------------------------------------------------------------- @@ -21,7 +21,7 @@ export default function ({ isClient, isServer }) { vendor: ['vue', 'vue-router', 'vue-meta'] }, output: { - publicPath: (this.options.build.publicPath.indexOf('http') === 0 ? this.options.build.publicPath : urlJoin(this.options.router.base, this.options.build.publicPath)) + publicPath: (isUrl(this.options.build.publicPath) ? this.options.build.publicPath : urlJoin(this.options.router.base, this.options.build.publicPath)) }, performance: { hints: (this.dev ? false : 'warning') From 11c960e3162d12be7209efba1e0715ccb05cd007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 16 Mar 2017 18:53:00 +0100 Subject: [PATCH 040/126] Upgrade vue-meta --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0593896f87..88f55a9d66 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "url-loader": "^0.5.7", "vue": "^2.2.1", "vue-loader": "^11.0.0", - "vue-meta": "^0.5.3", + "vue-meta": "^0.5.5", "vue-router": "^2.3.0", "vue-server-renderer": "^2.2.0", "vue-template-compiler": "^2.2.0", From fb7b856343f636acb73b6c65747754d65d0b0621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 16 Mar 2017 21:00:22 +0100 Subject: [PATCH 041/126] force calling middleware from error page --- lib/app/client.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/app/client.js b/lib/app/client.js index 463fd33f9e..d3882de0e8 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -71,7 +71,6 @@ function callMiddleware (Components, context, layout) { } return middleware[name] }) - if (this.$options._nuxt.err) return return promiseSeries(midd, context) } From b6856928db7e41989ceb2505bd05d2f60589c62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 17 Mar 2017 18:02:58 +0100 Subject: [PATCH 042/126] Dynamic layout feature --- lib/app/client.js | 136 ++++++++++++++++++++++++++++++---------------- lib/app/server.js | 24 ++++++-- 2 files changed, 109 insertions(+), 51 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index d3882de0e8..8a04cc59c8 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -55,22 +55,28 @@ function loadAsyncComponents (to, from, next) { } function callMiddleware (Components, context, layout) { - // Call middleware + // if layout is undefined, only call global middleware let midd = <%= serialize(router.middleware, { isJSON: true }) %> - if (layout.middleware) { - midd = midd.concat(layout.middleware) - } - Components.forEach((Component) => { - if (Component.options.middleware) { - midd = midd.concat(Component.options.middleware) + let unknownMiddleware = false + if (typeof layout !== 'undefined') { + midd = [] // exclude global middleware if layout defined (already called before) + if (layout.middleware) { + midd = midd.concat(layout.middleware) } - }) + Components.forEach((Component) => { + if (Component.options.middleware) { + midd = midd.concat(Component.options.middleware) + } + }) + } midd = midd.map((name) => { if (typeof middleware[name] !== 'function') { + unknownMiddleware = true this.error({ statusCode: 500, message: 'Unknown middleware ' + name }) } return middleware[name] }) + if (unknownMiddleware) return return promiseSeries(midd, context) } @@ -81,13 +87,15 @@ function render (to, from, next) { nextCalled = true next(path) } - const context = getContext({ to<%= (store ? ', store' : '') %>, isClient: true, next: _next.bind(this), error: this.error.bind(this) }) + let context = getContext({ to<%= (store ? ', store' : '') %>, isClient: true, next: _next.bind(this), error: this.error.bind(this) }) let Components = getMatchedComponents(to) + this._context = context this._dateLastError = this.$options._nuxt.dateErr this._hadError = !!this.$options._nuxt.err if (!Components.length) { // Default layout - this.loadLayout(NuxtError.layout) + callMiddleware.call(this, Components, context) + .then(() => this.loadLayout(typeof NuxtError.layout === 'function' ? NuxtError.layout(context) : NuxtError.layout)) .then(callMiddleware.bind(this, Components, context)) .then(() => { this.error({ statusCode: 404, message: 'This page could not be found.' }) @@ -105,7 +113,14 @@ function render (to, from, next) { this.setTransitions(mapTransitions(Components, to, from)) let nextCalled = false // Set layout - this.loadLayout(Components[0].options.layout) + callMiddleware.call(this, Components, context) + .then(() => { + let layout = Components[0].options.layout + if (typeof layout === 'function') { + layout = layout(context) + } + return this.loadLayout(layout) + }) .then(callMiddleware.bind(this, Components, context)) .then(() => { // Pass validation? @@ -169,7 +184,11 @@ function render (to, from, next) { .catch((error) => { _lastPaths = [] error.statusCode = error.statusCode || error.status || (error.response && error.response.status) || 500 - this.loadLayout(NuxtError.layout) + let layout = NuxtError.layout + if (typeof layout === 'function') { + layout = layout(context) + } + this.loadLayout(layout) .then(() => { this.error(error) next(false) @@ -211,7 +230,11 @@ function fixPrepatch (to, ___) { this.error() } // Set layout - this.setLayout(this.$options._nuxt.err ? NuxtError.layout : to.matched[0].components.default.options.layout) + let layout = this.$options._nuxt.err ? NuxtError.layout : to.matched[0].components.default.options.layout + if (typeof layout === 'function') { + layout = layout(this._context) + } + this.setLayout(layout) // hot reloading Vue.nextTick(() => hotReloadAPI(this)) }) @@ -246,7 +269,8 @@ function addHotReload ($component, depth) { $component.$vnode.data._hasHotReload = true var _forceUpdate = $component.$forceUpdate.bind($component.$parent) $component.$vnode.context.$forceUpdate = () => { - let Component = getMatchedComponents(router.currentRoute)[depth] + let Components = getMatchedComponents(router.currentRoute) + let Component = Components[depth] if (!Component) return _forceUpdate() if (typeof Component === 'object' && !Component.options) { // Updated via vue-router resolveAsyncComponents() @@ -255,41 +279,51 @@ function addHotReload ($component, depth) { } this.error() let promises = [] - if (depth === 0) { - // If layout changed - Component.options.layout = Component.options.layout || 'default' - if (this.layoutName !== Component.options.layout) { - let promise = this.loadLayout(Component.options.layout) - promise.then(() => { - this.setLayout(Component.options.layout) - Vue.nextTick(() => hotReloadAPI(this)) - }) - promises.push(promise) - } - } const next = function (path) { <%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %> router.push(path) } - const context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, next: next.bind(this), error: this.error }) - // Call asyncData() - let pAsyncData = promisify(Component.options.asyncData || noopData, context) - pAsyncData.then((asyncDataResult) => { - let data = (typeof Component.options.data === 'function' ? Component.options.data() : noopData()) - data = Object.assign(data, asyncDataResult) - Component.options.data = () => data - Component._Ctor.options.data = Component.options.data - <%= (loading ? 'this.$loading.increase && this.$loading.increase(30)' : '') %> - }) - promises.push(pAsyncData) - // Call fetch() - Component.options.fetch = Component.options.fetch || noopFetch - let pFetch = Component.options.fetch(context) - if (!(pFetch instanceof Promise)) { pFetch = Promise.resolve(pFetch) } - <%= (loading ? 'pFetch.then(() => this.$loading.increase && this.$loading.increase(30))' : '') %> - promises.push(pFetch) + let context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, next: next.bind(this), error: this.error }) <%= (loading ? 'this.$loading.start && this.$loading.start()' : '') %> - return Promise.all(promises).then(() => { + callMiddleware.call(this, Components, context) + .then(() => { + // If layout changed + if (depth !== 0) return Promise.resolve() + let layout = Component.options.layout || 'default' + if (typeof layout === 'function') { + layout = layout(context) + } + if (this.layoutName === layout) return Promise.resolve() + let promise = this.loadLayout(layout) + promise.then(() => { + this.setLayout(layout) + Vue.nextTick(() => hotReloadAPI(this)) + }) + return promise + }) + .then(() => { + return callMiddleware.call(this, Components, context, this.layout) + }) + .then(() => { + // Call asyncData() + let pAsyncData = promisify(Component.options.asyncData || noopData, context) + pAsyncData.then((asyncDataResult) => { + let data = (typeof Component.options.data === 'function' ? Component.options.data() : noopData()) + data = Object.assign(data, asyncDataResult) + Component.options.data = () => data + Component._Ctor.options.data = Component.options.data + <%= (loading ? 'this.$loading.increase && this.$loading.increase(30)' : '') %> + }) + promises.push(pAsyncData) + // Call fetch() + Component.options.fetch = Component.options.fetch || noopFetch + let pFetch = Component.options.fetch(context) + if (!(pFetch instanceof Promise)) { pFetch = Promise.resolve(pFetch) } + <%= (loading ? 'pFetch.then(() => this.$loading.increase && this.$loading.increase(30))' : '') %> + promises.push(pFetch) + return Promise.all(promises) + }) + .then(() => { <%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %> _forceUpdate() setTimeout(() => hotReloadAPI(this), 100) @@ -352,10 +386,18 @@ Promise.all(resolveComponents) .then((Components) => { const _app = new Vue(app) - let layout = Components.length ? Components[0].options.layout : NuxtError.layout - return _app.loadLayout(layout) + let context = getContext({ to: router.currentRoute, isClient: true }) + let layoutName = 'default' + return callMiddleware.call(_app, Components, context) .then(() => { - _app.setLayout(layout) + layoutName = Components.length ? Components[0].options.layout : NuxtError.layout + if (typeof layoutName === 'function') { + layoutName = layoutName(context) + } + return _app.loadLayout(layoutName) + }) + .then(() => { + _app.setLayout(layoutName) return { _app, Components } }) }) diff --git a/lib/app/server.js b/lib/app/server.js index 1bdae940ec..16965bf96a 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -50,7 +50,7 @@ export default context => { context.error = _app.$options._nuxt.error.bind(_app) <%= (isDev ? 'const s = isDev && Date.now()' : '') %> - const ctx = getContext(context) + let ctx = getContext(context) let Components = getMatchedComponents(context.route) <% if (store) { %> let promise = (store._actions && store._actions.nuxtServerInit ? store.dispatch('nuxtServerInit', omit(getContext(context), 'redirect', 'error')) : null) @@ -72,12 +72,28 @@ export default context => { } return Component }) + // Call global middleware (nuxt.config.js) + let midd = <%= serialize(router.middleware, { isJSON: true }) %> + midd = midd.map((name) => { + if (typeof middleware[name] !== 'function') { + context.nuxt.error = context.error({ statusCode: 500, message: 'Unknown middleware ' + name }) + } + return middleware[name] + }) + if (context.nuxt.error) return + return promiseSeries(midd, ctx) + }) + .then(() => { // Set layout - return _app.setLayout(Components.length ? Components[0].options.layout : NuxtError.layout) + let layout = Components.length ? Components[0].options.layout : NuxtError.layout + if (typeof layout === 'function') { + layout = layout(ctx) + } + return _app.setLayout(layout) }) .then((layout) => { - // Call middleware - let midd = <%= serialize(router.middleware, { isJSON: true }) %> + // Call middleware (layout + pages) + let midd = [] if (layout.middleware) { midd = midd.concat(layout.middleware) } From 0a9477dc7b14c8595f76ac797a4e519bcdad5d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 17 Mar 2017 18:03:12 +0100 Subject: [PATCH 043/126] Dynamic layouts example --- examples/dynamic-layouts/README.md | 3 ++ examples/dynamic-layouts/layouts/error.vue | 25 ++++++++++++ examples/dynamic-layouts/layouts/mobile.vue | 37 ++++++++++++++++++ examples/dynamic-layouts/middleware/mobile.js | 4 ++ examples/dynamic-layouts/nuxt.config.js | 10 +++++ examples/dynamic-layouts/package.json | 11 ++++++ examples/dynamic-layouts/pages/about.vue | 17 ++++++++ examples/dynamic-layouts/pages/index.vue | 12 ++++++ examples/dynamic-layouts/static/logo.png | Bin 0 -> 4252 bytes 9 files changed, 119 insertions(+) create mode 100644 examples/dynamic-layouts/README.md create mode 100644 examples/dynamic-layouts/layouts/error.vue create mode 100644 examples/dynamic-layouts/layouts/mobile.vue create mode 100644 examples/dynamic-layouts/middleware/mobile.js create mode 100644 examples/dynamic-layouts/nuxt.config.js create mode 100644 examples/dynamic-layouts/package.json create mode 100644 examples/dynamic-layouts/pages/about.vue create mode 100644 examples/dynamic-layouts/pages/index.vue create mode 100644 examples/dynamic-layouts/static/logo.png diff --git a/examples/dynamic-layouts/README.md b/examples/dynamic-layouts/README.md new file mode 100644 index 0000000000..baba1117a5 --- /dev/null +++ b/examples/dynamic-layouts/README.md @@ -0,0 +1,3 @@ +# Dynamic Layouts + +https://nuxtjs.org/examples/layouts diff --git a/examples/dynamic-layouts/layouts/error.vue b/examples/dynamic-layouts/layouts/error.vue new file mode 100644 index 0000000000..3ba6fabb69 --- /dev/null +++ b/examples/dynamic-layouts/layouts/error.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/examples/dynamic-layouts/layouts/mobile.vue b/examples/dynamic-layouts/layouts/mobile.vue new file mode 100644 index 0000000000..db8735a00e --- /dev/null +++ b/examples/dynamic-layouts/layouts/mobile.vue @@ -0,0 +1,37 @@ + + + diff --git a/examples/dynamic-layouts/middleware/mobile.js b/examples/dynamic-layouts/middleware/mobile.js new file mode 100644 index 0000000000..276889f41d --- /dev/null +++ b/examples/dynamic-layouts/middleware/mobile.js @@ -0,0 +1,4 @@ +export default function (ctx) { + let userAgent = ctx.req ? ctx.req.headers['user-agent'] : navigator.userAgent + ctx.isMobile = /mobile/i.test(userAgent) +} diff --git a/examples/dynamic-layouts/nuxt.config.js b/examples/dynamic-layouts/nuxt.config.js new file mode 100644 index 0000000000..ab913e20b1 --- /dev/null +++ b/examples/dynamic-layouts/nuxt.config.js @@ -0,0 +1,10 @@ +module.exports = { + head: { + meta: [ + { content: 'width=device-width,initial-scale=1', name: 'viewport' } + ] + }, + router: { + middleware: ['mobile'] + } +} diff --git a/examples/dynamic-layouts/package.json b/examples/dynamic-layouts/package.json new file mode 100644 index 0000000000..cd97f88ca2 --- /dev/null +++ b/examples/dynamic-layouts/package.json @@ -0,0 +1,11 @@ +{ + "name": "nuxt-dynamic-layouts", + "dependencies": { + "nuxt": "latest" + }, + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt start" + } +} diff --git a/examples/dynamic-layouts/pages/about.vue b/examples/dynamic-layouts/pages/about.vue new file mode 100644 index 0000000000..8ed01c381f --- /dev/null +++ b/examples/dynamic-layouts/pages/about.vue @@ -0,0 +1,17 @@ + + + diff --git a/examples/dynamic-layouts/pages/index.vue b/examples/dynamic-layouts/pages/index.vue new file mode 100644 index 0000000000..4095e47a00 --- /dev/null +++ b/examples/dynamic-layouts/pages/index.vue @@ -0,0 +1,12 @@ + + + diff --git a/examples/dynamic-layouts/static/logo.png b/examples/dynamic-layouts/static/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..7f238b598c85d618ae0c601fec86455a2a1ed4e1 GIT binary patch literal 4252 zcmV;N5M%F&P)g` zMQS+^rII|YPa_znyK06zSH+#;sbvrYPbJ-$aIST{pJ152GFi-#g|FGax5DoN-#l6N znP8Z{O75z3{VsQE_oQAM(2rSB>QQRU zvXfygeLVz&U3Iqn8=TBG#8!!K*Cbf&uJ(bxb!UbDitto?d`>X@x=IFHmdF0)s+QTt zz*EWA#-FYm>9*QezkPnmi1MbyzC2lAUPBGRV5^K~6WASrA#4Kx-Mos5-dd~{>#wS~ zrQTH$#1{KL(I(eyzbDhOLkO36Hu;a2~U~Gh7 zn4s?0CQ+*2Co>X>_szN1Nor_(Z1>d@PC@}40}z-KH{!k$41cfY(cbk5XTjh_#Q=Qm z&g9Fz+KE53?<6R}|2Q206qpk$PKMWacMuH!Q}U7zwoR(-S$(Z4#`=HN*weM@R0Qor z`g=n}zJ6e_SO|vSE4QyJ((JlQt~7x9X;LQ>OUOTV_q;~0Cm5`sTJt$-se=G$ zizeQ8c~V#9?`RDMk9(JxlePk#gy3~{%0kD`ryJRoa)qm+VQ^HSpN?kS2CLa0X!9~y zA^~L+0F<*xu=#?tdw6g`W4KloYily2o7dM(S;OOFTQAC-L;~9Y=(GB~^4-G405eXT zCKcVhrd|<$c@mD#{IaoI99>E6UNwo)P4p~V2T7k zzhg3+7aWGv?rM6*i9z4xi&S!_WA2RQ``CWo9GO273AWfTp}c5eVHh{+k7wS6`5HFG zDL5B`87uZPR_M~Z;KS>&_!jIgc0Z$V%< zU!jDXRBVb>@SY2q8xJv70S3Pdw1v}QH`Imz%a4Isn6fy@phck>X#!@3j-uSt!OyMBKL_fZ7nEw~s)IH%~C+^))O387J0O0K?hY+Y?R&JH-wJ=G6~rR&!;Rir z5}<)lXEh-4J~wS{W9Zk7?oPexg4ZC$D>x?tkQu;Pz3C7~=!-V1g#wV}^^Oe9VGKAk zPN*1#>l-m^>tWi7gw_xskZ{1fUQ&OUs~BoWx>jS&IN?-ahX`n`fZh=64pN~4q=o<~ z>CzLS)g7&K4+F?J!Bg+pO{&YoNaosuG?VI3L+m@ok@};iq+ze_na$=oh9RxHdJ)Vx zvC7HKoz@DDi|vn=l2SjFR9QTiFo2BH4P=~3%#)dWImE`^0?oW`cOWI@AG&#FT&JBg z7~V8zpk(6}( zIZ?-8{~W+@u|kD^ee_Di+;o_+3Lgf?Q&R8KUtiC53}u6DE8GT>eG=;z1_12Lv-mUHg=QxOvv0|JLAM^UJo31z`TN6j=c-Pm`m=l;Y&KQNW zzzep*G-(Y?NfAiE7op@fRL?vHo!RJ<^9cJR@-8>R7^{#>Du#vta|k^p<$FH3qB9z1 z7{k}rLi`!$HyP`o8@fTlK!VLjPf10BPx%=$iD6Jb2Hx`Jg8jD0$v{lU5&Ep&jBZ{< zg6)^({bM6DhT%?40$YVU<9sV-Zaa*_q)ux}dL!=3%wVV=?FR4n!k=-52^h;}hyh%g zIFynuKN(ir)jr)AEEbEn_$~h1B9EdN=ou#tVMs~Ai%>xHJFOTpdTPJ{g7+RLkdv1u z{;4osDJf{6wCb|y!=N?k-LvlDe-Q6VDE^T!y(#I@+u%hgx@p4jwmAoP#wq`iaqc^Y z#iZg(Nj)5R#P3yB@^oP6)(&q=zJ&cACr2JI6UPz$lyu{HN!QTelw-JDsmA{x-fIza z^C7G!68@AF!;4UGVW=2tTN!tfr^20a2J+!;ky$2qmsEg60+`pu(ZS`dO}H`8GR~0v z7x**Idl8H^*w#n*XZ0QjUWDQu@bsn$rli<0#B`K$)Dm!q5DW%9QcJmCC5*$z|FvY# zzn1TvrCPR^YvJsRe+6U?4>>5DcUU27;ltf6#$Ui#oOk#&Vtga!m?`n1%7^MRh>?!$A+P%p=HHx{-wJw(XPMc z6z%kgsHvayHM5Pa9lR}WSMR@e0K>f(pPV-wsj8cJbrX~FU+%7f%aR_5{*=#J+qU(r zv2EM7xwdVOZQHhSzPo4rM(JhutHn$^>6=t;-O5QPZ{un{eNAmmq~N##PJyTHOVI_l&f;}LqIsSwGt>_0!cZr@Qrc)|LK}jWAl9PY*j~E*O1LVf_hgBAC7Z}+2qGI%iVR&Rz z)6(;wjjWin*Jr;Ks-th~^Vf!BL9vwAoXjaK0}KwnQ9lRSq?FA&Yi ziTbH9z-k(rcJQ>&fKsyZXCG!zDHRjf!J%Qg!+=o;p02L3WeZDV^#KJi0s6xLd+f|h8_HVB-MxMEhXLjpdIH6;@d}^1 zPFP1*&oLDB_xw zDkd&)N9Jz9z=rWKz-k+scks2B?~x>D=F=aBx2nwg!^*&bt8UTuj>0k@2H3r)3Gaw` zM;HBJsBdaTyTOI(=5AwSe%i z0S0Yj%>l)YM^#HIYRF+ItEyYMPfo|$>kG^jt~a$MR3PuyTxxabi@XR)`HF_ z(y>LzLKrciBvRSKq2Uo#Q&%*dGgt339|o!9iAWcn{dr;r2@J5f3pWu`d52S5c><9N z?i><-kvx7@HgTS+V?$Miwz}q^65b}$VUSKGF5V#o6@ed!KYwdZ7+Tvq;jh;mP$Cx< zkSm5O+rrkUBgg|{@K|?Pc{59WCLR0s<5y5vxf+%bjAaJ~n0NST_*`p`(1=r4!At^%mICtu)w|@YR3xw*{!x=x!4UP?k6+O~9AZAjQV1QyH z(X(5;QwSb{hBhY*P|oopkT>S2S!K-j0@-$MElF4wMGWQmL+Qk~#rdKa2MW+0kuLmq=?<2f0b&t)Usn&c>4+F1(TxyK zP%YEQ=vY}*ZE98lh%cgFMCK$@5T*1LB&P6Ysa^#+fRg%+fi1VF> Date: Fri, 17 Mar 2017 18:52:36 +0100 Subject: [PATCH 044/126] Use empty array if routes not given --- lib/generate.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/generate.js b/lib/generate.js index 7587d6ff90..99ee140463 100644 --- a/lib/generate.js +++ b/lib/generate.js @@ -52,11 +52,12 @@ export default function () { }) .then(() => { // Resolve config.generate.routes promises before generating the routes - return promisifyRoute(this.options.generate.routes) + return promisifyRoute(this.options.generate.routes || []) .catch((e) => { - console.error(`Could not resolve routes`) // eslint-disable-line no-console + console.error('Could not resolve routes') // eslint-disable-line no-console console.error(e) // eslint-disable-line no-console process.exit(1) + throw e }) }) .then((generateRoutes) => { From 3fcfe4e026c65d744f60b7db0cf7993390b6280f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 17 Mar 2017 18:52:46 +0100 Subject: [PATCH 045/126] Fix tests --- test/basic.fail.generate.test.js | 38 +++++------------------------- test/fixtures/basic/nuxt.config.js | 12 ++++------ test/utils.test.js | 20 ++++++++-------- 3 files changed, 21 insertions(+), 49 deletions(-) diff --git a/test/basic.fail.generate.test.js b/test/basic.fail.generate.test.js index 034a6f3365..9750e812f3 100644 --- a/test/basic.fail.generate.test.js +++ b/test/basic.fail.generate.test.js @@ -1,42 +1,16 @@ import test from 'ava' import { resolve } from 'path' -test('Fail to generate without routeParams', t => { - const Nuxt = require('../') - const options = { - rootDir: resolve(__dirname, 'fixtures/basic'), - dev: false - // no generate.routeParams - } - const nuxt = new Nuxt(options) - return new Promise((resolve) => { - var oldExit = process.exit - var oldCE = console.error // eslint-disable-line no-console - var _log = '' - console.error = (s) => { _log += s } // eslint-disable-line no-console - process.exit = (code) => { - process.exit = oldExit - console.error = oldCE // eslint-disable-line no-console - t.is(code, 1) - t.true(_log.includes('Could not generate the dynamic route /users/:id')) - resolve() - } - nuxt.generate() - }) -}) - -test('Fail with routeParams which throw an error', t => { +test('Fail with routes() which throw an error', t => { const Nuxt = require('../') const options = { rootDir: resolve(__dirname, 'fixtures/basic'), dev: false, generate: { - routeParams: { - '/users/:id': function () { - return new Promise((resolve, reject) => { - reject('Not today!') - }) - } + routes: function () { + return new Promise((resolve, reject) => { + reject('Not today!') + }) } } } @@ -50,7 +24,7 @@ test('Fail with routeParams which throw an error', t => { process.exit = oldExit console.error = oldCE // eslint-disable-line no-console t.is(code, 1) - t.true(_log.includes('Could not resolve routeParams[/users/:id]')) + t.true(_log.includes('Could not resolve routes')) resolve() } nuxt.generate() diff --git a/test/fixtures/basic/nuxt.config.js b/test/fixtures/basic/nuxt.config.js index 13d5d0cef5..19c0433cab 100644 --- a/test/fixtures/basic/nuxt.config.js +++ b/test/fixtures/basic/nuxt.config.js @@ -1,11 +1,9 @@ module.exports = { generate: { - routeParams: { - '/users/:id?': [ - { id: 1 }, - { id: 2 }, - { id: 3 } - ] - } + routes: [ + '/users/1', + '/users/2', + '/users/3' + ] } } diff --git a/test/utils.test.js b/test/utils.test.js index e7421a0bb2..3b80dc2c70 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -37,9 +37,9 @@ test('urlJoin', t => { t.is(utils.urlJoin('test', '/about'), 'test/about') }) -test('promisifyRouteParams (array)', t => { +test('promisifyRoute (array)', t => { const array = [1] - const promise = utils.promisifyRouteParams(array) + const promise = utils.promisifyRoute(array) t.is(typeof promise, 'object') return promise .then((res) => { @@ -47,12 +47,12 @@ test('promisifyRouteParams (array)', t => { }) }) -test('promisifyRouteParams (fn => array)', t => { +test('promisifyRoute (fn => array)', t => { const array = [1, 2] const fn = function () { return array } - const promise = utils.promisifyRouteParams(fn) + const promise = utils.promisifyRoute(fn) t.is(typeof promise, 'object') return promise .then((res) => { @@ -60,14 +60,14 @@ test('promisifyRouteParams (fn => array)', t => { }) }) -test('promisifyRouteParams (fn => promise)', t => { +test('promisifyRoute (fn => promise)', t => { const array = [1, 2, 3] const fn = function () { return new Promise((resolve) => { resolve(array) }) } - const promise = utils.promisifyRouteParams(fn) + const promise = utils.promisifyRoute(fn) t.is(typeof promise, 'object') return promise .then((res) => { @@ -75,11 +75,11 @@ test('promisifyRouteParams (fn => promise)', t => { }) }) -test('promisifyRouteParams (fn(cb) with error)', t => { +test('promisifyRoute (fn(cb) with error)', t => { const fn = function (cb) { cb('Error here') } - const promise = utils.promisifyRouteParams(fn) + const promise = utils.promisifyRoute(fn) t.is(typeof promise, 'object') return promise .catch((e) => { @@ -87,12 +87,12 @@ test('promisifyRouteParams (fn(cb) with error)', t => { }) }) -test('promisifyRouteParams (fn(cb) with result)', t => { +test('promisifyRoute (fn(cb) with result)', t => { const array = [1, 2, 3, 4] const fn = function (cb) { cb(null, array) } - const promise = utils.promisifyRouteParams(fn) + const promise = utils.promisifyRoute(fn) t.is(typeof promise, 'object') return promise .then((res) => { From c0ae85e53b3c51f09089308f5d16283cc4519475 Mon Sep 17 00:00:00 2001 From: Espen Bratberg Date: Sun, 19 Mar 2017 08:17:32 +0100 Subject: [PATCH 046/126] Update with-vuetify example with theme overrides --- examples/with-vuetify/README.md | 4 +++- examples/with-vuetify/css/app.styl | 1 + examples/with-vuetify/css/vendor/vuetify.styl | 14 ++++++++++++++ examples/with-vuetify/layouts/default.vue | 6 ------ examples/with-vuetify/nuxt.config.js | 13 ++++++++++++- examples/with-vuetify/package.json | 4 ++++ examples/with-vuetify/pages/index.vue | 9 +++++++-- 7 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 examples/with-vuetify/css/app.styl create mode 100644 examples/with-vuetify/css/vendor/vuetify.styl delete mode 100644 examples/with-vuetify/layouts/default.vue diff --git a/examples/with-vuetify/README.md b/examples/with-vuetify/README.md index 4873ceb77b..04bf622643 100644 --- a/examples/with-vuetify/README.md +++ b/examples/with-vuetify/README.md @@ -1,4 +1,6 @@ # Using Vuetify.js with Nuxt.js -https://nuxtjs.org/examples/with-vuetify +https://nuxtjs.org/examples/with-vuetify
https://vuetifyjs.com/ + +*NOTE: Some Vuetify components needs Vue v2.2.x (or later) to work properly (Nuxt currently uses v2.1.x)* diff --git a/examples/with-vuetify/css/app.styl b/examples/with-vuetify/css/app.styl new file mode 100644 index 0000000000..0b24ada921 --- /dev/null +++ b/examples/with-vuetify/css/app.styl @@ -0,0 +1 @@ +@require './vendor/vuetify.styl' diff --git a/examples/with-vuetify/css/vendor/vuetify.styl b/examples/with-vuetify/css/vendor/vuetify.styl new file mode 100644 index 0000000000..6865590deb --- /dev/null +++ b/examples/with-vuetify/css/vendor/vuetify.styl @@ -0,0 +1,14 @@ +// Specify overrides (theme and/or base variables etc.) +// See https://vuetifyjs.com/quick-start +$theme := { + primary: #9c27b0 + accent: #ce93d8 + secondary: #424242 + info: #0D47A1 + warning: #ffb300 + error: #B71C1C + success: #2E7D32 +} + +// Import Vuetify styling +@require '~vuetify/src/stylus/main.styl' diff --git a/examples/with-vuetify/layouts/default.vue b/examples/with-vuetify/layouts/default.vue deleted file mode 100644 index 3f33e63651..0000000000 --- a/examples/with-vuetify/layouts/default.vue +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/examples/with-vuetify/nuxt.config.js b/examples/with-vuetify/nuxt.config.js index bd26adf454..9edc6811ef 100644 --- a/examples/with-vuetify/nuxt.config.js +++ b/examples/with-vuetify/nuxt.config.js @@ -1,7 +1,18 @@ + +const { join } = require('path') + module.exports = { build: { vendor: ['vuetify'] }, plugins: ['~plugins/vuetify.js'], - css: ['vuetify/dist/vuetify.min.css'] + css: [ + { src: join(__dirname, 'css/app.styl'), lang: 'styl' } + ], + head: { + link: [ + { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto' }, + { rel: 'stylesheet', href: 'https://fonts.googleapis.com/icon?family=Material+Icons' } + ] + } } diff --git a/examples/with-vuetify/package.json b/examples/with-vuetify/package.json index 0ee9083525..908878ba03 100644 --- a/examples/with-vuetify/package.json +++ b/examples/with-vuetify/package.json @@ -8,5 +8,9 @@ "dev": "nuxt", "build": "nuxt build", "start": "nuxt start" + }, + "devDependencies": { + "stylus": "^0.54.5", + "stylus-loader": "^3.0.1" } } diff --git a/examples/with-vuetify/pages/index.vue b/examples/with-vuetify/pages/index.vue index 5aeb83257a..8551eaff81 100644 --- a/examples/with-vuetify/pages/index.vue +++ b/examples/with-vuetify/pages/index.vue @@ -16,7 +16,12 @@ -
Main Content
+
+

Main content

+ Primary button + Secondary button + Success button +
@@ -33,7 +38,7 @@ } - From 8831331e3d724529dea8188033465769a199d0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 16:52:18 +0100 Subject: [PATCH 075/126] Fix hot reloading --- lib/app/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/client.js b/lib/app/client.js index d5fdba931b..1facab26b2 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -236,7 +236,7 @@ function fixPrepatch (to, ___) { } this.setLayout(layout) // hot reloading - Vue.nextTick(() => hotReloadAPI(this)) + setTimeout(() => hotReloadAPI(this), 100) }) } From 954c25b4200b1a00225576068a5afa3211420299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 18:21:50 +0100 Subject: [PATCH 076/126] Upgrade vue-loader --- TODO.md | 37 ------------------------------------- package.json | 2 +- yarn.lock | 6 +++--- 3 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 TODO.md diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 628ba948ea..0000000000 --- a/TODO.md +++ /dev/null @@ -1,37 +0,0 @@ -Tasks for `0.9.10`: -- [x] `build.publicPath` #25 -- [x] Use [name].[chunkhash].js for generated js (production) #218 -- [x] Add expired headers (production) -- [x] Activate layout only on afterEach #214 -- [x] Custom layout in layouts/error.vue #172 -- [x] Add Doc for build.filenames, performance.gzip and performance.prefetch -- [ ] Fork preload-webpack-plugin and use it in package.json -- [ ] Test + Coverage performance, cache, filenames -- [ ] Manual tests on router.base & publicPath -- [ ] asyncData, fetch, transition, validate, scrollToTop can be in mixins and extend (super) - --> Not possible to have custom layout for a page, it should do the condition inside the layout itself (because of the middleware strategy) - - -Release: - -## Deprecated -- `process.BROWSER_BUILD` is deprecated in favour of `process.browser` (`BROWSER_BUILD` will be removed for the 1.0) -- `process.SERVER_BUILD` is deprecated in favour of `process.server` (`SERVER_BUILD` will be removed for the 1.0) - -## Define `plugins` only for client-side - -Some Vue plugins might only work for client-side, you can now use an `Object` instead of a string to use a plugin only for client-side: - -`nuxt.config.js` -```js -module.exports = { - plugins: [ - '~plugins/client-and-server.js', - { - src: '~plugins/only-client-side.js', - ssr: false // disable for server-side - } - ] -} -``` diff --git a/package.json b/package.json index 4d26a4e693..1dcd8a050a 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "serve-static": "^1.12.1", "url-loader": "^0.5.8", "vue": "^2.2.5", - "vue-loader": "^11.3.2", + "vue-loader": "^11.3.3", "vue-meta": "^0.5.5", "vue-router": "^2.3.0", "vue-server-renderer": "^2.2.5", diff --git a/yarn.lock b/yarn.lock index 9af17fcb8a..c5aca49468 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5743,9 +5743,9 @@ vue-hot-reload-api@^2.0.11: version "2.0.11" resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.0.11.tgz#bf26374fb73366ce03f799e65ef5dfd0e28a1568" -vue-loader@^11.3.2: - version "11.3.2" - resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-11.3.2.tgz#08bb99446222e223d1e01e6228221acf1bcc95c9" +vue-loader@^11.3.3: + version "11.3.3" + resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-11.3.3.tgz#045d27afacf70c58889d46debe4adf6d67ec8cf3" dependencies: consolidate "^0.14.0" hash-sum "^1.0.2" From 184bd01b2b7aecc8e3a866d008889b078c8e9c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 18:35:30 +0100 Subject: [PATCH 077/126] Coverage for template and publicPath --- test/fixtures/with-config/app.html | 10 ++++++++++ test/fixtures/with-config/nuxt.config.js | 6 +++++- test/fixtures/with-config/plugins/only-client.js | 1 + test/with-config.test.js | 10 ++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/with-config/app.html create mode 100644 test/fixtures/with-config/plugins/only-client.js diff --git a/test/fixtures/with-config/app.html b/test/fixtures/with-config/app.html new file mode 100644 index 0000000000..86e25a09a2 --- /dev/null +++ b/test/fixtures/with-config/app.html @@ -0,0 +1,10 @@ + + + + {{ HEAD }} + + + {{ APP }} +

Made by Nuxt.js team

+ + diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 41cf46a770..73780c0666 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -10,7 +10,10 @@ module.exports = { } }, cache: true, - plugins: ['~plugins/test.js'], + plugins: [ + '~plugins/test.js', + { src: '~plugins/only-client.js', ssr: false } + ], loading: '~components/loading', env: { bool: true, @@ -18,6 +21,7 @@ module.exports = { string: 'Nuxt.js' }, build: { + publicPath: '/orion/', analyze: { analyzerMode: 'disabled', generateStatsFile: true diff --git a/test/fixtures/with-config/plugins/only-client.js b/test/fixtures/with-config/plugins/only-client.js new file mode 100644 index 0000000000..12ee6becab --- /dev/null +++ b/test/fixtures/with-config/plugins/only-client.js @@ -0,0 +1 @@ +console.log('Only called in client-side!') diff --git a/test/with-config.test.js b/test/with-config.test.js index 754f92c0d3..13b50b7452 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -24,6 +24,16 @@ test('/', async t => { t.true(html.includes('

I have custom configurations

')) }) +test('/ (custom app.html)', async t => { + const { html } = await nuxt.renderRoute('/') + t.true(html.includes('

Made by Nuxt.js team

')) +}) + +test('/ (custom build.publicPath)', async t => { + const { html } = await nuxt.renderRoute('/') + t.true(html.includes('src="/test/orion/vendor.bundle')) +}) + test('/test/ (router base)', async t => { const window = await nuxt.renderAndGetWindow(url('/test/')) const html = window.document.body.innerHTML From 05c6dd958cd6a708dd8ac05aab85117b8b547836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 18:46:18 +0100 Subject: [PATCH 078/126] Use CDN url for publicPath --- test/fixtures/with-config/nuxt.config.js | 2 +- test/with-config.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 73780c0666..67d083887a 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -21,7 +21,7 @@ module.exports = { string: 'Nuxt.js' }, build: { - publicPath: '/orion/', + publicPath: 'https://cdn.nuxtjs.org', analyze: { analyzerMode: 'disabled', generateStatsFile: true diff --git a/test/with-config.test.js b/test/with-config.test.js index 13b50b7452..7f00f135e0 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -31,7 +31,7 @@ test('/ (custom app.html)', async t => { test('/ (custom build.publicPath)', async t => { const { html } = await nuxt.renderRoute('/') - t.true(html.includes('src="/test/orion/vendor.bundle')) + t.true(html.includes('src="https://cdn.nuxtjs.org/vendor.bundle')) }) test('/test/ (router base)', async t => { From 4431dfa368704c4f8f0dda06a1dc63b2cabfbea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 18:54:54 +0100 Subject: [PATCH 079/126] revert to no-cdn publicPath --- lib/build.js | 1 + test/fixtures/with-config/nuxt.config.js | 2 +- test/with-config.test.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/build.js b/lib/build.js index b7c2c9cf3d..64b79d3675 100644 --- a/lib/build.js +++ b/lib/build.js @@ -84,6 +84,7 @@ export function options () { if (this.options.build && !Array.isArray(this.options.build.loaders)) extraDefaults.loaders = defaultsLoaders if (this.options.build && !Array.isArray(this.options.build.postcss)) extraDefaults.postcss = defaultsPostcss this.options.build = _.defaultsDeep(this.options.build, defaults, extraDefaults) + /* istanbul ignore if */ if (this.dev && isUrl(this.options.build.publicPath)) { this.options.build.publicPath = defaults.publicPath } diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 67d083887a..73780c0666 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -21,7 +21,7 @@ module.exports = { string: 'Nuxt.js' }, build: { - publicPath: 'https://cdn.nuxtjs.org', + publicPath: '/orion/', analyze: { analyzerMode: 'disabled', generateStatsFile: true diff --git a/test/with-config.test.js b/test/with-config.test.js index 7f00f135e0..13b50b7452 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -31,7 +31,7 @@ test('/ (custom app.html)', async t => { test('/ (custom build.publicPath)', async t => { const { html } = await nuxt.renderRoute('/') - t.true(html.includes('src="https://cdn.nuxtjs.org/vendor.bundle')) + t.true(html.includes('src="/test/orion/vendor.bundle')) }) test('/test/ (router base)', async t => { From 6d969bdd6bffe9bb5d2ab7a6eb201621a1a1441b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 19:02:20 +0100 Subject: [PATCH 080/126] Bump to 0.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1dcd8a050a..27b0460723 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt", - "version": "0.9.9", + "version": "0.10.0", "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", "contributors": [ { From bfe62b7d71d4ac64a4d411a83cec808824082b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 19:05:57 +0100 Subject: [PATCH 081/126] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28d0c2ccd0..d8ae3adfd6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ > Nuxt.js is a framework for server-rendered Vue applications (inspired by [Next.js](https://github.com/zeit/next.js)) -## 🚧 Under active development, 1.0 will be released soon :fire: +## 🚧 Under active development, [1.0](https://github.com/nuxt/nuxt.js/projects/1) will be released soon :fire: ## Links From 8f28f1d8dd0e4a9a6cc3ed1a85443ad58251521d Mon Sep 17 00:00:00 2001 From: Espen Bratberg Date: Fri, 24 Mar 2017 19:50:03 +0100 Subject: [PATCH 082/126] Bumped nuxt and vuetify versions --- examples/with-vuetify/package.json | 4 ++-- examples/with-vuetify/pages/index.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/with-vuetify/package.json b/examples/with-vuetify/package.json index 908878ba03..f32f783ecb 100644 --- a/examples/with-vuetify/package.json +++ b/examples/with-vuetify/package.json @@ -1,8 +1,8 @@ { "name": "with-vuetify", "dependencies": { - "nuxt": "latest", - "vuetify": "^0.9.1" + "nuxt": "0.10", + "vuetify": "0.9.4" }, "scripts": { "dev": "nuxt", diff --git a/examples/with-vuetify/pages/index.vue b/examples/with-vuetify/pages/index.vue index 8551eaff81..80916b3b54 100644 --- a/examples/with-vuetify/pages/index.vue +++ b/examples/with-vuetify/pages/index.vue @@ -7,7 +7,7 @@
- + Item {{ i }} @@ -30,7 +30,7 @@ diff --git a/test/fixtures/with-config/pages/error.vue b/test/fixtures/with-config/pages/error.vue new file mode 100644 index 0000000000..f309c03407 --- /dev/null +++ b/test/fixtures/with-config/pages/error.vue @@ -0,0 +1,11 @@ + + + diff --git a/test/fixtures/with-config/plugins/only-client.js b/test/fixtures/with-config/plugins/only-client.js index 12ee6becab..ca1ce034f3 100644 --- a/test/fixtures/with-config/plugins/only-client.js +++ b/test/fixtures/with-config/plugins/only-client.js @@ -1 +1 @@ -console.log('Only called in client-side!') +// Custom plugin (only included on client-side) diff --git a/test/with-config.test.js b/test/with-config.test.js index 13b50b7452..83faa9636d 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -37,6 +37,7 @@ test('/ (custom build.publicPath)', async t => { test('/test/ (router base)', async t => { const window = await nuxt.renderAndGetWindow(url('/test/')) const html = window.document.body.innerHTML + t.is(window.__NUXT__.layout, 'default') t.true(html.includes('

Default layout

')) t.true(html.includes('

I have custom configurations

')) }) @@ -44,6 +45,7 @@ test('/test/ (router base)', async t => { test('/test/about (custom layout)', async t => { const window = await nuxt.renderAndGetWindow(url('/test/about')) const html = window.document.body.innerHTML + t.is(window.__NUXT__.layout, 'custom') t.true(html.includes('

Custom layout

')) t.true(html.includes('

About page

')) }) @@ -57,6 +59,14 @@ test('/test/env', async t => { t.true(html.includes('"string": "Nuxt.js"')) }) +test('/test/error', async t => { + const window = await nuxt.renderAndGetWindow(url('/test/error')) + const html = window.document.body.innerHTML + t.is(window.__NUXT__.layout, 'custom') + t.true(html.includes('

Custom layout

')) + t.true(html.includes('Error page')) +}) + test('/test/user-agent', async t => { const window = await nuxt.renderAndGetWindow(url('/test/user-agent')) const html = window.document.body.innerHTML @@ -72,7 +82,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, 19) + t.is(stats.assets.length, 21) }) // Close server and ask nuxt to stop listening to file changes From 5ff6424e09eb2262b975c9c544c57e681fbf7591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sat, 25 Mar 2017 19:03:28 +0100 Subject: [PATCH 099/126] Bump to 0.10.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 731de4f111..2628faf661 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt", - "version": "0.10.3", + "version": "0.10.4", "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", "contributors": [ { From 78ea2591c26b2858b6738b062433a6c06b293596 Mon Sep 17 00:00:00 2001 From: Ralph Huwiler Date: Sat, 25 Mar 2017 21:21:11 +0100 Subject: [PATCH 100/126] Create nested modules for each folder in ./store --- lib/app/store.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/app/store.js b/lib/app/store.js index 218eeebebc..a030990d50 100644 --- a/lib/app/store.js +++ b/lib/app/store.js @@ -2,7 +2,7 @@ import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) -let files = require.context('~/store', false, /^\.\/.*\.js$/) +let files = require.context('~/store', true, /^\.\/.*\.js$/) let filenames = files.keys() function getModule (filename) { @@ -12,6 +12,18 @@ function getModule (filename) { : file } +function getModuleNamespace (storeData, namePath) { + if (namePath.length == 1) return storeData.modules + + let namespace = namePath.shift() + + storeData.modules[namespace] = storeData.modules[namespace] || {} + storeData.modules[namespace].namespaced = true + storeData.modules[namespace].modules = storeData.modules[namespace].modules || {} + + return getModuleNamespace(storeData.modules[namespace], namePath) +} + let store let storeData = {} @@ -31,8 +43,13 @@ if (store == null) { for (let filename of filenames) { let name = filename.replace(/^\.\//, '').replace(/\.js$/, '') if (name === 'index') continue - storeData.modules[name] = getModule(filename) - storeData.modules[name].namespaced = true + + let namePath = name.split(/\//) + let module = getModuleNamespace(storeData, namePath) + + name = namePath.pop() + module[name] = getModule(filename) + module[name].namespaced = true } store = new Vuex.Store(storeData) } From 6f66cd0a1f6cc1fb8bd7531ffdda5a908dbe29c7 Mon Sep 17 00:00:00 2001 From: Ralph Huwiler Date: Sat, 25 Mar 2017 23:04:34 +0100 Subject: [PATCH 101/126] updated example for nested modules --- examples/vuex-store-modules/pages/index.vue | 7 ++++ examples/vuex-store-modules/pages/website.vue | 33 +++++++++++++++++++ examples/vuex-store-modules/store/articles.js | 19 +++++++++++ .../store/articles/comments.js | 19 +++++++++++ 4 files changed, 78 insertions(+) create mode 100644 examples/vuex-store-modules/pages/website.vue create mode 100644 examples/vuex-store-modules/store/articles.js create mode 100644 examples/vuex-store-modules/store/articles/comments.js diff --git a/examples/vuex-store-modules/pages/index.vue b/examples/vuex-store-modules/pages/index.vue index 2a2a712d4d..99a2cd37a5 100644 --- a/examples/vuex-store-modules/pages/index.vue +++ b/examples/vuex-store-modules/pages/index.vue @@ -1,11 +1,18 @@ diff --git a/examples/vuex-store-modules/pages/website.vue b/examples/vuex-store-modules/pages/website.vue new file mode 100644 index 0000000000..e0fa75320c --- /dev/null +++ b/examples/vuex-store-modules/pages/website.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/examples/vuex-store-modules/store/articles.js b/examples/vuex-store-modules/store/articles.js new file mode 100644 index 0000000000..a0698ff850 --- /dev/null +++ b/examples/vuex-store-modules/store/articles.js @@ -0,0 +1,19 @@ +export const state = { + list: [ + 'Lorem ipsum', + 'dolor sit amet', + 'consetetur sadipscing elitr' + ] +} + +export const mutations = { + add (state, title) { + state.list.push(title) + } +} + +export const getters = { + get (state) { + return state.list + } +} diff --git a/examples/vuex-store-modules/store/articles/comments.js b/examples/vuex-store-modules/store/articles/comments.js new file mode 100644 index 0000000000..1cb5606bae --- /dev/null +++ b/examples/vuex-store-modules/store/articles/comments.js @@ -0,0 +1,19 @@ +export const state = { + list: [ + 'Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.', + 'Lorem ipsum dolor sit amet, consetetur sadipscing elit.', + 'Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.' + ] +} + +export const mutations = { + add (state, title) { + state.list.push(title) + } +} + +export const getters = { + get (state) { + return state.list + } +} From 617999a60a1861a675843b6c3f79b07842989259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 26 Mar 2017 00:52:39 +0100 Subject: [PATCH 102/126] Add manifest --- lib/build.js | 1 + lib/webpack/client.config.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/build.js b/lib/build.js index 43e664aeb4..10dd0f49c9 100644 --- a/lib/build.js +++ b/lib/build.js @@ -47,6 +47,7 @@ const defaults = { analyze: false, publicPath: '/_nuxt/', filenames: { + manifest: 'manifest.[hash].js', vendor: 'vendor.bundle.[hash].js', app: 'nuxt.bundle.[chunkhash].js' }, diff --git a/lib/webpack/client.config.js b/lib/webpack/client.config.js index 7e40a22d29..75a69cbf54 100644 --- a/lib/webpack/client.config.js +++ b/lib/webpack/client.config.js @@ -56,6 +56,11 @@ export default function () { name: 'vendor', filename: this.options.build.filenames.vendor }), + // Extract manifest + new webpack.optimize.CommonsChunkPlugin({ + name: 'manifest', + filename: this.options.build.filenames.manifest + }), // Generate output HTML new HTMLPlugin({ template: this.options.appTemplatePath From 0c8565614215fa10e21600c6136b3977ad5e72e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 26 Mar 2017 00:53:50 +0100 Subject: [PATCH 103/126] Add vuex nested modules test --- test/basic.test.js | 5 +++++ test/fixtures/basic/pages/store.vue | 11 +++++++++++ test/fixtures/basic/store/foo/bar.js | 9 +++++++++ 3 files changed, 25 insertions(+) create mode 100644 test/fixtures/basic/pages/store.vue create mode 100644 test/fixtures/basic/store/foo/bar.js diff --git a/test/basic.test.js b/test/basic.test.js index d71daf15f0..6afc42226a 100755 --- a/test/basic.test.js +++ b/test/basic.test.js @@ -42,6 +42,11 @@ test('/stateful', async t => { t.true(html.includes('

The answer is 42

')) }) +test('/store', async t => { + const { html } = await nuxt.renderRoute('/store') + t.true(html.includes('

Vuex Nested Modules

')) +}) + test('/head', async t => { const window = await nuxt.renderAndGetWindow(url('/head'), { virtualConsole: false }) const html = window.document.body.innerHTML diff --git a/test/fixtures/basic/pages/store.vue b/test/fixtures/basic/pages/store.vue new file mode 100644 index 0000000000..d95f1d3868 --- /dev/null +++ b/test/fixtures/basic/pages/store.vue @@ -0,0 +1,11 @@ + + + diff --git a/test/fixtures/basic/store/foo/bar.js b/test/fixtures/basic/store/foo/bar.js new file mode 100644 index 0000000000..43b5268f5e --- /dev/null +++ b/test/fixtures/basic/store/foo/bar.js @@ -0,0 +1,9 @@ +export const state = { + baz: 'Vuex Nested Modules' +} + +export const getters = { + baz (state) { + return state.baz + } +} From 704ff5e5775736cfe0e7030cbdc0b9cc2cb198d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 26 Mar 2017 00:54:12 +0100 Subject: [PATCH 104/126] Bump to 0.10.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2628faf661..fb16879f02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt", - "version": "0.10.4", + "version": "0.10.5", "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", "contributors": [ { From d63b34de781380da01327cae968787861e4940f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 26 Mar 2017 00:58:10 +0100 Subject: [PATCH 105/126] Fix tests --- test/with-config.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/with-config.test.js b/test/with-config.test.js index 83faa9636d..e0fed7930d 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -82,7 +82,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, 21) + t.is(stats.assets.length, 23) }) // Close server and ask nuxt to stop listening to file changes From 93c4be2d286787e0d6522fa5bc7f5f437bc9eab5 Mon Sep 17 00:00:00 2001 From: taldy Date: Sun, 26 Mar 2017 17:54:27 +0300 Subject: [PATCH 106/126] Support other types of Promises returned by nuxtServerInit() --- lib/app/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/server.js b/lib/app/server.js index fa5cff0c75..f4b2ec16d4 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -81,7 +81,7 @@ export default context => { // nuxtServerInit <% if (store) { %> let promise = (store._actions && store._actions.nuxtServerInit ? store.dispatch('nuxtServerInit', omit(getContext(context), 'redirect', 'error')) : null) - if (!(promise instanceof Promise)) promise = Promise.resolve() + if (!promise || (!(promise instanceof Promise) && (promise && typeof promise.then !== 'function'))) promise = Promise.resolve() <% } else { %> let promise = Promise.resolve() <% } %> From 2f2eaac299cdbe4222928ada11ada40b014621d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 26 Mar 2017 23:38:51 +0200 Subject: [PATCH 107/126] Add debug for redirect on ssr --- lib/app/server.js | 4 ++++ lib/render.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/app/server.js b/lib/app/server.js index fa5cff0c75..f1dde07c7f 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -59,6 +59,10 @@ export default context => { Component._Ctor = Component Component.extendOptions = Component.options } + // For debugging purpose + if (!Component.options.name && Component.options.__file) { + Component.options.name = Component.options.__file + } resolve(Component) } Component().then(_resolve).catch(reject) diff --git a/lib/render.js b/lib/render.js index f1e4ccc8b9..fb924166f9 100644 --- a/lib/render.js +++ b/lib/render.js @@ -71,6 +71,10 @@ export function render (req, res) { return html }) .catch((err) => { + if (context.redirected) { + console.error(err) // eslint-disable-line no-console + return err + } const html = this.errorTemplate({ error: err, stack: ansiHTML(encodeHtml(err.stack)) From f6a02a1ac6844030224bd516852784e1def5d48a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Mon, 27 Mar 2017 18:06:57 +0200 Subject: [PATCH 108/126] Disable performance hints for SSR --- lib/webpack/server.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/webpack/server.config.js b/lib/webpack/server.config.js index d1f6eb35ab..0a92a9c82e 100644 --- a/lib/webpack/server.config.js +++ b/lib/webpack/server.config.js @@ -30,6 +30,9 @@ export default function () { filename: 'server-bundle.js', libraryTarget: 'commonjs2' }), + performance: { + hints: false + }, plugins: (config.plugins || []).concat([ new VueSSRPlugin({ filename: 'server-bundle.json' From d576dad069b985711a0eca8d0c10c852c0cacec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 28 Mar 2017 16:28:24 +0200 Subject: [PATCH 109/126] Fix eslint + istanbul --- lib/app/store.js | 7 +++---- lib/render.js | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/app/store.js b/lib/app/store.js index a030990d50..acf94f07ac 100644 --- a/lib/app/store.js +++ b/lib/app/store.js @@ -13,14 +13,13 @@ function getModule (filename) { } function getModuleNamespace (storeData, namePath) { - if (namePath.length == 1) return storeData.modules - + if (namePath.length === 1) { + return storeData.modules + } let namespace = namePath.shift() - storeData.modules[namespace] = storeData.modules[namespace] || {} storeData.modules[namespace].namespaced = true storeData.modules[namespace].modules = storeData.modules[namespace].modules || {} - return getModuleNamespace(storeData.modules[namespace], namePath) } diff --git a/lib/render.js b/lib/render.js index fb924166f9..eec45eb82a 100644 --- a/lib/render.js +++ b/lib/render.js @@ -71,6 +71,7 @@ export function render (req, res) { return html }) .catch((err) => { + /* istanbul ignore if */ if (context.redirected) { console.error(err) // eslint-disable-line no-console return err From e7bcdc736ea5dec8746dbdfa217dee609a460a73 Mon Sep 17 00:00:00 2001 From: Walter Ye Date: Sat, 1 Apr 2017 13:34:09 +0800 Subject: [PATCH 110/126] pass 'this nuxt' context in extend webpack config // nuxt.config build: { extend (config, {dev, isClient}) { // get this context here config.resolve.alias['~services'] = join(this.srcDir, 'services'); }, } --- lib/webpack/client.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/webpack/client.config.js b/lib/webpack/client.config.js index 75a69cbf54..068a5c20dd 100644 --- a/lib/webpack/client.config.js +++ b/lib/webpack/client.config.js @@ -105,7 +105,7 @@ export default function () { } // Extend config if (typeof this.options.build.extend === 'function') { - this.options.build.extend(config, { + this.options.build.extend.call(this, config, { dev: this.dev, isClient: true }) From 42e16a650b65f9195f5fa37a749c14687122ffec Mon Sep 17 00:00:00 2001 From: Ilya Date: Tue, 4 Apr 2017 14:25:48 +0300 Subject: [PATCH 111/126] proposal for validation pages --- lib/app/client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index db3edeeb11..49ec770ad7 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -129,8 +129,9 @@ function render (to, from, next) { if (!isValid) return if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ - params: to.params || {}, - query: to.query || {} + params : to.params || {}, + query : to.query || {}, + store : context.store.state || {} }) }) if (!isValid) { From 2646970b672e0dac97481402bb4d3055f528a5a5 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Wed, 5 Apr 2017 15:39:17 +0200 Subject: [PATCH 112/126] Add preset-es2015 in dependencies --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fb16879f02..378ed7d136 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "autoprefixer": "^6.7.7", "babel-core": "^6.24.0", "babel-loader": "^6.4.1", + "babel-preset-es2015": "^6.24.0", "babel-preset-vue-app": "^0.5.1", "chokidar": "^1.6.1", "co": "^4.6.0", @@ -99,7 +100,6 @@ "babel-plugin-array-includes": "^2.0.3", "babel-plugin-transform-async-to-generator": "^6.22.0", "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-es2015": "^6.24.0", "babel-preset-stage-2": "^6.22.0", "codecov": "^2.1.0", "copy-webpack-plugin": "^4.0.1", From 99400bb12d1f6e7c3f82e6399688a8083a8e67ec Mon Sep 17 00:00:00 2001 From: Ilya Date: Wed, 5 Apr 2017 19:14:45 +0300 Subject: [PATCH 113/126] server proposal for validation --- lib/app/server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/app/server.js b/lib/app/server.js index f1dde07c7f..9726c99637 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -152,8 +152,9 @@ export default context => { if (!isValid) return if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ - params: context.route.params || {}, - query: context.route.query || {} + params : context.route.params || {}, + query : context.route.query || {}, + store : context.store.state || {} }) }) if (!isValid) { From 7ef6411269c503019a9ebd1c692f31306a97abe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 5 Apr 2017 18:24:15 +0200 Subject: [PATCH 114/126] Update client.js --- lib/app/client.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index 49ec770ad7..5d12832301 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -130,8 +130,7 @@ function render (to, from, next) { if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ params : to.params || {}, - query : to.query || {}, - store : context.store.state || {} + query : to.query || {}<%= (store ? ', store: ctx.store' : '') %> }) }) if (!isValid) { From 9c4244635c9d35690d576419ef027c55036d5b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 5 Apr 2017 18:24:48 +0200 Subject: [PATCH 115/126] Update server.js --- lib/app/server.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/app/server.js b/lib/app/server.js index 9726c99637..e543b62190 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -153,8 +153,7 @@ export default context => { if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ params : context.route.params || {}, - query : context.route.query || {}, - store : context.store.state || {} + query : context.route.query || {}<%= (store ? ', store: context.store' : '') %> }) }) if (!isValid) { From 99a03812a4598c6b1c0351060fef060aff862654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 5 Apr 2017 18:25:12 +0200 Subject: [PATCH 116/126] Update client.js --- lib/app/client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index 5d12832301..ad935ff848 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -129,8 +129,8 @@ function render (to, from, next) { if (!isValid) return if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ - params : to.params || {}, - query : to.query || {}<%= (store ? ', store: ctx.store' : '') %> + params: to.params || {}, + query: to.query || {}<%= (store ? ', store: ctx.store' : '') %> }) }) if (!isValid) { From 4c012e93af273744a664f609fc91f85c9b4ce98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 5 Apr 2017 18:25:35 +0200 Subject: [PATCH 117/126] Update server.js --- lib/app/server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/server.js b/lib/app/server.js index e543b62190..3f41f514f4 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -152,8 +152,8 @@ export default context => { if (!isValid) return if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ - params : context.route.params || {}, - query : context.route.query || {}<%= (store ? ', store: context.store' : '') %> + params: context.route.params || {}, + query: context.route.query || {}<%= (store ? ', store: context.store' : '') %> }) }) if (!isValid) { From 17db23f45ff7d7e096f920a503a01dd57628cf87 Mon Sep 17 00:00:00 2001 From: Ilya Date: Wed, 5 Apr 2017 21:40:46 +0300 Subject: [PATCH 118/126] fix in client : validate method --- lib/app/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/client.js b/lib/app/client.js index ad935ff848..438919ee5b 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -130,7 +130,7 @@ function render (to, from, next) { if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ params: to.params || {}, - query: to.query || {}<%= (store ? ', store: ctx.store' : '') %> + query : to.query || {}<%= (store ? ', store: store' : '') %> }) }) if (!isValid) { From 3e7d0a19ed409cc814efac5e7d218ee78aab3252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 5 Apr 2017 21:25:44 +0200 Subject: [PATCH 119/126] Update client.js --- lib/app/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/client.js b/lib/app/client.js index 438919ee5b..f09681b88c 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -130,7 +130,7 @@ function render (to, from, next) { if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ params: to.params || {}, - query : to.query || {}<%= (store ? ', store: store' : '') %> + query : to.query || {}<%= (store ? ', store: context.store' : '') %> }) }) if (!isValid) { From 6c0f138b7d1fa83fa99855a7f3640389dba5a9fb Mon Sep 17 00:00:00 2001 From: Ilya Date: Wed, 5 Apr 2017 22:33:11 +0300 Subject: [PATCH 120/126] fix server validate --- lib/app/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/server.js b/lib/app/server.js index 3f41f514f4..fd54790ddf 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -153,7 +153,7 @@ export default context => { if (typeof Component.options.validate !== 'function') return isValid = Component.options.validate({ params: context.route.params || {}, - query: context.route.query || {}<%= (store ? ', store: context.store' : '') %> + query: context.route.query || {}<%= (store ? ', store: ctx.store' : '') %> }) }) if (!isValid) { From c22b0b790b1d267f3eba0c07fc95caefe14b9a86 Mon Sep 17 00:00:00 2001 From: taldy Date: Thu, 6 Apr 2017 12:09:56 +0300 Subject: [PATCH 121/126] Simplify fix and cover other Promise checks --- lib/app/client.js | 4 ++-- lib/app/server.js | 2 +- lib/app/utils.js | 2 +- lib/utils.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index db3edeeb11..004271ff13 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -166,7 +166,7 @@ function render (to, from, next) { } if (Component.options.fetch) { var p = Component.options.fetch(context) - if (!(p instanceof Promise)) { p = Promise.resolve(p) } + if (!p || (!(p instanceof Promise) && (typeof p.then !== 'function'))) { p = Promise.resolve(p) } <%= (loading ? 'p.then(() => this.$loading.increase && this.$loading.increase(30))' : '') %> promises.push(p) } @@ -318,7 +318,7 @@ function addHotReload ($component, depth) { // Call fetch() Component.options.fetch = Component.options.fetch || noopFetch let pFetch = Component.options.fetch(context) - if (!(pFetch instanceof Promise)) { pFetch = Promise.resolve(pFetch) } + if (!pFetch || (!(pFetch instanceof Promise) && (typeof pFetch.then !== 'function'))) { pFetch = Promise.resolve(pFetch) } <%= (loading ? 'pFetch.then(() => this.$loading.increase && this.$loading.increase(30))' : '') %> promises.push(pFetch) return Promise.all(promises) diff --git a/lib/app/server.js b/lib/app/server.js index f4b2ec16d4..5bf49aa877 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -81,7 +81,7 @@ export default context => { // nuxtServerInit <% if (store) { %> let promise = (store._actions && store._actions.nuxtServerInit ? store.dispatch('nuxtServerInit', omit(getContext(context), 'redirect', 'error')) : null) - if (!promise || (!(promise instanceof Promise) && (promise && typeof promise.then !== 'function'))) promise = Promise.resolve() + if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) promise = Promise.resolve() <% } else { %> let promise = Promise.resolve() <% } %> diff --git a/lib/app/utils.js b/lib/app/utils.js index 013b3d4b29..e782671b75 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -84,7 +84,7 @@ export function promisify (fn, context) { } else { promise = fn(context) } - if (!(promise instanceof Promise)) { + if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) promise = Promise.resolve(promise) } return promise diff --git a/lib/utils.js b/lib/utils.js index aedd6e9d55..185dc414f4 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -52,7 +52,7 @@ export function promisifyRoute (fn) { }) } let promise = fn() - if (!(promise instanceof Promise)) { + if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) promise = Promise.resolve(promise) } return promise From 63f4f7449707699bea5897a294dee76587918a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 6 Apr 2017 11:14:24 +0200 Subject: [PATCH 122/126] Fix syntax error --- lib/app/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/utils.js b/lib/app/utils.js index e782671b75..f6b34f0739 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -84,7 +84,7 @@ export function promisify (fn, context) { } else { promise = fn(context) } - if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) + if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) { promise = Promise.resolve(promise) } return promise From 7fb45da8d032c75ca610a20f6326ce4f18f00254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 6 Apr 2017 11:14:43 +0200 Subject: [PATCH 123/126] Fix syntax error --- lib/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 185dc414f4..edea410fdb 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -52,7 +52,7 @@ export function promisifyRoute (fn) { }) } let promise = fn() - if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) + if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) { promise = Promise.resolve(promise) } return promise From 1ba4adca708870aad64a0d284ce8e87046dd9a9d Mon Sep 17 00:00:00 2001 From: taldy Date: Thu, 6 Apr 2017 12:18:27 +0300 Subject: [PATCH 124/126] Fix codestyle --- lib/app/utils.js | 2 +- lib/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/utils.js b/lib/app/utils.js index e782671b75..f6b34f0739 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -84,7 +84,7 @@ export function promisify (fn, context) { } else { promise = fn(context) } - if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) + if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) { promise = Promise.resolve(promise) } return promise diff --git a/lib/utils.js b/lib/utils.js index 185dc414f4..edea410fdb 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -52,7 +52,7 @@ export function promisifyRoute (fn) { }) } let promise = fn() - if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) + if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) { promise = Promise.resolve(promise) } return promise From 5849c68993d242575f001873275efec5bf402d07 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Thu, 6 Apr 2017 12:28:27 +0200 Subject: [PATCH 125/126] fix: npm start script --- examples/hello-world-jsx/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/hello-world-jsx/package.json b/examples/hello-world-jsx/package.json index 067dc72f52..abcca8b416 100644 --- a/examples/hello-world-jsx/package.json +++ b/examples/hello-world-jsx/package.json @@ -6,6 +6,6 @@ "scripts": { "dev": "nuxt", "build": "nuxt build", - "start": "nuxt" + "start": "nuxt start" } } From adc8282e57a3645fbaa5da6c07564f351a8ba9a2 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 6 Apr 2017 21:38:05 +0430 Subject: [PATCH 126/126] Upgrade babel-preset-vue-app ~> 1.1.1 #463 --- package.json | 2 +- yarn.lock | 266 +++++++++++++++++++++++++-------------------------- 2 files changed, 129 insertions(+), 139 deletions(-) diff --git a/package.json b/package.json index 378ed7d136..cbb5887478 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "babel-core": "^6.24.0", "babel-loader": "^6.4.1", "babel-preset-es2015": "^6.24.0", - "babel-preset-vue-app": "^0.5.1", + "babel-preset-vue-app": "^1.1.1", "chokidar": "^1.6.1", "co": "^4.6.0", "compression": "^1.6.2", diff --git a/yarn.lock b/yarn.lock index 8e97bbe9ac..b4496785e4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,5 +1,7 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 + + "@ava/babel-preset-stage-4@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@ava/babel-preset-stage-4/-/babel-preset-stage-4-1.0.0.tgz#a613b5e152f529305422546b072d47facfb26291" @@ -65,6 +67,10 @@ acorn-jsx@^3.0.0: dependencies: acorn "^3.0.4" +acorn@4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" + acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" @@ -73,10 +79,6 @@ acorn@^4.0.11, acorn@^4.0.3, acorn@^4.0.4: version "4.0.11" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0" -acorn@4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" - ajv-keywords@^1.0.0, ajv-keywords@^1.1.1: version "1.5.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" @@ -114,7 +116,7 @@ ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" -ansi-html@^0.0.7, ansi-html@0.0.7: +ansi-html@0.0.7, ansi-html@^0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" @@ -228,14 +230,14 @@ asn1@~0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + assert-plus@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" -assert-plus@^1.0.0, assert-plus@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - assert@^1.1.1: version "1.4.1" resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" @@ -838,7 +840,7 @@ 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-object-rest-spread@^6.22.0: +babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz#875d6bc9be761c58a2ae3feee5dc4895d8c7f921" dependencies: @@ -934,7 +936,7 @@ babel-preset-es2015@^6.24.0: babel-plugin-transform-es2015-unicode-regex "^6.22.0" babel-plugin-transform-regenerator "^6.22.0" -babel-preset-stage-2@^6.18.0, babel-preset-stage-2@^6.22.0: +babel-preset-stage-2@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-preset-stage-2/-/babel-preset-stage-2-6.22.0.tgz#ccd565f19c245cade394b21216df704a73b27c07" dependencies: @@ -953,13 +955,14 @@ babel-preset-stage-3@^6.22.0: babel-plugin-transform-exponentiation-operator "^6.22.0" babel-plugin-transform-object-rest-spread "^6.22.0" -babel-preset-vue-app@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/babel-preset-vue-app/-/babel-preset-vue-app-0.5.1.tgz#7786127541fa66ec0fe1f8bad5498ef17c7ef0f7" +babel-preset-vue-app@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/babel-preset-vue-app/-/babel-preset-vue-app-1.1.1.tgz#2976357df9fa68f1f48e9e315a0d77f29f8f944f" dependencies: + babel-plugin-syntax-dynamic-import "^6.18.0" + babel-plugin-transform-object-rest-spread "^6.23.0" babel-plugin-transform-runtime "^6.15.0" babel-preset-env "^1.2.1" - babel-preset-stage-2 "^6.18.0" babel-preset-vue "^0.1.0" babel-runtime "^6.20.0" @@ -1483,7 +1486,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@^2.9.0, commander@2.9.x: +commander@2.9.x, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -1793,7 +1796,7 @@ csso@~2.3.1: clap "^1.0.9" source-map "^0.5.3" -"cssom@>= 0.3.2 < 0.4.0", cssom@0.3.x: +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.2" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" @@ -1837,13 +1840,7 @@ debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" -debug@^2.1.1, debug@^2.2.0, debug@^2.3.3, debug@^2.6.3, debug@2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" - dependencies: - ms "0.7.2" - -debug@~2.2.0, debug@2.2.0: +debug@2.2.0, debug@~2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" dependencies: @@ -1855,6 +1852,12 @@ debug@2.6.1: dependencies: ms "0.7.2" +debug@2.6.3, debug@^2.1.1, debug@^2.2.0, debug@^2.3.3, debug@^2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" + dependencies: + ms "0.7.2" + decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1912,7 +1915,7 @@ delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" -depd@~1.1.0, depd@1.1.0: +depd@1.1.0, depd@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.0.tgz#e1bd82c6aab6ced965b97b88b17ed3e528ca18c3" @@ -1945,16 +1948,16 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" -doctrine@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" dependencies: esutils "^2.0.2" isarray "^1.0.0" -doctrine@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" +doctrine@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" dependencies: esutils "^2.0.2" isarray "^1.0.0" @@ -1976,7 +1979,7 @@ domain-browser@^1.1.1: version "1.1.7" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" -domelementtype@^1.3.0, domelementtype@1: +domelementtype@1, domelementtype@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2" @@ -1984,23 +1987,16 @@ domelementtype@~1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" -domhandler@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738" - dependencies: - domelementtype "1" - domhandler@2.1: version "2.1.0" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.1.0.tgz#d2646f5e57f6c3bab11cf6cb05d3c0acf7412594" dependencies: domelementtype "1" -domutils@^1.5.1, domutils@1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" +domhandler@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738" dependencies: - dom-serializer "0" domelementtype "1" domutils@1.1: @@ -2009,6 +2005,13 @@ domutils@1.1: dependencies: domelementtype "1" +domutils@1.5.1, domutils@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" + dependencies: + dom-serializer "0" + domelementtype "1" + dot-prop@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-3.0.0.tgz#1b708af094a49c9a0e7dbcad790aba539dac1177" @@ -2021,16 +2024,16 @@ dot-prop@^4.1.0: dependencies: is-obj "^1.0.0" -duplexer@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" - duplexer2@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" dependencies: readable-stream "^2.0.2" +duplexer@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -2127,7 +2130,7 @@ es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: es6-iterator "2" es6-symbol "~3.1" -es6-iterator@^2.0.1, es6-iterator@~2.0.1, es6-iterator@2: +es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" dependencies: @@ -2156,7 +2159,7 @@ es6-set@~0.1.5: es6-symbol "3.1.1" event-emitter "~0.3.5" -es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1, es6-symbol@3.1.1: +es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" dependencies: @@ -2881,7 +2884,7 @@ hawk@~3.1.3: hoek "2.x.x" sntp "1.x.x" -he@^1.1.0, he@1.1.x: +he@1.1.x, he@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -3036,7 +3039,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@2, inherits@2.0.3: +inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" @@ -3277,14 +3280,14 @@ is-utf8@^0.2.0, is-utf8@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" -isarray@^1.0.0, isarray@~1.0.0, isarray@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -3794,7 +3797,7 @@ mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.13, mime-types@~2.1.7: dependencies: mime-db "~1.27.0" -mime@^1.3.4, mime@1.3.4, mime@1.3.x: +mime@1.3.4, mime@1.3.x, mime@^1.3.4: version "1.3.4" resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53" @@ -3810,39 +3813,31 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, "minimatch@2 || 3": +"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: brace-expansion "^1.0.0" +minimist@0.0.8, minimist@~0.0.1: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -mkdirp@^0.5.0, mkdirp@^0.5.1, "mkdirp@>=0.5 0", mkdirp@~0.5.0, mkdirp@~0.5.1: +"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" -ms@^0.7.1: - version "0.7.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.3.tgz#708155a5e44e33f5fd0fc53e81d0d40a91be1fff" - ms@0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" -ms@0.7.2: +ms@0.7.2, ms@^0.7.1: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" @@ -4710,26 +4705,26 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" -punycode@^1.2.4, punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" +punycode@^1.2.4, punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + q@^1.1.2: version "1.5.0" resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1" +qs@6.4.0, qs@~6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" + qs@~6.3.0: version "6.3.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.2.tgz#e75bd5f6e268122a2a0e0bda630b2550c166502c" -qs@~6.4.0, qs@6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" - query-string@^4.1.0: version "4.3.2" resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.2.tgz#ec0fd765f58a50031a3968c2431386f8947a5cdd" @@ -4741,7 +4736,7 @@ querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" -querystring@^0.2.0, querystring@0.2.0: +querystring@0.2.0, querystring@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" @@ -4806,6 +4801,15 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" +readable-stream@1.0: + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.1.0, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2: version "2.2.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816" @@ -4818,15 +4822,6 @@ readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2. string_decoder "~0.10.x" util-deprecate "~1.0.1" -readable-stream@1.0: - version "1.0.34" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - readdirp@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" @@ -4973,6 +4968,31 @@ request-promise-native@^1.0.3: request-promise-core "1.1.1" stealthy-require "^1.0.0" +request@2.79.0: + version "2.79.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" + dependencies: + aws-sign2 "~0.6.0" + aws4 "^1.2.1" + caseless "~0.11.0" + combined-stream "~1.0.5" + extend "~3.0.0" + forever-agent "~0.6.1" + form-data "~2.1.1" + har-validator "~2.0.6" + hawk "~3.1.3" + http-signature "~1.1.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + qs "~6.3.0" + stringstream "~0.0.4" + tough-cookie "~2.3.0" + tunnel-agent "~0.4.1" + uuid "^3.0.0" + request@^2.79.0, request@^2.81.0: version "2.81.0" resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" @@ -5000,31 +5020,6 @@ request@^2.79.0, request@^2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" -request@2.79.0: - version "2.79.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.11.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~2.0.6" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - oauth-sign "~0.8.1" - qs "~6.3.0" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "~0.4.1" - uuid "^3.0.0" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -5088,7 +5083,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@2: +rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: @@ -5128,7 +5123,7 @@ semver-diff@^2.0.0: dependencies: semver "^5.0.3" -semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, "semver@2 || 3 || 4 || 5", semver@5.3.0: +"semver@2 || 3 || 4 || 5", semver@5.3.0, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -5154,7 +5149,7 @@ serialize-javascript@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.3.0.tgz#86a4f3752f5c7e47295449b0bbb63d64ba533f05" -serve-static@^1.12.1, serve-static@1.12.1: +serve-static@1.12.1, serve-static@^1.12.1: version "1.12.1" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.12.1.tgz#7443a965e3ced647aceb5639fa06bf4d1bbe0039" dependencies: @@ -5243,16 +5238,16 @@ source-map-support@^0.4.0, source-map-support@^0.4.2: dependencies: source-map "^0.5.6" +source-map@0.5.6, source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + source-map@^0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" dependencies: amdefine ">=0.0.4" -source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3, source-map@0.5.6, source-map@0.5.x: - version "0.5.6" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" - source-map@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" @@ -5340,10 +5335,6 @@ strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" -string_decoder@^0.10.25, string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - string-length@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac" @@ -5365,6 +5356,10 @@ string-width@^2.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^3.0.0" +string_decoder@^0.10.25, string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -5489,10 +5484,6 @@ text-table@^0.2.0, text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - through2@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" @@ -5500,6 +5491,10 @@ through2@^2.0.0: readable-stream "^2.1.5" xtend "~4.0.1" +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + time-require@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/time-require/-/time-require-0.1.2.tgz#f9e12cb370fc2605e11404582ba54ef5ca2b2d98" @@ -5588,7 +5583,7 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -uglify-js@^2.6, uglify-js@^2.8.5, uglify-js@2.8.x: +uglify-js@2.8.x, uglify-js@^2.6, uglify-js@^2.8.5: version "2.8.16" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.16.tgz#d286190b6eefc6fd65eb0ecac6551e0b0e8839a4" dependencies: @@ -5690,7 +5685,7 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -util@^0.10.3, util@0.10.3: +util@0.10.3, util@^0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" dependencies: @@ -5952,18 +5947,14 @@ window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" +wordwrap@0.0.2, wordwrap@~0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" - wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -6064,4 +6055,3 @@ yargs@~3.10.0: cliui "^2.1.0" decamelize "^1.0.0" window-size "0.1.0" -