@storyblok/nuxt 6.0.13 → 6.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Storyblok GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -44,11 +44,11 @@ npx nuxi@latest module add storyblok
44
44
  Add following code to modules section of `nuxt.config.js` and replace the accessToken with API token from Storyblok space.
45
45
 
46
46
  ```js
47
- import { defineNuxtConfig } from "nuxt";
47
+ import { defineNuxtConfig } from 'nuxt';
48
48
 
49
49
  export default defineNuxtConfig({
50
50
  modules: [
51
- ["@storyblok/nuxt", { accessToken: "<your-access-token>" }]
51
+ ['@storyblok/nuxt', { accessToken: '<your-access-token>' }]
52
52
  // ...
53
53
  ]
54
54
  });
@@ -57,12 +57,12 @@ export default defineNuxtConfig({
57
57
  You can also use the `storyblok` config if you prefer:
58
58
 
59
59
  ```js
60
- import { defineNuxtConfig } from "nuxt";
60
+ import { defineNuxtConfig } from 'nuxt';
61
61
 
62
62
  export default defineNuxtConfig({
63
- modules: ["@storyblok/nuxt"],
63
+ modules: ['@storyblok/nuxt'],
64
64
  storyblok: {
65
- accessToken: "<your-access-token>"
65
+ accessToken: '<your-access-token>'
66
66
  }
67
67
  });
68
68
  ```
@@ -97,9 +97,9 @@ While the recommended approach covers most cases, there are specific instances w
97
97
  // nuxt.config.ts
98
98
  modules: [
99
99
  [
100
- "@storyblok/nuxt",
100
+ '@storyblok/nuxt',
101
101
  {
102
- accessToken: "<your-access-token>",
102
+ accessToken: '<your-access-token>',
103
103
  enableSudoMode: true
104
104
  }
105
105
  ]
@@ -110,17 +110,17 @@ To include additional functionalities in the SDK's `apiOptions`, such as custom
110
110
 
111
111
  ```js
112
112
  // plugins/storyblok.js
113
- import { StoryblokVue, apiPlugin } from "@storyblok/vue";
113
+ import { apiPlugin, StoryblokVue } from '@storyblok/vue';
114
114
 
115
115
  export default defineNuxtPlugin(({ vueApp }) => {
116
116
  vueApp.use(StoryblokVue, {
117
- accessToken: "<your-access-token>",
117
+ accessToken: '<your-access-token>',
118
118
  apiOptions: {
119
119
  cache: {
120
- type: "custom",
120
+ type: 'custom',
121
121
  custom: {
122
122
  flush() {
123
- console.log("all right");
123
+ console.log('all right');
124
124
  }
125
125
  }
126
126
  }
@@ -280,9 +280,7 @@ You can easily render rich text by using the `renderRichText` function that come
280
280
 
281
281
  <script setup>
282
282
  const props = defineProps({ blok: Object });
283
- const articleContent = computed(() =>
284
- renderRichText(props.blok.articleContent)
285
- );
283
+ const articleContent = computed(() => renderRichText(props.blok.articleContent));
286
284
  </script>
287
285
  ```
288
286
 
@@ -290,7 +288,7 @@ You can also set a **custom Schema and component resolver** by passing the optio
290
288
 
291
289
  ```html
292
290
  <script setup>
293
- import cloneDeep from "clone-deep";
291
+ import cloneDeep from 'clone-deep';
294
292
 
295
293
  const mySchema = cloneDeep(RichTextSchema); // you can make a copy of the default RichTextSchema
296
294
  // ... and edit the nodes and marks, or add your own.
@@ -303,13 +301,13 @@ You can also set a **custom Schema and component resolver** by passing the optio
303
301
  schema: mySchema,
304
302
  resolver: (component, blok) => {
305
303
  switch (component) {
306
- case "my-custom-component":
304
+ case 'my-custom-component':
307
305
  return `<div class="my-component-class">${blok.text}</div>`;
308
306
  default:
309
- return "Resolver not defined";
307
+ return 'Resolver not defined';
310
308
  }
311
- }
312
- })
309
+ },
310
+ }),
313
311
  );
314
312
  </script>
315
313
  ```
@@ -333,7 +331,7 @@ In your `nuxt.config.ts`:
333
331
  export default defineNuxtConfig({
334
332
  runtimeConfig: {
335
333
  public: {
336
- storyblokVersion: process.env.STORYBLOK_VERSION || "published"
334
+ storyblokVersion: process.env.STORYBLOK_VERSION || 'published'
337
335
  }
338
336
  }
339
337
  });
@@ -345,19 +343,19 @@ Then you can access the runtime config in your components:
345
343
  const config = useRuntimeConfig();
346
344
 
347
345
  const story = await useAsyncStoryblok(
348
- "blog",
346
+ 'blog',
349
347
  {
350
348
  version: config.public.storyblokVersion,
351
- resolve_relations: "overview.featured_story"
349
+ resolve_relations: 'overview.featured_story'
352
350
  },
353
- { resolveRelations: "overview.featured_story" }
351
+ { resolveRelations: 'overview.featured_story' }
354
352
  );
355
353
 
356
- //or
354
+ // or
357
355
 
358
- const { data: articles } = await storyblokApi.get("cdn/stories", {
356
+ const { data: articles } = await storyblokApi.get('cdn/stories', {
359
357
  version: config.public.storyblokVersion,
360
- starts_with: "blog",
358
+ starts_with: 'blog',
361
359
  is_startpage: false
362
360
  });
363
361
  ```
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@storyblok/nuxt",
3
3
  "configKey": "storyblok",
4
- "version": "6.0.13",
4
+ "version": "6.1.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -44,6 +44,7 @@ const module = defineNuxtModule({
44
44
  for (const name of names) {
45
45
  addImports({ name, as: name, from: "@storyblok/vue" });
46
46
  }
47
+ nuxt.options.typescript.hoist.push("@storyblok/vue");
47
48
  addImportsDir(resolver.resolve("./runtime/composables"));
48
49
  if (options.devtools) {
49
50
  nuxt.hook("devtools:customTabs", (iframeTabs) => {
@@ -1,4 +1,4 @@
1
- import type { ISbStoriesParams, StoryblokBridgeConfigV2, ISbStoryData } from '@storyblok/vue';
1
+ import type { ISbStoriesParams, ISbStoryData, StoryblokBridgeConfigV2 } from '@storyblok/vue';
2
2
  export declare const useAsyncStoryblok: (url: string, apiOptions?: ISbStoriesParams, bridgeOptions?: StoryblokBridgeConfigV2) => Promise<import("vue").Ref<ISbStoryData<import("@storyblok/vue").StoryblokComponentType<string> & {
3
3
  [index: string]: any;
4
4
  }>, ISbStoryData<import("@storyblok/vue").StoryblokComponentType<string> & {
@@ -1,5 +1,5 @@
1
1
  import { useStoryblokApi, useStoryblokBridge } from "@storyblok/vue";
2
- import { useState, onMounted, useAsyncData } from "#imports";
2
+ import { onMounted, useAsyncData, useState } from "#imports";
3
3
  export const useAsyncStoryblok = async (url, apiOptions = {}, bridgeOptions = {}) => {
4
4
  const storyblokApiInstance = useStoryblokApi();
5
5
  const uniqueKey = `${JSON.stringify(apiOptions)}${url}`;
@@ -1,2 +1,2 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
1
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- import { StoryblokVue, apiPlugin } from "@storyblok/vue";
1
+ import { apiPlugin, StoryblokVue } from "@storyblok/vue";
2
2
  import { defineNuxtPlugin, useRuntimeConfig } from "#app";
3
3
  export default defineNuxtPlugin(({ vueApp }) => {
4
4
  let { storyblok } = useRuntimeConfig().public;
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@storyblok/nuxt",
3
- "version": "6.0.13",
4
- "description": "Storyblok Nuxt module",
5
- "packageManager": "pnpm@9.9.0",
6
3
  "type": "module",
7
- "main": "./dist/module.cjs",
8
- "types": "./dist/types.d.ts",
4
+ "version": "6.1.1",
5
+ "packageManager": "pnpm@9.9.0",
6
+ "description": "Storyblok Nuxt module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/storyblok/storyblok-nuxt.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/storyblok/storyblok-nuxt/issues"
13
+ },
9
14
  "exports": {
10
15
  ".": {
11
16
  "types": "./dist/types.d.ts",
@@ -13,86 +18,58 @@
13
18
  "require": "./dist/module.cjs"
14
19
  }
15
20
  },
21
+ "main": "./dist/module.cjs",
22
+ "types": "./dist/types.d.ts",
16
23
  "files": [
17
24
  "dist"
18
25
  ],
19
26
  "scripts": {
20
27
  "prepack": "nuxt-module-build build",
21
- "build": "nuxt-module-build build",
28
+ "build": "nuxt-module-build prepare && nuxt-module-build build",
22
29
  "dev": "nuxi dev playground",
23
30
  "dev:build": "nuxi build playground",
24
31
  "dev:preview": "nuxi preview playground",
25
32
  "prepare:playground": "nuxi prepare playground",
26
33
  "dev:prepare": "nuxt-module-build build --stub && nuxi prepare playground",
27
- "prepare": "husky install",
28
34
  "cy:open": "cypress open",
29
35
  "cy:run": "cypress run",
30
36
  "test:e2e": "start-server-and-test dev http://localhost:3000 cy:run",
31
37
  "test:e2e-watch": "start-server-and-test dev http://localhost:3000 cy:open",
32
38
  "pretest:e2e-static": "nuxi generate playground",
33
39
  "test:e2e-static": "start-server-and-test dev:preview http://localhost:3000 cy:run",
34
- "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue"
40
+ "lint": "eslint .",
41
+ "lint:fix": "eslint . --fix"
42
+ },
43
+ "dependencies": {
44
+ "@storyblok/vue": "^8.1.1"
35
45
  },
36
46
  "devDependencies": {
37
47
  "@commitlint/cli": "^19.5.0",
38
48
  "@commitlint/config-conventional": "^19.5.0",
39
49
  "@cypress/vite-dev-server": "^5.2.0",
50
+ "@nuxt/eslint": "^0.6.1",
40
51
  "@nuxt/eslint-config": "^0.5.7",
41
52
  "@nuxt/kit": "^3.13.2",
42
53
  "@nuxt/module-builder": "^0.8.4",
43
54
  "@nuxt/schema": "^3.13.2",
44
55
  "@nuxt/test-utils": "^3.14.3",
45
56
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
57
+ "@storyblok/eslint-config": "^0.3.0",
46
58
  "@types/node": "^20.8.10",
47
59
  "cypress": "^13.15.0",
48
- "eslint": "^8.52.0",
60
+ "eslint": "^8.57.1",
49
61
  "eslint-config-prettier": "^9.1.0",
50
62
  "eslint-plugin-cypress": "^3.5.0",
51
63
  "eslint-plugin-vue": "^9.28.0",
52
- "husky": "^9.1.6",
53
- "lint-staged": "^15.2.10",
54
64
  "nuxt": "^3.13.2",
55
65
  "prettier": "^3.3.3",
56
66
  "start-server-and-test": "^2.0.8"
57
67
  },
58
- "dependencies": {
59
- "@storyblok/vue": "^8.1.1"
60
- },
61
- "lint-staged": {
62
- "*.{vue,js,css}": [
63
- "prettier --write",
64
- "eslint"
65
- ],
66
- "*.md": [
67
- "prettier --write"
68
- ]
69
- },
70
68
  "commitlint": {
71
69
  "extends": [
72
70
  "@commitlint/config-conventional"
73
71
  ]
74
72
  },
75
- "eslintConfig": {
76
- "extends": [
77
- "eslint:recommended",
78
- "@nuxtjs/eslint-config-typescript",
79
- "plugin:vue/vue3-recommended",
80
- "prettier"
81
- ],
82
- "rules": {
83
- "vue/multi-word-component-names": 1
84
- }
85
- },
86
- "eslintIgnore": [
87
- "**/templates/plugin.js",
88
- "playground/app.vue"
89
- ],
90
- "prettier": {
91
- "trailingComma": "none",
92
- "tabWidth": 2,
93
- "semi": true,
94
- "singleQuote": false
95
- },
96
73
  "release": {
97
74
  "branches": [
98
75
  "main",