@bison-lab/payload-core 5.4.3 → 5.6.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.
Files changed (54) hide show
  1. package/README.md +10 -0
  2. package/dist/alternates-DlRTsaVe.d.mts +23 -0
  3. package/dist/alternates-DlRTsaVe.d.mts.map +1 -0
  4. package/dist/alternates-DxBTUXHh.mjs +19 -0
  5. package/dist/alternates-DxBTUXHh.mjs.map +1 -0
  6. package/dist/block-library.d.mts +1 -1
  7. package/dist/{capability-Dotbq58Q.d.mts → capability-NlorUIta.d.mts} +1 -1
  8. package/dist/{capability-Dotbq58Q.d.mts.map → capability-NlorUIta.d.mts.map} +1 -1
  9. package/dist/{catalogue-DWqHWVE5.d.mts → catalogue-CJ0RlTg4.d.mts} +1 -1
  10. package/dist/{catalogue-DWqHWVE5.d.mts.map → catalogue-CJ0RlTg4.d.mts.map} +1 -1
  11. package/dist/{facet-field-2K22iuWA.d.mts → facet-field-Cd6lffed.d.mts} +1 -1
  12. package/dist/{facet-field-2K22iuWA.d.mts.map → facet-field-Cd6lffed.d.mts.map} +1 -1
  13. package/dist/index.d.mts +7 -7
  14. package/dist/index.mjs +4 -4
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/{locale-CTT3nn6T.d.mts → locale-tnKLkutC.d.mts} +1 -1
  17. package/dist/locale-tnKLkutC.d.mts.map +1 -0
  18. package/dist/{messages-dZV_aAnR.mjs → messages-XFoL9RtF.mjs} +1 -1
  19. package/dist/{messages-dZV_aAnR.mjs.map → messages-XFoL9RtF.mjs.map} +1 -1
  20. package/dist/metadata.d.mts +20 -6
  21. package/dist/metadata.d.mts.map +1 -1
  22. package/dist/metadata.mjs +12 -2
  23. package/dist/metadata.mjs.map +1 -1
  24. package/dist/navigation.d.mts +2 -2
  25. package/dist/og.d.mts +2 -2
  26. package/dist/og.mjs +1 -1
  27. package/dist/{preview-1vwxBgm5.d.mts → preview-B69Dhi8T.d.mts} +2 -2
  28. package/dist/{preview-1vwxBgm5.d.mts.map → preview-B69Dhi8T.d.mts.map} +1 -1
  29. package/dist/{published-B3etM6X5.d.mts → published-2I-k6zEo.d.mts} +3 -3
  30. package/dist/{published-B3etM6X5.d.mts.map → published-2I-k6zEo.d.mts.map} +1 -1
  31. package/dist/{published-CkqqY08H.mjs → published-B80KqlcU.mjs} +1 -1
  32. package/dist/{published-CkqqY08H.mjs.map → published-B80KqlcU.mjs.map} +1 -1
  33. package/dist/{published-QDNmDi02.d.mts → published-BhYTEAK_.d.mts} +2 -2
  34. package/dist/{published-QDNmDi02.d.mts.map → published-BhYTEAK_.d.mts.map} +1 -1
  35. package/dist/seo.d.mts +26 -11
  36. package/dist/seo.d.mts.map +1 -1
  37. package/dist/seo.mjs +19 -10
  38. package/dist/seo.mjs.map +1 -1
  39. package/dist/taxonomy.d.mts +1 -1
  40. package/dist/theme.d.mts +4 -4
  41. package/dist/theme.mjs +1 -1
  42. package/dist/{title-trhUexxM.d.mts → title-BVV3o329.d.mts} +1 -1
  43. package/dist/{title-trhUexxM.d.mts.map → title-BVV3o329.d.mts.map} +1 -1
  44. package/dist/translate-messages-cli.mjs +1 -1
  45. package/dist/translate.d.mts +1 -1
  46. package/dist/translate.mjs +1 -1
  47. package/dist/{types-DLBlHZUd.d.mts → types-B1MmE-L3.d.mts} +1 -1
  48. package/dist/{types-DLBlHZUd.d.mts.map → types-B1MmE-L3.d.mts.map} +1 -1
  49. package/dist/{wireframe-CXorKFU_.mjs → wireframe-Ba65SOj8.mjs} +1 -1
  50. package/dist/{wireframe-CXorKFU_.mjs.map → wireframe-Ba65SOj8.mjs.map} +1 -1
  51. package/dist/wireframe-cli.mjs +1 -1
  52. package/dist/wireframe.mjs +1 -1
  53. package/package.json +3 -3
  54. package/dist/locale-CTT3nn6T.d.mts.map +0 -1
@@ -13,4 +13,4 @@ interface LocaleRead {
13
13
  }
14
14
  //#endregion
15
15
  export { LocaleRead as t };
16
- //# sourceMappingURL=locale-CTT3nn6T.d.mts.map
16
+ //# sourceMappingURL=locale-tnKLkutC.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-tnKLkutC.d.mts","names":[],"sources":["../src/locale.ts"],"mappings":";;AAQA;;;;;;;UAAiB,UAAA;EACf,MAAA;EACA,cAAA;AAAA"}
@@ -90,4 +90,4 @@ async function fillMessages(options) {
90
90
  //#endregion
91
91
  export { fillMessages as t };
92
92
 
93
- //# sourceMappingURL=messages-dZV_aAnR.mjs.map
93
+ //# sourceMappingURL=messages-XFoL9RtF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages-dZV_aAnR.mjs","names":[],"sources":["../src/translate/messages.ts"],"sourcesContent":["import { translateStrings } from \"./strings\";\nimport type { TranslateSite, Translator } from \"./types\";\n\n/** A next-intl message file: nested objects and arrays with string leaves. */\nexport type MessagesJson = string | number | boolean | null | MessagesJson[] | { [key: string]: MessagesJson };\n\nconst BATCH_SIZE = 40;\n\n/** Every string leaf as [path, value]; array indexes are path segments. */\nfunction stringLeaves(\n node: MessagesJson,\n path: string[] = [],\n out: Array<[string[], string]> = [],\n): Array<[string[], string]> {\n if (typeof node === \"string\") out.push([path, node]);\n else if (Array.isArray(node)) node.forEach((item, index) => stringLeaves(item, [...path, String(index)], out));\n else if (node && typeof node === \"object\") {\n for (const [key, value] of Object.entries(node)) stringLeaves(value, [...path, key], out);\n }\n return out;\n}\n\nfunction getAtPath(root: MessagesJson, path: string[]): MessagesJson | undefined {\n let current: MessagesJson | undefined = root;\n for (const segment of path) {\n if (current == null || typeof current !== \"object\") return undefined;\n current = Array.isArray(current) ? current[Number(segment)] : current[segment];\n }\n return current;\n}\n\nfunction setAtPath(root: { [key: string]: MessagesJson }, path: string[], value: string): void {\n let current: { [key: string]: MessagesJson } | MessagesJson[] = root;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i]!;\n const wantArray = /^\\d+$/.test(path[i + 1]!);\n const container = current as Record<string, MessagesJson>;\n let child = container[segment];\n // Create the container when missing, and REPAIR it when the existing\n // target node has the opposite shape from the source (the source changed\n // an object into a list) so string keys never land in an array or the\n // reverse.\n if (child == null || typeof child !== \"object\" || Array.isArray(child) !== wantArray) {\n child = wantArray ? [] : {};\n container[segment] = child;\n }\n current = child as { [key: string]: MessagesJson } | MessagesJson[];\n }\n (current as Record<string, MessagesJson>)[path[path.length - 1]!] = value;\n}\n\n/**\n * The `{name}` arguments of a message, sorted. Plural and select messages are\n * skipped (their branch bodies are braced text the model rightly translates),\n * so this only checks plain interpolations.\n */\nfunction placeholderNames(message: string): string | null {\n if (/,\\s*(plural|select|selectordinal)\\s*,/.test(message)) return null;\n const names = [...message.matchAll(/\\{\\s*([A-Za-z_][\\w]*)\\s*\\}/g)].map((match) => match[1]!);\n return names.sort().join(\",\");\n}\n\n/** A translation that dropped or renamed a `{placeholder}` would break at render; keep the source instead. */\nexport function keepsPlaceholders(source: string, translated: string): boolean {\n const before = placeholderNames(source);\n return before === null || before === placeholderNames(translated);\n}\n\nexport interface FillMessagesResult {\n /** The target file to write. */\n messages: MessagesJson;\n /** Keys translated. */\n translated: number;\n /**\n * Keys whose batch failed, or whose translation lost a `{placeholder}`.\n * They hold the source text, so the file stays\n * complete (a hole renders as MISSING_MESSAGE); a plain re-run will not\n * retry them, `--force` (or a hand edit) will.\n */\n fellBack: number;\n}\n\n/**\n * Fills a target next-intl message file from the source file. The source is\n * the truth; only keys that are missing or empty in the target are\n * translated, so reviewed copy is never overwritten, unless `force`\n * re-translates every key. Batches of 40, so one failure costs at most 40\n * keys. `{placeholders}` survive because the translator's prompt keeps them.\n */\nexport async function fillMessages(options: {\n source: MessagesJson;\n target?: MessagesJson;\n translator: Translator;\n from: string;\n to: string;\n force?: boolean;\n context?: string;\n site?: TranslateSite;\n onProgress?: (done: number, total: number) => void;\n}): Promise<FillMessagesResult> {\n const base =\n !options.force && options.target && typeof options.target === \"object\" && !Array.isArray(options.target)\n ? (structuredClone(options.target) as { [key: string]: MessagesJson })\n : {};\n const missing = stringLeaves(options.source).filter(([path]) => {\n const existing = getAtPath(base, path);\n return typeof existing !== \"string\" || existing.trim() === \"\";\n });\n\n let translated = 0;\n let fellBack = 0;\n for (let i = 0; i < missing.length; i += BATCH_SIZE) {\n const batch = missing.slice(i, i + BATCH_SIZE);\n const sources = batch.map(([, value]) => value);\n const result = await translateStrings(sources, {\n translator: options.translator,\n from: options.from,\n to: options.to,\n context: options.context ?? \"Website UI strings\",\n ...(options.site ? { site: options.site } : {}),\n });\n batch.forEach(([path, source], index) => {\n const value = result?.[index];\n if (value !== undefined && keepsPlaceholders(source, value)) {\n translated += 1;\n setAtPath(base, path, value);\n } else {\n fellBack += 1;\n setAtPath(base, path, source);\n }\n });\n options.onProgress?.(Math.min(i + BATCH_SIZE, missing.length), missing.length);\n }\n return { messages: base, translated, fellBack };\n}\n"],"mappings":";;AAMA,MAAM,aAAa;;AAGnB,SAAS,aACP,MACA,OAAiB,EAAE,EACnB,MAAiC,EAAE,EACR;AAC3B,KAAI,OAAO,SAAS,SAAU,KAAI,KAAK,CAAC,MAAM,KAAK,CAAC;UAC3C,MAAM,QAAQ,KAAK,CAAE,MAAK,SAAS,MAAM,UAAU,aAAa,MAAM,CAAC,GAAG,MAAM,OAAO,MAAM,CAAC,EAAE,IAAI,CAAC;UACrG,QAAQ,OAAO,SAAS,SAC/B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,CAAE,cAAa,OAAO,CAAC,GAAG,MAAM,IAAI,EAAE,IAAI;AAE3F,QAAO;;AAGT,SAAS,UAAU,MAAoB,MAA0C;CAC/E,IAAI,UAAoC;AACxC,MAAK,MAAM,WAAW,MAAM;AAC1B,MAAI,WAAW,QAAQ,OAAO,YAAY,SAAU,QAAO,KAAA;AAC3D,YAAU,MAAM,QAAQ,QAAQ,GAAG,QAAQ,OAAO,QAAQ,IAAI,QAAQ;;AAExE,QAAO;;AAGT,SAAS,UAAU,MAAuC,MAAgB,OAAqB;CAC7F,IAAI,UAA4D;AAChE,MAA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Y,QAAQ;GACpB,MAAM,QAAQ;GACd,IAAI,QAAQ;GACZ,SAAS,QAAQ,WAAW;GAC5B,GAAI,QAAQ,OAAO,EAAE,MAAM,QAAQ,MAAM,GAAG,EAAE;GAC/C,CAAC;AACF,QAAM,SAAS,CAAC,MAAM,SAAS,UAAU;GACvC,MAAM,QAAQ,SAAS;AACvB,OAAI,UAAU,KAAA,KAAa,kBAAkB,QAAQ,MAAM,EAAE;AAC3D,kBAAc;AACd,cAAU,MAAM,MAAM,MAAM;UACvB;AACL,gBAAY;AACZ,cAAU,MAAM,MAAM,OAAO;;IAE/B;AACF,UAAQ,aAAa,KAAK,IAAI,IAAI,YAAY,QAAQ,OAAO,EAAE,QAAQ,OAAO;;AAEhF,QAAO;EAAE,UAAU;EAAM;EAAY;EAAU"}
1
+ {"version":3,"file":"messages-XFoL9RtF.mjs","names":[],"sources":["../src/translate/messages.ts"],"sourcesContent":["import { translateStrings } from \"./strings\";\nimport type { TranslateSite, Translator } from \"./types\";\n\n/** A next-intl message file: nested objects and arrays with string leaves. */\nexport type MessagesJson = string | number | boolean | null | MessagesJson[] | { [key: string]: MessagesJson };\n\nconst BATCH_SIZE = 40;\n\n/** Every string leaf as [path, value]; array indexes are path segments. */\nfunction stringLeaves(\n node: MessagesJson,\n path: string[] = [],\n out: Array<[string[], string]> = [],\n): Array<[string[], string]> {\n if (typeof node === \"string\") out.push([path, node]);\n else if (Array.isArray(node)) node.forEach((item, index) => stringLeaves(item, [...path, String(index)], out));\n else if (node && typeof node === \"object\") {\n for (const [key, value] of Object.entries(node)) stringLeaves(value, [...path, key], out);\n }\n return out;\n}\n\nfunction getAtPath(root: MessagesJson, path: string[]): MessagesJson | undefined {\n let current: MessagesJson | undefined = root;\n for (const segment of path) {\n if (current == null || typeof current !== \"object\") return undefined;\n current = Array.isArray(current) ? current[Number(segment)] : current[segment];\n }\n return current;\n}\n\nfunction setAtPath(root: { [key: string]: MessagesJson }, path: string[], value: string): void {\n let current: { [key: string]: MessagesJson } | MessagesJson[] = root;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i]!;\n const wantArray = /^\\d+$/.test(path[i + 1]!);\n const container = current as Record<string, MessagesJson>;\n let child = container[segment];\n // Create the container when missing, and REPAIR it when the existing\n // target node has the opposite shape from the source (the source changed\n // an object into a list) so string keys never land in an array or the\n // reverse.\n if (child == null || typeof child !== \"object\" || Array.isArray(child) !== wantArray) {\n child = wantArray ? [] : {};\n container[segment] = child;\n }\n current = child as { [key: string]: MessagesJson } | MessagesJson[];\n }\n (current as Record<string, MessagesJson>)[path[path.length - 1]!] = value;\n}\n\n/**\n * The `{name}` arguments of a message, sorted. Plural and select messages are\n * skipped (their branch bodies are braced text the model rightly translates),\n * so this only checks plain interpolations.\n */\nfunction placeholderNames(message: string): string | null {\n if (/,\\s*(plural|select|selectordinal)\\s*,/.test(message)) return null;\n const names = [...message.matchAll(/\\{\\s*([A-Za-z_][\\w]*)\\s*\\}/g)].map((match) => match[1]!);\n return names.sort().join(\",\");\n}\n\n/** A translation that dropped or renamed a `{placeholder}` would break at render; keep the source instead. */\nexport function keepsPlaceholders(source: string, translated: string): boolean {\n const before = placeholderNames(source);\n return before === null || before === placeholderNames(translated);\n}\n\nexport interface FillMessagesResult {\n /** The target file to write. */\n messages: MessagesJson;\n /** Keys translated. */\n translated: number;\n /**\n * Keys whose batch failed, or whose translation lost a `{placeholder}`.\n * They hold the source text, so the file stays\n * complete (a hole renders as MISSING_MESSAGE); a plain re-run will not\n * retry them, `--force` (or a hand edit) will.\n */\n fellBack: number;\n}\n\n/**\n * Fills a target next-intl message file from the source file. The source is\n * the truth; only keys that are missing or empty in the target are\n * translated, so reviewed copy is never overwritten, unless `force`\n * re-translates every key. Batches of 40, so one failure costs at most 40\n * keys. `{placeholders}` survive because the translator's prompt keeps them.\n */\nexport async function fillMessages(options: {\n source: MessagesJson;\n target?: MessagesJson;\n translator: Translator;\n from: string;\n to: string;\n force?: boolean;\n context?: string;\n site?: TranslateSite;\n onProgress?: (done: number, total: number) => void;\n}): Promise<FillMessagesResult> {\n const base =\n !options.force && options.target && typeof options.target === \"object\" && !Array.isArray(options.target)\n ? (structuredClone(options.target) as { [key: string]: MessagesJson })\n : {};\n const missing = stringLeaves(options.source).filter(([path]) => {\n const existing = getAtPath(base, path);\n return typeof existing !== \"string\" || existing.trim() === \"\";\n });\n\n let translated = 0;\n let fellBack = 0;\n for (let i = 0; i < missing.length; i += BATCH_SIZE) {\n const batch = missing.slice(i, i + BATCH_SIZE);\n const sources = batch.map(([, value]) => value);\n const result = await translateStrings(sources, {\n translator: options.translator,\n from: options.from,\n to: options.to,\n context: options.context ?? \"Website UI strings\",\n ...(options.site ? { site: options.site } : {}),\n });\n batch.forEach(([path, source], index) => {\n const value = result?.[index];\n if (value !== undefined && keepsPlaceholders(source, value)) {\n translated += 1;\n setAtPath(base, path, value);\n } else {\n fellBack += 1;\n setAtPath(base, path, source);\n }\n });\n options.onProgress?.(Math.min(i + BATCH_SIZE, missing.length), missing.length);\n }\n return { messages: base, translated, fellBack };\n}\n"],"mappings":";;AAMA,MAAM,aAAa;;AAGnB,SAAS,aACP,MACA,OAAiB,EAAE,EACnB,MAAiC,EAAE,EACR;AAC3B,KAAI,OAAO,SAAS,SAAU,KAAI,KAAK,CAAC,MAAM,KAAK,CAAC;UAC3C,MAAM,QAAQ,KAAK,CAAE,MAAK,SAAS,MAAM,UAAU,aAAa,MAAM,CAAC,GAAG,MAAM,OAAO,MAAM,CAAC,EAAE,IAAI,CAAC;UACrG,QAAQ,OAAO,SAAS,SAC/B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,CAAE,cAAa,OAAO,CAAC,GAAG,MAAM,IAAI,EAAE,IAAI;AAE3F,QAAO;;AAGT,SAAS,UAAU,MAAoB,MAA0C;CAC/E,IAAI,UAAoC;AACxC,MAAK,MAAM,WAAW,MAAM;AAC1B,MAAI,WAAW,QAAQ,OAAO,YAAY,SAAU,QAAO,KAAA;AAC3D,YAAU,M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Q,KAAK,YAAY;EACnD,MAAM,QAAQ,QAAQ,MAAM,GAAG,IAAI,WAAW;EAE9C,MAAM,SAAS,MAAM,iBADL,MAAM,KAAK,GAAG,WAAW,MAAM,EACA;GAC7C,YAAY,QAAQ;GACpB,MAAM,QAAQ;GACd,IAAI,QAAQ;GACZ,SAAS,QAAQ,WAAW;GAC5B,GAAI,QAAQ,OAAO,EAAE,MAAM,QAAQ,MAAM,GAAG,EAAE;GAC/C,CAAC;AACF,QAAM,SAAS,CAAC,MAAM,SAAS,UAAU;GACvC,MAAM,QAAQ,SAAS;AACvB,OAAI,UAAU,KAAA,KAAa,kBAAkB,QAAQ,MAAM,EAAE;AAC3D,kBAAc;AACd,cAAU,MAAM,MAAM,MAAM;UACvB;AACL,gBAAY;AACZ,cAAU,MAAM,MAAM,OAAO;;IAE/B;AACF,UAAQ,aAAa,KAAK,IAAI,IAAI,YAAY,QAAQ,OAAO,EAAE,QAAQ,OAAO;;AAEhF,QAAO;EAAE,UAAU;EAAM;EAAY;EAAU"}
@@ -1,4 +1,5 @@
1
- import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-trhUexxM.mjs";
1
+ import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-BVV3o329.mjs";
2
+ import { t as LocaleAlternatesOptions } from "./alternates-DlRTsaVe.mjs";
2
3
 
3
4
  //#region src/seo/metadata.d.ts
4
5
  /** A page as the reader needs it; a site's generated `Page` is assignable. */
@@ -10,10 +11,10 @@ interface SeoPage {
10
11
  /** Read only to fill `{id}` in `ogImageRoute`. */
11
12
  id?: string | number | null;
12
13
  }
13
- interface PageMetadataOptions {
14
+ interface PageMetadataBaseOptions {
14
15
  /** The suffix a page without a written meta title gets. */
15
16
  siteName: string;
16
- /** This page's absolute URL at the site's own origin. */
17
+ /** This page's absolute URL at the site's own origin, in the locale it was read in. */
17
18
  canonical: string;
18
19
  /** Turns a media file path into an absolute URL; crawlers take no other kind. */
19
20
  absoluteUrl: (path: string) => string;
@@ -27,6 +28,12 @@ interface PageMetadataOptions {
27
28
  */
28
29
  ogImageRoute?: string;
29
30
  }
31
+ /**
32
+ * `pageMetadata`'s options. A multi-locale site adds `locales` and
33
+ * `pathFor` (#281) and gets `alternates.languages`; without them the output
34
+ * is unchanged.
35
+ */
36
+ type PageMetadataOptions<P extends SeoPage = SeoPage> = PageMetadataBaseOptions & LocaleAlternatesOptions<P>;
30
37
  interface PageMetadataImage {
31
38
  url: string;
32
39
  width?: number;
@@ -46,8 +53,10 @@ interface PageMetadata {
46
53
  absolute: string;
47
54
  };
48
55
  description?: string;
56
+ /** `languages` (one URL per locale plus `x-default`) only when `locales` was passed. */
49
57
  alternates: {
50
58
  canonical: string;
59
+ languages?: Record<string, string>;
51
60
  };
52
61
  openGraph: {
53
62
  title: string;
@@ -73,10 +82,15 @@ interface PageMetadata {
73
82
  * whose SEO tab has no share image gets the generated card instead. Fields the editor left empty
74
83
  * are left out, so the layout's defaults (a site-wide description, a default
75
84
  * share image) carry through Next's merge. The canonical is always this
76
- * site's origin; a page that must canonicalise elsewhere is a redirect, not
85
+ * site's origin; a page that must canonicalize elsewhere is a redirect, not
77
86
  * a field.
87
+ *
88
+ * With `locales` and `pathFor`, `alternates.languages` lists the page's URL
89
+ * in every locale plus `x-default`. The title and description are whatever
90
+ * `page.meta` holds, so read the page in the request's locale (`localeArgs`)
91
+ * and they come from that locale's localized SEO tab.
78
92
  */
79
- declare function pageMetadata(page: SeoPage, options: PageMetadataOptions): PageMetadata;
93
+ declare function pageMetadata<P extends SeoPage>(page: P, options: PageMetadataOptions<P>): PageMetadata;
80
94
  //#endregion
81
- export { type MediaId, type PageMetadata, type PageMetadataImage, type PageMetadataOptions, type SeoImageDoc, type SeoImageSize, type SeoImageValue, type SeoMeta, type SeoPage, documentTitle, pageMetadata, titleTemplate };
95
+ export { type LocaleAlternatesOptions, type MediaId, type PageMetadata, type PageMetadataBaseOptions, type PageMetadataImage, type PageMetadataOptions, type SeoImageDoc, type SeoImageSize, type SeoImageValue, type SeoMeta, type SeoPage, documentTitle, pageMetadata, titleTemplate };
82
96
  //# sourceMappingURL=metadata.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.mts","names":[],"sources":["../src/seo/metadata.ts"],"mappings":";;;;UAKiB,OAAA;EACf,KAAA;EACA,IAAA,GAAO,OAAA;;EAEP,IAAA;EAHA;EAKA,EAAA;AAAA;AAAA,UAGe,mBAAA;EAHf;EAKA,QAAA;EALE;EAOF,SAAA;EAJkC;EAMlC,WAAA,GAAc,IAAA;EANoB;EAQlC,SAAA;EAJA;;;;;;EAWA,YAAA;AAAA;AAAA,UAGe,iBAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;EACA,GAAA;AAAA;;;;AAWF;;;;;UAAiB,YAAA;EACf,KAAA;IAAkB,QAAA;EAAA;EAClB,WAAA;EACA,UAAA;IAAc,SAAA;EAAA;EACd,SAAA;IACE,KAAA;IACA,WAAA;IACA,GAAA;IACA,MAAA,GAAS,iBAAA;EAAA;EAEX,OAAA;IACE,IAAA;IACA,KAAA;IACA,WAAA;IACA,MAAA,GAAS,iBAAA;EAAA;EAEX,MAAA;IAAW,KAAA;IAAc,MAAA;EAAA;AAAA;;;;;;;;;;;iBAwDX,YAAA,CACd,IAAA,EAAM,OAAA,EACN,OAAA,EAAS,mBAAA,GACR,YAAA"}
1
+ {"version":3,"file":"metadata.d.mts","names":[],"sources":["../src/seo/metadata.ts"],"mappings":";;;;;UAMiB,OAAA;EACf,KAAA;EACA,IAAA,GAAO,OAAA;;EAEP,IAAA;EAHA;EAKA,EAAA;AAAA;AAAA,UAGe,uBAAA;EAHf;EAKA,QAAA;EALE;EAOF,SAAA;EAJsC;EAMtC,WAAA,GAAc,IAAA;EANwB;EAQtC,SAAA;EAJA;;;;;;EAWA,YAAA;AAAA;;;;;;KAQU,mBAAA,WAA8B,OAAA,GAAU,OAAA,IAAW,uBAAA,GAC7D,uBAAA,CAAwB,CAAA;AAAA,UAET,iBAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;EACA,GAAA;AAAA;;;;;;AAJF;;;UAeiB,YAAA;EACf,KAAA;IAAkB,QAAA;EAAA;EAClB,WAAA;EAbG;EAeH,UAAA;IAAc,SAAA;IAAmB,SAAA,GAAY,MAAA;EAAA;EAC7C,SAAA;IACE,KAAA;IACA,WAAA;IACA,GAAA;IACA,MAAA,GAAS,iBAAA;EAAA;EAEX,OAAA;IACE,IAAA;IACA,KAAA;IACA,WAAA;IACA,MAAA,GAAS,iBAAA;EAAA;EAEX,MAAA;IAAW,KAAA;IAAc,MAAA;EAAA;AAAA;;;;;;;;;;;;;AA6D3B;;;iBAAgB,YAAA,WAAuB,OAAA,CAAA,CACrC,IAAA,EAAM,CAAA,EACN,OAAA,EAAS,mBAAA,CAAoB,CAAA,IAC5B,YAAA"}
package/dist/metadata.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { n as titleTemplate, t as documentTitle } from "./title-DJ7C48gq.mjs";
2
2
  import { t as SHARE_IMAGE_SIZE } from "./share-image-C8ZtIcU8.mjs";
3
+ import { t as languageAlternates } from "./alternates-DxBTUXHh.mjs";
3
4
  //#region src/seo/metadata.ts
4
5
  /**
5
6
  * The share image as a crawler wants it, or `undefined` when the page has
@@ -50,8 +51,13 @@ function generatedImage(page, options, alt) {
50
51
  * whose SEO tab has no share image gets the generated card instead. Fields the editor left empty
51
52
  * are left out, so the layout's defaults (a site-wide description, a default
52
53
  * share image) carry through Next's merge. The canonical is always this
53
- * site's origin; a page that must canonicalise elsewhere is a redirect, not
54
+ * site's origin; a page that must canonicalize elsewhere is a redirect, not
54
55
  * a field.
56
+ *
57
+ * With `locales` and `pathFor`, `alternates.languages` lists the page's URL
58
+ * in every locale plus `x-default`. The title and description are whatever
59
+ * `page.meta` holds, so read the page in the request's locale (`localeArgs`)
60
+ * and they come from that locale's localized SEO tab.
55
61
  */
56
62
  function pageMetadata(page, options) {
57
63
  const meta = page.meta ?? {};
@@ -59,10 +65,14 @@ function pageMetadata(page, options) {
59
65
  const description = meta.description ? { description: meta.description } : {};
60
66
  const image = shareImage(meta.image, options) ?? generatedImage(page, options, page.title);
61
67
  const images = image ? { images: [image] } : {};
68
+ const languages = languageAlternates(page, options, options.absoluteUrl);
62
69
  return {
63
70
  title: meta.title ? { absolute: meta.title } : page.title,
64
71
  ...description,
65
- alternates: { canonical: options.canonical },
72
+ alternates: {
73
+ canonical: options.canonical,
74
+ ...languages ? { languages } : {}
75
+ },
66
76
  openGraph: {
67
77
  title,
68
78
  ...description,
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.mjs","names":[],"sources":["../src/seo/metadata.ts"],"sourcesContent":["import { SHARE_IMAGE_SIZE } from \"./share-image\";\nimport { documentTitle } from \"./title\";\nimport type { SeoImageValue, SeoMeta } from \"./types\";\n\n/** A page as the reader needs it; a site's generated `Page` is assignable. */\nexport interface SeoPage {\n title: string;\n meta?: SeoMeta | null;\n /** Read only to fill `{slug}` in `ogImageRoute`. */\n slug?: string | null;\n /** Read only to fill `{id}` in `ogImageRoute`. */\n id?: string | number | null;\n}\n\nexport interface PageMetadataOptions {\n /** The suffix a page without a written meta title gets. */\n siteName: string;\n /** This page's absolute URL at the site's own origin. */\n canonical: string;\n /** Turns a media file path into an absolute URL; crawlers take no other kind. */\n absoluteUrl: (path: string) => string;\n /** The rendition to read off the meta image. Default `SHARE_IMAGE_SIZE.name`. */\n shareSize?: string;\n /**\n * Where the site mounts `ogImageHandler` from `@bison-lab/payload-core/og`,\n * as a path pattern with `{slug}` or `{id}`: `\"/og/{slug}\"`. A page with\n * no share image points `og:image` at it (BIS-183); an uploaded share\n * image always wins. Omit it and a page without one has no image, as before.\n */\n ogImageRoute?: string;\n}\n\nexport interface PageMetadataImage {\n url: string;\n width?: number;\n height?: number;\n alt?: string;\n}\n\n/**\n * The shape `pageMetadata` returns, assignable to Next's `Metadata` without\n * this package depending on `next`. A written meta title is `absolute` so\n * the layout's title template does not append the site name a second time;\n * an unwritten one is the bare page title, which the template completes.\n * Optional keys are absent rather than `undefined`: Next's merge lets an\n * `undefined` key override the layout's value instead of inheriting it.\n */\nexport interface PageMetadata {\n title: string | { absolute: string };\n description?: string;\n alternates: { canonical: string };\n openGraph: {\n title: string;\n description?: string;\n url: string;\n images?: PageMetadataImage[];\n };\n twitter: {\n card: \"summary_large_image\";\n title: string;\n description?: string;\n images?: PageMetadataImage[];\n };\n robots?: { index: false; follow: false };\n}\n\n/**\n * The share image as a crawler wants it, or `undefined` when the page has\n * none or the relation came back unpopulated (`depth: 0` upstream). The\n * named rendition is preferred; a file uploaded before that size existed, or\n * too small to cut, has only its original, which is used as is.\n */\nfunction shareImage(\n image: SeoImageValue,\n { absoluteUrl, shareSize = SHARE_IMAGE_SIZE.name }: PageMetadataOptions,\n): PageMetadataImage | undefined {\n if (!image || typeof image !== \"object\") return undefined;\n const rendition = image.sizes?.[shareSize];\n const file = rendition?.url ? rendition : image;\n if (!file.url) return undefined;\n return {\n url: absoluteUrl(file.url),\n ...(file.width ? { width: file.width } : {}),\n ...(file.height ? { height: file.height } : {}),\n ...(image.alt ? { alt: image.alt } : {}),\n };\n}\n\n/**\n * The generated card for a page, from `ogImageRoute`, or `undefined` when\n * the pattern names a value the page does not carry.\n */\nfunction generatedImage(page: SeoPage, options: PageMetadataOptions, alt: string): PageMetadataImage | undefined {\n const route = options.ogImageRoute;\n if (!route) return undefined;\n let missing = false;\n const path = route.replace(/\\{(slug|id)\\}/g, (_, key: \"slug\" | \"id\") => {\n const value = page[key];\n if (value === undefined || value === null || value === \"\") {\n missing = true;\n return \"\";\n }\n // A nested slug keeps its slashes: each segment is encoded on its own.\n return String(value).split(\"/\").map(encodeURIComponent).join(\"/\");\n });\n if (missing) return undefined;\n return { url: options.absoluteUrl(path), width: SHARE_IMAGE_SIZE.width, height: SHARE_IMAGE_SIZE.height, alt };\n}\n\n/**\n * Next metadata for a page with the SEO tab: `<title>`, description,\n * canonical, Open Graph and Twitter with the share image, and\n * `noindex, nofollow` when the page is hidden. With `ogImageRoute`, a page\n * whose SEO tab has no share image gets the generated card instead. Fields the editor left empty\n * are left out, so the layout's defaults (a site-wide description, a default\n * share image) carry through Next's merge. The canonical is always this\n * site's origin; a page that must canonicalise elsewhere is a redirect, not\n * a field.\n */\nexport function pageMetadata(\n page: SeoPage,\n options: PageMetadataOptions,\n): PageMetadata {\n const meta = page.meta ?? {};\n const title = meta.title || documentTitle(options.siteName, page.title);\n const description = meta.description ? { description: meta.description } : {};\n const image = shareImage(meta.image, options) ?? generatedImage(page, options, page.title);\n const images = image ? { images: [image] } : {};\n\n return {\n title: meta.title ? { absolute: meta.title } : page.title,\n ...description,\n alternates: { canonical: options.canonical },\n openGraph: { title, ...description, url: options.canonical, ...images },\n twitter: { card: \"summary_large_image\", title, ...description, ...images },\n // Both off: a page hidden from search should not lend its links weight either.\n ...(meta.noIndex ? { robots: { index: false, follow: false } } : {}),\n };\n}\n"],"mappings":";;;;;;;;;AAwEA,SAAS,WACP,OACA,EAAE,aAAa,YAAY,iBAAiB,QACb;AAC/B,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO,KAAA;CAChD,MAAM,YAAY,MAAM,QAAQ;CAChC,MAAM,OAAO,WAAW,MAAM,YAAY;AAC1C,KAAI,CAAC,KAAK,IAAK,QAAO,KAAA;AACtB,QAAO;EACL,KAAK,YAAY,KAAK,IAAI;EAC1B,GAAI,KAAK,QAAQ,EAAE,OAAO,KAAK,OAAO,GAAG,EAAE;EAC3C,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE;EAC9C,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,KAAK,GAAG,EAAE;EACxC;;;;;;AAOH,SAAS,eAAe,MAAe,SAA8B,KAA4C;CAC/G,MAAM,QAAQ,QAAQ;AACtB,KAAI,CAAC,MAAO,QAAO,KAAA;CACnB,IAAI,UAAU;CACd,MAAM,OAAO,MAAM,QAAQ,mBAAmB,GAAG,QAAuB;EACtE,MAAM,QAAQ,KAAK;AACnB,MAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI;AACzD,aAAU;AACV,UAAO;;AAGT,SAAO,OAAO,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,mBAAmB,CAAC,KAAK,IAAI;GACjE;AACF,KAAI,QAAS,QAAO,KAAA;AACpB,QAAO;EAAE,KAAK,QAAQ,YAAY,KAAK;EAAE,OAAO,iBAAiB;EAAO,QAAQ,iBAAiB;EAAQ;EAAK;;;;;;;;;;;;AAahH,SAAgB,aACd,MACA,SACc;CACd,MAAM,OAAO,KAAK,QAAQ,EAAE;CAC5B,MAAM,QAAQ,KAAK,SAAS,cAAc,QAAQ,UAAU,KAAK,MAAM;CACvE,MAAM,cAAc,KAAK,cAAc,EAAE,aAAa,KAAK,aAAa,GAAG,EAAE;CAC7E,MAAM,QAAQ,WAAW,KAAK,OAAO,QAAQ,IAAI,eAAe,MAAM,SAAS,KAAK,MAAM;CAC1F,MAAM,SAAS,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;AAE/C,QAAO;EACL,OAAO,KAAK,QAAQ,EAAE,UAAU,KAAK,OAAO,GAAG,KAAK;EACpD,GAAG;EACH,YAAY,EAAE,WAAW,QAAQ,WAAW;EAC5C,WAAW;GAAE;GAAO,GAAG;GAAa,KAAK,QAAQ;GAAW,GAAG;GAAQ;EACvE,SAAS;GAAE,MAAM;GAAuB;GAAO,GAAG;GAAa,GAAG;GAAQ;EAE1E,GAAI,KAAK,UAAU,EAAE,QAAQ;GAAE,OAAO;GAAO,QAAQ;GAAO,EAAE,GAAG,EAAE;EACpE"}
1
+ {"version":3,"file":"metadata.mjs","names":[],"sources":["../src/seo/metadata.ts"],"sourcesContent":["import { languageAlternates, type LocaleAlternatesOptions } from \"./alternates\";\nimport { SHARE_IMAGE_SIZE } from \"./share-image\";\nimport { documentTitle } from \"./title\";\nimport type { SeoImageValue, SeoMeta } from \"./types\";\n\n/** A page as the reader needs it; a site's generated `Page` is assignable. */\nexport interface SeoPage {\n title: string;\n meta?: SeoMeta | null;\n /** Read only to fill `{slug}` in `ogImageRoute`. */\n slug?: string | null;\n /** Read only to fill `{id}` in `ogImageRoute`. */\n id?: string | number | null;\n}\n\nexport interface PageMetadataBaseOptions {\n /** The suffix a page without a written meta title gets. */\n siteName: string;\n /** This page's absolute URL at the site's own origin, in the locale it was read in. */\n canonical: string;\n /** Turns a media file path into an absolute URL; crawlers take no other kind. */\n absoluteUrl: (path: string) => string;\n /** The rendition to read off the meta image. Default `SHARE_IMAGE_SIZE.name`. */\n shareSize?: string;\n /**\n * Where the site mounts `ogImageHandler` from `@bison-lab/payload-core/og`,\n * as a path pattern with `{slug}` or `{id}`: `\"/og/{slug}\"`. A page with\n * no share image points `og:image` at it (BIS-183); an uploaded share\n * image always wins. Omit it and a page without one has no image, as before.\n */\n ogImageRoute?: string;\n}\n\n/**\n * `pageMetadata`'s options. A multi-locale site adds `locales` and\n * `pathFor` (#281) and gets `alternates.languages`; without them the output\n * is unchanged.\n */\nexport type PageMetadataOptions<P extends SeoPage = SeoPage> = PageMetadataBaseOptions &\n LocaleAlternatesOptions<P>;\n\nexport interface PageMetadataImage {\n url: string;\n width?: number;\n height?: number;\n alt?: string;\n}\n\n/**\n * The shape `pageMetadata` returns, assignable to Next's `Metadata` without\n * this package depending on `next`. A written meta title is `absolute` so\n * the layout's title template does not append the site name a second time;\n * an unwritten one is the bare page title, which the template completes.\n * Optional keys are absent rather than `undefined`: Next's merge lets an\n * `undefined` key override the layout's value instead of inheriting it.\n */\nexport interface PageMetadata {\n title: string | { absolute: string };\n description?: string;\n /** `languages` (one URL per locale plus `x-default`) only when `locales` was passed. */\n alternates: { canonical: string; languages?: Record<string, string> };\n openGraph: {\n title: string;\n description?: string;\n url: string;\n images?: PageMetadataImage[];\n };\n twitter: {\n card: \"summary_large_image\";\n title: string;\n description?: string;\n images?: PageMetadataImage[];\n };\n robots?: { index: false; follow: false };\n}\n\n/**\n * The share image as a crawler wants it, or `undefined` when the page has\n * none or the relation came back unpopulated (`depth: 0` upstream). The\n * named rendition is preferred; a file uploaded before that size existed, or\n * too small to cut, has only its original, which is used as is.\n */\nfunction shareImage(\n image: SeoImageValue,\n { absoluteUrl, shareSize = SHARE_IMAGE_SIZE.name }: PageMetadataBaseOptions,\n): PageMetadataImage | undefined {\n if (!image || typeof image !== \"object\") return undefined;\n const rendition = image.sizes?.[shareSize];\n const file = rendition?.url ? rendition : image;\n if (!file.url) return undefined;\n return {\n url: absoluteUrl(file.url),\n ...(file.width ? { width: file.width } : {}),\n ...(file.height ? { height: file.height } : {}),\n ...(image.alt ? { alt: image.alt } : {}),\n };\n}\n\n/**\n * The generated card for a page, from `ogImageRoute`, or `undefined` when\n * the pattern names a value the page does not carry.\n */\nfunction generatedImage(page: SeoPage, options: PageMetadataBaseOptions, alt: string): PageMetadataImage | undefined {\n const route = options.ogImageRoute;\n if (!route) return undefined;\n let missing = false;\n const path = route.replace(/\\{(slug|id)\\}/g, (_, key: \"slug\" | \"id\") => {\n const value = page[key];\n if (value === undefined || value === null || value === \"\") {\n missing = true;\n return \"\";\n }\n // A nested slug keeps its slashes: each segment is encoded on its own.\n return String(value).split(\"/\").map(encodeURIComponent).join(\"/\");\n });\n if (missing) return undefined;\n return { url: options.absoluteUrl(path), width: SHARE_IMAGE_SIZE.width, height: SHARE_IMAGE_SIZE.height, alt };\n}\n\n/**\n * Next metadata for a page with the SEO tab: `<title>`, description,\n * canonical, Open Graph and Twitter with the share image, and\n * `noindex, nofollow` when the page is hidden. With `ogImageRoute`, a page\n * whose SEO tab has no share image gets the generated card instead. Fields the editor left empty\n * are left out, so the layout's defaults (a site-wide description, a default\n * share image) carry through Next's merge. The canonical is always this\n * site's origin; a page that must canonicalize elsewhere is a redirect, not\n * a field.\n *\n * With `locales` and `pathFor`, `alternates.languages` lists the page's URL\n * in every locale plus `x-default`. The title and description are whatever\n * `page.meta` holds, so read the page in the request's locale (`localeArgs`)\n * and they come from that locale's localized SEO tab.\n */\nexport function pageMetadata<P extends SeoPage>(\n page: P,\n options: PageMetadataOptions<P>,\n): PageMetadata {\n const meta = page.meta ?? {};\n const title = meta.title || documentTitle(options.siteName, page.title);\n const description = meta.description ? { description: meta.description } : {};\n const image = shareImage(meta.image, options) ?? generatedImage(page, options, page.title);\n const images = image ? { images: [image] } : {};\n const languages = languageAlternates(page, options, options.absoluteUrl);\n\n return {\n title: meta.title ? { absolute: meta.title } : page.title,\n ...description,\n alternates: { canonical: options.canonical, ...(languages ? { languages } : {}) },\n openGraph: { title, ...description, url: options.canonical, ...images },\n twitter: { card: \"summary_large_image\", title, ...description, ...images },\n // Both off: a page hidden from search should not lend its links weight either.\n ...(meta.noIndex ? { robots: { index: false, follow: false } } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;AAkFA,SAAS,WACP,OACA,EAAE,aAAa,YAAY,iBAAiB,QACb;AAC/B,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO,KAAA;CAChD,MAAM,YAAY,MAAM,QAAQ;CAChC,MAAM,OAAO,WAAW,MAAM,YAAY;AAC1C,KAAI,CAAC,KAAK,IAAK,QAAO,KAAA;AACtB,QAAO;EACL,KAAK,YAAY,KAAK,IAAI;EAC1B,GAAI,KAAK,QAAQ,EAAE,OAAO,KAAK,OAAO,GAAG,EAAE;EAC3C,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE;EAC9C,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,KAAK,GAAG,EAAE;EACxC;;;;;;AAOH,SAAS,eAAe,MAAe,SAAkC,KAA4C;CACnH,MAAM,QAAQ,QAAQ;AACtB,KAAI,CAAC,MAAO,QAAO,KAAA;CACnB,IAAI,UAAU;CACd,MAAM,OAAO,MAAM,QAAQ,mBAAmB,GAAG,QAAuB;EACtE,MAAM,QAAQ,KAAK;AACn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VIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, g as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG } from "./published-QDNmDi02.mjs";
1
+ import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
2
+ import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, g as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG } from "./published-BhYTEAK_.mjs";
3
3
  export { EXTERNAL_HREF_MESSAGE, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, type FooterColumnWidth, type FooterSocial, type LocaleRead, NAVIGATION_DB_NAME, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, type NavigationBar, type NavigationDoc, type NavigationFooter, type NavigationHeader, footerDesktopTracks, getNavigation, isValidExternalHref, normalizeFooterDesktop, validateExternalHref, validateFooterSocialUrl, validateHeaderCta };
package/dist/og.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as ThemeIdentityFallback } from "./types-DLBlHZUd.mjs";
2
- import { t as ThemePayload } from "./published-B3etM6X5.mjs";
1
+ import { _ as ThemeIdentityFallback } from "./types-B1MmE-L3.mjs";
2
+ import { t as ThemePayload } from "./published-2I-k6zEo.mjs";
3
3
  import { FontId } from "@bison-lab/fonts";
4
4
  import { ThemeConfig } from "@bison-lab/tokens";
5
5
  import { Payload } from "payload";
package/dist/og.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as SHARE_IMAGE_SIZE } from "./share-image-C8ZtIcU8.mjs";
2
2
  import "./identity-CN6EOeDM.mjs";
3
- import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-CkqqY08H.mjs";
3
+ import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-B80KqlcU.mjs";
4
4
  import { isFontId } from "@bison-lab/fonts";
5
5
  import { auditTheme, brandColorsFromConfig, deriveDarkPalette, deriveLightPalette } from "@bison-lab/tokens";
6
6
  import * as fontsServer from "@bison-lab/fonts/server";
@@ -1,4 +1,4 @@
1
- import { d as ThemeDoc, m as ThemeLibraryColorDoc } from "./types-DLBlHZUd.mjs";
1
+ import { d as ThemeDoc, m as ThemeLibraryColorDoc } from "./types-B1MmE-L3.mjs";
2
2
  import { ShadeStep } from "@bison-lab/tokens";
3
3
  import { StaticLabel, TextField, TextFieldSingleValidation } from "payload";
4
4
 
@@ -110,4 +110,4 @@ declare const THEME_PREVIEW_BREAKPOINTS: readonly [{
110
110
  }];
111
111
  //#endregion
112
112
  export { deleteLibraryColor as _, PageEditorSystemKey as a, pageEditorTokens as c, LookFieldOptions as d, colorTokenField as f, rewriteColorTokens as g, findColorTokens as h, PAGE_EDITOR_SYSTEM_KEYS as i, themeLibraryFromDoc as l, ColorTokenHit as m, ColorSwatch as n, pageEditorLooks as o, lookField as p, LookOption as r, pageEditorSwatches as s, THEME_PREVIEW_BREAKPOINTS as t, LookFieldMode as u, rewriteColorToken as v, themeColorKeys as y };
113
- //# sourceMappingURL=preview-1vwxBgm5.d.mts.map
113
+ //# sourceMappingURL=preview-B69Dhi8T.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preview-1vwxBgm5.d.mts","names":[],"sources":["../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/looks.ts","../src/theme/preview.ts"],"mappings":";;;;;;;;;;iBAoBgB,iBAAA,CAAkB,KAAA,UAAe,OAAA,UAAiB,KAAA;AAAA,iBAUlD,cAAA,CAAe,GAAA,EAAK,QAAA;AAApC;;;;;AAaA;AAbA,iBAagB,kBAAA,CAAmB,GAAA,EAAK,QAAA,EAAU,GAAA,UAAa,WAAA,YAAuB,QAAA;;;UCzCrE,aAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,iBAWc,eAAA,CAAgB,KAAA,WAAgB,GAAA,WAAc,aAAA;AAAA,iBAQ9C,kBAAA,GAAA,CAAsB,KAAA,EAAO,CAAA,EAAG,OAAA,UAAiB,KAAA,WAAgB,CAAA;;;UClBhE,gBAAA;EACf,IAAA;EACA,KAAA,GAAQ,WAAA;EACR,QAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,GAAW,yBAAA;AAAA;AAAA,KAGD,aAAA;;;;AFiBZ;;;iBE0BgB,SAAA,CAAU,SAAA,GAAW,gBAAA,GAAwB,SAAA;;AFb7D;;iBEoBgB,eAAA,CAAgB,SAAA,GAAW,gBAAA,GAAwB,SAAA;;;;;;AF3CnE;cGXa,uBAAA;AAAA,KAED,mBAAA,WAA8B,uBAAA;AAAA,UAEzB,UAAA;EACf,KAAA;EACA,KAAA;AAAA;AAAA,iBAiBc,mBAAA,CAAoB,GAAA,EAAK,QAAA,sBAA8B,oBAAA;;AHFvE;;;;iBGuBgB,eAAA,CAAgB,GAAA,EAAK,QAAA,sBAA8B,UAAA;AHVnE;;;;AAAA,iBG6BgB,gBAAA,CAAiB,GAAA,EAAK,QAAA,sBAA8B,UAAA;;UAoBnD,WAAA,SAAoB,UAAA;EHjD0B;EGmD7D,MAAA;EHnD4F;EGqD5F,WAAA;EACA,IAAA,EAAM,SAAA;;EAEN,GAAA;AAAA;;;;;AFpFF;iBE4FgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,sBAA8B,WAAA;;;;;;;cCvGzD,yBAAA;EAAA"}
1
+ {"version":3,"file":"preview-B69Dhi8T.d.mts","names":[],"sources":["../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/looks.ts","../src/theme/preview.ts"],"mappings":";;;;;;;;;;iBAoBgB,iBAAA,CAAkB,KAAA,UAAe,OAAA,UAAiB,KAAA;AAAA,iBAUlD,cAAA,CAAe,GAAA,EAAK,QAAA;AAApC;;;;;AAaA;AAbA,iBAagB,kBAAA,CAAmB,GAAA,EAAK,QAAA,EAAU,GAAA,UAAa,WAAA,YAAuB,QAAA;;;UCzCrE,aAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,iBAWc,eAAA,CAAgB,KAAA,WAAgB,GAAA,WAAc,aAAA;AAAA,iBAQ9C,kBAAA,GAAA,CAAsB,KAAA,EAAO,CAAA,EAAG,OAAA,UAAiB,KAAA,WAAgB,CAAA;;;UClBhE,gBAAA;EACf,IAAA;EACA,KAAA,GAAQ,WAAA;EACR,QAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,GAAW,yBAAA;AAAA;AAAA,KAGD,aAAA;;;;AFiBZ;;;iBE0BgB,SAAA,CAAU,SAAA,GAAW,gBAAA,GAAwB,SAAA;;AFb7D;;iBEoBgB,eAAA,CAAgB,SAAA,GAAW,gBAAA,GAAwB,SAAA;;;;;;AF3CnE;cGXa,uBAAA;AAAA,KAED,mBAAA,WAA8B,uBAAA;AAAA,UAEzB,UAAA;EACf,KAAA;EACA,KAAA;AAAA;AAAA,iBAiBc,mBAAA,CAAoB,GAAA,EAAK,QAAA,sBAA8B,oBAAA;;AHFvE;;;;iBGuBgB,eAAA,CAAgB,GAAA,EAAK,QAAA,sBAA8B,UAAA;AHVnE;;;;AAAA,iBG6BgB,gBAAA,CAAiB,GAAA,EAAK,QAAA,sBAA8B,UAAA;;UAoBnD,WAAA,SAAoB,UAAA;EHjD0B;EGmD7D,MAAA;EHnD4F;EGqD5F,WAAA;EACA,IAAA,EAAM,SAAA;;EAEN,GAAA;AAAA;;;;;AFpFF;iBE4FgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,sBAA8B,WAAA;;;;;;;cCvGzD,yBAAA;EAAA"}
@@ -1,5 +1,5 @@
1
- import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-DLBlHZUd.mjs";
2
- import { t as LocaleRead } from "./locale-CTT3nn6T.mjs";
1
+ import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-B1MmE-L3.mjs";
2
+ import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
3
3
  import { ThemeConfig } from "@bison-lab/tokens";
4
4
 
5
5
  //#region src/theme/published.d.ts
@@ -27,4 +27,4 @@ declare function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Pr
27
27
  declare function getPublishedIdentity(payload: ThemePayload, fallback?: ThemeIdentityFallback, read?: LocaleRead): Promise<ResolvedThemeIdentity>;
28
28
  //#endregion
29
29
  export { getPublishedIdentity as n, getPublishedTheme as r, ThemePayload as t };
30
- //# sourceMappingURL=published-B3etM6X5.d.mts.map
30
+ //# sourceMappingURL=published-2I-k6zEo.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-B3etM6X5.d.mts","names":[],"sources":["../src/theme/published.ts"],"mappings":";;;;;UAQiB,YAAA;EAIf,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,QAAA;AAAA;;;;;;iBAQM,iBAAA,CAAkB,OAAA,EAAS,YAAA,EAAc,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,WAAA;;AAA3F;;;;;;iBAiBsB,oBAAA,CACpB,OAAA,EAAS,YAAA,EACT,QAAA,GAAW,qBAAA,EACX,IAAA,GAAM,UAAA,GACL,OAAA,CAAQ,qBAAA"}
1
+ {"version":3,"file":"published-2I-k6zEo.d.mts","names":[],"sources":["../src/theme/published.ts"],"mappings":";;;;;UAQiB,YAAA;EAIf,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,QAAA;AAAA;;;;;;iBAQM,iBAAA,CAAkB,OAAA,EAAS,YAAA,EAAc,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,WAAA;;AAA3F;;;;;;iBAiBsB,oBAAA,CACpB,OAAA,EAAS,YAAA,EACT,QAAA,GAAW,qBAAA,EACX,IAAA,GAAM,UAAA,GACL,OAAA,CAAQ,qBAAA"}
@@ -33,4 +33,4 @@ async function getPublishedIdentity(payload, fallback, read = {}) {
33
33
  //#endregion
34
34
  export { getPublishedTheme as n, getPublishedIdentity as t };
35
35
 
36
- //# sourceMappingURL=published-CkqqY08H.mjs.map
36
+ //# sourceMappingURL=published-B80KqlcU.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-CkqqY08H.mjs","names":[],"sources":["../src/theme/published.ts"],"sourcesContent":["import type { ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { localeArgs, type LocaleRead } from \"../locale\";\nimport { resolveThemeIdentity, type ResolvedThemeIdentity, type ThemeIdentityFallback } from \"./identity\";\nimport { themeConfigFromDoc } from \"./map\";\nimport { THEME_SLUG } from \"./types\";\nimport type { ThemeDoc } from \"./types\";\n\nexport interface ThemePayload {\n // No `locale` here: a site's generated types narrow it to its own\n // locales, and a wider `string` would refuse the site's `payload`. The\n // readers spread it in, which TypeScript does not check as excess.\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n}\n\n/**\n * The Theme row, or `seed` when the Global is empty. Theme has no draft\n * mode: `draft: false` is the live document. Access is overridden so a\n * logged-out request still gets the colours.\n */\nexport async function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Promise<ThemeConfig> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 0,\n overrideAccess: true,\n });\n return themeConfigFromDoc(doc ?? {}, seed);\n}\n\n/**\n * Uploaded logo, favicon, and mobile-menu mark, or the fallback the site\n * passed into `createTheme`. Depth 1 so the upload url is populated.\n * Takes the request's `locale` like every other reader. Theme and its\n * brand assets hold no localized field today (a logo's alt is the brand\n * name), so it only matters once one does.\n */\nexport async function getPublishedIdentity(\n payload: ThemePayload,\n fallback?: ThemeIdentityFallback,\n read: LocaleRead = {},\n): Promise<ResolvedThemeIdentity> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 1,\n overrideAccess: true,\n ...localeArgs(read),\n });\n return resolveThemeIdentity(doc ?? {}, fallback);\n}\n"],"mappings":";;;;;;;;AAyBA,eAAsB,kBAAkB,SAAuB,MAAyC;AAOtG,QAAO,mBANK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EACjB,CAAC,IAC+B,EAAE,EAAE,KAAK;;;;;;;;;AAU5C,eAAsB,qBACpB,SACA,UACA,OAAmB,EAAE,EACW;AAQhC,QAAO,qBAPK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EAChB,GAAG,WAAW,KAAK;EACpB,CAAC,IACiC,EAAE,EAAE,SAAS"}
1
+ {"version":3,"file":"published-B80KqlcU.mjs","names":[],"sources":["../src/theme/published.ts"],"sourcesContent":["import type { ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { localeArgs, type LocaleRead } from \"../locale\";\nimport { resolveThemeIdentity, type ResolvedThemeIdentity, type ThemeIdentityFallback } from \"./identity\";\nimport { themeConfigFromDoc } from \"./map\";\nimport { THEME_SLUG } from \"./types\";\nimport type { ThemeDoc } from \"./types\";\n\nexport interface ThemePayload {\n // No `locale` here: a site's generated types narrow it to its own\n // locales, and a wider `string` would refuse the site's `payload`. The\n // readers spread it in, which TypeScript does not check as excess.\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n}\n\n/**\n * The Theme row, or `seed` when the Global is empty. Theme has no draft\n * mode: `draft: false` is the live document. Access is overridden so a\n * logged-out request still gets the colours.\n */\nexport async function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Promise<ThemeConfig> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 0,\n overrideAccess: true,\n });\n return themeConfigFromDoc(doc ?? {}, seed);\n}\n\n/**\n * Uploaded logo, favicon, and mobile-menu mark, or the fallback the site\n * passed into `createTheme`. Depth 1 so the upload url is populated.\n * Takes the request's `locale` like every other reader. Theme and its\n * brand assets hold no localized field today (a logo's alt is the brand\n * name), so it only matters once one does.\n */\nexport async function getPublishedIdentity(\n payload: ThemePayload,\n fallback?: ThemeIdentityFallback,\n read: LocaleRead = {},\n): Promise<ResolvedThemeIdentity> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 1,\n overrideAccess: true,\n ...localeArgs(read),\n });\n return resolveThemeIdentity(doc ?? {}, fallback);\n}\n"],"mappings":";;;;;;;;AAyBA,eAAsB,kBAAkB,SAAuB,MAAyC;AAOtG,QAAO,mBANK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EACjB,CAAC,IAC+B,EAAE,EAAE,KAAK;;;;;;;;;AAU5C,eAAsB,qBACpB,SACA,UACA,OAAmB,EAAE,EACW;AAQhC,QAAO,qBAPK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EAChB,GAAG,WAAW,KAAK;EACpB,CAAC,IACiC,EAAE,EAAE,SAAS"}
@@ -1,4 +1,4 @@
1
- import { t as LocaleRead } from "./locale-CTT3nn6T.mjs";
1
+ import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
2
2
  import { ArrayFieldValidation, Block, Field, GlobalConfig } from "payload";
3
3
 
4
4
  //#region src/navigation/types.d.ts
@@ -137,4 +137,4 @@ declare function getNavigation({
137
137
  }: GetNavigationArgs): Promise<NavigationDoc>;
138
138
  //#endregion
139
139
  export { NAVIGATION_FOOTER_SLUG as C, NavigationFooter as D, NavigationDoc as E, NavigationHeader as O, NAVIGATION_FOOTER_DB_NAME as S, NavigationBar as T, validateExternalHref as _, FOOTER_MAX_LINK_COLUMNS as a, NAVIGATION_DB_NAME as b, FooterColumnWidth as c, normalizeFooterDesktop as d, validateFooterColumns as f, isValidExternalHref as g, headerCtaEnabled as h, FOOTER_MAX_COLUMNS as i, FooterSocial as l, EXTERNAL_HREF_MESSAGE as m, FOOTER_COLUMNS_FIELD as n, FOOTER_SOCIALS as o, validateFooterSocialUrl as p, FOOTER_COLUMN_WIDTHS as r, FOOTER_TWELFTHS as s, getNavigation as t, footerDesktopTracks as u, validateHeaderCta as v, NAVIGATION_SLUG as w, NAVIGATION_FEATURE as x, CreateNavigationOptions as y };
140
- //# sourceMappingURL=published-QDNmDi02.d.mts.map
140
+ //# sourceMappingURL=published-BhYTEAK_.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-QDNmDi02.d.mts","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"mappings":";;;;cAaa,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,sBAAA;AAAA,cACA,yBAAA;AAAA,cAEA,kBAAA;AAAA,UAEI,uBAAA;;;;AAJjB;EASE,MAAA,EAAQ,KAAA;;;;AAPV;EAYE,OAAA,GAAU,WAAA,CAAY,WAAA,CAAY,YAAA;EAClC,WAAA,GAAc,WAAA,CAAY,WAAA,CAAY,YAAA;EAbT;;AAE/B;;EAgBE,a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;;;;iBG4BsB,aAAA,CAAA;EACpB,OAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
1
+ {"version":3,"file":"published-BhYTEAK_.d.mts","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"mappings":";;;;cAaa,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,sBAAA;AAAA,cACA,yBAAA;AAAA,cAEA,kBAAA;AAAA,UAEI,uBAAA;;;;AAJjB;EASE,MAAA,EAAQ,KAAA;;;;AAPV;EAYE,OAAA,GAAU,WAAA,CAAY,WAAA,CAAY,YAAA;EAClC,WAAA,GAAc,WAAA,CAAY,WAAA,CAAY,YAAA;EAbT;;AAE/B;;EAgBE,aAAA;EAXQ;EAaR,eAAA;EARsB;EAUtB,mBAAA;AAAA;AAAA,UAGe,gBAAA;EACf,KAAA;EACA,GAAA;AAAA;AAAA,UAGe,aAAA;EACf,YAAA;EACA,QAAA;EACA,eAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,KAAA;AAAA;AAAA,UAGe,aAAA;EACf,MAAA,EAAQ,gBAAA;EACR,MAAA,EAAQ,gBAAA;EACR,GAAA,EAAK,aAAA;AAAA;AAAA,UAGU,iBAAA,SAA0B,UAAA;EACzC,OAAA;IACE,UAAA,GAAa,IAAA;MACX,IAAA;MACA,KAAA;MACA,cAAA;MACA,KAAA;IAAA,MACI,OAAA;EAAA;EAER,KAAA;AAAA;;;KChEG,QAAA;AAAA,cAaQ,qBAAA;;ADVb;;;;iBCoBgB,mBAAA,CAAoB,KAAA;AAAA,iBAgBpB,oBAAA,CAAqB,KAAA,WAAgB,QAAA;AAAA,UA4HpC,cAAA;EACf,OAAA;EACA,IAAA,GAAO,QAAA;EACP,IAAA;EACA,IAAA;EACA,KAAA;AAAA;;iBAIc,gBAAA,CAAiB,GAAA,EAAK,cAAA;ADtKtC;;;;AAAA,iBCiLgB,iBAAA,CAAkB,KAAA;;;;;;ADpLlC;cELa,oBAAA;AAAA,KACD,iBAAA,WAA4B,oBAAA;;cAG3B,kBAAA;AFEb;AAAA,cEAa,uBAAA;AAAA,cAEA,cAAA;AAAA,KACD,YAAA,WAAuB,cAAA;;cAWtB,eAAA,EAAiB,MAAA,CAAO,iBAAA;AAAA,cASxB,oBAAA;;iBA+BG,sBAAA,CAAuB,KAAA,WAAgB,iBAAA;;AFpDvD;;;;iBE6DgB,mBAAA,CACd,KAAA,EAAO,iBAAA,qBACP,OAAA,EAAS,KAAA,CAAM,iBAAA;EAEf,YAAA;EACA,aAAA;EACA,aAAA;AAAA;;AF/DF;;;;;cEwFa,qBAAA,EAAuB,oBAAA;AAAA,iBA6CpB,uBAAA,CAAwB,KAAA;;;;;;AF5IxC;;;;;iBG4BsB,aAAA,CAAA;EACpB,OAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
package/dist/seo.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { t as LocaleAlternatesOptions } from "./alternates-DlRTsaVe.mjs";
1
2
  import { Payload } from "payload";
2
3
  import { ReactElement } from "react";
3
4
 
@@ -24,10 +25,12 @@ interface SitemapEntry {
24
25
  lastModified?: string | Date;
25
26
  changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
26
27
  priority?: number;
28
+ /** The entry's URL in each locale plus `x-default`, when `pageSitemap` was given `locales`. */
29
+ alternates?: {
30
+ languages?: Record<string, string>;
31
+ };
27
32
  }
28
- interface PageSitemapOptions<P extends SitemapPage> {
29
- /** Public path of a page: the site's own route helper, home included. */
30
- path: (page: P) => string;
33
+ interface PageSitemapBaseOptions<P extends SitemapPage> {
31
34
  /** Turns a path into an absolute URL at the site's origin. */
32
35
  absoluteUrl: (path: string) => string;
33
36
  /** Per-page `changeFrequency` / `priority`; the URL and last edit are set here. */
@@ -40,18 +43,30 @@ interface PageSitemapOptions<P extends SitemapPage> {
40
43
  */
41
44
  routes?: readonly SitemapEntry[];
42
45
  }
46
+ /**
47
+ * `pageSitemap`'s options: `path` for a single-locale site, or `locales` and
48
+ * `pathFor` for a multi-locale one (#281), which lists each page once per
49
+ * locale with every locale's URL as its alternates.
50
+ */
51
+ type PageSitemapOptions<P extends SitemapPage> = PageSitemapBaseOptions<P> & ({
52
+ /** Public path of a page: the site's own route helper, home included. */path: (page: P) => string;
53
+ locales?: undefined;
54
+ pathFor?: undefined;
55
+ defaultLocale?: undefined;
56
+ } | ({
57
+ path?: undefined;
58
+ } & Exclude<LocaleAlternatesOptions<P>, {
59
+ locales?: undefined;
60
+ }>));
43
61
  /**
44
62
  * `/sitemap.xml` from the published pages: every page with an address,
45
63
  * skipping those the SEO tab hides from search (`meta.noIndex`), then the
46
64
  * site's code-owned routes, one entry per URL. Pass the result straight back
47
- * from `app/sitemap.ts`.
65
+ * from `app/sitemap.ts`. With `locales`, each page is listed at its URL in
66
+ * every locale, in order, and each of those entries carries
67
+ * `alternates.languages`; a hidden page is hidden in every locale.
48
68
  */
49
- declare function pageSitemap<P extends SitemapPage>(pages: readonly P[], {
50
- path,
51
- absoluteUrl,
52
- entry,
53
- routes
54
- }: PageSitemapOptions<P>): SitemapEntry[];
69
+ declare function pageSitemap<P extends SitemapPage>(pages: readonly P[], options: PageSitemapOptions<P>): SitemapEntry[];
55
70
  /** The one Local API call the reader makes, for a caller without a `Payload`. */
56
71
  interface SitemapPagesReader {
57
72
  find: (args: {
@@ -212,5 +227,5 @@ declare function JsonLd<T extends JsonLdInput>({
212
227
  nonce
213
228
  }: JsonLdProps<T>): ReactElement | null;
214
229
  //#endregion
215
- export { type BreadcrumbItem, type BreadcrumbListJsonLd, type GetSitemapPagesArgs, JsonLd, type JsonLdGraph, type JsonLdInput, type JsonLdNode, type JsonLdProps, type MaybeJsonLd, type OrganizationInput, type OrganizationJsonLd, type PageSitemapOptions, type SitemapEntry, type SitemapPage, type SitemapPagesReader, type WebsiteInput, type WebsiteJsonLd, breadcrumbListJsonLd, getSitemapPages, jsonLdGraph, jsonLdHtml, organizationJsonLd, pageSitemap, websiteJsonLd };
230
+ export { type BreadcrumbItem, type BreadcrumbListJsonLd, type GetSitemapPagesArgs, JsonLd, type JsonLdGraph, type JsonLdInput, type JsonLdNode, type JsonLdProps, type LocaleAlternatesOptions, type MaybeJsonLd, type OrganizationInput, type OrganizationJsonLd, type PageSitemapBaseOptions, type PageSitemapOptions, type SitemapEntry, type SitemapPage, type SitemapPagesReader, type WebsiteInput, type WebsiteJsonLd, breadcrumbListJsonLd, getSitemapPages, jsonLdGraph, jsonLdHtml, organizationJsonLd, pageSitemap, websiteJsonLd };
216
231
  //# sourceMappingURL=seo.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"seo.d.mts","names":[],"sources":["../src/seo/sitemap.ts","../src/seo/json-ld.ts"],"mappings":";;;;;;;AASA;;UAAiB,WAAA;EACf,IAAA;EACA,OAAA;EACA,SAAA;EACA,IAAA;IAAS,OAAA;EAAA;AAAA;;AAOX;;;UAAiB,YAAA;EACf,GAAA;EACA,YAAA,YAAwB,IAAA;EACxB,eAAA;EACA,QAAA;AAAA;AAAA,UAGe,kBAAA,WAA6B,WAAA;EAHpC;EAKR,IAAA,GAAO,IAAA,EAAM,CAAA;EAFoB;EAIjC,WAAA,GAAc,IAAA;EAJ8B;EAM5C,KAAA,IAAS,IAAA,EAAM,CAAA,KAAM,IAAA,CAAK,YAAA;EAAX;;;;;;EAOf,MAAA,YAAkB,YAAA;AAAA;;;;;;;iBAcJ,WAAA,WAAsB,WAAA,CAAA,CACpC,KAAA,WAAgB,CAAA;EACd,IAAA;EAAM,WAAA;EAAa,KAAA;EAAO;AAAA,GAAe,kBAAA,CAAmB,CAAA,IAC7D,YAAA;;UAgCc,kBAAA;EACf,IAAA,GAAO,IAAA;IACH,UAAA;IACA,KAAA,EAAO,MAAA;IACP,KAAA;IACA,KAAA;IACA,UAAA;IACA,MAAA,EAAQ,MAAA;EAAA,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,CAAA,IAAK,YAAA"}
package/dist/seo.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { l as isRootPageKey } from "./root-page-key-kx3C1eyp.mjs";
2
+ import { t as languageAlternates } from "./alternates-DxBTUXHh.mjs";
2
3
  import { createElement } from "react";
3
4
  //#region src/seo/sitemap.ts
4
5
  /** A page with no address yet has nothing to list. Home is keyed, not slugged. */
@@ -9,24 +10,32 @@ function hasAddress(page) {
9
10
  * `/sitemap.xml` from the published pages: every page with an address,
10
11
  * skipping those the SEO tab hides from search (`meta.noIndex`), then the
11
12
  * site's code-owned routes, one entry per URL. Pass the result straight back
12
- * from `app/sitemap.ts`.
13
+ * from `app/sitemap.ts`. With `locales`, each page is listed at its URL in
14
+ * every locale, in order, and each of those entries carries
15
+ * `alternates.languages`; a hidden page is hidden in every locale.
13
16
  */
14
- function pageSitemap(pages, { path, absoluteUrl, entry, routes = [] }) {
17
+ function pageSitemap(pages, options) {
18
+ const { absoluteUrl, entry, routes = [] } = options;
19
+ const urlsOf = (page) => options.locales ? options.locales.map((locale) => absoluteUrl(options.pathFor(page, locale))) : [absoluteUrl(options.path(page))];
15
20
  const byUrl = /* @__PURE__ */ new Map();
16
21
  const hidden = /* @__PURE__ */ new Set();
17
22
  for (const page of pages) {
18
23
  if (!hasAddress(page)) continue;
19
- const url = absoluteUrl(path(page));
24
+ const urls = urlsOf(page);
20
25
  if (page.meta?.noIndex) {
21
- hidden.add(url);
26
+ for (const url of urls) hidden.add(url);
22
27
  continue;
23
28
  }
24
- if (byUrl.has(url)) continue;
25
- byUrl.set(url, {
26
- url,
27
- ...page.updatedAt ? { lastModified: page.updatedAt } : {},
28
- ...entry?.(page)
29
- });
29
+ const languages = languageAlternates(page, options, absoluteUrl);
30
+ for (const url of urls) {
31
+ if (byUrl.has(url)) continue;
32
+ byUrl.set(url, {
33
+ url,
34
+ ...page.updatedAt ? { lastModified: page.updatedAt } : {},
35
+ ...entry?.(page),
36
+ ...languages ? { alternates: { languages } } : {}
37
+ });
38
+ }
30
39
  }
31
40
  const seenRoutes = /* @__PURE__ */ new Set();
32
41
  for (const route of routes) {
package/dist/seo.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"seo.mjs","names":[],"sources":["../src/seo/sitemap.ts","../src/seo/json-ld.ts"],"sourcesContent":["import type { Payload } from \"payload\";\n\nimport { isRootPageKey } from \"../collections/root-page-key\";\n\n/**\n * A page as the sitemap needs it; a site's generated `Page` is assignable.\n * Every field is optional and nullable, as `getSitemapPages` selects only\n * these.\n */\nexport interface SitemapPage {\n slug?: string | null;\n pageKey?: string | null;\n updatedAt?: string | null;\n meta?: { noIndex?: boolean | null } | null;\n}\n\n/**\n * One `<url>` of `/sitemap.xml`. Structurally assignable to an item of Next's\n * `MetadataRoute.Sitemap`, without this package depending on `next`.\n */\nexport interface SitemapEntry {\n url: string;\n lastModified?: string | Date;\n changeFrequency?: \"always\" | \"hourly\" | \"daily\" | \"weekly\" | \"monthly\" | \"yearly\" | \"never\";\n priority?: number;\n}\n\nexport interface PageSitemapOptions<P extends SitemapPage> {\n /** Public path of a page: the site's own route helper, home included. */\n path: (page: P) => string;\n /** Turns a path into an absolute URL at the site's origin. */\n absoluteUrl: (path: string) => string;\n /** Per-page `changeFrequency` / `priority`; the URL and last edit are set here. */\n entry?: (page: P) => Omit<SitemapEntry, \"url\" | \"lastModified\">;\n /**\n * The routes the site still serves from code, as absolute-URL entries.\n * They follow the pages. A route at a URL a page already lists is merged\n * into that page's entry (the page's fields win); a route at the URL of a\n * page hidden from search is dropped, because that page is what serves it.\n */\n routes?: readonly SitemapEntry[];\n}\n\n/** A page with no address yet has nothing to list. Home is keyed, not slugged. */\nfunction hasAddress(page: SitemapPage): boolean {\n return isRootPageKey(page.pageKey) || Boolean(page.slug);\n}\n\n/**\n * `/sitemap.xml` from the published pages: every page with an address,\n * skipping those the SEO tab hides from search (`meta.noIndex`), then the\n * site's code-owned routes, one entry per URL. Pass the result straight back\n * from `app/sitemap.ts`.\n */\nexport function pageSitemap<P extends SitemapPage>(\n pages: readonly P[],\n { path, absoluteUrl, entry, routes = [] }: PageSitemapOptions<P>,\n): SitemapEntry[] {\n const byUrl = new Map<string, SitemapEntry>();\n const hidden = new Set<string>();\n\n for (const page of pages) {\n if (!hasAddress(page)) continue;\n const url = absoluteUrl(path(page));\n if (page.meta?.noIndex) {\n hidden.add(url);\n continue;\n }\n if (byUrl.has(url)) continue;\n byUrl.set(url, {\n url,\n ...(page.updatedAt ? { lastModified: page.updatedAt } : {}),\n ...entry?.(page),\n });\n }\n\n const seenRoutes = new Set<string>();\n for (const route of routes) {\n // The first route at a URL wins over a later duplicate.\n if (hidden.has(route.url) || seenRoutes.has(route.url)) continue;\n seenRoutes.add(route.url);\n const page = byUrl.get(route.url);\n byUrl.set(route.url, page ? { ...route, ...page } : route);\n }\n\n return [...byUrl.values()];\n}\n\n/** The one Local API call the reader makes, for a caller without a `Payload`. */\nexport interface SitemapPagesReader {\n find: (args: {\n collection: string;\n where: Record<string, unknown>;\n draft: boolean;\n depth: number;\n pagination: boolean;\n select: Record<string, unknown>;\n }) => Promise<{ docs: unknown[] }>;\n}\n\nexport interface GetSitemapPagesArgs {\n /** The site's `Payload` (generated slugs and all), or anything with that `find`. */\n payload: SitemapPagesReader | Payload;\n /** The pages collection's slug. Default `pages` (`createPages`). */\n collection?: string;\n}\n\n/**\n * Every published page, with only the fields `pageSitemap` reads. A draft\n * never reaches the sitemap: the query filters on `_status` and reads the\n * published version. `updatedAt` is the document's, so an autosaved draft\n * over a live page can move a page's `lastModified` before it is republished.\n */\nexport async function getSitemapPages({\n payload,\n collection = \"pages\",\n}: GetSitemapPagesArgs): Promise<SitemapPage[]> {\n const { docs } = await (payload as SitemapPagesReader).find({\n collection,\n where: { _status: { equals: \"published\" } },\n draft: false,\n depth: 0,\n pagination: false,\n select: { slug: true, pageKey: true, updatedAt: true, meta: { noIndex: true } },\n });\n return docs as SitemapPage[];\n}\n","import { createElement, type ReactElement } from \"react\";\n\nconst SCHEMA_ORG = \"https://schema.org\";\n\n/** One schema.org node: a `@type` and whatever properties that type takes. */\nexport interface JsonLdNode {\n \"@context\"?: typeof SCHEMA_ORG;\n \"@type\": string;\n \"@id\"?: string;\n [property: string]: unknown;\n}\n\n/**\n * What `JsonLd` and `jsonLdGraph` accept: anything with a `@type`. No index\n * signature, so an interface (payload-blocks' `FaqPageJsonLd`, a site's own\n * `Product`) is accepted as well as a literal; the functions are generic so\n * a literal's extra properties are not refused either.\n */\nexport interface JsonLdInput {\n \"@type\": string | readonly string[];\n}\n\n/** A node, or nothing (a builder with nothing to say returns `null`). */\nexport type MaybeJsonLd<T extends JsonLdInput = JsonLdInput> = T | null | undefined;\n\n/** Optional text: empty and null both mean \"leave the property off\". */\ntype Text = string | null | undefined;\n\nfunction present<K extends string>(key: K, value: Text): Partial<Record<K, string>> {\n return value ? ({ [key]: value } as Record<K, string>) : {};\n}\n\nexport interface OrganizationInput {\n name: string;\n /** The site's home URL. */\n url: string;\n /**\n * A more specific schema.org type (`MedicalOrganization`, `LocalBusiness`).\n * Default `Organization`. Claims beyond the type are the site's to add.\n */\n type?: string;\n /** A stable `@id` (`https://acme.test/#organization`) other nodes can point at. */\n id?: Text;\n /** Absolute URL of the logo. */\n logo?: Text;\n description?: Text;\n telephone?: Text;\n email?: Text;\n /** Absolute URLs of the organization's profiles. Empty entries are dropped. */\n sameAs?: readonly Text[];\n}\n\nexport interface OrganizationJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n name: string;\n url: string;\n logo?: string;\n description?: string;\n telephone?: string;\n email?: string;\n sameAs?: string[];\n}\n\n/** The site's publisher: one Organization node, empty fields left off. */\nexport function organizationJsonLd(input: OrganizationInput): OrganizationJsonLd {\n const sameAs = (input.sameAs ?? []).filter((url): url is string => Boolean(url));\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": input.type ?? \"Organization\",\n ...present(\"@id\", input.id),\n name: input.name,\n url: input.url,\n ...present(\"logo\", input.logo),\n ...present(\"description\", input.description),\n ...present(\"telephone\", input.telephone),\n ...present(\"email\", input.email),\n ...(sameAs.length > 0 ? { sameAs } : {}),\n };\n}\n\nexport interface WebsiteInput {\n name: string;\n /** The site's home URL. */\n url: string;\n id?: Text;\n description?: Text;\n /** BCP 47 language tag, `en-US`. */\n inLanguage?: Text;\n /** The publishing Organization's `@id`. */\n publisher?: Text;\n}\n\nexport interface WebsiteJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n \"@type\": \"WebSite\";\n name: string;\n url: string;\n description?: string;\n inLanguage?: string;\n publisher?: { \"@id\": string };\n}\n\n/** The site itself, pointing at its publisher by `@id`. */\nexport function websiteJsonLd(input: WebsiteInput): WebsiteJsonLd {\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": \"WebSite\",\n ...present(\"@id\", input.id),\n name: input.name,\n url: input.url,\n ...present(\"description\", input.description),\n ...present(\"inLanguage\", input.inLanguage),\n ...(input.publisher ? { publisher: { \"@id\": input.publisher } } : {}),\n };\n}\n\nexport interface BreadcrumbItem {\n name: string;\n /** Absolute URL. Leave it off the current page, the trail's last item. */\n url?: Text;\n}\n\nexport interface BreadcrumbListJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n \"@type\": \"BreadcrumbList\";\n itemListElement: Array<{ \"@type\": \"ListItem\"; position: number; name: string; item?: string }>;\n}\n\n/**\n * A page's trail, home first, numbered from 1. `null` for an empty trail, so\n * a page with none renders no script.\n */\nexport function breadcrumbListJsonLd(items: readonly BreadcrumbItem[]): BreadcrumbListJsonLd | null {\n if (items.length === 0) return null;\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": \"BreadcrumbList\",\n itemListElement: items.map((crumb, index) => ({\n \"@type\": \"ListItem\" as const,\n position: index + 1,\n name: crumb.name,\n ...present(\"item\", crumb.url),\n })),\n };\n}\n\nexport interface JsonLdGraph {\n \"@context\": typeof SCHEMA_ORG;\n \"@graph\": JsonLdInput[];\n}\n\n/**\n * Several nodes under one `@context`, the absent ones dropped. `null` when\n * none is left.\n */\nexport function jsonLdGraph<T extends readonly MaybeJsonLd[]>(...nodes: T): JsonLdGraph | null {\n const graph = nodes.flatMap((node) => {\n if (!node) return [];\n const { \"@context\": _context, ...rest } = node as JsonLdInput & { \"@context\"?: unknown };\n return [rest as JsonLdInput];\n });\n return graph.length > 0 ? { \"@context\": SCHEMA_ORG, \"@graph\": graph } : null;\n}\n\n/**\n * JSON for an inline `<script>`, with `<` escaped so a value holding\n * `</script>` cannot close the tag. The escape is still valid JSON.\n */\nexport function jsonLdHtml(data: unknown): string {\n return JSON.stringify(data).replace(/</g, \"\\\\u003c\");\n}\n\nexport interface JsonLdProps<T extends JsonLdInput = JsonLdInput> {\n /**\n * A node (any builder here, payload-blocks' `faqPageJsonLd`, or a site's\n * own), a graph, or a list of nodes rendered as one `@graph`. Nothing to\n * say (`null`, or a list of nulls) renders nothing.\n */\n data: MaybeJsonLd<T> | JsonLdGraph | readonly MaybeJsonLd<T>[];\n /** CSP nonce for the `<script>` tag. */\n nonce?: string;\n}\n\n/**\n * One `<script type=\"application/ld+json\">`. A Server Component: no client\n * boundary, no `\"use client\"`, so a page route renders it as it is.\n */\nexport function JsonLd<T extends JsonLdInput>({ data, nonce }: JsonLdProps<T>): ReactElement | null {\n const value = Array.isArray(data) ? jsonLdGraph(...(data as readonly MaybeJsonLd[])) : data;\n if (!value) return null;\n return createElement(\"script\", {\n type: \"application/ld+json\",\n nonce,\n dangerouslySetInnerHTML: { __html: jsonLdHtml(value) },\n });\n}\n"],"mappings":";;;;AA4CA,SAAS,WAAW,MAA4B;AAC9C,QAAO,cAAc,KAAK,QAAQ,IAAI,QAAQ,KAAK,KAAK;;;;;;;;AAS1D,SAAgB,YACd,OACA,EAAE,MAAM,aAAa,OAAO,SAAS,EAAE,IACvB;CAChB,MAAM,wBAAQ,IAAI,KAA2B;CAC7C,MAAM,yBAAS,IAAI,KAAa;AAEhC,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,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YAAY,GAAI,KAAgC,GAAG;AACvF,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,cAAc,UAAU;EAC7B,MAAM;EACN;EACA,yBAAyB,EAAE,QAAQ,WAAW,MAAM,EAAE;EACvD,CAAC"}
1
+ {"version":3,"file":"seo.mjs","names":[],"sources":["../src/seo/sitemap.ts","../src/seo/json-ld.ts"],"sourcesContent":["import type { Payload } from \"payload\";\n\nimport { isRootPageKey } from \"../collections/root-page-key\";\nimport { languageAlternates, type LocaleAlternatesOptions } from \"./alternates\";\n\n/**\n * A page as the sitemap needs it; a site's generated `Page` is assignable.\n * Every field is optional and nullable, as `getSitemapPages` selects only\n * these.\n */\nexport interface SitemapPage {\n slug?: string | null;\n pageKey?: string | null;\n updatedAt?: string | null;\n meta?: { noIndex?: boolean | null } | null;\n}\n\n/**\n * One `<url>` of `/sitemap.xml`. Structurally assignable to an item of Next's\n * `MetadataRoute.Sitemap`, without this package depending on `next`.\n */\nexport interface SitemapEntry {\n url: string;\n lastModified?: string | Date;\n changeFrequency?: \"always\" | \"hourly\" | \"daily\" | \"weekly\" | \"monthly\" | \"yearly\" | \"never\";\n priority?: number;\n /** The entry's URL in each locale plus `x-default`, when `pageSitemap` was given `locales`. */\n alternates?: { languages?: Record<string, string> };\n}\n\nexport interface PageSitemapBaseOptions<P extends SitemapPage> {\n /** Turns a path into an absolute URL at the site's origin. */\n absoluteUrl: (path: string) => string;\n /** Per-page `changeFrequency` / `priority`; the URL and last edit are set here. */\n entry?: (page: P) => Omit<SitemapEntry, \"url\" | \"lastModified\">;\n /**\n * The routes the site still serves from code, as absolute-URL entries.\n * They follow the pages. A route at a URL a page already lists is merged\n * into that page's entry (the page's fields win); a route at the URL of a\n * page hidden from search is dropped, because that page is what serves it.\n */\n routes?: readonly SitemapEntry[];\n}\n\n/**\n * `pageSitemap`'s options: `path` for a single-locale site, or `locales` and\n * `pathFor` for a multi-locale one (#281), which lists each page once per\n * locale with every locale's URL as its alternates.\n */\nexport type PageSitemapOptions<P extends SitemapPage> = PageSitemapBaseOptions<P> &\n (\n | {\n /** Public path of a page: the site's own route helper, home included. */\n path: (page: P) => string;\n locales?: undefined;\n pathFor?: undefined;\n defaultLocale?: undefined;\n }\n | ({ path?: undefined } & Exclude<LocaleAlternatesOptions<P>, { locales?: undefined }>)\n );\n\n/** A page with no address yet has nothing to list. Home is keyed, not slugged. */\nfunction hasAddress(page: SitemapPage): boolean {\n return isRootPageKey(page.pageKey) || Boolean(page.slug);\n}\n\n/**\n * `/sitemap.xml` from the published pages: every page with an address,\n * skipping those the SEO tab hides from search (`meta.noIndex`), then the\n * site's code-owned routes, one entry per URL. Pass the result straight back\n * from `app/sitemap.ts`. With `locales`, each page is listed at its URL in\n * every locale, in order, and each of those entries carries\n * `alternates.languages`; a hidden page is hidden in every locale.\n */\nexport function pageSitemap<P extends SitemapPage>(\n pages: readonly P[],\n options: PageSitemapOptions<P>,\n): SitemapEntry[] {\n const { absoluteUrl, entry, routes = [] } = options;\n const urlsOf = (page: P): string[] =>\n options.locales\n ? options.locales.map((locale) => absoluteUrl(options.pathFor(page, locale)))\n : [absoluteUrl(options.path(page))];\n const byUrl = new Map<string, SitemapEntry>();\n const hidden = new Set<string>();\n\n for (const page of pages) {\n if (!hasAddress(page)) continue;\n const urls = urlsOf(page);\n if (page.meta?.noIndex) {\n for (const url of urls) hidden.add(url);\n continue;\n }\n const languages = languageAlternates(page, options, absoluteUrl);\n for (const url of urls) {\n if (byUrl.has(url)) continue;\n byUrl.set(url, {\n url,\n ...(page.updatedAt ? { lastModified: page.updatedAt } : {}),\n ...entry?.(page),\n ...(languages ? { alternates: { languages } } : {}),\n });\n }\n }\n\n const seenRoutes = new Set<string>();\n for (const route of routes) {\n // The first route at a URL wins over a later duplicate.\n if (hidden.has(route.url) || seenRoutes.has(route.url)) continue;\n seenRoutes.add(route.url);\n const page = byUrl.get(route.url);\n byUrl.set(route.url, page ? { ...route, ...page } : route);\n }\n\n return [...byUrl.values()];\n}\n\n/** The one Local API call the reader makes, for a caller without a `Payload`. */\nexport interface SitemapPagesReader {\n find: (args: {\n collection: string;\n where: Record<string, unknown>;\n draft: boolean;\n depth: number;\n pagination: boolean;\n select: Record<string, unknown>;\n }) => Promise<{ docs: unknown[] }>;\n}\n\nexport interface GetSitemapPagesArgs {\n /** The site's `Payload` (generated slugs and all), or anything with that `find`. */\n payload: SitemapPagesReader | Payload;\n /** The pages collection's slug. Default `pages` (`createPages`). */\n collection?: string;\n}\n\n/**\n * Every published page, with only the fields `pageSitemap` reads. A draft\n * never reaches the sitemap: the query filters on `_status` and reads the\n * published version. `updatedAt` is the document's, so an autosaved draft\n * over a live page can move a page's `lastModified` before it is republished.\n */\nexport async function getSitemapPages({\n payload,\n collection = \"pages\",\n}: GetSitemapPagesArgs): Promise<SitemapPage[]> {\n const { docs } = await (payload as SitemapPagesReader).find({\n collection,\n where: { _status: { equals: \"published\" } },\n draft: false,\n depth: 0,\n pagination: false,\n select: { slug: true, pageKey: true, updatedAt: true, meta: { noIndex: true } },\n });\n return docs as SitemapPage[];\n}\n","import { createElement, type ReactElement } from \"react\";\n\nconst SCHEMA_ORG = \"https://schema.org\";\n\n/** One schema.org node: a `@type` and whatever properties that type takes. */\nexport interface JsonLdNode {\n \"@context\"?: typeof SCHEMA_ORG;\n \"@type\": string;\n \"@id\"?: string;\n [property: string]: unknown;\n}\n\n/**\n * What `JsonLd` and `jsonLdGraph` accept: anything with a `@type`. No index\n * signature, so an interface (payload-blocks' `FaqPageJsonLd`, a site's own\n * `Product`) is accepted as well as a literal; the functions are generic so\n * a literal's extra properties are not refused either.\n */\nexport interface JsonLdInput {\n \"@type\": string | readonly string[];\n}\n\n/** A node, or nothing (a builder with nothing to say returns `null`). */\nexport type MaybeJsonLd<T extends JsonLdInput = JsonLdInput> = T | null | undefined;\n\n/** Optional text: empty and null both mean \"leave the property off\". */\ntype Text = string | null | undefined;\n\nfunction present<K extends string>(key: K, value: Text): Partial<Record<K, string>> {\n return value ? ({ [key]: value } as Record<K, string>) : {};\n}\n\nexport interface OrganizationInput {\n name: string;\n /** The site's home URL. */\n url: string;\n /**\n * A more specific schema.org type (`MedicalOrganization`, `LocalBusiness`).\n * Default `Organization`. Claims beyond the type are the site's to add.\n */\n type?: string;\n /** A stable `@id` (`https://acme.test/#organization`) other nodes can point at. */\n id?: Text;\n /** Absolute URL of the logo. */\n logo?: Text;\n description?: Text;\n telephone?: Text;\n email?: Text;\n /** Absolute URLs of the organization's profiles. Empty entries are dropped. */\n sameAs?: readonly Text[];\n}\n\nexport interface OrganizationJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n name: string;\n url: string;\n logo?: string;\n description?: string;\n telephone?: string;\n email?: string;\n sameAs?: string[];\n}\n\n/** The site's publisher: one Organization node, empty fields left off. */\nexport function organizationJsonLd(input: OrganizationInput): OrganizationJsonLd {\n const sameAs = (input.sameAs ?? []).filter((url): url is string => Boolean(url));\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": input.type ?? \"Organization\",\n ...present(\"@id\", input.id),\n name: input.name,\n url: input.url,\n ...present(\"logo\", input.logo),\n ...present(\"description\", input.description),\n ...present(\"telephone\", input.telephone),\n ...present(\"email\", input.email),\n ...(sameAs.length > 0 ? { sameAs } : {}),\n };\n}\n\nexport interface WebsiteInput {\n name: string;\n /** The site's home URL. */\n url: string;\n id?: Text;\n description?: Text;\n /** BCP 47 language tag, `en-US`. */\n inLanguage?: Text;\n /** The publishing Organization's `@id`. */\n publisher?: Text;\n}\n\nexport interface WebsiteJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n \"@type\": \"WebSite\";\n name: string;\n url: string;\n description?: string;\n inLanguage?: string;\n publisher?: { \"@id\": string };\n}\n\n/** The site itself, pointing at its publisher by `@id`. */\nexport function websiteJsonLd(input: WebsiteInput): WebsiteJsonLd {\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": \"WebSite\",\n ...present(\"@id\", input.id),\n name: input.name,\n url: input.url,\n ...present(\"description\", input.description),\n ...present(\"inLanguage\", input.inLanguage),\n ...(input.publisher ? { publisher: { \"@id\": input.publisher } } : {}),\n };\n}\n\nexport interface BreadcrumbItem {\n name: string;\n /** Absolute URL. Leave it off the current page, the trail's last item. */\n url?: Text;\n}\n\nexport interface BreadcrumbListJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n \"@type\": \"BreadcrumbList\";\n itemListElement: Array<{ \"@type\": \"ListItem\"; position: number; name: string; item?: string }>;\n}\n\n/**\n * A page's trail, home first, numbered from 1. `null` for an empty trail, so\n * a page with none renders no script.\n */\nexport function breadcrumbListJsonLd(items: readonly BreadcrumbItem[]): BreadcrumbListJsonLd | null {\n if (items.length === 0) return null;\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": \"BreadcrumbList\",\n itemListElement: items.map((crumb, index) => ({\n \"@type\": \"ListItem\" as const,\n position: index + 1,\n name: crumb.name,\n ...present(\"item\", crumb.url),\n })),\n };\n}\n\nexport interface JsonLdGraph {\n \"@context\": typeof SCHEMA_ORG;\n \"@graph\": JsonLdInput[];\n}\n\n/**\n * Several nodes under one `@context`, the absent ones dropped. `null` when\n * none is left.\n */\nexport function jsonLdGraph<T extends readonly MaybeJsonLd[]>(...nodes: T): JsonLdGraph | null {\n const graph = nodes.flatMap((node) => {\n if (!node) return [];\n const { \"@context\": _context, ...rest } = node as JsonLdInput & { \"@context\"?: unknown };\n return [rest as JsonLdInput];\n });\n return graph.length > 0 ? { \"@context\": SCHEMA_ORG, \"@graph\": graph } : null;\n}\n\n/**\n * JSON for an inline `<script>`, with `<` escaped so a value holding\n * `</script>` cannot close the tag. The escape is still valid JSON.\n */\nexport function jsonLdHtml(data: unknown): string {\n return JSON.stringify(data).replace(/</g, \"\\\\u003c\");\n}\n\nexport interface JsonLdProps<T extends JsonLdInput = JsonLdInput> {\n /**\n * A node (any builder here, payload-blocks' `faqPageJsonLd`, or a site's\n * own), a graph, or a list of nodes rendered as one `@graph`. Nothing to\n * say (`null`, or a list of nulls) renders nothing.\n */\n data: MaybeJsonLd<T> | JsonLdGraph | readonly MaybeJsonLd<T>[];\n /** CSP nonce for the `<script>` tag. */\n nonce?: string;\n}\n\n/**\n * One `<script type=\"application/ld+json\">`. A Server Component: no client\n * boundary, no `\"use client\"`, so a page route renders it as it is.\n */\nexport function JsonLd<T extends JsonLdInput>({ data, nonce }: JsonLdProps<T>): ReactElement | null {\n const value = Array.isArray(data) ? jsonLdGraph(...(data as readonly MaybeJsonLd[])) : data;\n if (!value) return null;\n return createElement(\"script\", {\n type: \"application/ld+json\",\n nonce,\n dangerouslySetInnerHTML: { __html: jsonLdHtml(value) },\n });\n}\n"],"mappings":";;;;;AA8DA,SAAS,WAAW,MAA4B;AAC9C,QAAO,cAAc,KAAK,QAAQ,IAAI,QAAQ,KAAK,KAAK;;;;;;;;;;AAW1D,SAAgB,YACd,OACA,SACgB;CAChB,MAAM,EAAE,aAAa,OAAO,SAAS,EAAE,KAAK;CAC5C,MAAM,UAAU,SACd,QAAQ,UACJ,QAAQ,QAAQ,KAAK,WAAW,YAAY,QAAQ,QAAQ,MAAM,OAAO,CAAC,CAAC,GAC3E,CAAC,YAAY,QAAQ,KAAK,KAAK,CAAC,CAAC;CACvC,MAAM,wBAAQ,IAAI,KAA2B;CAC7C,MAAM,yBAAS,IAAI,KAAa;AAEhC,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,CAAC,WAAW,KAAK,CAAE;EACvB,MAAM,OAAO,OAAO,KAAK;AACzB,MAAI,KAAK,MAAM,SAAS;AACtB,QAAK,MAAM,OAAO,KAAM,QAAO,IAAI,IAAI;AACvC;;EAEF,MAAM,YAAY,mBAAmB,MAAM,SAAS,YAAY;AAChE,OAAK,MAAM,OAAO,MAAM;AACtB,OAAI,MAAM,IAAI,IAAI,CAAE;AACpB,SAAM,IAAI,KAAK;IACb;IACA,GAAI,KAAK,YAAY,EAAE,cAAc,KAAK,WAAW,GAAG,EAAE;IAC1D,GAAG,QAAQ,KAAK;IAChB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s";
1
+ import { n as facetField, t as FacetEntry } from "./facet-field-Cd6lffed.mjs";
2
2
  export { type FacetEntry, facetField };
package/dist/theme.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { _ as ThemeIdentityFallback, c as THEME_SLUG, d as ThemeDoc, f as ThemeHead, g as ResolvedThemeIdentity, h as ThemeUploadDoc, i as SystemColorKey, m as ThemeLibraryColorDoc, n as EditableTheme, p as ThemeHeadOptions, r as SYSTEM_COLOR_KEYS, t as CreateThemeOptions, u as ThemeColorDoc, v as resolveThemeIdentity } from "./types-DLBlHZUd.mjs";
2
- import { _ as deleteLibraryColor, a as PageEditorSystemKey, c as pageEditorTokens, f as colorTokenField, g as rewriteColorTokens, h as findColorTokens, i as PAGE_EDITOR_SYSTEM_KEYS, l as themeLibraryFromDoc, m as ColorTokenHit, n as ColorSwatch, o as pageEditorLooks, p as lookField, r as LookOption, s as pageEditorSwatches, t as THEME_PREVIEW_BREAKPOINTS, v as rewriteColorToken, y as themeColorKeys } from "./preview-1vwxBgm5.mjs";
3
- import { t as LocaleRead } from "./locale-CTT3nn6T.mjs";
4
- import { n as getPublishedIdentity, r as getPublishedTheme } from "./published-B3etM6X5.mjs";
1
+ import { _ as ThemeIdentityFallback, c as THEME_SLUG, d as ThemeDoc, f as ThemeHead, g as ResolvedThemeIdentity, h as ThemeUploadDoc, i as SystemColorKey, m as ThemeLibraryColorDoc, n as EditableTheme, p as ThemeHeadOptions, r as SYSTEM_COLOR_KEYS, t as CreateThemeOptions, u as ThemeColorDoc, v as resolveThemeIdentity } from "./types-B1MmE-L3.mjs";
2
+ import { _ as deleteLibraryColor, a as PageEditorSystemKey, c as pageEditorTokens, f as colorTokenField, g as rewriteColorTokens, h as findColorTokens, i as PAGE_EDITOR_SYSTEM_KEYS, l as themeLibraryFromDoc, m as ColorTokenHit, n as ColorSwatch, o as pageEditorLooks, p as lookField, r as LookOption, s as pageEditorSwatches, t as THEME_PREVIEW_BREAKPOINTS, v as rewriteColorToken, y as themeColorKeys } from "./preview-B69Dhi8T.mjs";
3
+ import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
4
+ import { n as getPublishedIdentity, r as getPublishedTheme } from "./published-2I-k6zEo.mjs";
5
5
  import { ShadeStep, ThemeConfig } from "@bison-lab/tokens";
6
6
 
7
7
  //#region src/theme/map.d.ts
package/dist/theme.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { l as stateFromColorDoc, n as SYSTEM_COLOR_KEYS, o as THEME_SLUG, t as resolveThemeIdentity, u as themeConfigFromDoc } from "./identity-CN6EOeDM.mjs";
2
2
  import { a as pageEditorLooks, c as themeLibraryFromDoc, d as deleteLibraryColor, f as rewriteColorToken, i as PAGE_EDITOR_SYSTEM_KEYS, l as findColorTokens, n as colorTokenField, o as pageEditorSwatches, p as themeColorKeys, r as lookField, s as pageEditorTokens, t as THEME_PREVIEW_BREAKPOINTS, u as rewriteColorTokens } from "./preview-Br1SQCKn.mjs";
3
- import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-CkqqY08H.mjs";
3
+ import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-B80KqlcU.mjs";
4
4
  import { fontFaceCss, fontPreloads } from "@bison-lab/fonts";
5
5
  import { buildThemeCss, generateNamedScaleCSS, lookBindingCss, themeFontIds } from "@bison-lab/tokens";
6
6
  //#region src/theme/look-css.ts
@@ -52,4 +52,4 @@ declare function documentTitle(siteName: string, pageTitle: string): string;
52
52
  declare function titleTemplate(siteName: string): string;
53
53
  //#endregion
54
54
  export { SeoImageSize as a, SeoImageDoc as i, titleTemplate as n, SeoImageValue as o, MediaId as r, SeoMeta as s, documentTitle as t };
55
- //# sourceMappingURL=title-trhUexxM.d.mts.map
55
+ //# sourceMappingURL=title-BVV3o329.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"title-trhUexxM.d.mts","names":[],"sources":["../src/seo/types.ts","../src/seo/title.ts"],"mappings":";;KACY,OAAA;;UAGK,YAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;;;;AAWF;UAAiB,WAAA;EACf,GAAA;EACA,GAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;IAAA,CAAW,IAAA,WAAe,YAAA;EAAA;AAAA;;KAIhB,aAAA,GAAgB,OAAA,GAAU,WAAA;;AAAtC;;;UAMiB,OAAA;EACf,KAAA;EACA,WAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;AAAA;;;;AApCF;;;;;iBCKgB,aAAA,CAAc,QAAA,UAAkB,SAAA;;;;;iBAQhC,aAAA,CAAc,QAAA"}
1
+ {"version":3,"file":"title-BVV3o329.d.mts","names":[],"sources":["../src/seo/types.ts","../src/seo/title.ts"],"mappings":";;KACY,OAAA;;UAGK,YAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;;;;AAWF;UAAiB,WAAA;EACf,GAAA;EACA,GAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;IAAA,CAAW,IAAA,WAAe,YAAA;EAAA;AAAA;;KAIhB,aAAA,GAAgB,OAAA,GAAU,WAAA;;AAAtC;;;UAMiB,OAAA;EACf,KAAA;EACA,WAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;AAAA;;;;AApCF;;;;;iBCKgB,aAAA,CAAc,QAAA,UAAkB,SAAA;;;;;iBAQhC,aAAA,CAAc,QAAA"}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { o as anthropicTranslator } from "./strings-Fd7kUCT7.mjs";
3
- import { t as fillMessages } from "./messages-dZV_aAnR.mjs";
3
+ import { t as fillMessages } from "./messages-XFoL9RtF.mjs";
4
4
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
5
5
  import { basename, resolve } from "node:path";
6
6
  import { parseArgs } from "node:util";