@prismicio/next 0.1.6-alpha.1 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PrismicNextImage.cjs +44 -2
- package/dist/PrismicNextImage.cjs.map +1 -1
- package/dist/PrismicNextImage.d.ts +51 -48
- package/dist/PrismicNextImage.js +44 -2
- package/dist/PrismicNextImage.js.map +1 -1
- package/dist/PrismicPreview.cjs +16 -10
- package/dist/PrismicPreview.cjs.map +1 -1
- package/dist/PrismicPreview.d.ts +42 -42
- package/dist/PrismicPreview.js +14 -10
- package/dist/PrismicPreview.js.map +1 -1
- package/dist/enableAutoPreviews.d.ts +38 -38
- package/dist/exitPreview.d.ts +34 -34
- package/dist/index.d.ts +13 -13
- package/dist/lib/__PRODUCTION__.d.ts +7 -7
- package/dist/lib/devMsg.d.ts +16 -16
- package/dist/lib/getPreviewCookieRepositoryName.d.ts +9 -9
- package/dist/lib/getPrismicPreviewCookie.d.ts +9 -9
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/redirectToPreviewURL.d.ts +59 -59
- package/dist/setPreviewData.d.ts +29 -29
- package/dist/types.d.ts +21 -21
- package/package.json +15 -15
- package/src/PrismicNextImage.tsx +48 -7
- package/src/PrismicPreview.tsx +5 -2
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { PreviewData } from "next";
|
|
2
|
-
import { Client, HttpRequestLike } from "@prismicio/client";
|
|
3
|
-
/**
|
|
4
|
-
* Configuration for `enableAutoPreviews`.
|
|
5
|
-
*
|
|
6
|
-
* @typeParam TPreviewData - Next.js preview data object.
|
|
7
|
-
*/
|
|
8
|
-
export declare type EnableAutoPreviewsConfig<TPreviewData extends PreviewData = PreviewData> = {
|
|
9
|
-
/**
|
|
10
|
-
* Prismic client with which automatic previews will be enabled.
|
|
11
|
-
*/
|
|
12
|
-
client: Client;
|
|
13
|
-
} & ({
|
|
14
|
-
/**
|
|
15
|
-
* A Next.js context object (such as the context object from
|
|
16
|
-
* `getStaticProps` or `getServerSideProps`).
|
|
17
|
-
*
|
|
18
|
-
* Pass a `context` object when using `enableAutoPreviews` outside a
|
|
19
|
-
* Next.js API endpoint.
|
|
20
|
-
*/
|
|
21
|
-
previewData?: TPreviewData;
|
|
22
|
-
} | {
|
|
23
|
-
/**
|
|
24
|
-
* A Next.js API endpoint request object.
|
|
25
|
-
*
|
|
26
|
-
* Pass a `req` object when using `enableAutoPreviews` in a Next.js API
|
|
27
|
-
* endpoint.
|
|
28
|
-
*/
|
|
29
|
-
req?: HttpRequestLike;
|
|
30
|
-
});
|
|
31
|
-
/**
|
|
32
|
-
* Configures a Prismic client to automatically query draft content during a
|
|
33
|
-
* preview session. It either takes in a Next.js `getStaticProps` context object
|
|
34
|
-
* or a Next.js API endpoint request object.
|
|
35
|
-
*
|
|
36
|
-
* @param config - Configuration for the function.
|
|
37
|
-
*/
|
|
38
|
-
export declare const enableAutoPreviews: <TPreviewData extends PreviewData>(config: EnableAutoPreviewsConfig<TPreviewData>) => void;
|
|
1
|
+
import { PreviewData } from "next";
|
|
2
|
+
import { Client, HttpRequestLike } from "@prismicio/client";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for `enableAutoPreviews`.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam TPreviewData - Next.js preview data object.
|
|
7
|
+
*/
|
|
8
|
+
export declare type EnableAutoPreviewsConfig<TPreviewData extends PreviewData = PreviewData> = {
|
|
9
|
+
/**
|
|
10
|
+
* Prismic client with which automatic previews will be enabled.
|
|
11
|
+
*/
|
|
12
|
+
client: Client;
|
|
13
|
+
} & ({
|
|
14
|
+
/**
|
|
15
|
+
* A Next.js context object (such as the context object from
|
|
16
|
+
* `getStaticProps` or `getServerSideProps`).
|
|
17
|
+
*
|
|
18
|
+
* Pass a `context` object when using `enableAutoPreviews` outside a
|
|
19
|
+
* Next.js API endpoint.
|
|
20
|
+
*/
|
|
21
|
+
previewData?: TPreviewData;
|
|
22
|
+
} | {
|
|
23
|
+
/**
|
|
24
|
+
* A Next.js API endpoint request object.
|
|
25
|
+
*
|
|
26
|
+
* Pass a `req` object when using `enableAutoPreviews` in a Next.js API
|
|
27
|
+
* endpoint.
|
|
28
|
+
*/
|
|
29
|
+
req?: HttpRequestLike;
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Configures a Prismic client to automatically query draft content during a
|
|
33
|
+
* preview session. It either takes in a Next.js `getStaticProps` context object
|
|
34
|
+
* or a Next.js API endpoint request object.
|
|
35
|
+
*
|
|
36
|
+
* @param config - Configuration for the function.
|
|
37
|
+
*/
|
|
38
|
+
export declare const enableAutoPreviews: <TPreviewData extends PreviewData>(config: EnableAutoPreviewsConfig<TPreviewData>) => void;
|
package/dist/exitPreview.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import type { NextApiResponse, NextApiRequest } from "next";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for `exitPreview`.
|
|
4
|
-
*/
|
|
5
|
-
export declare type ExitPreviewConfig = {
|
|
6
|
-
/**
|
|
7
|
-
* The `req` object from a Next.js API route. This is given as a parameter to
|
|
8
|
-
* the API route.
|
|
9
|
-
*
|
|
10
|
-
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
11
|
-
*/
|
|
12
|
-
req: {
|
|
13
|
-
headers: NextApiRequest["headers"];
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* The `res` object from a Next.js API route. This is given as a parameter to
|
|
17
|
-
* the API route.
|
|
18
|
-
*
|
|
19
|
-
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
20
|
-
*/
|
|
21
|
-
res: {
|
|
22
|
-
clearPreviewData: NextApiResponse["clearPreviewData"];
|
|
23
|
-
status: NextApiResponse["status"];
|
|
24
|
-
json: NextApiResponse["json"];
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated - This property is no longer used. It can be deleted safely.
|
|
28
|
-
*/
|
|
29
|
-
exitPreviewURL?: string;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Exits Next.js's Preview Mode from within a Next.js API route.
|
|
33
|
-
*/
|
|
34
|
-
export declare function exitPreview(config: ExitPreviewConfig): void;
|
|
1
|
+
import type { NextApiResponse, NextApiRequest } from "next";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for `exitPreview`.
|
|
4
|
+
*/
|
|
5
|
+
export declare type ExitPreviewConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* The `req` object from a Next.js API route. This is given as a parameter to
|
|
8
|
+
* the API route.
|
|
9
|
+
*
|
|
10
|
+
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
11
|
+
*/
|
|
12
|
+
req: {
|
|
13
|
+
headers: NextApiRequest["headers"];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The `res` object from a Next.js API route. This is given as a parameter to
|
|
17
|
+
* the API route.
|
|
18
|
+
*
|
|
19
|
+
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
20
|
+
*/
|
|
21
|
+
res: {
|
|
22
|
+
clearPreviewData: NextApiResponse["clearPreviewData"];
|
|
23
|
+
status: NextApiResponse["status"];
|
|
24
|
+
json: NextApiResponse["json"];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated - This property is no longer used. It can be deleted safely.
|
|
28
|
+
*/
|
|
29
|
+
exitPreviewURL?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Exits Next.js's Preview Mode from within a Next.js API route.
|
|
33
|
+
*/
|
|
34
|
+
export declare function exitPreview(config: ExitPreviewConfig): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { setPreviewData } from "./setPreviewData";
|
|
2
|
-
export type { SetPreviewDataConfig } from "./setPreviewData";
|
|
3
|
-
export { exitPreview } from "./exitPreview";
|
|
4
|
-
export type { ExitPreviewConfig } from "./exitPreview";
|
|
5
|
-
export { PrismicPreview } from "./PrismicPreview";
|
|
6
|
-
export type { PrismicPreviewProps } from "./PrismicPreview";
|
|
7
|
-
export { enableAutoPreviews } from "./enableAutoPreviews";
|
|
8
|
-
export type { EnableAutoPreviewsConfig } from "./enableAutoPreviews";
|
|
9
|
-
export { redirectToPreviewURL } from "./redirectToPreviewURL";
|
|
10
|
-
export type { RedirectToPreviewURLConfig } from "./redirectToPreviewURL";
|
|
11
|
-
export { PrismicNextImage } from "./PrismicNextImage";
|
|
12
|
-
export type { PrismicNextImageProps } from "./PrismicNextImage";
|
|
13
|
-
export type { CreateClientConfig } from "./types";
|
|
1
|
+
export { setPreviewData } from "./setPreviewData";
|
|
2
|
+
export type { SetPreviewDataConfig } from "./setPreviewData";
|
|
3
|
+
export { exitPreview } from "./exitPreview";
|
|
4
|
+
export type { ExitPreviewConfig } from "./exitPreview";
|
|
5
|
+
export { PrismicPreview } from "./PrismicPreview";
|
|
6
|
+
export type { PrismicPreviewProps } from "./PrismicPreview";
|
|
7
|
+
export { enableAutoPreviews } from "./enableAutoPreviews";
|
|
8
|
+
export type { EnableAutoPreviewsConfig } from "./enableAutoPreviews";
|
|
9
|
+
export { redirectToPreviewURL } from "./redirectToPreviewURL";
|
|
10
|
+
export type { RedirectToPreviewURLConfig } from "./redirectToPreviewURL";
|
|
11
|
+
export { PrismicNextImage } from "./PrismicNextImage";
|
|
12
|
+
export type { PrismicNextImageProps } from "./PrismicNextImage";
|
|
13
|
+
export type { CreateClientConfig } from "./types";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `true` if in the production environment, `false` otherwise.
|
|
3
|
-
*
|
|
4
|
-
* This boolean can be used to perform actions only in development environments,
|
|
5
|
-
* such as logging.
|
|
6
|
-
*/
|
|
7
|
-
export declare const __PRODUCTION__: boolean;
|
|
1
|
+
/**
|
|
2
|
+
* `true` if in the production environment, `false` otherwise.
|
|
3
|
+
*
|
|
4
|
+
* This boolean can be used to perform actions only in development environments,
|
|
5
|
+
* such as logging.
|
|
6
|
+
*/
|
|
7
|
+
export declare const __PRODUCTION__: boolean;
|
package/dist/lib/devMsg.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a `prismic.dev/msg` URL for a given message slug.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* devMsg("missing-param");
|
|
8
|
-
* // => "https://prismic.dev/msg/next/v1.2.3/missing-param.md"
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* @param slug - Slug for the message. This corresponds to a Markdown file in
|
|
12
|
-
* the Git repository's `/messages` directory.
|
|
13
|
-
*
|
|
14
|
-
* @returns The `prismic.dev/msg` URL for the given slug.
|
|
15
|
-
*/
|
|
16
|
-
export declare const devMsg: (slug: string) => string;
|
|
1
|
+
/**
|
|
2
|
+
* Returns a `prismic.dev/msg` URL for a given message slug.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* devMsg("missing-param");
|
|
8
|
+
* // => "https://prismic.dev/msg/next/v1.2.3/missing-param.md"
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @param slug - Slug for the message. This corresponds to a Markdown file in
|
|
12
|
+
* the Git repository's `/messages` directory.
|
|
13
|
+
*
|
|
14
|
+
* @returns The `prismic.dev/msg` URL for the given slug.
|
|
15
|
+
*/
|
|
16
|
+
export declare const devMsg: (slug: string) => string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts preview reference repo name from stringified Prismic preview cookie
|
|
3
|
-
*
|
|
4
|
-
* @param previewCookie - The Prismic preview cookie.
|
|
5
|
-
*
|
|
6
|
-
* @returns The repository name for the Prismic preview cookie. If the cookie
|
|
7
|
-
* represents an inactive preview session, `undefined` will be returned.
|
|
8
|
-
*/
|
|
9
|
-
export declare const getPreviewCookieRepositoryName: (previewCookie: string) => string | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* Extracts preview reference repo name from stringified Prismic preview cookie
|
|
3
|
+
*
|
|
4
|
+
* @param previewCookie - The Prismic preview cookie.
|
|
5
|
+
*
|
|
6
|
+
* @returns The repository name for the Prismic preview cookie. If the cookie
|
|
7
|
+
* represents an inactive preview session, `undefined` will be returned.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getPreviewCookieRepositoryName: (previewCookie: string) => string | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the value of a cookie from a given cookie store.
|
|
3
|
-
*
|
|
4
|
-
* @param cookieJar - The stringified cookie store from which to read the
|
|
5
|
-
* cookie.
|
|
6
|
-
*
|
|
7
|
-
* @returns The value of the cookie, if it exists.
|
|
8
|
-
*/
|
|
9
|
-
export declare const getPrismicPreviewCookie: (cookieJar: string) => string | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value of a cookie from a given cookie store.
|
|
3
|
+
*
|
|
4
|
+
* @param cookieJar - The stringified cookie store from which to read the
|
|
5
|
+
* cookie.
|
|
6
|
+
*
|
|
7
|
+
* @returns The value of the cookie, if it exists.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getPrismicPreviewCookie: (cookieJar: string) => string | undefined;
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import type { Client } from "@prismicio/client";
|
|
2
|
-
import type { NextApiRequest, NextApiResponse } from "next";
|
|
3
|
-
import type { LinkResolverFunction } from "@prismicio/helpers";
|
|
4
|
-
/**
|
|
5
|
-
* Preview config for enabling previews with redirectToPreviewURL
|
|
6
|
-
*/
|
|
7
|
-
export declare type RedirectToPreviewURLConfig<TLinkResolverFunction extends LinkResolverFunction<any> = LinkResolverFunction> = {
|
|
8
|
-
/**
|
|
9
|
-
* The `req` object from a Next.js API route. This is given as a parameter to
|
|
10
|
-
* the API route.
|
|
11
|
-
*
|
|
12
|
-
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
13
|
-
*/
|
|
14
|
-
req: {
|
|
15
|
-
query: NextApiRequest["query"];
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* The `res` object from a Next.js API route. This is given as a parameter to
|
|
19
|
-
* the API route.
|
|
20
|
-
*
|
|
21
|
-
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
22
|
-
*/
|
|
23
|
-
res: {
|
|
24
|
-
redirect: NextApiResponse["redirect"];
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* The Prismic client configured for the preview session's repository.
|
|
28
|
-
*/
|
|
29
|
-
client: Client;
|
|
30
|
-
/**
|
|
31
|
-
* A Link Resolver used to resolve the previewed document's URL.
|
|
32
|
-
*
|
|
33
|
-
* @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}
|
|
34
|
-
*/
|
|
35
|
-
linkResolver?: TLinkResolverFunction;
|
|
36
|
-
/**
|
|
37
|
-
* The default redirect URL if a URL cannot be determined for the previewed
|
|
38
|
-
* document.
|
|
39
|
-
*
|
|
40
|
-
* **Note**: If you `next.config.js` file contains a `basePath`, the
|
|
41
|
-
* `defaultURL` option must _not_ include it. Instead, provide the `basePath`
|
|
42
|
-
* property using the `basePath` option.
|
|
43
|
-
*/
|
|
44
|
-
defaultURL?: string;
|
|
45
|
-
/**
|
|
46
|
-
* The `basePath` for the Next.js app as it is defined in `next.config.js`.
|
|
47
|
-
* This option can be omitted if the app does not have a `basePath`.
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* The API route is unable to detect the app's `basePath` automatically. It
|
|
51
|
-
* must be provided to `redirectToPreviewURL()` manually.
|
|
52
|
-
*/
|
|
53
|
-
basePath?: string;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Redirects a user to the URL of a previewed Prismic document from within a
|
|
57
|
-
* Next.js API route.
|
|
58
|
-
*/
|
|
59
|
-
export declare function redirectToPreviewURL<TLinkResolverFunction extends LinkResolverFunction<any>>(config: RedirectToPreviewURLConfig<TLinkResolverFunction>): Promise<void>;
|
|
1
|
+
import type { Client } from "@prismicio/client";
|
|
2
|
+
import type { NextApiRequest, NextApiResponse } from "next";
|
|
3
|
+
import type { LinkResolverFunction } from "@prismicio/helpers";
|
|
4
|
+
/**
|
|
5
|
+
* Preview config for enabling previews with redirectToPreviewURL
|
|
6
|
+
*/
|
|
7
|
+
export declare type RedirectToPreviewURLConfig<TLinkResolverFunction extends LinkResolverFunction<any> = LinkResolverFunction> = {
|
|
8
|
+
/**
|
|
9
|
+
* The `req` object from a Next.js API route. This is given as a parameter to
|
|
10
|
+
* the API route.
|
|
11
|
+
*
|
|
12
|
+
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
13
|
+
*/
|
|
14
|
+
req: {
|
|
15
|
+
query: NextApiRequest["query"];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The `res` object from a Next.js API route. This is given as a parameter to
|
|
19
|
+
* the API route.
|
|
20
|
+
*
|
|
21
|
+
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
22
|
+
*/
|
|
23
|
+
res: {
|
|
24
|
+
redirect: NextApiResponse["redirect"];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The Prismic client configured for the preview session's repository.
|
|
28
|
+
*/
|
|
29
|
+
client: Client;
|
|
30
|
+
/**
|
|
31
|
+
* A Link Resolver used to resolve the previewed document's URL.
|
|
32
|
+
*
|
|
33
|
+
* @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}
|
|
34
|
+
*/
|
|
35
|
+
linkResolver?: TLinkResolverFunction;
|
|
36
|
+
/**
|
|
37
|
+
* The default redirect URL if a URL cannot be determined for the previewed
|
|
38
|
+
* document.
|
|
39
|
+
*
|
|
40
|
+
* **Note**: If you `next.config.js` file contains a `basePath`, the
|
|
41
|
+
* `defaultURL` option must _not_ include it. Instead, provide the `basePath`
|
|
42
|
+
* property using the `basePath` option.
|
|
43
|
+
*/
|
|
44
|
+
defaultURL?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The `basePath` for the Next.js app as it is defined in `next.config.js`.
|
|
47
|
+
* This option can be omitted if the app does not have a `basePath`.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* The API route is unable to detect the app's `basePath` automatically. It
|
|
51
|
+
* must be provided to `redirectToPreviewURL()` manually.
|
|
52
|
+
*/
|
|
53
|
+
basePath?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Redirects a user to the URL of a previewed Prismic document from within a
|
|
57
|
+
* Next.js API route.
|
|
58
|
+
*/
|
|
59
|
+
export declare function redirectToPreviewURL<TLinkResolverFunction extends LinkResolverFunction<any>>(config: RedirectToPreviewURLConfig<TLinkResolverFunction>): Promise<void>;
|
package/dist/setPreviewData.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { NextApiResponse, NextApiRequest } from "next";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for `setPreviewData`.
|
|
4
|
-
*/
|
|
5
|
-
export declare type SetPreviewDataConfig = {
|
|
6
|
-
/**
|
|
7
|
-
* The `req` object from a Next.js API route. This is given as a parameter to
|
|
8
|
-
* the API route.
|
|
9
|
-
*
|
|
10
|
-
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
11
|
-
*/
|
|
12
|
-
req: {
|
|
13
|
-
query: NextApiRequest["query"];
|
|
14
|
-
cookies: NextApiRequest["cookies"];
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* The `res` object from a Next.js API route. This is given as a parameter to
|
|
18
|
-
* the API route.
|
|
19
|
-
*
|
|
20
|
-
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
21
|
-
*/
|
|
22
|
-
res: {
|
|
23
|
-
setPreviewData: NextApiResponse["setPreviewData"];
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Set Prismic preview data for Next.js's Preview Mode.
|
|
28
|
-
*/
|
|
29
|
-
export declare function setPreviewData({ req, res }: SetPreviewDataConfig): void;
|
|
1
|
+
import { NextApiResponse, NextApiRequest } from "next";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for `setPreviewData`.
|
|
4
|
+
*/
|
|
5
|
+
export declare type SetPreviewDataConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* The `req` object from a Next.js API route. This is given as a parameter to
|
|
8
|
+
* the API route.
|
|
9
|
+
*
|
|
10
|
+
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
11
|
+
*/
|
|
12
|
+
req: {
|
|
13
|
+
query: NextApiRequest["query"];
|
|
14
|
+
cookies: NextApiRequest["cookies"];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The `res` object from a Next.js API route. This is given as a parameter to
|
|
18
|
+
* the API route.
|
|
19
|
+
*
|
|
20
|
+
* @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
|
|
21
|
+
*/
|
|
22
|
+
res: {
|
|
23
|
+
setPreviewData: NextApiResponse["setPreviewData"];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Set Prismic preview data for Next.js's Preview Mode.
|
|
28
|
+
*/
|
|
29
|
+
export declare function setPreviewData({ req, res }: SetPreviewDataConfig): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { PreviewData, NextApiRequest } from "next";
|
|
2
|
-
import type { ClientConfig } from "@prismicio/client";
|
|
3
|
-
/**
|
|
4
|
-
* Configuration for creating a Prismic client with automatic preview support in
|
|
5
|
-
* Next.js apps.
|
|
6
|
-
*/
|
|
7
|
-
export declare type CreateClientConfig = {
|
|
8
|
-
/**
|
|
9
|
-
* Preview data coming from Next.js context object. This context object comes
|
|
10
|
-
* from `getStaticProps` or `getServerSideProps`.
|
|
11
|
-
*
|
|
12
|
-
* Pass `previewData` when using outside a Next.js API endpoint.
|
|
13
|
-
*/
|
|
14
|
-
previewData?: PreviewData;
|
|
15
|
-
/**
|
|
16
|
-
* A Next.js API endpoint request object.
|
|
17
|
-
*
|
|
18
|
-
* Pass a `req` object when using in a Next.js API endpoint.
|
|
19
|
-
*/
|
|
20
|
-
req?: NextApiRequest;
|
|
21
|
-
} & ClientConfig;
|
|
1
|
+
import type { PreviewData, NextApiRequest } from "next";
|
|
2
|
+
import type { ClientConfig } from "@prismicio/client";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for creating a Prismic client with automatic preview support in
|
|
5
|
+
* Next.js apps.
|
|
6
|
+
*/
|
|
7
|
+
export declare type CreateClientConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* Preview data coming from Next.js context object. This context object comes
|
|
10
|
+
* from `getStaticProps` or `getServerSideProps`.
|
|
11
|
+
*
|
|
12
|
+
* Pass `previewData` when using outside a Next.js API endpoint.
|
|
13
|
+
*/
|
|
14
|
+
previewData?: PreviewData;
|
|
15
|
+
/**
|
|
16
|
+
* A Next.js API endpoint request object.
|
|
17
|
+
*
|
|
18
|
+
* Pass a `req` object when using in a Next.js API endpoint.
|
|
19
|
+
*/
|
|
20
|
+
req?: NextApiRequest;
|
|
21
|
+
} & ClientConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Helpers to integrate Prismic into Next.js apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -46,9 +46,8 @@
|
|
|
46
46
|
"unit:watch": "vitest watch"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@prismicio/client": "^6.
|
|
50
|
-
"@prismicio/helpers": "^2.3.
|
|
51
|
-
"@prismicio/react": "^2.5.0",
|
|
49
|
+
"@prismicio/client": "^6.7.1",
|
|
50
|
+
"@prismicio/helpers": "^2.3.5",
|
|
52
51
|
"@prismicio/types": "^0.2.3",
|
|
53
52
|
"imgix-url-builder": "^0.0.3"
|
|
54
53
|
},
|
|
@@ -56,16 +55,17 @@
|
|
|
56
55
|
"@prismicio/mock": "^0.1.1",
|
|
57
56
|
"@size-limit/preset-small-lib": "^8.1.0",
|
|
58
57
|
"@types/react-test-renderer": "^18.0.0",
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
60
|
-
"@typescript-eslint/parser": "^5.
|
|
61
|
-
"@
|
|
62
|
-
"
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
|
59
|
+
"@typescript-eslint/parser": "^5.40.1",
|
|
60
|
+
"@vitejs/plugin-react": "^2.1.0",
|
|
61
|
+
"@vitest/coverage-c8": "^0.24.3",
|
|
62
|
+
"eslint": "^8.25.0",
|
|
63
63
|
"eslint-config-prettier": "^8.5.0",
|
|
64
64
|
"eslint-plugin-prettier": "^4.2.1",
|
|
65
|
-
"eslint-plugin-react": "^7.31.
|
|
65
|
+
"eslint-plugin-react": "^7.31.10",
|
|
66
66
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
67
|
-
"eslint-plugin-tsdoc": "^0.2.
|
|
68
|
-
"happy-dom": "^
|
|
67
|
+
"eslint-plugin-tsdoc": "^0.2.17",
|
|
68
|
+
"happy-dom": "^7.5.13",
|
|
69
69
|
"next": "^12.1.4",
|
|
70
70
|
"nyc": "^15.1.0",
|
|
71
71
|
"prettier": "^2.7.1",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"react-test-renderer": "^18.2.0",
|
|
75
75
|
"size-limit": "^8.1.0",
|
|
76
76
|
"standard-version": "^9.5.0",
|
|
77
|
-
"typescript": "^4.8.
|
|
78
|
-
"vite": "^3.1.
|
|
79
|
-
"vite-plugin-sdk": "^0.0.
|
|
80
|
-
"vitest": "^0.
|
|
77
|
+
"typescript": "^4.8.4",
|
|
78
|
+
"vite": "^3.1.8",
|
|
79
|
+
"vite-plugin-sdk": "^0.0.3",
|
|
80
|
+
"vitest": "^0.24.3"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@prismicio/client": "^6.0.0",
|