@prismicio/vue 3.1.3 → 3.2.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.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/dist/components/PrismicEmbed.cjs.map +1 -1
  3. package/dist/components/PrismicEmbed.d.ts +57 -63
  4. package/dist/components/PrismicEmbed.js.map +1 -1
  5. package/dist/components/PrismicImage.cjs.map +1 -1
  6. package/dist/components/PrismicImage.d.ts +162 -162
  7. package/dist/components/PrismicImage.js.map +1 -1
  8. package/dist/components/PrismicLink.cjs.map +1 -1
  9. package/dist/components/PrismicLink.d.ts +191 -191
  10. package/dist/components/PrismicLink.js.map +1 -1
  11. package/dist/components/PrismicRichText.cjs +7 -2
  12. package/dist/components/PrismicRichText.cjs.map +1 -1
  13. package/dist/components/PrismicRichText.d.ts +160 -139
  14. package/dist/components/PrismicRichText.js +7 -2
  15. package/dist/components/PrismicRichText.js.map +1 -1
  16. package/dist/components/PrismicText.cjs.map +1 -1
  17. package/dist/components/PrismicText.d.ts +117 -117
  18. package/dist/components/PrismicText.js.map +1 -1
  19. package/dist/components/SliceZone.cjs.map +1 -1
  20. package/dist/components/SliceZone.d.ts +357 -359
  21. package/dist/components/SliceZone.js.map +1 -1
  22. package/dist/components/index.d.ts +12 -12
  23. package/dist/composables.d.ts +366 -366
  24. package/dist/createPrismic.cjs +3 -3
  25. package/dist/createPrismic.cjs.map +1 -1
  26. package/dist/createPrismic.d.ts +12 -12
  27. package/dist/createPrismic.js +3 -3
  28. package/dist/createPrismic.js.map +1 -1
  29. package/dist/globalExtensions.d.ts +11 -11
  30. package/dist/index.cjs +16 -16
  31. package/dist/index.d.ts +10 -10
  32. package/dist/index.js +3 -3
  33. package/dist/injectionSymbols.d.ts +9 -9
  34. package/dist/lib/__PRODUCTION__.d.ts +7 -7
  35. package/dist/lib/getSlots.d.ts +14 -14
  36. package/dist/lib/isInternalURL.d.ts +8 -8
  37. package/dist/lib/simplyResolveComponent.cjs.map +1 -1
  38. package/dist/lib/simplyResolveComponent.d.ts +12 -12
  39. package/dist/lib/simplyResolveComponent.js.map +1 -1
  40. package/dist/types.d.ts +366 -357
  41. package/dist/usePrismic.d.ts +21 -21
  42. package/dist/useStatefulPrismicClientMethod.d.ts +64 -64
  43. package/package.json +15 -15
  44. package/src/components/PrismicEmbed.ts +6 -2
  45. package/src/components/PrismicImage.ts +6 -2
  46. package/src/components/PrismicLink.ts +11 -5
  47. package/src/components/PrismicRichText.ts +30 -5
  48. package/src/components/PrismicText.ts +6 -2
  49. package/src/components/SliceZone.ts +8 -2
  50. package/src/createPrismic.ts +3 -6
  51. package/src/lib/simplyResolveComponent.ts +8 -2
  52. package/src/types.ts +15 -4
@@ -1,21 +1,21 @@
1
- import { PrismicPlugin } from "./types";
2
- /**
3
- * Accesses `@prismicio/vue` plugin interface.
4
- *
5
- * @example With the composition API:
6
- *
7
- * ```javascript
8
- * import { usePrismic } from "@prismicio/vue";
9
- *
10
- * export default {
11
- * setup() {
12
- * const prismic = usePrismic();
13
- *
14
- * return {};
15
- * },
16
- * };
17
- * ```
18
- *
19
- * @returns The interface {@link PrismicPlugin}
20
- */
21
- export declare const usePrismic: () => PrismicPlugin;
1
+ import { PrismicPlugin } from "./types";
2
+ /**
3
+ * Accesses `@prismicio/vue` plugin interface.
4
+ *
5
+ * @example With the composition API:
6
+ *
7
+ * ```javascript
8
+ * import { usePrismic } from "@prismicio/vue";
9
+ *
10
+ * export default {
11
+ * setup() {
12
+ * const prismic = usePrismic();
13
+ *
14
+ * return {};
15
+ * },
16
+ * };
17
+ * ```
18
+ *
19
+ * @returns The interface {@link PrismicPlugin}
20
+ */
21
+ export declare const usePrismic: () => PrismicPlugin;
@@ -1,64 +1,64 @@
1
- import { Ref } from "vue";
2
- import { Client, ForbiddenError, ParsingError, PrismicError } from "@prismicio/client";
3
- import { PrismicClientComposableState, VueUseParameters } from "./types";
4
- type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
5
- type ClientMethodLike = (...args: any[]) => Promise<any> | any;
6
- type ClientMethods = typeof Client.prototype;
7
- type ClientError = PrismicError<unknown> | ParsingError | ForbiddenError;
8
- /**
9
- * @internal
10
- */
11
- export type ClientMethodParameters<TMethodName extends keyof ClientMethods> = ClientMethods[TMethodName] extends ClientMethodLike ? VueUseParameters<Parameters<ClientMethods[TMethodName]>> : never;
12
- /**
13
- * @internal
14
- */
15
- export type ClientMethodReturnType<TMethodName extends keyof ClientMethods> = ClientMethods[TMethodName] extends ClientMethodLike ? ReturnType<ClientMethods[TMethodName]> : never;
16
- /**
17
- * @internal
18
- */
19
- export type ComposableOnlyParameters = {
20
- client?: Ref<Client> | Client;
21
- };
22
- /**
23
- * The return type of a `@prismicio/client` Vue composable.
24
- *
25
- * @typeParam TData - The expected format of the `data` property of the returned
26
- * object
27
- */
28
- export type ClientComposableReturnType<TData = unknown> = {
29
- /**
30
- * The current state of the composable's client method call.
31
- */
32
- state: Ref<PrismicClientComposableState>;
33
- /**
34
- * Data returned by the client.
35
- */
36
- data: Ref<TData | null>;
37
- /**
38
- * Error returned by the composable's client method call if in an errror
39
- * state.
40
- */
41
- error: Ref<ClientError | Error | null>;
42
- /**
43
- * Perform the composable's client method call again.
44
- */
45
- refresh: () => Promise<void>;
46
- };
47
- /**
48
- * A low level Vue composable that uses provided method name on plugin or
49
- * provided client with given arguments. The composable has its own internal
50
- * state manager to report async status, such as pending or error statuses.
51
- *
52
- * @typeParam TClientMethodName - A method name from `@prismicio/client`
53
- * @typeParam TClientMethodArguments - The method expected arguments
54
- * @typeParam TClientMethodReturnType - The method expected return type
55
- *
56
- * @param method - The `@prismicio/client` method name to use
57
- * @param args - The arguments to use with requested method
58
- *
59
- * @returns The composable payload {@link ClientComposableReturnType}
60
- *
61
- * @internal
62
- */
63
- export declare const useStatefulPrismicClientMethod: <TClientMethodName extends keyof Client<any>, TClientMethodArguments extends ClientMethodParameters<TClientMethodName>, TClientMethodReturnType extends UnwrapPromise<ClientMethodReturnType<TClientMethodName>>>(methodName: TClientMethodName, args: TClientMethodArguments) => ClientComposableReturnType<TClientMethodReturnType>;
64
- export {};
1
+ import { Ref } from "vue";
2
+ import { Client, ForbiddenError, ParsingError, PrismicError } from "@prismicio/client";
3
+ import { PrismicClientComposableState, VueUseParameters } from "./types";
4
+ type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
5
+ type ClientMethodLike = (...args: any[]) => Promise<any> | any;
6
+ type ClientMethods = typeof Client.prototype;
7
+ type ClientError = PrismicError<unknown> | ParsingError | ForbiddenError;
8
+ /**
9
+ * @internal
10
+ */
11
+ export type ClientMethodParameters<TMethodName extends keyof ClientMethods> = ClientMethods[TMethodName] extends ClientMethodLike ? VueUseParameters<Parameters<ClientMethods[TMethodName]>> : never;
12
+ /**
13
+ * @internal
14
+ */
15
+ export type ClientMethodReturnType<TMethodName extends keyof ClientMethods> = ClientMethods[TMethodName] extends ClientMethodLike ? ReturnType<ClientMethods[TMethodName]> : never;
16
+ /**
17
+ * @internal
18
+ */
19
+ export type ComposableOnlyParameters = {
20
+ client?: Ref<Client> | Client;
21
+ };
22
+ /**
23
+ * The return type of a `@prismicio/client` Vue composable.
24
+ *
25
+ * @typeParam TData - The expected format of the `data` property of the returned
26
+ * object
27
+ */
28
+ export type ClientComposableReturnType<TData = unknown> = {
29
+ /**
30
+ * The current state of the composable's client method call.
31
+ */
32
+ state: Ref<PrismicClientComposableState>;
33
+ /**
34
+ * Data returned by the client.
35
+ */
36
+ data: Ref<TData | null>;
37
+ /**
38
+ * Error returned by the composable's client method call if in an errror
39
+ * state.
40
+ */
41
+ error: Ref<ClientError | Error | null>;
42
+ /**
43
+ * Perform the composable's client method call again.
44
+ */
45
+ refresh: () => Promise<void>;
46
+ };
47
+ /**
48
+ * A low level Vue composable that uses provided method name on plugin or
49
+ * provided client with given arguments. The composable has its own internal
50
+ * state manager to report async status, such as pending or error statuses.
51
+ *
52
+ * @typeParam TClientMethodName - A method name from `@prismicio/client`
53
+ * @typeParam TClientMethodArguments - The method expected arguments
54
+ * @typeParam TClientMethodReturnType - The method expected return type
55
+ *
56
+ * @param method - The `@prismicio/client` method name to use
57
+ * @param args - The arguments to use with requested method
58
+ *
59
+ * @returns The composable payload {@link ClientComposableReturnType}
60
+ *
61
+ * @internal
62
+ */
63
+ export declare const useStatefulPrismicClientMethod: <TClientMethodName extends keyof Client<any>, TClientMethodArguments extends ClientMethodParameters<TClientMethodName>, TClientMethodReturnType extends UnwrapPromise<ClientMethodReturnType<TClientMethodName>>>(methodName: TClientMethodName, args: TClientMethodArguments) => ClientComposableReturnType<TClientMethodReturnType>;
64
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/vue",
3
- "version": "3.1.3",
3
+ "version": "3.2.0",
4
4
  "description": "Vue plugin, components, and composables to fetch and present Prismic content",
5
5
  "keywords": [
6
6
  "typescript",
@@ -60,28 +60,28 @@
60
60
  "@prismicio/mock": "^0.2.0",
61
61
  "@size-limit/preset-small-lib": "^8.2.4",
62
62
  "@types/jsdom-global": "^3.0.4",
63
- "@typescript-eslint/eslint-plugin": "^5.54.1",
64
- "@typescript-eslint/parser": "^5.54.1",
65
- "@vitejs/plugin-vue": "^4.0.0",
66
- "@vitest/coverage-c8": "^0.29.2",
63
+ "@typescript-eslint/eslint-plugin": "^5.59.5",
64
+ "@typescript-eslint/parser": "^5.59.5",
65
+ "@vitejs/plugin-vue": "^4.2.1",
66
+ "@vitest/coverage-c8": "^0.31.0",
67
67
  "@vue/compiler-sfc": "^3.2.47",
68
- "@vue/eslint-config-typescript": "^11.0.2",
69
- "@vue/test-utils": "^2.3.1",
70
- "eslint": "^8.36.0",
71
- "eslint-config-prettier": "^8.7.0",
68
+ "@vue/eslint-config-typescript": "^11.0.3",
69
+ "@vue/test-utils": "^2.3.2",
70
+ "eslint": "^8.40.0",
71
+ "eslint-config-prettier": "^8.8.0",
72
72
  "eslint-plugin-prettier": "^4.2.1",
73
73
  "eslint-plugin-tsdoc": "^0.2.17",
74
- "eslint-plugin-vue": "^9.9.0",
75
- "jsdom": "^21.1.1",
74
+ "eslint-plugin-vue": "^9.11.1",
75
+ "jsdom": "^22.0.0",
76
76
  "jsdom-global": "^3.0.2",
77
- "prettier": "^2.8.4",
77
+ "prettier": "^2.8.8",
78
78
  "prettier-plugin-jsdoc": "^0.4.2",
79
79
  "size-limit": "^8.2.4",
80
80
  "standard-version": "^9.5.0",
81
- "typescript": "^4.9.5",
82
- "vite": "^4.1.4",
81
+ "typescript": "^5.0.4",
82
+ "vite": "^4.3.5",
83
83
  "vite-plugin-sdk": "^0.1.1",
84
- "vitest": "^0.29.2",
84
+ "vitest": "^0.31.0",
85
85
  "vue": "^3.2.47"
86
86
  },
87
87
  "peerDependencies": {
@@ -2,9 +2,11 @@ import {
2
2
  AllowedComponentProps,
3
3
  ComponentCustomProps,
4
4
  ConcreteComponent,
5
+ DefineComponent,
5
6
  defineComponent,
6
7
  h,
7
8
  PropType,
9
+ Raw,
8
10
  VNodeProps,
9
11
  } from "vue";
10
12
 
@@ -31,7 +33,7 @@ export type PrismicEmbedProps = {
31
33
  *
32
34
  * @defaultValue `"div"`
33
35
  */
34
- wrapper?: string | ConcreteComponent;
36
+ wrapper?: string | ConcreteComponent | Raw<DefineComponent>;
35
37
  };
36
38
 
37
39
  /**
@@ -47,7 +49,9 @@ export const PrismicEmbedImpl = /*#__PURE__*/ defineComponent({
47
49
  required: true,
48
50
  },
49
51
  wrapper: {
50
- type: [String, Object, Function] as PropType<string | ConcreteComponent>,
52
+ type: [String, Object, Function] as PropType<
53
+ string | ConcreteComponent | Raw<DefineComponent>
54
+ >,
51
55
  default: undefined,
52
56
  required: false,
53
57
  },
@@ -9,6 +9,8 @@ import {
9
9
  PropType,
10
10
  VNodeProps,
11
11
  unref,
12
+ DefineComponent,
13
+ Raw,
12
14
  } from "vue";
13
15
 
14
16
  import { ImageField } from "@prismicio/types";
@@ -48,7 +50,7 @@ export type PrismicImageProps = {
48
50
  * receive an additional `copyright` props.
49
51
  * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `"img"` otherwise.
50
52
  */
51
- imageComponent?: string | ConcreteComponent;
53
+ imageComponent?: string | ConcreteComponent | Raw<DefineComponent>;
52
54
 
53
55
  /**
54
56
  * An object of Imgix URL API parameters.
@@ -217,7 +219,9 @@ export const PrismicImageImpl = /*#__PURE__*/ defineComponent({
217
219
  required: true,
218
220
  },
219
221
  imageComponent: {
220
- type: [String, Object] as PropType<string | ConcreteComponent>,
222
+ type: [String, Object] as PropType<
223
+ string | ConcreteComponent | Raw<DefineComponent>
224
+ >,
221
225
  default: undefined,
222
226
  required: false,
223
227
  },
@@ -10,6 +10,8 @@ import {
10
10
  ConcreteComponent,
11
11
  computed,
12
12
  ComputedRef,
13
+ Raw,
14
+ DefineComponent,
13
15
  } from "vue";
14
16
 
15
17
  import { asLink, LinkResolverFunction } from "@prismicio/helpers";
@@ -85,7 +87,7 @@ export type PrismicLinkProps = {
85
87
  * (`to` props).
86
88
  * @defaultValue The one provided to `@prismicio/vue` plugin if configured, {@link RouterLink} otherwise.
87
89
  */
88
- internalComponent?: string | ConcreteComponent;
90
+ internalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
89
91
 
90
92
  /**
91
93
  * An HTML tag name, a component, or a functional component used to render
@@ -99,7 +101,7 @@ export type PrismicLinkProps = {
99
101
  * (`to` props).
100
102
  * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `"a"` otherwise.
101
103
  */
102
- externalComponent?: string | ConcreteComponent;
104
+ externalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
103
105
  };
104
106
 
105
107
  /**
@@ -114,7 +116,7 @@ export type UsePrismicLinkReturnType = {
114
116
  /**
115
117
  * Suggested component to render for provided link field.
116
118
  */
117
- type: ComputedRef<string | ConcreteComponent>;
119
+ type: ComputedRef<string | ConcreteComponent | Raw<DefineComponent>>;
118
120
 
119
121
  /**
120
122
  * Resolved anchor `href` value.
@@ -238,12 +240,16 @@ export const PrismicLinkImpl = /*#__PURE__*/ defineComponent({
238
240
  required: false,
239
241
  },
240
242
  internalComponent: {
241
- type: [String, Object, Function] as PropType<string | ConcreteComponent>,
243
+ type: [String, Object, Function] as PropType<
244
+ string | ConcreteComponent | Raw<DefineComponent>
245
+ >,
242
246
  default: undefined,
243
247
  required: false,
244
248
  },
245
249
  externalComponent: {
246
- type: [String, Object, Function] as PropType<string | ConcreteComponent>,
250
+ type: [String, Object, Function] as PropType<
251
+ string | ConcreteComponent | Raw<DefineComponent>
252
+ >,
247
253
  default: undefined,
248
254
  required: false,
249
255
  },
@@ -5,12 +5,14 @@ import {
5
5
  computed,
6
6
  ComputedRef,
7
7
  ConcreteComponent,
8
+ DefineComponent,
8
9
  defineComponent,
9
10
  h,
10
11
  inject,
11
12
  nextTick,
12
13
  onBeforeUnmount,
13
14
  PropType,
15
+ Raw,
14
16
  ref,
15
17
  unref,
16
18
  VNodeProps,
@@ -63,6 +65,17 @@ export type PrismicRichTextProps = {
63
65
  *
64
66
  * @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
65
67
  */
68
+ serializer?: HTMLFunctionSerializer | HTMLMapSerializer;
69
+
70
+ /**
71
+ * An HTML serializer to customize the way rich text fields are rendered.
72
+ *
73
+ * @deprecated Use `serializer` instead.
74
+ *
75
+ * @defaultValue The HTML serializer provided to `@prismicio/vue` plugin if configured.
76
+ *
77
+ * @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
78
+ */
66
79
  htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
67
80
 
68
81
  /**
@@ -71,7 +84,7 @@ export type PrismicRichTextProps = {
71
84
  *
72
85
  * @defaultValue `"div"`
73
86
  */
74
- wrapper?: string | ConcreteComponent;
87
+ wrapper?: string | ConcreteComponent | Raw<DefineComponent>;
75
88
 
76
89
  /**
77
90
  * The HTML value to be rendered when the field is empty. If a fallback is not
@@ -118,10 +131,13 @@ export const usePrismicRichText = (
118
131
  }
119
132
 
120
133
  const linkResolver = unref(props.linkResolver) ?? options.linkResolver;
121
- const htmlSerializer =
122
- unref(props.htmlSerializer) ?? options.htmlSerializer;
134
+ const serializer =
135
+ unref(props.serializer) ??
136
+ unref(props.htmlSerializer) ??
137
+ options.richTextSerializer ??
138
+ options.htmlSerializer;
123
139
 
124
- return asHTML(unref(field), linkResolver, htmlSerializer);
140
+ return asHTML(unref(field), linkResolver, serializer);
125
141
  });
126
142
 
127
143
  return {
@@ -147,6 +163,13 @@ export const PrismicRichTextImpl = /*#__PURE__*/ defineComponent({
147
163
  default: undefined,
148
164
  required: false,
149
165
  },
166
+ serializer: {
167
+ type: [Function, Object] as PropType<
168
+ HTMLFunctionSerializer | HTMLMapSerializer
169
+ >,
170
+ default: undefined,
171
+ required: false,
172
+ },
150
173
  htmlSerializer: {
151
174
  type: [Function, Object] as PropType<
152
175
  HTMLFunctionSerializer | HTMLMapSerializer
@@ -155,7 +178,9 @@ export const PrismicRichTextImpl = /*#__PURE__*/ defineComponent({
155
178
  required: false,
156
179
  },
157
180
  wrapper: {
158
- type: [String, Object, Function] as PropType<string | ConcreteComponent>,
181
+ type: [String, Object, Function] as PropType<
182
+ string | ConcreteComponent | Raw<DefineComponent>
183
+ >,
159
184
  default: undefined,
160
185
  required: false,
161
186
  },
@@ -4,9 +4,11 @@ import {
4
4
  computed,
5
5
  ComputedRef,
6
6
  ConcreteComponent,
7
+ DefineComponent,
7
8
  defineComponent,
8
9
  h,
9
10
  PropType,
11
+ Raw,
10
12
  unref,
11
13
  VNode,
12
14
  VNodeProps,
@@ -44,7 +46,7 @@ export type PrismicTextProps = {
44
46
  *
45
47
  * @defaultValue `"div"`
46
48
  */
47
- wrapper?: string | ConcreteComponent;
49
+ wrapper?: string | ConcreteComponent | Raw<DefineComponent>;
48
50
 
49
51
  /**
50
52
  * The string value to be rendered when the field is empty. If a fallback is
@@ -116,7 +118,9 @@ export const PrismicTextImpl = /*#__PURE__*/ defineComponent({
116
118
  required: false,
117
119
  },
118
120
  wrapper: {
119
- type: [String, Object, Function] as PropType<string | ConcreteComponent>,
121
+ type: [String, Object, Function] as PropType<
122
+ string | ConcreteComponent | Raw<DefineComponent>
123
+ >,
120
124
  default: undefined,
121
125
  required: false,
122
126
  },
@@ -9,6 +9,7 @@ import {
9
9
  h,
10
10
  markRaw,
11
11
  PropType,
12
+ Raw,
12
13
  VNodeProps,
13
14
  watchEffect,
14
15
  } from "vue";
@@ -222,6 +223,9 @@ export type SliceComponentType<
222
223
  TSlice extends SliceLike = any,
223
224
  TContext = unknown,
224
225
  > =
226
+ // For reference within TypeScript files when `*.vue` type cannot be inferred
227
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
228
+ | DefineComponent<{}, {}, any>
225
229
  | DefineComponent<SliceComponentProps<TSlice, TContext>>
226
230
  | FunctionalComponent<SliceComponentProps<TSlice, TContext>>;
227
231
 
@@ -439,7 +443,7 @@ export type SliceZoneProps<TContext = unknown> = {
439
443
  * An HTML tag name, a component, or a functional component used to wrap the
440
444
  * output. The Slice Zone is not wrapped by default.
441
445
  */
442
- wrapper?: string | ConcreteComponent;
446
+ wrapper?: string | ConcreteComponent | Raw<DefineComponent>;
443
447
  };
444
448
 
445
449
  /**
@@ -475,7 +479,9 @@ export const SliceZoneImpl = /*#__PURE__*/ defineComponent({
475
479
  required: false,
476
480
  },
477
481
  wrapper: {
478
- type: [String, Object, Function] as PropType<string | ConcreteComponent>,
482
+ type: [String, Object, Function] as PropType<
483
+ string | ConcreteComponent | Raw<DefineComponent>
484
+ >,
479
485
  default: undefined,
480
486
  required: false,
481
487
  },
@@ -54,12 +54,9 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
54
54
  fetch: async (endpoint, options) => {
55
55
  let fetchFunction: FetchLike;
56
56
  if (typeof globalThis.fetch === "function") {
57
- // TODO: Remove after https://github.com/prismicio/prismic-client/issues/254
58
- fetchFunction = globalThis.fetch as FetchLike;
57
+ fetchFunction = globalThis.fetch;
59
58
  } else {
60
- // TODO: Remove after https://github.com/prismicio/prismic-client/issues/254
61
- fetchFunction = (await import("isomorphic-unfetch"))
62
- .default as FetchLike;
59
+ fetchFunction = (await import("isomorphic-unfetch")).default;
63
60
  }
64
61
 
65
62
  return await fetchFunction(endpoint, options);
@@ -81,7 +78,7 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
81
78
  return asHTML(
82
79
  richTextField,
83
80
  linkResolver || options.linkResolver,
84
- htmlSerializer || options.htmlSerializer,
81
+ htmlSerializer || options.richTextSerializer || options.htmlSerializer,
85
82
  );
86
83
  },
87
84
  asLink: (linkField, linkResolver) => {
@@ -1,4 +1,10 @@
1
- import { ConcreteComponent, resolveDynamicComponent, VNode } from "vue";
1
+ import {
2
+ ConcreteComponent,
3
+ DefineComponent,
4
+ Raw,
5
+ resolveDynamicComponent,
6
+ VNode,
7
+ } from "vue";
2
8
 
3
9
  /**
4
10
  * A stricter version of {@link resolveDynamicComponent} that resolves only type
@@ -11,7 +17,7 @@ import { ConcreteComponent, resolveDynamicComponent, VNode } from "vue";
11
17
  * @internal
12
18
  */
13
19
  export const simplyResolveComponent = (
14
- component: string | ConcreteComponent,
20
+ component: string | ConcreteComponent | Raw<DefineComponent>,
15
21
  ): string | VNode => {
16
22
  return resolveDynamicComponent(component) as string | VNode;
17
23
  };
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { App, ConcreteComponent, Ref } from "vue";
1
+ import type { App, ConcreteComponent, DefineComponent, Raw, Ref } from "vue";
2
2
 
3
3
  import type {
4
4
  Client,
@@ -60,7 +60,7 @@ type PrismicPluginComponentsOptions = {
60
60
  * (`to` props).
61
61
  * @defaultValue {@link RouterLink}
62
62
  */
63
- linkInternalComponent?: string | ConcreteComponent;
63
+ linkInternalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
64
64
 
65
65
  /**
66
66
  * An HTML tag name, a component, or a functional component used to render
@@ -74,7 +74,7 @@ type PrismicPluginComponentsOptions = {
74
74
  * (`to` props).
75
75
  * @defaultValue `"a"`
76
76
  */
77
- linkExternalComponent?: string | ConcreteComponent;
77
+ linkExternalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
78
78
 
79
79
  /**
80
80
  * An HTML tag name, a component, or a functional component used to render
@@ -86,7 +86,7 @@ type PrismicPluginComponentsOptions = {
86
86
  * additional `copyright` props.
87
87
  * @defaultValue `"img"`
88
88
  */
89
- imageComponent?: string | ConcreteComponent;
89
+ imageComponent?: string | ConcreteComponent | Raw<DefineComponent>;
90
90
 
91
91
  /**
92
92
  * Default widths to use when rendering an image with `widths="defaults"`
@@ -138,6 +138,17 @@ type PrismicPluginOptionsBase = {
138
138
  *
139
139
  * @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
140
140
  */
141
+ richTextSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
142
+
143
+ /**
144
+ * An optional HTML serializer to customize the way rich text fields are
145
+ * rendered.
146
+ *
147
+ * @deprecated Use `richTextSerializer` instead.
148
+ *
149
+ * @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
150
+ */
151
+ // TODO: Remove in v5
141
152
  htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
142
153
 
143
154
  /**