Socket
Socket
Sign inDemoInstall

@nuxt/vue-app

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxt/vue-app - npm Package Compare versions

Comparing version 2.14.7 to 2.14.8

6

dist/vue-app.js
/*!
* @nuxt/vue-app v2.14.7 (c) 2016-2020
* @nuxt/vue-app v2.14.8 (c) 2016-2020

@@ -25,5 +25,5 @@ * - All the amazing contributors

"vue-no-ssr": "^1.1.1",
"vue-router": "^3.4.6",
"vue-router": "^3.4.9",
"vue-template-compiler": "^2.6.12",
vuex: "^3.5.1"
vuex: "^3.6.0"
};

@@ -30,0 +30,0 @@

{
"name": "@nuxt/vue-app",
"version": "2.14.7",
"version": "2.14.8",
"repository": "nuxt/nuxt.js",

@@ -22,5 +22,5 @@ "license": "MIT",

"vue-no-ssr": "^1.1.1",
"vue-router": "^3.4.6",
"vue-router": "^3.4.9",
"vue-template-compiler": "^2.6.12",
"vuex": "^3.5.1"
"vuex": "^3.6.0"
},

@@ -27,0 +27,0 @@ "publishConfig": {

@@ -298,2 +298,22 @@ import Vue from 'vue'

<% if (isFullStatic) { %>
getRouterBase() {
return (this.$router.options.base || '').replace(/\/+$/, '')
},
getRoutePath(route = '/') {
const base = this.getRouterBase()
if (base && route.startsWith(base)) {
route = route.substr(base.length)
}
return (route.replace(/\/+$/, '') || '/').split('?')[0].split('#')[0]
},
getStaticAssetsPath(route = '/') {
const { staticAssetsBase } = window.<%= globals.context %>
return urlJoin(staticAssetsBase, this.getRoutePath(route))
},
<% if (nuxtOptions.generate.manifest) { %>
async fetchStaticManifest() {
return window.__NUXT_IMPORT__('manifest.js', encodeURI(urlJoin(this.getStaticAssetsPath(), 'manifest.js')))
},
<% } %>
setPagePayload(payload) {

@@ -304,9 +324,11 @@ this._pagePayload = payload

async fetchPayload(route) {
const { staticAssetsBase } = window.<%= globals.context %>
const base = (this.$router.options.base || '').replace(/\/+$/, '')
if (base && route.startsWith(base)) {
route = route.substr(base.length)
<% if (nuxtOptions.generate.manifest) { %>
const manifest = await this.fetchStaticManifest()
const path = this.getRoutePath(route)
if (!manifest.routes.includes(path)) {
this.setPagePayload(false)
throw new Error(`Route ${path} is not pre-rendered`)
}
route = (route.replace(/\/+$/, '') || '/').split('?')[0].split('#')[0]
const src = urlJoin(base, staticAssetsBase, route, 'payload.js')
<% } %>
const src = urlJoin(this.getStaticAssetsPath(route), 'payload.js')
try {

@@ -313,0 +335,0 @@ const payload = await window.__NUXT_IMPORT__(decodeURI(route), encodeURI(src))

@@ -653,2 +653,4 @@ import Vue from 'vue'

let triggerScroll = <%= features.transitions ? 'false' : 'true' %>
Vue.nextTick(() => {

@@ -671,8 +673,13 @@ instances.forEach((instance, i) => {

// Ensure to trigger scroll event after calling scrollBehavior
window.<%= globals.nuxt %>.$nextTick(() => {
window.<%= globals.nuxt %>.$emit('triggerScroll')
})
triggerScroll = true
}
})
if (triggerScroll) {
// Ensure to trigger scroll event after calling scrollBehavior
window.<%= globals.nuxt %>.$nextTick(() => {
window.<%= globals.nuxt %>.$emit('triggerScroll')
})
}
checkForErrors(this)

@@ -679,0 +686,0 @@ <% if (isDev) { %>

@@ -114,4 +114,4 @@ import Vue from 'vue'

const { href } = this.$router.resolve(this.to, this.$route, this.append)
if (this.$nuxt)
this.$nuxt.fetchPayload(href).catch(() => {})
if (this.<%= globals.nuxt %>)
this.<%= globals.nuxt %>.fetchPayload(href).catch(() => {})
}

@@ -118,0 +118,0 @@ <% } %>

@@ -63,8 +63,8 @@ import Vue from 'vue'

}
if (!fetchedOnServer || this.$nuxt.isPreview || !this.$nuxt._pagePayload) {
if (!fetchedOnServer || this.<%= globals.nuxt %>.isPreview || !this.<%= globals.nuxt %>._pagePayload) {
return
}
this._hydrated = true
this._fetchKey = this.$nuxt._payloadFetchIndex++
const data = this.$nuxt._pagePayload.fetch[this._fetchKey]
this._fetchKey = this.<%= globals.nuxt %>._payloadFetchIndex++
const data = this.<%= globals.nuxt %>._pagePayload.fetch[this._fetchKey]

@@ -71,0 +71,0 @@ // If fetch error

import Vue from 'vue'
import { hasFetch, normalizeError, addLifecycleHook } from '../utils'
import { hasFetch, normalizeError, addLifecycleHook, purifyData } from '../utils'

@@ -29,3 +29,3 @@ async function serverPrefetch() {

// Add to ssrContext for window.__NUXT__.fetch
this.$ssrContext.nuxt.fetch.push(this.$fetchState.error ? { _error: this.$fetchState.error } : this._data)
this.$ssrContext.nuxt.fetch.push(this.$fetchState.error ? { _error: this.$fetchState.error } : purifyData(this._data))
}

@@ -32,0 +32,0 @@

@@ -50,3 +50,3 @@ import Vue from 'vue'

res += '{'
res += firstIndent + 'path: ' + JSON.stringify(route.path)
res += firstIndent + 'path: ' + JSON.stringify(encodeURI(decodeURI(route.path)))
res += (route.components) ? nextIndent + 'components: {' + resMap + '\n' + baseIndent + tab + '}' : ''

@@ -97,3 +97,3 @@ res += (route.component) ? nextIndent + 'component: ' + route._name : ''

mode: '<%= router.mode %>',
base: decodeURI('<%= router.base %>'),
base: '<%= router.base %>',
linkActiveClass: '<%= router.linkActiveClass %>',

@@ -111,3 +111,14 @@ linkExactActiveClass: '<%= router.linkExactActiveClass %>',

export function createRouter () {
return new Router(routerOptions)
const router = new Router(routerOptions)
const resolve = router.resolve.bind(router)
// encodeURI(decodeURI()) ~> support both encoded and non-encoded urls
router.resolve = (to, current, append) => {
if (typeof to === 'string') {
to = encodeURI(decodeURI(to))
}
return resolve(to, current, append)
}
return router
}

@@ -53,3 +53,3 @@ import { stringify } from 'querystring'

// Avoid loop redirect
if (opts.path === ssrContext.url) {
if (encodeURI(decodeURI(opts.path)) === ssrContext.url) {
ssrContext.redirected = false

@@ -56,0 +56,0 @@ return

@@ -28,2 +28,20 @@ import Vue from 'vue'

}
export function purifyData(data) {
if (process.env.NODE_ENV === 'production') {
return data
}
return Object.entries(data).filter(
([key, value]) => {
const valid = !(value instanceof Function) && !(value instanceof Promise)
if (!valid) {
console.warn(`${key} is not able to be stringified. This will break in a production environment.`)
}
return valid
}
).reduce((obj, [key, value]) => {
obj[key] = value
return obj
}, {})
}
export function getChildrenComponentInstancesUsingFetch(vm, instances = []) {

@@ -282,11 +300,16 @@ const children = vm.$children || []

export function getLocation (base, mode) {
let path = decodeURI(window.location.pathname)
if (mode === 'hash') {
return window.location.hash.replace(/^#\//, '')
}
// To get matched with sanitized router.base add trailing slash
if (base && (path.endsWith('/') ? path : path + '/').startsWith(base)) {
base = decodeURI(base).slice(0, -1) // consideration is base is normalized with trailing slash
let path = decodeURI(window.location.pathname)
if (base && path.startsWith(base)) {
path = path.slice(base.length)
}
return (path || '/') + window.location.search + window.location.hash
const fullPath = (path || '/') + window.location.search + window.location.hash
return encodeURI(fullPath)
}

@@ -293,0 +316,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc