@prismicio/next 2.2.3 → 2.2.4-canary.080cd66
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 +9 -11
- package/dist/PrismicNextImage.cjs.map +1 -1
- package/dist/PrismicNextImage.d.cts +13 -21
- package/dist/PrismicNextImage.d.cts.map +1 -0
- package/dist/PrismicNextImage.d.ts +13 -21
- package/dist/PrismicNextImage.d.ts.map +1 -0
- package/dist/PrismicNextImage.js +9 -11
- package/dist/PrismicNextImage.js.map +1 -1
- package/dist/PrismicNextLink.cjs.map +1 -1
- package/dist/PrismicNextLink.d.cts +3 -3
- package/dist/PrismicNextLink.d.cts.map +1 -0
- package/dist/PrismicNextLink.d.ts +3 -3
- package/dist/PrismicNextLink.d.ts.map +1 -0
- package/dist/PrismicNextLink.js.map +1 -1
- package/dist/PrismicPreview.cjs +6 -7
- package/dist/PrismicPreview.cjs.map +1 -1
- package/dist/PrismicPreview.d.cts +11 -12
- package/dist/PrismicPreview.d.cts.map +1 -0
- package/dist/PrismicPreview.d.ts +11 -12
- package/dist/PrismicPreview.d.ts.map +1 -0
- package/dist/PrismicPreview.js +6 -7
- package/dist/PrismicPreview.js.map +1 -1
- package/dist/PrismicPreviewClient.cjs +1 -3
- package/dist/PrismicPreviewClient.cjs.map +1 -1
- package/dist/PrismicPreviewClient.js +1 -3
- package/dist/PrismicPreviewClient.js.map +1 -1
- package/dist/SliceSimulator.cjs +3 -3
- package/dist/SliceSimulator.cjs.map +1 -1
- package/dist/SliceSimulator.d.cts +3 -5
- package/dist/SliceSimulator.d.cts.map +1 -0
- package/dist/SliceSimulator.d.ts +3 -5
- package/dist/SliceSimulator.d.ts.map +1 -0
- package/dist/SliceSimulator.js +3 -3
- package/dist/SliceSimulator.js.map +1 -1
- package/dist/SliceSimulatorWrapper.cjs +1 -4
- package/dist/SliceSimulatorWrapper.cjs.map +1 -1
- package/dist/SliceSimulatorWrapper.js +1 -4
- package/dist/SliceSimulatorWrapper.js.map +1 -1
- package/dist/cacheTagPrismicPages.cjs +23 -0
- package/dist/cacheTagPrismicPages.cjs.map +1 -0
- package/dist/cacheTagPrismicPages.d.cts +19 -0
- package/dist/cacheTagPrismicPages.d.cts.map +1 -0
- package/dist/cacheTagPrismicPages.d.ts +19 -0
- package/dist/cacheTagPrismicPages.d.ts.map +1 -0
- package/dist/cacheTagPrismicPages.js +22 -0
- package/dist/cacheTagPrismicPages.js.map +1 -0
- package/dist/createLocaleRedirect.cjs.map +1 -1
- package/dist/createLocaleRedirect.d.cts.map +1 -0
- package/dist/createLocaleRedirect.d.ts.map +1 -0
- package/dist/createLocaleRedirect.js.map +1 -1
- package/dist/enableAutoPreviews.cjs +3 -18
- package/dist/enableAutoPreviews.cjs.map +1 -1
- package/dist/enableAutoPreviews.d.cts +1 -2
- package/dist/enableAutoPreviews.d.cts.map +1 -0
- package/dist/enableAutoPreviews.d.ts +1 -2
- package/dist/enableAutoPreviews.d.ts.map +1 -0
- package/dist/enableAutoPreviews.js +3 -17
- package/dist/enableAutoPreviews.js.map +1 -1
- package/dist/exitPreview.cjs +13 -11
- package/dist/exitPreview.cjs.map +1 -1
- package/dist/exitPreview.d.cts +9 -10
- package/dist/exitPreview.d.cts.map +1 -0
- package/dist/exitPreview.d.ts +9 -10
- package/dist/exitPreview.d.ts.map +1 -0
- package/dist/exitPreview.js +12 -11
- package/dist/exitPreview.js.map +1 -1
- package/dist/getPreviewRef.cjs +38 -0
- package/dist/getPreviewRef.cjs.map +1 -0
- package/dist/getPreviewRef.d.cts +22 -0
- package/dist/getPreviewRef.d.cts.map +1 -0
- package/dist/getPreviewRef.d.ts +22 -0
- package/dist/getPreviewRef.d.ts.map +1 -0
- package/dist/getPreviewRef.js +37 -0
- package/dist/getPreviewRef.js.map +1 -0
- package/dist/getPrismicCacheTags.cjs +31 -0
- package/dist/getPrismicCacheTags.cjs.map +1 -0
- package/dist/getPrismicCacheTags.d.cts +16 -0
- package/dist/getPrismicCacheTags.d.cts.map +1 -0
- package/dist/getPrismicCacheTags.d.ts +16 -0
- package/dist/getPrismicCacheTags.d.ts.map +1 -0
- package/dist/getPrismicCacheTags.js +30 -0
- package/dist/getPrismicCacheTags.js.map +1 -0
- package/dist/getSlices.cjs.map +1 -1
- package/dist/getSlices.d.cts.map +1 -0
- package/dist/getSlices.d.ts.map +1 -0
- package/dist/getSlices.js.map +1 -1
- package/dist/imgixLoader.cjs +2 -2
- package/dist/imgixLoader.cjs.map +1 -1
- package/dist/imgixLoader.d.cts +2 -2
- package/dist/imgixLoader.d.cts.map +1 -0
- package/dist/imgixLoader.d.ts +2 -2
- package/dist/imgixLoader.d.ts.map +1 -0
- package/dist/imgixLoader.js +2 -2
- package/dist/imgixLoader.js.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/lib/devMsg.cjs +6 -8
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js +6 -8
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/resolveDefaultExport.cjs +8 -12
- package/dist/lib/resolveDefaultExport.cjs.map +1 -1
- package/dist/lib/resolveDefaultExport.js +8 -12
- 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 +6 -7
- package/dist/pages/PrismicPreview.cjs.map +1 -1
- package/dist/pages/PrismicPreview.d.cts +11 -12
- package/dist/pages/PrismicPreview.d.cts.map +1 -0
- package/dist/pages/PrismicPreview.d.ts +11 -12
- package/dist/pages/PrismicPreview.d.ts.map +1 -0
- package/dist/pages/PrismicPreview.js +6 -7
- package/dist/pages/PrismicPreview.js.map +1 -1
- package/dist/pages/SliceSimulator.cjs +2 -2
- package/dist/pages/SliceSimulator.cjs.map +1 -1
- package/dist/pages/SliceSimulator.d.cts +10 -13
- package/dist/pages/SliceSimulator.d.cts.map +1 -0
- package/dist/pages/SliceSimulator.d.ts +10 -13
- package/dist/pages/SliceSimulator.d.ts.map +1 -0
- package/dist/pages/SliceSimulator.js +2 -2
- package/dist/pages/SliceSimulator.js.map +1 -1
- package/dist/pages/enableAutoPreviews.cjs +3 -3
- package/dist/pages/enableAutoPreviews.cjs.map +1 -1
- package/dist/pages/enableAutoPreviews.d.cts +5 -5
- package/dist/pages/enableAutoPreviews.d.cts.map +1 -0
- package/dist/pages/enableAutoPreviews.d.ts +5 -5
- package/dist/pages/enableAutoPreviews.d.ts.map +1 -0
- package/dist/pages/enableAutoPreviews.js +3 -3
- package/dist/pages/enableAutoPreviews.js.map +1 -1
- package/dist/pages/exitPreview.cjs +9 -10
- package/dist/pages/exitPreview.cjs.map +1 -1
- package/dist/pages/exitPreview.d.cts +9 -10
- package/dist/pages/exitPreview.d.cts.map +1 -0
- package/dist/pages/exitPreview.d.ts +9 -10
- package/dist/pages/exitPreview.d.ts.map +1 -0
- package/dist/pages/exitPreview.js +9 -10
- package/dist/pages/exitPreview.js.map +1 -1
- package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
- package/dist/pages/redirectToPreviewURL.d.cts +7 -9
- package/dist/pages/redirectToPreviewURL.d.cts.map +1 -0
- package/dist/pages/redirectToPreviewURL.d.ts +7 -9
- package/dist/pages/redirectToPreviewURL.d.ts.map +1 -0
- package/dist/pages/redirectToPreviewURL.js.map +1 -1
- package/dist/pages/setPreviewData.cjs.map +1 -1
- package/dist/pages/setPreviewData.d.cts.map +1 -0
- package/dist/pages/setPreviewData.d.ts.map +1 -0
- package/dist/pages/setPreviewData.js.map +1 -1
- package/dist/pages/types.d.cts +3 -8
- package/dist/pages/types.d.cts.map +1 -0
- package/dist/pages/types.d.ts +3 -8
- package/dist/pages/types.d.ts.map +1 -0
- package/dist/redirectToPreviewURL.cjs.map +1 -1
- package/dist/redirectToPreviewURL.d.cts +3 -5
- package/dist/redirectToPreviewURL.d.cts.map +1 -0
- package/dist/redirectToPreviewURL.d.ts +3 -5
- package/dist/redirectToPreviewURL.d.ts.map +1 -0
- package/dist/redirectToPreviewURL.js.map +1 -1
- package/dist/revalidatePrismicPages.cjs +20 -0
- package/dist/revalidatePrismicPages.cjs.map +1 -0
- package/dist/revalidatePrismicPages.d.cts +14 -0
- package/dist/revalidatePrismicPages.d.cts.map +1 -0
- package/dist/revalidatePrismicPages.d.ts +14 -0
- package/dist/revalidatePrismicPages.d.ts.map +1 -0
- package/dist/revalidatePrismicPages.js +19 -0
- package/dist/revalidatePrismicPages.js.map +1 -0
- package/dist/types.d.cts +1 -2
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +1 -2
- package/dist/types.d.ts.map +1 -0
- package/package.json +32 -34
- package/src/PrismicNextImage.tsx +113 -134
- package/src/PrismicNextLink.tsx +43 -45
- package/src/PrismicPreview.tsx +28 -29
- package/src/PrismicPreviewClient.tsx +42 -44
- package/src/SliceSimulator.tsx +38 -43
- package/src/SliceSimulatorWrapper.tsx +15 -25
- package/src/cacheTagPrismicPages.ts +20 -0
- package/src/createLocaleRedirect.ts +3 -3
- package/src/enableAutoPreviews.ts +7 -37
- package/src/exitPreview.ts +18 -13
- package/src/getPreviewRef.ts +51 -0
- package/src/getPrismicCacheTags.ts +46 -0
- package/src/getSlices.ts +6 -10
- package/src/imgixLoader.ts +10 -10
- package/src/index.ts +26 -21
- package/src/lib/devMsg.ts +9 -11
- package/src/lib/resolveDefaultExport.ts +9 -13
- package/src/pages/PrismicPreview.tsx +47 -51
- package/src/pages/SliceSimulator.tsx +35 -37
- package/src/pages/enableAutoPreviews.ts +17 -17
- package/src/pages/exitPreview.ts +17 -18
- package/src/pages/index.ts +20 -23
- package/src/pages/redirectToPreviewURL.ts +22 -33
- package/src/pages/setPreviewData.ts +7 -7
- package/src/pages/types.ts +16 -20
- package/src/redirectToPreviewURL.ts +21 -30
- package/src/revalidatePrismicPages.ts +19 -0
- package/src/types.ts +12 -13
package/dist/exitPreview.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
//#region src/exitPreview.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
4
|
-
*
|
|
3
|
+
* Ends a Prismic preview session within a Next.js app. This function should be used in a Router
|
|
4
|
+
* Handler.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
+
* ;```typescript
|
|
8
|
+
* // src/app/api/exit-preview/route.js
|
|
7
9
|
*
|
|
8
|
-
*
|
|
9
|
-
* // src/app/api/exit-preview/route.js
|
|
10
|
+
* import { exitPreview } from "@prismicio/next"
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
12
|
+
* export async function GET() {
|
|
13
|
+
* return await exitPreview()
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
17
16
|
*/
|
|
18
17
|
declare function exitPreview(): Promise<Response>;
|
|
19
18
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exitPreview.d.ts","names":[],"sources":["../src/exitPreview.ts"],"mappings":";;AAiBA;;;;;;;;;;;;;;iBAAsB,WAAA,CAAA,GAAe,OAAA,CAAQ,QAAA"}
|
package/dist/exitPreview.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
import { cookie } from "@prismicio/client";
|
|
1
2
|
//#region src/exitPreview.ts
|
|
2
3
|
/**
|
|
3
|
-
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
4
|
-
*
|
|
4
|
+
* Ends a Prismic preview session within a Next.js app. This function should be used in a Router
|
|
5
|
+
* Handler.
|
|
5
6
|
*
|
|
6
7
|
* @example
|
|
8
|
+
* ;```typescript
|
|
9
|
+
* // src/app/api/exit-preview/route.js
|
|
7
10
|
*
|
|
8
|
-
*
|
|
9
|
-
* // src/app/api/exit-preview/route.js
|
|
11
|
+
* import { exitPreview } from "@prismicio/next"
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
13
|
+
* export async function GET() {
|
|
14
|
+
* return await exitPreview()
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
17
|
*/
|
|
18
18
|
async function exitPreview() {
|
|
19
|
-
const { draftMode } = await import("next/headers.js");
|
|
19
|
+
const { cookies, draftMode } = await import("next/headers.js");
|
|
20
20
|
(await draftMode()).disable();
|
|
21
|
+
(await cookies()).delete(cookie.preview);
|
|
21
22
|
return new Response(JSON.stringify({ success: true }), { headers: { "Cache-Control": "no-store" } });
|
|
22
23
|
}
|
|
23
24
|
//#endregion
|
package/dist/exitPreview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitPreview.js","names":[],"sources":["../src/exitPreview.ts"],"sourcesContent":["/**\n * Ends a Prismic preview session within a Next.js app. This function should be
|
|
1
|
+
{"version":3,"file":"exitPreview.js","names":["prismicCookie"],"sources":["../src/exitPreview.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in a Router\n * Handler.\n *\n * @example\n * \t;```typescript\n * \t// src/app/api/exit-preview/route.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport async function GET() {\n * \t\treturn await exitPreview()\n * \t}\n * \t```\n */\nexport async function exitPreview(): Promise<Response> {\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;(await draftMode()).disable()\n\n\t// `redirectToPreviewURL` writes the preview cookie, so `exitPreview`\n\t// clears it to close the preview-cookie loop.\n\t;(await cookies()).delete(prismicCookie.preview)\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\theaders: {\n\t\t\t\"Cache-Control\": \"no-store\",\n\t\t},\n\t})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,eAAsB,cAAiC;CAItD,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;AAE3C,EAAC,MAAM,WAAW,EAAE,SAAS;AAI7B,EAAC,MAAM,SAAS,EAAE,OAAOA,OAAc,QAAQ;AAGhD,QAAO,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,MAAM,CAAC,EAAE,EACtD,SAAS,EACR,iBAAiB,YACjB,EACD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let _prismicio_client = require("@prismicio/client");
|
|
3
|
+
//#region src/getPreviewRef.ts
|
|
4
|
+
/**
|
|
5
|
+
* Reads the Prismic preview ref for the current request when an active preview session exists.
|
|
6
|
+
*
|
|
7
|
+
* This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use
|
|
8
|
+
* it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as
|
|
9
|
+
* an argument so it becomes part of the cache key:
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ;```typescript
|
|
13
|
+
* import { getPreviewRef } from "@prismicio/next"
|
|
14
|
+
*
|
|
15
|
+
* const page = await fetchPage(uid, await getPreviewRef())
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @returns The active preview ref, or `undefined` if no preview session is active.
|
|
19
|
+
* @experimental
|
|
20
|
+
*/
|
|
21
|
+
async function getPreviewRef() {
|
|
22
|
+
const { cookies, draftMode } = await import("next/headers.js");
|
|
23
|
+
let isDraftModeEnabled = false;
|
|
24
|
+
try {
|
|
25
|
+
isDraftModeEnabled = (await draftMode()).isEnabled;
|
|
26
|
+
} catch {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (!isDraftModeEnabled) return;
|
|
30
|
+
const cookie = (await cookies()).get(_prismicio_client.cookie.preview)?.value;
|
|
31
|
+
if (!cookie) return;
|
|
32
|
+
if (!cookie.includes("websitePreviewId=")) return;
|
|
33
|
+
return cookie;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.getPreviewRef = getPreviewRef;
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=getPreviewRef.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPreviewRef.cjs","names":["prismicCookie"],"sources":["../src/getPreviewRef.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Reads the Prismic preview ref for the current request when an active preview session exists.\n *\n * This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use\n * it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as\n * an argument so it becomes part of the cache key:\n *\n * @example\n * \t;```typescript\n * \timport { getPreviewRef } from \"@prismicio/next\"\n *\n * \tconst page = await fetchPage(uid, await getPreviewRef())\n * \t```\n *\n * @returns The active preview ref, or `undefined` if no preview session is active.\n * @experimental\n */\nexport async function getPreviewRef(): Promise<string | undefined> {\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\tlet isDraftModeEnabled = false\n\ttry {\n\t\tisDraftModeEnabled = (await draftMode()).isEnabled\n\t} catch {\n\t\t// `draftMode()` may have been called in a place that\n\t\t// does not have access to its async storage. This\n\t\t// occurs in places like `generateStaticParams()`. We\n\t\t// can ignore this case.\n\t\treturn\n\t}\n\tif (!isDraftModeEnabled) {\n\t\treturn\n\t}\n\n\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value\n\tif (!cookie) {\n\t\treturn\n\t}\n\n\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\")\n\tif (!isActiveCookie) {\n\t\treturn\n\t}\n\n\treturn cookie\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,eAAsB,gBAA6C;CAIlE,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAE5C,IAAI,qBAAqB;AACzB,KAAI;AACH,wBAAsB,MAAM,WAAW,EAAE;SAClC;AAKP;;AAED,KAAI,CAAC,mBACJ;CAGD,MAAM,UAAU,MAAM,SAAS,EAAE,IAAIA,kBAAAA,OAAc,QAAQ,EAAE;AAC7D,KAAI,CAAC,OACJ;AAID,KAAI,CADmB,OAAO,SAAS,oBAAoB,CAE1D;AAGD,QAAO"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/getPreviewRef.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Reads the Prismic preview ref for the current request when an active preview session exists.
|
|
4
|
+
*
|
|
5
|
+
* This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use
|
|
6
|
+
* it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as
|
|
7
|
+
* an argument so it becomes part of the cache key:
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ;```typescript
|
|
11
|
+
* import { getPreviewRef } from "@prismicio/next"
|
|
12
|
+
*
|
|
13
|
+
* const page = await fetchPage(uid, await getPreviewRef())
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @returns The active preview ref, or `undefined` if no preview session is active.
|
|
17
|
+
* @experimental
|
|
18
|
+
*/
|
|
19
|
+
declare function getPreviewRef(): Promise<string | undefined>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getPreviewRef };
|
|
22
|
+
//# sourceMappingURL=getPreviewRef.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPreviewRef.d.cts","names":[],"sources":["../src/getPreviewRef.ts"],"mappings":";;AAmBA;;;;;;;;;;;;;;;;iBAAsB,aAAA,CAAA,GAAiB,OAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/getPreviewRef.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Reads the Prismic preview ref for the current request when an active preview session exists.
|
|
4
|
+
*
|
|
5
|
+
* This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use
|
|
6
|
+
* it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as
|
|
7
|
+
* an argument so it becomes part of the cache key:
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ;```typescript
|
|
11
|
+
* import { getPreviewRef } from "@prismicio/next"
|
|
12
|
+
*
|
|
13
|
+
* const page = await fetchPage(uid, await getPreviewRef())
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @returns The active preview ref, or `undefined` if no preview session is active.
|
|
17
|
+
* @experimental
|
|
18
|
+
*/
|
|
19
|
+
declare function getPreviewRef(): Promise<string | undefined>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getPreviewRef };
|
|
22
|
+
//# sourceMappingURL=getPreviewRef.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPreviewRef.d.ts","names":[],"sources":["../src/getPreviewRef.ts"],"mappings":";;AAmBA;;;;;;;;;;;;;;;;iBAAsB,aAAA,CAAA,GAAiB,OAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { cookie } from "@prismicio/client";
|
|
2
|
+
//#region src/getPreviewRef.ts
|
|
3
|
+
/**
|
|
4
|
+
* Reads the Prismic preview ref for the current request when an active preview session exists.
|
|
5
|
+
*
|
|
6
|
+
* This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use
|
|
7
|
+
* it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as
|
|
8
|
+
* an argument so it becomes part of the cache key:
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ;```typescript
|
|
12
|
+
* import { getPreviewRef } from "@prismicio/next"
|
|
13
|
+
*
|
|
14
|
+
* const page = await fetchPage(uid, await getPreviewRef())
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @returns The active preview ref, or `undefined` if no preview session is active.
|
|
18
|
+
* @experimental
|
|
19
|
+
*/
|
|
20
|
+
async function getPreviewRef() {
|
|
21
|
+
const { cookies, draftMode } = await import("next/headers.js");
|
|
22
|
+
let isDraftModeEnabled = false;
|
|
23
|
+
try {
|
|
24
|
+
isDraftModeEnabled = (await draftMode()).isEnabled;
|
|
25
|
+
} catch {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!isDraftModeEnabled) return;
|
|
29
|
+
const cookie$1 = (await cookies()).get(cookie.preview)?.value;
|
|
30
|
+
if (!cookie$1) return;
|
|
31
|
+
if (!cookie$1.includes("websitePreviewId=")) return;
|
|
32
|
+
return cookie$1;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { getPreviewRef };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=getPreviewRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPreviewRef.js","names":["cookie","prismicCookie"],"sources":["../src/getPreviewRef.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Reads the Prismic preview ref for the current request when an active preview session exists.\n *\n * This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use\n * it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as\n * an argument so it becomes part of the cache key:\n *\n * @example\n * \t;```typescript\n * \timport { getPreviewRef } from \"@prismicio/next\"\n *\n * \tconst page = await fetchPage(uid, await getPreviewRef())\n * \t```\n *\n * @returns The active preview ref, or `undefined` if no preview session is active.\n * @experimental\n */\nexport async function getPreviewRef(): Promise<string | undefined> {\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\tlet isDraftModeEnabled = false\n\ttry {\n\t\tisDraftModeEnabled = (await draftMode()).isEnabled\n\t} catch {\n\t\t// `draftMode()` may have been called in a place that\n\t\t// does not have access to its async storage. This\n\t\t// occurs in places like `generateStaticParams()`. We\n\t\t// can ignore this case.\n\t\treturn\n\t}\n\tif (!isDraftModeEnabled) {\n\t\treturn\n\t}\n\n\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value\n\tif (!cookie) {\n\t\treturn\n\t}\n\n\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\")\n\tif (!isActiveCookie) {\n\t\treturn\n\t}\n\n\treturn cookie\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,eAAsB,gBAA6C;CAIlE,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAE5C,IAAI,qBAAqB;AACzB,KAAI;AACH,wBAAsB,MAAM,WAAW,EAAE;SAClC;AAKP;;AAED,KAAI,CAAC,mBACJ;CAGD,MAAMA,YAAU,MAAM,SAAS,EAAE,IAAIC,OAAc,QAAQ,EAAE;AAC7D,KAAI,CAACD,SACJ;AAID,KAAI,CADmBA,SAAO,SAAS,oBAAoB,CAE1D;AAGD,QAAOA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/getPrismicCacheTags.ts
|
|
2
|
+
const CACHE_TAG_PREFIX = "prismic/";
|
|
3
|
+
/**
|
|
4
|
+
* Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
|
|
5
|
+
* relationship) are included to ensure all related content can be revalidated.
|
|
6
|
+
*
|
|
7
|
+
* @param pages - A set of Prismic pages used to tag the function.
|
|
8
|
+
* @experimental
|
|
9
|
+
*
|
|
10
|
+
* @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
|
|
11
|
+
*/
|
|
12
|
+
function getPrismicCacheTags(pages) {
|
|
13
|
+
return [...new Set(getPrismicDocumentIDs(pages))].map((id) => buildPrismicCacheTag(id));
|
|
14
|
+
}
|
|
15
|
+
function buildPrismicCacheTag(id) {
|
|
16
|
+
return `${CACHE_TAG_PREFIX}${id}`;
|
|
17
|
+
}
|
|
18
|
+
function getPrismicDocumentIDs(input) {
|
|
19
|
+
if (typeof input !== "object" || input == null) return [];
|
|
20
|
+
if (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item));
|
|
21
|
+
if ("id" in input && typeof input.id === "string") {
|
|
22
|
+
if ("href" in input && typeof input.href === "string" && input.href.includes("/api/v2/documents/search?") || "link_type" in input && input.link_type === "Document") if ("data" in input && typeof input.data === "object" && input.data !== null) return [input.id, ...getPrismicDocumentIDs(input.data)];
|
|
23
|
+
else return [input.id];
|
|
24
|
+
}
|
|
25
|
+
return Object.values(input).flatMap((input) => getPrismicDocumentIDs(input));
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.buildPrismicCacheTag = buildPrismicCacheTag;
|
|
29
|
+
exports.getPrismicCacheTags = getPrismicCacheTags;
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=getPrismicCacheTags.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPrismicCacheTags.cjs","names":[],"sources":["../src/getPrismicCacheTags.ts"],"sourcesContent":["import type { PrismicDocument } from \"@prismicio/client\"\n\nconst CACHE_TAG_PREFIX = \"prismic/\"\n\n/**\n * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content\n * relationship) are included to ensure all related content can be revalidated.\n *\n * @param pages - A set of Prismic pages used to tag the function.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}\n */\nexport function getPrismicCacheTags(pages: PrismicDocument[]): string[] {\n\tconst ids = [...new Set(getPrismicDocumentIDs(pages))]\n\treturn ids.map((id) => buildPrismicCacheTag(id))\n}\n\nexport function buildPrismicCacheTag(id: string): string {\n\treturn `${CACHE_TAG_PREFIX}${id}`\n}\n\nfunction getPrismicDocumentIDs(input: unknown): string[] {\n\tif (typeof input !== \"object\" || input == null) return []\n\n\tif (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item))\n\n\tif (\"id\" in input && typeof input.id === \"string\") {\n\t\t// Document\n\t\t// Content relationship or link\n\t\tif (\n\t\t\t(\"href\" in input &&\n\t\t\t\ttypeof input.href === \"string\" &&\n\t\t\t\tinput.href.includes(\"/api/v2/documents/search?\")) ||\n\t\t\t(\"link_type\" in input && input.link_type === \"Document\")\n\t\t) {\n\t\t\tif (\"data\" in input && typeof input.data === \"object\" && input.data !== null) {\n\t\t\t\treturn [input.id, ...getPrismicDocumentIDs(input.data)]\n\t\t\t} else {\n\t\t\t\treturn [input.id]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.values(input).flatMap((input) => getPrismicDocumentIDs(input))\n}\n"],"mappings":";AAEA,MAAM,mBAAmB;;;;;;;;;;AAWzB,SAAgB,oBAAoB,OAAoC;AAEvE,QADY,CAAC,GAAG,IAAI,IAAI,sBAAsB,MAAM,CAAC,CAAC,CAC3C,KAAK,OAAO,qBAAqB,GAAG,CAAC;;AAGjD,SAAgB,qBAAqB,IAAoB;AACxD,QAAO,GAAG,mBAAmB;;AAG9B,SAAS,sBAAsB,OAA0B;AACxD,KAAI,OAAO,UAAU,YAAY,SAAS,KAAM,QAAO,EAAE;AAEzD,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,SAAS,SAAS,sBAAsB,KAAK,CAAC;AAErF,KAAI,QAAQ,SAAS,OAAO,MAAM,OAAO;MAItC,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,KAAK,SAAS,4BAA4B,IAChD,eAAe,SAAS,MAAM,cAAc,WAE7C,KAAI,UAAU,SAAS,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,KACvE,QAAO,CAAC,MAAM,IAAI,GAAG,sBAAsB,MAAM,KAAK,CAAC;MAEvD,QAAO,CAAC,MAAM,GAAG;;AAKpB,QAAO,OAAO,OAAO,MAAM,CAAC,SAAS,UAAU,sBAAsB,MAAM,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PrismicDocument } from "@prismicio/client";
|
|
2
|
+
|
|
3
|
+
//#region src/getPrismicCacheTags.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
|
|
6
|
+
* relationship) are included to ensure all related content can be revalidated.
|
|
7
|
+
*
|
|
8
|
+
* @param pages - A set of Prismic pages used to tag the function.
|
|
9
|
+
* @experimental
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
|
|
12
|
+
*/
|
|
13
|
+
declare function getPrismicCacheTags(pages: PrismicDocument[]): string[];
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getPrismicCacheTags };
|
|
16
|
+
//# sourceMappingURL=getPrismicCacheTags.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPrismicCacheTags.d.cts","names":[],"sources":["../src/getPrismicCacheTags.ts"],"mappings":";;;;;AAaA;;;;;;;iBAAgB,mBAAA,CAAoB,KAAA,EAAO,eAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PrismicDocument } from "@prismicio/client";
|
|
2
|
+
|
|
3
|
+
//#region src/getPrismicCacheTags.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
|
|
6
|
+
* relationship) are included to ensure all related content can be revalidated.
|
|
7
|
+
*
|
|
8
|
+
* @param pages - A set of Prismic pages used to tag the function.
|
|
9
|
+
* @experimental
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
|
|
12
|
+
*/
|
|
13
|
+
declare function getPrismicCacheTags(pages: PrismicDocument[]): string[];
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getPrismicCacheTags };
|
|
16
|
+
//# sourceMappingURL=getPrismicCacheTags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPrismicCacheTags.d.ts","names":[],"sources":["../src/getPrismicCacheTags.ts"],"mappings":";;;;;AAaA;;;;;;;iBAAgB,mBAAA,CAAoB,KAAA,EAAO,eAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/getPrismicCacheTags.ts
|
|
2
|
+
const CACHE_TAG_PREFIX = "prismic/";
|
|
3
|
+
/**
|
|
4
|
+
* Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
|
|
5
|
+
* relationship) are included to ensure all related content can be revalidated.
|
|
6
|
+
*
|
|
7
|
+
* @param pages - A set of Prismic pages used to tag the function.
|
|
8
|
+
* @experimental
|
|
9
|
+
*
|
|
10
|
+
* @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
|
|
11
|
+
*/
|
|
12
|
+
function getPrismicCacheTags(pages) {
|
|
13
|
+
return [...new Set(getPrismicDocumentIDs(pages))].map((id) => buildPrismicCacheTag(id));
|
|
14
|
+
}
|
|
15
|
+
function buildPrismicCacheTag(id) {
|
|
16
|
+
return `${CACHE_TAG_PREFIX}${id}`;
|
|
17
|
+
}
|
|
18
|
+
function getPrismicDocumentIDs(input) {
|
|
19
|
+
if (typeof input !== "object" || input == null) return [];
|
|
20
|
+
if (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item));
|
|
21
|
+
if ("id" in input && typeof input.id === "string") {
|
|
22
|
+
if ("href" in input && typeof input.href === "string" && input.href.includes("/api/v2/documents/search?") || "link_type" in input && input.link_type === "Document") if ("data" in input && typeof input.data === "object" && input.data !== null) return [input.id, ...getPrismicDocumentIDs(input.data)];
|
|
23
|
+
else return [input.id];
|
|
24
|
+
}
|
|
25
|
+
return Object.values(input).flatMap((input) => getPrismicDocumentIDs(input));
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { buildPrismicCacheTag, getPrismicCacheTags };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=getPrismicCacheTags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPrismicCacheTags.js","names":[],"sources":["../src/getPrismicCacheTags.ts"],"sourcesContent":["import type { PrismicDocument } from \"@prismicio/client\"\n\nconst CACHE_TAG_PREFIX = \"prismic/\"\n\n/**\n * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content\n * relationship) are included to ensure all related content can be revalidated.\n *\n * @param pages - A set of Prismic pages used to tag the function.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}\n */\nexport function getPrismicCacheTags(pages: PrismicDocument[]): string[] {\n\tconst ids = [...new Set(getPrismicDocumentIDs(pages))]\n\treturn ids.map((id) => buildPrismicCacheTag(id))\n}\n\nexport function buildPrismicCacheTag(id: string): string {\n\treturn `${CACHE_TAG_PREFIX}${id}`\n}\n\nfunction getPrismicDocumentIDs(input: unknown): string[] {\n\tif (typeof input !== \"object\" || input == null) return []\n\n\tif (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item))\n\n\tif (\"id\" in input && typeof input.id === \"string\") {\n\t\t// Document\n\t\t// Content relationship or link\n\t\tif (\n\t\t\t(\"href\" in input &&\n\t\t\t\ttypeof input.href === \"string\" &&\n\t\t\t\tinput.href.includes(\"/api/v2/documents/search?\")) ||\n\t\t\t(\"link_type\" in input && input.link_type === \"Document\")\n\t\t) {\n\t\t\tif (\"data\" in input && typeof input.data === \"object\" && input.data !== null) {\n\t\t\t\treturn [input.id, ...getPrismicDocumentIDs(input.data)]\n\t\t\t} else {\n\t\t\t\treturn [input.id]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.values(input).flatMap((input) => getPrismicDocumentIDs(input))\n}\n"],"mappings":";AAEA,MAAM,mBAAmB;;;;;;;;;;AAWzB,SAAgB,oBAAoB,OAAoC;AAEvE,QADY,CAAC,GAAG,IAAI,IAAI,sBAAsB,MAAM,CAAC,CAAC,CAC3C,KAAK,OAAO,qBAAqB,GAAG,CAAC;;AAGjD,SAAgB,qBAAqB,IAAoB;AACxD,QAAO,GAAG,mBAAmB;;AAG9B,SAAS,sBAAsB,OAA0B;AACxD,KAAI,OAAO,UAAU,YAAY,SAAS,KAAM,QAAO,EAAE;AAEzD,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,SAAS,SAAS,sBAAsB,KAAK,CAAC;AAErF,KAAI,QAAQ,SAAS,OAAO,MAAM,OAAO;MAItC,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,KAAK,SAAS,4BAA4B,IAChD,eAAe,SAAS,MAAM,cAAc,WAE7C,KAAI,UAAU,SAAS,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,KACvE,QAAO,CAAC,MAAM,IAAI,GAAG,sBAAsB,MAAM,KAAK,CAAC;MAEvD,QAAO,CAAC,MAAM,GAAG;;AAKpB,QAAO,OAAO,OAAO,MAAM,CAAC,SAAS,UAAU,sBAAsB,MAAM,CAAC"}
|
package/dist/getSlices.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSlices.cjs","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"
|
|
1
|
+
{"version":3,"file":"getSlices.cjs","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport { decompressFromEncodedURIComponent } from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;;AAIA,MAAa,aAAa,UAAyE;AAClG,QAAO,QAAQ,KAAK,OAAA,GAAA,UAAA,mCAAwC,MAAM,CAAC,IAAA,GAAA,yBAAA,mBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSlices.d.cts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;;cAIa,SAAA,GAAa,KAAA,gCAAmC,WAAA,CAAY,cAAA,CAAe,MAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSlices.d.ts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;;cAIa,SAAA,GAAa,KAAA,gCAAmC,WAAA,CAAY,cAAA,CAAe,MAAA"}
|
package/dist/getSlices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSlices.js","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"
|
|
1
|
+
{"version":3,"file":"getSlices.js","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport { decompressFromEncodedURIComponent } from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;AAIA,MAAa,aAAa,UAAyE;AAClG,QAAO,QAAQ,KAAK,MAAM,kCAAkC,MAAM,CAAC,GAAG,kBAAkB"}
|
package/dist/imgixLoader.cjs
CHANGED
|
@@ -2,8 +2,8 @@ require("./_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
let imgix_url_builder = require("imgix-url-builder");
|
|
3
3
|
//#region src/imgixLoader.ts
|
|
4
4
|
/**
|
|
5
|
-
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
6
|
-
*
|
|
5
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
|
|
6
|
+
* parameters.
|
|
7
7
|
*
|
|
8
8
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
9
9
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
package/dist/imgixLoader.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imgixLoader.cjs","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"imgixLoader.cjs","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImgixURLParams } from \"imgix-url-builder\"\nimport { buildURL } from \"imgix-url-builder\"\nimport type { ImageLoaderProps } from \"next/image\"\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix\n * parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src)\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t}\n\n\tif (args.quality) {\n\t\tparams.q = args.quality\n\t}\n\n\treturn buildURL(args.src, params)\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,eAAe,SAAmC;CAG9D,MAAM,SAAyB;EAC9B,KAHW,IAAI,IAAI,KAAK,IAAI,CAGlB,aAAa,IAAI,MAAM,IAA8B;EAC/D,GAAG,KAAK;EACR,GAAG,KAAA;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,SAAA,GAAA,kBAAA,UAAgB,KAAK,KAAK,OAAO"}
|
package/dist/imgixLoader.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import { ImageLoaderProps } from "next/image.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/imgixLoader.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
6
|
-
*
|
|
5
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
|
|
6
|
+
* parameters.
|
|
7
7
|
*
|
|
8
8
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
9
9
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imgixLoader.d.cts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;AAWA;;;;;cAAa,WAAA,GAAe,IAAA,EAAM,gBAAA"}
|
package/dist/imgixLoader.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ImageLoaderProps } from "next/image.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/imgixLoader.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
6
|
-
*
|
|
5
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
|
|
6
|
+
* parameters.
|
|
7
7
|
*
|
|
8
8
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
9
9
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imgixLoader.d.ts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;AAWA;;;;;cAAa,WAAA,GAAe,IAAA,EAAM,gBAAA"}
|
package/dist/imgixLoader.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildURL } from "imgix-url-builder";
|
|
2
2
|
//#region src/imgixLoader.ts
|
|
3
3
|
/**
|
|
4
|
-
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
5
|
-
*
|
|
4
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
|
|
5
|
+
* parameters.
|
|
6
6
|
*
|
|
7
7
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
8
8
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
package/dist/imgixLoader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imgixLoader.js","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"imgixLoader.js","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImgixURLParams } from \"imgix-url-builder\"\nimport { buildURL } from \"imgix-url-builder\"\nimport type { ImageLoaderProps } from \"next/image\"\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix\n * parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src)\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t}\n\n\tif (args.quality) {\n\t\tparams.q = args.quality\n\t}\n\n\treturn buildURL(args.src, params)\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,eAAe,SAAmC;CAG9D,MAAM,SAAyB;EAC9B,KAHW,IAAI,IAAI,KAAK,IAAI,CAGlB,aAAa,IAAI,MAAM,IAA8B;EAC/D,GAAG,KAAK;EACR,GAAG,KAAA;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,QAAO,SAAS,KAAK,KAAK,OAAO"}
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_exitPreview = require("./exitPreview.cjs");
|
|
3
3
|
const require_PrismicPreview = require("./PrismicPreview.cjs");
|
|
4
4
|
const require_PrismicNextLink = require("./PrismicNextLink.cjs");
|
|
5
|
+
const require_getPreviewRef = require("./getPreviewRef.cjs");
|
|
5
6
|
const require_enableAutoPreviews = require("./enableAutoPreviews.cjs");
|
|
6
7
|
const require_redirectToPreviewURL = require("./redirectToPreviewURL.cjs");
|
|
7
8
|
const require_imgixLoader = require("./imgixLoader.cjs");
|
|
@@ -9,13 +10,20 @@ const require_PrismicNextImage = require("./PrismicNextImage.cjs");
|
|
|
9
10
|
const require_getSlices = require("./getSlices.cjs");
|
|
10
11
|
const require_SliceSimulator = require("./SliceSimulator.cjs");
|
|
11
12
|
const require_createLocaleRedirect = require("./createLocaleRedirect.cjs");
|
|
13
|
+
const require_getPrismicCacheTags = require("./getPrismicCacheTags.cjs");
|
|
14
|
+
const require_cacheTagPrismicPages = require("./cacheTagPrismicPages.cjs");
|
|
15
|
+
const require_revalidatePrismicPages = require("./revalidatePrismicPages.cjs");
|
|
12
16
|
exports.PrismicNextImage = require_PrismicNextImage.PrismicNextImage;
|
|
13
17
|
exports.PrismicNextLink = require_PrismicNextLink.PrismicNextLink;
|
|
14
18
|
exports.PrismicPreview = require_PrismicPreview.PrismicPreview;
|
|
15
19
|
exports.SliceSimulator = require_SliceSimulator.SliceSimulator;
|
|
20
|
+
exports.cacheTagPrismicPages = require_cacheTagPrismicPages.cacheTagPrismicPages;
|
|
16
21
|
exports.createLocaleRedirect = require_createLocaleRedirect.createLocaleRedirect;
|
|
17
22
|
exports.enableAutoPreviews = require_enableAutoPreviews.enableAutoPreviews;
|
|
18
23
|
exports.exitPreview = require_exitPreview.exitPreview;
|
|
24
|
+
exports.getPreviewRef = require_getPreviewRef.getPreviewRef;
|
|
25
|
+
exports.getPrismicCacheTags = require_getPrismicCacheTags.getPrismicCacheTags;
|
|
19
26
|
exports.getSlices = require_getSlices.getSlices;
|
|
20
27
|
exports.imgixLoader = require_imgixLoader.imgixLoader;
|
|
21
28
|
exports.redirectToPreviewURL = require_redirectToPreviewURL.redirectToPreviewURL;
|
|
29
|
+
exports.revalidatePrismicPages = require_revalidatePrismicPages.revalidatePrismicPages;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import { exitPreview } from "./exitPreview.cjs";
|
|
|
2
2
|
import { PrismicPreview, PrismicPreviewProps } from "./PrismicPreview.cjs";
|
|
3
3
|
import { PrismicNextLink, PrismicNextLinkProps } from "./PrismicNextLink.cjs";
|
|
4
4
|
import { EnableAutoPreviewsConfig, enableAutoPreviews } from "./enableAutoPreviews.cjs";
|
|
5
|
+
import { getPreviewRef } from "./getPreviewRef.cjs";
|
|
5
6
|
import { CreateClientConfig } from "./types.cjs";
|
|
6
7
|
import { RedirectToPreviewURLConfig, redirectToPreviewURL } from "./redirectToPreviewURL.cjs";
|
|
7
8
|
import { PrismicNextImage, PrismicNextImageProps } from "./PrismicNextImage.cjs";
|
|
@@ -9,4 +10,7 @@ import { SliceSimulator, SliceSimulatorParams, SliceSimulatorProps } from "./Sli
|
|
|
9
10
|
import { getSlices } from "./getSlices.cjs";
|
|
10
11
|
import { imgixLoader } from "./imgixLoader.cjs";
|
|
11
12
|
import { CreateLocaleRedirectConfig, createLocaleRedirect } from "./createLocaleRedirect.cjs";
|
|
12
|
-
|
|
13
|
+
import { getPrismicCacheTags } from "./getPrismicCacheTags.cjs";
|
|
14
|
+
import { cacheTagPrismicPages } from "./cacheTagPrismicPages.cjs";
|
|
15
|
+
import { revalidatePrismicPages } from "./revalidatePrismicPages.cjs";
|
|
16
|
+
export { type CreateClientConfig, type CreateLocaleRedirectConfig, type EnableAutoPreviewsConfig, PrismicNextImage, type PrismicNextImageProps, PrismicNextLink, type PrismicNextLinkProps, PrismicPreview, type PrismicPreviewProps, type RedirectToPreviewURLConfig, SliceSimulator, type SliceSimulatorParams, type SliceSimulatorProps, cacheTagPrismicPages, createLocaleRedirect, enableAutoPreviews, exitPreview, getPreviewRef, getPrismicCacheTags, getSlices, imgixLoader, redirectToPreviewURL, revalidatePrismicPages };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { exitPreview } from "./exitPreview.js";
|
|
|
2
2
|
import { PrismicPreview, PrismicPreviewProps } from "./PrismicPreview.js";
|
|
3
3
|
import { PrismicNextLink, PrismicNextLinkProps } from "./PrismicNextLink.js";
|
|
4
4
|
import { EnableAutoPreviewsConfig, enableAutoPreviews } from "./enableAutoPreviews.js";
|
|
5
|
+
import { getPreviewRef } from "./getPreviewRef.js";
|
|
5
6
|
import { CreateClientConfig } from "./types.js";
|
|
6
7
|
import { RedirectToPreviewURLConfig, redirectToPreviewURL } from "./redirectToPreviewURL.js";
|
|
7
8
|
import { PrismicNextImage, PrismicNextImageProps } from "./PrismicNextImage.js";
|
|
@@ -9,4 +10,7 @@ import { SliceSimulator, SliceSimulatorParams, SliceSimulatorProps } from "./Sli
|
|
|
9
10
|
import { getSlices } from "./getSlices.js";
|
|
10
11
|
import { imgixLoader } from "./imgixLoader.js";
|
|
11
12
|
import { CreateLocaleRedirectConfig, createLocaleRedirect } from "./createLocaleRedirect.js";
|
|
12
|
-
|
|
13
|
+
import { getPrismicCacheTags } from "./getPrismicCacheTags.js";
|
|
14
|
+
import { cacheTagPrismicPages } from "./cacheTagPrismicPages.js";
|
|
15
|
+
import { revalidatePrismicPages } from "./revalidatePrismicPages.js";
|
|
16
|
+
export { type CreateClientConfig, type CreateLocaleRedirectConfig, type EnableAutoPreviewsConfig, PrismicNextImage, type PrismicNextImageProps, PrismicNextLink, type PrismicNextLinkProps, PrismicPreview, type PrismicPreviewProps, type RedirectToPreviewURLConfig, SliceSimulator, type SliceSimulatorParams, type SliceSimulatorProps, cacheTagPrismicPages, createLocaleRedirect, enableAutoPreviews, exitPreview, getPreviewRef, getPrismicCacheTags, getSlices, imgixLoader, redirectToPreviewURL, revalidatePrismicPages };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { exitPreview } from "./exitPreview.js";
|
|
2
2
|
import { PrismicPreview } from "./PrismicPreview.js";
|
|
3
3
|
import { PrismicNextLink } from "./PrismicNextLink.js";
|
|
4
|
+
import { getPreviewRef } from "./getPreviewRef.js";
|
|
4
5
|
import { enableAutoPreviews } from "./enableAutoPreviews.js";
|
|
5
6
|
import { redirectToPreviewURL } from "./redirectToPreviewURL.js";
|
|
6
7
|
import { imgixLoader } from "./imgixLoader.js";
|
|
@@ -8,4 +9,7 @@ import { PrismicNextImage } from "./PrismicNextImage.js";
|
|
|
8
9
|
import { getSlices } from "./getSlices.js";
|
|
9
10
|
import { SliceSimulator } from "./SliceSimulator.js";
|
|
10
11
|
import { createLocaleRedirect } from "./createLocaleRedirect.js";
|
|
11
|
-
|
|
12
|
+
import { getPrismicCacheTags } from "./getPrismicCacheTags.js";
|
|
13
|
+
import { cacheTagPrismicPages } from "./cacheTagPrismicPages.js";
|
|
14
|
+
import { revalidatePrismicPages } from "./revalidatePrismicPages.js";
|
|
15
|
+
export { PrismicNextImage, PrismicNextLink, PrismicPreview, SliceSimulator, cacheTagPrismicPages, createLocaleRedirect, enableAutoPreviews, exitPreview, getPreviewRef, getPrismicCacheTags, getSlices, imgixLoader, redirectToPreviewURL, revalidatePrismicPages };
|
package/dist/lib/devMsg.cjs
CHANGED
|
@@ -4,15 +4,13 @@ const require_package = require("../package.cjs");
|
|
|
4
4
|
* Returns a `prismic.dev/msg` URL for a given message slug.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
+
* ;```ts
|
|
8
|
+
* devMsg("missing-param")
|
|
9
|
+
* // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
|
|
10
|
+
* ```
|
|
7
11
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @param slug - Slug for the message. This corresponds to a Markdown file in
|
|
14
|
-
* the Git repository's `/messages` directory.
|
|
15
|
-
*
|
|
12
|
+
* @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
|
|
13
|
+
* `/messages` directory.
|
|
16
14
|
* @returns The `prismic.dev/msg` URL for the given slug.
|
|
17
15
|
*/
|
|
18
16
|
const devMsg = (slug) => {
|
package/dist/lib/devMsg.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"
|
|
1
|
+
{"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiCA,gBAAAA,QAAQ,GAAG"}
|
package/dist/lib/devMsg.js
CHANGED
|
@@ -4,15 +4,13 @@ import { version } from "../package.js";
|
|
|
4
4
|
* Returns a `prismic.dev/msg` URL for a given message slug.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
+
* ;```ts
|
|
8
|
+
* devMsg("missing-param")
|
|
9
|
+
* // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
|
|
10
|
+
* ```
|
|
7
11
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @param slug - Slug for the message. This corresponds to a Markdown file in
|
|
14
|
-
* the Git repository's `/messages` directory.
|
|
15
|
-
*
|
|
12
|
+
* @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
|
|
13
|
+
* `/messages` directory.
|
|
16
14
|
* @returns The `prismic.dev/msg` URL for the given slug.
|
|
17
15
|
*/
|
|
18
16
|
const devMsg = (slug) => {
|
package/dist/lib/devMsg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"
|
|
1
|
+
{"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiC,QAAQ,GAAG"}
|