@prismicio/next 1.7.1 → 2.0.0-alpha.0
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/README.md +5 -3
- package/dist/PrismicNextImage.d.ts +7 -8
- package/dist/PrismicNextImage.js +8 -8
- package/dist/PrismicNextImage.js.map +1 -1
- package/dist/PrismicNextLink.d.ts +99 -100
- package/dist/PrismicNextLink.js +3 -5
- package/dist/PrismicNextLink.js.map +1 -1
- package/dist/PrismicPreview.d.ts +5 -13
- package/dist/PrismicPreview.js +6 -19
- package/dist/PrismicPreview.js.map +1 -1
- package/dist/PrismicPreviewClient.d.ts +5 -3
- package/dist/PrismicPreviewClient.js +58 -69
- package/dist/PrismicPreviewClient.js.map +1 -1
- package/dist/createLocaleRedirect.d.ts +8 -15
- package/dist/createLocaleRedirect.js +4 -28
- package/dist/createLocaleRedirect.js.map +1 -1
- package/dist/enableAutoPreviews.d.ts +7 -31
- package/dist/enableAutoPreviews.js +24 -35
- package/dist/enableAutoPreviews.js.map +1 -1
- package/dist/exitPreview.d.ts +4 -46
- package/dist/exitPreview.js +8 -15
- package/dist/exitPreview.js.map +1 -1
- package/dist/imgixLoader.js.map +1 -1
- package/dist/index.d.ts +15 -18
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/devMsg.d.ts +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/pages/PrismicPreview.d.ts +31 -0
- package/dist/pages/PrismicPreview.js +64 -0
- package/dist/pages/PrismicPreview.js.map +1 -0
- package/dist/pages/enableAutoPreviews.d.ts +31 -0
- package/dist/pages/enableAutoPreviews.js +19 -0
- package/dist/pages/enableAutoPreviews.js.map +1 -0
- package/dist/pages/exitPreview.d.ts +33 -0
- package/dist/pages/exitPreview.js +10 -0
- package/dist/pages/exitPreview.js.map +1 -0
- package/dist/pages/index.d.ts +18 -0
- package/dist/pages/redirectToPreviewURL.d.ts +43 -0
- package/dist/pages/redirectToPreviewURL.js +16 -0
- package/dist/pages/redirectToPreviewURL.js.map +1 -0
- package/dist/{setPreviewData.d.ts → pages/setPreviewData.d.ts} +3 -9
- package/dist/{setPreviewData.js → pages/setPreviewData.js} +2 -2
- package/dist/pages/setPreviewData.js.map +1 -0
- package/dist/pages/types.d.ts +30 -0
- package/dist/pages.js +21 -0
- package/dist/pages.js.map +1 -0
- package/dist/redirectToPreviewURL.d.ts +11 -41
- package/dist/redirectToPreviewURL.js +16 -22
- package/dist/redirectToPreviewURL.js.map +1 -1
- package/dist/types.d.ts +2 -51
- package/package.json +61 -54
- package/src/PrismicNextImage.tsx +19 -16
- package/src/PrismicNextLink.tsx +17 -13
- package/src/PrismicPreview.tsx +20 -50
- package/src/PrismicPreviewClient.tsx +111 -138
- package/src/createLocaleRedirect.ts +14 -56
- package/src/enableAutoPreviews.ts +38 -110
- package/src/exitPreview.ts +18 -81
- package/src/index.ts +15 -26
- package/src/lib/devMsg.ts +1 -1
- package/src/pages/PrismicPreview.tsx +145 -0
- package/src/pages/enableAutoPreviews.ts +62 -0
- package/src/pages/exitPreview.ts +45 -0
- package/src/pages/index.ts +27 -0
- package/src/pages/redirectToPreviewURL.ts +77 -0
- package/src/{setPreviewData.ts → pages/setPreviewData.ts} +5 -11
- package/src/pages/types.ts +36 -0
- package/src/redirectToPreviewURL.ts +44 -95
- package/src/types.ts +2 -56
- package/dist/PrismicNextImage.cjs +0 -64
- package/dist/PrismicNextImage.cjs.map +0 -1
- package/dist/PrismicNextLink.cjs +0 -40
- package/dist/PrismicNextLink.cjs.map +0 -1
- package/dist/PrismicPreview.cjs +0 -28
- package/dist/PrismicPreview.cjs.map +0 -1
- package/dist/PrismicPreviewClient.cjs +0 -81
- package/dist/PrismicPreviewClient.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/cookie.cjs +0 -5
- package/dist/_node_modules/@prismicio/client/dist/cookie.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/cookie.js +0 -5
- package/dist/_node_modules/@prismicio/client/dist/cookie.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs +0 -16
- package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js +0 -16
- package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs +0 -13
- package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js +0 -13
- package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs +0 -47
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js +0 -47
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs +0 -28
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js +0 -28
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.cjs +0 -27
- package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.js +0 -27
- package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs +0 -14
- package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js +0 -14
- package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs +0 -7
- package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js +0 -7
- package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.cjs +0 -9
- package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.js +0 -9
- package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.js.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/types/value/link.cjs +0 -10
- package/dist/_node_modules/@prismicio/client/dist/types/value/link.cjs.map +0 -1
- package/dist/_node_modules/@prismicio/client/dist/types/value/link.js +0 -10
- package/dist/_node_modules/@prismicio/client/dist/types/value/link.js.map +0 -1
- package/dist/createLocaleRedirect.cjs +0 -32
- package/dist/createLocaleRedirect.cjs.map +0 -1
- package/dist/enableAutoPreviews.cjs +0 -40
- package/dist/enableAutoPreviews.cjs.map +0 -1
- package/dist/exitPreview.cjs +0 -20
- package/dist/exitPreview.cjs.map +0 -1
- package/dist/imgixLoader.cjs +0 -17
- package/dist/imgixLoader.cjs.map +0 -1
- package/dist/index.cjs +0 -21
- package/dist/index.cjs.map +0 -1
- package/dist/lib/devMsg.cjs +0 -8
- package/dist/lib/devMsg.cjs.map +0 -1
- package/dist/lib/getPreviewCookieRepositoryName.cjs +0 -7
- package/dist/lib/getPreviewCookieRepositoryName.cjs.map +0 -1
- package/dist/lib/getPreviewCookieRepositoryName.d.ts +0 -9
- package/dist/lib/getPreviewCookieRepositoryName.js +0 -7
- package/dist/lib/getPreviewCookieRepositoryName.js.map +0 -1
- package/dist/lib/getPrismicPreviewCookie.cjs +0 -21
- package/dist/lib/getPrismicPreviewCookie.cjs.map +0 -1
- package/dist/lib/getPrismicPreviewCookie.d.ts +0 -9
- package/dist/lib/getPrismicPreviewCookie.js +0 -21
- package/dist/lib/getPrismicPreviewCookie.js.map +0 -1
- package/dist/package.json.cjs +0 -5
- package/dist/package.json.cjs.map +0 -1
- package/dist/redirectToPreviewURL.cjs +0 -30
- package/dist/redirectToPreviewURL.cjs.map +0 -1
- package/dist/setPreviewData.cjs +0 -11
- package/dist/setPreviewData.cjs.map +0 -1
- package/dist/setPreviewData.js.map +0 -1
- package/src/lib/getPreviewCookieRepositoryName.ts +0 -14
- package/src/lib/getPrismicPreviewCookie.ts +0 -33
|
@@ -1,80 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
'use client';
|
|
1
|
+
"use client";
|
|
3
2
|
import { useEffect } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import { useRouter
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let isPreviewActive = isDraftMode;
|
|
10
|
-
let isAppRouter = true;
|
|
11
|
-
let basePath = "";
|
|
12
|
-
let refresh;
|
|
13
|
-
try {
|
|
14
|
-
const router = useRouter();
|
|
15
|
-
isAppRouter = false;
|
|
16
|
-
basePath = router.basePath;
|
|
17
|
-
isPreviewActive || (isPreviewActive = router.isPreview);
|
|
18
|
-
refresh = () => router.replace(router.asPath, void 0, { scroll: false });
|
|
19
|
-
} catch {
|
|
20
|
-
const router = useRouter$1();
|
|
21
|
-
refresh = router.refresh;
|
|
22
|
-
}
|
|
3
|
+
import { cookie } from "@prismicio/client";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
5
|
+
function PrismicPreviewClient(props) {
|
|
6
|
+
const { repositoryName, isDraftMode, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" } = props;
|
|
7
|
+
const { refresh } = useRouter();
|
|
23
8
|
useEffect(() => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
const controller = new AbortController();
|
|
10
|
+
window.addEventListener("prismicPreviewUpdate", onUpdate, {
|
|
11
|
+
signal: controller.signal
|
|
12
|
+
});
|
|
13
|
+
window.addEventListener("prismicPreviewEnd", onEnd, {
|
|
14
|
+
signal: controller.signal
|
|
15
|
+
});
|
|
16
|
+
const cookie2 = getPrismicPreviewCookie(window.document.cookie);
|
|
17
|
+
const cookieRepositoryName = cookie2 ? (decodeURIComponent(cookie2).match(/"([^"]+)\.prismic\.io"/) || [])[1] : void 0;
|
|
18
|
+
const hasCookieForRepository = cookieRepositoryName === repositoryName;
|
|
19
|
+
if (hasCookieForRepository && !isDraftMode) {
|
|
20
|
+
console.log("starting preview link");
|
|
21
|
+
globalThis.fetch(updatePreviewURL, {
|
|
22
|
+
redirect: "manual",
|
|
23
|
+
signal: controller.signal
|
|
24
|
+
}).then((res) => {
|
|
25
|
+
if (res.type !== "opaqueredirect") {
|
|
26
|
+
console.error(`[<PrismicPreview>] Failed to start the preview using "${updatePreviewURL}". Does it exist?`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
36
29
|
refresh();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
}).catch(() => {
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function onUpdate() {
|
|
34
|
+
refresh();
|
|
35
|
+
}
|
|
36
|
+
function onEnd(event) {
|
|
42
37
|
event.preventDefault();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} else {
|
|
48
|
-
console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${resolvedExitPreviewURL}" API endpoint. Does it exist?`);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
window.addEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
|
|
52
|
-
window.addEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
|
|
53
|
-
if (!isPreviewActive) {
|
|
54
|
-
const prismicPreviewCookie = getPrismicPreviewCookie(globalThis.document.cookie);
|
|
55
|
-
if (prismicPreviewCookie) {
|
|
56
|
-
const locationIsDescendantOfBasePath = window.location.href.startsWith(window.location.origin + basePath);
|
|
57
|
-
const prismicPreviewCookieRepositoryName = getPreviewCookieRepositoryName(prismicPreviewCookie);
|
|
58
|
-
if (locationIsDescendantOfBasePath && prismicPreviewCookieRepositoryName === repositoryName) {
|
|
59
|
-
startPreviewMode();
|
|
38
|
+
globalThis.fetch(exitPreviewURL, { signal: controller.signal }).then((res) => {
|
|
39
|
+
if (!res.ok) {
|
|
40
|
+
console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${exitPreviewURL}" API endpoint. Does it exist?`);
|
|
41
|
+
return;
|
|
60
42
|
}
|
|
61
|
-
|
|
43
|
+
refresh();
|
|
44
|
+
}).catch(() => {
|
|
45
|
+
});
|
|
62
46
|
}
|
|
63
|
-
return () =>
|
|
64
|
-
|
|
65
|
-
window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
|
|
66
|
-
};
|
|
67
|
-
}, [
|
|
68
|
-
basePath,
|
|
69
|
-
exitPreviewURL,
|
|
70
|
-
isAppRouter,
|
|
71
|
-
isPreviewActive,
|
|
72
|
-
refresh,
|
|
73
|
-
repositoryName,
|
|
74
|
-
updatePreviewURL
|
|
75
|
-
]);
|
|
47
|
+
return () => controller.abort();
|
|
48
|
+
}, [repositoryName, isDraftMode, updatePreviewURL, exitPreviewURL, refresh]);
|
|
76
49
|
return null;
|
|
77
50
|
}
|
|
51
|
+
function getPrismicPreviewCookie(cookieJar) {
|
|
52
|
+
function readValue(value2) {
|
|
53
|
+
return value2.replace(/%3B/g, ";");
|
|
54
|
+
}
|
|
55
|
+
const cookies = cookieJar.split("; ");
|
|
56
|
+
let value;
|
|
57
|
+
for (const cookie$1 of cookies) {
|
|
58
|
+
const parts = cookie$1.split("=");
|
|
59
|
+
const name = readValue(parts[0]).replace(/%3D/g, "=");
|
|
60
|
+
if (name === cookie.preview) {
|
|
61
|
+
value = readValue(parts.slice(1).join("="));
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
78
67
|
export {
|
|
79
68
|
PrismicPreviewClient
|
|
80
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicPreviewClient.js","sources":["
|
|
1
|
+
{"version":3,"file":"PrismicPreviewClient.js","sources":["../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { cookie as prismicCookie } from \"@prismicio/client\";\nimport { useRouter } from \"next/navigation\";\n\ntype PrismicPreviewClientProps = {\n\trepositoryName: string;\n\tisDraftMode: boolean;\n\tupdatePreviewURL?: string;\n\texitPreviewURL?: string;\n};\n\nexport function PrismicPreviewClient(props: PrismicPreviewClientProps): null {\n\tconst {\n\t\trepositoryName,\n\t\tisDraftMode,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t} = props;\n\n\tconst { refresh } = useRouter();\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController();\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\n\t\tconst cookie = getPrismicPreviewCookie(window.document.cookie);\n\t\tconst cookieRepositoryName = cookie\n\t\t\t? (decodeURIComponent(cookie).match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n\t\t\t: undefined;\n\t\tconst hasCookieForRepository = cookieRepositoryName === repositoryName;\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\tif (hasCookieForRepository && !isDraftMode) {\n\t\t\tconsole.log(\"starting preview link\");\n\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and draft mode\n\t\t\t// is active.\n\t\t\tglobalThis\n\t\t\t\t.fetch(updatePreviewURL, {\n\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\t// noop\n\t\t\t\t});\n\t\t}\n\n\t\tfunction onUpdate() {\n\t\t\trefresh();\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tglobalThis\n\t\t\t\t.fetch(exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\t// noop\n\t\t\t\t});\n\t\t}\n\n\t\treturn () => controller.abort();\n\t}, [repositoryName, isDraftMode, updatePreviewURL, exitPreviewURL, refresh]);\n\n\treturn null;\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the\n * cookie.\n *\n * @returns The value of the cookie, if it exists.\n */\nfunction getPrismicPreviewCookie(cookieJar: string): string | undefined {\n\tfunction readValue(value: string): string {\n\t\treturn value.replace(/%3B/g, \";\");\n\t}\n\n\tconst cookies = cookieJar.split(\"; \");\n\n\tlet value: string | undefined;\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\");\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\");\n\n\t\tif (name === prismicCookie.preview) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"));\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\treturn value;\n}\n"],"names":["cookie","value","prismicCookie"],"mappings":";;;;AAaM,SAAU,qBAAqB,OAAgC;AACpE,QAAM,EACL,gBACA,aACA,mBAAmB,gBACnB,iBAAiB,wBACd;AAEE,QAAA,EAAE,QAAO,IAAK;AAEpB,YAAU,MAAK;AACR,UAAA,aAAa,IAAI;AAEhB,WAAA,iBAAiB,wBAAwB,UAAU;AAAA,MACzD,QAAQ,WAAW;AAAA,IAAA,CACnB;AACM,WAAA,iBAAiB,qBAAqB,OAAO;AAAA,MACnD,QAAQ,WAAW;AAAA,IAAA,CACnB;AAED,UAAMA,UAAS,wBAAwB,OAAO,SAAS,MAAM;AACvD,UAAA,uBAAuBA,WACzB,mBAAmBA,OAAM,EAAE,MAAM,wBAAwB,KAAK,CAAA,GAAI,CAAC,IACpE;AACH,UAAM,yBAAyB,yBAAyB;AAKpD,QAAA,0BAA0B,CAAC,aAAa;AAC3C,cAAQ,IAAI,uBAAuB;AAMnC,iBACE,MAAM,kBAAkB;AAAA,QACxB,UAAU;AAAA,QACV,QAAQ,WAAW;AAAA,MAAA,CACnB,EACA,KAAK,CAAC,QAAO;AACT,YAAA,IAAI,SAAS,kBAAkB;AAC1B,kBAAA,MACP,yDAAyD,gBAAgB,mBAAmB;AAG7F;AAAA,QAAA;;OAID,EACA,MAAM,MAAK;AAAA,MAAA,CAEX;AAAA,IAAA;AAGH,aAAS,WAAQ;;;AAIjB,aAAS,MAAM,OAAY;AAC1B,YAAM,eAAc;AAElB,iBAAA,MAAM,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,EACnD,KAAK,CAAC,QAAO;AACT,YAAA,CAAC,IAAI,IAAI;AACJ,kBAAA,MACP,6DAA6D,cAAc,gCAAgC;AAG5G;AAAA,QAAA;;OAID,EACA,MAAM,MAAK;AAAA,MAAA,CAEX;AAAA,IAAA;AAGI,WAAA,MAAM,WAAW;KACtB,CAAC,gBAAgB,aAAa,kBAAkB,gBAAgB,OAAO,CAAC;AAEpE,SAAA;AACR;AAUA,SAAS,wBAAwB,WAAiB;AACjD,WAAS,UAAUC,QAAa;AACxBA,WAAAA,OAAM,QAAQ,QAAQ,GAAG;AAAA,EAAA;AAG3B,QAAA,UAAU,UAAU,MAAM,IAAI;AAEhC,MAAA;AAEJ,aAAWD,YAAU,SAAS;AACvB,UAAA,QAAQA,SAAO,MAAM,GAAG;AACxB,UAAA,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,QAAQ,QAAQ,GAAG;AAEhD,QAAA,SAASE,OAAc,SAAS;AACnC,cAAQ,UAAU,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC;AAC1C;AAAA,IAAA;AAAA,EACD;AAGM,SAAA;AACR;"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import * as prismic from "@prismicio/client";
|
|
2
|
-
import { NextRequestLike } from "./types";
|
|
3
|
-
export type CreateLocaleRedirectConfig = {
|
|
4
|
-
request: NextRequestLike;
|
|
5
|
-
client: Pick<prismic.Client, "getRepository">;
|
|
6
|
-
localeOverrides?: Record<string, string>;
|
|
7
|
-
omitDefaultLocale?: boolean;
|
|
8
|
-
};
|
|
9
1
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* locale.
|
|
13
|
-
*
|
|
14
|
-
* @returns A `Response` if the request should be redirected, `undefined`
|
|
15
|
-
* otherwise.
|
|
2
|
+
* @deprecated `createLocaleRedirect()` has been removed due to performance
|
|
3
|
+
* issues.
|
|
16
4
|
*/
|
|
17
|
-
export declare
|
|
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,31 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const locales = repository.languages.map((language) => {
|
|
6
|
-
var _a;
|
|
7
|
-
return ((_a = config.localeOverrides) == null ? void 0 : _a[language.id]) ?? language.id;
|
|
8
|
-
});
|
|
9
|
-
const defaultLocale = locales[0];
|
|
10
|
-
const { pathname } = config.request.nextUrl;
|
|
11
|
-
const pathnameHasLocale = locales.some((locale2) => pathname.startsWith(`/${locale2}/`) || pathname === `/${locale2}`);
|
|
12
|
-
if (pathnameHasLocale) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
let locale = defaultLocale;
|
|
16
|
-
const headers = {
|
|
17
|
-
"accept-language": config.request.headers.get("accept-language") ?? void 0
|
|
18
|
-
};
|
|
19
|
-
if (headers["accept-language"]) {
|
|
20
|
-
const languages = new Negotiator({ headers }).languages();
|
|
21
|
-
locale = match(languages, locales, defaultLocale);
|
|
22
|
-
}
|
|
23
|
-
if (locale === defaultLocale && config.omitDefaultLocale) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
config.request.nextUrl.pathname = `/${locale}${pathname}`;
|
|
27
|
-
return Response.redirect(config.request.nextUrl);
|
|
28
|
-
};
|
|
1
|
+
import { devMsg } from "./lib/devMsg.js";
|
|
2
|
+
function createLocaleRedirect() {
|
|
3
|
+
throw new Error(`createLocaleRedirect() has been removed due to performance issues. See ${devMsg("replace-createLocaleRedirect")} for more details.`);
|
|
4
|
+
}
|
|
29
5
|
export {
|
|
30
6
|
createLocaleRedirect
|
|
31
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLocaleRedirect.js","sources":["
|
|
1
|
+
{"version":3,"file":"createLocaleRedirect.js","sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg.js\";\n\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport function createLocaleRedirect() {\n\tthrow new Error(\n\t\t`createLocaleRedirect() has been removed due to performance issues. See ${devMsg(\n\t\t\t\"replace-createLocaleRedirect\",\n\t\t)} for more details.`,\n\t);\n}\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport type CreateLocaleRedirectConfig = never;\n"],"names":[],"mappings":";SAMgB,uBAAoB;AACnC,QAAM,IAAI,MACT,0EAA0E,OACzE,8BAA8B,CAC9B,oBAAoB;AAEvB;"}
|
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* @typeParam TPreviewData - Next.js preview data object.
|
|
8
|
-
*/
|
|
9
|
-
export type EnableAutoPreviewsConfig<TPreviewData extends PreviewData = PreviewData> = {
|
|
10
|
-
/**
|
|
11
|
-
* Prismic client with which automatic previews will be enabled.
|
|
12
|
-
*/
|
|
13
|
-
client: Pick<prismic.Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
|
|
14
|
-
/**
|
|
15
|
-
* **Only used in the Pages Directory (/pages).**
|
|
16
|
-
*
|
|
17
|
-
* The `previewData` object provided in the `getStaticProps()` or
|
|
18
|
-
* `getServerSideProps()` context object.
|
|
19
|
-
*/
|
|
20
|
-
previewData?: TPreviewData;
|
|
21
|
-
/**
|
|
22
|
-
* **Only used in the Pages Directory (/pages).**
|
|
23
|
-
*
|
|
24
|
-
* The `req` object from a Next.js API route.
|
|
25
|
-
*
|
|
26
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/api-routes/introduction\>
|
|
27
|
-
*/
|
|
28
|
-
req?: NextApiRequestLike;
|
|
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">;
|
|
29
6
|
};
|
|
30
7
|
/**
|
|
31
8
|
* Configures a Prismic client to automatically query draft content during a
|
|
32
|
-
* preview session.
|
|
33
|
-
* or a Next.js API endpoint request object.
|
|
9
|
+
* preview session.
|
|
34
10
|
*
|
|
35
11
|
* @param config - Configuration for the function.
|
|
36
12
|
*/
|
|
37
|
-
export declare
|
|
13
|
+
export declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
|
|
@@ -1,39 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { cookie } from "@prismicio/client";
|
|
2
|
+
function enableAutoPreviews(config) {
|
|
3
|
+
config.client.queryContentFromRef(async () => {
|
|
4
|
+
var _a;
|
|
5
|
+
const { cookies, draftMode } = await import("next/headers");
|
|
6
|
+
let isDraftModeEnabled = false;
|
|
7
|
+
try {
|
|
8
|
+
isDraftModeEnabled = (await draftMode()).isEnabled;
|
|
9
|
+
} catch {
|
|
10
|
+
return;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let cookie;
|
|
26
|
-
try {
|
|
27
|
-
cookie = (_a = (await cookies()).get(preview)) == null ? void 0 : _a.value;
|
|
28
|
-
} catch {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (cookie && /\.prismic\.io/.test(cookie)) {
|
|
32
|
-
return cookie;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
};
|
|
12
|
+
if (!isDraftModeEnabled) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const cookie$1 = (_a = (await cookies()).get(cookie.preview)) == null ? void 0 : _a.value;
|
|
16
|
+
if (!cookie$1) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const isActiveCookie = cookie$1.includes("websitePreviewId=");
|
|
20
|
+
if (!isActiveCookie) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
return cookie$1;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
37
26
|
export {
|
|
38
27
|
enableAutoPreviews
|
|
39
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enableAutoPreviews.js","sources":["
|
|
1
|
+
{"version":3,"file":"enableAutoPreviews.js","sources":["../src/enableAutoPreviews.ts"],"sourcesContent":["import { type Client, cookie as prismicCookie } from \"@prismicio/client\";\n\n/** Configuration for `enableAutoPreviews`. */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\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, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">;\n};\n\n/**\n * Configures a Prismic client to automatically query draft content during a\n * preview session.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\t// We use a function value so the cookie is checked on every\n\t// request. We don't have a static value to read from.\n\tconfig.client.queryContentFromRef(async () => {\n\t\t// Need this to avoid the following Next.js build-time error:\n\t\t// You're importing a component that needs next/headers. That only works\n\t\t// in a Server Component which is not supported in the pages/ directory.\n\t\tconst { cookies, draftMode } = await import(\"next/headers\");\n\n\t\tlet isDraftModeEnabled = false;\n\t\ttry {\n\t\t\tisDraftModeEnabled = (await draftMode()).isEnabled;\n\t\t} catch {\n\t\t\t// `draftMode()` may have been called in a palce that\n\t\t\t// does not have access to its async storage. This\n\t\t\t// occurs in places like `generateStaticParams()`. We\n\t\t\t// can ignore this case.\n\t\t\treturn;\n\t\t}\n\t\tif (!isDraftModeEnabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value;\n\t\tif (!cookie) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\");\n\t\tif (!isActiveCookie) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn cookie;\n\t});\n}\n"],"names":["cookie","prismicCookie"],"mappings":";AAiBM,SAAU,mBAAmB,QAAgC;AAG3D,SAAA,OAAO,oBAAoB,YAAW;;AAI5C,UAAM,EAAE,SAAS,cAAc,MAAM,OAAO,cAAc;AAE1D,QAAI,qBAAqB;AACrB,QAAA;AACmB,4BAAA,MAAM,aAAa;AAAA,IAAA,QAClC;AAKP;AAAA,IAAA;AAED,QAAI,CAAC,oBAAoB;AACxB;AAAA,IAAA;AAGD,UAAMA,YAAU,YAAM,QAAA,GAAW,IAAIC,OAAc,OAAO,MAA1C,mBAA6C;AAC7D,QAAI,CAACD,UAAQ;AACZ;AAAA,IAAA;AAGK,UAAA,iBAAiBA,SAAO,SAAS,mBAAmB;AAC1D,QAAI,CAAC,gBAAgB;AACpB;AAAA,IAAA;AAGM,WAAAA;AAAAA,EAAA,CACP;AACF;"}
|
package/dist/exitPreview.d.ts
CHANGED
|
@@ -1,59 +1,17 @@
|
|
|
1
|
-
import { NextApiRequestLike, NextApiResponseLike } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Use `ExitPreviewAPIRouteConfig` instead when `exitPreview()` is
|
|
4
|
-
* used in a Pages Router API endpoint. `exitPreview()` does not require any
|
|
5
|
-
* configuration when used in an App Router Route Handler.
|
|
6
|
-
*/
|
|
7
|
-
export type ExitPreviewConfig = ExitPreviewAPIRouteConfig;
|
|
8
|
-
/**
|
|
9
|
-
* Configuration for `exitPreview()` when used in a Pages Router API route.
|
|
10
|
-
*/
|
|
11
|
-
export type ExitPreviewAPIRouteConfig = {
|
|
12
|
-
/**
|
|
13
|
-
* **Only use this parameter in the Pages Directory (/pages).**
|
|
14
|
-
*
|
|
15
|
-
* The `req` object from a Next.js API route.
|
|
16
|
-
*
|
|
17
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/api-routes/introduction\>
|
|
18
|
-
*/
|
|
19
|
-
req?: NextApiRequestLike;
|
|
20
|
-
/**
|
|
21
|
-
* **Only use this parameter in the Pages Directory (/pages).**
|
|
22
|
-
*
|
|
23
|
-
* The `res` object from a Next.js API route.
|
|
24
|
-
*
|
|
25
|
-
* @see Next.js API route docs: \<https://nextjs.org/docs/api-routes/introduction\>
|
|
26
|
-
*/
|
|
27
|
-
res?: NextApiResponseLike;
|
|
28
|
-
};
|
|
29
1
|
/**
|
|
30
2
|
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
31
|
-
* used in a Router Handler
|
|
32
|
-
* the App Router or Pages Router.
|
|
3
|
+
* used in a Router Handler.
|
|
33
4
|
*
|
|
34
|
-
* @example
|
|
5
|
+
* @example
|
|
35
6
|
*
|
|
36
7
|
* ```typescript
|
|
37
8
|
* // src/app/api/exit-preview/route.js
|
|
38
9
|
*
|
|
39
10
|
* import { exitPreview } from "@prismicio/next";
|
|
40
11
|
*
|
|
41
|
-
* export function GET() {
|
|
42
|
-
* return exitPreview();
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @example Usage within a Pages Router API Route.
|
|
47
|
-
*
|
|
48
|
-
* ```typescript
|
|
49
|
-
* // src/pages/api/exit-preview.js
|
|
50
|
-
*
|
|
51
|
-
* import { exitPreview } from "@prismicio/next";
|
|
52
|
-
*
|
|
53
|
-
* export default function handler(req, res) {
|
|
54
|
-
* exitPreview({ req, res });
|
|
12
|
+
* export async function GET() {
|
|
13
|
+
* return await exitPreview();
|
|
55
14
|
* }
|
|
56
15
|
* ```
|
|
57
16
|
*/
|
|
58
17
|
export declare function exitPreview(): Promise<Response>;
|
|
59
|
-
export declare function exitPreview(config: ExitPreviewAPIRouteConfig): Promise<void>;
|
package/dist/exitPreview.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
(await draftMode()).disable();
|
|
10
|
-
return new Response(JSON.stringify({ success: true }), {
|
|
11
|
-
headers: {
|
|
12
|
-
"Cache-Control": "no-store"
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
1
|
+
async function exitPreview() {
|
|
2
|
+
const { draftMode } = await import("next/headers");
|
|
3
|
+
(await draftMode()).disable();
|
|
4
|
+
return new Response(JSON.stringify({ success: true }), {
|
|
5
|
+
headers: {
|
|
6
|
+
"Cache-Control": "no-store"
|
|
7
|
+
}
|
|
8
|
+
});
|
|
16
9
|
}
|
|
17
10
|
export {
|
|
18
11
|
exitPreview
|
package/dist/exitPreview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitPreview.js","sources":["
|
|
1
|
+
{"version":3,"file":"exitPreview.js","sources":["../src/exitPreview.ts"],"sourcesContent":["/**\n * Ends a Prismic preview session within a Next.js app. This function should be\n * used in a Router Handler.\n *\n * @example\n *\n * ```typescript\n * // src/app/api/exit-preview/route.js\n *\n * import { exitPreview } from \"@prismicio/next\";\n *\n * export async function GET() {\n * \treturn await exitPreview();\n * }\n * ```\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 { draftMode } = await import(\"next/headers\");\n\n\t(await draftMode()).disable();\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"],"names":[],"mappings":"AAgBA,eAAsB,cAAW;AAIhC,QAAM,EAAE,UAAA,IAAc,MAAM,OAAO,cAAc;AAEhD,GAAA,MAAM,UAAS,GAAI;AAGb,SAAA,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,KAAA,CAAM,GAAG;AAAA,IACtD,SAAS;AAAA,MACR,iBAAiB;AAAA,IAAA;AAAA,EACjB,CACD;AACF;"}
|
package/dist/imgixLoader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imgixLoader.js","sources":["
|
|
1
|
+
{"version":3,"file":"imgixLoader.js","sources":["../src/imgixLoader.ts"],"sourcesContent":["import { ImageLoaderProps } from \"next/image\";\nimport { buildURL, ImgixURLParams } from \"imgix-url-builder\";\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional\n * collection of default Imgix 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"],"names":[],"mappings":";AAUa,MAAA,cAAc,CAAC,SAAkC;AAC7D,QAAM,MAAM,IAAI,IAAI,KAAK,GAAG;AAE5B,QAAM,SAAyB;AAAA,IAC9B,KAAM,IAAI,aAAa,IAAI,KAAK,KAA+B;AAAA,IAC/D,GAAG,KAAK;AAAA,IACR,GAAG;AAAA;AAGJ,MAAI,KAAK,SAAS;AACjB,WAAO,IAAI,KAAK;AAAA,EAAA;AAGV,SAAA,SAAS,KAAK,KAAK,MAAM;AACjC;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
9
|
-
export {
|
|
10
|
-
export
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
13
|
-
export {
|
|
14
|
-
export
|
|
15
|
-
export {
|
|
16
|
-
export type { PrismicNextImageProps } from "./PrismicNextImage";
|
|
17
|
-
export { imgixLoader } from "./imgixLoader";
|
|
18
|
-
export type { CreateClientConfig, PrismicPreviewData } from "./types";
|
|
1
|
+
export { exitPreview } from "./exitPreview.js";
|
|
2
|
+
export { PrismicPreview } from "./PrismicPreview.js";
|
|
3
|
+
export type { PrismicPreviewProps } from "./PrismicPreview.js";
|
|
4
|
+
export { PrismicNextLink } from "./PrismicNextLink.js";
|
|
5
|
+
export type { PrismicNextLinkProps } from "./PrismicNextLink.js";
|
|
6
|
+
export { enableAutoPreviews } from "./enableAutoPreviews.js";
|
|
7
|
+
export type { EnableAutoPreviewsConfig } from "./enableAutoPreviews.js";
|
|
8
|
+
export { redirectToPreviewURL } from "./redirectToPreviewURL.js";
|
|
9
|
+
export type { RedirectToPreviewURLConfig } from "./redirectToPreviewURL.js";
|
|
10
|
+
export { PrismicNextImage } from "./PrismicNextImage.js";
|
|
11
|
+
export type { PrismicNextImageProps } from "./PrismicNextImage.js";
|
|
12
|
+
export { imgixLoader } from "./imgixLoader.js";
|
|
13
|
+
export type { CreateClientConfig } from "./types.js";
|
|
14
|
+
export { createLocaleRedirect } from "./createLocaleRedirect.js";
|
|
15
|
+
export type { CreateLocaleRedirectConfig } from "./createLocaleRedirect.js";
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { setPreviewData } from "./setPreviewData.js";
|
|
2
1
|
import { exitPreview } from "./exitPreview.js";
|
|
3
2
|
import { PrismicPreview } from "./PrismicPreview.js";
|
|
4
3
|
import { PrismicNextLink } from "./PrismicNextLink.js";
|
|
5
4
|
import { enableAutoPreviews } from "./enableAutoPreviews.js";
|
|
6
5
|
import { redirectToPreviewURL } from "./redirectToPreviewURL.js";
|
|
7
|
-
import { createLocaleRedirect } from "./createLocaleRedirect.js";
|
|
8
6
|
import { PrismicNextImage } from "./PrismicNextImage.js";
|
|
9
7
|
import { imgixLoader } from "./imgixLoader.js";
|
|
8
|
+
import { createLocaleRedirect } from "./createLocaleRedirect.js";
|
|
10
9
|
export {
|
|
11
10
|
PrismicNextImage,
|
|
12
11
|
PrismicNextLink,
|
|
@@ -15,7 +14,6 @@ export {
|
|
|
15
14
|
enableAutoPreviews,
|
|
16
15
|
exitPreview,
|
|
17
16
|
imgixLoader,
|
|
18
|
-
redirectToPreviewURL
|
|
19
|
-
setPreviewData
|
|
17
|
+
redirectToPreviewURL
|
|
20
18
|
};
|
|
21
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/dist/lib/devMsg.d.ts
CHANGED
package/dist/lib/devMsg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devMsg.js","sources":["
|
|
1
|
+
{"version":3,"file":"devMsg.js","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 *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string) => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`;\n};\n"],"names":[],"mappings":";AAiBa,MAAA,SAAS,CAAC,SAAgB;AAC/B,SAAA,iCAAiC,OAAO,IAAI,IAAI;AACxD;"}
|
package/dist/package.json.js
CHANGED