@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.
- package/README.md +317 -307
- package/dist/access.d.ts +2 -2
- package/dist/access.js +3 -17
- package/dist/blocks.d.ts +7 -12
- package/dist/blocks.js +24 -43
- package/dist/cli.js +201 -0
- package/dist/collections.d.ts +33 -225
- package/dist/collections.js +185 -639
- package/dist/config.d.ts +19 -105
- package/dist/config.js +257 -855
- package/dist/fields.d.ts +4 -46
- package/dist/fields.js +177 -53
- package/dist/imagehash.js +0 -15
- package/dist/import-map-provider.d.ts +0 -16
- package/dist/import-map-provider.js +0 -15
- package/dist/metadata.d.ts +24 -89
- package/dist/metadata.js +123 -255
- package/dist/pages.d.ts +37 -319
- package/dist/pages.js +349 -964
- package/dist/render-pages.d.ts +70 -565
- package/dist/render-pages.js +464 -1477
- package/dist/sitemap.d.ts +10 -0
- package/dist/sitemap.js +337 -0
- package/dist/translator.js +0 -15
- package/dist/utils.d.ts +10 -12
- package/dist/utils.js +18 -41
- package/package.json +81 -178
- package/dist/components.d.ts +0 -6
- package/dist/components.js +0 -39
- package/dist/core-access.d.ts +0 -11
- package/dist/core-access.js +0 -34
- package/dist/core-blocks.d.ts +0 -24
- package/dist/core-blocks.js +0 -79
- package/dist/core-fields.d.ts +0 -73
- package/dist/core-fields.js +0 -167
- package/dist/core-utils.d.ts +0 -16
- package/dist/core-utils.js +0 -63
- package/dist/data-collections.d.ts +0 -229
- package/dist/data-collections.js +0 -676
- package/dist/data-seed.d.ts +0 -76
- package/dist/data-seed.js +0 -212
- package/dist/data-test.d.ts +0 -30
- package/dist/data-test.js +0 -1110
- package/dist/globals.d.ts +0 -69
- package/dist/globals.js +0 -251
- package/dist/hooks.d.ts +0 -108
- package/dist/hooks.js +0 -228
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -39
- package/dist/render-components.d.ts +0 -42
- package/dist/render-components.js +0 -154
- package/dist/render-metadata.d.ts +0 -122
- package/dist/render-metadata.js +0 -390
- package/dist/render-utils.d.ts +0 -166
- package/dist/render-utils.js +0 -398
- package/dist/seed.d.ts +0 -76
- package/dist/seed.js +0 -212
- package/dist/server.d.ts +0 -980
- package/dist/server.js +0 -2231
- package/dist/test.d.ts +0 -30
- package/dist/test.js +0 -1110
- package/dist/with-www-config.d.ts +0 -108
- package/dist/with-www-config.js +0 -1006
package/dist/fields.d.ts
CHANGED
|
@@ -7,67 +7,25 @@ declare const appearanceOptions: Record<LinkAppearances, {
|
|
|
7
7
|
type LinkOptions = {
|
|
8
8
|
appearances?: LinkAppearances[] | false;
|
|
9
9
|
disableLabel?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Collection slugs the link can reference. Payload 3.85 rejects
|
|
12
|
-
* empty arrays, so the lib defaults to `['pages']` (its own Pages
|
|
13
|
-
* collection). Hosts that reference different collections pass
|
|
14
|
-
* their own list.
|
|
15
|
-
*/
|
|
16
10
|
relationTo?: string[];
|
|
17
|
-
/** Mark the text fields as `localized: true`. */
|
|
18
11
|
localized?: boolean;
|
|
19
|
-
/** Deep-merge into the resulting group. */
|
|
20
12
|
overrides?: Partial<GroupField>;
|
|
21
|
-
/** Legacy alias for the host's custom field overrides. */
|
|
22
13
|
linkOverrides?: Partial<GroupField>;
|
|
23
|
-
/**
|
|
24
|
-
* Extra fields appended to the link group — e.g. a `description`
|
|
25
|
-
* text field or a `navHover` group for a mega-menu. Lets hosts
|
|
26
|
-
* extend the nav link schema without re-implementing the whole
|
|
27
|
-
* `link` field. Appended after the standard type/label/appearance
|
|
28
|
-
* fields.
|
|
29
|
-
*/
|
|
30
14
|
extraFields?: Field[];
|
|
31
15
|
};
|
|
32
16
|
declare const link: (options?: LinkOptions) => Field;
|
|
33
17
|
import { Field as Field2 } from "payload";
|
|
34
18
|
declare const linkGroup: (options?: LinkOptions) => Field2;
|
|
35
19
|
import { Field as Field3 } from "payload";
|
|
36
|
-
|
|
37
|
-
/** Field name. Default: `'slug'`. */
|
|
38
|
-
name?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Allow the `_` nesting divider in the slug so `about_us` renders at
|
|
41
|
-
* `/about/us`. Relaxes validation and documents the convention in the
|
|
42
|
-
* admin UI. Pair with `createCollectionPageExports({ nested: true })`.
|
|
43
|
-
* Default: `false`.
|
|
44
|
-
*/
|
|
45
|
-
nested?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Localize the slug — one slug per locale (`/about` in `en`, `/o-nas`
|
|
48
|
-
* in `sk`), stored in the collection's `_locales` table. This is the
|
|
49
|
-
* default: the lib's collections are multilingual, so per-locale slugs
|
|
50
|
-
* power localized URLs and hreflang alternates. Pass `false` for a
|
|
51
|
-
* single shared slug.
|
|
52
|
-
*/
|
|
53
|
-
localized?: boolean;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* The slug field shared by the lib's Pages / Posts collections: a
|
|
57
|
-
* required, unique, indexed, sidebar text field, localized by default.
|
|
58
|
-
*
|
|
59
|
-
* The empty string is reserved for the home page (rendered at
|
|
60
|
-
* `/${locale}`), so validation only rejects non-empty malformed values.
|
|
61
|
-
*/
|
|
62
|
-
declare const slugField: (options?: SlugFieldOptions) => Field3;
|
|
20
|
+
declare const slugField: () => Field3;
|
|
63
21
|
import { Field as Field_14espm } from "payload";
|
|
64
|
-
declare const
|
|
22
|
+
declare const fields: {
|
|
65
23
|
link: (options?: LinkOptions) => Field_14espm;
|
|
66
24
|
linkGroup: (options?: LinkOptions) => Field_14espm;
|
|
67
25
|
appearanceOptions: Record<LinkAppearances, {
|
|
68
26
|
label: string;
|
|
69
27
|
value: string;
|
|
70
28
|
}>;
|
|
71
|
-
slugField: (
|
|
29
|
+
slugField: () => Field_14espm;
|
|
72
30
|
};
|
|
73
|
-
export { slugField, linkGroup, link,
|
|
31
|
+
export { slugField, linkGroup, link, fields as default, appearanceOptions, LinkOptions, LinkAppearances };
|
package/dist/fields.js
CHANGED
|
@@ -1,31 +1,182 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
// package.json
|
|
4
|
+
var name = "@justanarthur/payload-www";
|
|
5
|
+
|
|
6
|
+
// src/collections/hooks/populatePublishedAt.ts
|
|
7
|
+
var populatePublishedAt = ({ data, operation, req }) => {
|
|
8
|
+
if (operation === "create" || operation === "update") {
|
|
9
|
+
if (req.data && !req.data.publishedAt) {
|
|
10
|
+
const now = new Date;
|
|
11
|
+
return {
|
|
12
|
+
...data,
|
|
13
|
+
publishedAt: now
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// src/collections/hooks/createRevalidateCollectionGlobalHook.ts
|
|
21
|
+
import { revalidateTag } from "next/cache";
|
|
22
|
+
function createRevalidateCollectionGlobalHook() {
|
|
23
|
+
const afterChangeDeleteHook = async ({ doc, req, ...args }) => {
|
|
24
|
+
const previousDoc = "previousDoc" in args ? args.previousDoc : null, locale = req.locale;
|
|
25
|
+
function revalidate(args2) {
|
|
26
|
+
try {
|
|
27
|
+
revalidateTag(createCollectionCacheKey({ ...args2, locale }), "max");
|
|
28
|
+
} catch (error) {
|
|
29
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
30
|
+
if (msg.includes("static generation store missing"))
|
|
31
|
+
return;
|
|
32
|
+
console.error(error);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if ("collection" in args) {
|
|
36
|
+
[
|
|
37
|
+
doc && doc._status !== "draft" && doc.slug,
|
|
38
|
+
previousDoc && previousDoc._status === "published" && previousDoc.slug
|
|
39
|
+
].filter((slug) => slug !== undefined && slug !== false).map((slug) => revalidate({ collectionSlug: args.collection.slug, slug }));
|
|
40
|
+
} else {
|
|
41
|
+
revalidate({ globalSlug: args.global.slug });
|
|
42
|
+
}
|
|
43
|
+
return doc;
|
|
44
|
+
};
|
|
45
|
+
return { afterChange: afterChangeDeleteHook, afterDelete: afterChangeDeleteHook };
|
|
6
46
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
47
|
+
function createCollectionCacheKey(args) {
|
|
48
|
+
return `${"globalSlug" in args ? args.globalSlug : args.collectionSlug + args.slug}_${args.locale}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/collections/fields/slug.ts
|
|
52
|
+
var slugField = () => ({
|
|
53
|
+
name: "slug",
|
|
54
|
+
type: "text",
|
|
55
|
+
required: true,
|
|
56
|
+
unique: true,
|
|
57
|
+
index: true,
|
|
58
|
+
localized: true,
|
|
59
|
+
admin: {
|
|
60
|
+
position: "sidebar",
|
|
61
|
+
description: "Lowercase, hyphens for words. Use the `_` divider for nesting, e.g. `about_us` → `/about/us`."
|
|
62
|
+
},
|
|
63
|
+
validate: (value) => {
|
|
64
|
+
if (typeof value !== "string")
|
|
65
|
+
return "Slug must be a string";
|
|
66
|
+
if (value !== "" && !/^[a-z0-9_-]+$/.test(value))
|
|
67
|
+
return "Slug must be lowercase, with hyphens (no spaces or special characters).";
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// src/collections/access/index.ts
|
|
73
|
+
var anyone = () => true;
|
|
74
|
+
var authenticated = ({ req: { user } }) => Boolean(user);
|
|
75
|
+
var authenticatedOrPublished = ({ req: { user } }) => {
|
|
76
|
+
if (user)
|
|
77
|
+
return true;
|
|
78
|
+
return { _status: { equals: "published" } };
|
|
15
79
|
};
|
|
16
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
80
|
|
|
18
|
-
// src/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
81
|
+
// src/collections/createWWWCollectionGlobal.ts
|
|
82
|
+
function createWWWCollectionGlobal(fields, {
|
|
83
|
+
slug: collectionSlug,
|
|
84
|
+
renderPath,
|
|
85
|
+
isGlobalConfig = false,
|
|
86
|
+
isDraft = true
|
|
87
|
+
}) {
|
|
88
|
+
return {
|
|
89
|
+
slug: collectionSlug,
|
|
90
|
+
fields: isGlobalConfig ? fields : [
|
|
91
|
+
slugField(),
|
|
92
|
+
{
|
|
93
|
+
name: "publishedAt",
|
|
94
|
+
type: "date",
|
|
95
|
+
admin: { position: "sidebar" }
|
|
96
|
+
},
|
|
97
|
+
...fields
|
|
98
|
+
],
|
|
99
|
+
custom: { [name]: { path: renderPath } },
|
|
100
|
+
access: {
|
|
101
|
+
create: authenticated,
|
|
102
|
+
delete: authenticated,
|
|
103
|
+
read: isDraft ? authenticatedOrPublished : anyone,
|
|
104
|
+
update: authenticated
|
|
105
|
+
},
|
|
106
|
+
hooks: (() => {
|
|
107
|
+
const { afterChange, afterDelete } = createRevalidateCollectionGlobalHook();
|
|
108
|
+
return {
|
|
109
|
+
afterChange: [afterChange],
|
|
110
|
+
beforeChange: [populatePublishedAt],
|
|
111
|
+
afterDelete: [afterDelete]
|
|
112
|
+
};
|
|
113
|
+
})(),
|
|
114
|
+
...isDraft && {
|
|
115
|
+
versions: { drafts: { autosave: { interval: 3000 } } }
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/collections/createPagesCollection.ts
|
|
24
121
|
var PAGES_SLUG = "pages";
|
|
122
|
+
var PAGES_RENDER_PATH = "@justanarthur/payload-www/render-pages#PagesPage";
|
|
123
|
+
var createPagesCollection = (blocks) => createWWWCollectionGlobal([
|
|
124
|
+
{
|
|
125
|
+
name: "title",
|
|
126
|
+
type: "text",
|
|
127
|
+
required: true,
|
|
128
|
+
localized: true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: "tabs",
|
|
132
|
+
tabs: [
|
|
133
|
+
{
|
|
134
|
+
fields: [
|
|
135
|
+
{
|
|
136
|
+
name: "blocks",
|
|
137
|
+
type: "blocks",
|
|
138
|
+
blocks,
|
|
139
|
+
required: true,
|
|
140
|
+
admin: { initCollapsed: true }
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
label: "Content"
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
], {
|
|
148
|
+
slug: PAGES_SLUG,
|
|
149
|
+
renderPath: PAGES_RENDER_PATH
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// src/collections/createPostsCollection.ts
|
|
25
153
|
var POSTS_SLUG = "posts";
|
|
26
|
-
var
|
|
154
|
+
var POSTS_RENDER_PATH = "@justanarthur/payload-www/render-pages#PostsPage";
|
|
155
|
+
var createPostsCollection = () => createWWWCollectionGlobal([
|
|
156
|
+
{
|
|
157
|
+
name: "title",
|
|
158
|
+
type: "text",
|
|
159
|
+
required: true,
|
|
160
|
+
localized: true
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "excerpt",
|
|
164
|
+
type: "text",
|
|
165
|
+
required: false,
|
|
166
|
+
localized: true
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "content",
|
|
170
|
+
type: "richText",
|
|
171
|
+
required: false,
|
|
172
|
+
localized: true
|
|
173
|
+
}
|
|
174
|
+
], {
|
|
175
|
+
slug: POSTS_SLUG,
|
|
176
|
+
renderPath: POSTS_RENDER_PATH
|
|
177
|
+
});
|
|
27
178
|
|
|
28
|
-
// src/
|
|
179
|
+
// src/collections/fields/link.ts
|
|
29
180
|
var appearanceOptions = {
|
|
30
181
|
default: { label: "Default", value: "default" },
|
|
31
182
|
outline: { label: "Outline", value: "outline" }
|
|
@@ -34,8 +185,8 @@ var link = (options = {}) => {
|
|
|
34
185
|
const {
|
|
35
186
|
appearances,
|
|
36
187
|
disableLabel = false,
|
|
37
|
-
relationTo = [PAGES_SLUG],
|
|
38
|
-
localized =
|
|
188
|
+
relationTo = [PAGES_SLUG, POSTS_SLUG],
|
|
189
|
+
localized = true,
|
|
39
190
|
overrides = {},
|
|
40
191
|
extraFields = []
|
|
41
192
|
} = options;
|
|
@@ -120,7 +271,7 @@ var link = (options = {}) => {
|
|
|
120
271
|
return { ...result, ...overrides };
|
|
121
272
|
};
|
|
122
273
|
|
|
123
|
-
// src/
|
|
274
|
+
// src/collections/fields/linkGroup.ts
|
|
124
275
|
var linkGroup = (options = {}) => ({
|
|
125
276
|
name: "links",
|
|
126
277
|
type: "array",
|
|
@@ -128,36 +279,9 @@ var linkGroup = (options = {}) => ({
|
|
|
128
279
|
admin: { initCollapsed: true }
|
|
129
280
|
});
|
|
130
281
|
|
|
131
|
-
// src/core/fields/slug.ts
|
|
132
|
-
var FLAT_PATTERN = /^[a-z0-9-]+$/;
|
|
133
|
-
var NESTED_PATTERN = /^[a-z0-9_-]+$/;
|
|
134
|
-
var slugField = (options = {}) => {
|
|
135
|
-
const { name = "slug", nested = false, localized = true } = options;
|
|
136
|
-
const pattern = nested ? NESTED_PATTERN : FLAT_PATTERN;
|
|
137
|
-
const invalidMessage = nested ? "Slug must be lowercase, with hyphens or the `_` nesting divider (no spaces or other special characters)" : "Slug must be lowercase, with hyphens (no spaces or special characters)";
|
|
138
|
-
return {
|
|
139
|
-
name,
|
|
140
|
-
type: "text",
|
|
141
|
-
required: true,
|
|
142
|
-
unique: true,
|
|
143
|
-
index: true,
|
|
144
|
-
localized,
|
|
145
|
-
admin: {
|
|
146
|
-
position: "sidebar",
|
|
147
|
-
...nested ? { description: "Lowercase, hyphens for words. Use the `_` divider for nesting, e.g. `about_us` → `/about/us`." } : {}
|
|
148
|
-
},
|
|
149
|
-
validate: (value) => {
|
|
150
|
-
if (typeof value !== "string")
|
|
151
|
-
return "Slug must be a string";
|
|
152
|
-
if (value !== "" && !pattern.test(value))
|
|
153
|
-
return invalidMessage;
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
|
|
159
282
|
// src/exports/fields.ts
|
|
160
|
-
var
|
|
283
|
+
var fields = { link, linkGroup, appearanceOptions, slugField };
|
|
284
|
+
var fields_default = fields;
|
|
161
285
|
export {
|
|
162
286
|
slugField,
|
|
163
287
|
linkGroup,
|
package/dist/imagehash.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
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
2
|
|
|
18
3
|
// src/exports/imagehash.ts
|
|
19
4
|
import { imageHashPlugin } from "@justanarthur/payload-imagehash-plugin";
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
import { ImportMap } from "payload";
|
|
2
|
-
/**
|
|
3
|
-
* Marker kept for backwards compatibility with hosts that
|
|
4
|
-
* imported `setImportMapProvider` / `getImportMap` from earlier
|
|
5
|
-
* versions of the lib. New code should pass the importMap directly
|
|
6
|
-
* to `createRootLayoutExports` and `createCollectionPageExports` —
|
|
7
|
-
* no global state, no module-load-time coupling.
|
|
8
|
-
*
|
|
9
|
-
* The functions are no-ops. The lib reads the importMap exclusively
|
|
10
|
-
* from the per-factory `importMap` option now.
|
|
11
|
-
*
|
|
12
|
-
* @deprecated pass `importMap` to the factories instead.
|
|
13
|
-
*/
|
|
14
2
|
declare function setImportMapProvider(_provider: () => Promise<ImportMap> | ImportMap): void;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated pass `importMap` to the factories instead. Always
|
|
17
|
-
* returns `{}` now — the lib never reads global state.
|
|
18
|
-
*/
|
|
19
3
|
declare function getImportMap(): Promise<ImportMap>;
|
|
20
4
|
export { setImportMapProvider, getImportMap };
|
|
@@ -1,19 +1,4 @@
|
|
|
1
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
2
|
|
|
18
3
|
// src/exports/import-map-provider.ts
|
|
19
4
|
function setImportMapProvider(_provider) {}
|
package/dist/metadata.d.ts
CHANGED
|
@@ -16,107 +16,42 @@ declare function buildBreadcrumbsLd({ items, currentUrl }: {
|
|
|
16
16
|
items: BreadcrumbItem[];
|
|
17
17
|
currentUrl: string;
|
|
18
18
|
}): Record<string, unknown>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
declare function buildHreflangAlternates<L extends string>({ siteUrl, locale, urlPrefix, storedSlug, queryAllLocaleSlugs, nested, homeSlug, defaultLocale, locales, localePrefix }: {
|
|
26
|
-
siteUrl: string;
|
|
27
|
-
locale: L;
|
|
28
|
-
urlPrefix: string;
|
|
29
|
-
storedSlug: string;
|
|
30
|
-
queryAllLocaleSlugs: (slug: string, locale: L) => Promise<Partial<Record<L, string>> | undefined>;
|
|
31
|
-
nested: boolean;
|
|
32
|
-
homeSlug: string;
|
|
33
|
-
defaultLocale: L;
|
|
34
|
-
locales: readonly L[];
|
|
35
|
-
/**
|
|
36
|
-
* Locale prefix mode — mirrors next-intl's `localePrefix` so each
|
|
37
|
-
* alternate URL matches the host's actual route shape:
|
|
38
|
-
*
|
|
39
|
-
* - `'always'`: every URL is prefixed with `/{locale}/…`
|
|
40
|
-
* (e.g. `/en/about`, `/uk/about`). The default — preserves
|
|
41
|
-
* the helper's prior behavior.
|
|
42
|
-
* - `'as-needed'`: the default locale renders without a prefix
|
|
43
|
-
* (e.g. `/about`), other locales are prefixed (`/uk/about`).
|
|
44
|
-
* Critical: callers that emit hreflang alongside a canonical
|
|
45
|
-
* URL built with `as-needed` mode MUST pass this through,
|
|
46
|
-
* otherwise the `en` and `x-default` alternates point to URLs
|
|
47
|
-
* the host doesn't actually serve.
|
|
48
|
-
* - `'never'`: no locale prefix at all.
|
|
49
|
-
*/
|
|
50
|
-
localePrefix?: "always" | "as-needed" | "never";
|
|
51
|
-
}): Promise<Record<string, string>>;
|
|
52
|
-
declare function segmentsToStoredSlug(segments: string[] | string, nested?: boolean): string;
|
|
53
|
-
declare function segmentsToUrlPath(segments: string[] | string, nested?: boolean): string;
|
|
54
|
-
declare function storedSlugToSegments(storedSlug: string, nested?: boolean): string[] | string;
|
|
55
|
-
declare function buildCanonicalUrl<L extends string>({ siteUrl, locale, urlPrefix, urlPath }: {
|
|
56
|
-
siteUrl: string;
|
|
57
|
-
locale: L;
|
|
58
|
-
urlPrefix: string;
|
|
59
|
-
urlPath: string;
|
|
60
|
-
}): string;
|
|
61
|
-
declare function getUrlPath(segments: string[] | string, nested: boolean, homeSlug: string): string;
|
|
62
|
-
import { DataFromCollectionSlug, ImportMap, SanitizedConfig } from "payload";
|
|
63
|
-
declare const queryDocBySlug: <S extends string>({ collectionSlug, slug, slugField, locale, draft, config }: {
|
|
19
|
+
import { BuildOrganizationLdOptions, BuildProductLdOptions, BuildRootJsonLdOptions, BuildWebSiteLdOptions, buildOrganizationLd, buildProductLd, buildRootJsonLd, buildWebSiteLd } from "@justanarthur/payload-plugin-seo/root-jsonld";
|
|
20
|
+
type SlugShape = "single" | "catch-all";
|
|
21
|
+
declare function paramsSlugToSlug(slug: string | string[] | undefined, _shape: SlugShape): string;
|
|
22
|
+
declare function slugToParamsSlug(slug: string, shape: SlugShape): string | string[];
|
|
23
|
+
import { DataFromCollectionSlug, SanitizedConfig } from "payload";
|
|
24
|
+
declare function queryDocBySlug<S extends string>({ collectionSlug, slug, slugField, locale, draft, config }: {
|
|
64
25
|
collectionSlug: S;
|
|
65
26
|
slug: string;
|
|
66
27
|
slugField?: string;
|
|
67
28
|
locale: string;
|
|
68
29
|
draft?: boolean;
|
|
69
30
|
config: Promise<SanitizedConfig>;
|
|
70
|
-
})
|
|
71
|
-
declare
|
|
31
|
+
}): Promise<DataFromCollectionSlug<S> | null>;
|
|
32
|
+
declare function queryAllDocs<S extends string>({ collectionSlug, slugField, locale, config }: {
|
|
72
33
|
collectionSlug: S;
|
|
73
34
|
slugField?: string;
|
|
74
35
|
locale: string;
|
|
75
36
|
config: Promise<SanitizedConfig>;
|
|
76
|
-
})
|
|
77
|
-
declare
|
|
78
|
-
collectionSlug:
|
|
79
|
-
|
|
37
|
+
}): Promise<DataFromCollectionSlug<S>[]>;
|
|
38
|
+
declare function queryAllLocaleSlugs({ collectionSlug, id, slugField, config }: {
|
|
39
|
+
collectionSlug: string;
|
|
40
|
+
id: number | string;
|
|
80
41
|
slugField?: string;
|
|
81
|
-
locale: string;
|
|
82
42
|
config: Promise<SanitizedConfig>;
|
|
83
|
-
})
|
|
84
|
-
declare
|
|
85
|
-
custom?: Record<string, unknown>;
|
|
86
|
-
} | undefined, importMap: ImportMap): unknown;
|
|
87
|
-
import { SanitizedConfig as SanitizedConfig_ee8ogz } from "payload";
|
|
88
|
-
import { DataFromCollectionSlug as DataFromCollectionSlug_2e2bqb } from "payload";
|
|
89
|
-
declare const _default: {
|
|
43
|
+
}): Promise<Record<string, string> | null>;
|
|
44
|
+
declare const metadata: {
|
|
90
45
|
buildArticleLd: typeof buildArticleLd;
|
|
91
46
|
buildBreadcrumbsLd: typeof buildBreadcrumbsLd;
|
|
92
|
-
buildOrganizationLd:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}) => Promise<DataFromCollectionSlug_2e2bqb<S> | null>;
|
|
102
|
-
queryAllDocs: <S extends string>({ collectionSlug, slugField, locale, config }: {
|
|
103
|
-
collectionSlug: S;
|
|
104
|
-
slugField?: string;
|
|
105
|
-
locale: string;
|
|
106
|
-
config: Promise<SanitizedConfig_ee8ogz>;
|
|
107
|
-
}) => Promise<DataFromCollectionSlug_2e2bqb<S>[]>;
|
|
108
|
-
queryAllLocaleSlugs2: <S extends string>({ collectionSlug, slug, slugField, locale, config }: {
|
|
109
|
-
collectionSlug: S;
|
|
110
|
-
slug: string;
|
|
111
|
-
slugField?: string;
|
|
112
|
-
locale: string;
|
|
113
|
-
config: Promise<SanitizedConfig_ee8ogz>;
|
|
114
|
-
}) => Promise<Record<string, string> | undefined>;
|
|
115
|
-
getUrlPath: typeof getUrlPath;
|
|
116
|
-
segmentsToStoredSlug: typeof segmentsToStoredSlug;
|
|
117
|
-
segmentsToUrlPath: typeof segmentsToUrlPath;
|
|
118
|
-
storedSlugToSegments: typeof storedSlugToSegments;
|
|
119
|
-
buildCanonicalUrl: typeof buildCanonicalUrl;
|
|
120
|
-
getRenderModuleExports: typeof getRenderModuleExports;
|
|
47
|
+
buildOrganizationLd: any;
|
|
48
|
+
buildWebSiteLd: any;
|
|
49
|
+
buildProductLd: any;
|
|
50
|
+
buildRootJsonLd: any;
|
|
51
|
+
queryDocBySlug: typeof queryDocBySlug;
|
|
52
|
+
queryAllDocs: typeof queryAllDocs;
|
|
53
|
+
queryAllLocaleSlugs: typeof queryAllLocaleSlugs;
|
|
54
|
+
paramsSlugToSlug: typeof paramsSlugToSlug;
|
|
55
|
+
slugToParamsSlug: typeof slugToParamsSlug;
|
|
121
56
|
};
|
|
122
|
-
export {
|
|
57
|
+
export { slugToParamsSlug, queryDocBySlug, queryAllLocaleSlugs, queryAllDocs, paramsSlugToSlug, metadata as default, buildWebSiteLd, buildRootJsonLd, buildProductLd, buildOrganizationLd, buildBreadcrumbsLd, buildArticleLd, SlugShape, BuildWebSiteLdOptions, BuildRootJsonLdOptions, BuildProductLdOptions, BuildOrganizationLdOptions, BreadcrumbItem, ArticleLdOptions };
|