@nexpress/core 0.1.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/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/audit-54XLVCWD.js +14 -0
- package/dist/audit-54XLVCWD.js.map +1 -0
- package/dist/auth.d.ts +640 -0
- package/dist/auth.js +94 -0
- package/dist/auth.js.map +1 -0
- package/dist/can-YLUHRJAB.js +19 -0
- package/dist/can-YLUHRJAB.js.map +1 -0
- package/dist/chunk-2G264RCD.js +68 -0
- package/dist/chunk-2G264RCD.js.map +1 -0
- package/dist/chunk-2YDGE7YX.js +92 -0
- package/dist/chunk-2YDGE7YX.js.map +1 -0
- package/dist/chunk-473S4TER.js +538 -0
- package/dist/chunk-473S4TER.js.map +1 -0
- package/dist/chunk-4ZLMEKFX.js +18 -0
- package/dist/chunk-4ZLMEKFX.js.map +1 -0
- package/dist/chunk-55FU6WED.js +179 -0
- package/dist/chunk-55FU6WED.js.map +1 -0
- package/dist/chunk-6YI5K2TI.js +1959 -0
- package/dist/chunk-6YI5K2TI.js.map +1 -0
- package/dist/chunk-BHK3AD3Q.js +41 -0
- package/dist/chunk-BHK3AD3Q.js.map +1 -0
- package/dist/chunk-CRUQBZUF.js +39 -0
- package/dist/chunk-CRUQBZUF.js.map +1 -0
- package/dist/chunk-CTSQ7BRI.js +175 -0
- package/dist/chunk-CTSQ7BRI.js.map +1 -0
- package/dist/chunk-DK2JBJH7.js +81 -0
- package/dist/chunk-DK2JBJH7.js.map +1 -0
- package/dist/chunk-DP2PREDU.js +597 -0
- package/dist/chunk-DP2PREDU.js.map +1 -0
- package/dist/chunk-EQ2Z3KMD.js +24 -0
- package/dist/chunk-EQ2Z3KMD.js.map +1 -0
- package/dist/chunk-FZ7O6DWI.js +305 -0
- package/dist/chunk-FZ7O6DWI.js.map +1 -0
- package/dist/chunk-ISLYFQWL.js +1270 -0
- package/dist/chunk-ISLYFQWL.js.map +1 -0
- package/dist/chunk-JJL74ZPK.js +68 -0
- package/dist/chunk-JJL74ZPK.js.map +1 -0
- package/dist/chunk-JKXAPSU4.js +24 -0
- package/dist/chunk-JKXAPSU4.js.map +1 -0
- package/dist/chunk-KU5M27ZC.js +24 -0
- package/dist/chunk-KU5M27ZC.js.map +1 -0
- package/dist/chunk-LSHHRDVR.js +34 -0
- package/dist/chunk-LSHHRDVR.js.map +1 -0
- package/dist/chunk-M43PGOQY.js +715 -0
- package/dist/chunk-M43PGOQY.js.map +1 -0
- package/dist/chunk-MEJAHXIO.js +150 -0
- package/dist/chunk-MEJAHXIO.js.map +1 -0
- package/dist/chunk-NUCGHWCF.js +101 -0
- package/dist/chunk-NUCGHWCF.js.map +1 -0
- package/dist/chunk-OK5HOCQI.js +845 -0
- package/dist/chunk-OK5HOCQI.js.map +1 -0
- package/dist/chunk-OROPGO65.js +13 -0
- package/dist/chunk-OROPGO65.js.map +1 -0
- package/dist/chunk-PPAS4SZR.js +176 -0
- package/dist/chunk-PPAS4SZR.js.map +1 -0
- package/dist/chunk-PPBWRKO2.js +171 -0
- package/dist/chunk-PPBWRKO2.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-QO7LAQZH.js +321 -0
- package/dist/chunk-QO7LAQZH.js.map +1 -0
- package/dist/chunk-QVJ2HCAX.js +225 -0
- package/dist/chunk-QVJ2HCAX.js.map +1 -0
- package/dist/chunk-RIPHIRPP.js +68 -0
- package/dist/chunk-RIPHIRPP.js.map +1 -0
- package/dist/chunk-S27S42QY.js +134 -0
- package/dist/chunk-S27S42QY.js.map +1 -0
- package/dist/chunk-SBCVAC2Z.js +40 -0
- package/dist/chunk-SBCVAC2Z.js.map +1 -0
- package/dist/chunk-TFJ4MKPH.js +694 -0
- package/dist/chunk-TFJ4MKPH.js.map +1 -0
- package/dist/chunk-THX3SHYA.js +75 -0
- package/dist/chunk-THX3SHYA.js.map +1 -0
- package/dist/chunk-UGQSQO5B.js +222 -0
- package/dist/chunk-UGQSQO5B.js.map +1 -0
- package/dist/chunk-V2UNHGAP.js +26 -0
- package/dist/chunk-V2UNHGAP.js.map +1 -0
- package/dist/chunk-VGTPQXNQ.js +2790 -0
- package/dist/chunk-VGTPQXNQ.js.map +1 -0
- package/dist/chunk-VNIHXQ7W.js +194 -0
- package/dist/chunk-VNIHXQ7W.js.map +1 -0
- package/dist/chunk-WV272MPW.js +31 -0
- package/dist/chunk-WV272MPW.js.map +1 -0
- package/dist/chunk-X5KKBOUS.js +26 -0
- package/dist/chunk-X5KKBOUS.js.map +1 -0
- package/dist/chunk-XANPEOJC.js +17 -0
- package/dist/chunk-XANPEOJC.js.map +1 -0
- package/dist/chunk-XPVQIHAQ.js +83 -0
- package/dist/chunk-XPVQIHAQ.js.map +1 -0
- package/dist/chunk-ZCINJSS4.js +75 -0
- package/dist/chunk-ZCINJSS4.js.map +1 -0
- package/dist/community.d.ts +1425 -0
- package/dist/community.js +206 -0
- package/dist/community.js.map +1 -0
- package/dist/config-2GDU7PCK.js +32 -0
- package/dist/config-2GDU7PCK.js.map +1 -0
- package/dist/context-MNZ4QXPC.js +16 -0
- package/dist/context-MNZ4QXPC.js.map +1 -0
- package/dist/db-schema.d.ts +4 -0
- package/dist/db-schema.js +102 -0
- package/dist/db-schema.js.map +1 -0
- package/dist/db.d.ts +7 -0
- package/dist/db.js +117 -0
- package/dist/db.js.map +1 -0
- package/dist/digest-SY42GQSU.js +17 -0
- package/dist/digest-SY42GQSU.js.map +1 -0
- package/dist/errors-5OS3S2J3.js +22 -0
- package/dist/errors-5OS3S2J3.js.map +1 -0
- package/dist/host-OBOI4MJK.js +51 -0
- package/dist/host-OBOI4MJK.js.map +1 -0
- package/dist/i18n.d.ts +301 -0
- package/dist/i18n.js +68 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index-B6-_vr_m.d.ts +590 -0
- package/dist/index-CY55LC0u.d.ts +4722 -0
- package/dist/index-CeiTvwbp.d.ts +168 -0
- package/dist/index-XwP1ET8b.d.ts +61 -0
- package/dist/index.d.ts +2037 -0
- package/dist/index.js +2205 -0
- package/dist/index.js.map +1 -0
- package/dist/job-log-VZXWQUDK.js +24 -0
- package/dist/job-log-VZXWQUDK.js.map +1 -0
- package/dist/jobs.d.ts +4 -0
- package/dist/jobs.js +76 -0
- package/dist/jobs.js.map +1 -0
- package/dist/logger-DqGaOU_j.d.ts +29 -0
- package/dist/logger-S7REWDNE.js +16 -0
- package/dist/logger-S7REWDNE.js.map +1 -0
- package/dist/media.d.ts +5 -0
- package/dist/media.js +41 -0
- package/dist/media.js.map +1 -0
- package/dist/mentions-2IHFVSHW.js +23 -0
- package/dist/mentions-2IHFVSHW.js.map +1 -0
- package/dist/mutes-EWAE5FZR.js +21 -0
- package/dist/mutes-EWAE5FZR.js.map +1 -0
- package/dist/notification-prefs-VPJDU7I6.js +21 -0
- package/dist/notification-prefs-VPJDU7I6.js.map +1 -0
- package/dist/observability.d.ts +156 -0
- package/dist/observability.js +32 -0
- package/dist/observability.js.map +1 -0
- package/dist/profanity-adapter-NU2JQSLX.js +12 -0
- package/dist/profanity-adapter-NU2JQSLX.js.map +1 -0
- package/dist/queue-XE5BC75T.js +14 -0
- package/dist/queue-XE5BC75T.js.map +1 -0
- package/dist/rate-limit.d.ts +99 -0
- package/dist/rate-limit.js +14 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/registry-XIXDEPVI.js +31 -0
- package/dist/registry-XIXDEPVI.js.map +1 -0
- package/dist/reputation-JRL2YQHM.js +11 -0
- package/dist/reputation-JRL2YQHM.js.map +1 -0
- package/dist/routes.d.ts +43 -0
- package/dist/routes.js +12 -0
- package/dist/routes.js.map +1 -0
- package/dist/scheduled-CIQM57HT.js +20 -0
- package/dist/scheduled-CIQM57HT.js.map +1 -0
- package/dist/seo.d.ts +410 -0
- package/dist/seo.js +44 -0
- package/dist/seo.js.map +1 -0
- package/dist/settings-FOBIESPB.js +17 -0
- package/dist/settings-FOBIESPB.js.map +1 -0
- package/dist/spam-adapter-XX3G737Z.js +12 -0
- package/dist/spam-adapter-XX3G737Z.js.map +1 -0
- package/dist/strings-VAE47B2C.js +29 -0
- package/dist/strings-VAE47B2C.js.map +1 -0
- package/dist/templates-IFVJMCJ6.js +12 -0
- package/dist/templates-IFVJMCJ6.js.map +1 -0
- package/dist/types-TlsbXS0T.d.ts +871 -0
- package/package.json +129 -0
package/dist/seo.d.ts
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 10.1 — sitemap entry shape. Mirrors the sitemap.org spec
|
|
3
|
+
* fields the framework cares about. Apps format these into XML
|
|
4
|
+
* (the reference app does that in `apps/web/src/app/sitemap.xml/
|
|
5
|
+
* route.ts`); the core helper stays format-agnostic so a future
|
|
6
|
+
* news-sitemap or video-sitemap variant can reuse the same
|
|
7
|
+
* collection walk.
|
|
8
|
+
*/
|
|
9
|
+
interface NpSitemapEntry {
|
|
10
|
+
/** Path-only — host is prepended by the consumer. Always starts with `/`. */
|
|
11
|
+
loc: string;
|
|
12
|
+
/** ISO timestamp for `<lastmod>`. Falls back to `updatedAt` then `createdAt`. */
|
|
13
|
+
lastmod?: string;
|
|
14
|
+
changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
|
|
15
|
+
priority?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Phase 12.2 — hreflang alternates for translated content.
|
|
18
|
+
* The renderer emits an `<xhtml:link rel="alternate" hreflang="..." href="..."/>`
|
|
19
|
+
* entry per alternate, and the urlset gets the xhtml namespace
|
|
20
|
+
* declaration when any entry uses alternates.
|
|
21
|
+
*/
|
|
22
|
+
alternates?: Array<{
|
|
23
|
+
hreflang: string;
|
|
24
|
+
href: string;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
interface BuildSitemapOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Cap per-collection at this many rows so a 100K-document blog
|
|
30
|
+
* doesn't bring the sitemap.xml endpoint to its knees. Default
|
|
31
|
+
* 5000 is the sitemaps.org recommended max per file. Sites with
|
|
32
|
+
* more rows than that per locale should pair this with the
|
|
33
|
+
* sitemap-index split (see `locale` below) so each child file
|
|
34
|
+
* stays under the cap.
|
|
35
|
+
*/
|
|
36
|
+
perCollectionLimit?: number;
|
|
37
|
+
/** Restrict to specific collection slugs (default: all). */
|
|
38
|
+
collections?: string[];
|
|
39
|
+
/**
|
|
40
|
+
* Restrict to a single locale. When set:
|
|
41
|
+
* - i18n collections filter rows to `locale = $locale` (so
|
|
42
|
+
* each per-locale sitemap only enumerates its own URLs).
|
|
43
|
+
* - non-i18n collections are emitted only for the configured
|
|
44
|
+
* `defaultLocale`; other locales' sitemaps skip them so
|
|
45
|
+
* a row never appears in two sibling sitemaps.
|
|
46
|
+
* Leaving this `undefined` keeps the unfiltered single-file
|
|
47
|
+
* behavior used when i18n is not configured.
|
|
48
|
+
*/
|
|
49
|
+
locale?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Sitemap-index entry — a pointer to a child `<urlset>` document
|
|
53
|
+
* (typically a per-locale sitemap). The `loc` is path-only; the
|
|
54
|
+
* renderer prepends the absolute origin.
|
|
55
|
+
*/
|
|
56
|
+
interface NpSitemapIndexEntry {
|
|
57
|
+
loc: string;
|
|
58
|
+
/** Optional ISO timestamp for `<lastmod>` on the child sitemap. */
|
|
59
|
+
lastmod?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Walks every registered collection that opts into the sitemap
|
|
63
|
+
* via `seo.urlPath`, queries published documents, and emits a
|
|
64
|
+
* flat list of `NpSitemapEntry` rows. Anonymous read access is
|
|
65
|
+
* required — `findDocuments(slug, opts, undefined)` runs the
|
|
66
|
+
* collection's `access.read` callback with no user. Collections
|
|
67
|
+
* that gate reads (admin-only, member-only) won't surface in the
|
|
68
|
+
* sitemap, which is the right default.
|
|
69
|
+
*
|
|
70
|
+
* The function intentionally doesn't include the site root `/`
|
|
71
|
+
* by itself — sites add a fixed entry for the home page (and any
|
|
72
|
+
* other static routes like /search, /discussions) on top of the
|
|
73
|
+
* collection walk.
|
|
74
|
+
*/
|
|
75
|
+
declare function buildSitemap(options?: BuildSitemapOptions): Promise<NpSitemapEntry[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Renders an `NpSitemapEntry[]` plus the absolute host into an
|
|
78
|
+
* XML body suitable for `Content-Type: application/xml`. The
|
|
79
|
+
* loc path is URL-joined with the host without double-slashes;
|
|
80
|
+
* the host should NOT have a trailing slash. The output is
|
|
81
|
+
* sitemap.org 0.9 compliant.
|
|
82
|
+
*/
|
|
83
|
+
declare function renderSitemapXml(origin: string, entries: NpSitemapEntry[]): string;
|
|
84
|
+
/**
|
|
85
|
+
* Phase 12.9 — render a sitemap-index document. Sites with i18n
|
|
86
|
+
* configured emit one of these at `/sitemap.xml` instead of a
|
|
87
|
+
* single `<urlset>`; each child sitemap holds the URLs for one
|
|
88
|
+
* locale so the per-file 50K-entry sitemaps.org cap is per-locale
|
|
89
|
+
* rather than shared across the whole site.
|
|
90
|
+
*
|
|
91
|
+
* The index itself is small (one `<sitemap>` per locale) so it
|
|
92
|
+
* doesn't need the `xhtml` namespace or alternates — those live
|
|
93
|
+
* inside the child `<urlset>` documents.
|
|
94
|
+
*/
|
|
95
|
+
declare function renderSitemapIndexXml(origin: string, entries: NpSitemapIndexEntry[]): string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Phase 10.3 — site-wide SEO defaults read from `np_settings`.
|
|
99
|
+
* Reads three existing keys + a new `seo` key:
|
|
100
|
+
*
|
|
101
|
+
* - `site` → { name, url } (existing General settings)
|
|
102
|
+
* - `description` → string (existing General settings)
|
|
103
|
+
* - `seo` → { defaultOgImage, twitterHandle, defaultLocale }
|
|
104
|
+
*
|
|
105
|
+
* The shape is a flat merge so callers don't have to hop across
|
|
106
|
+
* keys to pre-fill metadata.
|
|
107
|
+
*/
|
|
108
|
+
interface NpSiteSeoSettings {
|
|
109
|
+
/** Site name shown in the title bar suffix and `og:site_name`. */
|
|
110
|
+
siteName: string;
|
|
111
|
+
/** Absolute origin used as the base for canonical URLs. */
|
|
112
|
+
siteUrl: string;
|
|
113
|
+
/** Default `<meta name="description">` when a page doesn't set its own. */
|
|
114
|
+
defaultDescription: string;
|
|
115
|
+
/**
|
|
116
|
+
* Default Open Graph image. Either an absolute URL or a path
|
|
117
|
+
* starting with `/` (which gets joined to `siteUrl`). `null` =
|
|
118
|
+
* no default; pages that don't set an image won't render an
|
|
119
|
+
* `og:image` tag.
|
|
120
|
+
*/
|
|
121
|
+
defaultOgImage: string | null;
|
|
122
|
+
/** Twitter `@handle` (no leading `@`) for `twitter:site`. `null` = omit. */
|
|
123
|
+
twitterHandle: string | null;
|
|
124
|
+
/** BCP 47 locale tag for `og:locale`. Default `"en_US"`. */
|
|
125
|
+
defaultLocale: string;
|
|
126
|
+
}
|
|
127
|
+
declare const DEFAULT_SITE_SEO_SETTINGS: NpSiteSeoSettings;
|
|
128
|
+
/**
|
|
129
|
+
* Reads the three settings keys that contribute to site-wide
|
|
130
|
+
* SEO and merges into a single flat object. Missing fields fall
|
|
131
|
+
* back to `DEFAULT_SITE_SEO_SETTINGS`. Read-only access — no
|
|
132
|
+
* permission gate; the values are surfaced in public HTML
|
|
133
|
+
* `<head>` tags.
|
|
134
|
+
*/
|
|
135
|
+
declare function getSiteSeoSettings(): Promise<NpSiteSeoSettings>;
|
|
136
|
+
/**
|
|
137
|
+
* Caller-provided metadata for a single page. All fields are
|
|
138
|
+
* optional — anything missing falls back to the site-wide
|
|
139
|
+
* defaults from `getSiteSeoSettings()`.
|
|
140
|
+
*/
|
|
141
|
+
interface NpPageMetadataInput {
|
|
142
|
+
/** Page title (without site-name suffix; that's appended below). */
|
|
143
|
+
title?: string | null;
|
|
144
|
+
/** Page-specific description. Falls back to site default. */
|
|
145
|
+
description?: string | null;
|
|
146
|
+
/**
|
|
147
|
+
* Image URL for og:image / twitter:image. Either absolute or
|
|
148
|
+
* a path starting with `/` (joined to siteUrl). Falls back to
|
|
149
|
+
* `defaultOgImage`.
|
|
150
|
+
*/
|
|
151
|
+
ogImage?: string | null;
|
|
152
|
+
/**
|
|
153
|
+
* Path of the current page (no origin). Used to build the
|
|
154
|
+
* canonical URL. Pass without query / hash; trailing `/` is
|
|
155
|
+
* normalized off.
|
|
156
|
+
*/
|
|
157
|
+
path?: string;
|
|
158
|
+
/** OpenGraph type. Default `"website"`; posts use `"article"`. */
|
|
159
|
+
ogType?: "website" | "article" | "profile";
|
|
160
|
+
/**
|
|
161
|
+
* Article-specific dates (only honored when `ogType === "article"`).
|
|
162
|
+
* Pass `Date` instances — the helper formats to ISO 8601.
|
|
163
|
+
*/
|
|
164
|
+
publishedTime?: Date | null;
|
|
165
|
+
modifiedTime?: Date | null;
|
|
166
|
+
/**
|
|
167
|
+
* Phase 12.2 — locale for the rendered page. Surfaces into
|
|
168
|
+
* `og:locale` so social cards label the language correctly.
|
|
169
|
+
* Optional; sites without i18n leave it unset and the helper
|
|
170
|
+
* omits `og:locale` from the output.
|
|
171
|
+
*/
|
|
172
|
+
locale?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Next.js Metadata shape — kept structurally typed here to avoid
|
|
176
|
+
* a hard dependency on the framework from core. The reference app
|
|
177
|
+
* casts the return to Next's `Metadata` (the field names match).
|
|
178
|
+
*/
|
|
179
|
+
interface NpPageMetadata {
|
|
180
|
+
title: string;
|
|
181
|
+
description: string;
|
|
182
|
+
alternates?: {
|
|
183
|
+
canonical: string;
|
|
184
|
+
};
|
|
185
|
+
openGraph?: {
|
|
186
|
+
title: string;
|
|
187
|
+
description: string;
|
|
188
|
+
siteName: string;
|
|
189
|
+
url: string;
|
|
190
|
+
type: "website" | "article" | "profile";
|
|
191
|
+
images?: Array<{
|
|
192
|
+
url: string;
|
|
193
|
+
}>;
|
|
194
|
+
locale?: string;
|
|
195
|
+
publishedTime?: string;
|
|
196
|
+
modifiedTime?: string;
|
|
197
|
+
};
|
|
198
|
+
twitter?: {
|
|
199
|
+
card: "summary" | "summary_large_image";
|
|
200
|
+
title: string;
|
|
201
|
+
description: string;
|
|
202
|
+
site?: string;
|
|
203
|
+
images?: string[];
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Combines the page-level input with site-wide SEO defaults to
|
|
208
|
+
* produce a fully-resolved metadata object suitable for
|
|
209
|
+
* Next.js' `generateMetadata`. Title, description, and image
|
|
210
|
+
* fall back through to defaults; the OG and Twitter blocks are
|
|
211
|
+
* mirrored so both crawler families see consistent values.
|
|
212
|
+
*/
|
|
213
|
+
declare function buildPageMetadata(input?: NpPageMetadataInput): Promise<NpPageMetadata>;
|
|
214
|
+
/**
|
|
215
|
+
* Validates a partial patch against the `seo` settings shape.
|
|
216
|
+
* Throws when fields are mistyped; returns the merged settings
|
|
217
|
+
* the admin endpoint should persist. Mirrors
|
|
218
|
+
* `validateCommunitySettingsPatch` in the community module.
|
|
219
|
+
*/
|
|
220
|
+
interface NpSeoSettingsPatch {
|
|
221
|
+
defaultOgImage?: string | null;
|
|
222
|
+
twitterHandle?: string | null;
|
|
223
|
+
defaultLocale?: string | null;
|
|
224
|
+
}
|
|
225
|
+
declare function validateSeoSettingsPatch(patch: unknown): NpSeoSettingsPatch;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Phase 10.4 — Atom feed builder. Atom (RFC 4287) over RSS 2.0
|
|
229
|
+
* because Atom has tighter spec compliance, mandatory unique
|
|
230
|
+
* IDs, and timezone-correct timestamps that RSS 2.0 leaves
|
|
231
|
+
* underspecified. Most modern readers consume both, but new
|
|
232
|
+
* surfaces should write Atom.
|
|
233
|
+
*
|
|
234
|
+
* Sites declare which collections expose a feed by giving them
|
|
235
|
+
* `seo.urlPath` (already required for the sitemap, 10.1). The
|
|
236
|
+
* feed reuses the same anonymous-read query path so non-public
|
|
237
|
+
* rows never leak — same trust model as `/sitemap.xml`.
|
|
238
|
+
*/
|
|
239
|
+
interface NpFeedEntry {
|
|
240
|
+
/** Stable id (we use the absolute canonical URL). */
|
|
241
|
+
id: string;
|
|
242
|
+
title: string;
|
|
243
|
+
/** Short summary; HTML escaped on the way out. */
|
|
244
|
+
summary: string | null;
|
|
245
|
+
link: string;
|
|
246
|
+
/** Author display name; null when unavailable (e.g. anonymous post). */
|
|
247
|
+
author: string | null;
|
|
248
|
+
/** ISO 8601. The Atom `<updated>` element. */
|
|
249
|
+
updated: string;
|
|
250
|
+
/** ISO 8601. Optional — emitted as `<published>`. */
|
|
251
|
+
published: string | null;
|
|
252
|
+
}
|
|
253
|
+
interface BuildAtomFeedOptions {
|
|
254
|
+
collection?: string;
|
|
255
|
+
/** Cap entries per feed. Default 50 — most readers ignore beyond that. */
|
|
256
|
+
limit?: number;
|
|
257
|
+
/**
|
|
258
|
+
* Phase 12.4 — restrict an i18n collection's feed to one
|
|
259
|
+
* locale. Ignored on non-i18n collections. The Atom feed's
|
|
260
|
+
* top-level `<title>` / `<subtitle>` aren't translated by
|
|
261
|
+
* the framework — sites that want fully translated feeds
|
|
262
|
+
* pass their own language-specific siteName / description
|
|
263
|
+
* via custom site settings hooks.
|
|
264
|
+
*/
|
|
265
|
+
locale?: string;
|
|
266
|
+
/**
|
|
267
|
+
* Phase F.7 — extra entries to merge into the feed alongside
|
|
268
|
+
* the collection walk. Supplied by the active theme's
|
|
269
|
+
* `impl.seo.feedEntries` hook through the route handler.
|
|
270
|
+
* Deduplicated against the collection-walk output by `id`
|
|
271
|
+
* (collection-walk wins on collision); the final list is
|
|
272
|
+
* sorted by `updated` desc and capped by `limit`.
|
|
273
|
+
*/
|
|
274
|
+
extraEntries?: NpFeedEntry[];
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Walks a single collection's published documents and returns a
|
|
278
|
+
* flat list of feed entries. Skips collections that don't
|
|
279
|
+
* declare `seo.urlPath` (the same opt-in the sitemap uses).
|
|
280
|
+
* Anonymous read access required — `findDocuments` runs the
|
|
281
|
+
* collection's `access.read` callback with no user.
|
|
282
|
+
*/
|
|
283
|
+
declare function buildAtomFeed(options?: BuildAtomFeedOptions): Promise<{
|
|
284
|
+
entries: NpFeedEntry[];
|
|
285
|
+
collection: string;
|
|
286
|
+
} | null>;
|
|
287
|
+
/**
|
|
288
|
+
* Renders the Atom 1.0 XML body. Doesn't depend on any specific
|
|
289
|
+
* runtime so it's safe to call from a route handler, a static
|
|
290
|
+
* builder, or a CLI exporter.
|
|
291
|
+
*/
|
|
292
|
+
declare function renderAtomFeed(options?: BuildAtomFeedOptions): Promise<string | null>;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Phase 10.5 — JSON-LD structured data builders. Schema.org
|
|
296
|
+
* vocabulary, embedded into pages as
|
|
297
|
+
* `<script type="application/ld+json">{ ... }</script>`. The
|
|
298
|
+
* builders here produce plain objects; pages render them via
|
|
299
|
+
* the helper component the reference app declares
|
|
300
|
+
* (`@/components/json-ld`). Keeping the builders structural
|
|
301
|
+
* (no React dependency) lets non-Next consumers — static
|
|
302
|
+
* exporters, mobile bridges, plugin tests — emit the same
|
|
303
|
+
* shapes.
|
|
304
|
+
*
|
|
305
|
+
* Why JSON-LD over Microdata / RDFa: Google explicitly
|
|
306
|
+
* recommends JSON-LD as the preferred format for structured
|
|
307
|
+
* data, and it composes cleanly because it doesn't require
|
|
308
|
+
* splicing schema attributes into the page markup.
|
|
309
|
+
*/
|
|
310
|
+
declare const SCHEMA = "https://schema.org";
|
|
311
|
+
interface BuildJsonLdContext {
|
|
312
|
+
/** Origin without trailing slash. Falls back to settings if omitted. */
|
|
313
|
+
origin?: string;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* `WebSite` + `SearchAction` for the site root. Tells search
|
|
317
|
+
* engines the canonical site name and lets Google render a
|
|
318
|
+
* sitelinks searchbox in result pages — when the user types
|
|
319
|
+
* into it, the engine routes them straight to /search?q=… on
|
|
320
|
+
* the site instead of returning more SERP results.
|
|
321
|
+
*/
|
|
322
|
+
interface WebSiteJsonLd {
|
|
323
|
+
"@context": typeof SCHEMA;
|
|
324
|
+
"@type": "WebSite";
|
|
325
|
+
name: string;
|
|
326
|
+
url: string;
|
|
327
|
+
potentialAction?: {
|
|
328
|
+
"@type": "SearchAction";
|
|
329
|
+
target: {
|
|
330
|
+
"@type": "EntryPoint";
|
|
331
|
+
urlTemplate: string;
|
|
332
|
+
};
|
|
333
|
+
"query-input": string;
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
declare function buildWebSiteJsonLd(ctx?: BuildJsonLdContext): Promise<WebSiteJsonLd>;
|
|
337
|
+
/**
|
|
338
|
+
* `BlogPosting` (a subtype of Article) for blog posts. Keeps
|
|
339
|
+
* the structural fields a search engine cares about — headline,
|
|
340
|
+
* dates, author, image, description — without trying to encode
|
|
341
|
+
* the body content.
|
|
342
|
+
*/
|
|
343
|
+
interface ArticleJsonLdInput {
|
|
344
|
+
/** Canonical URL of the article. */
|
|
345
|
+
url: string;
|
|
346
|
+
headline: string;
|
|
347
|
+
description?: string | null;
|
|
348
|
+
/** Absolute URL or `/`-rooted path. Resolved against `origin`. */
|
|
349
|
+
image?: string | null;
|
|
350
|
+
datePublished?: Date | string | null;
|
|
351
|
+
dateModified?: Date | string | null;
|
|
352
|
+
authorName?: string | null;
|
|
353
|
+
/** Schema.org type. Defaults to `BlogPosting`; forum threads use
|
|
354
|
+
* `DiscussionForumPosting` via `buildDiscussionForumPostingJsonLd`. */
|
|
355
|
+
type?: "BlogPosting" | "Article";
|
|
356
|
+
}
|
|
357
|
+
interface ArticleJsonLd {
|
|
358
|
+
"@context": typeof SCHEMA;
|
|
359
|
+
"@type": "BlogPosting" | "Article";
|
|
360
|
+
headline: string;
|
|
361
|
+
url: string;
|
|
362
|
+
description?: string;
|
|
363
|
+
image?: string;
|
|
364
|
+
datePublished?: string;
|
|
365
|
+
dateModified?: string;
|
|
366
|
+
author?: {
|
|
367
|
+
"@type": "Person";
|
|
368
|
+
name: string;
|
|
369
|
+
};
|
|
370
|
+
publisher: {
|
|
371
|
+
"@type": "Organization";
|
|
372
|
+
name: string;
|
|
373
|
+
url: string;
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
declare function buildArticleJsonLd(input: ArticleJsonLdInput, ctx?: BuildJsonLdContext): Promise<ArticleJsonLd>;
|
|
377
|
+
/**
|
|
378
|
+
* `DiscussionForumPosting` for member-authored forum threads.
|
|
379
|
+
* Same skeleton as `Article` but the type tells search engines
|
|
380
|
+
* (and surfaces like Google's "Forums" filter) that this is
|
|
381
|
+
* community discussion, not editorial content.
|
|
382
|
+
*/
|
|
383
|
+
interface DiscussionForumPostingJsonLd extends Omit<ArticleJsonLd, "@type"> {
|
|
384
|
+
"@type": "DiscussionForumPosting";
|
|
385
|
+
}
|
|
386
|
+
declare function buildDiscussionForumPostingJsonLd(input: ArticleJsonLdInput, ctx?: BuildJsonLdContext): Promise<DiscussionForumPostingJsonLd>;
|
|
387
|
+
/**
|
|
388
|
+
* `Person` for member / user profile pages. Keeps the public
|
|
389
|
+
* fields a search engine could legitimately surface — handle,
|
|
390
|
+
* display name, profile URL, avatar.
|
|
391
|
+
*/
|
|
392
|
+
interface PersonJsonLdInput {
|
|
393
|
+
url: string;
|
|
394
|
+
name: string;
|
|
395
|
+
alternateName?: string | null;
|
|
396
|
+
image?: string | null;
|
|
397
|
+
description?: string | null;
|
|
398
|
+
}
|
|
399
|
+
interface PersonJsonLd {
|
|
400
|
+
"@context": typeof SCHEMA;
|
|
401
|
+
"@type": "Person";
|
|
402
|
+
name: string;
|
|
403
|
+
url: string;
|
|
404
|
+
alternateName?: string;
|
|
405
|
+
image?: string;
|
|
406
|
+
description?: string;
|
|
407
|
+
}
|
|
408
|
+
declare function buildPersonJsonLd(input: PersonJsonLdInput, ctx?: BuildJsonLdContext): Promise<PersonJsonLd>;
|
|
409
|
+
|
|
410
|
+
export { type ArticleJsonLd, type ArticleJsonLdInput, type BuildAtomFeedOptions, type BuildJsonLdContext, type BuildSitemapOptions, DEFAULT_SITE_SEO_SETTINGS, type DiscussionForumPostingJsonLd, type NpFeedEntry, type NpPageMetadata, type NpPageMetadataInput, type NpSeoSettingsPatch, type NpSiteSeoSettings, type NpSitemapEntry, type NpSitemapIndexEntry, type PersonJsonLd, type PersonJsonLdInput, type WebSiteJsonLd, buildArticleJsonLd, buildAtomFeed, buildDiscussionForumPostingJsonLd, buildPageMetadata, buildPersonJsonLd, buildSitemap, buildWebSiteJsonLd, getSiteSeoSettings, renderAtomFeed, renderSitemapIndexXml, renderSitemapXml, validateSeoSettingsPatch };
|
package/dist/seo.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_SITE_SEO_SETTINGS,
|
|
3
|
+
buildArticleJsonLd,
|
|
4
|
+
buildAtomFeed,
|
|
5
|
+
buildDiscussionForumPostingJsonLd,
|
|
6
|
+
buildPageMetadata,
|
|
7
|
+
buildPersonJsonLd,
|
|
8
|
+
buildSitemap,
|
|
9
|
+
buildWebSiteJsonLd,
|
|
10
|
+
getSiteSeoSettings,
|
|
11
|
+
renderAtomFeed,
|
|
12
|
+
renderSitemapIndexXml,
|
|
13
|
+
renderSitemapXml,
|
|
14
|
+
validateSeoSettingsPatch
|
|
15
|
+
} from "./chunk-DP2PREDU.js";
|
|
16
|
+
import "./chunk-VGTPQXNQ.js";
|
|
17
|
+
import "./chunk-4ZLMEKFX.js";
|
|
18
|
+
import "./chunk-FZ7O6DWI.js";
|
|
19
|
+
import "./chunk-SBCVAC2Z.js";
|
|
20
|
+
import "./chunk-ZCINJSS4.js";
|
|
21
|
+
import "./chunk-WV272MPW.js";
|
|
22
|
+
import "./chunk-473S4TER.js";
|
|
23
|
+
import "./chunk-V2UNHGAP.js";
|
|
24
|
+
import "./chunk-OROPGO65.js";
|
|
25
|
+
import "./chunk-JJL74ZPK.js";
|
|
26
|
+
import "./chunk-XANPEOJC.js";
|
|
27
|
+
import "./chunk-M43PGOQY.js";
|
|
28
|
+
import "./chunk-PZ5AY32C.js";
|
|
29
|
+
export {
|
|
30
|
+
DEFAULT_SITE_SEO_SETTINGS,
|
|
31
|
+
buildArticleJsonLd,
|
|
32
|
+
buildAtomFeed,
|
|
33
|
+
buildDiscussionForumPostingJsonLd,
|
|
34
|
+
buildPageMetadata,
|
|
35
|
+
buildPersonJsonLd,
|
|
36
|
+
buildSitemap,
|
|
37
|
+
buildWebSiteJsonLd,
|
|
38
|
+
getSiteSeoSettings,
|
|
39
|
+
renderAtomFeed,
|
|
40
|
+
renderSitemapIndexXml,
|
|
41
|
+
renderSitemapXml,
|
|
42
|
+
validateSeoSettingsPatch
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=seo.js.map
|
package/dist/seo.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_COMMUNITY_SETTINGS,
|
|
3
|
+
getCommunitySettings,
|
|
4
|
+
updateCommunitySettings,
|
|
5
|
+
validateCommunitySettingsPatch
|
|
6
|
+
} from "./chunk-PPBWRKO2.js";
|
|
7
|
+
import "./chunk-ZCINJSS4.js";
|
|
8
|
+
import "./chunk-XANPEOJC.js";
|
|
9
|
+
import "./chunk-M43PGOQY.js";
|
|
10
|
+
import "./chunk-PZ5AY32C.js";
|
|
11
|
+
export {
|
|
12
|
+
DEFAULT_COMMUNITY_SETTINGS,
|
|
13
|
+
getCommunitySettings,
|
|
14
|
+
updateCommunitySettings,
|
|
15
|
+
validateCommunitySettingsPatch
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=settings-FOBIESPB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addStrings,
|
|
3
|
+
getAllStrings,
|
|
4
|
+
getStrings,
|
|
5
|
+
resetStrings,
|
|
6
|
+
resetTranslationCache,
|
|
7
|
+
setStrings,
|
|
8
|
+
t,
|
|
9
|
+
tSync
|
|
10
|
+
} from "./chunk-QVJ2HCAX.js";
|
|
11
|
+
import "./chunk-4ZLMEKFX.js";
|
|
12
|
+
import "./chunk-FZ7O6DWI.js";
|
|
13
|
+
import "./chunk-SBCVAC2Z.js";
|
|
14
|
+
import "./chunk-ZCINJSS4.js";
|
|
15
|
+
import "./chunk-JJL74ZPK.js";
|
|
16
|
+
import "./chunk-XANPEOJC.js";
|
|
17
|
+
import "./chunk-M43PGOQY.js";
|
|
18
|
+
import "./chunk-PZ5AY32C.js";
|
|
19
|
+
export {
|
|
20
|
+
addStrings,
|
|
21
|
+
getAllStrings,
|
|
22
|
+
getStrings,
|
|
23
|
+
resetStrings,
|
|
24
|
+
resetTranslationCache,
|
|
25
|
+
setStrings,
|
|
26
|
+
t,
|
|
27
|
+
tSync
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=strings-VAE47B2C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPluginTemplatesForCollection,
|
|
3
|
+
registerPluginTemplates,
|
|
4
|
+
resetPluginTemplates
|
|
5
|
+
} from "./chunk-CRUQBZUF.js";
|
|
6
|
+
import "./chunk-PZ5AY32C.js";
|
|
7
|
+
export {
|
|
8
|
+
getPluginTemplatesForCollection,
|
|
9
|
+
registerPluginTemplates,
|
|
10
|
+
resetPluginTemplates
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=templates-IFVJMCJ6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|