@justanarthur/payload-www 0.3.5 → 1.2.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 (63) hide show
  1. package/README.md +317 -307
  2. package/dist/access.d.ts +2 -2
  3. package/dist/access.js +3 -17
  4. package/dist/blocks.d.ts +7 -12
  5. package/dist/blocks.js +24 -43
  6. package/dist/cli.js +201 -0
  7. package/dist/collections.d.ts +33 -225
  8. package/dist/collections.js +185 -639
  9. package/dist/config.d.ts +19 -105
  10. package/dist/config.js +257 -855
  11. package/dist/fields.d.ts +4 -46
  12. package/dist/fields.js +177 -53
  13. package/dist/imagehash.js +0 -15
  14. package/dist/import-map-provider.d.ts +0 -16
  15. package/dist/import-map-provider.js +0 -15
  16. package/dist/metadata.d.ts +24 -89
  17. package/dist/metadata.js +123 -255
  18. package/dist/pages.d.ts +37 -319
  19. package/dist/pages.js +349 -964
  20. package/dist/render-pages.d.ts +70 -565
  21. package/dist/render-pages.js +464 -1477
  22. package/dist/sitemap.d.ts +10 -0
  23. package/dist/sitemap.js +337 -0
  24. package/dist/translator.js +0 -15
  25. package/dist/utils.d.ts +10 -12
  26. package/dist/utils.js +18 -41
  27. package/package.json +81 -178
  28. package/dist/components.d.ts +0 -6
  29. package/dist/components.js +0 -39
  30. package/dist/core-access.d.ts +0 -11
  31. package/dist/core-access.js +0 -34
  32. package/dist/core-blocks.d.ts +0 -24
  33. package/dist/core-blocks.js +0 -79
  34. package/dist/core-fields.d.ts +0 -73
  35. package/dist/core-fields.js +0 -167
  36. package/dist/core-utils.d.ts +0 -16
  37. package/dist/core-utils.js +0 -63
  38. package/dist/data-collections.d.ts +0 -229
  39. package/dist/data-collections.js +0 -676
  40. package/dist/data-seed.d.ts +0 -76
  41. package/dist/data-seed.js +0 -212
  42. package/dist/data-test.d.ts +0 -30
  43. package/dist/data-test.js +0 -1110
  44. package/dist/globals.d.ts +0 -69
  45. package/dist/globals.js +0 -251
  46. package/dist/hooks.d.ts +0 -108
  47. package/dist/hooks.js +0 -228
  48. package/dist/index.d.ts +0 -6
  49. package/dist/index.js +0 -39
  50. package/dist/render-components.d.ts +0 -42
  51. package/dist/render-components.js +0 -154
  52. package/dist/render-metadata.d.ts +0 -122
  53. package/dist/render-metadata.js +0 -390
  54. package/dist/render-utils.d.ts +0 -166
  55. package/dist/render-utils.js +0 -398
  56. package/dist/seed.d.ts +0 -76
  57. package/dist/seed.js +0 -212
  58. package/dist/server.d.ts +0 -980
  59. package/dist/server.js +0 -2231
  60. package/dist/test.d.ts +0 -30
  61. package/dist/test.js +0 -1110
  62. package/dist/with-www-config.d.ts +0 -108
  63. package/dist/with-www-config.js +0 -1006
@@ -1,390 +0,0 @@
1
-
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
- // src/render/metadata/jsonld.ts
19
- function getImageUrl(doc, siteUrl) {
20
- const img = doc?.meta?.image ?? doc?.heroImage ?? doc?.image;
21
- if (!img)
22
- return null;
23
- if (typeof img === "string")
24
- return img;
25
- if (img?.url)
26
- return img.url.startsWith("http") ? img.url : `${siteUrl}${img.url}`;
27
- return null;
28
- }
29
- function getImageUrlWithLog(doc, siteUrl) {
30
- const result = getImageUrl(doc, siteUrl);
31
- console.log("[WWW] render/metadata:jsonld:getImageUrl ->", result);
32
- return result;
33
- }
34
- function resolveLocalizedField(value, locale) {
35
- if (value == null)
36
- return "";
37
- if (typeof value === "string") {
38
- if (!value.startsWith("{"))
39
- return value;
40
- try {
41
- const parsed = JSON.parse(value);
42
- return resolveLocalizedField(parsed, locale);
43
- } catch {
44
- return value;
45
- }
46
- }
47
- if (typeof value !== "object")
48
- return "";
49
- const obj = value;
50
- if (typeof obj[locale] === "string" && obj[locale].length > 0) {
51
- return obj[locale];
52
- }
53
- return Object.values(obj).filter((v) => typeof v === "string" && v.length > 0).join(" / ");
54
- }
55
- function resolveLocalizedFieldWithLog(value, locale) {
56
- const result = resolveLocalizedField(value, locale);
57
- if (value && typeof value === "object") {
58
- console.log("[WWW] render/metadata:jsonld:resolveLocalizedField locale=", locale, "->", JSON.stringify(result));
59
- }
60
- return result;
61
- }
62
- function buildArticleLd({
63
- doc,
64
- url,
65
- locale,
66
- siteUrl,
67
- type = "BlogPosting",
68
- publisherName,
69
- publisherLogo
70
- }) {
71
- const name = publisherName ?? new URL(siteUrl).hostname;
72
- console.log("[WWW] render/metadata:buildArticleLd url=", url, "locale=", locale, "type=", type, "publisherName=", name);
73
- const ld = {
74
- "@context": "https://schema.org",
75
- "@type": type,
76
- "@id": `${url}#article`,
77
- headline: resolveLocalizedFieldWithLog(doc.title, locale),
78
- description: resolveLocalizedFieldWithLog(doc.meta?.description ?? doc.description ?? doc.excerpt, locale),
79
- inLanguage: locale,
80
- url,
81
- dateModified: doc.updatedAt ? new Date(doc.updatedAt).toISOString() : undefined
82
- };
83
- const datePublished = doc.publishedAt ?? doc.createdAt;
84
- if (datePublished)
85
- ld.datePublished = new Date(datePublished).toISOString();
86
- const imgUrl = getImageUrlWithLog(doc, siteUrl);
87
- if (imgUrl)
88
- ld.image = imgUrl;
89
- ld.author = { "@type": "Organization", name, url: siteUrl };
90
- const publisher = { "@type": "Organization", name };
91
- if (publisherLogo !== undefined) {
92
- if (publisherLogo !== null)
93
- publisher.logo = { "@type": "ImageObject", url: publisherLogo };
94
- }
95
- ld.publisher = publisher;
96
- return ld;
97
- }
98
- function buildBreadcrumbsLd({
99
- items,
100
- currentUrl
101
- }) {
102
- console.log("[WWW] render/metadata:buildBreadcrumbsLd items=", items.length, "currentUrl=", currentUrl);
103
- return {
104
- "@context": "https://schema.org",
105
- "@type": "BreadcrumbList",
106
- itemListElement: items.map((item, index) => ({
107
- "@type": "ListItem",
108
- position: index + 1,
109
- name: item.label,
110
- item: index === items.length - 1 ? currentUrl : item.url
111
- }))
112
- };
113
- }
114
- function buildOrganizationLd({
115
- siteUrl,
116
- name,
117
- logo,
118
- sameAs
119
- }) {
120
- console.log("[WWW] render/metadata:buildOrganizationLd siteUrl=", siteUrl, "name=", name, "logo?", Boolean(logo), "sameAs?", Boolean(sameAs));
121
- const org = {
122
- "@context": "https://schema.org",
123
- "@type": "Organization",
124
- "@id": `${siteUrl}#organization`,
125
- url: siteUrl,
126
- ...name && { name },
127
- ...logo && { logo: { "@type": "ImageObject", url: logo } },
128
- ...sameAs && sameAs.length > 0 && { sameAs }
129
- };
130
- return org;
131
- }
132
-
133
- // src/render/metadata/hreflang.ts
134
- async function buildHreflangAlternates({
135
- siteUrl,
136
- locale,
137
- urlPrefix,
138
- storedSlug,
139
- queryAllLocaleSlugs,
140
- nested,
141
- homeSlug,
142
- defaultLocale,
143
- locales,
144
- localePrefix = "always"
145
- }) {
146
- const allLocaleSlugs = await queryAllLocaleSlugs(storedSlug, locale);
147
- console.log("[WWW] render/metadata:buildHreflangAlternates storedSlug=", storedSlug, "locale=", locale, "allLocaleSlugs=", JSON.stringify(allLocaleSlugs));
148
- const languages = {};
149
- const urlFor = (l, slug) => {
150
- const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
151
- const prefixSegment = trimmedPrefix ? `/${trimmedPrefix}` : "";
152
- const urlPath = slug === homeSlug ? "/" : nested ? "/" + slug.replaceAll("_", "/") : "/" + slug;
153
- const localeSegment = localePrefix === "never" ? "" : localePrefix === "as-needed" && l === defaultLocale ? "" : `/${l}`;
154
- return `${siteUrl}${localeSegment}${prefixSegment}${urlPath}`;
155
- };
156
- for (const l of locales) {
157
- const slugForLocale = allLocaleSlugs?.[l];
158
- if (!slugForLocale)
159
- continue;
160
- languages[l] = urlFor(l, slugForLocale);
161
- }
162
- if (allLocaleSlugs?.[defaultLocale]) {
163
- languages["x-default"] = urlFor(defaultLocale, allLocaleSlugs[defaultLocale]);
164
- }
165
- console.log("[WWW] render/metadata:buildHreflangAlternates ->", JSON.stringify(languages));
166
- return languages;
167
- }
168
-
169
- // src/render/metadata/slug.ts
170
- var SLUG_NESTED_DIVIDER = "_";
171
- function segmentsToStoredSlug(segments, nested) {
172
- if (!Array.isArray(segments)) {
173
- console.log("[WWW] render/metadata:segmentsToStoredSlug string passthrough:", JSON.stringify(segments));
174
- return segments;
175
- }
176
- const result = nested ? segments.join(SLUG_NESTED_DIVIDER) : segments[0] ?? "";
177
- console.log("[WWW] render/metadata:segmentsToStoredSlug nested=", nested, "segments=", JSON.stringify(segments), "->", result);
178
- return result;
179
- }
180
- function segmentsToUrlPath(segments, nested) {
181
- let result;
182
- if (!Array.isArray(segments))
183
- result = "/" + segments;
184
- else if (nested)
185
- result = "/" + segments.join("/");
186
- else
187
- result = "/" + (segments[0] ?? "");
188
- console.log("[WWW] render/metadata:segmentsToUrlPath nested=", nested, "segments=", JSON.stringify(segments), "->", result);
189
- return result;
190
- }
191
- function storedSlugToSegments(storedSlug, nested) {
192
- const result = nested ? storedSlug.split(SLUG_NESTED_DIVIDER) : storedSlug;
193
- console.log("[WWW] render/metadata:storedSlugToSegments nested=", nested, "storedSlug=", storedSlug, "->", JSON.stringify(result));
194
- return result;
195
- }
196
- function buildCanonicalUrl({
197
- siteUrl,
198
- locale,
199
- urlPrefix,
200
- urlPath
201
- }) {
202
- const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
203
- const prefixSegment = trimmedPrefix ? `/${trimmedPrefix}` : "";
204
- const result = `${siteUrl}/${locale}${prefixSegment}${urlPath}`;
205
- console.log("[WWW] render/metadata:buildCanonicalUrl siteUrl=", siteUrl, "locale=", locale, "urlPrefix=", urlPrefix, "urlPath=", urlPath, "->", result);
206
- return result;
207
- }
208
- function getUrlPath(segments, nested, homeSlug) {
209
- const urlPath = segmentsToUrlPath(segments, nested);
210
- if (nested && !Array.isArray(segments)) {
211
- if (segments === homeSlug)
212
- return "/";
213
- } else if (nested && Array.isArray(segments)) {
214
- const stored = segments.join(SLUG_NESTED_DIVIDER);
215
- if (stored === homeSlug)
216
- return "/";
217
- }
218
- return urlPath;
219
- }
220
-
221
- // src/render/metadata/query.ts
222
- import { getPayload } from "payload";
223
- import { cache } from "react";
224
-
225
- // src/core/utils/getFromImportMap.ts
226
- function getFromImportMap(key, importMap) {
227
- return importMap[key.includes("#") ? key : key + "#default"];
228
- }
229
-
230
- // src/render/metadata/query.ts
231
- var queryDocBySlug = cache(async function queryDocBySlug2({
232
- collectionSlug,
233
- slug,
234
- slugField = "slug",
235
- locale,
236
- draft = false,
237
- config
238
- }) {
239
- console.log("[WWW] render/metadata:queryDocBySlug collection=", collectionSlug, "slug=", slug, "slugField=", slugField, "locale=", locale, "draft=", draft);
240
- const payload = await getPayload({ config });
241
- const result = await payload.find({
242
- collection: collectionSlug,
243
- draft,
244
- limit: 1,
245
- pagination: false,
246
- overrideAccess: draft,
247
- where: { [slugField]: { equals: slug } },
248
- locale
249
- });
250
- const doc = result.docs?.[0] ?? null;
251
- console.log("[WWW] render/metadata:queryDocBySlug ->", doc ? "hit" : "miss");
252
- return doc;
253
- });
254
- var queryAllDocs = cache(async function queryAllDocs2({
255
- collectionSlug,
256
- slugField = "slug",
257
- locale,
258
- config
259
- }) {
260
- console.log("[WWW] render/metadata:queryAllDocs collection=", collectionSlug, "locale=", locale);
261
- const payload = await getPayload({ config });
262
- const result = await payload.find({
263
- collection: collectionSlug,
264
- draft: false,
265
- limit: 1000,
266
- pagination: false,
267
- overrideAccess: false,
268
- select: { [slugField]: true },
269
- locale
270
- });
271
- const docs = result.docs ?? [];
272
- console.log("[WWW] render/metadata:queryAllDocs -> count=", docs.length);
273
- return docs;
274
- });
275
- var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
276
- collectionSlug,
277
- slug,
278
- slugField = "slug",
279
- locale,
280
- config
281
- }) {
282
- console.log("[WWW] render/metadata:queryAllLocaleSlugs collection=", collectionSlug, "slug=", slug, "locale=", locale);
283
- const payload = await getPayload({ config });
284
- const result = await payload.find({
285
- collection: collectionSlug,
286
- draft: false,
287
- limit: 1,
288
- pagination: false,
289
- overrideAccess: false,
290
- locale,
291
- where: { [slugField]: { equals: slug } },
292
- select: { [slugField]: true }
293
- });
294
- const doc = result.docs?.[0];
295
- if (!doc) {
296
- console.log("[WWW] render/metadata:queryAllLocaleSlugs -> undefined (no doc)");
297
- return;
298
- }
299
- let fieldValue = doc[slugField];
300
- if (doc.id != null) {
301
- const allLocales = await payload.findByID({
302
- collection: collectionSlug,
303
- id: doc.id,
304
- locale: "all",
305
- draft: false,
306
- overrideAccess: false,
307
- select: { [slugField]: true }
308
- }).catch(() => null);
309
- if (allLocales)
310
- fieldValue = allLocales[slugField];
311
- }
312
- if (fieldValue && typeof fieldValue === "object") {
313
- console.log("[WWW] render/metadata:queryAllLocaleSlugs -> localized map=", JSON.stringify(fieldValue));
314
- return fieldValue;
315
- }
316
- const resolved = await config;
317
- const rawLocales = Array.isArray(resolved?.localization?.localeCodes) ? resolved.localization.localeCodes : resolved?.localization?.locales?.map((l) => l.code) ?? [];
318
- const out = {};
319
- for (const l of rawLocales)
320
- out[l] = String(fieldValue ?? slug);
321
- console.log("[WWW] render/metadata:queryAllLocaleSlugs -> flat-fanout locales=", rawLocales.length, "slug=", JSON.stringify(fieldValue ?? slug));
322
- return out;
323
- });
324
- var queryGlobal = cache(async function queryGlobal2({
325
- globalSlug,
326
- locale,
327
- depth = 0,
328
- draft = false,
329
- config
330
- }) {
331
- console.log("[WWW] render/metadata:queryGlobal global=", globalSlug, "locale=", locale, "depth=", depth, "draft=", draft);
332
- const payload = await getPayload({ config });
333
- try {
334
- const global = await payload.findGlobal({
335
- slug: globalSlug,
336
- depth,
337
- draft,
338
- locale
339
- });
340
- console.log("[WWW] render/metadata:queryGlobal -> hit");
341
- return global;
342
- } catch (error) {
343
- console.warn("[WWW] render/metadata:queryGlobal failed for slug=", globalSlug, "err=", String(error));
344
- return null;
345
- }
346
- });
347
- function getRenderModuleExports(exportName, collection, importMap) {
348
- const path = collection?.custom?.path;
349
- if (!path) {
350
- console.log("[WWW] render/metadata:getRenderModuleExports no custom.path exportName=", exportName);
351
- return;
352
- }
353
- const mod = getFromImportMap(path, importMap);
354
- const value = mod?.[exportName];
355
- console.log("[WWW] render/metadata:getRenderModuleExports exportName=", exportName, "path=", path, "hit=", Boolean(value));
356
- return value;
357
- }
358
-
359
- // src/exports/render-metadata.ts
360
- var render_metadata_default = {
361
- buildArticleLd,
362
- buildBreadcrumbsLd,
363
- buildOrganizationLd,
364
- buildHreflangAlternates,
365
- queryDocBySlug,
366
- queryAllDocs,
367
- queryAllLocaleSlugs,
368
- getUrlPath,
369
- segmentsToStoredSlug,
370
- segmentsToUrlPath,
371
- storedSlugToSegments,
372
- buildCanonicalUrl,
373
- getRenderModuleExports
374
- };
375
- export {
376
- storedSlugToSegments,
377
- segmentsToUrlPath,
378
- segmentsToStoredSlug,
379
- queryDocBySlug,
380
- queryAllLocaleSlugs,
381
- queryAllDocs,
382
- getUrlPath,
383
- getRenderModuleExports,
384
- render_metadata_default as default,
385
- buildOrganizationLd,
386
- buildHreflangAlternates,
387
- buildCanonicalUrl,
388
- buildBreadcrumbsLd,
389
- buildArticleLd
390
- };
@@ -1,166 +0,0 @@
1
- type CreatePreviewHandlerOptions = {
2
- /** Resolves the host's site URL (used to construct preview links if
3
- * the host navigates back to the canonical site). */
4
- getServerSideURL: () => string;
5
- /**
6
- * Secret token the host configures in `process.env.PREVIEW_SECRET`.
7
- * The handler validates `?previewSecret=...` against this value and
8
- * 401s on mismatch.
9
- */
10
- secret: string;
11
- /**
12
- * Whether to enable draft mode on a valid preview. Hosts that use
13
- * their own preview mechanism can pass `false`.
14
- * Default: `true`.
15
- */
16
- enableDraftMode?: boolean;
17
- };
18
- /**
19
- * Build a Next.js `GET` route handler for the host's
20
- * `app/(payload)/next/preview/route.ts`. Validates the preview secret
21
- * from the query string, enables draft mode if configured, and
22
- * redirects to the `?path=...` value.
23
- *
24
- * Usage:
25
- *
26
- * // app/(payload)/next/preview/route.ts
27
- * import { createPreviewHandler } from '@justanarthur/payload-www/render-utils'
28
- * import { getServerSideURL } from '@/utilities/getURL'
29
- * const GET = createPreviewHandler({
30
- * getServerSideURL,
31
- * secret: process.env.PREVIEW_SECRET || ''
32
- * })
33
- */
34
- declare function createPreviewHandler(options: CreatePreviewHandlerOptions): (req: Request) => Promise<Response>;
35
- import { MetadataRoute } from "next";
36
- type CreateSitemapFileOptions = {
37
- /**
38
- * Collection slugs whose docs should appear in the sitemap. Each
39
- * collection must have a `slug` field on its documents. The lib
40
- * emits a single unified sitemap at `/sitemap.xml` listing every
41
- * doc from every configured collection across every active locale.
42
- */
43
- collections: string[];
44
- /**
45
- * The Payload config promise. The factory resolves it at request
46
- * time.
47
- */
48
- config: Promise<any>;
49
- /**
50
- * The host's site URL — used to build absolute URLs.
51
- */
52
- getServerSideURL: () => string;
53
- /**
54
- * Locale prefix mode. Mirrors next-intl's `localePrefix` so the
55
- * sitemap URLs match the host's actual route shape:
56
- *
57
- * - `'always'`: every URL is prefixed with `/{locale}/…`
58
- * (e.g. `/en/about`, `/uk/about`). The default.
59
- * - `'as-needed'`: the default locale renders without a prefix
60
- * (e.g. `/about`), other locales are prefixed (`/uk/about`).
61
- * - `'never'`: no locale prefix (only useful for single-locale
62
- * sites or hosts that don't expose locales in the URL).
63
- *
64
- * The default locale is read from `config.localization.defaultLocale`
65
- * — the same single source of truth that next-intl and the rest of
66
- * the lib use.
67
- */
68
- localePrefix?: "always" | "as-needed" | "never";
69
- /**
70
- * Optional filter for which locales to include in the sitemap.
71
- * Defaults to every locale declared in `config.localization.locales`.
72
- */
73
- locales?: string[];
74
- /**
75
- * Optional URL path prefix per collection. The Pages collection
76
- * lives at the root (`/about`) so it doesn't need a prefix, but
77
- * collections mounted under a sub-route (e.g. a posts collection
78
- * under `/posts/[...slug]`) need their URLs prefixed with `/posts`
79
- * so the sitemap entries match the actual route.
80
- *
81
- * Defaults to `''` (no prefix). Pass a value like `'/posts'`
82
- * (leading slash, no trailing slash) for a sub-routed collection.
83
- */
84
- urlPrefixes?: Record<string, string>;
85
- /**
86
- * Optional priority / changeFrequency overrides per collection.
87
- */
88
- perCollection?: Record<string, {
89
- priority?: number;
90
- changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
91
- }>;
92
- /**
93
- * Per-collection nested-slug flag. When a collection is marked
94
- * `true`, its stored `about_us` slug is expanded into the
95
- * `/about/us` URL path (and hreflang alternates), matching a
96
- * `createCollectionPageExports({ nested: true })` route. Defaults
97
- * to `false` (flat slugs) for every collection.
98
- */
99
- nested?: Record<string, boolean>;
100
- };
101
- /**
102
- * A Next.js sitemap function for the host's
103
- * `app/(frontend)/sitemap.ts`. Returns the typed
104
- * `MetadataRoute.Sitemap` array — Next.js handles XML serialization.
105
- *
106
- * Usage — single unified sitemap:
107
- *
108
- * // app/(frontend)/sitemap.ts
109
- * import { createSitemapFile } from '@justanarthur/payload-www/render-utils'
110
- * import configPromise from '@payload-config'
111
- * import { getServerSideURL } from '@/utilities/getURL'
112
- *
113
- * createSitemapFile({
114
- * collections: ['pages', 'posts'],
115
- * config: configPromise,
116
- * getServerSideURL,
117
- * localePrefix: 'as-needed',
118
- * urlPrefixes: { posts: '/posts' }
119
- * })
120
- *
121
- * The lib resolves the sitemap at request time, queries every
122
- * configured collection across every active locale, and emits one
123
- * unified `<urlset>` with full `alternates.languages` hreflang blocks
124
- * per URL. Google accepts up to 50,000 URLs per file.
125
- */
126
- type SitemapFunction = () => Promise<MetadataRoute.Sitemap>;
127
- declare function createSitemapFile(options: CreateSitemapFileOptions): SitemapFunction;
128
- import { ReactElement } from "react";
129
- /**
130
- * Hreflang alternate URLs as a `lang → url` map. Always includes an
131
- * `'x-default'` entry pointing at the default locale's URL.
132
- */
133
- type HreflangAlternates = Record<string, string>;
134
- type LocaleSwitcherProps = {
135
- /**
136
- * The currently-active locale (the one being rendered). The
137
- * switcher marks the corresponding link with `aria-current="true"`.
138
- */
139
- currentLocale: string;
140
- /**
141
- * The hreflang alternates map as returned by the lib's metadata
142
- * pipeline. Keys are locale codes; values are absolute URLs. An
143
- * `'x-default'` entry is also expected.
144
- */
145
- hreflangAlternates: HreflangAlternates;
146
- /**
147
- * Optional human-readable labels per locale. When missing, the
148
- * switcher falls back to uppercased locale codes.
149
- */
150
- labels?: Record<string, string>;
151
- };
152
- /**
153
- * Render a list of links to the same page in every other locale.
154
- * The component is server-renderable (no `'use client'`) and emits
155
- * a single `<nav>` element with one `<a>` per locale plus an
156
- * `x-default` fallback. The lib's `<PageShowcase>` mounts it as a
157
- * child of the sidebar; hosts can also drop it elsewhere on the
158
- * page.
159
- */
160
- declare function LocaleSwitcher({ currentLocale, hreflangAlternates, labels }: LocaleSwitcherProps): ReactElement;
161
- declare const _default: {
162
- createPreviewHandler: typeof createPreviewHandler;
163
- createSitemapFile: typeof createSitemapFile;
164
- LocaleSwitcher: typeof LocaleSwitcher;
165
- };
166
- export { _default as default, createSitemapFile, createPreviewHandler, SitemapFunction, LocaleSwitcherProps, LocaleSwitcher, CreateSitemapFileOptions, CreatePreviewHandlerOptions };