Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nuxt/vue-app

Package Overview
Dependencies
Maintainers
5
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.15.8 to 2.16.0

62

dist/vue-app.js
/*!
* @nuxt/vue-app v2.15.8 (c) 2016-2021
* @nuxt/vue-app v2.16.0 (c) 2016-2023
* Released under the MIT License

@@ -9,20 +9,14 @@ * Repository: https://github.com/nuxt/nuxt.js

Object.defineProperty(exports, '__esModule', { value: true });
const path = require('path');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
var dependencies = {
"node-fetch": "^2.6.1",
ufo: "^0.7.4",
unfetch: "^4.2.0",
vue: "^2.6.12",
"vue-client-only": "^2.0.0",
"node-fetch-native": "^1.0.1",
ufo: "^1.0.1",
unfetch: "^5.0.0",
vue: "^2.7.10",
"vue-client-only": "^2.1.0",
"vue-meta": "^2.4.0",
"vue-no-ssr": "^1.1.1",
"vue-router": "^3.5.1",
"vue-template-compiler": "^2.6.12",
"vue-router": "^3.6.5",
"vue-template-compiler": "^2.7.14",
vuex: "^3.6.2"

@@ -33,23 +27,23 @@ };

dependencies,
dir: path__default['default'].join(__dirname, '..', 'template'),
dir: path.join(__dirname, "..", "template"),
files: [
'App.js',
'client.js',
'index.js',
'jsonp.js',
'router.js',
'router.scrollBehavior.js',
'routes.json',
'server.js',
'utils.js',
'empty.js',
'mixins/fetch.server.js',
'mixins/fetch.client.js',
'components/nuxt-error.vue',
'components/nuxt-child.js',
'components/nuxt-link.server.js',
'components/nuxt-link.client.js',
'components/nuxt.js',
'views/app.template.html',
'views/error.html'
"App.js",
"client.js",
"index.js",
"jsonp.js",
"router.js",
"router.scrollBehavior.js",
"routes.json",
"server.js",
"utils.js",
"empty.js",
"mixins/fetch.server.js",
"mixins/fetch.client.js",
"components/nuxt-error.vue",
"components/nuxt-child.js",
"components/nuxt-link.server.js",
"components/nuxt-link.client.js",
"components/nuxt.js",
"views/app.template.html",
"views/error.html"
]

@@ -56,0 +50,0 @@ };

{
"name": "@nuxt/vue-app",
"version": "2.15.8",
"version": "2.16.0",
"repository": "nuxt/nuxt.js",

@@ -16,11 +16,11 @@ "license": "MIT",

"dependencies": {
"node-fetch": "^2.6.1",
"ufo": "^0.7.4",
"unfetch": "^4.2.0",
"vue": "^2.6.12",
"vue-client-only": "^2.0.0",
"node-fetch-native": "^1.0.1",
"ufo": "^1.0.1",
"unfetch": "^5.0.0",
"vue": "^2.7.10",
"vue-client-only": "^2.1.0",
"vue-meta": "^2.4.0",
"vue-no-ssr": "^1.1.1",
"vue-router": "^3.5.1",
"vue-template-compiler": "^2.6.12",
"vue-router": "^3.6.5",
"vue-template-compiler": "^2.7.14",
"vuex": "^3.6.2"

@@ -27,0 +27,0 @@ },

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

const promises = pages.map((page) => {
const p = []
const promises = pages.map(async (page) => {
let p = []

@@ -186,11 +186,4 @@ <% if (features.fetch) { %>

}
if (page.$fetch) {
p.push(page.$fetch())
} else {
// Get all component instance to call $fetch
for (const component of getChildrenComponentInstancesUsingFetch(page.$vnode.componentInstance)) {
p.push(component.$fetch())
}
}
<% } %>
<% if (features.asyncData) { %>

@@ -208,2 +201,18 @@ if (page.$options.asyncData) {

<% } %>
<% if (features.fetch) { %>
// Wait for asyncData & old fetch to finish
await Promise.all(p)
// Cleanup refs
p = []
if (page.$fetch) {
p.push(page.$fetch())
}
// Get all component instance to call $fetch
for (const component of getChildrenComponentInstancesUsingFetch(page.$vnode.componentInstance)) {
p.push(component.$fetch())
}
<% } %>
return Promise.all(p)

@@ -210,0 +219,0 @@ })

@@ -738,2 +738,9 @@ import Vue from 'vue'

$components.forEach(addHotReload.bind(_app))
if (_app.context.isHMR) {
const Components = getMatchedComponents(router.currentRoute)
Components.forEach((Component) => {
Component.prototype.constructor = Component
})
}
}

@@ -740,0 +747,0 @@

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

get() {
const globalNuxt = this.$root.$options.<%= globals.nuxt %>
const globalNuxt = this.$root ? this.$root.$options.<%= globals.nuxt %> : null
if (process.client && !globalNuxt && typeof window !== 'undefined') {

@@ -96,6 +96,6 @@ return window.<%= globals.nuxt %>

async function createApp(ssrContext, config = {}) {
const router = await createRouter(ssrContext, config)
const store = <%= store ? 'createStore(ssrContext)' : 'null' %>
const router = await createRouter(ssrContext, config, { store })
<% if (store) { %>
const store = createStore(ssrContext)
// Add this.$router into store actions/mutations

@@ -188,2 +188,3 @@ store.$router = router

beforeRenderFns: ssrContext ? ssrContext.beforeRenderFns : undefined,
beforeSerializeFns: ssrContext ? ssrContext.beforeSerializeFns : undefined,
ssrContext

@@ -190,0 +191,0 @@ })

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

res += (route.redirect) ? nextIndent + 'redirect: ' + (typeof route.redirect === 'function' ? serialize(route.redirect) : JSON.stringify(route.redirect)) : ''
res += (route.meta) ? nextIndent + 'meta: ' + JSON.stringify(route.meta) : ''
res += (route.meta) ? nextIndent + 'meta: ' + serialize(route.meta) : ''
res += (typeof route.props !== 'undefined') ? nextIndent + 'props: ' + (typeof route.props === 'function' ? serialize(route.props) : JSON.stringify(route.props)) : ''

@@ -58,0 +58,0 @@ res += (typeof route.caseSensitive !== 'undefined') ? nextIndent + 'caseSensitive: ' + JSON.stringify(route.caseSensitive) : ''

@@ -69,5 +69,11 @@ <% if (router.scrollBehavior) { %>

try {
if (document.querySelector(hash)) {
const el = document.querySelector(hash)
if (el) {
// scroll to anchor by returning the selector
position = { selector: hash }
// Respect any scroll-margin-top set in CSS when scrolling to anchor
const y = Number(getComputedStyle(el)['scroll-margin-top']?.replace('px', ''))
if (y) {
position.offset = { y }
}
}

@@ -74,0 +80,0 @@ } catch (e) {

import Vue from 'vue'
import { joinURL, normalizeURL, withQuery } from 'ufo'
<% if (fetch.server) { %>import fetch from 'node-fetch'<% } %>
<% if (fetch.server) { %>import fetch from 'node-fetch-native'<% } %>
<% if (features.middleware) { %>import middleware from './middleware.js'<% } %>
import {
<% if (features.asyncData) { %>applyAsyncData,<% } %>
<% if (features.middleware) { %>middlewareSeries,<% } %>
<% if (features.middleware && features.layouts) { %>sanitizeComponent,<% } %>
<% if (features.asyncData) { %> applyAsyncData,<% } %>
<% if (features.middleware) { %> middlewareSeries,<% } %>
<% if (features.middleware && features.layouts) { %> sanitizeComponent,<% } %>
getMatchedComponents,
promisify
} from './utils.js'
<% if (features.fetch) { %>import fetchMixin from './mixins/fetch.server'<% } %>
import { createApp<% if (features.layouts) { %>, NuxtError<% } %> } from './index.js'
<% if (features.fetch) { %>import fetchMixin from './mixins/fetch.server'<% } %>
import { createApp<% if (features.layouts) { %>, NuxtError <% } %> } from './index.js'
import NuxtLink from './components/nuxt-link.server.js' // should be included after ./index.js
<% if (features.fetch) { %>
// Update serverPrefetch strategy
Vue.config.optionMergeStrategies.serverPrefetch = Vue.config.optionMergeStrategies.created
// Update serverPrefetch strategy
Vue.config.optionMergeStrategies.serverPrefetch = Vue.config.optionMergeStrategies.created
// Fetch mixin
if (!Vue.__nuxt__fetch__mixin__) {
Vue.mixin(fetchMixin)
Vue.__nuxt__fetch__mixin__ = true
}
// Fetch mixin
if (!Vue.__nuxt__fetch__mixin__) {
Vue.mixin(fetchMixin)
Vue.__nuxt__fetch__mixin__ = true
}
<% } %>

@@ -29,21 +29,21 @@

if (!Vue.__original_use__) {
Vue.__original_use__ = Vue.use
Vue.__install_times__ = 0
Vue.use = function (plugin, ...args) {
plugin.__nuxt_external_installed__ = Vue._installedPlugins.includes(plugin)
return Vue.__original_use__(plugin, ...args)
Vue.__original_use__ = Vue.use
Vue.__install_times__ = 0
Vue.use = function (plugin, ...args) {
plugin.__nuxt_external_installed__ = Vue._installedPlugins.includes(plugin)
return Vue.__original_use__(plugin, ...args)
}
}
}
if (Vue.__install_times__ === 2) {
Vue.__install_times__ = 0
Vue._installedPlugins = Vue._installedPlugins.filter(plugin => {
return plugin.__nuxt_external_installed__ === true
})
}
Vue.__install_times__++
<% } %>
if (Vue.__install_times__ === 2) {
Vue.__install_times__ = 0
Vue._installedPlugins = Vue._installedPlugins.filter(plugin => {
return plugin.__nuxt_external_installed__ === true
})
}
Vue.__install_times__++
<% } %>
// Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink)
<% if (features.componentAliases) { %>Vue.component('NLink', NuxtLink)<% } %>
// Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink)
<% if (features.componentAliases) { %> Vue.component('NLink', NuxtLink) <% } %>

@@ -62,3 +62,3 @@ <% if (fetch.server) { %>if (!global.fetch) { global.fetch = fetch }<% } %>

let fullPath = withQuery(opts.path, opts.query)
const $config = ssrContext.runtimeConfig || {}
const $config = ssrContext.nuxt.config || {}
const routerBase = ($config._app && $config._app.basePath) || '<%= router.base %>'

@@ -90,6 +90,9 @@ if (!fullPath.startsWith('http') && (routerBase !== '/' && !fullPath.startsWith(routerBase))) {

ssrContext.beforeRenderFns = []
// for beforeSerialize(nuxtState)
ssrContext.beforeSerializeFns = []
// Nuxt object (window.{{globals.context}}, defaults to window.__NUXT__)
ssrContext.nuxt = { <% if (features.layouts) { %>layout: 'default', <% } %>data: [], <% if (features.fetch) { %>fetch: {}, <% } %>error: null<%= (store ? ', state: null' : '') %>, serverRendered: true, routePath: '' }
ssrContext.nuxt = { <% if (features.layouts) { %> layout: 'default', <% } %> data: [], <% if (features.fetch) { %> fetch: { }, <% } %> error: null <%= (store ? ', state: null' : '') %>, serverRendered: true, routePath: ''
}
<% if (features.fetch) { %>
ssrContext.fetchCounters = {}
ssrContext.fetchCounters = { }
<% } %>

@@ -105,40 +108,48 @@

ssrContext.nuxt.config = ssrContext.runtimeConfig.public
if (ssrContext.nuxt.config._app) {
__webpack_public_path__ = joinURL(ssrContext.nuxt.config._app.cdnURL, ssrContext.nuxt.config._app.assetsPath)
}
// Create the app definition and the instance (created for each request)
const { app, router<%= (store ? ', store' : '') %> } = await createApp(ssrContext, ssrContext.runtimeConfig.private)
const _app = new Vue(app)
// Add ssr route path to nuxt context so we can account for page navigation between ssr and csr
ssrContext.nuxt.routePath = app.context.route.path
if (ssrContext.nuxt.config._app) {
__webpack_public_path__ = joinURL(ssrContext.nuxt.config._app.cdnURL, ssrContext.nuxt.config._app.assetsPath)
}
// Create the app definition and the instance (created for each request)
const { app, router<%= (store ? ', store' : '') %> } = await createApp(ssrContext, ssrContext.runtimeConfig.private)
const _app = new Vue(app)
// Add ssr route path to nuxt context so we can account for page navigation between ssr and csr
ssrContext.nuxt.routePath = app.context.route.path
<% if (features.meta) { %>
// Add meta infos (used in renderer.js)
ssrContext.meta = _app.$meta()
<% } %>
// Add meta infos (used in renderer.js)
ssrContext.meta = _app.$meta()
<% } %>
<% if (features.asyncData) { %>
// Keep asyncData for each matched component in ssrContext (used in app/utils.js via this.$ssrContext)
ssrContext.asyncData = {}
ssrContext.asyncData = { }
<% } %>
const beforeRender = async () => {
// Call beforeNuxtRender() methods
await Promise.all(ssrContext.beforeRenderFns.map(fn => promisify(fn, { Components, nuxtState: ssrContext.nuxt })))
<% if (store) { %>
ssrContext.rendered = () => {
// Add the state from the vuex store
ssrContext.nuxt.state = store.state
// Call beforeNuxtRender() methods
await Promise.all(ssrContext.beforeRenderFns.map(fn => promisify(fn, { Components, nuxtState: ssrContext.nuxt })))
ssrContext.rendered = () => {
// Call beforeSerialize() hooks
ssrContext.beforeSerializeFns.forEach(fn => fn(ssrContext.nuxt))
<% if (store) { %>
// Add the state from the vuex store
ssrContext.nuxt.state = store.state
<% } %>
<% if (isFullStatic && store) { %>
// Stop recording store mutations
ssrContext.unsetMutationObserver()
// unsetMutationObserver is only set after all router middleware are evaluated
if (ssrContext.unsetMutationObserver) {
ssrContext.unsetMutationObserver()
}
<% } %>
}
<% } %>
}
const renderErrorPage = async () => {
// Don't server-render the page in static target
if (ssrContext.target === 'static') {
ssrContext.nuxt.serverRendered = false
}
const renderErrorPage = async () => {
// Don't server-render the page in static target
if (ssrContext.target === 'static') {
ssrContext.nuxt.serverRendered = false
}
<% if (features.layouts) { %>

@@ -151,12 +162,12 @@ // Load layout for error page

_app.setLayout(errLayout)
<% } %>
await beforeRender()
return _app
}
const render404Page = () => {
app.context.error({ statusCode: 404, path: ssrContext.url, message: '<%= messages.error_404 %>' })
return renderErrorPage()
}
<% } %>
await beforeRender()
return _app
}
const render404Page = () => {
app.context.error({ statusCode: 404, path: ssrContext.url, message: '<%= messages.error_404 %>' })
return renderErrorPage()
}
<% if (debug) { %>const s = Date.now()<% } %>
<% if (debug) { %>const s = Date.now() <% } %>

@@ -171,16 +182,16 @@ // Components are already resolved by setContext -> getRouteData (app/utils.js)

if (store._actions && store._actions.nuxtServerInit) {
try {
await store.dispatch('nuxtServerInit', app.context)
} catch (err) {
console.debug('Error occurred when calling nuxtServerInit: ', err.message)<%= isTest ? '// eslint-disable-line no-console' : '' %>
try {
await store.dispatch('nuxtServerInit', app.context)
} catch (err) {
console.debug('Error occurred when calling nuxtServerInit: ', err.message) <%= isTest ? '// eslint-disable-line no-console' : '' %>
throw err
}
}
}
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
<% } %>

@@ -193,11 +204,11 @@

let midd = <%= serialize(router.middleware).replace('middleware(', 'function(') %><%= isTest ? '// eslint-disable-line' : '' %>
midd = midd.map((name) => {
if (typeof name === 'function') {
return name
}
if (typeof middleware[name] !== 'function') {
app.context.error({ statusCode: 500, message: 'Unknown middleware ' + name })
}
return middleware[name]
})
midd = midd.map((name) => {
if (typeof name === 'function') {
return name
}
if (typeof middleware[name] !== 'function') {
app.context.error({ statusCode: 500, message: 'Unknown middleware ' + name })
}
return middleware[name]
})
await middlewareSeries(midd, app.context)

@@ -217,3 +228,3 @@ // ...If there is a redirect or an error, stop the process

ssrContext.unsetMutationObserver = store.subscribe(m => { ssrContext.nuxt.mutations.push([m.type, m.payload]) })
<% } %>
<% } %>

@@ -234,3 +245,3 @@ <% if (features.layouts) { %>

ssrContext.nuxt.layout = _app.layoutName
<% } %>
<% } %>

@@ -241,14 +252,14 @@ <% if (features.middleware) { %>

*/
midd = []
<% if (features.layouts) { %>
layout = sanitizeComponent(layout)
if (layout.options.middleware) {
midd = midd.concat(layout.options.middleware)
}
midd =[]
<% if (features.layouts) { %>
layout = sanitizeComponent(layout)
if (layout.options.middleware) {
midd = midd.concat(layout.options.middleware)
}
<% } %>
Components.forEach((Component) => {
if (Component.options.middleware) {
midd = midd.concat(Component.options.middleware)
}
})
Components.forEach((Component) => {
if (Component.options.middleware) {
midd = midd.concat(Component.options.middleware)
}
})
midd = midd.map((name) => {

@@ -308,4 +319,4 @@ if (typeof name === 'function') {

if (!Components.length) {
return render404Page()
}
return render404Page()
}

@@ -315,3 +326,3 @@ <% if (features.asyncData || features.fetch) { %>

const asyncDatas = await Promise.all(Components.map((Component) => {
const promises = []
const promises = []

@@ -321,12 +332,12 @@ <% if (features.asyncData) { %>

if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
const promise = promisify(Component.options.asyncData, app.context)
promise.then((asyncDataResult) => {
ssrContext.asyncData[Component.cid] = asyncDataResult
applyAsyncData(Component)
return asyncDataResult
})
promises.push(promise)
} else {
promises.push(null)
}
const promise = promisify(Component.options.asyncData, app.context)
promise.then((asyncDataResult) => {
ssrContext.asyncData[Component.cid] = asyncDataResult
applyAsyncData(Component)
return asyncDataResult
})
promises.push(promise)
} else {
promises.push(null)
}
<% } %>

@@ -344,22 +355,22 @@

return Promise.all(promises)
}))
}))
<% if (debug) { %>if (process.env.DEBUG && asyncDatas.length) console.debug('Data fetching ' + ssrContext.url + ': ' + (Date.now() - s) + 'ms')<% } %>
<% if (debug) { %>if (process.env.DEBUG && asyncDatas.length) console.debug('Data fetching ' + ssrContext.url + ': ' + (Date.now() - s) + 'ms') <% } %>
// datas are the first row of each
ssrContext.nuxt.data = asyncDatas.map(r => r[0] || {})
<% } %>
// datas are the first row of each
ssrContext.nuxt.data = asyncDatas.map(r => r[0] || {})
<% } %>
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
// Call beforeNuxtRender methods & add store state
await beforeRender()
// Call beforeNuxtRender methods & add store state
await beforeRender()
return _app
return _app
}

@@ -61,3 +61,2 @@ import Vue from 'vue'

instances.push(child)
continue; // Don't get the children since it will reload the template
}

@@ -253,4 +252,4 @@ if (child.$children) {

if (process.client) {
// https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
window.location.replace(path)
// https://developer.mozilla.org/en-US/docs/Web/API/Location/assign
window.location.assign(path)

@@ -264,2 +263,3 @@ // Throw a redirect error

app.context.beforeNuxtRender = fn => context.beforeRenderFns.push(fn)
app.context.beforeSerialize = fn => context.beforeSerializeFns.push(fn)
}

@@ -266,0 +266,0 @@ if (process.client) {

@@ -17,3 +17,3 @@ {

{
"name": "next-child-key",
"name": "nuxt-child-key",
"value": {

@@ -20,0 +20,0 @@ "kind": "expression",

Sorry, the diff of this file is not supported yet

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