@nuxt/vue-app
Advanced tools
Comparing version 2.6.3 to 2.7.0
/*! | ||
* @nuxt/vue-app v2.6.3 (c) 2016-2019 | ||
* @nuxt/vue-app v2.7.0 (c) 2016-2019 | ||
@@ -17,3 +17,3 @@ * - All the amazing contributors | ||
var dependencies = { | ||
"node-fetch": "^2.3.0", | ||
"node-fetch": "^2.5.0", | ||
unfetch: "^4.1.0", | ||
@@ -25,3 +25,3 @@ vue: "^2.6.10", | ||
"vue-template-compiler": "^2.6.10", | ||
vuex: "^3.1.0" | ||
vuex: "^3.1.1" | ||
}; | ||
@@ -28,0 +28,0 @@ |
{ | ||
"name": "@nuxt/vue-app", | ||
"version": "2.6.3", | ||
"version": "2.7.0", | ||
"repository": "nuxt/nuxt.js", | ||
@@ -15,3 +15,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"node-fetch": "^2.3.0", | ||
"node-fetch": "^2.5.0", | ||
"unfetch": "^4.1.0", | ||
@@ -23,3 +23,3 @@ "vue": "^2.6.10", | ||
"vue-template-compiler": "^2.6.10", | ||
"vuex": "^3.1.0" | ||
"vuex": "^3.1.1" | ||
}, | ||
@@ -26,0 +26,0 @@ "publishConfig": { |
@@ -21,2 +21,3 @@ import Vue from 'vue' | ||
import NuxtLink from './components/nuxt-link.<%= router.prefetchLinks ? "client" : "server" %>.js' // should be included after ./index.js | ||
<% if (isDev) { %>import consola from 'consola'<% } %> | ||
@@ -40,2 +41,8 @@ // Component: <NuxtLink> | ||
<% if (isDev) { %> | ||
const logger = consola.withScope('nuxt:ssr') | ||
const logs = NUXT.logs || [] | ||
logs.forEach(logObj => logger[logObj.type](logObj)) | ||
delete NUXT.logs | ||
<% } %> | ||
<% if (debug) { %> | ||
@@ -42,0 +49,0 @@ // Setup global Vue error handler |
@@ -88,6 +88,4 @@ import Vue from 'vue' | ||
for (const Component of Components) { | ||
try { | ||
Component() | ||
Component.__prefetched = true | ||
} catch (e) {} | ||
Component().catch(() => {}) | ||
Component.__prefetched = true | ||
}<% if (router.linkPrefetchedClass) { %> | ||
@@ -94,0 +92,0 @@ this.addPrefetchedClass()<% } %> |
@@ -43,6 +43,26 @@ import Vue from 'vue' | ||
} | ||
const Component = this.$route.matched[0] && this.$route.matched[0].components.default | ||
if (Component && Component.options && Component.options.key) { | ||
return (typeof Component.options.key === 'function' ? Component.options.key(this.$route) : Component.options.key) | ||
if (Component && Component.options) { | ||
const { key, watchQuery } = Component.options | ||
if (key) { | ||
return (typeof key === 'function' ? key(this.$route) : key) | ||
} | ||
if (watchQuery) { | ||
if (watchQuery.length) { | ||
const pickedQuery = {} | ||
for (const queryKey of watchQuery) { | ||
pickedQuery[queryKey] = this.$route.query[queryKey] | ||
} | ||
return this.$router.resolve({ | ||
path: this.$route.path, | ||
query: pickedQuery | ||
}).href | ||
} | ||
return this.$route.fullPath | ||
} | ||
} | ||
return this.$route.path | ||
@@ -49,0 +69,0 @@ } |
@@ -39,3 +39,3 @@ import Vue from 'vue' | ||
const defaultTransition = <%= | ||
serialize(transition) | ||
serialize(pageTransition) | ||
.replace('beforeEnter(', 'function(').replace('enter(', 'function(').replace('afterEnter(', 'function(') | ||
@@ -42,0 +42,0 @@ .replace('enterCancelled(', 'function(').replace('beforeLeave(', 'function(').replace('leave(', 'function(') |
@@ -5,5 +5,5 @@ const middleware = {} | ||
%> | ||
middleware['<%= name %>'] = require('@/<%= dir.middleware %>/<%= m.src %>'); | ||
middleware['<%= name %>'] = require('<%= relativeToBuild(srcDir, dir.middleware, m.src) %>'); | ||
middleware['<%= name %>'] = middleware['<%= name %>'].default || middleware['<%= name %>'] | ||
<% }) %> | ||
export default middleware |
import { stringify } from 'querystring' | ||
import consola from 'consola' | ||
import Vue from 'vue' | ||
@@ -15,5 +16,2 @@ <% if (fetch.server) { %>import fetch from 'node-fetch'<% } %> | ||
const debug = require('debug')('nuxt:render') | ||
debug.color = 4 // force blue color | ||
const noopApp = () => new Vue({ render: h => h('div') }) | ||
@@ -70,6 +68,8 @@ | ||
await Promise.all(ssrContext.beforeRenderFns.map(fn => promisify(fn, { Components, nuxtState: ssrContext.nuxt }))) | ||
ssrContext.rendered = () => { | ||
<% if (store) { %> | ||
// Add the state from the vuex store | ||
ssrContext.nuxt.state = store.state | ||
// Add the state from the vuex store | ||
ssrContext.nuxt.state = store.state | ||
<% } %> | ||
} | ||
} | ||
@@ -90,3 +90,3 @@ const renderErrorPage = async () => { | ||
<% if (isDev) { %>const s = Date.now()<% } %> | ||
<% if (debug) { %>const s = Date.now()<% } %> | ||
@@ -104,3 +104,3 @@ // Components are already resolved by setContext -> getRouteData (app/utils.js) | ||
} catch (err) { | ||
debug('error occurred when calling nuxtServerInit: ', err.message) | ||
consola.debug('Error occurred when calling nuxtServerInit: ', err.message) | ||
throw err | ||
@@ -226,3 +226,3 @@ } | ||
<% if (isDev) { %>if (asyncDatas.length) debug('Data fetching ' + ssrContext.url + ': ' + (Date.now() - s) + 'ms')<% } %> | ||
<% if (debug) { %>if (asyncDatas.length) consola.debug('Data fetching ' + ssrContext.url + ': ' + (Date.now() - s) + 'ms')<% } %> | ||
@@ -229,0 +229,0 @@ // datas are the first row of each |
@@ -13,3 +13,3 @@ import Vue from 'vue' | ||
if(s.src.indexOf('index.') === 0) { %> | ||
store = normalizeRoot(require('@/<%= dir.store %>/<%= s.src %>'), '<%= dir.store %>/<%= s.src %>') | ||
store = normalizeRoot(require('<%= relativeToBuild(srcDir, dir.store, s.src) %>'), '<%= dir.store %>/<%= s.src %>') | ||
<% return true }}) %> | ||
@@ -28,3 +28,3 @@ | ||
if(s.src.indexOf('index.') !== 0) { %> | ||
resolveStoreModules(require('@/<%= dir.store %>/<%= s.src %>'), '<%= s.src %>')<% }}) %> | ||
resolveStoreModules(require('<%= relativeToBuild(srcDir, dir.store, s.src) %>'), '<%= s.src %>')<% }}) %> | ||
@@ -36,3 +36,3 @@ // If the environment supports hot reloading... | ||
module.hot.accept([<% storeModules.forEach(s => { %> | ||
'@/<%= dir.store %>/<%= s.src %>',<% }) %> | ||
'<%= relativeToBuild(srcDir, dir.store, s.src) %>',<% }) %> | ||
], () => { | ||
@@ -39,0 +39,0 @@ // Update `root.modules` with the latest definitions. |
@@ -1,2 +0,2 @@ | ||
import Vue from 'vue' | ||
import Vue, { ComponentOptions } from 'vue' | ||
import VueRouter, { Route } from 'vue-router' | ||
@@ -17,3 +17,3 @@ import { Store } from 'vuex' | ||
export interface Context { | ||
app: Vue | ||
app: NuxtAppOptions | ||
/** | ||
@@ -85,3 +85,8 @@ * @deprecated Use process.client instead | ||
export interface NuxtAppOptions extends ComponentOptions<Vue> { | ||
[key: string]: any // TBD | ||
} | ||
export interface NuxtApp extends Vue { | ||
$options: NuxtAppOptions | ||
$loading: NuxtLoading | ||
@@ -88,0 +93,0 @@ isOffline: boolean |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126193
2543
Updatednode-fetch@^2.5.0
Updatedvuex@^3.1.1