@storyblok/nuxt 5.4.9 → 5.5.0

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/README.md CHANGED
@@ -76,8 +76,9 @@ export default defineNuxtConfig({
76
76
 
77
77
  #### Options
78
78
 
79
- When you initialize the module, you can pass all [_@storyblok/vue_ options](https://github.com/storyblok/storyblok-vue#storyblok-api) plus a `bridge` option explained in our [JS SDK Storyblok bridge section](https://github.com/storyblok/storyblok-js#storyblok-bridge).
80
- If you want to use Storyblok inside `nuxt-devtools` you can use the option `devtools`, if enabled, make sure to have installed the @nuxt/devtools module and enable it on your nuxt config.
79
+ When you initialize the module, you can pass all [_@storyblok/vue_ options](https://github.com/storyblok/storyblok-vue#storyblok-api) plus a `bridge` option explained in our [JS SDK Storyblok bridge section](https://github.com/storyblok/storyblok-js#storyblok-bridge) and a `enableSudoMode` option to define your own plugin (see below).
80
+
81
+ > If you want to use Storyblok inside `nuxt-devtools` you can use the option `devtools`, if enabled, make sure to have installed the @nuxt/devtools module and enable it on your nuxt config.
81
82
 
82
83
  ```js
83
84
  // Defaults
@@ -91,6 +92,47 @@ If you want to use Storyblok inside `nuxt-devtools` you can use the option `devt
91
92
  }]
92
93
  ```
93
94
 
95
+ **Define your own plugin**
96
+
97
+ While the recommended approach covers most cases, there are specific instances where you may need to use the `enableSudoMode` option and disable our plugin, allowing you to incorporate your own.
98
+
99
+ ```js
100
+ // nuxt.config.ts
101
+ modules: [
102
+ [
103
+ "@storyblok/nuxt",
104
+ {
105
+ accessToken: "<your-access-token>",
106
+ enableSudoMode: true
107
+ }
108
+ ]
109
+ ];
110
+ ```
111
+
112
+ To include additional functionalities in the SDK's `apiOptions`, such as custom cache methods, you can implement the following solution inside the plugins folder (autoimported):
113
+
114
+ ```js
115
+ // plugins/storyblok.js
116
+ import { StoryblokVue, apiPlugin } from "@storyblok/vue";
117
+
118
+ export default defineNuxtPlugin(({ vueApp }) => {
119
+ vueApp.use(StoryblokVue, {
120
+ accessToken: "<your-access-token>",
121
+ apiOptions: {
122
+ cache: {
123
+ type: "custom",
124
+ custom: {
125
+ flush() {
126
+ console.log("all right");
127
+ }
128
+ }
129
+ }
130
+ },
131
+ use: [apiPlugin]
132
+ });
133
+ });
134
+ ```
135
+
94
136
  #### Region parameter
95
137
 
96
138
  Possible values:
package/dist/module.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
3
  interface ModuleOptions {
4
4
  accessToken: string;
5
+ enableSudoMode: boolean;
5
6
  usePlugin: boolean;
6
7
  bridge: boolean;
7
8
  devtools: boolean;
package/dist/module.mjs CHANGED
@@ -7,7 +7,9 @@ const module = defineNuxtModule({
7
7
  },
8
8
  defaults: {
9
9
  accessToken: "",
10
+ enableSudoMode: false,
10
11
  usePlugin: true,
12
+ // legacy opt. for enableSudoMode
11
13
  bridge: true,
12
14
  devtools: false,
13
15
  apiOptions: {}
@@ -22,7 +24,8 @@ const module = defineNuxtModule({
22
24
  nuxt.options.build.transpile.push("@storyblok/nuxt");
23
25
  nuxt.options.build.transpile.push("@storyblok/vue");
24
26
  nuxt.options.runtimeConfig.public.storyblok = options;
25
- if (options.usePlugin !== false) {
27
+ const enablePluginCondition = options.usePlugin === true && options.enableSudoMode === false;
28
+ if (enablePluginCondition) {
26
29
  addPlugin(resolver.resolve("./runtime/plugin"));
27
30
  }
28
31
  const names = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyblok/nuxt",
3
- "version": "5.4.9",
3
+ "version": "5.5.0",
4
4
  "description": "Storyblok Nuxt module",
5
5
  "type": "module",
6
6
  "exports": {
@@ -28,14 +28,14 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@nuxt/kit": "^3.4.2",
31
- "@storyblok/vue": "^7.1.8"
31
+ "@storyblok/vue": "^7.1.9"
32
32
  },
33
33
  "devDependencies": {
34
- "@babel/core": "^7.22.1",
34
+ "@babel/core": "^7.22.5",
35
35
  "@cypress/vite-dev-server": "^5.0.5",
36
36
  "@nuxt/module-builder": "latest",
37
37
  "babel-jest": "^29.4.3",
38
- "cypress": "^12.13.0",
38
+ "cypress": "^12.14.0",
39
39
  "eslint-plugin-cypress": "^2.13.3",
40
40
  "jest": "^29.4.3",
41
41
  "start-server-and-test": "^2.0.0",