@prismicio/next 2.0.1-alpha.1 → 2.0.2-canary.6f580fa
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 +66 -56
- package/dist/PrismicNextImage.cjs.map +1 -1
- package/dist/PrismicNextImage.d.cts +57 -0
- package/dist/PrismicNextLink.cjs +29 -21
- package/dist/PrismicNextLink.cjs.map +1 -1
- package/dist/PrismicNextLink.d.cts +54 -0
- package/dist/PrismicNextRichText.cjs +34 -0
- package/dist/PrismicNextRichText.cjs.map +1 -0
- package/dist/PrismicNextRichText.d.cts +11 -0
- package/dist/PrismicPreview.cjs +38 -36
- package/dist/PrismicPreview.cjs.map +1 -1
- package/dist/PrismicPreview.d.cts +36 -0
- package/dist/PrismicPreviewClient.cjs +71 -65
- package/dist/PrismicPreviewClient.cjs.map +1 -1
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/createLocaleRedirect.cjs +11 -5
- package/dist/createLocaleRedirect.cjs.map +1 -1
- package/dist/createLocaleRedirect.d.cts +14 -0
- package/dist/enableAutoPreviews.cjs +27 -48
- package/dist/enableAutoPreviews.cjs.map +1 -1
- package/dist/enableAutoPreviews.d.cts +18 -0
- package/dist/exitPreview.cjs +24 -32
- package/dist/exitPreview.cjs.map +1 -1
- package/dist/{exitPreview.d.ts → exitPreview.d.cts} +5 -1
- package/dist/imgixLoader.cjs +21 -14
- package/dist/imgixLoader.cjs.map +1 -1
- package/dist/{imgixLoader.d.ts → imgixLoader.d.cts} +7 -1
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts +11 -0
- package/dist/lib/devMsg.cjs +22 -5
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/resolveDefaultExport.cjs +26 -0
- package/dist/lib/resolveDefaultExport.cjs.map +1 -0
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/pages/PrismicPreview.cjs +71 -59
- package/dist/pages/PrismicPreview.cjs.map +1 -1
- package/dist/pages/PrismicPreview.d.cts +36 -0
- package/dist/pages/enableAutoPreviews.cjs +21 -14
- package/dist/pages/enableAutoPreviews.cjs.map +1 -1
- package/dist/pages/enableAutoPreviews.d.cts +37 -0
- package/dist/pages/exitPreview.cjs +24 -7
- package/dist/pages/exitPreview.cjs.map +1 -1
- package/dist/pages/exitPreview.d.cts +38 -0
- package/dist/pages/redirectToPreviewURL.cjs +13 -13
- package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
- package/dist/pages/redirectToPreviewURL.d.cts +48 -0
- package/dist/pages/setPreviewData.cjs +10 -8
- package/dist/pages/setPreviewData.cjs.map +1 -1
- package/dist/pages/setPreviewData.d.cts +26 -0
- package/dist/pages/types.d.cts +36 -0
- package/dist/pages.cjs +21 -21
- package/dist/pages.d.cts +12 -0
- package/dist/redirectToPreviewURL.cjs +21 -43
- package/dist/redirectToPreviewURL.cjs.map +1 -1
- package/dist/redirectToPreviewURL.d.cts +33 -0
- package/dist/types.d.cts +31 -0
- package/package.json +34 -49
- package/src/PrismicNextImage.tsx +12 -8
- package/src/PrismicNextLink.tsx +7 -5
- package/src/PrismicNextRichText.tsx +41 -0
- package/src/PrismicPreview.tsx +2 -2
- package/src/PrismicPreviewClient.tsx +2 -3
- package/src/createLocaleRedirect.ts +1 -1
- package/src/imgixLoader.ts +3 -2
- package/src/index.ts +3 -0
- package/src/lib/devMsg.ts +1 -1
- package/src/lib/resolveDefaultExport.ts +21 -0
- package/src/pages/PrismicPreview.tsx +2 -1
- package/src/pages/index.ts +3 -0
- package/src/pages/types.ts +2 -3
- package/src/redirectToPreviewURL.ts +1 -1
- package/dist/PrismicNextImage.d.ts +0 -54
- package/dist/PrismicNextLink.d.ts +0 -125
- package/dist/PrismicPreview.d.ts +0 -31
- package/dist/PrismicPreviewClient.d.ts +0 -9
- package/dist/createLocaleRedirect.d.ts +0 -10
- package/dist/enableAutoPreviews.d.ts +0 -13
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -15
- package/dist/lib/devMsg.d.ts +0 -16
- package/dist/lib/resolveCJS.cjs +0 -7
- package/dist/lib/resolveCJS.cjs.map +0 -1
- package/dist/lib/resolveCJS.d.ts +0 -9
- package/dist/package.json.cjs +0 -5
- package/dist/package.json.cjs.map +0 -1
- package/dist/pages/PrismicPreview.d.ts +0 -31
- package/dist/pages/enableAutoPreviews.d.ts +0 -31
- package/dist/pages/exitPreview.d.ts +0 -33
- package/dist/pages/index.d.ts +0 -18
- package/dist/pages/redirectToPreviewURL.d.ts +0 -43
- package/dist/pages/setPreviewData.d.ts +0 -18
- package/dist/pages/types.d.ts +0 -30
- package/dist/pages.cjs.map +0 -1
- package/dist/redirectToPreviewURL.d.ts +0 -28
- package/dist/types.d.ts +0 -26
- package/src/lib/resolveCJS.ts +0 -12
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
2
|
-
import { ImageProps } from "next/image";
|
|
3
|
-
import { ImgixURLParams } from "imgix-url-builder";
|
|
4
|
-
import { ImageFieldImage } from "@prismicio/client";
|
|
5
|
-
export type PrismicNextImageProps = Omit<ImageProps, "src" | "alt" | "loader"> & {
|
|
6
|
-
/** The Prismic Image field or thumbnail to render. */
|
|
7
|
-
field: ImageFieldImage | null | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* An object of Imgix URL API parameters to transform the image.
|
|
10
|
-
*
|
|
11
|
-
* @see https://docs.imgix.com/apis/rendering
|
|
12
|
-
*/
|
|
13
|
-
imgixParams?: {
|
|
14
|
-
[P in keyof ImgixURLParams]: ImgixURLParams[P] | null;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Declare an image as decorative by providing `alt=""`.
|
|
18
|
-
*
|
|
19
|
-
* See:
|
|
20
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images
|
|
21
|
-
*/
|
|
22
|
-
alt?: "";
|
|
23
|
-
/**
|
|
24
|
-
* Declare an image as decorative only if the Image field does not have
|
|
25
|
-
* alternative text by providing `fallbackAlt=""`.
|
|
26
|
-
*
|
|
27
|
-
* See:
|
|
28
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images
|
|
29
|
-
*/
|
|
30
|
-
fallbackAlt?: "";
|
|
31
|
-
/**
|
|
32
|
-
* Rendered when the field is empty. If a fallback is not given, `null` will
|
|
33
|
-
* be rendered.
|
|
34
|
-
*/
|
|
35
|
-
fallback?: React.ReactNode;
|
|
36
|
-
loader?: ImageProps["loader"] | null;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* React component that renders an image from a Prismic Image field or one of
|
|
40
|
-
* its thumbnails using `next/image`. It will automatically set the `alt`
|
|
41
|
-
* attribute using the Image field's `alt` property.
|
|
42
|
-
*
|
|
43
|
-
* It uses an Imgix URL-based loader by default. A custom loader can be provided
|
|
44
|
-
* with the `loader` prop. If you would like to use the Next.js Image
|
|
45
|
-
* Optimization API instead, set `loader={undefined}`.
|
|
46
|
-
*
|
|
47
|
-
* @param props - Props for the component.
|
|
48
|
-
*
|
|
49
|
-
* @returns A responsive image component using `next/image` for the given Image
|
|
50
|
-
* field.
|
|
51
|
-
*
|
|
52
|
-
* @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image
|
|
53
|
-
*/
|
|
54
|
-
export declare const PrismicNextImage: ForwardRefExoticComponent<PropsWithoutRef<PrismicNextImageProps> & RefAttributes<HTMLImageElement>>;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
|
|
4
|
-
export type PrismicNextLinkProps = Omit<ComponentProps<typeof Link>, "field" | "document" | "href" | "rel"> & {
|
|
5
|
-
linkResolver?: LinkResolverFunction;
|
|
6
|
-
rel?: string | AsLinkAttrsConfig["rel"];
|
|
7
|
-
} & ({
|
|
8
|
-
field: LinkField | null | undefined;
|
|
9
|
-
document?: never;
|
|
10
|
-
href?: never;
|
|
11
|
-
} | {
|
|
12
|
-
field?: never;
|
|
13
|
-
document: PrismicDocument | null | undefined;
|
|
14
|
-
href?: never;
|
|
15
|
-
} | {
|
|
16
|
-
field?: never;
|
|
17
|
-
document?: never;
|
|
18
|
-
href: ComponentProps<typeof Link>["href"];
|
|
19
|
-
});
|
|
20
|
-
export declare const PrismicNextLink: import("react").ForwardRefExoticComponent<(Omit<Omit<Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
21
|
-
href: string | import("url").UrlObject;
|
|
22
|
-
as?: string | import("url").UrlObject;
|
|
23
|
-
replace?: boolean;
|
|
24
|
-
scroll?: boolean;
|
|
25
|
-
shallow?: boolean;
|
|
26
|
-
passHref?: boolean;
|
|
27
|
-
prefetch?: boolean | null;
|
|
28
|
-
locale?: string | false;
|
|
29
|
-
legacyBehavior?: boolean;
|
|
30
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
31
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
32
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
33
|
-
}> & {
|
|
34
|
-
href: string | import("url").UrlObject;
|
|
35
|
-
as?: string | import("url").UrlObject;
|
|
36
|
-
replace?: boolean;
|
|
37
|
-
scroll?: boolean;
|
|
38
|
-
shallow?: boolean;
|
|
39
|
-
passHref?: boolean;
|
|
40
|
-
prefetch?: boolean | null;
|
|
41
|
-
locale?: string | false;
|
|
42
|
-
legacyBehavior?: boolean;
|
|
43
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
44
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
45
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
46
|
-
} & {
|
|
47
|
-
children?: React.ReactNode | undefined;
|
|
48
|
-
} & import("react").RefAttributes<HTMLAnchorElement>, "rel" | "field" | "document" | "href"> & {
|
|
49
|
-
linkResolver?: LinkResolverFunction;
|
|
50
|
-
rel?: string | AsLinkAttrsConfig["rel"];
|
|
51
|
-
} & {
|
|
52
|
-
field: LinkField | null | undefined;
|
|
53
|
-
document?: never;
|
|
54
|
-
href?: never;
|
|
55
|
-
}, "ref"> | Omit<Omit<Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
56
|
-
href: string | import("url").UrlObject;
|
|
57
|
-
as?: string | import("url").UrlObject;
|
|
58
|
-
replace?: boolean;
|
|
59
|
-
scroll?: boolean;
|
|
60
|
-
shallow?: boolean;
|
|
61
|
-
passHref?: boolean;
|
|
62
|
-
prefetch?: boolean | null;
|
|
63
|
-
locale?: string | false;
|
|
64
|
-
legacyBehavior?: boolean;
|
|
65
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
66
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
67
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
68
|
-
}> & {
|
|
69
|
-
href: string | import("url").UrlObject;
|
|
70
|
-
as?: string | import("url").UrlObject;
|
|
71
|
-
replace?: boolean;
|
|
72
|
-
scroll?: boolean;
|
|
73
|
-
shallow?: boolean;
|
|
74
|
-
passHref?: boolean;
|
|
75
|
-
prefetch?: boolean | null;
|
|
76
|
-
locale?: string | false;
|
|
77
|
-
legacyBehavior?: boolean;
|
|
78
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
79
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
80
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
81
|
-
} & {
|
|
82
|
-
children?: React.ReactNode | undefined;
|
|
83
|
-
} & import("react").RefAttributes<HTMLAnchorElement>, "rel" | "field" | "document" | "href"> & {
|
|
84
|
-
linkResolver?: LinkResolverFunction;
|
|
85
|
-
rel?: string | AsLinkAttrsConfig["rel"];
|
|
86
|
-
} & {
|
|
87
|
-
field?: never;
|
|
88
|
-
document: PrismicDocument | null | undefined;
|
|
89
|
-
href?: never;
|
|
90
|
-
}, "ref"> | Omit<Omit<Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
91
|
-
href: string | import("url").UrlObject;
|
|
92
|
-
as?: string | import("url").UrlObject;
|
|
93
|
-
replace?: boolean;
|
|
94
|
-
scroll?: boolean;
|
|
95
|
-
shallow?: boolean;
|
|
96
|
-
passHref?: boolean;
|
|
97
|
-
prefetch?: boolean | null;
|
|
98
|
-
locale?: string | false;
|
|
99
|
-
legacyBehavior?: boolean;
|
|
100
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
101
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
102
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
103
|
-
}> & {
|
|
104
|
-
href: string | import("url").UrlObject;
|
|
105
|
-
as?: string | import("url").UrlObject;
|
|
106
|
-
replace?: boolean;
|
|
107
|
-
scroll?: boolean;
|
|
108
|
-
shallow?: boolean;
|
|
109
|
-
passHref?: boolean;
|
|
110
|
-
prefetch?: boolean | null;
|
|
111
|
-
locale?: string | false;
|
|
112
|
-
legacyBehavior?: boolean;
|
|
113
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
114
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
115
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
116
|
-
} & {
|
|
117
|
-
children?: React.ReactNode | undefined;
|
|
118
|
-
} & import("react").RefAttributes<HTMLAnchorElement>, "rel" | "field" | "document" | "href"> & {
|
|
119
|
-
linkResolver?: LinkResolverFunction;
|
|
120
|
-
rel?: string | AsLinkAttrsConfig["rel"];
|
|
121
|
-
} & {
|
|
122
|
-
field?: never;
|
|
123
|
-
document?: never;
|
|
124
|
-
href: ComponentProps<typeof Link>["href"];
|
|
125
|
-
}, "ref">) & import("react").RefAttributes<HTMLAnchorElement>>;
|
package/dist/PrismicPreview.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { FC, ReactNode } from "react";
|
|
2
|
-
/** Props for `<PrismicPreview>`. */
|
|
3
|
-
export type PrismicPreviewProps = {
|
|
4
|
-
/**
|
|
5
|
-
* The name of your Prismic repository. A Prismic Toolbar will be registered
|
|
6
|
-
* using this repository.
|
|
7
|
-
*/
|
|
8
|
-
repositoryName: string;
|
|
9
|
-
/**
|
|
10
|
-
* The URL of your app's Prismic preview endpoint (default: `/api/preview`).
|
|
11
|
-
* This URL will be fetched on preview update events.
|
|
12
|
-
*/
|
|
13
|
-
updatePreviewURL?: string;
|
|
14
|
-
/**
|
|
15
|
-
* The URL of your app's exit preview endpoint (default: `/api/exit-preview`).
|
|
16
|
-
* This URL will be fetched on preview exit events.
|
|
17
|
-
*/
|
|
18
|
-
exitPreviewURL?: string;
|
|
19
|
-
/** Children to render adjacent to the Prismic Toolbar. */
|
|
20
|
-
children?: ReactNode;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* React component that sets up Prismic Previews using the Prismic Toolbar. When
|
|
24
|
-
* the Prismic Toolbar send events to the browser, such as on preview updates
|
|
25
|
-
* and exiting, this component will automatically refresh the page with the
|
|
26
|
-
* changes.
|
|
27
|
-
*
|
|
28
|
-
* This component can be wrapped around your app or added anywhere in your app's
|
|
29
|
-
* tree. It must be rendered on every page.
|
|
30
|
-
*/
|
|
31
|
-
export declare const PrismicPreview: FC<PrismicPreviewProps>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
type PrismicPreviewClientProps = {
|
|
3
|
-
repositoryName: string;
|
|
4
|
-
isDraftMode: boolean;
|
|
5
|
-
updatePreviewURL?: string;
|
|
6
|
-
exitPreviewURL?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const PrismicPreviewClient: FC<PrismicPreviewClientProps>;
|
|
9
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated `createLocaleRedirect()` has been removed due to performance
|
|
3
|
-
* issues.
|
|
4
|
-
*/
|
|
5
|
-
export declare function createLocaleRedirect(): void;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated `createLocaleRedirect()` has been removed due to performance
|
|
8
|
-
* issues.
|
|
9
|
-
*/
|
|
10
|
-
export type CreateLocaleRedirectConfig = never;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type Client } from "@prismicio/client";
|
|
2
|
-
/** Configuration for `enableAutoPreviews`. */
|
|
3
|
-
export type EnableAutoPreviewsConfig = {
|
|
4
|
-
/** Prismic client with which automatic previews will be enabled. */
|
|
5
|
-
client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Configures a Prismic client to automatically query draft content during a
|
|
9
|
-
* preview session.
|
|
10
|
-
*
|
|
11
|
-
* @param config - Configuration for the function.
|
|
12
|
-
*/
|
|
13
|
-
export declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { exitPreview } from "./exitPreview";
|
|
2
|
-
export { PrismicPreview } from "./PrismicPreview";
|
|
3
|
-
export type { PrismicPreviewProps } from "./PrismicPreview";
|
|
4
|
-
export { PrismicNextLink } from "./PrismicNextLink";
|
|
5
|
-
export type { PrismicNextLinkProps } from "./PrismicNextLink";
|
|
6
|
-
export { enableAutoPreviews } from "./enableAutoPreviews";
|
|
7
|
-
export type { EnableAutoPreviewsConfig } from "./enableAutoPreviews";
|
|
8
|
-
export { redirectToPreviewURL } from "./redirectToPreviewURL";
|
|
9
|
-
export type { RedirectToPreviewURLConfig } from "./redirectToPreviewURL";
|
|
10
|
-
export { PrismicNextImage } from "./PrismicNextImage";
|
|
11
|
-
export type { PrismicNextImageProps } from "./PrismicNextImage";
|
|
12
|
-
export { imgixLoader } from "./imgixLoader";
|
|
13
|
-
export type { CreateClientConfig } from "./types";
|
|
14
|
-
export { createLocaleRedirect } from "./createLocaleRedirect";
|
|
15
|
-
export type { CreateLocaleRedirectConfig } from "./createLocaleRedirect";
|
package/dist/lib/devMsg.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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"
|
|
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;
|
package/dist/lib/resolveCJS.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCJS.cjs","sources":["../../src/lib/resolveCJS.ts"],"sourcesContent":["/**\n * Resolves a CommonJS import that might have a `default` property. This happens\n * when named and default exports are mixed in modules. Next.js seems to do this\n * in the exact set up `@prismicio/next` uses.\n *\n * This is _should_ be a temporary hack until Next.js and Node.js resolve their\n * ESM difficulties. This will likely not be removed any time soon.\n */\nexport function resolveCJS<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod;\n}\n"],"names":[],"mappings":";;AAQM,SAAU,WAAc,KAAM;AAE5B,SAAA,aAAc,MAAe,IAAY,UAAU;AAC3D;;"}
|
package/dist/lib/resolveCJS.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves a CommonJS import that might have a `default` property. This happens
|
|
3
|
-
* when named and default exports are mixed in modules. Next.js seems to do this
|
|
4
|
-
* in the exact set up `@prismicio/next` uses.
|
|
5
|
-
*
|
|
6
|
-
* This is _should_ be a temporary hack until Next.js and Node.js resolve their
|
|
7
|
-
* ESM difficulties. This will likely not be removed any time soon.
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolveCJS<T>(mod: T): T;
|
package/dist/package.json.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type ReactNode, FC } from "react";
|
|
2
|
-
/** Props for `<PrismicPreview>`. */
|
|
3
|
-
export type PrismicPreviewProps = {
|
|
4
|
-
/**
|
|
5
|
-
* The name of your Prismic repository. A Prismic Toolbar will be registered
|
|
6
|
-
* using this repository.
|
|
7
|
-
*/
|
|
8
|
-
repositoryName: string;
|
|
9
|
-
/**
|
|
10
|
-
* The URL of your app's Prismic preview endpoint (default: `/api/preview`).
|
|
11
|
-
* This URL will be fetched on preview update events.
|
|
12
|
-
*/
|
|
13
|
-
updatePreviewURL?: string;
|
|
14
|
-
/**
|
|
15
|
-
* The URL of your app's exit preview endpoint (default: `/api/exit-preview`).
|
|
16
|
-
* This URL will be fetched on preview exit events.
|
|
17
|
-
*/
|
|
18
|
-
exitPreviewURL?: string;
|
|
19
|
-
/** Children to render adjacent to the Prismic Toolbar. */
|
|
20
|
-
children?: ReactNode;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* React component that sets up Prismic Previews using the Prismic Toolbar. When
|
|
24
|
-
* the Prismic Toolbar send events to the browser, such as on preview updates
|
|
25
|
-
* and exiting, this component will automatically refresh the page with the
|
|
26
|
-
* changes.
|
|
27
|
-
*
|
|
28
|
-
* This component can be wrapped around your app or added anywhere in your app's
|
|
29
|
-
* tree. It must be rendered on every page.
|
|
30
|
-
*/
|
|
31
|
-
export declare const PrismicPreview: FC<PrismicPreviewProps>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { PreviewData } from "next";
|
|
2
|
-
import type { Client } from "@prismicio/client";
|
|
3
|
-
import type { NextApiRequestLike } from "./types";
|
|
4
|
-
/**
|
|
5
|
-
* Configuration for `enableAutoPreviews`.
|
|
6
|
-
*
|
|
7
|
-
* @typeParam TPreviewData - Next.js preview data object.
|
|
8
|
-
*/
|
|
9
|
-
export type EnableAutoPreviewsConfig = {
|
|
10
|
-
/** Prismic client with which automatic previews will be enabled. */
|
|
11
|
-
client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
|
|
12
|
-
/**
|
|
13
|
-
* The `previewData` object provided in the `getStaticProps()` or
|
|
14
|
-
* `getServerSideProps()` context object.
|
|
15
|
-
*/
|
|
16
|
-
previewData?: PreviewData;
|
|
17
|
-
/**
|
|
18
|
-
* The `req` object from a Next.js API route.
|
|
19
|
-
*
|
|
20
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/api-routes/introduction\>
|
|
21
|
-
*/
|
|
22
|
-
req?: NextApiRequestLike;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Configures a Prismic client to automatically query draft content during a
|
|
26
|
-
* preview session. It either takes in a Next.js `getStaticProps` context object
|
|
27
|
-
* or a Next.js API endpoint request object.
|
|
28
|
-
*
|
|
29
|
-
* @param config - Configuration for the function.
|
|
30
|
-
*/
|
|
31
|
-
export declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { NextApiRequestLike, NextApiResponseLike } from "./types";
|
|
2
|
-
/** Configuration for `exitPreview()`. */
|
|
3
|
-
export type ExitPreviewAPIRouteConfig = {
|
|
4
|
-
/**
|
|
5
|
-
* The `req` object from a Next.js API route.
|
|
6
|
-
*
|
|
7
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/api-routes/introduction\>
|
|
8
|
-
*/
|
|
9
|
-
req?: NextApiRequestLike;
|
|
10
|
-
/**
|
|
11
|
-
* The `res` object from a Next.js API route.
|
|
12
|
-
*
|
|
13
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/api-routes/introduction\>
|
|
14
|
-
*/
|
|
15
|
-
res: NextApiResponseLike;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
19
|
-
* used in an API route.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* ```typescript
|
|
24
|
-
* // src/pages/api/exit-preview.js
|
|
25
|
-
*
|
|
26
|
-
* import { exitPreview } from "@prismicio/next";
|
|
27
|
-
*
|
|
28
|
-
* export default function handler(_req, res) {
|
|
29
|
-
* return exitPreview({ res });
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function exitPreview(config: ExitPreviewAPIRouteConfig): void;
|
package/dist/pages/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { PrismicNextLink } from "../PrismicNextLink";
|
|
2
|
-
export { type PrismicNextLinkProps } from "../PrismicNextLink";
|
|
3
|
-
export { PrismicNextImage } from "../PrismicNextImage";
|
|
4
|
-
export { type PrismicNextImageProps } from "../PrismicNextImage";
|
|
5
|
-
export { imgixLoader } from "../imgixLoader";
|
|
6
|
-
export { PrismicPreview } from "./PrismicPreview";
|
|
7
|
-
export type { PrismicPreviewProps } from "./PrismicPreview";
|
|
8
|
-
export { enableAutoPreviews } from "./enableAutoPreviews";
|
|
9
|
-
export type { EnableAutoPreviewsConfig } from "./enableAutoPreviews";
|
|
10
|
-
export { redirectToPreviewURL } from "./redirectToPreviewURL";
|
|
11
|
-
export type { RedirectToPreviewURLConfig } from "./redirectToPreviewURL";
|
|
12
|
-
export { exitPreview } from "./exitPreview";
|
|
13
|
-
export type { ExitPreviewAPIRouteConfig } from "./exitPreview";
|
|
14
|
-
export { setPreviewData } from "./setPreviewData";
|
|
15
|
-
export type { SetPreviewDataConfig } from "./setPreviewData";
|
|
16
|
-
export type { CreateClientConfig } from "./types";
|
|
17
|
-
export { createLocaleRedirect } from "../createLocaleRedirect";
|
|
18
|
-
export type { CreateLocaleRedirectConfig } from "../createLocaleRedirect";
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { LinkResolverFunction, Client } from "@prismicio/client";
|
|
2
|
-
import type { NextApiRequestLike, NextApiResponseLike } from "./types";
|
|
3
|
-
export type RedirectToPreviewURLConfig = {
|
|
4
|
-
/** The Prismic client configured for the preview session's repository. */
|
|
5
|
-
client: Pick<Client, "resolvePreviewURL">;
|
|
6
|
-
/**
|
|
7
|
-
* The `req` object from a Next.js API route.
|
|
8
|
-
*
|
|
9
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\>
|
|
10
|
-
*/
|
|
11
|
-
req: NextApiRequestLike;
|
|
12
|
-
/**
|
|
13
|
-
* The `res` object from a Next.js API route.
|
|
14
|
-
*
|
|
15
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\>
|
|
16
|
-
*/
|
|
17
|
-
res: NextApiResponseLike;
|
|
18
|
-
/**
|
|
19
|
-
* A Link Resolver used to resolve the previewed document's URL.
|
|
20
|
-
*
|
|
21
|
-
* @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}
|
|
22
|
-
*/
|
|
23
|
-
linkResolver?: LinkResolverFunction;
|
|
24
|
-
/**
|
|
25
|
-
* The default redirect URL if a URL cannot be determined for the previewed
|
|
26
|
-
* document.
|
|
27
|
-
*
|
|
28
|
-
* **Note**: If you `next.config.js` file contains a `basePath`, the
|
|
29
|
-
* `defaultURL` option must _not_ include it. Instead, provide the `basePath`
|
|
30
|
-
* property using the `basePath` option.
|
|
31
|
-
*/
|
|
32
|
-
defaultURL?: string;
|
|
33
|
-
/**
|
|
34
|
-
* The `basePath` for the Next.js app as it is defined in `next.config.js`.
|
|
35
|
-
* This option can be omitted if the app does not have a `basePath`.
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* The Router Handler or API route is unable to detect the app's `basePath`
|
|
39
|
-
* automatically. It must be provided to `redirectToPreviewURL()` manually.
|
|
40
|
-
*/
|
|
41
|
-
basePath?: string;
|
|
42
|
-
};
|
|
43
|
-
export declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { NextApiRequestLike, NextApiResponseLike } from "./types";
|
|
2
|
-
/** Configuration for `setPreviewData`. */
|
|
3
|
-
export type SetPreviewDataConfig = {
|
|
4
|
-
/**
|
|
5
|
-
* The `req` object from a Next.js API route.
|
|
6
|
-
*
|
|
7
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/api-routes/introduction\>
|
|
8
|
-
*/
|
|
9
|
-
req: NextApiRequestLike;
|
|
10
|
-
/**
|
|
11
|
-
* The `res` object from a Next.js API route.
|
|
12
|
-
*
|
|
13
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/api-routes/introduction\>
|
|
14
|
-
*/
|
|
15
|
-
res: NextApiResponseLike;
|
|
16
|
-
};
|
|
17
|
-
/** Set Prismic preview data for Next.js's Preview Mode. */
|
|
18
|
-
export declare function setPreviewData({ req, res }: SetPreviewDataConfig): void;
|
package/dist/pages/types.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ClientConfig } from "@prismicio/client";
|
|
2
|
-
import { EnableAutoPreviewsConfig } from "./enableAutoPreviews";
|
|
3
|
-
/**
|
|
4
|
-
* Configuration for creating a Prismic client with automatic preview support in
|
|
5
|
-
* Next.js apps.
|
|
6
|
-
*/
|
|
7
|
-
export type CreateClientConfig = ClientConfig & Pick<EnableAutoPreviewsConfig, "previewData" | "req">;
|
|
8
|
-
/**
|
|
9
|
-
* The minimal set of properties needed from `next`'s `NextApiRequest` type.
|
|
10
|
-
*
|
|
11
|
-
* This request type is only compatible with API routes defined in the `pages`
|
|
12
|
-
* directory.
|
|
13
|
-
*/
|
|
14
|
-
export type NextApiRequestLike = {
|
|
15
|
-
query: Partial<Record<string, string | string[]>>;
|
|
16
|
-
cookies: Partial<Record<string, string>>;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The minimal set of properties needed from `next`'s `NextApiResponse` type.
|
|
20
|
-
*
|
|
21
|
-
* This request type is only compatible with API routes defined in the `pages`
|
|
22
|
-
* directory.
|
|
23
|
-
*/
|
|
24
|
-
export type NextApiResponseLike = {
|
|
25
|
-
redirect(url: string): NextApiResponseLike;
|
|
26
|
-
clearPreviewData(): NextApiResponseLike;
|
|
27
|
-
setHeader(name: string, value: string | string[]): NextApiResponseLike;
|
|
28
|
-
json(body: any): void;
|
|
29
|
-
setPreviewData(data: object | string): NextApiResponseLike;
|
|
30
|
-
};
|
package/dist/pages.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pages.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Client, type LinkResolverFunction } from "@prismicio/client";
|
|
2
|
-
import { NextRequestLike } from "./types";
|
|
3
|
-
export type RedirectToPreviewURLConfig = {
|
|
4
|
-
/** The Prismic client configured for the preview session's repository. */
|
|
5
|
-
client: Pick<Client, "resolvePreviewURL">;
|
|
6
|
-
/**
|
|
7
|
-
* The `request` object from a Next.js Route Handler.
|
|
8
|
-
*
|
|
9
|
-
* @see Next.js Route Handler docs: \<https://nextjs.org/docs/app/building-your-application/routing/route-handlers\>
|
|
10
|
-
*/
|
|
11
|
-
request: NextRequestLike;
|
|
12
|
-
/**
|
|
13
|
-
* A Link Resolver used to resolve the previewed document's URL.
|
|
14
|
-
*
|
|
15
|
-
* @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}
|
|
16
|
-
*/
|
|
17
|
-
linkResolver?: LinkResolverFunction;
|
|
18
|
-
/**
|
|
19
|
-
* The default redirect URL if a URL cannot be determined for the previewed
|
|
20
|
-
* document.
|
|
21
|
-
*
|
|
22
|
-
* **Note**: If you `next.config.js` file contains a `basePath`, the
|
|
23
|
-
* `defaultURL` option must _not_ include it. Instead, provide the `basePath`
|
|
24
|
-
* property using the `basePath` option.
|
|
25
|
-
*/
|
|
26
|
-
defaultURL?: string;
|
|
27
|
-
};
|
|
28
|
-
export declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never>;
|
package/dist/types.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ClientConfig } from "@prismicio/client";
|
|
2
|
-
declare module "@prismicio/client" {
|
|
3
|
-
interface RequestInitLike {
|
|
4
|
-
next?: RequestInit["next"];
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
/** @deprecated Use `@prismicio/client`'s `ClientConfig`. */
|
|
8
|
-
export type CreateClientConfig = ClientConfig;
|
|
9
|
-
/**
|
|
10
|
-
* The minimal set of properties needed from `next`'s `NextRequest` type.
|
|
11
|
-
*
|
|
12
|
-
* This request type is only compatible with Route Handlers defined in the `app`
|
|
13
|
-
* directory.
|
|
14
|
-
*/
|
|
15
|
-
export type NextRequestLike = {
|
|
16
|
-
headers: {
|
|
17
|
-
get(name: string): string | null;
|
|
18
|
-
};
|
|
19
|
-
url: string;
|
|
20
|
-
nextUrl: {
|
|
21
|
-
pathname: string;
|
|
22
|
-
searchParams: {
|
|
23
|
-
get(name: string): string | null;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
package/src/lib/resolveCJS.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves a CommonJS import that might have a `default` property. This happens
|
|
3
|
-
* when named and default exports are mixed in modules. Next.js seems to do this
|
|
4
|
-
* in the exact set up `@prismicio/next` uses.
|
|
5
|
-
*
|
|
6
|
-
* This is _should_ be a temporary hack until Next.js and Node.js resolve their
|
|
7
|
-
* ESM difficulties. This will likely not be removed any time soon.
|
|
8
|
-
*/
|
|
9
|
-
export function resolveCJS<T>(mod: T): T {
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
-
return "default" in (mod as any) ? (mod as any).default : mod;
|
|
12
|
-
}
|