New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nuxtjs-drupal-ce

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxtjs-drupal-ce - npm Package Compare versions

Comparing version 1.0.0-alpha4 to 1.0.0-alpha5

81

lib/plugin.js

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

title: null,
statusCode: null,
metadata: {

@@ -30,9 +31,2 @@ meta: [],

})
/**
* Returns an object for rendering as Vue component.
*/
this.$currentPage.contentComponent = () => {
return { name: 'DrupalContent', template: this.$currentPage.content }
}
}

@@ -59,3 +53,3 @@

}
const data = await this.$axios.get(path, config).then(res => res.data)
const { data, status } = await this.$axios.get(path, config)
if (!data.title || !data.content) {

@@ -66,13 +60,21 @@ return this.context.error({

}
this.$currentPage.title = data.title
this.$currentPage.metadata = this.processMetaData(data.metatags)
this.$currentPage.content = data.content
this.$currentPage.breadcrumbs = Array.isArray(data.breadcrumbs) ? data.breadcrumbs : [],
this.$currentPage.messages = this.processMessages(data.messages)
this.$currentPage.localTasks = data.local_tasks
this.$currentPage.settings = data.settings
this.processPageResponse(data, status)
return this.$currentPage
} catch (err) {
this.context.error(err)
return err
} catch (error) {
if (error.response) {
// Request made and server responded. If we get a proper Drupal error
// page, apply it and propagate the error code.
if (error.response.data && error.response.data.title && error.response.data.content) {
this.processPageResponse(error.response.data, error.response.status)
} else {
this.context.error({ statusCode: error.response.status, message: error.message })
}
} else if (error.request) {
// The request was made but no response was received. Usually this
// means a network error.
this.context.error({ statusCode: 503, message: error.message })
} else {
// Some other error happened, so be verbose about it.
this.context.error({ statusCode: 400, message: error.message })
}
}

@@ -82,7 +84,25 @@ }

/**
* Generates `hid` keys for metatags and links.
* Updates $currentpage based upon response data.
*/
processMetaData(metadata) {
const { meta = [], link = [] } = metadata;
metadata.meta = [...meta].map((metaObject) => {
processPageResponse(data, status) {
this.$currentPage.statusCode = status
this.$currentPage.title = data.title
this.$currentPage.metatags = this.processMetatags(data.metatags)
this.$currentPage.content = data.content
this.$currentPage.breadcrumbs = Array.isArray(data.breadcrumbs) ? data.breadcrumbs : [],
this.$currentPage.messages = this.processMessages(data.messages)
this.$currentPage.localTasks = data.local_tasks
this.$currentPage.settings = data.settings
// When possible, propagate status code (only in server mode).
if (this.context.res) {
this.context.res.statusCode = status
}
}
/**
* Generates `hid` keys for metatags.
*/
processMetatags(metatags) {
const { meta = [], link = [] } = metatags;
metatags.meta = [...meta].map((metaObject) => {
// Simply take the first key as hid, e.g. 'name'.

@@ -93,3 +113,3 @@ const firstKey = Object.keys(metaObject)[0]

})
metadata.link = [...link].map((linkObject) => {
metatags.link = [...link].map((linkObject) => {
// Simply take the first key as hid, e.g. 'name'.

@@ -100,3 +120,3 @@ const firstKey = Object.keys(linkObject)[0]

})
return metadata
return metatags
}

@@ -143,6 +163,13 @@

if (process.server) {
context.beforeNuxtRender(({ nuxtState }) => {
// Prepare data for client-side hydration.
nuxtState.drupal = drupal.$currentPage
})
}
const { nuxtState = {} } = context || {}
if (process.client && !nuxtState.drupal) {
await drupal.fetchPage(context.route.path)
// Client-side hydration
if (process.client && nuxtState.drupal) {
drupal.$currentPage = Vue.observable(nuxtState.drupal)
}

@@ -149,0 +176,0 @@

{
"name": "nuxtjs-drupal-ce",
"version": "1.0.0-alpha4",
"version": "1.0.0-alpha5",
"description": "A Nuxt.js module to easily connect Drupal via custom elements.",

@@ -5,0 +5,0 @@ "repository": "drunomics/nuxt-module-drupal-ce",

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