@justanarthur/payload-www 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/pages.d.ts +3 -1
- package/dist/pages.js +3 -2
- package/dist/render-pages.d.ts +3 -1
- package/dist/render-pages.js +3 -2
- package/dist/sitemap.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,6 +124,11 @@ done. `export const instant = false` tells Next's dev-time instant validation th
|
|
|
124
124
|
blocks on purpose. With `partialPrefetching: true`, Next streams the layout shell for slugs it did
|
|
125
125
|
not prerender, so those slugs still get a soft 404.
|
|
126
126
|
|
|
127
|
+
`prerenderLocales` limits which locales' documents `generateStaticParams` prerenders at build;
|
|
128
|
+
the rest render on their first request and are cached from there. A large multilingual
|
|
129
|
+
collection can prerender only its main locale, e.g. `prerenderLocales: ['en']` for posts, to keep
|
|
130
|
+
the build short. It defaults to every locale.
|
|
131
|
+
|
|
127
132
|
`slugShape` is `'single'` (default) or `'catch-all'`. Use `'catch-all'` if your route segment is
|
|
128
133
|
`[[...slug]]` (Pages-style), `'single'` for `[slug]` (Posts-style — file convention).
|
|
129
134
|
|
package/dist/pages.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ type CreateCollectionPageExportsArgs<S extends string = "pages"> = {
|
|
|
41
41
|
slugShape?: SlugShape;
|
|
42
42
|
/** Relationship / upload hops populated on the rendered document. `0` renders them as bare ids. */
|
|
43
43
|
depth?: number;
|
|
44
|
+
/** Locales whose documents prerender at build. The rest render on their first request and cache from there. Defaults to every locale. */
|
|
45
|
+
prerenderLocales?: string[];
|
|
44
46
|
};
|
|
45
47
|
type CreateCollectionPageExportsDeps<S extends string> = {
|
|
46
48
|
getServerSideURL: () => string;
|
|
@@ -48,7 +50,7 @@ type CreateCollectionPageExportsDeps<S extends string> = {
|
|
|
48
50
|
/** Rendered while the document streams. Defaults to nothing. */
|
|
49
51
|
fallback?: ReactNode2;
|
|
50
52
|
};
|
|
51
|
-
declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, _payloadConfig, importMap, routing, slugShape, depth }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix, fallback }: CreateCollectionPageExportsDeps<S>): {
|
|
53
|
+
declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, _payloadConfig, importMap, routing, slugShape, depth, prerenderLocales }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix, fallback }: CreateCollectionPageExportsDeps<S>): {
|
|
52
54
|
default: (props: NextPageProps) => Promise<ReactNode2>;
|
|
53
55
|
generateMetadata: (props: NextPageProps) => Promise<Metadata>;
|
|
54
56
|
generateStaticParams: (props: GenerateStaticParamsProps) => Promise<{
|
package/dist/pages.js
CHANGED
|
@@ -415,7 +415,8 @@ function createCollectionPageExports({
|
|
|
415
415
|
importMap,
|
|
416
416
|
routing,
|
|
417
417
|
slugShape = "single",
|
|
418
|
-
depth = RENDER_DEPTH
|
|
418
|
+
depth = RENDER_DEPTH,
|
|
419
|
+
prerenderLocales = routing.locales
|
|
419
420
|
}, {
|
|
420
421
|
getServerSideURL,
|
|
421
422
|
pagePathPrefix,
|
|
@@ -482,7 +483,7 @@ function createCollectionPageExports({
|
|
|
482
483
|
}
|
|
483
484
|
async function generateStaticParams(props) {
|
|
484
485
|
await props.params;
|
|
485
|
-
const perLocaleEntries = await Promise.all(
|
|
486
|
+
const perLocaleEntries = await Promise.all(prerenderLocales.map(async (locale) => {
|
|
486
487
|
const docs = await queryAllDocs({ locale, collectionSlug });
|
|
487
488
|
const entries = docs.filter((doc) => !isIndexSlug(doc.slug)).map((doc) => ({ locale, slug: slugToParamsSlug(doc.slug, slugShape) }));
|
|
488
489
|
if (shapeHasIndexPath(slugShape) && await fetchDoc(locale, ""))
|
package/dist/render-pages.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ type CreateCollectionPageExportsArgs<S extends string = "pages"> = {
|
|
|
50
50
|
slugShape?: SlugShape;
|
|
51
51
|
/** Relationship / upload hops populated on the rendered document. `0` renders them as bare ids. */
|
|
52
52
|
depth?: number;
|
|
53
|
+
/** Locales whose documents prerender at build. The rest render on their first request and cache from there. Defaults to every locale. */
|
|
54
|
+
prerenderLocales?: string[];
|
|
53
55
|
};
|
|
54
56
|
type CreateCollectionPageExportsDeps<S extends string> = {
|
|
55
57
|
getServerSideURL: () => string;
|
|
@@ -57,7 +59,7 @@ type CreateCollectionPageExportsDeps<S extends string> = {
|
|
|
57
59
|
/** Rendered while the document streams. Defaults to nothing. */
|
|
58
60
|
fallback?: ReactNode2;
|
|
59
61
|
};
|
|
60
|
-
declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, _payloadConfig, importMap, routing, slugShape, depth }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix, fallback }: CreateCollectionPageExportsDeps<S>): {
|
|
62
|
+
declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, _payloadConfig, importMap, routing, slugShape, depth, prerenderLocales }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix, fallback }: CreateCollectionPageExportsDeps<S>): {
|
|
61
63
|
default: (props: NextPageProps) => Promise<ReactNode2>;
|
|
62
64
|
generateMetadata: (props: NextPageProps) => Promise<Metadata>;
|
|
63
65
|
generateStaticParams: (props: GenerateStaticParamsProps) => Promise<{
|
package/dist/render-pages.js
CHANGED
|
@@ -445,7 +445,8 @@ function createCollectionPageExports({
|
|
|
445
445
|
importMap,
|
|
446
446
|
routing,
|
|
447
447
|
slugShape = "single",
|
|
448
|
-
depth = RENDER_DEPTH
|
|
448
|
+
depth = RENDER_DEPTH,
|
|
449
|
+
prerenderLocales = routing.locales
|
|
449
450
|
}, {
|
|
450
451
|
getServerSideURL,
|
|
451
452
|
pagePathPrefix,
|
|
@@ -512,7 +513,7 @@ function createCollectionPageExports({
|
|
|
512
513
|
}
|
|
513
514
|
async function generateStaticParams(props) {
|
|
514
515
|
await props.params;
|
|
515
|
-
const perLocaleEntries = await Promise.all(
|
|
516
|
+
const perLocaleEntries = await Promise.all(prerenderLocales.map(async (locale) => {
|
|
516
517
|
const docs = await queryAllDocs({ locale, collectionSlug });
|
|
517
518
|
const entries = docs.filter((doc) => !isIndexSlug(doc.slug)).map((doc) => ({ locale, slug: slugToParamsSlug(doc.slug, slugShape) }));
|
|
518
519
|
if (shapeHasIndexPath(slugShape) && await fetchDoc(locale, ""))
|
package/dist/sitemap.js
CHANGED
|
@@ -261,7 +261,8 @@ function createCollectionPageExports({
|
|
|
261
261
|
importMap,
|
|
262
262
|
routing,
|
|
263
263
|
slugShape = "single",
|
|
264
|
-
depth = RENDER_DEPTH
|
|
264
|
+
depth = RENDER_DEPTH,
|
|
265
|
+
prerenderLocales = routing.locales
|
|
265
266
|
}, {
|
|
266
267
|
getServerSideURL,
|
|
267
268
|
pagePathPrefix,
|
|
@@ -328,7 +329,7 @@ function createCollectionPageExports({
|
|
|
328
329
|
}
|
|
329
330
|
async function generateStaticParams(props) {
|
|
330
331
|
await props.params;
|
|
331
|
-
const perLocaleEntries = await Promise.all(
|
|
332
|
+
const perLocaleEntries = await Promise.all(prerenderLocales.map(async (locale) => {
|
|
332
333
|
const docs = await queryAllDocs({ locale, collectionSlug });
|
|
333
334
|
const entries = docs.filter((doc) => !isIndexSlug(doc.slug)).map((doc) => ({ locale, slug: slugToParamsSlug(doc.slug, slugShape) }));
|
|
334
335
|
if (shapeHasIndexPath(slugShape) && await fetchDoc(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.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"private": false,
|