Skip to content

Commit 24df0e9

Browse files
committedJul 23, 2024·
chore(deps): maintain dependencies
1 parent 8c5a82b commit 24df0e9

32 files changed

+2393
-3154
lines changed
 

‎.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"jsdocCapitalizeDescription": false,
44
"jsdocSeparateReturnsFromParam": true,
55
"jsdocSeparateTagGroups": true,
6-
"jsdocSingleLineComment": false,
6+
"jsdocCommentLineStrategy": "multiline",
77
"tsdoc": true,
88
"importOrder": [
99
"^vitest(/|$)",

‎package-lock.json

+2,165-2,932
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+20-20
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"hast": "^1.0.0",
8383
"hast-util-select": "^6.0.2",
8484
"hast-util-to-html": "^9.0.1",
85-
"imgix-url-builder": "^0.0.4",
85+
"imgix-url-builder": "^0.0.5",
8686
"mdast-util-to-string": "^4.0.0",
8787
"rehype-minify-whitespace": "^6.0.0",
8888
"rehype-parse": "^9.0.0",
@@ -94,29 +94,29 @@
9494
"vfile": "^6.0.2"
9595
},
9696
"devDependencies": {
97-
"@prismicio/mock": "^0.3.1",
98-
"@prismicio/types-internal": "^2.5.0",
99-
"@size-limit/preset-small-lib": "^9.0.0",
100-
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
101-
"@typescript-eslint/eslint-plugin": "^6.7.4",
102-
"@typescript-eslint/parser": "^6.7.4",
103-
"@vitest/coverage-v8": "^0.34.6",
97+
"@prismicio/mock": "^0.3.7",
98+
"@prismicio/types-internal": "^2.6.0",
99+
"@size-limit/preset-small-lib": "^11.1.4",
100+
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
101+
"@typescript-eslint/eslint-plugin": "^6.21.0",
102+
"@typescript-eslint/parser": "^6.21.0",
103+
"@vitest/coverage-v8": "^2.0.4",
104104
"abort-controller": "^3.0.0",
105-
"eslint": "^8.50.0",
106-
"eslint-config-prettier": "^9.0.0",
107-
"eslint-plugin-prettier": "^5.0.0",
108-
"eslint-plugin-tsdoc": "^0.2.17",
109-
"msw": "^1.3.2",
105+
"eslint": "^8.57.0",
106+
"eslint-config-prettier": "^9.1.0",
107+
"eslint-plugin-prettier": "^5.2.1",
108+
"eslint-plugin-tsdoc": "^0.3.0",
109+
"msw": "^1.3.3",
110110
"node-fetch": "^3.3.2",
111-
"prettier": "^3.0.3",
112-
"prettier-plugin-jsdoc": "1.0.2",
113-
"size-limit": "^9.0.0",
111+
"prettier": "^3.3.3",
112+
"prettier-plugin-jsdoc": "1.3.0",
113+
"size-limit": "^11.1.4",
114114
"standard-version": "^9.5.0",
115115
"ts-expect": "^1.3.0",
116-
"typescript": "~5.0.4",
117-
"vite": "^4.4.11",
118-
"vite-plugin-sdk": "^0.1.1",
119-
"vitest": "^0.34.6"
116+
"typescript": "^5.5.4",
117+
"vite": "^5.3.4",
118+
"vite-plugin-sdk": "^0.1.2",
119+
"vitest": "^2.0.4"
120120
},
121121
"engines": {
122122
"node": ">=14.15.0"

‎src/createClient.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ const DEFUALT_RETRY_AFTER_MS = 1000;
7575
type ExtractDocumentType<
7676
TDocuments extends PrismicDocument,
7777
TDocumentType extends TDocuments["type"],
78-
> = Extract<TDocuments, { type: TDocumentType }> extends never
79-
? TDocuments
80-
: Extract<TDocuments, { type: TDocumentType }>;
78+
> =
79+
Extract<TDocuments, { type: TDocumentType }> extends never
80+
? TDocuments
81+
: Extract<TDocuments, { type: TDocumentType }>;
8182

8283
/**
8384
* A universal API to make network requests. A subset of the `fetch()` API.

‎src/helpers/asHTML.ts

+20-18
Original file line numberDiff line numberDiff line change
@@ -93,31 +93,33 @@ type HTMLRichTextMapSerializerFunction<
9393
* @typeParam T - The `RichTextMapSerializerFunction` containing the needed
9494
* `Node` generic.
9595
*/
96-
type ExtractNodeGeneric<T> = T extends RichTextMapSerializerFunction<
97-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
98-
any,
99-
infer U,
100-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
101-
any
102-
>
103-
? U
104-
: never;
96+
type ExtractNodeGeneric<T> =
97+
T extends RichTextMapSerializerFunction<
98+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
99+
any,
100+
infer U,
101+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
102+
any
103+
>
104+
? U
105+
: never;
105106

106107
/**
107108
* Returns the `TextType` generic from {@link RichTextMapSerializerFunction}.
108109
*
109110
* @typeParam T - The `RichTextMapSerializerFunction` containing the needed
110111
* `TextType` generic.
111112
*/
112-
type ExtractTextTypeGeneric<T> = T extends RichTextMapSerializerFunction<
113-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
114-
any,
115-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
116-
any,
117-
infer U
118-
>
119-
? U
120-
: never;
113+
type ExtractTextTypeGeneric<T> =
114+
T extends RichTextMapSerializerFunction<
115+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
116+
any,
117+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
118+
any,
119+
infer U
120+
>
121+
? U
122+
: never;
121123

122124
/**
123125
* A shorthand definition for {@link HTMLRichTextMapSerializer} element types.

‎src/helpers/asImagePixelDensitySrcSet.ts

+14-13
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,21 @@ type AsImagePixelDensitySrcSetConfig = Omit<
2727
*/
2828
type AsImagePixelDensitySrcSetReturnType<
2929
Field extends ImageFieldImage | null | undefined,
30-
> = Field extends ImageFieldImage<"filled">
31-
? {
32-
/**
33-
* The image field's image URL with Imgix URL parameters (if given).
34-
*/
35-
src: string;
30+
> =
31+
Field extends ImageFieldImage<"filled">
32+
? {
33+
/**
34+
* The image field's image URL with Imgix URL parameters (if given).
35+
*/
36+
src: string;
3637

37-
/**
38-
* A pixel-densitye-based `srcset` attribute value for the image field's
39-
* image with Imgix URL parameters (if given).
40-
*/
41-
srcset: string;
42-
}
43-
: null;
38+
/**
39+
* A pixel-densitye-based `srcset` attribute value for the image field's
40+
* image with Imgix URL parameters (if given).
41+
*/
42+
srcset: string;
43+
}
44+
: null;
4445

4546
/**
4647
* Creates a pixel-density-based `srcset` from an image field with optional

‎src/helpers/asImageWidthSrcSet.ts

+16-15
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@ const DEFAULT_WIDTHS = [640, 828, 1200, 2048, 3840];
1818
*/
1919
type AsImageWidthSrcSetReturnType<
2020
Field extends ImageFieldImage | null | undefined,
21-
> = Field extends ImageFieldImage<"filled">
22-
? {
23-
/**
24-
* The image field's image URL with Imgix URL parameters (if given).
25-
*/
26-
src: string;
21+
> =
22+
Field extends ImageFieldImage<"filled">
23+
? {
24+
/**
25+
* The image field's image URL with Imgix URL parameters (if given).
26+
*/
27+
src: string;
2728

28-
/**
29-
* A width-based `srcset` attribute value for the image field's image with
30-
* Imgix URL parameters (if given).
31-
*/
32-
srcset: string;
33-
}
34-
: null;
29+
/**
30+
* A width-based `srcset` attribute value for the image field's image
31+
* with Imgix URL parameters (if given).
32+
*/
33+
srcset: string;
34+
}
35+
: null;
3536

3637
/**
3738
* Configuration for `asImageWidthSrcSet()`.
@@ -130,11 +131,11 @@ export const asImageWidthSrcSet = <
130131
widths: [thumbnail.dimensions.width],
131132
});
132133
}),
133-
].join(", ")
134+
].join(", ")
134135
: buildWidthSrcSet(field.url, {
135136
...imgixParams,
136137
widths,
137-
}),
138+
}),
138139
} as AsImageWidthSrcSetReturnType<Field>;
139140
} else {
140141
return null as AsImageWidthSrcSetReturnType<Field>;

‎src/helpers/asLinkAttrs.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ type AsLinkAttrsReturnType<
5858
| undefined;
5959
target?: string;
6060
rel?: string;
61-
}
61+
}
6262
: {
6363
href?: undefined;
6464
target?: undefined;
6565
rel?: undefined;
66-
};
66+
};
6767

6868
/**
6969
* Resolves any type of link field or Prismic document to a set of link
@@ -120,8 +120,8 @@ export const asLinkAttrs = <
120120
const rel = config.rel
121121
? config.rel({ href, isExternal, target })
122122
: isExternal
123-
? "noreferrer"
124-
: undefined;
123+
? "noreferrer"
124+
: undefined;
125125

126126
return {
127127
href,

‎src/helpers/mapSliceZone.ts

+20-19
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ type AnyFunction = (...args: any[]) => any;
2222
type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2
2323
? TSlice["slice_type"]
2424
: TSlice extends SliceLikeGraphQL
25-
? TSlice["type"]
26-
: never;
25+
? TSlice["type"]
26+
: never;
2727

2828
/**
2929
* The minimum required properties to represent a Prismic Slice from the Prismic
@@ -160,13 +160,14 @@ export type SliceMapper<
160160
type ResolveLazySliceMapperModule<
161161
// eslint-disable-next-line @typescript-eslint/no-explicit-any
162162
TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,
163-
> = TSliceMapper extends LazyModule<SliceMapper>
164-
? Awaited<ReturnType<TSliceMapper>> extends {
165-
default: unknown;
166-
}
167-
? Awaited<ReturnType<TSliceMapper>>["default"]
168-
: Awaited<ReturnType<TSliceMapper>>
169-
: TSliceMapper;
163+
> =
164+
TSliceMapper extends LazyModule<SliceMapper>
165+
? Awaited<ReturnType<TSliceMapper>> extends {
166+
default: unknown;
167+
}
168+
? Awaited<ReturnType<TSliceMapper>>["default"]
169+
: Awaited<ReturnType<TSliceMapper>>
170+
: TSliceMapper;
170171

171172
/**
172173
* Transforms a Slice into its mapped version.
@@ -194,18 +195,18 @@ type MapSliceLike<
194195
: TSliceLike
195196
: TSliceLike
196197
: TSliceLike extends SliceLikeGraphQL
197-
? TSliceLike["type"] extends keyof TSliceMappers
198-
? TSliceMappers[TSliceLike["type"]] extends AnyFunction
199-
? SliceLikeGraphQL<TSliceLike["type"]> &
200-
MappedSliceLike &
201-
Awaited<
202-
ReturnType<
203-
ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["type"]]>
198+
? TSliceLike["type"] extends keyof TSliceMappers
199+
? TSliceMappers[TSliceLike["type"]] extends AnyFunction
200+
? SliceLikeGraphQL<TSliceLike["type"]> &
201+
MappedSliceLike &
202+
Awaited<
203+
ReturnType<
204+
ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["type"]]>
205+
>
204206
>
205-
>
207+
: TSliceLike
206208
: TSliceLike
207-
: TSliceLike
208-
: never;
209+
: never;
209210

210211
/**
211212
* Transforms a Slice Zone using a set of mapping functions, one for each type

‎src/richtext/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export { asText } from "./asText";
44
export { serialize } from "./serialize";
55
export { wrapMapSerializer } from "./wrapMapSerializer";
66
export { composeSerializers } from "./composeSerializers";
7-
export { filterRichTextField } from "../lib/filterRichTextField";
87

98
export { RichTextNodeType as Element } from "../types/value/richText";
109

‎src/types/value/embed.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,4 @@ export type EmbedField<
194194
: Data & {
195195
embed_url: string;
196196
html: string | null;
197-
};
197+
};

‎src/types/value/geoPoint.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ export type GeoPointField<State extends FieldState = FieldState> =
1313
: {
1414
latitude: number;
1515
longitude: number;
16-
};
16+
};

‎src/types/value/title.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ export type TitleField<State extends FieldState = FieldState> =
2929
> & {
3030
spans: [];
3131
},
32-
];
32+
];

‎test/__setup__.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ beforeAll(() => {
2222
});
2323

2424
beforeEach((ctx) => {
25-
ctx.mock = createMockFactory({ seed: ctx.meta.name });
25+
ctx.mock = createMockFactory({ seed: ctx.task.name });
2626
ctx.server = server;
2727

2828
// Reset cookies.

‎test/__snapshots__/helpers-asHTML.test.ts.snap

+5-5
Large diffs are not rendered by default.

‎test/__snapshots__/helpers-unstable_htmlAsRichText.test.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ exports[`transforms HTML to rich text > embed > custom 1`] = `
445445
{
446446
"oembed": {
447447
"embed_url": "https://twitter.com/li_hbr/status/1803718142222282829?ref_src=twsrc%5Etfw",
448-
"html": "<blockquote class=\\"twitter-tweet\\" src=\\"https://twitter.com/li_hbr/status/1803718142222282829?ref_src=twsrc%5Etfw\\"><p lang=\\"en\\" dir=\\"ltr\\">Slack bot that uses AI to tl;dr; threads for you, anyone?</p>— Lucie (@li_hbr) <a href=\\"https://twitter.com/li_hbr/status/1803718142222282829?ref_src=twsrc%5Etfw\\">June 20, 2024</a></blockquote>",
448+
"html": "<blockquote class="twitter-tweet" src="https://twitter.com/li_hbr/status/1803718142222282829?ref_src=twsrc%5Etfw"><p lang="en" dir="ltr">Slack bot that uses AI to tl;dr; threads for you, anyone?</p>— Lucie (@li_hbr) <a href="https://twitter.com/li_hbr/status/1803718142222282829?ref_src=twsrc%5Etfw">June 20, 2024</a></blockquote>",
449449
"title": undefined,
450450
"type": "link",
451451
"version": "1.0",
@@ -461,7 +461,7 @@ exports[`transforms HTML to rich text > embed > iframe 1`] = `
461461
"oembed": {
462462
"embed_url": "https://www.youtube.com/embed/wkS1bf7BLjs?feature=oembed",
463463
"height": 150,
464-
"html": "<iframe width=\\"200\\" height=\\"150\\" src=\\"https://www.youtube.com/embed/wkS1bf7BLjs?feature=oembed\\" frameborder=\\"0\\" allow=\\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\\" referrerpolicy=\\"strict-origin-when-cross-origin\\" allowfullscreen title=\\"幾田りら「ハミング」Official Music Video\\"></iframe>",
464+
"html": "<iframe width="200" height="150" src="https://www.youtube.com/embed/wkS1bf7BLjs?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen title="幾田りら「ハミング」Official Music Video"></iframe>",
465465
"title": "幾田りら「ハミング」Official Music Video",
466466
"type": "rich",
467467
"version": "1.0",

‎test/__testutils__/testAnyGetMethod.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const testAnyGetMethodFactory = (
2828
args: TestGetAllMethodArgs,
2929
mode: "get" | "getFirst" | "getAll",
3030
): void => {
31-
it.concurrent(description, async (ctx) => {
31+
it(description, async (ctx) => {
3232
const queryResponses = createPagedQueryResponses({
3333
ctx,
3434
pages: args.mockedPages,

‎test/__testutils__/testAsRichTextHelper.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const testAsRichTextHelperFactory = <
4040
THelper extends typeof unstable_htmlAsRichText
4141
? HTMLAsRichTextConfig
4242
: THelper extends typeof unstable_markdownAsRichText
43-
? MarkdownAsRichTextConfig
44-
: undefined
43+
? MarkdownAsRichTextConfig
44+
: undefined
4545
>,
4646
helper: THelper,
4747
): void => {

‎test/client-getFirst.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ testGetFirstMethod(
7878
it("throws if no documents were returned", async (ctx) => {
7979
mockPrismicRestAPIV2({
8080
queryResponse: prismicM.api.query({
81-
seed: ctx.meta.name,
81+
seed: ctx.task.name,
8282
documents: [],
8383
}),
8484
ctx,

‎test/client-queryContentFromRef.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ testGetMethod("supports manual thunk ref", {
3131

3232
it("uses master ref if manual thunk ref returns non-string value", async (ctx) => {
3333
const repositoryResponse = ctx.mock.api.repository();
34-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
34+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
3535

3636
mockPrismicRestAPIV2({
3737
repositoryResponse,

‎test/client-queryContentFromReleaseById.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ref2.id = ref1.id;
2020
it("uses a releases ref by ID", async (ctx) => {
2121
const repositoryResponse = ctx.mock.api.repository();
2222
repositoryResponse.refs = [ref1];
23-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
23+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
2424

2525
mockPrismicRestAPIV2({
2626
repositoryResponse,

‎test/client-queryContentFromReleaseByLabel.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ref2.label = ref1.label;
2020
it("uses a releases ref by label", async (ctx) => {
2121
const repositoryResponse = ctx.mock.api.repository();
2222
repositoryResponse.refs = [ref1];
23-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
23+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
2424

2525
mockPrismicRestAPIV2({
2626
repositoryResponse,

‎test/client-resolvePreviewUrl.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { testFetchOptions } from "./__testutils__/testFetchOptions";
1212
const previewToken = "previewToken";
1313

1414
it("resolves a preview url in the browser", async (ctx) => {
15-
const seed = ctx.meta.name;
15+
const seed = ctx.task.name;
1616
const document = { ...prismicM.value.document({ seed }), uid: seed };
1717
const queryResponse = prismicM.api.query({ seed, documents: [document] });
1818

@@ -45,7 +45,7 @@ it("resolves a preview url in the browser", async (ctx) => {
4545
});
4646

4747
it("resolves a preview url using a server req object", async (ctx) => {
48-
const seed = ctx.meta.name;
48+
const seed = ctx.task.name;
4949
const document = { ...prismicM.value.document({ seed }), uid: seed };
5050
const queryResponse = prismicM.api.query({ seed, documents: [document] });
5151

@@ -78,7 +78,7 @@ it("resolves a preview url using a server req object", async (ctx) => {
7878
});
7979

8080
it("resolves a preview url using a Web API-based server req object", async (ctx) => {
81-
const seed = ctx.meta.name;
81+
const seed = ctx.task.name;
8282
const document = { ...prismicM.value.document({ seed }), uid: seed };
8383
const queryResponse = prismicM.api.query({ seed, documents: [document] });
8484

@@ -113,7 +113,7 @@ it("resolves a preview url using a Web API-based server req object", async (ctx)
113113
});
114114

115115
it("resolves a preview url using a Web API-based server req object containing a URL without a host", async (ctx) => {
116-
const seed = ctx.meta.name;
116+
const seed = ctx.task.name;
117117
const document = { ...prismicM.value.document({ seed }), uid: seed };
118118
const queryResponse = prismicM.api.query({ seed, documents: [document] });
119119

@@ -146,7 +146,7 @@ it("resolves a preview url using a Web API-based server req object containing a
146146
});
147147

148148
it("allows providing an explicit documentId and previewToken", async (ctx) => {
149-
const seed = ctx.meta.name;
149+
const seed = ctx.task.name;
150150
const document = { ...prismicM.value.document({ seed }), uid: seed };
151151
const queryResponse = prismicM.api.query({ seed, documents: [document] });
152152

@@ -226,7 +226,7 @@ it("returns defaultURL if no preview context is available", async () => {
226226
});
227227

228228
it("returns defaultURL if resolved URL is not a string", async (ctx) => {
229-
const seed = ctx.meta.name;
229+
const seed = ctx.task.name;
230230
const document = {
231231
...prismicM.value.document({ seed, withURL: false }),
232232
uid: seed,

‎test/client.test.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ it("uses globalThis.fetch if available", async () => {
217217
});
218218

219219
it("uses the master ref by default", async (ctx) => {
220-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
220+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
221221

222222
mockPrismicRestAPIV2({
223223
queryResponse,
@@ -231,7 +231,7 @@ it("uses the master ref by default", async (ctx) => {
231231
});
232232

233233
it("supports manual string ref", async (ctx) => {
234-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
234+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
235235
const ref = "ref";
236236

237237
mockPrismicRestAPIV2({
@@ -247,7 +247,7 @@ it("supports manual string ref", async (ctx) => {
247247
});
248248

249249
it("supports manual thunk ref", async (ctx) => {
250-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
250+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
251251
const ref = "ref";
252252

253253
mockPrismicRestAPIV2({
@@ -264,7 +264,7 @@ it("supports manual thunk ref", async (ctx) => {
264264

265265
it("uses master ref if ref thunk param returns non-string value", async (ctx) => {
266266
const repositoryResponse = ctx.mock.api.repository();
267-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
267+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
268268

269269
mockPrismicRestAPIV2({
270270
repositoryResponse,
@@ -286,7 +286,7 @@ it("uses browser preview ref if available", async (ctx) => {
286286
cookie: `io.prismic.preview=${previewRef}`,
287287
};
288288

289-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
289+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
290290

291291
mockPrismicRestAPIV2({
292292
queryResponse,
@@ -310,7 +310,7 @@ it("uses req preview ref if available", async (ctx) => {
310310
},
311311
};
312312

313-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
313+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
314314

315315
mockPrismicRestAPIV2({
316316
queryResponse,
@@ -334,7 +334,7 @@ it("supports req with Web APIs", async (ctx) => {
334334
url: "https://example.com",
335335
};
336336

337-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
337+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
338338

339339
mockPrismicRestAPIV2({
340340
queryResponse,
@@ -355,7 +355,7 @@ it("ignores req without cookies", async (ctx) => {
355355
};
356356

357357
const repositoryResponse = ctx.mock.api.repository();
358-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
358+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
359359

360360
mockPrismicRestAPIV2({
361361
repositoryResponse,
@@ -379,7 +379,7 @@ it("does not use preview ref if auto previews are disabled", async (ctx) => {
379379
};
380380

381381
const repositoryResponse = ctx.mock.api.repository();
382-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
382+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
383383

384384
const client = createTestClient();
385385

@@ -417,7 +417,7 @@ it("does not use preview ref if auto previews are disabled", async (ctx) => {
417417
it("uses the integration fields ref if the repository provides it", async (ctx) => {
418418
const repositoryResponse = ctx.mock.api.repository();
419419
repositoryResponse.integrationFieldsRef = ctx.mock.api.ref().ref;
420-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
420+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
421421

422422
mockPrismicRestAPIV2({
423423
repositoryResponse,
@@ -439,7 +439,7 @@ it("uses the integration fields ref if the repository provides it", async (ctx)
439439
it("ignores the integration fields ref if the repository provides a null value", async (ctx) => {
440440
const repositoryResponse = ctx.mock.api.repository();
441441
repositoryResponse.integrationFieldsRef = null;
442-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
442+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
443443

444444
mockPrismicRestAPIV2({
445445
repositoryResponse,
@@ -457,7 +457,7 @@ it("ignores the integration fields ref if the repository provides a null value",
457457
});
458458

459459
it("uses client-provided routes in queries", async (ctx) => {
460-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
460+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
461461

462462
const routes: prismic.Route[] = [
463463
{
@@ -492,7 +492,7 @@ it("uses client-provided routes in queries", async (ctx) => {
492492
});
493493

494494
it("uses client-provided brokenRoute in queries", async (ctx) => {
495-
const queryResponse = prismicM.api.query({ seed: ctx.meta.name });
495+
const queryResponse = prismicM.api.query({ seed: ctx.task.name });
496496

497497
const brokenRoute = "/404";
498498

‎test/helpers-asHTML.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ it("omits target attribute on links without a target value", () => {
108108
];
109109

110110
expect(asHTML(field, { linkResolver })).toMatchInlineSnapshot(
111-
'"<p><a href=\\"https://example.org\\" rel=\\"noopener noreferrer\\">link</a></p>"',
111+
`"<p><a href="https://example.org" rel="noopener noreferrer">link</a></p>"`,
112112
);
113113
});
114114

@@ -133,7 +133,7 @@ it("includes target attribute on links with a target value", () => {
133133
];
134134

135135
expect(asHTML(field, { linkResolver })).toMatchInlineSnapshot(
136-
'"<p><a href=\\"https://example.org\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">link</a></p>"',
136+
`"<p><a href="https://example.org" target="_blank" rel="noopener noreferrer">link</a></p>"`,
137137
);
138138
});
139139

‎test/helpers-unstable_htmlAsRichText.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ describe("transforms HTML to rich text", () => {
228228
},
229229
),
230230
).toThrowErrorMatchingInlineSnapshot(
231-
'"Unknown rich text node type: `foo`"',
231+
`[Error: Unknown rich text node type: \`foo\`]`,
232232
);
233233
});
234234
});
@@ -364,7 +364,7 @@ describe("transforms HTML to rich text", () => {
364364
expect(() =>
365365
unstable_htmlAsRichText("", { container: "article#baz" }),
366366
).toThrowErrorMatchingInlineSnapshot(
367-
'"No container matching `article#baz` could be found in the input AST."',
367+
`[Error: No container matching \`article#baz\` could be found in the input AST.]`,
368368
);
369369
});
370370
});

‎test/richtext/__snapshots__/asTree.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -3552,7 +3552,7 @@ exports[`converts a rich text field value to a tree 1`] = `
35523552
"author_url": "https://www.youtube.com/user/reolch",
35533553
"embed_url": "https://www.youtube.com/watch?v=n5CwXuyNfoc",
35543554
"height": 113,
3555-
"html": "<iframe width=\\"200\\" height=\\"113\\" src=\\"https://www.youtube.com/embed/n5CwXuyNfoc?feature=oembed\\" frameborder=\\"0\\" allow=\\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\\" allowfullscreen></iframe>",
3555+
"html": "<iframe width="200" height="113" src="https://www.youtube.com/embed/n5CwXuyNfoc?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>",
35563556
"provider_name": "YouTube",
35573557
"provider_url": "https://www.youtube.com/",
35583558
"thumbnail_height": 360,

‎test/richtext/__snapshots__/composeSerializers.test.ts.snap

+29-29
Large diffs are not rendered by default.

‎test/richtext/__snapshots__/serialize.test.ts.snap

+40-40
Large diffs are not rendered by default.

‎test/richtext/__snapshots__/wrapMapSerializer.test.ts.snap

+15-15
Large diffs are not rendered by default.

‎test/types/fields-link.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@
101101
tags: [],
102102
lang: "string",
103103
});
104+
// @ts-expect-error - Document type must match the given type.
104105
expectType<prismic.LinkField<"foo">>({
105106
link_type: prismic.LinkType.Document,
106107
id: "string",
107-
// @ts-expect-error - Document type must match the given type.
108108
type: "string",
109109
tags: [],
110110
lang: "string",
111111
});
@@ -120,13 +120,13 @@
120120
tags: [],
121121
lang: "fr-fr",
122122
});
123+
// @ts-expect-error - Document language must match the given type.
123124
expectType<prismic.LinkField<string, "fr-fr">>({
124125
link_type: prismic.LinkType.Document,
125126
id: "string",
126127
type: "string",
127128
tags: [],
128-
// @ts-expect-error - Document language must match the given type.
129129
lang: "string",
130130
});
131131

132132
/**

‎vite.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default defineConfig({
1515
coverage: {
1616
provider: "v8",
1717
reporter: ["lcovonly", "text"],
18+
include: ["src"],
1819
},
1920
setupFiles: ["./test/__setup__"],
2021
},

0 commit comments

Comments
 (0)
Please sign in to comment.