@nuxtjs/prismic 4.0.1 → 4.1.0-pr.235.302ce94

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.
Files changed (44) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -32
  3. package/dist/module.d.mts +48 -75
  4. package/dist/module.json +3 -3
  5. package/dist/module.mjs +193 -242
  6. package/dist/runtime/PrismicPreview.d.vue.ts +3 -0
  7. package/dist/runtime/PrismicPreview.vue +8 -14
  8. package/dist/runtime/PrismicPreview.vue.d.ts +3 -0
  9. package/dist/runtime/plugin.client.js +13 -7
  10. package/dist/runtime/plugin.js +89 -72
  11. package/dist/runtime/usePrismicPreview.d.ts +1 -5
  12. package/dist/runtime/usePrismicPreview.js +3 -3
  13. package/dist/types.d.mts +3 -1
  14. package/package.json +38 -45
  15. package/src/module.ts +352 -185
  16. package/src/runtime/PrismicPreview.vue +12 -16
  17. package/src/runtime/plugin.client.ts +16 -12
  18. package/src/runtime/plugin.ts +114 -103
  19. package/src/runtime/usePrismicPreview.ts +7 -11
  20. package/dist/client/200.html +0 -1
  21. package/dist/client/404.html +0 -1
  22. package/dist/client/_nuxt/BMD6bpEv.js +0 -1
  23. package/dist/client/_nuxt/BQB6UGbx.js +0 -25
  24. package/dist/client/_nuxt/CkG7IjgS.js +0 -1
  25. package/dist/client/_nuxt/DlAUqK2U.js +0 -1
  26. package/dist/client/_nuxt/H1okkFcd.js +0 -1
  27. package/dist/client/_nuxt/RYS3n4u0.js +0 -1
  28. package/dist/client/_nuxt/V_weDLQm.js +0 -1
  29. package/dist/client/_nuxt/builds/latest.json +0 -1
  30. package/dist/client/_nuxt/builds/meta/f4865457-86fc-49e4-8a56-18ed8a000da8.json +0 -1
  31. package/dist/client/_nuxt/entry.BC9BDAld.css +0 -1
  32. package/dist/client/_nuxt/error-404.smTsHvdw.css +0 -1
  33. package/dist/client/_nuxt/error-500.Bo-s0s94.css +0 -1
  34. package/dist/client/_nuxt/index.C4BggqQh.css +0 -1
  35. package/dist/client/index.html +0 -1
  36. package/dist/module.cjs +0 -5
  37. package/dist/module.d.ts +0 -136
  38. package/dist/types.d.ts +0 -1
  39. package/src/devtools/index.ts +0 -127
  40. package/src/devtools/types.ts +0 -22
  41. package/src/lib/fileExists.ts +0 -15
  42. package/src/lib/index.ts +0 -2
  43. package/src/lib/logger.ts +0 -3
  44. package/src/types.ts +0 -137
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Nuxt.js Community
3
+ Copyright (c) 2025 Nuxt.js Community
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -12,26 +12,14 @@ Replace all on all files (README.md, CONTRIBUTING.md, bug_report.md, package.jso
12
12
 
13
13
  [![npm version][npm-version-src]][npm-version-href]
14
14
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
15
- [![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
16
- [![Codecov][codecov-src]][codecov-href]
17
- [![Conventional Commits][conventional-commits-src]][conventional-commits-href]
18
- [![License][license-src]][license-href]
19
15
 
20
- Easily connect your Nuxt.js application to your content hosted on [Prismic][prismic].
16
+ Easily connect your [Nuxt][nuxt] application to your content hosted on [Prismic][prismic].
21
17
 
22
- - [✨  Release Notes][changelog]
23
- - [🏀 Online Playground][playground]
24
- - [📖  Module Documentation][nuxt-docs]
25
- - [📚  Prismic Documentation][prismic-docs]
18
+ - 🚀  Add Prismic to your Nuxt app in seconds.
19
+ - 🍡  Fetch and present Prismic content with components and composables.
20
+ - 🏀  [Try it now on the online playground][playground].
26
21
 
27
- ## Features
28
-
29
- <!-- Highlight some of the features your module provide here -->
30
- - 🚀 &nbsp;Add Prismic to your Nuxt app in seconds;
31
- - 🎣 &nbsp;Access Prismic SDK through composition and options API;
32
- - 🖼 &nbsp;Prismic previews supported.
33
-
34
- ## Quick Setup
22
+ ## Install
35
23
 
36
24
  Install the module to your Nuxt application with one command:
37
25
 
@@ -42,18 +30,22 @@ npx nuxi@latest module add prismic
42
30
  Then, configure your Prismic API endpoint:
43
31
 
44
32
  ```javascript
45
- import { defineNuxtConfig } from 'nuxt'
33
+ import { defineNuxtConfig } from "nuxt"
46
34
 
47
35
  export default defineNuxtConfig({
48
- modules: ['@nuxtjs/prismic'],
36
+ modules: ["@nuxtjs/prismic"],
49
37
  prismic: {
50
- endpoint: 'my-repository'
38
+ endpoint: "my-repository",
51
39
  },
52
- });
40
+ })
53
41
  ```
54
42
 
55
43
  That's it! You can now use Prismic in your Nuxt app ✨
56
44
 
45
+ ## Documentation
46
+
47
+ To discover what's new on this package check out [the changelog][changelog]. For full documentation, visit the [official Prismic documentation][prismic-docs].
48
+
57
49
  ## Contributing
58
50
 
59
51
  Whether you're helping us fix bugs, improve the docs, or spread the word, we'd love to have you as part of the Prismic developer community!
@@ -66,6 +58,8 @@ Whether you're helping us fix bugs, improve the docs, or spread the word, we'd l
66
58
 
67
59
  **Submitting code changes**: For small fixes, feel free to [open a pull request][repo-pull-requests] with a description of your changes. For large changes, please first [open an issue][repo-feature-request] so we can discuss if and how the changes should be implemented.
68
60
 
61
+ For more clarity on this project and its structure you can also check out the detailed [CONTRIBUTING.md][contributing] document.
62
+
69
63
  ## License
70
64
 
71
65
  [MIT License](./LICENSE)
@@ -76,11 +70,11 @@ Whether you're helping us fix bugs, improve the docs, or spread the word, we'd l
76
70
 
77
71
  <!-- Replace link with a more useful one if available -->
78
72
 
79
- [playground]: https://stackblitz.com/github/nuxt-modules/prismic/tree/master/examples/minimal?file=pages%2Findex.vue
80
- [nuxt-docs]: https://prismic.nuxtjs.org
81
- [prismic-docs]: https://prismic.io/docs/technical-reference/prismicio-vue?version=v4
73
+ [prismic-docs]: https://prismic.io/docs/nuxt
74
+ [nuxt-docs]: https://nuxt.com
82
75
  [changelog]: ./CHANGELOG.md
83
76
  [contributing]: ./CONTRIBUTING.md
77
+ [playground]: https://stackblitz.com/github/nuxt-modules/prismic/tree/master/examples/minimal?file=pages%2Findex.vue
84
78
 
85
79
  <!-- Replace link with a more useful one if available -->
86
80
 
@@ -95,11 +89,3 @@ Whether you're helping us fix bugs, improve the docs, or spread the word, we'd l
95
89
  [npm-version-href]: https://npmjs.com/package/@nuxtjs/prismic
96
90
  [npm-downloads-src]: https://img.shields.io/npm/dm/@nuxtjs/prismic.svg?style=flat&colorA=020420&colorB=00DC82
97
91
  [npm-downloads-href]: https://npmjs.com/package/@nuxtjs/prismic
98
- [github-actions-ci-src]: https://img.shields.io/github/actions/workflow/status/nuxt-modules/prismic/ci.yml.svg?style=flat&colorA=020420&colorB=00DC82
99
- [github-actions-ci-href]: https://github.com/nuxt-modules/prismic/actions?query=workflow%3Aci
100
- [codecov-src]: https://img.shields.io/codecov/c/github/nuxt-modules/prismic.svg?style=flat&colorA=020420&colorB=00DC82
101
- [codecov-href]: https://codecov.io/gh/nuxt-modules/prismic
102
- [conventional-commits-src]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat&colorA=020420&colorB=00DC82
103
- [conventional-commits-href]: https://conventionalcommits.org
104
- [license-src]: https://img.shields.io/npm/l/@nuxtjs/prismic.svg?style=flat&colorA=020420&colorB=00DC82
105
- [license-href]: https://npmjs.com/package/@nuxtjs/prismic
package/dist/module.d.mts CHANGED
@@ -1,31 +1,29 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { PrismicPluginOptions } from '@prismicio/vue';
2
+ import { ClientConfig } from '@prismicio/client';
3
3
 
4
4
  /**
5
- * `@nuxtjs/prismic` module options.
5
+ * Prismic Nuxt module options.
6
6
  *
7
- * @see Module documentation: {@link https://prismic.nuxtjs.org}
8
- * @see Prismic documentation: {@link https://prismic.io/docs/nuxt-3-setup}
7
+ * @see {@link https://prismic.io/docs/nuxt}
8
+ * @see {@link https://prismic.io/docs/technical-reference/nuxtjs-prismic}
9
9
  */
10
- type PrismicModuleOptions = Omit<PrismicPluginOptions, 'endpoint' | 'client' | 'linkResolver' | 'richTextSerializer' | 'components'> & {
10
+ type PrismicModuleOptions = {
11
11
  /**
12
- * A Prismic repository endpoint to init the module's `@prismicio/client`
13
- * instance used to fetch content from a Prismic repository with.
12
+ * The Prismic repository name or full Content API endpoint to init the
13
+ * module's client instance used to fetch content from a Prismic repository
14
+ * with.
14
15
  *
15
- * @remarks
16
- * Said client will be used exposed through `this.$prismic.client` and
17
- * `usePrismic().client`.
18
16
  * @example
19
17
  *
20
- * ```javascript
21
- * // A repository ID
22
- * "my-repo";
18
+ * ```typescript
19
+ * // With a repository name
20
+ * createClient("my-repo")
23
21
  *
24
- * //A full repository endpoint
25
- * "https://my-repo.cdn.prismic.io/api/v2";
22
+ * // With a full Prismic Content API endpoint
23
+ * createClient("https://my-repo.cdn.prismic.io/api/v2")
26
24
  * ```
27
25
  *
28
- * @see Prismic client documentation {@link https://prismic.io/docs/technical-reference/prismicio-client}
26
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client}
29
27
  */
30
28
  endpoint?: string;
31
29
  /**
@@ -38,35 +36,25 @@ type PrismicModuleOptions = Omit<PrismicPluginOptions, 'endpoint' | 'client' | '
38
36
  */
39
37
  environment?: string;
40
38
  /**
41
- * An optional path to a file exporting a `@prismicio/client` instance used
42
- * to fetch content from a Prismic repository to configure the module with.
39
+ * Configuration options that determines how content will be queries from the
40
+ * Prismic repository.
43
41
  *
44
- * @remarks
45
- * Said client will be used exposed through `this.$prismic.client` and
46
- * `usePrismic().client`.
47
- * @see Prismic client documentation {@link https://prismic.io/docs/technical-reference/prismicio-client}
42
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client}
48
43
  */
49
- client?: string;
44
+ clientConfig?: ClientConfig;
50
45
  /**
51
- * An optional path to a file exporting a link resolver function used to
52
- * resolve links to Prismic documents when not using the route resolver
53
- * parameter with `@prismicio/client`.
46
+ * An optional path to a file exporting a Prismic client instance used to
47
+ * fetch content from a Prismic repository to configure the module with.
54
48
  *
55
- * @see Link resolver documentation {@link https://prismic.io/docs/route-resolver#link-resolver}
56
- */
57
- linkResolver?: string;
58
- /**
59
- * An optional path to a file exporting an HTML serializer to customize
60
- * the way rich text fields are rendered.
61
- *
62
- * @deprecated Use `components.richTextComponents` instead.
49
+ * @remarks
50
+ * When provided, it takes precedence over the `endpoint` and `clientConfig`
51
+ * options.
63
52
  *
64
- * @see HTML serializer documentation {@link https://prismic.io/docs/rich-text}
53
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client}
65
54
  */
66
- richTextSerializer?: string;
55
+ client?: string;
67
56
  /**
68
- * Desired path of the preview page used by Prismic to enter preview
69
- * session.
57
+ * Desired path of the preview page used by Prismic to enter preview session.
70
58
  *
71
59
  * @remarks
72
60
  * `false` can be used to disable the preview page.
@@ -83,54 +71,39 @@ type PrismicModuleOptions = Omit<PrismicPluginOptions, 'endpoint' | 'client' | '
83
71
  * @defaultValue `true`
84
72
  */
85
73
  toolbar?: boolean;
86
- /**
87
- * Whether to enable Prismic Nuxt DevTools integration.
88
- *
89
- * @defaultValue `true`
90
- */
91
- devtools?: boolean;
92
- /**
93
- * Options used by Prismic Vue components.
94
- */
95
- components?: Omit<Required<PrismicPluginOptions>['components'], 'richTextComponents' | 'linkRel' | 'sliceZoneDefaultComponent' | 'linkInternalComponent' | 'linkExternalComponent'> & {
96
- /**
97
- * An optional path to a file exporting the `rel` attribute to apply on links.
98
- * It can export a function to use the link's metadata to determine the `rel` value.
99
- *
100
- * @defaultValue `"noreferrer"` for external links.
101
- */
102
- linkRel?: string;
74
+ /** Options used by Prismic Vue components. */
75
+ componentsConfig?: {
103
76
  /**
104
- * An optional path to a file exporting a map of Rich Text block types to Vue Components.
105
- * It is used to render Rich Text or title fields.
77
+ * The path to a file exporting a default link resolver function used to
78
+ * resolve links.
106
79
  *
107
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/rich-text}
80
+ * @see {@link https://prismic.io/docs/routes}
108
81
  */
109
- richTextComponents?: string;
82
+ linkResolver?: string;
110
83
  /**
111
- * An optional path to a file exporting a component or a functional component rendered
112
- * if a component mapping from the `components` prop cannot be found.
113
- *
114
- * @remarks
115
- * Components will be rendered using the {@link SliceComponentProps} interface.
84
+ * The path to a file exporting default components or shorthand definitions
85
+ * for rich text and table components.
116
86
  *
117
- * @defaultValue `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}
87
+ * @see {@link https://prismic.io/docs/fields/rich-text}
88
+ * @see {@link https://prismic.io/docs/fields/table}
118
89
  */
119
- sliceZoneDefaultComponent?: string;
90
+ defaultComponents?: string;
120
91
  };
121
92
  };
122
-
123
- declare module '@nuxt/schema' {
93
+ /**
94
+ * Prismic Nuxt module options.
95
+ *
96
+ * @see {@link https://prismic.io/docs/nuxt}
97
+ * @see {@link https://prismic.io/docs/technical-reference/nuxtjs-prismic}
98
+ */
99
+ type ModuleOptions = PrismicModuleOptions;
100
+ declare module "@nuxt/schema" {
124
101
  interface PublicRuntimeConfig {
125
- /**
126
- * `@nuxtjs/prismic` module options.
127
- *
128
- * @see Module documentation: {@link https://prismic.nuxtjs.org}
129
- * @see Prismic documentation: {@link https://prismic.io/docs/nuxt-3-setup}
130
- */
102
+ /** The Prismic Nuxt module options. */
131
103
  prismic: PrismicModuleOptions;
132
104
  }
133
105
  }
134
106
  declare const _default: _nuxt_schema.NuxtModule<PrismicModuleOptions, PrismicModuleOptions, false>;
135
107
 
136
- export { type PrismicModuleOptions as ModuleOptions, type PrismicModuleOptions, _default as default };
108
+ export { _default as default };
109
+ export type { ModuleOptions, PrismicModuleOptions };
package/dist/module.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "4.0.1",
7
+ "version": "4.1.0-pr.235.302ce94",
8
8
  "builder": {
9
- "@nuxt/module-builder": "0.8.4",
10
- "unbuild": "2.0.0"
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "3.6.1"
11
11
  }
12
12
  }