Socket
Socket
Sign inDemoInstall

druxt-router

Package Overview
Dependencies
4
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.19.1 to 0.20.0

dist/components/DruxtRoute.vue

14

CHANGELOG.md
# druxt-router
## 0.20.0
### Minor Changes
- 1ab762c: Enabled Nuxt Vuex store by default
- ecefef5: Added option to disable wildcard route
- 715e5ef: Updated component registration method to use the Nuxt `components:dirs` hook
- cbc66cd: Added option to disable `pages/` routes
### Patch Changes
- Updated dependencies [715e5ef]
- druxt@0.10.0
## 0.19.1

@@ -4,0 +18,0 @@

48

dist/druxt-router.esm.js

@@ -1,2 +0,2 @@

import { resolve } from 'path';
import { join, resolve } from 'path';
import { DruxtClient } from 'druxt';

@@ -6,3 +6,3 @@ import Url from 'url-parse';

const DruxtRouterNuxtModule = function(moduleOptions = {}) {
const DruxtRouterNuxtModule = function() {
if (typeof this.options === "undefined" || !this.options.druxt) {

@@ -12,19 +12,28 @@ throw new TypeError("Druxt settings missing.");

const options = this.options.druxt;
options.router = options.router || {};
this.extendRoutes((routes, resolve2) => {
if (!options.router.component) {
options.router.component = resolve2(this.options.buildDir, "components/druxt-router.js");
this.addTemplate({
src: resolve2(__dirname, "../nuxt/component.js"),
fileName: "components/druxt-router.js",
options
options.router = {
pages: true,
wildcard: true,
...options.router
};
this.nuxt.hook("components:dirs", (dirs) => {
dirs.push({ path: join(__dirname, "components") });
});
if (options.router.wildcard) {
this.addTemplate({
src: resolve(__dirname, "../nuxt/component.js"),
fileName: "components/druxt-router.js",
options
});
this.extendRoutes((routes, resolve2) => {
routes.push({
name: "druxt-router",
path: "*",
component: resolve2(this.options.buildDir, "components/druxt-router.js"),
chunkName: "druxt-router"
});
}
routes.push({
name: "druxt-router",
path: "*",
component: options.router.component,
chunkName: "druxt-router"
});
});
}
if (options.router.wildcard && !options.router.pages) {
this.nuxt.hook("build:before", () => this.nuxt.options.build.createRoutes = () => []);
}
this.addPlugin({

@@ -35,2 +44,3 @@ src: resolve(__dirname, "../nuxt/plugin.js"),

});
this.options.store = true;
this.addPlugin({

@@ -239,3 +249,3 @@ src: resolve(__dirname, "../nuxt/store.js"),

actions: {
async get({ commit, dispatch, state }, path) {
async get({ commit, dispatch }, path) {
const route = await dispatch("getRoute", path);

@@ -259,3 +269,3 @@ if (route.error && typeof route.error.statusCode !== "undefined" && ((this.app || {}).context || {}).error) {

},
async getResources(app, { resource, query, options }) {
async getResources(app, { resource, query }) {
console.warn("[druxt-router] `druxtRouter/getResources` is deprecated. See http://druxtjs.org/api/stores/druxt.");

@@ -262,0 +272,0 @@ const collection = await this.app.store.dispatch("druxt/getCollection", { type: resource, query });

@@ -14,3 +14,3 @@ 'use strict';

const DruxtRouterNuxtModule = function(moduleOptions = {}) {
const DruxtRouterNuxtModule = function() {
if (typeof this.options === "undefined" || !this.options.druxt) {

@@ -20,19 +20,28 @@ throw new TypeError("Druxt settings missing.");

const options = this.options.druxt;
options.router = options.router || {};
this.extendRoutes((routes, resolve2) => {
if (!options.router.component) {
options.router.component = resolve2(this.options.buildDir, "components/druxt-router.js");
this.addTemplate({
src: resolve2(__dirname, "../nuxt/component.js"),
fileName: "components/druxt-router.js",
options
options.router = {
pages: true,
wildcard: true,
...options.router
};
this.nuxt.hook("components:dirs", (dirs) => {
dirs.push({ path: path.join(__dirname, "components") });
});
if (options.router.wildcard) {
this.addTemplate({
src: path.resolve(__dirname, "../nuxt/component.js"),
fileName: "components/druxt-router.js",
options
});
this.extendRoutes((routes, resolve2) => {
routes.push({
name: "druxt-router",
path: "*",
component: resolve2(this.options.buildDir, "components/druxt-router.js"),
chunkName: "druxt-router"
});
}
routes.push({
name: "druxt-router",
path: "*",
component: options.router.component,
chunkName: "druxt-router"
});
});
}
if (options.router.wildcard && !options.router.pages) {
this.nuxt.hook("build:before", () => this.nuxt.options.build.createRoutes = () => []);
}
this.addPlugin({

@@ -43,2 +52,3 @@ src: path.resolve(__dirname, "../nuxt/plugin.js"),

});
this.options.store = true;
this.addPlugin({

@@ -247,3 +257,3 @@ src: path.resolve(__dirname, "../nuxt/store.js"),

actions: {
async get({ commit, dispatch, state }, path) {
async get({ commit, dispatch }, path) {
const route = await dispatch("getRoute", path);

@@ -267,3 +277,3 @@ if (route.error && typeof route.error.statusCode !== "undefined" && ((this.app || {}).context || {}).error) {

},
async getResources(app, { resource, query, options }) {
async getResources(app, { resource, query }) {
console.warn("[druxt-router] `druxtRouter/getResources` is deprecated. See http://druxtjs.org/api/stores/druxt.");

@@ -270,0 +280,0 @@ const collection = await this.app.store.dispatch("druxt/getCollection", { type: resource, query });

{
"name": "druxt-router",
"version": "0.19.1",
"version": "0.20.0",
"description": "Drupal router for Nuxt, powered by the Drupal Decoupled Router module.",

@@ -34,3 +34,3 @@ "keywords": [

"dependencies": {
"druxt": "^0.9.0",
"druxt": "^0.10.0",
"url-parse": "^1.4.7"

@@ -37,0 +37,0 @@ },

@@ -47,2 +47,11 @@ # DruxtJS Router

### Druxt Router options
These options are specific to this module.
| Option | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `router.pages` | `boolean` | No | `true` | Whether to parse the Nuxt `pages/` directory. |
| `router.wildcard` | `boolean` | No | `true` | Whether to install the wildcard route. |
### Base Druxt options

@@ -49,0 +58,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc