@nuxt/vue-app
Advanced tools
Comparing version 2.14.1 to 2.14.2
/*! | ||
* @nuxt/vue-app v2.14.1 (c) 2016-2020 | ||
* @nuxt/vue-app v2.14.2 (c) 2016-2020 | ||
@@ -12,6 +12,8 @@ * - All the amazing contributors | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
const path = require('path'); | ||
const path = _interopDefault(require('path')); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
const path__default = /*#__PURE__*/_interopDefaultLegacy(path); | ||
var dependencies = { | ||
@@ -24,3 +26,3 @@ "node-fetch": "^2.6.0", | ||
"vue-no-ssr": "^1.1.1", | ||
"vue-router": "^3.3.4", | ||
"vue-router": "^3.4.3", | ||
"vue-template-compiler": "^2.6.11", | ||
@@ -32,3 +34,3 @@ vuex: "^3.5.1" | ||
dependencies, | ||
dir: path.join(__dirname, '..', 'template'), | ||
dir: path__default['default'].join(__dirname, '..', 'template'), | ||
files: [ | ||
@@ -35,0 +37,0 @@ 'App.js', |
{ | ||
"name": "@nuxt/vue-app", | ||
"version": "2.14.1", | ||
"version": "2.14.2", | ||
"repository": "nuxt/nuxt.js", | ||
@@ -22,3 +22,3 @@ "license": "MIT", | ||
"vue-no-ssr": "^1.1.1", | ||
"vue-router": "^3.3.4", | ||
"vue-router": "^3.4.3", | ||
"vue-template-compiler": "^2.6.11", | ||
@@ -25,0 +25,0 @@ "vuex": "^3.5.1" |
import Vue from 'vue' | ||
<% if (store) { %>import Vuex from 'vuex'<% } %> | ||
<% if (features.meta) { %>import Meta from 'vue-meta'<% } %> | ||
@@ -69,2 +70,11 @@ <% if (features.componentClientOnly) { %>import ClientOnly from 'vue-client-only'<% } %> | ||
<% if (store) { %> | ||
const originalRegisterModule = Vuex.Store.prototype.registerModule | ||
const baseStoreOptions = { preserveState: process.client } | ||
function registerModule (path, rawModule, options = {}) { | ||
return originalRegisterModule.call(this, path, rawModule, { ...baseStoreOptions, ...options }) | ||
} | ||
<% } %> | ||
async function createApp(ssrContext, config = {}) { | ||
@@ -79,4 +89,3 @@ const router = await createRouter(ssrContext) | ||
// Fix SSR caveat https://github.com/nuxt/nuxt.js/issues/3757#issuecomment-414689141 | ||
const registerModule = store.registerModule | ||
store.registerModule = (path, rawModule, options) => registerModule.call(store, path, rawModule, Object.assign({ preserveState: process.client }, options)) | ||
store.registerModule = registerModule | ||
<% } %> | ||
@@ -252,5 +261,5 @@ <% } %> | ||
router.push(ssrContext.url, resolve, (err) => { | ||
// https://github.com/vuejs/vue-router/blob/v3.3.4/src/history/errors.js | ||
// https://github.com/vuejs/vue-router/blob/v3.4.3/src/util/errors.js | ||
if (!err._isRouter) return reject(err) | ||
if (err.type !== 1 /* NavigationFailureType.redirected */) return resolve() | ||
if (err.type !== 2 /* NavigationFailureType.redirected */) return resolve() | ||
@@ -257,0 +266,0 @@ // navigated to a different route in router guard |
@@ -25,18 +25,16 @@ <% if (router.scrollBehavior) { %> | ||
export default function (to, from, savedPosition) { | ||
// if the returned position is falsy or an empty object, | ||
// will retain current scroll position. | ||
export default function (to, from, savedPosition) { | ||
// If the returned position is falsy or an empty object, will retain current scroll position | ||
let position = false | ||
// if no children detected and scrollToTop is not explicitly disabled | ||
const Pages = getMatchedComponents(to) | ||
// Scroll to the top of the page if... | ||
if ( | ||
Pages.length < 2 && | ||
Pages.every(Page => Page.options.scrollToTop !== false) | ||
// One of the children set `scrollToTop` | ||
Pages.some(Page => Page.options.scrollToTop) || | ||
// scrollToTop set in only page without children | ||
(Pages.length < 2 && Pages.every(Page => Page.options.scrollToTop !== false)) | ||
) { | ||
// scroll to the top of the page | ||
position = { x: 0, y: 0 } | ||
} else if (Pages.some(Page => Page.options.scrollToTop)) { | ||
// if one of the children has scrollToTop option set to true | ||
position = { x: 0, y: 0 } | ||
} | ||
@@ -51,4 +49,8 @@ | ||
// triggerScroll is only fired when a new component is loaded | ||
if (to.path === from.path && to.hash !== from.hash) { | ||
if ( | ||
// Route hash changes | ||
(to.path === from.path && to.hash !== from.hash) || | ||
// Initial load (vuejs/vue-router#3199) | ||
to === from | ||
) { | ||
nuxt.$nextTick(() => nuxt.$emit('triggerScroll')) | ||
@@ -55,0 +57,0 @@ } |
Sorry, the diff of this file is not supported yet
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
165799
3559
Updatedvue-router@^3.4.3