@justanarthur/payload-www 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pages.d.ts +4 -2
- package/dist/pages.js +12 -2
- package/dist/render-pages.d.ts +4 -2
- package/dist/render-pages.js +23 -4
- package/dist/sitemap.d.ts +3 -0
- package/dist/sitemap.js +12 -2
- package/package.json +1 -1
package/dist/pages.d.ts
CHANGED
|
@@ -39,9 +39,11 @@ type CreateCollectionPageExportsArgs<S extends string = "pages"> = {
|
|
|
39
39
|
type CreateCollectionPageExportsDeps<S extends string> = {
|
|
40
40
|
getServerSideURL: () => string;
|
|
41
41
|
pagePathPrefix?: PagePathPrefix;
|
|
42
|
+
/** Rendered while the document streams. Defaults to nothing. */
|
|
43
|
+
fallback?: ReactNode2;
|
|
42
44
|
};
|
|
43
|
-
declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, _payloadConfig, importMap, routing, slugShape }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix }: CreateCollectionPageExportsDeps<S>): {
|
|
44
|
-
default: (props: NextPageProps) =>
|
|
45
|
+
declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, _payloadConfig, importMap, routing, slugShape }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix, fallback }: CreateCollectionPageExportsDeps<S>): {
|
|
46
|
+
default: (props: NextPageProps) => ReactNode2;
|
|
45
47
|
generateMetadata: (props: NextPageProps) => Promise<Metadata>;
|
|
46
48
|
generateStaticParams: (props: NextPageProps) => Promise<{
|
|
47
49
|
locale: string;
|
package/dist/pages.js
CHANGED
|
@@ -173,6 +173,9 @@ async function PagesPage({ data, locale, ...props }) {
|
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
// src/render/pages/createCollectionPageExports.tsx
|
|
177
|
+
import * as React from "react";
|
|
178
|
+
|
|
176
179
|
// src/render/metadata/slug.ts
|
|
177
180
|
var SLUG_NESTED_DIVIDER = "_";
|
|
178
181
|
function paramsSlugToSlug(slug, _shape) {
|
|
@@ -358,7 +361,8 @@ function createCollectionPageExports({
|
|
|
358
361
|
slugShape = "single"
|
|
359
362
|
}, {
|
|
360
363
|
getServerSideURL,
|
|
361
|
-
pagePathPrefix
|
|
364
|
+
pagePathPrefix,
|
|
365
|
+
fallback
|
|
362
366
|
}) {
|
|
363
367
|
seedPayloadCache({ config: _payloadConfig });
|
|
364
368
|
const siteUrl = getServerSideURL();
|
|
@@ -369,7 +373,13 @@ function createCollectionPageExports({
|
|
|
369
373
|
collectionSlug
|
|
370
374
|
});
|
|
371
375
|
}
|
|
372
|
-
const default_ =
|
|
376
|
+
const default_ = (props) => /* @__PURE__ */ jsx6(React.Suspense, {
|
|
377
|
+
fallback: fallback ?? null,
|
|
378
|
+
children: /* @__PURE__ */ jsx6(CollectionDocument, {
|
|
379
|
+
...props
|
|
380
|
+
})
|
|
381
|
+
});
|
|
382
|
+
const CollectionDocument = async (props) => {
|
|
373
383
|
const params = await props.params;
|
|
374
384
|
const locale = params.locale;
|
|
375
385
|
if (!routing.locales.includes(locale)) {
|
package/dist/render-pages.d.ts
CHANGED
|
@@ -48,9 +48,11 @@ type CreateCollectionPageExportsArgs<S extends string = "pages"> = {
|
|
|
48
48
|
type CreateCollectionPageExportsDeps<S extends string> = {
|
|
49
49
|
getServerSideURL: () => string;
|
|
50
50
|
pagePathPrefix?: PagePathPrefix;
|
|
51
|
+
/** Rendered while the document streams. Defaults to nothing. */
|
|
52
|
+
fallback?: ReactNode2;
|
|
51
53
|
};
|
|
52
|
-
declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, _payloadConfig, importMap, routing, slugShape }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix }: CreateCollectionPageExportsDeps<S>): {
|
|
53
|
-
default: (props: NextPageProps) =>
|
|
54
|
+
declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, _payloadConfig, importMap, routing, slugShape }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix, fallback }: CreateCollectionPageExportsDeps<S>): {
|
|
55
|
+
default: (props: NextPageProps) => ReactNode2;
|
|
54
56
|
generateMetadata: (props: NextPageProps) => Promise<Metadata>;
|
|
55
57
|
generateStaticParams: (props: NextPageProps) => Promise<{
|
|
56
58
|
locale: string;
|
package/dist/render-pages.js
CHANGED
|
@@ -203,6 +203,9 @@ async function PostsPage({ doc, locale, ...props }) {
|
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
// src/render/pages/createCollectionPageExports.tsx
|
|
207
|
+
import * as React from "react";
|
|
208
|
+
|
|
206
209
|
// src/render/metadata/slug.ts
|
|
207
210
|
var SLUG_NESTED_DIVIDER = "_";
|
|
208
211
|
function paramsSlugToSlug(slug, _shape) {
|
|
@@ -388,7 +391,8 @@ function createCollectionPageExports({
|
|
|
388
391
|
slugShape = "single"
|
|
389
392
|
}, {
|
|
390
393
|
getServerSideURL,
|
|
391
|
-
pagePathPrefix
|
|
394
|
+
pagePathPrefix,
|
|
395
|
+
fallback
|
|
392
396
|
}) {
|
|
393
397
|
seedPayloadCache({ config: _payloadConfig });
|
|
394
398
|
const siteUrl = getServerSideURL();
|
|
@@ -399,7 +403,13 @@ function createCollectionPageExports({
|
|
|
399
403
|
collectionSlug
|
|
400
404
|
});
|
|
401
405
|
}
|
|
402
|
-
const default_ =
|
|
406
|
+
const default_ = (props) => /* @__PURE__ */ jsx7(React.Suspense, {
|
|
407
|
+
fallback: fallback ?? null,
|
|
408
|
+
children: /* @__PURE__ */ jsx7(CollectionDocument, {
|
|
409
|
+
...props
|
|
410
|
+
})
|
|
411
|
+
});
|
|
412
|
+
const CollectionDocument = async (props) => {
|
|
403
413
|
const params = await props.params;
|
|
404
414
|
const locale = params.locale;
|
|
405
415
|
if (!routing.locales.includes(locale)) {
|
|
@@ -503,7 +513,17 @@ import { Activity } from "react";
|
|
|
503
513
|
import { setRequestLocale as setRequestLocale2 } from "next-intl/server";
|
|
504
514
|
import { NextIntlClientProvider } from "next-intl";
|
|
505
515
|
import { RootJsonLd } from "@justanarthur/payload-plugin-seo/root-jsonld";
|
|
516
|
+
import * as rootParams from "next/root-params";
|
|
506
517
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
518
|
+
var readLocaleRootParam = rootParams.locale;
|
|
519
|
+
async function resolveLocale(props) {
|
|
520
|
+
if (readLocaleRootParam) {
|
|
521
|
+
const locale = await readLocaleRootParam();
|
|
522
|
+
if (locale)
|
|
523
|
+
return locale;
|
|
524
|
+
}
|
|
525
|
+
return (await props.params).locale;
|
|
526
|
+
}
|
|
507
527
|
function createRootLayoutExports({
|
|
508
528
|
_payloadConfig,
|
|
509
529
|
importMap,
|
|
@@ -515,8 +535,7 @@ function createRootLayoutExports({
|
|
|
515
535
|
} = {}) {
|
|
516
536
|
seedPayloadCache({ config: _payloadConfig });
|
|
517
537
|
async function RootLayout(props) {
|
|
518
|
-
const
|
|
519
|
-
const locale = params.locale;
|
|
538
|
+
const locale = await resolveLocale(props);
|
|
520
539
|
if (!routing.locales.includes(locale)) {
|
|
521
540
|
const { notFound } = await import("next/navigation");
|
|
522
541
|
return notFound();
|
package/dist/sitemap.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode as ReactNode2 } from "react";
|
|
1
2
|
/**
|
|
2
3
|
* URL segment a collection is mounted under. A string is used for every locale; a record
|
|
3
4
|
* localizes it (`{ en: 'posts', sk: 'prispevky' }`), so a host serving localized routes
|
|
@@ -8,6 +9,8 @@ type PagePathPrefix = string | Record<string, string>;
|
|
|
8
9
|
type CreateCollectionPageExportsDeps<S extends string> = {
|
|
9
10
|
getServerSideURL: () => string;
|
|
10
11
|
pagePathPrefix?: PagePathPrefix;
|
|
12
|
+
/** Rendered while the document streams. Defaults to nothing. */
|
|
13
|
+
fallback?: ReactNode2;
|
|
11
14
|
};
|
|
12
15
|
type GenerateSitemapPageExportsArgs = CreateCollectionPageExportsDeps<any>;
|
|
13
16
|
declare function createSitemapFromCollections(...args: GenerateSitemapPageExportsArgs[]): () => Response;
|
package/dist/sitemap.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/render/pages/createCollectionPageExports.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
1
4
|
// src/render/metadata/slug.ts
|
|
2
5
|
var SLUG_NESTED_DIVIDER = "_";
|
|
3
6
|
function paramsSlugToSlug(slug, _shape) {
|
|
@@ -204,7 +207,8 @@ function createCollectionPageExports({
|
|
|
204
207
|
slugShape = "single"
|
|
205
208
|
}, {
|
|
206
209
|
getServerSideURL,
|
|
207
|
-
pagePathPrefix
|
|
210
|
+
pagePathPrefix,
|
|
211
|
+
fallback
|
|
208
212
|
}) {
|
|
209
213
|
seedPayloadCache({ config: _payloadConfig });
|
|
210
214
|
const siteUrl = getServerSideURL();
|
|
@@ -215,7 +219,13 @@ function createCollectionPageExports({
|
|
|
215
219
|
collectionSlug
|
|
216
220
|
});
|
|
217
221
|
}
|
|
218
|
-
const default_ =
|
|
222
|
+
const default_ = (props) => /* @__PURE__ */ jsx2(React.Suspense, {
|
|
223
|
+
fallback: fallback ?? null,
|
|
224
|
+
children: /* @__PURE__ */ jsx2(CollectionDocument, {
|
|
225
|
+
...props
|
|
226
|
+
})
|
|
227
|
+
});
|
|
228
|
+
const CollectionDocument = async (props) => {
|
|
219
229
|
const params = await props.params;
|
|
220
230
|
const locale = params.locale;
|
|
221
231
|
if (!routing.locales.includes(locale)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justanarthur/payload-www",
|
|
3
3
|
"description": "Reusable Payload CMS website template — config builder, collections, globals, blocks, fields, access, hooks, metadata (JSON-LD, hreflang), page renderers, and test helpers.",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"files": [
|