@justanarthur/payload-www 0.1.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/README.md +381 -0
- package/dist/access.d.ts +11 -0
- package/dist/access.js +34 -0
- package/dist/blocks.d.ts +24 -0
- package/dist/blocks.js +75 -0
- package/dist/collections.d.ts +200 -0
- package/dist/collections.js +625 -0
- package/dist/components.d.ts +6 -0
- package/dist/components.js +38 -0
- package/dist/config.d.ts +100 -0
- package/dist/config.js +914 -0
- package/dist/core-access.d.ts +11 -0
- package/dist/core-access.js +34 -0
- package/dist/core-blocks.d.ts +24 -0
- package/dist/core-blocks.js +75 -0
- package/dist/core-fields.d.ts +36 -0
- package/dist/core-fields.js +134 -0
- package/dist/core-utils.d.ts +16 -0
- package/dist/core-utils.js +59 -0
- package/dist/data-collections.d.ts +200 -0
- package/dist/data-collections.js +625 -0
- package/dist/data-seed.d.ts +76 -0
- package/dist/data-seed.js +212 -0
- package/dist/data-test.d.ts +30 -0
- package/dist/data-test.js +1018 -0
- package/dist/fields.d.ts +36 -0
- package/dist/fields.js +134 -0
- package/dist/globals.d.ts +48 -0
- package/dist/globals.js +228 -0
- package/dist/hooks.d.ts +108 -0
- package/dist/hooks.js +196 -0
- package/dist/imagehash.d.ts +3 -0
- package/dist/imagehash.js +24 -0
- package/dist/import-map-provider.d.ts +20 -0
- package/dist/import-map-provider.js +26 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +38 -0
- package/dist/metadata.d.ts +122 -0
- package/dist/metadata.js +335 -0
- package/dist/pages.d.ts +323 -0
- package/dist/pages.js +1016 -0
- package/dist/render-components.d.ts +42 -0
- package/dist/render-components.js +144 -0
- package/dist/render-metadata.d.ts +122 -0
- package/dist/render-metadata.js +335 -0
- package/dist/render-pages.d.ts +574 -0
- package/dist/render-pages.js +1450 -0
- package/dist/render-utils.d.ts +158 -0
- package/dist/render-utils.js +341 -0
- package/dist/seed.d.ts +76 -0
- package/dist/seed.js +212 -0
- package/dist/server.d.ts +922 -0
- package/dist/server.js +2055 -0
- package/dist/test.d.ts +30 -0
- package/dist/test.js +1018 -0
- package/dist/translator.d.ts +2 -0
- package/dist/translator.js +24 -0
- package/dist/utils.d.ts +16 -0
- package/dist/utils.js +59 -0
- package/dist/with-www-config.d.ts +100 -0
- package/dist/with-www-config.js +914 -0
- package/package.json +246 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Block as Block3, CollectionConfig as CollectionConfig4, Config, GlobalConfig as GlobalConfig3, Plugin } from "payload";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal next-intl routing contract the lib reads. Hosts pass
|
|
4
|
+
* their `defineRouting({...})` result directly; the lib only needs
|
|
5
|
+
* the shape below.
|
|
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
|
+
* Final say on the lib's default plugin list. Receives the
|
|
62
|
+
* `[seoPlugin, imageHashPlugin, translator]` array; return the
|
|
63
|
+
* list to apply. Common uses: drop the translator (no AI
|
|
64
|
+
* translation in this project), add a second `seoPlugin({...})`
|
|
65
|
+
* call for posts, or layer on a `formBuilderPlugin(...)`.
|
|
66
|
+
*/
|
|
67
|
+
defaultPlugins?: (defaults: Plugin[]) => Plugin[];
|
|
68
|
+
};
|
|
69
|
+
type WWWConfigApi = {
|
|
70
|
+
withWWWConfig: (config: WWWInputConfig) => Promise<Config> | Config;
|
|
71
|
+
};
|
|
72
|
+
type WWWInputConfig = Omit<Config, "collections" | "globals"> & {
|
|
73
|
+
collections: ((args: {
|
|
74
|
+
defaultCollections: CollectionConfig4[];
|
|
75
|
+
}) => CollectionConfig4[]) | CollectionConfig4[];
|
|
76
|
+
globals: ((args: {
|
|
77
|
+
defaultGlobals: GlobalConfig3[];
|
|
78
|
+
}) => GlobalConfig3[]) | GlobalConfig3[];
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Build the lib's data-config API surface, configured for a specific host.
|
|
82
|
+
*
|
|
83
|
+
* Hosts call this once with their `locales` and `blocks`; the returned
|
|
84
|
+
* object is **safe to import from a Node entrypoint** such as
|
|
85
|
+
* `payload.config.ts` — it only contains Payload collection / global
|
|
86
|
+
* factories and the `withWWWConfig` composer.
|
|
87
|
+
*
|
|
88
|
+
* The lib applies three plugins by default: `seoPlugin` (Pages + meta tab),
|
|
89
|
+
* `imageHashPlugin` (Blurhash/Thumbhash on uploads), and `translator`
|
|
90
|
+
* (auto-translation workflow). Use the `defaultPlugins` callback to
|
|
91
|
+
* drop or extend the list.
|
|
92
|
+
*
|
|
93
|
+
* For the App Router rendering side, import from the lib's render
|
|
94
|
+
* subpaths:
|
|
95
|
+
*
|
|
96
|
+
* import { createCollectionPageExports } from '@justanarthur/payload-www/render-pages'
|
|
97
|
+
* import { createPreviewHandler, createSitemapFile } from '@justanarthur/payload-www/render-utils'
|
|
98
|
+
*/
|
|
99
|
+
declare function createWWWConfig(options: WWWConfigOptions): WWWConfigApi;
|
|
100
|
+
export { createWWWConfig as default, createWWWConfig, WWWInputConfig, WWWConfigOptions, WWWConfigApi };
|