@prismicio/next 2.0.1 → 2.0.2-canary.6f580fa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PrismicNextImage.cjs +66 -56
- package/dist/PrismicNextImage.cjs.map +1 -1
- package/dist/PrismicNextImage.d.cts +57 -0
- package/dist/PrismicNextLink.cjs +29 -21
- package/dist/PrismicNextLink.cjs.map +1 -1
- package/dist/PrismicNextLink.d.cts +54 -0
- package/dist/PrismicNextRichText.cjs +34 -0
- package/dist/PrismicNextRichText.cjs.map +1 -0
- package/dist/PrismicNextRichText.d.cts +11 -0
- package/dist/PrismicPreview.cjs +38 -36
- package/dist/PrismicPreview.cjs.map +1 -1
- package/dist/PrismicPreview.d.cts +36 -0
- package/dist/PrismicPreviewClient.cjs +71 -65
- package/dist/PrismicPreviewClient.cjs.map +1 -1
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/createLocaleRedirect.cjs +11 -5
- package/dist/createLocaleRedirect.cjs.map +1 -1
- package/dist/createLocaleRedirect.d.cts +14 -0
- package/dist/enableAutoPreviews.cjs +27 -48
- package/dist/enableAutoPreviews.cjs.map +1 -1
- package/dist/enableAutoPreviews.d.cts +18 -0
- package/dist/exitPreview.cjs +24 -32
- package/dist/exitPreview.cjs.map +1 -1
- package/dist/{exitPreview.d.ts → exitPreview.d.cts} +5 -1
- package/dist/imgixLoader.cjs +21 -14
- package/dist/imgixLoader.cjs.map +1 -1
- package/dist/{imgixLoader.d.ts → imgixLoader.d.cts} +7 -1
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts +11 -0
- package/dist/lib/devMsg.cjs +22 -5
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/resolveDefaultExport.cjs +23 -4
- package/dist/lib/resolveDefaultExport.cjs.map +1 -1
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/pages/PrismicPreview.cjs +71 -59
- package/dist/pages/PrismicPreview.cjs.map +1 -1
- package/dist/pages/PrismicPreview.d.cts +36 -0
- package/dist/pages/enableAutoPreviews.cjs +21 -14
- package/dist/pages/enableAutoPreviews.cjs.map +1 -1
- package/dist/pages/enableAutoPreviews.d.cts +37 -0
- package/dist/pages/exitPreview.cjs +24 -7
- package/dist/pages/exitPreview.cjs.map +1 -1
- package/dist/pages/exitPreview.d.cts +38 -0
- package/dist/pages/redirectToPreviewURL.cjs +13 -13
- package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
- package/dist/pages/redirectToPreviewURL.d.cts +48 -0
- package/dist/pages/setPreviewData.cjs +10 -8
- package/dist/pages/setPreviewData.cjs.map +1 -1
- package/dist/pages/setPreviewData.d.cts +26 -0
- package/dist/pages/types.d.cts +36 -0
- package/dist/pages.cjs +21 -21
- package/dist/pages.d.cts +12 -0
- package/dist/redirectToPreviewURL.cjs +21 -43
- package/dist/redirectToPreviewURL.cjs.map +1 -1
- package/dist/redirectToPreviewURL.d.cts +33 -0
- package/dist/types.d.cts +31 -0
- package/package.json +34 -49
- package/src/PrismicNextImage.tsx +10 -6
- package/src/PrismicNextLink.tsx +5 -3
- package/src/PrismicNextRichText.tsx +41 -0
- package/src/PrismicPreviewClient.tsx +2 -3
- package/src/createLocaleRedirect.ts +1 -1
- package/src/imgixLoader.ts +3 -2
- package/src/index.ts +3 -0
- package/src/lib/devMsg.ts +1 -1
- package/src/pages/PrismicPreview.tsx +2 -1
- package/src/pages/index.ts +3 -0
- package/src/pages/types.ts +2 -3
- package/src/redirectToPreviewURL.ts +1 -1
- package/dist/PrismicNextImage.d.ts +0 -54
- package/dist/PrismicNextLink.d.ts +0 -125
- package/dist/PrismicPreview.d.ts +0 -31
- package/dist/PrismicPreviewClient.d.ts +0 -9
- package/dist/createLocaleRedirect.d.ts +0 -10
- package/dist/enableAutoPreviews.d.ts +0 -13
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -15
- package/dist/lib/devMsg.d.ts +0 -16
- package/dist/lib/resolveDefaultExport.d.ts +0 -18
- package/dist/package.json.cjs +0 -5
- package/dist/package.json.cjs.map +0 -1
- package/dist/pages/PrismicPreview.d.ts +0 -31
- package/dist/pages/enableAutoPreviews.d.ts +0 -31
- package/dist/pages/exitPreview.d.ts +0 -33
- package/dist/pages/index.d.ts +0 -18
- package/dist/pages/redirectToPreviewURL.d.ts +0 -43
- package/dist/pages/setPreviewData.d.ts +0 -18
- package/dist/pages/types.d.ts +0 -30
- package/dist/pages.cjs.map +0 -1
- package/dist/redirectToPreviewURL.d.ts +0 -28
- package/dist/types.d.ts +0 -26
|
@@ -1,71 +1,77 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
4
|
+
let _prismicio_client = require("@prismicio/client");
|
|
5
|
+
let next_navigation = require("next/navigation");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
|
|
8
|
+
//#region src/PrismicPreviewClient.tsx
|
|
7
9
|
const PrismicPreviewClient = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return () => controller.abort();
|
|
51
|
-
}, [repositoryName, isDraftMode, updatePreviewURL, exitPreviewURL, refresh]);
|
|
52
|
-
return null;
|
|
10
|
+
const { repositoryName, isDraftMode, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" } = props;
|
|
11
|
+
const { refresh } = (0, next_navigation.useRouter)();
|
|
12
|
+
(0, react.useEffect)(() => {
|
|
13
|
+
const controller = new AbortController();
|
|
14
|
+
window.addEventListener("prismicPreviewUpdate", onUpdate, { signal: controller.signal });
|
|
15
|
+
window.addEventListener("prismicPreviewEnd", onEnd, { signal: controller.signal });
|
|
16
|
+
const cookie = getPrismicPreviewCookie(window.document.cookie);
|
|
17
|
+
if ((cookie ? (decodeURIComponent(cookie).match(/"([^"]+)\.prismic\.io"/) || [])[1] : void 0) === repositoryName && !isDraftMode) globalThis.fetch(updatePreviewURL, {
|
|
18
|
+
redirect: "manual",
|
|
19
|
+
signal: controller.signal
|
|
20
|
+
}).then((res) => {
|
|
21
|
+
if (res.type !== "opaqueredirect") {
|
|
22
|
+
console.error(`[<PrismicPreview>] Failed to start the preview using "${updatePreviewURL}". Does it exist?`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
refresh();
|
|
26
|
+
}).catch(() => {});
|
|
27
|
+
function onUpdate(event) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
refresh();
|
|
30
|
+
}
|
|
31
|
+
function onEnd(event) {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
globalThis.fetch(exitPreviewURL, { signal: controller.signal }).then((res) => {
|
|
34
|
+
if (!res.ok) {
|
|
35
|
+
console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${exitPreviewURL}" API endpoint. Does it exist?`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
refresh();
|
|
39
|
+
}).catch(() => {});
|
|
40
|
+
}
|
|
41
|
+
return () => controller.abort();
|
|
42
|
+
}, [
|
|
43
|
+
repositoryName,
|
|
44
|
+
isDraftMode,
|
|
45
|
+
updatePreviewURL,
|
|
46
|
+
exitPreviewURL,
|
|
47
|
+
refresh
|
|
48
|
+
]);
|
|
49
|
+
return null;
|
|
53
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Returns the value of a cookie from a given cookie store.
|
|
53
|
+
*
|
|
54
|
+
* @param cookieJar - The stringified cookie store from which to read the
|
|
55
|
+
* cookie.
|
|
56
|
+
*
|
|
57
|
+
* @returns The value of the cookie, if it exists.
|
|
58
|
+
*/
|
|
54
59
|
function getPrismicPreviewCookie(cookieJar) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return value;
|
|
60
|
+
function readValue(value$1) {
|
|
61
|
+
return value$1.replace(/%3B/g, ";");
|
|
62
|
+
}
|
|
63
|
+
const cookies = cookieJar.split("; ");
|
|
64
|
+
let value;
|
|
65
|
+
for (const cookie of cookies) {
|
|
66
|
+
const parts = cookie.split("=");
|
|
67
|
+
if (readValue(parts[0]).replace(/%3D/g, "=") === _prismicio_client.cookie.preview) {
|
|
68
|
+
value = readValue(parts.slice(1).join("="));
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return value;
|
|
69
73
|
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
70
76
|
exports.PrismicPreviewClient = PrismicPreviewClient;
|
|
71
|
-
//# sourceMappingURL=PrismicPreviewClient.cjs.map
|
|
77
|
+
//# sourceMappingURL=PrismicPreviewClient.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicPreviewClient.cjs","sources":["../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"PrismicPreviewClient.cjs","names":["value","prismicCookie"],"sources":["../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport { cookie as prismicCookie } from \"@prismicio/client\";\nimport { useRouter } from \"next/navigation\";\nimport type { FC } from \"react\";\nimport { useEffect } from \"react\";\n\ntype PrismicPreviewClientProps = {\n\trepositoryName: string;\n\tisDraftMode: boolean;\n\tupdatePreviewURL?: string;\n\texitPreviewURL?: string;\n};\n\nexport const PrismicPreviewClient: FC<PrismicPreviewClientProps> = (props) => {\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\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(event: Event) {\n\t\t\tevent.preventDefault();\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"],"mappings":";;;;;;;;AAcA,MAAa,wBAAuD,UAAU;CAC7E,MAAM,EACL,gBACA,aACA,mBAAmB,gBACnB,iBAAiB,wBACd;CAEJ,MAAM,EAAE,4CAAuB;AAE/B,4BAAgB;EACf,MAAM,aAAa,IAAI,iBAAiB;AAExC,SAAO,iBAAiB,wBAAwB,UAAU,EACzD,QAAQ,WAAW,QACnB,CAAC;AACF,SAAO,iBAAiB,qBAAqB,OAAO,EACnD,QAAQ,WAAW,QACnB,CAAC;EAEF,MAAM,SAAS,wBAAwB,OAAO,SAAS,OAAO;AAS9D,OAR6B,UACzB,mBAAmB,OAAO,CAAC,MAAM,yBAAyB,IAAI,EAAE,EAAE,KACnE,YACqD,kBAK1B,CAAC,YAK9B,YACE,MAAM,kBAAkB;GACxB,UAAU;GACV,QAAQ,WAAW;GACnB,CAAC,CACD,MAAM,QAAQ;AACd,OAAI,IAAI,SAAS,kBAAkB;AAClC,YAAQ,MACP,yDAAyD,iBAAiB,mBAC1E;AAED;;AAGD,YAAS;IACR,CACD,YAAY,GAEX;EAGJ,SAAS,SAAS,OAAc;AAC/B,SAAM,gBAAgB;AACtB,YAAS;;EAGV,SAAS,MAAM,OAAc;AAC5B,SAAM,gBAAgB;AACtB,cACE,MAAM,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,CAAC,CACpD,MAAM,QAAQ;AACd,QAAI,CAAC,IAAI,IAAI;AACZ,aAAQ,MACP,6DAA6D,eAAe,gCAC5E;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAEX;;AAGJ,eAAa,WAAW,OAAO;IAC7B;EAAC;EAAgB;EAAa;EAAkB;EAAgB;EAAQ,CAAC;AAE5E,QAAO;;;;;;;;;;AAWR,SAAS,wBAAwB,WAAuC;CACvE,SAAS,UAAU,SAAuB;AACzC,SAAOA,QAAM,QAAQ,QAAQ,IAAI;;CAGlC,MAAM,UAAU,UAAU,MAAM,KAAK;CAErC,IAAI;AAEJ,MAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,IAAI;AAG/B,MAFa,UAAU,MAAM,GAAG,CAAC,QAAQ,QAAQ,IAAI,KAExCC,yBAAc,SAAS;AACnC,WAAQ,UAAU,MAAM,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAC3C;;;AAIF,QAAO"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_devMsg = require('./lib/devMsg.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/createLocaleRedirect.ts
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated `createLocaleRedirect()` has been removed due to performance
|
|
6
|
+
* issues.
|
|
7
|
+
*/
|
|
4
8
|
function createLocaleRedirect() {
|
|
5
|
-
|
|
9
|
+
throw new Error(`createLocaleRedirect() has been removed due to performance issues. See ${require_devMsg.devMsg("replace-createLocaleRedirect")} for more details.`);
|
|
6
10
|
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
7
13
|
exports.createLocaleRedirect = createLocaleRedirect;
|
|
8
|
-
//# sourceMappingURL=createLocaleRedirect.cjs.map
|
|
14
|
+
//# sourceMappingURL=createLocaleRedirect.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLocaleRedirect.cjs","sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\";\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"],"
|
|
1
|
+
{"version":3,"file":"createLocaleRedirect.cjs","names":["devMsg"],"sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\";\n\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport function createLocaleRedirect(): never {\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"],"mappings":";;;;;;;AAMA,SAAgB,uBAA8B;AAC7C,OAAM,IAAI,MACT,0EAA0EA,sBACzE,+BACA,CAAC,oBACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/createLocaleRedirect.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated `createLocaleRedirect()` has been removed due to performance
|
|
4
|
+
* issues.
|
|
5
|
+
*/
|
|
6
|
+
declare function createLocaleRedirect(): never;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated `createLocaleRedirect()` has been removed due to performance
|
|
9
|
+
* issues.
|
|
10
|
+
*/
|
|
11
|
+
type CreateLocaleRedirectConfig = never;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { CreateLocaleRedirectConfig, createLocaleRedirect };
|
|
14
|
+
//# sourceMappingURL=createLocaleRedirect.d.cts.map
|
|
@@ -1,51 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
const client = require("@prismicio/client");
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let _prismicio_client = require("@prismicio/client");
|
|
3
|
+
|
|
4
|
+
//#region src/enableAutoPreviews.ts
|
|
5
|
+
/**
|
|
6
|
+
* Configures a Prismic client to automatically query draft content during a
|
|
7
|
+
* preview session.
|
|
8
|
+
*
|
|
9
|
+
* @param config - Configuration for the function.
|
|
10
|
+
*/
|
|
26
11
|
function enableAutoPreviews(config) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const isActiveCookie = cookie.includes("websitePreviewId=");
|
|
44
|
-
if (!isActiveCookie) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
return cookie;
|
|
48
|
-
});
|
|
12
|
+
config.client.queryContentFromRef(async () => {
|
|
13
|
+
const { cookies, draftMode } = await import("next/headers");
|
|
14
|
+
let isDraftModeEnabled = false;
|
|
15
|
+
try {
|
|
16
|
+
isDraftModeEnabled = (await draftMode()).isEnabled;
|
|
17
|
+
} catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (!isDraftModeEnabled) return;
|
|
21
|
+
const cookie = (await cookies()).get(_prismicio_client.cookie.preview)?.value;
|
|
22
|
+
if (!cookie) return;
|
|
23
|
+
if (!cookie.includes("websitePreviewId=")) return;
|
|
24
|
+
return cookie;
|
|
25
|
+
});
|
|
49
26
|
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
50
29
|
exports.enableAutoPreviews = enableAutoPreviews;
|
|
51
|
-
//# sourceMappingURL=enableAutoPreviews.cjs.map
|
|
30
|
+
//# sourceMappingURL=enableAutoPreviews.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enableAutoPreviews.cjs","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"],"
|
|
1
|
+
{"version":3,"file":"enableAutoPreviews.cjs","names":["prismicCookie"],"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"],"mappings":";;;;;;;;;;AAiBA,SAAgB,mBAAmB,QAAwC;AAG1E,QAAO,OAAO,oBAAoB,YAAY;EAI7C,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;EAE5C,IAAI,qBAAqB;AACzB,MAAI;AACH,yBAAsB,MAAM,WAAW,EAAE;UAClC;AAKP;;AAED,MAAI,CAAC,mBACJ;EAGD,MAAM,UAAU,MAAM,SAAS,EAAE,IAAIA,yBAAc,QAAQ,EAAE;AAC7D,MAAI,CAAC,OACJ;AAID,MAAI,CADmB,OAAO,SAAS,oBAAoB,CAE1D;AAGD,SAAO;GACN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client } from "@prismicio/client";
|
|
2
|
+
|
|
3
|
+
//#region src/enableAutoPreviews.d.ts
|
|
4
|
+
/** Configuration for `enableAutoPreviews`. */
|
|
5
|
+
type EnableAutoPreviewsConfig = {
|
|
6
|
+
/** Prismic client with which automatic previews will be enabled. */
|
|
7
|
+
client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Configures a Prismic client to automatically query draft content during a
|
|
11
|
+
* preview session.
|
|
12
|
+
*
|
|
13
|
+
* @param config - Configuration for the function.
|
|
14
|
+
*/
|
|
15
|
+
declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { EnableAutoPreviewsConfig, enableAutoPreviews };
|
|
18
|
+
//# sourceMappingURL=enableAutoPreviews.d.cts.map
|
package/dist/exitPreview.cjs
CHANGED
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
|
+
|
|
2
|
+
//#region src/exitPreview.ts
|
|
3
|
+
/**
|
|
4
|
+
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
5
|
+
* used in a Router Handler.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // src/app/api/exit-preview/route.js
|
|
11
|
+
*
|
|
12
|
+
* import { exitPreview } from "@prismicio/next";
|
|
13
|
+
*
|
|
14
|
+
* export async function GET() {
|
|
15
|
+
* return await exitPreview();
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
25
19
|
async function exitPreview() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
headers: {
|
|
30
|
-
"Cache-Control": "no-store"
|
|
31
|
-
}
|
|
32
|
-
});
|
|
20
|
+
const { draftMode } = await import("next/headers");
|
|
21
|
+
(await draftMode()).disable();
|
|
22
|
+
return new Response(JSON.stringify({ success: true }), { headers: { "Cache-Control": "no-store" } });
|
|
33
23
|
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
34
26
|
exports.exitPreview = exitPreview;
|
|
35
|
-
//# sourceMappingURL=exitPreview.cjs.map
|
|
27
|
+
//# sourceMappingURL=exitPreview.cjs.map
|
package/dist/exitPreview.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitPreview.cjs","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"],"
|
|
1
|
+
{"version":3,"file":"exitPreview.cjs","names":[],"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"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,eAAsB,cAAiC;CAItD,MAAM,EAAE,cAAc,MAAM,OAAO;AAEnC,EAAC,MAAM,WAAW,EAAE,SAAS;AAG7B,QAAO,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,MAAM,CAAC,EAAE,EACtD,SAAS,EACR,iBAAiB,YACjB,EACD,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/exitPreview.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
3
4
|
* used in a Router Handler.
|
|
@@ -14,4 +15,7 @@
|
|
|
14
15
|
* }
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
declare function exitPreview(): Promise<Response>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { exitPreview };
|
|
21
|
+
//# sourceMappingURL=exitPreview.d.cts.map
|
package/dist/imgixLoader.cjs
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let imgix_url_builder = require("imgix-url-builder");
|
|
3
|
+
|
|
4
|
+
//#region src/imgixLoader.ts
|
|
5
|
+
/**
|
|
6
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
7
|
+
* collection of default Imgix parameters.
|
|
8
|
+
*
|
|
9
|
+
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
10
|
+
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
|
11
|
+
*/
|
|
4
12
|
const imgixLoader = (args) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
params.q = args.quality;
|
|
13
|
-
}
|
|
14
|
-
return imgixUrlBuilder.buildURL(args.src, params);
|
|
13
|
+
const params = {
|
|
14
|
+
fit: new URL(args.src).searchParams.get("fit") || "max",
|
|
15
|
+
w: args.width,
|
|
16
|
+
h: void 0
|
|
17
|
+
};
|
|
18
|
+
if (args.quality) params.q = args.quality;
|
|
19
|
+
return (0, imgix_url_builder.buildURL)(args.src, params);
|
|
15
20
|
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
16
23
|
exports.imgixLoader = imgixLoader;
|
|
17
|
-
//# sourceMappingURL=imgixLoader.cjs.map
|
|
24
|
+
//# sourceMappingURL=imgixLoader.cjs.map
|
package/dist/imgixLoader.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imgixLoader.cjs","sources":["../src/imgixLoader.ts"],"sourcesContent":["import { ImageLoaderProps } from \"next/image\";\nimport {
|
|
1
|
+
{"version":3,"file":"imgixLoader.cjs","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImageLoaderProps } from \"next/image\";\nimport type { ImgixURLParams } from \"imgix-url-builder\";\nimport { buildURL } 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"],"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;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,wCAAgB,KAAK,KAAK,OAAO"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ImageLoaderProps } from "next/image";
|
|
2
|
+
|
|
3
|
+
//#region src/imgixLoader.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
4
7
|
* collection of default Imgix parameters.
|
|
@@ -6,4 +9,7 @@ import { ImageLoaderProps } from "next/image";
|
|
|
6
9
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
7
10
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
declare const imgixLoader: (args: ImageLoaderProps) => string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { imgixLoader };
|
|
15
|
+
//# sourceMappingURL=imgixLoader.d.cts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
|
|
1
|
+
const require_exitPreview = require('./exitPreview.cjs');
|
|
2
|
+
const require_PrismicPreview = require('./PrismicPreview.cjs');
|
|
3
|
+
const require_PrismicNextLink = require('./PrismicNextLink.cjs');
|
|
4
|
+
const require_enableAutoPreviews = require('./enableAutoPreviews.cjs');
|
|
5
|
+
const require_redirectToPreviewURL = require('./redirectToPreviewURL.cjs');
|
|
6
|
+
const require_imgixLoader = require('./imgixLoader.cjs');
|
|
7
|
+
const require_PrismicNextImage = require('./PrismicNextImage.cjs');
|
|
8
|
+
const require_PrismicNextRichText = require('./PrismicNextRichText.cjs');
|
|
9
|
+
const require_createLocaleRedirect = require('./createLocaleRedirect.cjs');
|
|
10
|
+
|
|
11
|
+
exports.PrismicNextImage = require_PrismicNextImage.PrismicNextImage;
|
|
12
|
+
exports.PrismicNextLink = require_PrismicNextLink.PrismicNextLink;
|
|
13
|
+
exports.PrismicNextRichText = require_PrismicNextRichText.PrismicNextRichText;
|
|
14
|
+
exports.PrismicPreview = require_PrismicPreview.PrismicPreview;
|
|
15
|
+
exports.createLocaleRedirect = require_createLocaleRedirect.createLocaleRedirect;
|
|
16
|
+
exports.enableAutoPreviews = require_enableAutoPreviews.enableAutoPreviews;
|
|
17
|
+
exports.exitPreview = require_exitPreview.exitPreview;
|
|
18
|
+
exports.imgixLoader = require_imgixLoader.imgixLoader;
|
|
19
|
+
exports.redirectToPreviewURL = require_redirectToPreviewURL.redirectToPreviewURL;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { exitPreview } from "./exitPreview.cjs";
|
|
2
|
+
import { PrismicPreview, PrismicPreviewProps } from "./PrismicPreview.cjs";
|
|
3
|
+
import { PrismicNextLink, PrismicNextLinkProps } from "./PrismicNextLink.cjs";
|
|
4
|
+
import { EnableAutoPreviewsConfig, enableAutoPreviews } from "./enableAutoPreviews.cjs";
|
|
5
|
+
import { CreateClientConfig } from "./types.cjs";
|
|
6
|
+
import { RedirectToPreviewURLConfig, redirectToPreviewURL } from "./redirectToPreviewURL.cjs";
|
|
7
|
+
import { PrismicNextImage, PrismicNextImageProps } from "./PrismicNextImage.cjs";
|
|
8
|
+
import { PrismicNextRichText, PrismicNextRichTextProps } from "./PrismicNextRichText.cjs";
|
|
9
|
+
import { imgixLoader } from "./imgixLoader.cjs";
|
|
10
|
+
import { CreateLocaleRedirectConfig, createLocaleRedirect } from "./createLocaleRedirect.cjs";
|
|
11
|
+
export { type CreateClientConfig, type CreateLocaleRedirectConfig, type EnableAutoPreviewsConfig, PrismicNextImage, type PrismicNextImageProps, PrismicNextLink, type PrismicNextLinkProps, PrismicNextRichText, type PrismicNextRichTextProps, PrismicPreview, type PrismicPreviewProps, type RedirectToPreviewURLConfig, createLocaleRedirect, enableAutoPreviews, exitPreview, imgixLoader, redirectToPreviewURL };
|
package/dist/lib/devMsg.cjs
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_package = require('../package.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/lib/devMsg.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns a `prismic.dev/msg` URL for a given message slug.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* devMsg("missing-param");
|
|
11
|
+
* // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param slug - Slug for the message. This corresponds to a Markdown file in
|
|
15
|
+
* the Git repository's `/messages` directory.
|
|
16
|
+
*
|
|
17
|
+
* @returns The `prismic.dev/msg` URL for the given slug.
|
|
18
|
+
*/
|
|
4
19
|
const devMsg = (slug) => {
|
|
5
|
-
|
|
20
|
+
return `https://prismic.dev/msg/next/v${require_package.version}/${slug}`;
|
|
6
21
|
};
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
7
24
|
exports.devMsg = devMsg;
|
|
8
|
-
//# sourceMappingURL=devMsg.cjs.map
|
|
25
|
+
//# sourceMappingURL=devMsg.cjs.map
|
package/dist/lib/devMsg.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devMsg.cjs","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"],"
|
|
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 *\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): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiCA,wBAAQ,GAAG"}
|