From 5f60b23198160e8d6ca0d7c6ab7c8e81dfe6c2b9 Mon Sep 17 00:00:00 2001 From: Mouti'a Benachour Date: Wed, 30 Aug 2017 10:32:03 +0100 Subject: [PATCH 01/62] require bulma in example only --- examples/global-css/package.json | 2 +- package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/global-css/package.json b/examples/global-css/package.json index 75e5b4647d..1525d69e4e 100644 --- a/examples/global-css/package.json +++ b/examples/global-css/package.json @@ -1,7 +1,7 @@ { "name": "nuxt-global-css", "dependencies": { - "bulma": "^0.4.3", + "bulma": "^0.5.1", "nuxt": "latest" }, "scripts": { diff --git a/package.json b/package.json index 48a1f5cd0c..edd80effb2 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,6 @@ "babel-loader": "^7.1.2", "babel-preset-es2015": "^6.24.1", "babel-preset-vue-app": "^1.2.1", - "bulma": "^0.5.1", "chalk": "^2.1.0", "chokidar": "^1.7.0", "clone": "^2.1.1", From 5616f1acba4d4a30bda0428e30a3cae23792c804 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Wed, 30 Aug 2017 18:13:01 +0800 Subject: [PATCH 02/62] match correct route when resolveComponents in hash mode --- lib/app/client.js | 2 +- lib/app/utils.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index 724c070344..4f6ebf8a33 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -134,7 +134,7 @@ async function loadAsyncComponents (to, from, next) { // Get matched components function resolveComponents(router) { - const path = getLocation(router.options.base) + const path = getLocation(router.options.base, router.options.mode) return flatMapComponents(router.match(path), (Component, _, match, key, index) => { // If component already resolved diff --git a/lib/app/utils.js b/lib/app/utils.js index 2ad110a906..4d65a8e187 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -144,8 +144,11 @@ export function promisify (fn, context) { } // Imported from vue-router -export function getLocation (base) { +export function getLocation (base, mode) { var path = window.location.pathname + if (mode === 'hash') { + return window.location.hash.replace(/^#\//, '') + } if (base && path.indexOf(base) === 0) { path = path.slice(base.length) } From c9e8d44c45cbddde1c989c67b8e3e2c05cb31fe3 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Wed, 30 Aug 2017 13:43:49 +0200 Subject: [PATCH 03/62] Update yarn --- yarn.lock | 47 +++++------------------------------------------ 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/yarn.lock b/yarn.lock index 64ed700936..3f1dd839ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1220,10 +1220,6 @@ builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" -bulma@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/bulma/-/bulma-0.5.1.tgz#db2831c94afe732250c7b12527a7b792a4dc9ef8" - bytes@2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.5.0.tgz#4c9423ea2d252c270c41b2bdefeff9bb6b62c06a" @@ -1348,7 +1344,7 @@ chalk@^0.4.0: has-color "~0.1.0" strip-ansi "~0.1.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: +chalk@^2.0.1, chalk@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e" dependencies: @@ -2591,7 +2587,7 @@ extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" -external-editor@^2.0.1, external-editor@^2.0.4: +external-editor@^2.0.1: version "2.0.4" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.4.tgz#1ed9199da9cbfe2ef2f7a31b2fde8b0d12368972" dependencies: @@ -3249,7 +3245,7 @@ ini@^1.3.4, ini@~1.3.0: version "1.3.4" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" -inquirer@3.0.6: +inquirer@3.0.6, inquirer@^3.0.6: version "3.0.6" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.6.tgz#e04aaa9d05b7a3cb9b0f407d04375f0447190347" dependencies: @@ -3267,25 +3263,6 @@ inquirer@3.0.6: strip-ansi "^3.0.0" through "^2.3.6" -inquirer@^3.0.6: - version "3.2.2" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.2.2.tgz#c2aaede1507cc54d826818737742d621bef2e823" - dependencies: - ansi-escapes "^2.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.0.4" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rx-lite "^4.0.8" - rx-lite-aggregates "^4.0.8" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - interpret@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" @@ -4090,7 +4067,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: +minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -4098,10 +4075,6 @@ minimist@1.2.0, 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" - "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" @@ -5748,16 +5721,6 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" -rx-lite-aggregates@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" - dependencies: - rx-lite "*" - -rx-lite@*, rx-lite@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" - rx@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" @@ -6045,7 +6008,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0, string-width@^2.1.0: +string-width@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: From 696ada09c45b2ca4b7c72f0d2065089615670028 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Wed, 30 Aug 2017 14:47:07 +0200 Subject: [PATCH 04/62] Add resourceHints for SPA mode --- lib/core/meta.js | 11 ++++++++--- lib/core/renderer.js | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/core/meta.js b/lib/core/meta.js index fee94285f1..96bc215b5e 100644 --- a/lib/core/meta.js +++ b/lib/core/meta.js @@ -55,18 +55,23 @@ export default class MetaRenderer { meta.BODY_ATTRS = m.bodyAttrs.text() // HEAD tags meta.HEAD = m.meta.text() + m.title.text() + m.link.text() + m.style.text() + m.script.text() + m.noscript.text() + // Resources Hints + meta.resourceHints = '' // Resource Hints const clientManifest = this.renderer.resources.clientManifest if (this.options.render.resourceHints && clientManifest) { const publicPath = clientManifest.publicPath || '/_nuxt/' // Pre-Load initial resources if (Array.isArray(clientManifest.initial)) { - meta.HEAD += clientManifest.initial.map(r => ``).join('') + meta.resourceHints += clientManifest.initial.map(r => ``).join('') } - // Pre-Fetch async resources if (Array.isArray(clientManifest.async)) { - meta.HEAD += clientManifest.async.map(r => ``).join('') + meta.resourceHints += clientManifest.async.map(r => ``).join('') + } + // Add them to HEAD + if (meta.resourceHints) { + meta.HEAD += meta.resourceHints } } diff --git a/lib/core/renderer.js b/lib/core/renderer.js index 4d103cb9cf..fac537f83c 100644 --- a/lib/core/renderer.js +++ b/lib/core/renderer.js @@ -453,7 +453,7 @@ export default class Renderer extends Tapable { // Basic response if SSR is disabled or spa data provided const spa = context.spa || (context.res && context.res.spa) if (this.noSSR || spa) { - const { HTML_ATTRS, BODY_ATTRS, HEAD } = await this.metaRenderer.render(context) + const { HTML_ATTRS, BODY_ATTRS, HEAD, resourceHints } = await this.metaRenderer.render(context) const APP = `
${this.resources.loadingHTML}
` const data = { @@ -465,7 +465,7 @@ export default class Renderer extends Tapable { const html = this.resources.spaTemplate(data) - return { html } + return { html, resourceHints } } // Call renderToString from the bundleRenderer and generate the HTML (will update the context as well) From 5eeca5a41bd6c9dbec62184a8ba605121a46ee8a Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 30 Aug 2017 18:29:09 +0430 Subject: [PATCH 05/62] add font to global-css example --- examples/global-css/assets/roboto.woff2 | Bin 0 -> 10560 bytes examples/global-css/css/main.css | 9 +++++++++ examples/global-css/nuxt.config.js | 9 ++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 examples/global-css/assets/roboto.woff2 diff --git a/examples/global-css/assets/roboto.woff2 b/examples/global-css/assets/roboto.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..555f98b12050685859ec09a1cfac15cf528fd2ef GIT binary patch literal 10560 zcmV-GDZkctPew8T0RR9104Y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? zt6sgWsf(Ei;FM!e0b3jigOFxw+)gZ-?I3OGEC;F$*|H=-IixZKJFhoyvxWGbt@(ea zZilR2^?m2#K(#5HZhp2FA?E0{v0Ih{!zVf%rDAKE%l`9CEGG7GDiu5BUY2-F@!mUK zJ#S}S`!s?mxVKS2r2Nv`Bo-?O!t2Ugu44Db)g{M+_s`GvCS#u5s8svq9sGIAa|`AY z-Im$e%(Jyk>NbJVdOKue)jq{w)#3gF5{OrPojpMIWE(Ysa(@DaOY?>jkjjY|X8hL4Z=Hrv%b5 z-ck7Y|2%RJ0Pw-WRu}?C`oZt{onYqnwezSKD zkeXNFXRYiVeLgOS`S__Mhq+8|iPvw}!P(thAsU;`HYggg+Cmzi0O!65E(a?6=yi#4SKrMxN< zr+8&L+hiyE59paj*+XjDg7`oiV|_;KJ3$%cR~bjM&)$82ZtW@d0a8dj8ZeFUmb_;A z(sU|aXTgK*_geqb%(eq<(wH>FC5E0Ylx=~&PNFuILuz=YhF99*<~_%%;b`>j%~w}e zzH4iZ+qz7z`)S9Bb+Do~$JrI;)c%FO%G}OZ;gN@LJ=H2XUpJ(MqM45lOp=_cX&OWx z#nhTXe1m3YHLE0a3k~x7s8TIAr$CB*bn4#Bx*nifWhG?LIk!& zhqmRihhyv_dpNh9^g9W;#GbVPE**pldbaR9gz@Dp*kyRZLU;+_Pst$~wCOnP*bue0 zKTO@x!C}!;Xk!M#(NrQ_4W}DexUQabJPiSYdDMJ)alIVfUkJRAPNs~UagMo*gMTn} ORSVkc%!&m!0001EDr!3b literal 0 HcmV?d00001 diff --git a/examples/global-css/css/main.css b/examples/global-css/css/main.css index 762c321cb7..debffff97e 100644 --- a/examples/global-css/css/main.css +++ b/examples/global-css/css/main.css @@ -1,3 +1,11 @@ +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + src: local('Roboto'), local('Roboto-Regular'), url(../assets/roboto.woff2) format('woff2'); + unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; +} + body { background: #eee; text-align: center; @@ -7,6 +15,7 @@ body { position: absolute; top: 0; left: 0; + font-family: 'Roboto'; } .content { margin-top: 100px; diff --git a/examples/global-css/nuxt.config.js b/examples/global-css/nuxt.config.js index f916e5a053..3dc2839759 100644 --- a/examples/global-css/nuxt.config.js +++ b/examples/global-css/nuxt.config.js @@ -9,5 +9,12 @@ module.exports = { css: [ 'bulma/css/bulma.css', '~/css/main.css' - ] + ], + render: { + bundleRenderer: { + shouldPreload: (file, type) => { + return ['script', 'style', 'font'].includes(type) + } + } + } } From 5c2f4715e65d2f3066a582b2d25b7ecf1f8573bb Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 30 Aug 2017 18:48:37 +0430 Subject: [PATCH 06/62] add tests for font preload --- test/fixtures/with-config/assets/app.css | 12 ++++++++++++ test/fixtures/with-config/assets/roboto.woff2 | Bin 0 -> 10560 bytes test/fixtures/with-config/nuxt.config.js | 7 ++++++- test/with-config.test.js | 12 ++++++++---- 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 test/fixtures/with-config/assets/roboto.woff2 diff --git a/test/fixtures/with-config/assets/app.css b/test/fixtures/with-config/assets/app.css index f69fcd8bbc..6b41464a8d 100755 --- a/test/fixtures/with-config/assets/app.css +++ b/test/fixtures/with-config/assets/app.css @@ -1,3 +1,15 @@ +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + src: local('Roboto'), local('Roboto-Regular'), url(../assets/roboto.woff2) format('woff2'); + unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; +} + +body { + font-family: 'Roboto'; +} + .global-css-selector { color: red; } diff --git a/test/fixtures/with-config/assets/roboto.woff2 b/test/fixtures/with-config/assets/roboto.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..555f98b12050685859ec09a1cfac15cf528fd2ef GIT binary patch literal 10560 zcmV-GDZkctPew8T0RR9104YEK4gdfE08iim04V1G0RR9100000000000000000000 z0000QfleEeLL4jxU;u{<5ey3R2;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KJFhoyvxWGbt@(ea zZilR2^?m2#K(#5HZhp2FA?E0{v0Ih{!zVf%rDAKE%l`9CEGG7GDiu5BUY2-F@!mUK zJ#S}S`!s?mxVKS2r2Nv`Bo-?O!t2Ugu44Db)g{M+_s`GvCS#u5s8svq9sGIAa|`AY z-Im$e%(Jyk>NbJVdOKue)jq{w)#3gF5{OrPojpMIWE(Ysa(@DaOY?>jkjjY|X8hL4Z=Hrv%b5 z-ck7Y|2%RJ0Pw-WRu}?C`oZt{onYqnwezSKD zkeXNFXRYiVeLgOS`S__Mhq+8|iPvw}!P(thAsU;`HYggg+Cmzi0O!65E(a?6=yi#4SKrMxN< zr+8&L+hiyE59paj*+XjDg7`oiV|_;KJ3$%cR~bjM&)$82ZtW@d0a8dj8ZeFUmb_;A z(sU|aXTgK*_geqb%(eq<(wH>FC5E0Ylx=~&PNFuILuz=YhF99*<~_%%;b`>j%~w}e zzH4iZ+qz7z`)S9Bb+Do~$JrI;)c%FO%G}OZ;gN@LJ=H2XUpJ(MqM45lOp=_cX&OWx z#nhTXe1m3YHLE0a3k~x7s8TIAr$CB*bn4#Bx*nifWhG?LIk!& zhqmRihhyv_dpNh9^g9W;#GbVPE**pldbaR9gz@Dp*kyRZLU;+_Pst$~wCOnP*bue0 zKTO@x!C}!;Xk!M#(NrQ_4W}DexUQabJPiSYdDMJ)alIVfUkJRAPNs~UagMo*gMTn} ORSVkc%!&m!0001EDr!3b literal 0 HcmV?d00001 diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index adf8eac489..a17928867e 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -27,7 +27,7 @@ module.exports = { string: 'Nuxt.js' }, build: { - extractCSS: true, + // extractCSS: true, publicPath: '/orion/', analyze: { analyzerMode: 'disabled', @@ -46,6 +46,11 @@ module.exports = { http2: { push: true }, + bundleRenderer: { + shouldPreload: (file, type) => { + return ['script', 'style', 'font'].includes(type) + } + }, static: { maxAge: '1y' } diff --git a/test/with-config.test.js b/test/with-config.test.js index 2dacdca53f..c92e2b5fd2 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -26,9 +26,13 @@ test('/', async t => { }) test('/ (global styles inlined)', async t => { - // const { html } = await nuxt.renderRoute('/') - // t.true(html.includes('.global-css-selector')) - t.pass() + const { html } = await nuxt.renderRoute('/') + t.true(html.includes('.global-css-selector')) +}) + +test('/ (preload fonts)', async t => { + const { html } = await nuxt.renderRoute('/') + t.true(html.includes(' { @@ -87,7 +91,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, 28) + t.is(stats.assets.length, 27) }) test('Check /test/test.txt with custom serve-static options', async t => { From 32ef99a96cb94fef529530e0c99910989d2485f2 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 30 Aug 2017 18:59:32 +0430 Subject: [PATCH 07/62] tests: move font-face to layout --- test/fixtures/with-config/assets/app.css | 12 ------------ test/fixtures/with-config/layouts/default.vue | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/test/fixtures/with-config/assets/app.css b/test/fixtures/with-config/assets/app.css index 6b41464a8d..f69fcd8bbc 100755 --- a/test/fixtures/with-config/assets/app.css +++ b/test/fixtures/with-config/assets/app.css @@ -1,15 +1,3 @@ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: local('Roboto'), local('Roboto-Regular'), url(../assets/roboto.woff2) format('woff2'); - unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; -} - -body { - font-family: 'Roboto'; -} - .global-css-selector { color: red; } diff --git a/test/fixtures/with-config/layouts/default.vue b/test/fixtures/with-config/layouts/default.vue index 4555ce65c4..4ab9402ac2 100644 --- a/test/fixtures/with-config/layouts/default.vue +++ b/test/fixtures/with-config/layouts/default.vue @@ -4,3 +4,17 @@ + + \ No newline at end of file From 699b3f6230d60618662284d382e95e83a1fdb55a Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 30 Aug 2017 19:36:16 +0430 Subject: [PATCH 08/62] disable ModuleConcatenationPlugin --- lib/builder/webpack/client.config.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/builder/webpack/client.config.js b/lib/builder/webpack/client.config.js index bef3a7b08c..4e04e63df0 100644 --- a/lib/builder/webpack/client.config.js +++ b/lib/builder/webpack/client.config.js @@ -5,7 +5,6 @@ import HTMLPlugin from 'html-webpack-plugin' import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin' import ProgressBarPlugin from 'progress-bar-webpack-plugin' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' -// import MinifyPlugin from 'babel-minify-webpack-plugin' import { resolve } from 'path' import { existsSync } from 'fs' import Debug from 'debug' @@ -191,17 +190,13 @@ export default function webpackClientConfig () { if (!this.options.dev) { // Scope Hoisting config.plugins.push( - new webpack.optimize.ModuleConcatenationPlugin() + // new webpack.optimize.ModuleConcatenationPlugin() ) // https://webpack.js.org/plugins/hashed-module-ids-plugin config.plugins.push(new webpack.HashedModuleIdsPlugin()) // Minify JS - - // https://github.com/webpack-contrib/babel-minify-webpack-plugin - // config.plugins.push(new MinifyPlugin()) - // https://github.com/webpack-contrib/uglifyjs-webpack-plugin config.plugins.push( new webpack.optimize.UglifyJsPlugin({ From 2dc84add7d32a72e0d41043c14f6b3bc2d2b5aea Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Wed, 30 Aug 2017 18:33:27 +0200 Subject: [PATCH 09/62] Use css-loader module --- package.json | 2 +- yarn.lock | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index edd80effb2..a8cd8b14bf 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "clone": "^2.1.1", "compression": "^1.7.0", "connect": "^3.6.3", - "css-loader": "https://github.com/nuxt/css-loader.git", + "css-loader": "^0.28.6", "debug": "^3.0.1", "es6-promise": "^4.1.1", "etag": "^1.8.0", diff --git a/yarn.lock b/yarn.lock index 3f1dd839ca..2687749834 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1304,12 +1304,12 @@ caniuse-api@^2.0.0: lodash.uniq "^4.5.0" caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639: - version "1.0.30000718" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000718.tgz#86cdd97987302554934c61e106f4e470f16f993c" + version "1.0.30000721" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000721.tgz#cdc52efe8f82dd13916615b78e86f704ece61802" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000718: - version "1.0.30000718" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000718.tgz#0dd24290beb11310b2d80f6b70a823c2a65a6fad" + version "1.0.30000721" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000721.tgz#931a21a7bd85016300328d21f126d84b73437d35" capture-stack-trace@^1.0.0: version "1.0.0" @@ -1811,9 +1811,9 @@ css-color-names@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" -"css-loader@https://github.com/nuxt/css-loader.git": - version "0.28.5" - resolved "https://github.com/nuxt/css-loader.git#43674428e42dd208f6192cfc0b1679935a0bae4b" +css-loader@^0.28.6: + version "0.28.6" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.6.tgz#9cc15eeee3f8d2f4eeb4c37556581ac84f39bad1" dependencies: babel-code-frame "^6.11.0" css-selector-tokenizer "^0.7.0" @@ -4103,8 +4103,8 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" nan@^2.3.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" + version "2.7.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" natural-compare@^1.4.0: version "1.4.0" @@ -6688,14 +6688,10 @@ 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: +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@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" From 6852f9e7a63c1555777e5064a5829c61577e80b3 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Wed, 30 Aug 2017 18:36:12 +0200 Subject: [PATCH 10/62] Bump to rc8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a8cd8b14bf..17f7485b45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt", - "version": "1.0.0-rc7", + "version": "1.0.0-rc8", "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", "contributors": [ { From 63bc512d73660986546bd2428649d0299a6a0abd Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Wed, 30 Aug 2017 18:36:41 +0200 Subject: [PATCH 11/62] Bump to rc8 --- start/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start/package.json b/start/package.json index 8f2b656b6e..040335a6e9 100644 --- a/start/package.json +++ b/start/package.json @@ -1,6 +1,6 @@ { "name": "nuxt-start", - "version": "1.0.0-rc7", + "version": "1.0.0-rc8", "description": "runtime-only build for nuxt", "contributors": [ { From e2a18d76da6bc81c6cd946b8bafe6501679796c1 Mon Sep 17 00:00:00 2001 From: Wu Haotian Date: Thu, 31 Aug 2017 14:27:52 +0800 Subject: [PATCH 12/62] Fix typo in lib/app/index.js (#1539) --- lib/app/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/index.js b/lib/app/index.js index d3dc52750a..19ba1ad2b2 100644 --- a/lib/app/index.js +++ b/lib/app/index.js @@ -144,7 +144,7 @@ async function createApp (ssrContext) { <% if (store) { %> if (process.browser) { - // Replace store state before calling plugins + // Replace store state after calling plugins if (window.__NUXT__ && window.__NUXT__.state) { store.replaceState(window.__NUXT__.state) } From 7da8785d729985dca829fc2a2d614b859e3ca871 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Thu, 31 Aug 2017 14:46:06 +0200 Subject: [PATCH 13/62] Add context.serverStoreState --- lib/app/utils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/app/utils.js b/lib/app/utils.js index 4d65a8e187..e2d444796e 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -108,6 +108,11 @@ export function getContext (context, app) { if (ctx.isServer && context.beforeRenderFns) { ctx.beforeNuxtRender = (fn) => context.beforeRenderFns.push(fn) } + <% if (store) { %> + if (ctx.isClient && window.__NUXT__ && window.__NUXT__.state) { + ctx.serverStoreState = window.__NUXT__.state + } + <% } %> return ctx } From f4c68e95e240842c50701ea75a7834fdf07616f2 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Fri, 1 Sep 2017 10:29:06 +0200 Subject: [PATCH 14/62] Add serverState --- lib/app/utils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/app/utils.js b/lib/app/utils.js index e2d444796e..8cebeba6c3 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -108,11 +108,12 @@ export function getContext (context, app) { if (ctx.isServer && context.beforeRenderFns) { ctx.beforeNuxtRender = (fn) => context.beforeRenderFns.push(fn) } - <% if (store) { %> - if (ctx.isClient && window.__NUXT__ && window.__NUXT__.state) { - ctx.serverStoreState = window.__NUXT__.state + if (ctx.isClient && window.__NUXT__) { + ctx.serverState = window.__NUXT__ + <% if (store) { %> + ctx.serverStoreState = ctx.serverState.state + <% } %> } - <% } %> return ctx } From 9d43db475b86218db1b68515200a0ec887bb43a9 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Fri, 1 Sep 2017 17:38:16 +0200 Subject: [PATCH 15/62] Fix example --- examples/i18n/package.json | 2 +- examples/i18n/plugins/i18n.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/i18n/package.json b/examples/i18n/package.json index 5ca4f709ba..6c75b31cb7 100644 --- a/examples/i18n/package.json +++ b/examples/i18n/package.json @@ -1,7 +1,7 @@ { "name": "nuxt-i18n", "dependencies": { - "nuxt": "latest", + "nuxt": "^1.0.0-rc9", "vue-i18n": "^7.0.5" }, "scripts": { diff --git a/examples/i18n/plugins/i18n.js b/examples/i18n/plugins/i18n.js index e4859aadc9..c767fd7f3e 100644 --- a/examples/i18n/plugins/i18n.js +++ b/examples/i18n/plugins/i18n.js @@ -3,11 +3,11 @@ import VueI18n from 'vue-i18n' Vue.use(VueI18n) -export default ({ app, store }) => { +export default ({ app, isClient, store, serverStore }) => { // Set i18n instance on app // This way we can use it in middleware and pages asyncData/fetch app.i18n = new VueI18n({ - locale: store.state.locale, + locale: (isClient ? serverStore.locale : store.state.locale), fallbackLocale: 'en', messages: { 'en': require('~/locales/en.json'), From a6a36b1d2fe0ae0f33a1a01a4aa4863790d84abb Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 1 Sep 2017 20:29:20 +0430 Subject: [PATCH 16/62] simplify error pages No dependencies and more mobile friendly --- lib/app/components/nuxt-error.vue | 99 +++++++++++++++++-------------- lib/app/views/error.html | 71 ++++------------------ 2 files changed, 65 insertions(+), 105 deletions(-) diff --git a/lib/app/components/nuxt-error.vue b/lib/app/components/nuxt-error.vue index 68b05a43be..4a12242201 100644 --- a/lib/app/components/nuxt-error.vue +++ b/lib/app/components/nuxt-error.vue @@ -1,32 +1,23 @@ diff --git a/examples/layout-transitions/pages/index.vue b/examples/layout-transitions/pages/index.vue new file mode 100644 index 0000000000..fe5ce74005 --- /dev/null +++ b/examples/layout-transitions/pages/index.vue @@ -0,0 +1,7 @@ + diff --git a/examples/layout-transitions/pages/users.vue b/examples/layout-transitions/pages/users.vue new file mode 100644 index 0000000000..ce5c065ba4 --- /dev/null +++ b/examples/layout-transitions/pages/users.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/lib/app/App.vue b/lib/app/App.vue index 37e6d69b37..53806cd92e 100644 --- a/lib/app/App.vue +++ b/lib/app/App.vue @@ -1,7 +1,9 @@ diff --git a/lib/app/components/nuxt-child.js b/lib/app/components/nuxt-child.js index 39b8e3c4e7..5e17edbea1 100644 --- a/lib/app/components/nuxt-child.js +++ b/lib/app/components/nuxt-child.js @@ -37,6 +37,19 @@ export default { name: 'nuxt-child', functional: true, render (h, { parent, data }) { + const nuxt = parent.$root.nuxt + const component = parent.$route.matched[0].components.default + + const layoutUid = parent._uid + const layoutName = component.options ? component.options.layout : null + + // If we're changing layout return the stored vnode + if (nuxt._layoutUid === layoutUid && + nuxt._layoutName !== layoutName) return nuxt._layoutVnode + + nuxt._layoutUid = layoutUid + nuxt._layoutName = layoutName + data.nuxtChild = true const _parent = parent const transitions = parent.$nuxt.nuxt.transitions @@ -62,11 +75,14 @@ export default { listeners[key] = transition[key].bind(_parent) } }) - return h('transition', { + + nuxt._layoutVnode = h('transition', { props: transitionProps, on: listeners }, [ h('router-view', data) ]) + + return nuxt._layoutVnode } } diff --git a/lib/builder/builder.js b/lib/builder/builder.js index cf1de02253..ec84c59138 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -219,6 +219,7 @@ export default class Builder extends Tapable { layouts: Object.assign({}, this.options.layouts), loading: typeof this.options.loading === 'string' ? this.relativeToBuild(this.options.srcDir, this.options.loading) : this.options.loading, transition: this.options.transition, + layoutTransition: this.options.layoutTransition, components: { ErrorPage: this.options.ErrorPage ? this.relativeToBuild(this.options.ErrorPage) : null } diff --git a/lib/common/options.js b/lib/common/options.js index 8c6f099314..7f0e5b8d32 100755 --- a/lib/common/options.js +++ b/lib/common/options.js @@ -24,6 +24,9 @@ Options.from = function (_options) { if (typeof options.transition === 'string') { options.transition = { name: options.transition } } + if (typeof options.layoutTransition === 'string') { + options.layoutTransition = { name: options.layoutTransition } + } // Apply defaults _.defaultsDeep(options, Options.defaults) @@ -243,6 +246,10 @@ Options.defaults = { appearActiveClass: 'appear-active', appearToClass: 'appear-to' }, + layoutTransition: { + name: 'layout', + mode: 'out-in' + }, router: { mode: 'history', base: '/', From 2bf02731f2b0b948cefc97560cb73b8b9d03ac67 Mon Sep 17 00:00:00 2001 From: James Homer Date: Sat, 9 Sep 2017 12:12:07 +0100 Subject: [PATCH 53/62] fix page transitions --- lib/app/App.vue | 2 +- lib/app/components/nuxt-child.js | 8 ++++---- lib/app/components/nuxt.vue | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/app/App.vue b/lib/app/App.vue index 53806cd92e..771bd613f7 100644 --- a/lib/app/App.vue +++ b/lib/app/App.vue @@ -2,7 +2,7 @@
<% if (loading) { %><% } %> <% if (layoutTransition) { %><% } %> - + <% if (layoutTransition) { %><% } %>
diff --git a/lib/app/components/nuxt-child.js b/lib/app/components/nuxt-child.js index 5e17edbea1..8df1feb71d 100644 --- a/lib/app/components/nuxt-child.js +++ b/lib/app/components/nuxt-child.js @@ -43,9 +43,9 @@ export default { const layoutUid = parent._uid const layoutName = component.options ? component.options.layout : null - // If we're changing layout return the stored vnode + // If we're changing layout render the stored vnode if (nuxt._layoutUid === layoutUid && - nuxt._layoutName !== layoutName) return nuxt._layoutVnode + nuxt._layoutName !== layoutName) return nuxt._childVnode nuxt._layoutUid = layoutUid nuxt._layoutName = layoutName @@ -76,13 +76,13 @@ export default { } }) - nuxt._layoutVnode = h('transition', { + nuxt._childVnode = h('transition', { props: transitionProps, on: listeners }, [ h('router-view', data) ]) - return nuxt._layoutVnode + return nuxt._childVnode } } diff --git a/lib/app/components/nuxt.vue b/lib/app/components/nuxt.vue index 2817b3af9a..2bdd096dd8 100644 --- a/lib/app/components/nuxt.vue +++ b/lib/app/components/nuxt.vue @@ -1,6 +1,8 @@