From 00a71cae45f562746654e91cff2b24278ecdf25f Mon Sep 17 00:00:00 2001 From: Lucie <25330882+lihbr@users.noreply.github.com> Date: Fri, 2 Jun 2023 11:28:32 +0200 Subject: [PATCH] feat!: update to client v7 (#64) Co-authored-by: lihbr --- package-lock.json | 59 +++++++----------------- package.json | 8 ++-- src/components/PrismicEmbed.ts | 3 +- src/components/PrismicImage.ts | 4 +- src/components/PrismicLink.ts | 8 +++- src/components/PrismicRichText.ts | 4 +- src/components/PrismicText.ts | 3 +- src/components/SliceZone.ts | 16 +++---- src/composables.ts | 2 +- src/createPrismic.ts | 56 ++++++++++++++++++----- src/types.ts | 61 ++++++++++++++----------- test/__fixtures__/richText.ts | 2 +- test/components-PrismicEmbed.test.ts | 3 +- test/components-PrismicImage.test.ts | 3 +- test/components-PrismicLink.test.ts | 3 +- test/components-PrismicRichText.test.ts | 3 +- test/components-PrismicText.test.ts | 3 +- test/createPrismic-helpers.test.ts | 3 +- 18 files changed, 127 insertions(+), 117 deletions(-) diff --git a/package-lock.json b/package-lock.json index a35807a..61cb6aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,7 @@ "version": "3.2.1", "license": "Apache-2.0", "dependencies": { - "@prismicio/client": "^6.7.3", - "@prismicio/helpers": "^2.3.9", - "@prismicio/types": "^0.2.7", + "@prismicio/client": "^7.0.1", "isomorphic-unfetch": "^3.1.0", "vue-router": "^4.2.1" }, @@ -45,7 +43,7 @@ "vue": "^3.3.4" }, "engines": { - "node": ">=14.15.0" + "node": ">=16.10.0" }, "peerDependencies": { "vue": "^3.0.0" @@ -938,28 +936,15 @@ } }, "node_modules/@prismicio/client": { - "version": "6.7.3", - "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-6.7.3.tgz", - "integrity": "sha512-zQVZhuQDYIgdaY636u+QNk2tvvbtpkaKsEiLT0Ef51nFW/y5fqpOG5U0eU3cVsikZaYNlZ17x6O1wmvVCLdimQ==", - "dependencies": { - "@prismicio/helpers": "^2.3.8", - "@prismicio/types": "^0.2.7" - }, - "engines": { - "node": ">=12.13.0" - } - }, - "node_modules/@prismicio/helpers": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/@prismicio/helpers/-/helpers-2.3.9.tgz", - "integrity": "sha512-p7Y1sG83A2YPZvptfAzuZA8xH1bdM2wGRjqSKW9Qa0rAnBq2OfVKRvwl9OMCZML4eLUMxSEUAEWRVSoKpQnJvA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-7.0.1.tgz", + "integrity": "sha512-f4SDcDwVB2T73QKJJtzXd8LsfvDgIqOQNhC78bwsKLb1BjfPZNucsyIcRI9jGZdGxcU7lA+HStkYHw6z98ofKQ==", "dependencies": { - "@prismicio/richtext": "^2.1.4", - "@prismicio/types": "^0.2.7", + "@prismicio/richtext": "^2.1.5", "imgix-url-builder": "^0.0.3" }, "engines": { - "node": ">=12.7.0" + "node": ">=14.15.0" } }, "node_modules/@prismicio/mock": { @@ -976,9 +961,9 @@ } }, "node_modules/@prismicio/richtext": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@prismicio/richtext/-/richtext-2.1.4.tgz", - "integrity": "sha512-hyC8XItj+2yMmLGNjg9xGA/lRMO5UgbPF132VFrpZHzHhtIKvHN3iYxCZxnrEoPaTcT6JjA8vWyYLjmmB49bvw==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@prismicio/richtext/-/richtext-2.1.5.tgz", + "integrity": "sha512-Sf6iCsciPmfK3uQeFmeY9RTRSuhrCVzyU39OkiJ1VJn8O0531pKapGoWS+5WGxouJtE5+jGqV8L+L2mKP7NkXQ==", "dependencies": { "@prismicio/types": "^0.2.7" }, @@ -8231,21 +8216,11 @@ } }, "@prismicio/client": { - "version": "6.7.3", - "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-6.7.3.tgz", - "integrity": "sha512-zQVZhuQDYIgdaY636u+QNk2tvvbtpkaKsEiLT0Ef51nFW/y5fqpOG5U0eU3cVsikZaYNlZ17x6O1wmvVCLdimQ==", - "requires": { - "@prismicio/helpers": "^2.3.8", - "@prismicio/types": "^0.2.7" - } - }, - "@prismicio/helpers": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/@prismicio/helpers/-/helpers-2.3.9.tgz", - "integrity": "sha512-p7Y1sG83A2YPZvptfAzuZA8xH1bdM2wGRjqSKW9Qa0rAnBq2OfVKRvwl9OMCZML4eLUMxSEUAEWRVSoKpQnJvA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-7.0.1.tgz", + "integrity": "sha512-f4SDcDwVB2T73QKJJtzXd8LsfvDgIqOQNhC78bwsKLb1BjfPZNucsyIcRI9jGZdGxcU7lA+HStkYHw6z98ofKQ==", "requires": { - "@prismicio/richtext": "^2.1.4", - "@prismicio/types": "^0.2.7", + "@prismicio/richtext": "^2.1.5", "imgix-url-builder": "^0.0.3" } }, @@ -8260,9 +8235,9 @@ } }, "@prismicio/richtext": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@prismicio/richtext/-/richtext-2.1.4.tgz", - "integrity": "sha512-hyC8XItj+2yMmLGNjg9xGA/lRMO5UgbPF132VFrpZHzHhtIKvHN3iYxCZxnrEoPaTcT6JjA8vWyYLjmmB49bvw==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@prismicio/richtext/-/richtext-2.1.5.tgz", + "integrity": "sha512-Sf6iCsciPmfK3uQeFmeY9RTRSuhrCVzyU39OkiJ1VJn8O0531pKapGoWS+5WGxouJtE5+jGqV8L+L2mKP7NkXQ==", "requires": { "@prismicio/types": "^0.2.7" } diff --git a/package.json b/package.json index cc56e33..1c9969a 100644 --- a/package.json +++ b/package.json @@ -45,9 +45,9 @@ "playground:dev": "vite playground", "prepare": "npm run build", "release": "npm run test && standard-version && git push --follow-tags && npm run build && npm publish", + "release:dry": "standard-version --dry-run", "release:beta": "npm run test && standard-version --release-as major --prerelease beta && git push --follow-tags && npm run build && npm publish --tag beta", "release:beta:dry": "standard-version --release-as major --prerelease beta --dry-run", - "release:dry": "standard-version --dry-run", "lint": "eslint --ext .js,.ts .", "types": "vitest typecheck --run && tsc --noEmit", "types:watch": "vitest typecheck", @@ -57,9 +57,7 @@ "test": "npm run lint && npm run types && npm run unit && npm run build && npm run size" }, "dependencies": { - "@prismicio/client": "^6.7.3", - "@prismicio/helpers": "^2.3.9", - "@prismicio/types": "^0.2.7", + "@prismicio/client": "^7.0.1", "isomorphic-unfetch": "^3.1.0", "vue-router": "^4.2.1" }, @@ -96,7 +94,7 @@ "vue": "^3.0.0" }, "engines": { - "node": ">=14.15.0" + "node": ">=16.10.0" }, "publishConfig": { "access": "public" diff --git a/src/components/PrismicEmbed.ts b/src/components/PrismicEmbed.ts index eef8f7f..e4b2729 100644 --- a/src/components/PrismicEmbed.ts +++ b/src/components/PrismicEmbed.ts @@ -1,3 +1,4 @@ +import { EmbedField } from "@prismicio/client"; import { AllowedComponentProps, ComponentCustomProps, @@ -12,8 +13,6 @@ import { import { simplyResolveComponent } from "../lib/simplyResolveComponent"; -import { EmbedField } from "@prismicio/types"; - /** * The default component rendered to wrap the embed. */ diff --git a/src/components/PrismicImage.ts b/src/components/PrismicImage.ts index 547a602..5204e03 100644 --- a/src/components/PrismicImage.ts +++ b/src/components/PrismicImage.ts @@ -1,9 +1,10 @@ import { + ImageField, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, isFilled, -} from "@prismicio/helpers"; +} from "@prismicio/client"; import { AllowedComponentProps, ComponentCustomProps, @@ -23,7 +24,6 @@ import { __PRODUCTION__ } from "../lib/__PRODUCTION__"; import { simplyResolveComponent } from "../lib/simplyResolveComponent"; import { VueUseOptions } from "../types"; -import { ImageField } from "@prismicio/types"; import { usePrismic } from "../usePrismic"; diff --git a/src/components/PrismicLink.ts b/src/components/PrismicLink.ts index 3f82d7a..bdf9707 100644 --- a/src/components/PrismicLink.ts +++ b/src/components/PrismicLink.ts @@ -1,4 +1,9 @@ -import { LinkResolverFunction, asLink } from "@prismicio/helpers"; +import { + LinkField, + LinkResolverFunction, + PrismicDocument, + asLink, +} from "@prismicio/client"; import { AllowedComponentProps, ComponentCustomProps, @@ -20,7 +25,6 @@ import { isInternalURL } from "../lib/isInternalURL"; import { simplyResolveComponent } from "../lib/simplyResolveComponent"; import { VueUseOptions } from "../types"; -import { LinkField, PrismicDocument } from "@prismicio/types"; import { usePrismic } from "../usePrismic"; diff --git a/src/components/PrismicRichText.ts b/src/components/PrismicRichText.ts index 8858e4c..75dd3f8 100644 --- a/src/components/PrismicRichText.ts +++ b/src/components/PrismicRichText.ts @@ -2,9 +2,10 @@ import { HTMLFunctionSerializer, HTMLMapSerializer, LinkResolverFunction, + RichTextField, asHTML, isFilled, -} from "@prismicio/helpers"; +} from "@prismicio/client"; import { AllowedComponentProps, Component, @@ -31,7 +32,6 @@ import { isInternalURL } from "../lib/isInternalURL"; import { simplyResolveComponent } from "../lib/simplyResolveComponent"; import { VueUseOptions } from "../types"; -import { RichTextField } from "@prismicio/types"; import { usePrismic } from "../usePrismic"; diff --git a/src/components/PrismicText.ts b/src/components/PrismicText.ts index e417b82..08da7a3 100644 --- a/src/components/PrismicText.ts +++ b/src/components/PrismicText.ts @@ -1,4 +1,4 @@ -import { asText, isFilled } from "@prismicio/helpers"; +import { RichTextField, asText, isFilled } from "@prismicio/client"; import { AllowedComponentProps, ComponentCustomProps, @@ -18,7 +18,6 @@ import { import { simplyResolveComponent } from "../lib/simplyResolveComponent"; import { VueUseOptions } from "../types"; -import { RichTextField } from "@prismicio/types"; /** * The default component rendered to wrap the text output. diff --git a/src/components/SliceZone.ts b/src/components/SliceZone.ts index 3ebed80..5e14b40 100644 --- a/src/components/SliceZone.ts +++ b/src/components/SliceZone.ts @@ -1,3 +1,4 @@ +import { Slice } from "@prismicio/client"; import { AllowedComponentProps, ComponentCustomProps, @@ -17,8 +18,6 @@ import { import { __PRODUCTION__ } from "../lib/__PRODUCTION__"; import { simplyResolveComponent } from "../lib/simplyResolveComponent"; -import { Slice } from "@prismicio/types"; - import { usePrismic } from "../usePrismic"; /** @@ -37,7 +36,7 @@ type ExtractSliceType = TSlice extends SliceLikeRestV2 * Rest API V2 for the `` component. * * If using Prismic's Rest API V2, use the `Slice` export from - * `@prismicio/types` for a full interface. + * `@prismicio/client` for a full interface. * * @typeParam TSliceType - Type name of the Slice. */ @@ -60,7 +59,7 @@ export type SliceLikeGraphQL = { * The minimum required properties to represent a Prismic Slice for the * `` component. * - * If using Prismic's REST API, use the `Slice` export from `@prismicio/types` + * If using Prismic's REST API, use the `Slice` export from `@prismicio/client` * for a full interface. * * @typeParam TSliceType - Type name of the Slice @@ -70,11 +69,11 @@ export type SliceLike = | SliceLikeGraphQL; /** - * A looser version of the `SliceZone` type from `@prismicio/types` using + * A looser version of the `SliceZone` type from `@prismicio/client` using * `SliceLike`. * * If using Prismic's REST API, use the `SliceZone` export from - * `@prismicio/types` for the full type. + * `@prismicio/client` for the full type. * * @typeParam TSlice - The type(s) of slices in the Slice Zone */ @@ -153,8 +152,9 @@ export type DefineComponentSliceComponentProps< /** * Gets native Vue props for a component rendering content from a Prismic Slice - * using the `` component. Props are: `["slice", "index", "slices", - * "context"]` + * using the `` component. + * + * Props are: `["slice", "index", "slices", "context"]` * * @example Defining a new slice component: * diff --git a/src/composables.ts b/src/composables.ts index 0442c31..fa76398 100644 --- a/src/composables.ts +++ b/src/composables.ts @@ -3,7 +3,7 @@ import type { Client } from "@prismicio/client"; /* eslint-enable @typescript-eslint/no-unused-vars */ -import { PrismicDocument, Query } from "@prismicio/types"; +import { PrismicDocument, Query } from "@prismicio/client"; import { ClientComposableReturnType, diff --git a/src/createPrismic.ts b/src/createPrismic.ts index 0b696a6..a8d670e 100644 --- a/src/createPrismic.ts +++ b/src/createPrismic.ts @@ -1,20 +1,20 @@ import { Client, FetchLike, - cookie, - createClient, - predicate, -} from "@prismicio/client"; -import { + LinkResolverFunction, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, + asLinkAttrs, asText, + cookie, + createClient, documentToLinkField, -} from "@prismicio/helpers"; + filter, +} from "@prismicio/client"; import { App } from "vue"; import type { @@ -67,22 +67,54 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => { const prismicClient: PrismicPluginClient = { client, - predicate, + filter, cookie, }; // Create plugin helpers const prismicHelpers: PrismicPluginHelpers = { asText, - asHTML: (richTextField, linkResolver, htmlSerializer) => { + asHTML: (richTextField, ...config) => { + const [configOrLinkResolver, maybeHTMLSerializer] = config; + return asHTML( richTextField, - linkResolver || options.linkResolver, - htmlSerializer || options.richTextSerializer || options.htmlSerializer, + typeof configOrLinkResolver === "function" || + configOrLinkResolver == null + ? { + linkResolver: configOrLinkResolver || options.linkResolver, + serializer: + maybeHTMLSerializer || + options.richTextSerializer || + options.htmlSerializer, + } + : { + linkResolver: options.linkResolver, + serializer: options.richTextSerializer || options.htmlSerializer, + ...config, + }, + ); + }, + asLink: (linkField, config) => { + return asLink( + linkField, + typeof config === "function" + ? { linkResolver: config } + : { + linkResolver: options.linkResolver, + // TODO: For some reasons, TypeScript narrows the type to "unknown" where it's supposed to be a union + // eslint-disable-next-line @typescript-eslint/no-explicit-any + ...(config as any), + }, ); }, - asLink: (linkField, linkResolver) => { - return asLink(linkField, linkResolver || options.linkResolver); + asLinkAttrs: (linkField, config) => { + return asLinkAttrs(linkField, { + // TODO: We can't really retrieve the generic type here, this might cause some unexpected type error in some edge-case scenario + // eslint-disable-next-line @typescript-eslint/no-explicit-any + linkResolver: options.linkResolver as LinkResolverFunction, + ...config, + }); }, asDate, asImageSrc, diff --git a/src/types.ts b/src/types.ts index d7ac2af..4cef1a0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,12 +1,8 @@ import type { ClientConfig, CreateClient, - cookie, - predicate, -} from "@prismicio/client"; -import type { - HTMLFunctionSerializer, - HTMLMapSerializer, + HTMLRichTextFunctionSerializer, + HTMLRichTextMapSerializer, LinkResolverFunction, asDate, asHTML, @@ -14,9 +10,12 @@ import type { asImageSrc, asImageWidthSrcSet, asLink, + asLinkAttrs, asText, + cookie, documentToLinkField, -} from "@prismicio/helpers"; + filter, +} from "@prismicio/client"; import type { App, ConcreteComponent, DefineComponent, Raw, Ref } from "vue"; /* eslint-disable @typescript-eslint/no-unused-vars */ @@ -92,7 +91,7 @@ type PrismicPluginComponentsOptions = { * Consider configuring image widths within your content type definition and * using `widths="auto"` instead to give content writers the ability to crop * images in the editor. - * @defaultValue `@prismicio/helpers` defaults + * @defaultValue `@prismicio/client` defaults */ imageWidthSrcSetDefaults?: number[]; @@ -100,7 +99,7 @@ type PrismicPluginComponentsOptions = { * Default pixel densities to use when rendering an image with * `pixel-densities="defaults"` * - * @defaultValue `@prismicio/helpers` defaults + * @defaultValue `@prismicio/client` defaults */ imagePixelDensitySrcSetDefaults?: number[]; @@ -135,7 +134,9 @@ type PrismicPluginOptionsBase = { * * @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer} */ - richTextSerializer?: HTMLFunctionSerializer | HTMLMapSerializer; + richTextSerializer?: + | HTMLRichTextFunctionSerializer + | HTMLRichTextMapSerializer; /** * An optional HTML serializer to customize the way rich text fields are @@ -146,7 +147,7 @@ type PrismicPluginOptionsBase = { * @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer} */ // TODO: Remove in v5 - htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer; + htmlSerializer?: HTMLRichTextFunctionSerializer | HTMLRichTextMapSerializer; /** * Whether or not to inject components globally. @@ -287,9 +288,9 @@ export type PrismicPluginClient = { client: ReturnType; /** - * Query predicates from `@prismicio/client`. + * Query filters from `@prismicio/client`. */ - predicate: typeof predicate; + filter: typeof filter; /** * Prismic cookies from `@prismicio/client`. @@ -298,13 +299,13 @@ export type PrismicPluginClient = { }; /** - * `@prismicio/helpers` related methods exposed by `@prismicio/vue` plugin and + * `@prismicio/client` related methods exposed by `@prismicio/vue` plugin and * accessible through `this.$prismic` and `usePrismic()`. */ export type PrismicPluginHelpers = { /** * Serializes a rich text or title field to a plain text string. This is - * `@prismicio/helpers` {@link asText} function. + * `@prismicio/client` {@link asText} function. * * @see Templating rich text and title fields {@link https://prismic.io/docs/technologies/vue-template-content#rich-text-and-titles} */ @@ -312,7 +313,7 @@ export type PrismicPluginHelpers = { /** * Serializes a rich text or title field to an HTML string. This is - * `@prismicio/helpers` {@link asHTML} function. + * `@prismicio/client` {@link asHTML} function. * * @remarks * If no `linkResolver` is provided the function will use the one provided to @@ -326,34 +327,42 @@ export type PrismicPluginHelpers = { /** * Resolves any type of link field or document to a URL. This is - * `@prismicio/helpers` {@link asLink} function. + * `@prismicio/client` {@link asLink} function. + * + * @remarks + * If no `linkResolver` is provided the function will use the one provided to + * the plugin at {@link PrismicPluginOptions.linkResolver} if available. + * @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships} + */ + asLink: typeof asLink; + + /** + * Resolves any type of link field or document to a set of link attributes. + * This is `@prismicio/client` {@link asLinkAttrs} function. * * @remarks * If no `linkResolver` is provided the function will use the one provided to * the plugin at {@link PrismicPluginOptions.linkResolver} if available. * @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships} */ - asLink: ( - linkField: Parameters[0], - linkResolver?: LinkResolverFunction, - ) => string | null; + asLinkAttrs: typeof asLinkAttrs; /** * Transforms a date or timestamp field into a JavaScript Date object. This is - * `@prismicio/helpers` {@link asDate} function. + * `@prismicio/client` {@link asDate} function. */ asDate: typeof asDate; /** * Returns the URL of an Image field with optional image transformations (via - * Imgix URL parameters). This is `@prismicio/helpers` {@link asImageSrc} + * Imgix URL parameters). This is `@prismicio/client` {@link asImageSrc} * function. */ asImageSrc: typeof asImageSrc; /** * Creates a width-based `srcset` from an Image field with optional image - * transformations (via Imgix URL parameters). This is `@prismicio/helpers` + * transformations (via Imgix URL parameters). This is `@prismicio/client` * {@link asImageWidthSrcSet} function. */ asImageWidthSrcSet: typeof asImageWidthSrcSet; @@ -361,12 +370,12 @@ export type PrismicPluginHelpers = { /** * Creates a pixel-density-based `srcset` from an Image field with optional * image transformations (via Imgix URL parameters). This is - * `@prismicio/helpers` {@link asImagePixelDensitySrcSet} function. + * `@prismicio/client` {@link asImagePixelDensitySrcSet} function. */ asImagePixelDensitySrcSet: typeof asImagePixelDensitySrcSet; /** - * Converts a document into a link field. This is `@prismicio/helpers` + * Converts a document into a link field. This is `@prismicio/client` * {@link documentToLinkField} function. * * @internal diff --git a/test/__fixtures__/richText.ts b/test/__fixtures__/richText.ts index 9d257d9..6811d73 100644 --- a/test/__fixtures__/richText.ts +++ b/test/__fixtures__/richText.ts @@ -1,4 +1,4 @@ -import { RichTextField } from "@prismicio/types"; +import { RichTextField } from "@prismicio/client"; import enRichTextJSON from "./enRichText.json"; import linkRichTextJSON from "./linkRichText.json"; diff --git a/test/components-PrismicEmbed.test.ts b/test/components-PrismicEmbed.test.ts index cc5cb0f..e6a6d5d 100644 --- a/test/components-PrismicEmbed.test.ts +++ b/test/components-PrismicEmbed.test.ts @@ -1,13 +1,12 @@ import { expect, it, vi } from "vitest"; import * as mock from "@prismicio/mock"; +import { EmbedField } from "@prismicio/client"; import { mount } from "@vue/test-utils"; import { markRaw } from "vue"; import { WrapperComponent } from "./__fixtures__/WrapperComponent"; -import { EmbedField } from "@prismicio/types"; - import { PrismicEmbedImpl } from "../src/components"; it("renders embed field", () => { diff --git a/test/components-PrismicImage.test.ts b/test/components-PrismicImage.test.ts index 10522b8..fb4be9c 100644 --- a/test/components-PrismicImage.test.ts +++ b/test/components-PrismicImage.test.ts @@ -1,6 +1,7 @@ import { expect, it, vi } from "vitest"; import * as mock from "@prismicio/mock"; +import { ImageField } from "@prismicio/client"; import { mount } from "@vue/test-utils"; import { markRaw } from "vue"; @@ -9,8 +10,6 @@ import { createWrapperComponent, } from "./__fixtures__/WrapperComponent"; -import { ImageField } from "@prismicio/types"; - import { createPrismic } from "../src"; import { PrismicImageImpl } from "../src/components"; diff --git a/test/components-PrismicLink.test.ts b/test/components-PrismicLink.test.ts index d0897e7..bebf5ce 100644 --- a/test/components-PrismicLink.test.ts +++ b/test/components-PrismicLink.test.ts @@ -1,6 +1,7 @@ import { expect, it, vi } from "vitest"; import * as mock from "@prismicio/mock"; +import { LinkField, LinkType } from "@prismicio/client"; import { mount } from "@vue/test-utils"; import { markRaw } from "vue"; @@ -10,8 +11,6 @@ import { } from "./__fixtures__/WrapperComponent"; import router from "./__fixtures__/router"; -import { LinkField, LinkType } from "@prismicio/types"; - import { createPrismic } from "../src"; import { PrismicLinkImpl } from "../src/components"; diff --git a/test/components-PrismicRichText.test.ts b/test/components-PrismicRichText.test.ts index 85a7d5d..c2c12ef 100644 --- a/test/components-PrismicRichText.test.ts +++ b/test/components-PrismicRichText.test.ts @@ -1,5 +1,6 @@ import { expect, it, vi } from "vitest"; +import { RichTextField } from "@prismicio/client"; import { Element } from "@prismicio/richtext"; import { flushPromises, mount } from "@vue/test-utils"; import { markRaw } from "vue"; @@ -8,8 +9,6 @@ import { routerKey } from "vue-router"; import { WrapperComponent } from "./__fixtures__/WrapperComponent"; import { richTextFixture } from "./__fixtures__/richText"; -import { RichTextField } from "@prismicio/types"; - import { createPrismic } from "../src"; import { PrismicRichTextImpl } from "../src/components"; diff --git a/test/components-PrismicText.test.ts b/test/components-PrismicText.test.ts index 580fea5..0fd8c06 100644 --- a/test/components-PrismicText.test.ts +++ b/test/components-PrismicText.test.ts @@ -1,13 +1,12 @@ import { expect, it } from "vitest"; +import { RichTextField } from "@prismicio/client"; import { mount } from "@vue/test-utils"; import { markRaw } from "vue"; import { WrapperComponent } from "./__fixtures__/WrapperComponent"; import { richTextFixture } from "./__fixtures__/richText"; -import { RichTextField } from "@prismicio/types"; - import { PrismicTextImpl } from "../src/components"; it("renders rich text field as plain text", () => { diff --git a/test/createPrismic-helpers.test.ts b/test/createPrismic-helpers.test.ts index 0488a3f..82502c7 100644 --- a/test/createPrismic-helpers.test.ts +++ b/test/createPrismic-helpers.test.ts @@ -1,13 +1,12 @@ import { expect, it, vi } from "vitest"; import * as mock from "@prismicio/mock"; +import { LinkType } from "@prismicio/client"; import { mount } from "@vue/test-utils"; import { WrapperComponent } from "./__fixtures__/WrapperComponent"; import { richTextFixture } from "./__fixtures__/richText"; -import { LinkType } from "@prismicio/types"; - import { createPrismic } from "../src"; it("`asHTML` uses provided default link resolver", () => {