@prismicio/next 2.3.3-pr.161.f7cf911 → 2.3.3
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 +5 -6
- package/dist/PrismicNextImage.cjs.map +1 -1
- package/dist/PrismicNextImage.d.cts +4 -5
- package/dist/PrismicNextImage.d.cts.map +1 -1
- package/dist/PrismicNextImage.d.ts +4 -5
- package/dist/PrismicNextImage.d.ts.map +1 -1
- package/dist/PrismicNextImage.js +4 -5
- package/dist/PrismicNextImage.js.map +1 -1
- package/dist/PrismicNextLink.cjs +2 -3
- package/dist/PrismicNextLink.cjs.map +1 -1
- package/dist/PrismicNextLink.d.cts +11 -8
- package/dist/PrismicNextLink.d.cts.map +1 -1
- package/dist/PrismicNextLink.d.ts +10 -7
- package/dist/PrismicNextLink.d.ts.map +1 -1
- package/dist/PrismicNextLink.js +1 -2
- package/dist/PrismicNextLink.js.map +1 -1
- package/dist/PrismicPreview.cjs +2 -2
- package/dist/PrismicPreview.cjs.map +1 -1
- package/dist/PrismicPreview.d.cts +2 -2
- package/dist/PrismicPreview.d.cts.map +1 -1
- package/dist/PrismicPreview.d.ts +2 -2
- package/dist/PrismicPreview.d.ts.map +1 -1
- package/dist/PrismicPreview.js +1 -1
- package/dist/PrismicPreview.js.map +1 -1
- package/dist/PrismicPreviewClient.cjs +1 -0
- package/dist/PrismicPreviewClient.cjs.map +1 -1
- package/dist/PrismicPreviewClient.js.map +1 -1
- package/dist/SliceSimulator.cjs +2 -3
- package/dist/SliceSimulator.cjs.map +1 -1
- package/dist/SliceSimulator.d.cts +1 -0
- package/dist/SliceSimulator.d.cts.map +1 -1
- package/dist/SliceSimulator.d.ts +1 -0
- package/dist/SliceSimulator.d.ts.map +1 -1
- package/dist/SliceSimulator.js +1 -2
- package/dist/SliceSimulator.js.map +1 -1
- package/dist/SliceSimulatorWrapper.cjs +1 -0
- package/dist/SliceSimulatorWrapper.cjs.map +1 -1
- package/dist/SliceSimulatorWrapper.js.map +1 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/cacheTagPrismicPages.cjs +1 -1
- package/dist/cacheTagPrismicPages.cjs.map +1 -1
- package/dist/cacheTagPrismicPages.d.cts +1 -0
- package/dist/cacheTagPrismicPages.d.cts.map +1 -1
- package/dist/cacheTagPrismicPages.d.ts +1 -0
- package/dist/cacheTagPrismicPages.d.ts.map +1 -1
- package/dist/cacheTagPrismicPages.js.map +1 -1
- package/dist/createLocaleRedirect.cjs.map +1 -1
- package/dist/createLocaleRedirect.d.cts.map +1 -1
- package/dist/createLocaleRedirect.d.ts.map +1 -1
- package/dist/createLocaleRedirect.js.map +1 -1
- package/dist/enableAutoPreviews.cjs.map +1 -1
- package/dist/enableAutoPreviews.d.cts +2 -2
- package/dist/enableAutoPreviews.d.cts.map +1 -1
- package/dist/enableAutoPreviews.d.ts +2 -2
- package/dist/enableAutoPreviews.d.ts.map +1 -1
- package/dist/enableAutoPreviews.js.map +1 -1
- package/dist/exitPreview.cjs +1 -0
- package/dist/exitPreview.cjs.map +1 -1
- package/dist/exitPreview.d.cts.map +1 -1
- package/dist/exitPreview.d.ts.map +1 -1
- package/dist/exitPreview.js.map +1 -1
- package/dist/getPreviewRef.cjs +1 -0
- package/dist/getPreviewRef.cjs.map +1 -1
- package/dist/getPreviewRef.d.cts.map +1 -1
- package/dist/getPreviewRef.d.ts.map +1 -1
- package/dist/getPreviewRef.js.map +1 -1
- package/dist/getPrismicCacheTags.cjs +2 -4
- package/dist/getPrismicCacheTags.cjs.map +1 -1
- package/dist/getPrismicCacheTags.d.cts +1 -0
- package/dist/getPrismicCacheTags.d.cts.map +1 -1
- package/dist/getPrismicCacheTags.d.ts +1 -0
- package/dist/getPrismicCacheTags.d.ts.map +1 -1
- package/dist/getPrismicCacheTags.js +2 -4
- package/dist/getPrismicCacheTags.js.map +1 -1
- package/dist/getSlices.cjs +1 -1
- package/dist/getSlices.cjs.map +1 -1
- package/dist/getSlices.d.cts +1 -0
- package/dist/getSlices.d.cts.map +1 -1
- package/dist/getSlices.d.ts +1 -0
- package/dist/getSlices.d.ts.map +1 -1
- package/dist/getSlices.js.map +1 -1
- package/dist/imgixLoader.cjs +1 -0
- package/dist/imgixLoader.cjs.map +1 -1
- package/dist/imgixLoader.d.cts +1 -0
- package/dist/imgixLoader.d.cts.map +1 -1
- package/dist/imgixLoader.d.ts +1 -0
- package/dist/imgixLoader.d.ts.map +1 -1
- package/dist/imgixLoader.js.map +1 -1
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/resolveDefaultExport.cjs.map +1 -1
- package/dist/lib/resolveDefaultExport.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/pages/PrismicPreview.cjs +1 -1
- package/dist/pages/PrismicPreview.cjs.map +1 -1
- package/dist/pages/PrismicPreview.d.cts +2 -2
- package/dist/pages/PrismicPreview.d.cts.map +1 -1
- package/dist/pages/PrismicPreview.d.ts +2 -2
- package/dist/pages/PrismicPreview.d.ts.map +1 -1
- package/dist/pages/PrismicPreview.js.map +1 -1
- package/dist/pages/SliceSimulator.cjs +1 -0
- package/dist/pages/SliceSimulator.cjs.map +1 -1
- package/dist/pages/SliceSimulator.d.cts +1 -0
- package/dist/pages/SliceSimulator.d.cts.map +1 -1
- package/dist/pages/SliceSimulator.d.ts +1 -0
- package/dist/pages/SliceSimulator.d.ts.map +1 -1
- package/dist/pages/SliceSimulator.js.map +1 -1
- package/dist/pages/enableAutoPreviews.cjs.map +1 -1
- package/dist/pages/enableAutoPreviews.d.cts +2 -2
- package/dist/pages/enableAutoPreviews.d.cts.map +1 -1
- package/dist/pages/enableAutoPreviews.d.ts +2 -2
- package/dist/pages/enableAutoPreviews.d.ts.map +1 -1
- package/dist/pages/enableAutoPreviews.js.map +1 -1
- package/dist/pages/exitPreview.cjs.map +1 -1
- package/dist/pages/exitPreview.d.cts +1 -0
- package/dist/pages/exitPreview.d.cts.map +1 -1
- package/dist/pages/exitPreview.d.ts +1 -0
- package/dist/pages/exitPreview.d.ts.map +1 -1
- package/dist/pages/exitPreview.js.map +1 -1
- package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
- package/dist/pages/redirectToPreviewURL.d.cts +2 -2
- package/dist/pages/redirectToPreviewURL.d.cts.map +1 -1
- package/dist/pages/redirectToPreviewURL.d.ts +2 -2
- package/dist/pages/redirectToPreviewURL.d.ts.map +1 -1
- package/dist/pages/redirectToPreviewURL.js.map +1 -1
- package/dist/pages/setPreviewData.cjs +1 -0
- package/dist/pages/setPreviewData.cjs.map +1 -1
- package/dist/pages/setPreviewData.d.cts +5 -1
- package/dist/pages/setPreviewData.d.cts.map +1 -1
- package/dist/pages/setPreviewData.d.ts +5 -1
- package/dist/pages/setPreviewData.d.ts.map +1 -1
- package/dist/pages/setPreviewData.js.map +1 -1
- package/dist/pages/types.d.cts +1 -0
- package/dist/pages/types.d.cts.map +1 -1
- package/dist/pages/types.d.ts +1 -0
- package/dist/pages/types.d.ts.map +1 -1
- package/dist/redirectToPreviewURL.cjs +1 -0
- package/dist/redirectToPreviewURL.cjs.map +1 -1
- package/dist/redirectToPreviewURL.d.cts +2 -2
- package/dist/redirectToPreviewURL.d.cts.map +1 -1
- package/dist/redirectToPreviewURL.d.ts +2 -2
- package/dist/redirectToPreviewURL.d.ts.map +1 -1
- package/dist/redirectToPreviewURL.js.map +1 -1
- package/dist/revalidatePrismicPages.cjs +2 -4
- package/dist/revalidatePrismicPages.cjs.map +1 -1
- package/dist/revalidatePrismicPages.d.cts.map +1 -1
- package/dist/revalidatePrismicPages.d.ts.map +1 -1
- package/dist/revalidatePrismicPages.js +1 -4
- package/dist/revalidatePrismicPages.js.map +1 -1
- package/dist/types.d.cts +1 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/PrismicNextImage.tsx +5 -5
- package/src/PrismicNextLink.tsx +2 -2
- package/src/PrismicPreview.tsx +2 -2
package/dist/pages/types.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EnableAutoPreviewsConfig } from "./enableAutoPreviews.cjs";
|
|
2
2
|
import { ClientConfig } from "@prismicio/client";
|
|
3
|
+
|
|
3
4
|
//#region src/pages/types.d.ts
|
|
4
5
|
/** Configuration for creating a Prismic client with automatic preview support in Next.js apps. */
|
|
5
6
|
type CreateClientConfig = ClientConfig & Pick<EnableAutoPreviewsConfig, "previewData" | "req">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/pages/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/pages/types.ts"],"mappings":";;;;;KAKY,kBAAA,GAAqB,YAAA,GAChC,IAAA,CAAK,wBAAA;AADN;;;;;AAAA,KAQY,kBAAA;EACX,KAAA,EAAO,OAAA,CAAQ,MAAA;EACf,OAAA,EAAS,OAAA,CAAQ,MAAA;AAAA;;;;;AAFlB;KAUY,mBAAA;EACX,QAAA,CAAS,GAAA,WAAc,mBAAA;EACvB,gBAAA,IAAoB,mBAAA;EACpB,SAAA,CAAU,IAAA,UAAc,KAAA,sBAA2B,mBAAA;EAEnD,IAAA,CAAK,IAAA;EACL,cAAA,CAAe,IAAA,oBAAwB,mBAAA;AAAA"}
|
package/dist/pages/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EnableAutoPreviewsConfig } from "./enableAutoPreviews.js";
|
|
2
2
|
import { ClientConfig } from "@prismicio/client";
|
|
3
|
+
|
|
3
4
|
//#region src/pages/types.d.ts
|
|
4
5
|
/** Configuration for creating a Prismic client with automatic preview support in Next.js apps. */
|
|
5
6
|
type CreateClientConfig = ClientConfig & Pick<EnableAutoPreviewsConfig, "previewData" | "req">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/pages/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/pages/types.ts"],"mappings":";;;;;KAKY,kBAAA,GAAqB,YAAA,GAChC,IAAA,CAAK,wBAAA;AADN;;;;;AAAA,KAQY,kBAAA;EACX,KAAA,EAAO,OAAA,CAAQ,MAAA;EACf,OAAA,EAAS,OAAA,CAAQ,MAAA;AAAA;;;;;AAFlB;KAUY,mBAAA;EACX,QAAA,CAAS,GAAA,WAAc,mBAAA;EACvB,gBAAA,IAAoB,mBAAA;EACpB,SAAA,CAAU,IAAA,UAAc,KAAA,sBAA2B,mBAAA;EAEnD,IAAA,CAAK,IAAA;EACL,cAAA,CAAe,IAAA,oBAAwB,mBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirectToPreviewURL.cjs","names":["prismicCookie"],"sources":["../src/redirectToPreviewURL.ts"],"sourcesContent":["import { cookie as prismicCookie, type Client, type LinkResolverFunction } from \"@prismicio/client\"\n\nimport type { NextRequestLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `request` object from a Next.js Route Handler.\n\t *\n\t * @see Next.js Route Handler docs: \\<https://nextjs.org/docs/app/building-your-application/routing/route-handlers\\>\n\t */\n\trequest: NextRequestLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never> {\n\tconst { client, request, linkResolver, defaultURL = \"/\" } = config\n\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\t// Dynamic so Node.js can load this module: the bare specifier (kept by\n\t// tsdown.config.ts for Next.js's server alias) is not resolvable by Node.js.\n\tconst { redirect } = await import(\"next/navigation\")\n\n\tconst documentID = request.nextUrl.searchParams.get(\"documentId\") ?? undefined\n\n\t// Set the initial preview cookie. Setting the cookie here is necessary\n\t// to support unpublished previews. Without setting it here, the page\n\t// will try to render without the preview cookie, leading to a\n\t// PrismicNotFound error.\n\tconst cookieJar = await cookies()\n\tconst previewToken = request.nextUrl.searchParams.get(\"token\") ?? undefined\n\tif (previewToken) {\n\t\tcookieJar.set(prismicCookie.preview, previewToken, { sameSite: \"none\", secure: true })\n\t}\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tdocumentID,\n\t\tpreviewToken,\n\t\tdefaultURL,\n\t\tlinkResolver,\n\t})\n\n\t;(await draftMode()).enable()\n\n\t// Next.js uses `SameSite=Lax` in development, which cross-site iframes drop.\n\tcookieJar.set({\n\t\t...cookieJar.get(\"__prerender_bypass\")!,\n\t\thttpOnly: true,\n\t\tsameSite: \"none\",\n\t\tsecure: true,\n\t})\n\n\treturn redirect(previewURL)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"redirectToPreviewURL.cjs","names":["prismicCookie"],"sources":["../src/redirectToPreviewURL.ts"],"sourcesContent":["import { cookie as prismicCookie, type Client, type LinkResolverFunction } from \"@prismicio/client\"\n\nimport type { NextRequestLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `request` object from a Next.js Route Handler.\n\t *\n\t * @see Next.js Route Handler docs: \\<https://nextjs.org/docs/app/building-your-application/routing/route-handlers\\>\n\t */\n\trequest: NextRequestLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never> {\n\tconst { client, request, linkResolver, defaultURL = \"/\" } = config\n\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\t// Dynamic so Node.js can load this module: the bare specifier (kept by\n\t// tsdown.config.ts for Next.js's server alias) is not resolvable by Node.js.\n\tconst { redirect } = await import(\"next/navigation\")\n\n\tconst documentID = request.nextUrl.searchParams.get(\"documentId\") ?? undefined\n\n\t// Set the initial preview cookie. Setting the cookie here is necessary\n\t// to support unpublished previews. Without setting it here, the page\n\t// will try to render without the preview cookie, leading to a\n\t// PrismicNotFound error.\n\tconst cookieJar = await cookies()\n\tconst previewToken = request.nextUrl.searchParams.get(\"token\") ?? undefined\n\tif (previewToken) {\n\t\tcookieJar.set(prismicCookie.preview, previewToken, { sameSite: \"none\", secure: true })\n\t}\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tdocumentID,\n\t\tpreviewToken,\n\t\tdefaultURL,\n\t\tlinkResolver,\n\t})\n\n\t;(await draftMode()).enable()\n\n\t// Next.js uses `SameSite=Lax` in development, which cross-site iframes drop.\n\tcookieJar.set({\n\t\t...cookieJar.get(\"__prerender_bypass\")!,\n\t\thttpOnly: true,\n\t\tsameSite: \"none\",\n\t\tsecure: true,\n\t})\n\n\treturn redirect(previewURL)\n}\n"],"mappings":";;;AAkCA,eAAsB,qBAAqB,QAAoD;CAC9F,MAAM,EAAE,QAAQ,SAAS,cAAc,aAAa,QAAQ;CAK5D,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAI5C,MAAM,EAAE,aAAa,MAAM,OAAO;CAElC,MAAM,aAAa,QAAQ,QAAQ,aAAa,IAAI,aAAa,IAAI,KAAA;CAMrE,MAAM,YAAY,MAAM,SAAS;CACjC,MAAM,eAAe,QAAQ,QAAQ,aAAa,IAAI,QAAQ,IAAI,KAAA;AAClE,KAAI,aACH,WAAU,IAAIA,kBAAAA,OAAc,SAAS,cAAc;EAAE,UAAU;EAAQ,QAAQ;EAAM,CAAC;CAGvF,MAAM,aAAa,MAAM,OAAO,kBAAkB;EACjD;EACA;EACA;EACA;EACA,CAAC;AAED,EAAC,MAAM,WAAW,EAAE,QAAQ;AAG7B,WAAU,IAAI;EACb,GAAG,UAAU,IAAI,qBAAqB;EACtC,UAAU;EACV,UAAU;EACV,QAAQ;EACR,CAAC;AAEF,QAAO,SAAS,WAAW"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NextRequestLike } from "./types.cjs";
|
|
2
2
|
import { Client, LinkResolverFunction } from "@prismicio/client";
|
|
3
|
+
|
|
3
4
|
//#region src/redirectToPreviewURL.d.ts
|
|
4
5
|
type RedirectToPreviewURLConfig = {
|
|
5
|
-
/** The Prismic client configured for the preview session's repository. */
|
|
6
|
-
client: Pick<Client, "resolvePreviewURL">;
|
|
6
|
+
/** The Prismic client configured for the preview session's repository. */client: Pick<Client, "resolvePreviewURL">;
|
|
7
7
|
/**
|
|
8
8
|
* The `request` object from a Next.js Route Handler.
|
|
9
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirectToPreviewURL.d.cts","names":[],"sources":["../src/redirectToPreviewURL.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"redirectToPreviewURL.d.cts","names":[],"sources":["../src/redirectToPreviewURL.ts"],"mappings":";;;;KAIY,0BAAA;4EAKX,MAAA,EAAQ,IAAA,CAAK,MAAA;EALwB;;;;;EAYrC,OAAA,EAAS,eAAA;EAO0B;;;;;EAAnC,YAAA,GAAe,oBAAA;EAPN;;;;;;EAeT,UAAA;AAAA;AAAA,iBAGqB,oBAAA,CAAqB,MAAA,EAAQ,0BAAA,GAA6B,OAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NextRequestLike } from "./types.js";
|
|
2
2
|
import { Client, LinkResolverFunction } from "@prismicio/client";
|
|
3
|
+
|
|
3
4
|
//#region src/redirectToPreviewURL.d.ts
|
|
4
5
|
type RedirectToPreviewURLConfig = {
|
|
5
|
-
/** The Prismic client configured for the preview session's repository. */
|
|
6
|
-
client: Pick<Client, "resolvePreviewURL">;
|
|
6
|
+
/** The Prismic client configured for the preview session's repository. */client: Pick<Client, "resolvePreviewURL">;
|
|
7
7
|
/**
|
|
8
8
|
* The `request` object from a Next.js Route Handler.
|
|
9
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirectToPreviewURL.d.ts","names":[],"sources":["../src/redirectToPreviewURL.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"redirectToPreviewURL.d.ts","names":[],"sources":["../src/redirectToPreviewURL.ts"],"mappings":";;;;KAIY,0BAAA;4EAKX,MAAA,EAAQ,IAAA,CAAK,MAAA;EALwB;;;;;EAYrC,OAAA,EAAS,eAAA;EAO0B;;;;;EAAnC,YAAA,GAAe,oBAAA;EAPN;;;;;;EAeT,UAAA;AAAA;AAAA,iBAGqB,oBAAA,CAAqB,MAAA,EAAQ,0BAAA,GAA6B,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirectToPreviewURL.js","names":["prismicCookie"],"sources":["../src/redirectToPreviewURL.ts"],"sourcesContent":["import { cookie as prismicCookie, type Client, type LinkResolverFunction } from \"@prismicio/client\"\n\nimport type { NextRequestLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `request` object from a Next.js Route Handler.\n\t *\n\t * @see Next.js Route Handler docs: \\<https://nextjs.org/docs/app/building-your-application/routing/route-handlers\\>\n\t */\n\trequest: NextRequestLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never> {\n\tconst { client, request, linkResolver, defaultURL = \"/\" } = config\n\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\t// Dynamic so Node.js can load this module: the bare specifier (kept by\n\t// tsdown.config.ts for Next.js's server alias) is not resolvable by Node.js.\n\tconst { redirect } = await import(\"next/navigation\")\n\n\tconst documentID = request.nextUrl.searchParams.get(\"documentId\") ?? undefined\n\n\t// Set the initial preview cookie. Setting the cookie here is necessary\n\t// to support unpublished previews. Without setting it here, the page\n\t// will try to render without the preview cookie, leading to a\n\t// PrismicNotFound error.\n\tconst cookieJar = await cookies()\n\tconst previewToken = request.nextUrl.searchParams.get(\"token\") ?? undefined\n\tif (previewToken) {\n\t\tcookieJar.set(prismicCookie.preview, previewToken, { sameSite: \"none\", secure: true })\n\t}\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tdocumentID,\n\t\tpreviewToken,\n\t\tdefaultURL,\n\t\tlinkResolver,\n\t})\n\n\t;(await draftMode()).enable()\n\n\t// Next.js uses `SameSite=Lax` in development, which cross-site iframes drop.\n\tcookieJar.set({\n\t\t...cookieJar.get(\"__prerender_bypass\")!,\n\t\thttpOnly: true,\n\t\tsameSite: \"none\",\n\t\tsecure: true,\n\t})\n\n\treturn redirect(previewURL)\n}\n"],"mappings":";;AAkCA,eAAsB,qBAAqB,QAAoD;CAC9F,MAAM,EAAE,QAAQ,SAAS,cAAc,aAAa,QAAQ;CAK5D,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAI5C,MAAM,EAAE,aAAa,MAAM,OAAO;CAElC,MAAM,aAAa,QAAQ,QAAQ,aAAa,IAAI,
|
|
1
|
+
{"version":3,"file":"redirectToPreviewURL.js","names":["prismicCookie"],"sources":["../src/redirectToPreviewURL.ts"],"sourcesContent":["import { cookie as prismicCookie, type Client, type LinkResolverFunction } from \"@prismicio/client\"\n\nimport type { NextRequestLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `request` object from a Next.js Route Handler.\n\t *\n\t * @see Next.js Route Handler docs: \\<https://nextjs.org/docs/app/building-your-application/routing/route-handlers\\>\n\t */\n\trequest: NextRequestLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never> {\n\tconst { client, request, linkResolver, defaultURL = \"/\" } = config\n\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\t// Dynamic so Node.js can load this module: the bare specifier (kept by\n\t// tsdown.config.ts for Next.js's server alias) is not resolvable by Node.js.\n\tconst { redirect } = await import(\"next/navigation\")\n\n\tconst documentID = request.nextUrl.searchParams.get(\"documentId\") ?? undefined\n\n\t// Set the initial preview cookie. Setting the cookie here is necessary\n\t// to support unpublished previews. Without setting it here, the page\n\t// will try to render without the preview cookie, leading to a\n\t// PrismicNotFound error.\n\tconst cookieJar = await cookies()\n\tconst previewToken = request.nextUrl.searchParams.get(\"token\") ?? undefined\n\tif (previewToken) {\n\t\tcookieJar.set(prismicCookie.preview, previewToken, { sameSite: \"none\", secure: true })\n\t}\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tdocumentID,\n\t\tpreviewToken,\n\t\tdefaultURL,\n\t\tlinkResolver,\n\t})\n\n\t;(await draftMode()).enable()\n\n\t// Next.js uses `SameSite=Lax` in development, which cross-site iframes drop.\n\tcookieJar.set({\n\t\t...cookieJar.get(\"__prerender_bypass\")!,\n\t\thttpOnly: true,\n\t\tsameSite: \"none\",\n\t\tsecure: true,\n\t})\n\n\treturn redirect(previewURL)\n}\n"],"mappings":";;AAkCA,eAAsB,qBAAqB,QAAoD;CAC9F,MAAM,EAAE,QAAQ,SAAS,cAAc,aAAa,QAAQ;CAK5D,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAI5C,MAAM,EAAE,aAAa,MAAM,OAAO;CAElC,MAAM,aAAa,QAAQ,QAAQ,aAAa,IAAI,aAAa,IAAI,KAAA;CAMrE,MAAM,YAAY,MAAM,SAAS;CACjC,MAAM,eAAe,QAAQ,QAAQ,aAAa,IAAI,QAAQ,IAAI,KAAA;AAClE,KAAI,aACH,WAAU,IAAIA,OAAc,SAAS,cAAc;EAAE,UAAU;EAAQ,QAAQ;EAAM,CAAC;CAGvF,MAAM,aAAa,MAAM,OAAO,kBAAkB;EACjD;EACA;EACA;EACA;EACA,CAAC;AAED,EAAC,MAAM,WAAW,EAAE,QAAQ;AAG7B,WAAU,IAAI;EACb,GAAG,UAAU,IAAI,qBAAqB;EACtC,UAAU;EACV,UAAU;EACV,QAAQ;EACR,CAAC;AAEF,QAAO,SAAS,WAAW"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
1
2
|
const require_getPrismicCacheTags = require("./getPrismicCacheTags.cjs");
|
|
2
3
|
let next_cache_js = require("next/cache.js");
|
|
3
4
|
//#region src/revalidatePrismicPages.ts
|
|
@@ -11,10 +12,7 @@ let next_cache_js = require("next/cache.js");
|
|
|
11
12
|
* @see {@link https://nextjs.org/docs/app/api-reference/functions/revalidateTag}
|
|
12
13
|
*/
|
|
13
14
|
function revalidatePrismicPages(ids) {
|
|
14
|
-
for (const id of ids) {
|
|
15
|
-
const tag = require_getPrismicCacheTags.buildPrismicCacheTag(id);
|
|
16
|
-
(0, next_cache_js.revalidateTag)(tag, { expire: 0 });
|
|
17
|
-
}
|
|
15
|
+
for (const id of ids) (0, next_cache_js.revalidateTag)(require_getPrismicCacheTags.buildPrismicCacheTag(id), { expire: 0 });
|
|
18
16
|
}
|
|
19
17
|
//#endregion
|
|
20
18
|
exports.revalidatePrismicPages = revalidatePrismicPages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revalidatePrismicPages.cjs","names":["buildPrismicCacheTag"],"sources":["../src/revalidatePrismicPages.ts"],"sourcesContent":["import { revalidateTag } from \"next/cache\"\n\nimport { buildPrismicCacheTag } from \"./getPrismicCacheTags\"\n\n/**\n * Immediately revalidates a set of Prismic pages given a list of their IDs. The list of IDs\n * typically comes from a Prismic webhook triggered when publishing content.\n *\n * @param ids - A list of Prismic page IDs to revalidate.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/revalidateTag}\n */\nexport function revalidatePrismicPages(ids: string[]): void {\n\tfor (const id of ids) {\n\t\tconst tag = buildPrismicCacheTag(id)\n\t\trevalidateTag(tag, { expire: 0 })\n\t}\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"revalidatePrismicPages.cjs","names":["buildPrismicCacheTag"],"sources":["../src/revalidatePrismicPages.ts"],"sourcesContent":["import { revalidateTag } from \"next/cache\"\n\nimport { buildPrismicCacheTag } from \"./getPrismicCacheTags\"\n\n/**\n * Immediately revalidates a set of Prismic pages given a list of their IDs. The list of IDs\n * typically comes from a Prismic webhook triggered when publishing content.\n *\n * @param ids - A list of Prismic page IDs to revalidate.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/revalidateTag}\n */\nexport function revalidatePrismicPages(ids: string[]): void {\n\tfor (const id of ids) {\n\t\tconst tag = buildPrismicCacheTag(id)\n\t\trevalidateTag(tag, { expire: 0 })\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,uBAAuB,KAAqB;AAC3D,MAAK,MAAM,MAAM,IAEhB,EAAA,GAAA,cAAA,eADYA,4BAAAA,qBAAqB,GAAG,EACjB,EAAE,QAAQ,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revalidatePrismicPages.d.cts","names":[],"sources":["../src/revalidatePrismicPages.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"revalidatePrismicPages.d.cts","names":[],"sources":["../src/revalidatePrismicPages.ts"],"mappings":";;AAaA;;;;;;;;iBAAgB,sBAAA,CAAuB,GAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revalidatePrismicPages.d.ts","names":[],"sources":["../src/revalidatePrismicPages.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"revalidatePrismicPages.d.ts","names":[],"sources":["../src/revalidatePrismicPages.ts"],"mappings":";;AAaA;;;;;;;;iBAAgB,sBAAA,CAAuB,GAAA"}
|
|
@@ -11,10 +11,7 @@ import { revalidateTag } from "next/cache.js";
|
|
|
11
11
|
* @see {@link https://nextjs.org/docs/app/api-reference/functions/revalidateTag}
|
|
12
12
|
*/
|
|
13
13
|
function revalidatePrismicPages(ids) {
|
|
14
|
-
for (const id of ids) {
|
|
15
|
-
const tag = buildPrismicCacheTag(id);
|
|
16
|
-
revalidateTag(tag, { expire: 0 });
|
|
17
|
-
}
|
|
14
|
+
for (const id of ids) revalidateTag(buildPrismicCacheTag(id), { expire: 0 });
|
|
18
15
|
}
|
|
19
16
|
//#endregion
|
|
20
17
|
export { revalidatePrismicPages };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revalidatePrismicPages.js","names":[],"sources":["../src/revalidatePrismicPages.ts"],"sourcesContent":["import { revalidateTag } from \"next/cache\"\n\nimport { buildPrismicCacheTag } from \"./getPrismicCacheTags\"\n\n/**\n * Immediately revalidates a set of Prismic pages given a list of their IDs. The list of IDs\n * typically comes from a Prismic webhook triggered when publishing content.\n *\n * @param ids - A list of Prismic page IDs to revalidate.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/revalidateTag}\n */\nexport function revalidatePrismicPages(ids: string[]): void {\n\tfor (const id of ids) {\n\t\tconst tag = buildPrismicCacheTag(id)\n\t\trevalidateTag(tag, { expire: 0 })\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,uBAAuB,KAAqB;
|
|
1
|
+
{"version":3,"file":"revalidatePrismicPages.js","names":[],"sources":["../src/revalidatePrismicPages.ts"],"sourcesContent":["import { revalidateTag } from \"next/cache\"\n\nimport { buildPrismicCacheTag } from \"./getPrismicCacheTags\"\n\n/**\n * Immediately revalidates a set of Prismic pages given a list of their IDs. The list of IDs\n * typically comes from a Prismic webhook triggered when publishing content.\n *\n * @param ids - A list of Prismic page IDs to revalidate.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/revalidateTag}\n */\nexport function revalidatePrismicPages(ids: string[]): void {\n\tfor (const id of ids) {\n\t\tconst tag = buildPrismicCacheTag(id)\n\t\trevalidateTag(tag, { expire: 0 })\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,uBAAuB,KAAqB;AAC3D,MAAK,MAAM,MAAM,IAEhB,eADY,qBAAqB,GAAG,EACjB,EAAE,QAAQ,GAAG,CAAC"}
|
package/dist/types.d.cts
CHANGED
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;YAIW,eAAA;IACT,IAAA,GAAO,WAAA;EAAA;AAAA;;KAKG,kBAAA,GAAqB,YAAA;;;;;;KAOrB,eAAA;EACX,OAAA;IACC,GAAA,CAAI,IAAA;EAAA;EAEL,GAAA;EACA,OAAA;IACC,QAAA;IACA,YAAA;MACC,GAAA,CAAI,IAAA;IAAA;EAAA;AAAA"}
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;YAIW,eAAA;IACT,IAAA,GAAO,WAAA;EAAA;AAAA;;KAKG,kBAAA,GAAqB,YAAA;;;;;;KAOrB,eAAA;EACX,OAAA;IACC,GAAA,CAAI,IAAA;EAAA;EAEL,GAAA;EACA,OAAA;IACC,QAAA;IACA,YAAA;MACC,GAAA,CAAI,IAAA;IAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/next",
|
|
3
|
-
"version": "2.3.3
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Helpers to integrate Prismic into Next.js apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"next",
|
|
@@ -54,23 +54,23 @@
|
|
|
54
54
|
"types": "tsc --noEmit"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@prismicio/simulator": "^0.2.
|
|
57
|
+
"@prismicio/simulator": "^0.2.2",
|
|
58
58
|
"imgix-url-builder": "^0.0.6",
|
|
59
59
|
"lz-string": "^1.5.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@playwright/test": "^1.
|
|
63
|
-
"@prismicio/client": "^7.
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"@types/react": "^19.
|
|
66
|
-
"next": "16.3
|
|
67
|
-
"oxfmt": "^0.
|
|
68
|
-
"oxlint": "^1.
|
|
69
|
-
"playwright": "^1.
|
|
70
|
-
"react": "^19.
|
|
71
|
-
"react-dom": "^19.
|
|
72
|
-
"tsdown": "^0.
|
|
73
|
-
"typescript": "^
|
|
62
|
+
"@playwright/test": "^1.59.1",
|
|
63
|
+
"@prismicio/client": "^7.21.8",
|
|
64
|
+
"@types/node": "^25.5.2",
|
|
65
|
+
"@types/react": "^19.2.14",
|
|
66
|
+
"next": "16.2.3",
|
|
67
|
+
"oxfmt": "^0.44.0",
|
|
68
|
+
"oxlint": "^1.59.0",
|
|
69
|
+
"playwright": "^1.59.1",
|
|
70
|
+
"react": "^19.2.5",
|
|
71
|
+
"react-dom": "^19.2.5",
|
|
72
|
+
"tsdown": "^0.21.7",
|
|
73
|
+
"typescript": "^6.0.2"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@prismicio/client": "^7",
|
|
@@ -78,6 +78,6 @@
|
|
|
78
78
|
"react": "^18 || ^19"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
81
|
-
"node": ">=
|
|
81
|
+
"node": ">=20"
|
|
82
82
|
}
|
|
83
83
|
}
|
package/src/PrismicNextImage.tsx
CHANGED
|
@@ -13,8 +13,6 @@ import { imgixLoader } from "./imgixLoader"
|
|
|
13
13
|
import { devMsg } from "./lib/devMsg"
|
|
14
14
|
import { resolveDefaultExport } from "./lib/resolveDefaultExport"
|
|
15
15
|
|
|
16
|
-
const ResolvedImage = resolveDefaultExport(Image)
|
|
17
|
-
|
|
18
16
|
const castInt = (input: string | number | undefined): number | undefined => {
|
|
19
17
|
if (typeof input === "number" || typeof input === "undefined") {
|
|
20
18
|
return input
|
|
@@ -115,14 +113,14 @@ export const PrismicNextImage: ForwardRefExoticComponent<
|
|
|
115
113
|
return <>{fallback}</>
|
|
116
114
|
}
|
|
117
115
|
|
|
118
|
-
const resolvedImgixParams =
|
|
119
|
-
for (const x in
|
|
116
|
+
const resolvedImgixParams = imgixParams
|
|
117
|
+
for (const x in imgixParams) {
|
|
120
118
|
if (resolvedImgixParams[x as keyof typeof resolvedImgixParams] === null) {
|
|
121
119
|
resolvedImgixParams[x as keyof typeof resolvedImgixParams] = undefined
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
|
|
125
|
-
const src = buildURL(field.url,
|
|
123
|
+
const src = buildURL(field.url, imgixParams as ImgixURLParams)
|
|
126
124
|
|
|
127
125
|
const ar = field.dimensions.width / field.dimensions.height
|
|
128
126
|
|
|
@@ -149,6 +147,8 @@ export const PrismicNextImage: ForwardRefExoticComponent<
|
|
|
149
147
|
)
|
|
150
148
|
}
|
|
151
149
|
|
|
150
|
+
const ResolvedImage = resolveDefaultExport(Image)
|
|
151
|
+
|
|
152
152
|
return (
|
|
153
153
|
<ResolvedImage
|
|
154
154
|
ref={ref}
|
package/src/PrismicNextLink.tsx
CHANGED
|
@@ -11,8 +11,6 @@ import { forwardRef } from "react"
|
|
|
11
11
|
|
|
12
12
|
import { resolveDefaultExport } from "./lib/resolveDefaultExport"
|
|
13
13
|
|
|
14
|
-
const ResolvedLink = resolveDefaultExport(Link)
|
|
15
|
-
|
|
16
14
|
export type PrismicNextLinkProps = Omit<
|
|
17
15
|
ComponentProps<typeof Link>,
|
|
18
16
|
"field" | "document" | "href" | "rel"
|
|
@@ -56,6 +54,8 @@ export const PrismicNextLink = forwardRef<HTMLAnchorElement, PrismicNextLinkProp
|
|
|
56
54
|
rel = restProps.rel
|
|
57
55
|
}
|
|
58
56
|
|
|
57
|
+
const ResolvedLink = resolveDefaultExport(Link)
|
|
58
|
+
|
|
59
59
|
return (
|
|
60
60
|
<ResolvedLink ref={ref} {...attrs} {...restProps} href={href} rel={rel}>
|
|
61
61
|
{"children" in props ? children : field?.text}
|
package/src/PrismicPreview.tsx
CHANGED
|
@@ -5,8 +5,6 @@ import type { FC, ReactNode } from "react"
|
|
|
5
5
|
import { resolveDefaultExport } from "./lib/resolveDefaultExport"
|
|
6
6
|
import { PrismicPreviewClient } from "./PrismicPreviewClient"
|
|
7
7
|
|
|
8
|
-
const ResolvedScript = resolveDefaultExport(Script)
|
|
9
|
-
|
|
10
8
|
/** Props for `<PrismicPreview>`. */
|
|
11
9
|
export type PrismicPreviewProps = {
|
|
12
10
|
/**
|
|
@@ -50,6 +48,8 @@ export const PrismicPreview: FC<PrismicPreviewProps> = async (props) => {
|
|
|
50
48
|
const toolbarSrc = getToolbarSrc(repositoryName)
|
|
51
49
|
const isDraftMode = (await draftMode()).isEnabled
|
|
52
50
|
|
|
51
|
+
const ResolvedScript = resolveDefaultExport(Script)
|
|
52
|
+
|
|
53
53
|
return (
|
|
54
54
|
<>
|
|
55
55
|
{children}
|