@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/config.d.ts
CHANGED
|
@@ -1,108 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* `localePrefix` accepts either the simple string form
|
|
8
|
-
* (`'always' | 'as-needed' | 'never'`) or next-intl's verbose
|
|
9
|
-
* `LocalePrefixConfigVerbose` shape (`{ mode, prefixes? }`). The lib
|
|
10
|
-
* normalizes both to a string `mode` internally.
|
|
11
|
-
*/
|
|
12
|
-
type LocalePrefixValue = "always" | "as-needed" | "never" | {
|
|
13
|
-
mode?: "always" | "as-needed" | "never";
|
|
14
|
-
};
|
|
15
|
-
type PageRouting = {
|
|
16
|
-
locales: readonly string[];
|
|
17
|
-
defaultLocale: string;
|
|
18
|
-
localePrefix?: LocalePrefixValue;
|
|
19
|
-
/** Optional human-readable labels per locale (used by the
|
|
20
|
-
* `<LocaleSwitcher>`). Falls back to the locale code when missing.
|
|
21
|
-
* Not part of next-intl's `defineRouting` shape — the host extends
|
|
22
|
-
* its routing object to include it (e.g. via a type assertion). */
|
|
23
|
-
labels?: Record<string, string>;
|
|
24
|
-
};
|
|
25
|
-
type WWWConfigOptions = {
|
|
26
|
-
/**
|
|
27
|
-
* Locales the host uses. First entry is the default locale
|
|
28
|
-
* (used for translation source-of-truth and the home-page path).
|
|
29
|
-
* The list drives hreflang alternates, sitemap, and the per-locale
|
|
30
|
-
* revalidation tag suffix.
|
|
31
|
-
*/
|
|
32
|
-
locales: string[];
|
|
33
|
-
/**
|
|
34
|
-
* The host's next-intl routing config (the value returned from
|
|
35
|
-
* `defineRouting({...})`). When passed, `locales`, `defaultLocale`,
|
|
36
|
-
* and `localePrefix` are read from this object instead of the
|
|
37
|
-
* legacy `locales: string[]` field. `localePrefix` is normalized
|
|
38
|
-
* to the simple string form internally — next-intl's verbose
|
|
39
|
-
* `{ mode, prefixes? }` shape is accepted and reduced to `mode`.
|
|
40
|
-
*/
|
|
41
|
-
routing?: PageRouting;
|
|
42
|
-
/**
|
|
43
|
-
* Blocks the Pages collection accepts.
|
|
44
|
-
*/
|
|
45
|
-
blocks: Block3[];
|
|
46
|
-
/**
|
|
47
|
-
* Collection slugs the Header / Footer nav `link` fields can
|
|
48
|
-
* reference. Defaults to `['pages']` (the lib's Pages collection).
|
|
49
|
-
* Pass a different list when your host has additional linkable
|
|
50
|
-
* collections.
|
|
51
|
-
*/
|
|
52
|
-
linkRelationTo?: string[];
|
|
53
|
-
/**
|
|
54
|
-
* Register the lib's Posts collection. Default: `true`. The
|
|
55
|
-
* translator plugin's default `collections` list is
|
|
56
|
-
* `['pages', 'posts']`; pass `false` here to opt out and either
|
|
57
|
-
* define your own posts-like collection or drop the translator.
|
|
58
|
-
*/
|
|
59
|
-
registerPosts?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Enable nested (hierarchical) Pages slugs. When `true`, the lib's
|
|
62
|
-
* Pages collection accepts the `_` nesting divider in its slug
|
|
63
|
-
* (`about_us` → `/about/us`). Pass the same `nested: true` to
|
|
64
|
-
* `createCollectionPageExports` on the Pages route so URL building,
|
|
65
|
-
* hreflang, and static params expand the divider. Default: `false`.
|
|
66
|
-
*/
|
|
67
|
-
nested?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Final say on the lib's default plugin list. Receives the
|
|
70
|
-
* `[seoPlugin, imageHashPlugin, translator]` array; return the
|
|
71
|
-
* list to apply. Common uses: drop the translator (no AI
|
|
72
|
-
* translation in this project), add a second `seoPlugin({...})`
|
|
73
|
-
* call for posts, or layer on a `formBuilderPlugin(...)`.
|
|
74
|
-
*/
|
|
75
|
-
defaultPlugins?: (defaults: Plugin[]) => Plugin[];
|
|
76
|
-
};
|
|
1
|
+
import { CollectionConfig, Config, GlobalConfig, Plugin } from "payload";
|
|
2
|
+
import { MCPPluginConfig } from "@payloadcms/plugin-mcp";
|
|
3
|
+
import { SEOPluginConfig } from "@justanarthur/payload-plugin-seo/types";
|
|
4
|
+
import { BlurhashPluginOptions } from "@justanarthur/payload-imagehash-plugin/types";
|
|
5
|
+
import { TranslatorConfig } from "@justanarthur/payload-plugin-translator/types";
|
|
77
6
|
type WWWConfigApi = {
|
|
78
|
-
withWWWConfig: (config: WWWInputConfig) =>
|
|
7
|
+
withWWWConfig: (config: WWWInputConfig) => Config;
|
|
79
8
|
};
|
|
80
|
-
type WWWInputConfig = Omit<Config, "collections" | "globals"> & {
|
|
81
|
-
collections:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
9
|
+
type WWWInputConfig = Omit<Config, "collections" | "globals" | "plugins"> & {
|
|
10
|
+
collections: MergeOrOverride<CollectionConfig[]>;
|
|
11
|
+
globals: MergeOrOverride<GlobalConfig[]>;
|
|
12
|
+
plugins?: MergeOrOverride<Plugin[]>;
|
|
13
|
+
defaultPluginsConfigs?: {
|
|
14
|
+
seo?: MergeOrOverride<SEOPluginConfig>;
|
|
15
|
+
imageHash?: MergeOrOverride<BlurhashPluginOptions>;
|
|
16
|
+
translator?: MergeOrOverride<TranslatorConfig>;
|
|
17
|
+
mcp?: MergeOrOverride<MCPPluginConfig>;
|
|
18
|
+
};
|
|
87
19
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
* Hosts call this once with their `locales` and `blocks`; the returned
|
|
92
|
-
* object is **safe to import from a Node entrypoint** such as
|
|
93
|
-
* `payload.config.ts` — it only contains Payload collection / global
|
|
94
|
-
* factories and the `withWWWConfig` composer.
|
|
95
|
-
*
|
|
96
|
-
* The lib applies three plugins by default: `seoPlugin` (Pages + meta tab),
|
|
97
|
-
* `imageHashPlugin` (Blurhash/Thumbhash on uploads), and `translator`
|
|
98
|
-
* (auto-translation workflow). Use the `defaultPlugins` callback to
|
|
99
|
-
* drop or extend the list.
|
|
100
|
-
*
|
|
101
|
-
* For the App Router rendering side, import from the lib's render
|
|
102
|
-
* subpaths:
|
|
103
|
-
*
|
|
104
|
-
* import { createCollectionPageExports } from '@justanarthur/payload-www/render-pages'
|
|
105
|
-
* import { createPreviewHandler, createSitemapFile } from '@justanarthur/payload-www/render-utils'
|
|
106
|
-
*/
|
|
107
|
-
declare function createWWWConfig(options: WWWConfigOptions): WWWConfigApi;
|
|
108
|
-
export { createWWWConfig as default, createWWWConfig, WWWInputConfig, WWWConfigOptions, WWWConfigApi };
|
|
20
|
+
declare function createWWWConfig(): WWWConfigApi;
|
|
21
|
+
type MergeOrOverride<T> = T | ((defaultValue: T) => T);
|
|
22
|
+
export { createWWWConfig as default, createWWWConfig, WWWInputConfig, WWWConfigApi };
|