druxt 0.19.2 → 0.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/druxt.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import chalk from 'chalk';
2
2
  import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
3
- import { join, resolve } from 'path';
3
+ import { join, resolve, normalize } from 'path';
4
4
  import axios from 'axios';
5
5
  import { stringify } from 'querystring';
6
6
  import consola from 'consola';
@@ -251,7 +251,7 @@ class DruxtClient {
251
251
  }
252
252
 
253
253
  var name = "druxt";
254
- var version = "0.19.2";
254
+ var version = "0.19.3";
255
255
  var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
256
256
  var keywords = [
257
257
  "cms",
@@ -285,7 +285,6 @@ var main = "dist/druxt.ssr.js";
285
285
  var module = "dist/druxt.esm.js";
286
286
  var files = [
287
287
  "dist",
288
- "stories",
289
288
  "templates"
290
289
  ];
291
290
  var dependencies = {
@@ -340,6 +339,8 @@ const DruxtNuxtModule = async function(moduleOptions = {}) {
340
339
  ...moduleOptions,
341
340
  ...(this.options || {}).druxt
342
341
  };
342
+ this.options.baseUrl = options.baseUrl = options.baseUrl.endsWith("/") ? options.baseUrl.slice(0, -1) : options.baseUrl;
343
+ this.options.endpoint = options.endpoint = options.endpoint.startsWith("/") ? options.endpoint : `/${options.endpoint}`;
343
344
  const druxt = new DruxtClient(options.baseUrl, {
344
345
  ...options,
345
346
  proxy: { ...options.proxy || {}, api: false }
@@ -398,10 +399,10 @@ const DruxtNuxtModule = async function(moduleOptions = {}) {
398
399
  const extendPlugins = this.options.extendPlugins;
399
400
  this.options.extendPlugins = (plugins) => {
400
401
  plugins = typeof extendPlugins === "function" ? extendPlugins(plugins) : plugins;
401
- const axiosIndex = plugins.findIndex(({ src }) => src === `${this.options.buildDir}/axios.js`);
402
+ const axiosIndex = plugins.findIndex(({ src }) => src === normalize(`${this.options.buildDir}/axios.js`));
402
403
  const axiosPlugin = plugins[axiosIndex];
403
404
  plugins.splice(axiosIndex, 1);
404
- const druxtIndex = plugins.findIndex(({ src }) => src === `${this.options.buildDir}/druxt.js`);
405
+ const druxtIndex = plugins.findIndex(({ src }) => src === normalize(`${this.options.buildDir}/druxt.js`));
405
406
  const druxtPlugin = plugins[druxtIndex];
406
407
  plugins.splice(druxtIndex, 1);
407
408
  plugins = [axiosPlugin, druxtPlugin, ...plugins];
@@ -416,10 +417,23 @@ const DruxtNuxtModule = async function(moduleOptions = {}) {
416
417
  this.options.components = (_a = this.options.components) != null ? _a : true;
417
418
  this.options.cli.badgeMessages.push(`${chalk.blue.bold("Druxt")} @ v${meta.version}`);
418
419
  this.options.cli.badgeMessages.push(`${chalk.bold("API:")} ${chalk.blue.underline(options.baseUrl + options.endpoint)}`);
420
+ const self = this;
419
421
  this.nuxt.hook("storybook:config", async ({ stories }) => {
420
- stories.push("druxt/stories/*.stories.mdx");
421
- stories.push("druxt/dist/components/*.stories.mdx");
422
- stories.push("druxt/dist/components/*.stories.mjs");
422
+ self.addTemplate({
423
+ src: resolve(__dirname, "../templates/stories/README.stories.mdx"),
424
+ fileName: "stories/druxt-README.stories.mdx"
425
+ });
426
+ stories.push(resolve(self.options.buildDir, "./stories/druxt-README.stories.mdx"));
427
+ self.addTemplate({
428
+ src: resolve(__dirname, "../templates/stories/druxt-module.stories.mdx"),
429
+ fileName: "stories/druxt-module.stories.mdx"
430
+ });
431
+ stories.push(resolve(self.options.buildDir, "./stories/druxt-module.stories.mdx"));
432
+ self.addTemplate({
433
+ src: resolve(__dirname, "../templates/stories/druxt-debug.stories.js"),
434
+ fileName: "stories/druxt-debug.stories.js"
435
+ });
436
+ stories.push(resolve(self.options.buildDir, "./stories/druxt-debug.stories.js"));
423
437
  });
424
438
  };
425
439
 
package/dist/druxt.ssr.js CHANGED
@@ -264,7 +264,7 @@ class DruxtClient {
264
264
  }
265
265
 
266
266
  var name = "druxt";
267
- var version = "0.19.2";
267
+ var version = "0.19.3";
268
268
  var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
269
269
  var keywords = [
270
270
  "cms",
@@ -298,7 +298,6 @@ var main = "dist/druxt.ssr.js";
298
298
  var module$1 = "dist/druxt.esm.js";
299
299
  var files = [
300
300
  "dist",
301
- "stories",
302
301
  "templates"
303
302
  ];
304
303
  var dependencies = {
@@ -353,6 +352,8 @@ const DruxtNuxtModule = async function(moduleOptions = {}) {
353
352
  ...moduleOptions,
354
353
  ...(this.options || {}).druxt
355
354
  };
355
+ this.options.baseUrl = options.baseUrl = options.baseUrl.endsWith("/") ? options.baseUrl.slice(0, -1) : options.baseUrl;
356
+ this.options.endpoint = options.endpoint = options.endpoint.startsWith("/") ? options.endpoint : `/${options.endpoint}`;
356
357
  const druxt = new DruxtClient(options.baseUrl, {
357
358
  ...options,
358
359
  proxy: { ...options.proxy || {}, api: false }
@@ -411,10 +412,10 @@ const DruxtNuxtModule = async function(moduleOptions = {}) {
411
412
  const extendPlugins = this.options.extendPlugins;
412
413
  this.options.extendPlugins = (plugins) => {
413
414
  plugins = typeof extendPlugins === "function" ? extendPlugins(plugins) : plugins;
414
- const axiosIndex = plugins.findIndex(({ src }) => src === `${this.options.buildDir}/axios.js`);
415
+ const axiosIndex = plugins.findIndex(({ src }) => src === path.normalize(`${this.options.buildDir}/axios.js`));
415
416
  const axiosPlugin = plugins[axiosIndex];
416
417
  plugins.splice(axiosIndex, 1);
417
- const druxtIndex = plugins.findIndex(({ src }) => src === `${this.options.buildDir}/druxt.js`);
418
+ const druxtIndex = plugins.findIndex(({ src }) => src === path.normalize(`${this.options.buildDir}/druxt.js`));
418
419
  const druxtPlugin = plugins[druxtIndex];
419
420
  plugins.splice(druxtIndex, 1);
420
421
  plugins = [axiosPlugin, druxtPlugin, ...plugins];
@@ -429,10 +430,23 @@ const DruxtNuxtModule = async function(moduleOptions = {}) {
429
430
  this.options.components = (_a = this.options.components) != null ? _a : true;
430
431
  this.options.cli.badgeMessages.push(`${chalk__default["default"].blue.bold("Druxt")} @ v${meta.version}`);
431
432
  this.options.cli.badgeMessages.push(`${chalk__default["default"].bold("API:")} ${chalk__default["default"].blue.underline(options.baseUrl + options.endpoint)}`);
433
+ const self = this;
432
434
  this.nuxt.hook("storybook:config", async ({ stories }) => {
433
- stories.push("druxt/stories/*.stories.mdx");
434
- stories.push("druxt/dist/components/*.stories.mdx");
435
- stories.push("druxt/dist/components/*.stories.mjs");
435
+ self.addTemplate({
436
+ src: path.resolve(__dirname, "../templates/stories/README.stories.mdx"),
437
+ fileName: "stories/druxt-README.stories.mdx"
438
+ });
439
+ stories.push(path.resolve(self.options.buildDir, "./stories/druxt-README.stories.mdx"));
440
+ self.addTemplate({
441
+ src: path.resolve(__dirname, "../templates/stories/druxt-module.stories.mdx"),
442
+ fileName: "stories/druxt-module.stories.mdx"
443
+ });
444
+ stories.push(path.resolve(self.options.buildDir, "./stories/druxt-module.stories.mdx"));
445
+ self.addTemplate({
446
+ src: path.resolve(__dirname, "../templates/stories/druxt-debug.stories.js"),
447
+ fileName: "stories/druxt-debug.stories.js"
448
+ });
449
+ stories.push(path.resolve(self.options.buildDir, "./stories/druxt-debug.stories.js"));
436
450
  });
437
451
  };
438
452
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt",
3
- "version": "0.19.2",
3
+ "version": "0.19.3",
4
4
  "description": "The Fully Decoupled Drupal Framework for Nuxt.js.",
5
5
  "keywords": [
6
6
  "cms",
@@ -34,7 +34,6 @@
34
34
  "module": "dist/druxt.esm.js",
35
35
  "files": [
36
36
  "dist",
37
- "stories",
38
37
  "templates"
39
38
  ],
40
39
  "dependencies": {
@@ -1,4 +1,4 @@
1
- import DruxtDebug from './DruxtDebug.vue'
1
+ import DruxtDebug from 'druxt/dist/components/DruxtDebug.vue'
2
2
 
3
3
  export default {
4
4
  title: 'Druxt/DruxtDebug',
@@ -27,7 +27,9 @@ Json.args = {
27
27
  }
28
28
  Json.parameters = {
29
29
  docs: {
30
- storyDescription: 'The **json** prop takes any data and runs it through a basic JSON formatter for improved readability.',
30
+ description: {
31
+ story: 'The **json** prop takes any data and runs it through a basic JSON formatter for improved readability.',
32
+ },
31
33
  source: {
32
34
  code: '<DruxtDebug :json="entity" open>Debug information</DruxtDebug>'
33
35
  },
@@ -40,7 +42,9 @@ Summary.args = {
40
42
  }
41
43
  Summary.parameters = {
42
44
  docs: {
43
- storyDescription: 'The **summary** prop can be used to provide a quick explanation of the debug component.',
45
+ description: {
46
+ story: 'The **summary** prop can be used to provide a quick explanation of the debug component.',
47
+ },
44
48
  source: {
45
49
  code: `<DruxtDebug summary="${Summary.args.sumary}">Debug information</DruxtDebug>`
46
50
  },
@@ -102,7 +102,7 @@ Druxt module.
102
102
  import DruxtModule from 'druxt/dist/components/DruxtModule.vue'
103
103
  export default {
104
104
  name: 'MyModule',
105
- extends: DruxtModule
105
+ extends: DruxtModule,
106
106
  druxt: {
107
107
  async fetchConfig() {
108
108
  // Load configuration data here.
@@ -113,7 +113,7 @@ export default {
113
113
  // Build nested arrays of component options based on the context.
114
114
  componentOptions: (context) => ([['default']]),
115
115
  // Map props data from the context.
116
- propsData: (context) => ({ ...context }),
116
+ propsData: (context) => ({}),
117
117
  // Build slots render arrays.
118
118
  slots(h) {
119
119
  return {