@donotdev/core 0.2.2 → 0.3.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/functions/index.js +13 -13
- package/i18n/locales/eager/dndev_ar.json +13 -0
- package/i18n/locales/eager/dndev_da.json +13 -0
- package/i18n/locales/eager/dndev_de.json +13 -0
- package/i18n/locales/eager/dndev_en.json +13 -0
- package/i18n/locales/eager/dndev_es.json +13 -0
- package/i18n/locales/eager/dndev_fr.json +13 -0
- package/i18n/locales/eager/dndev_it.json +13 -0
- package/i18n/locales/eager/dndev_ja.json +13 -0
- package/i18n/locales/eager/dndev_ko.json +13 -0
- package/i18n/locales/eager/dndev_nl.json +13 -0
- package/i18n/locales/eager/dndev_pl.json +645 -0
- package/i18n/locales/eager/dndev_pt.json +13 -0
- package/i18n/locales/eager/dndev_zh.json +13 -0
- package/i18n/locales/lazy/auth_ar.json +5 -2
- package/i18n/locales/lazy/auth_da.json +5 -2
- package/i18n/locales/lazy/auth_de.json +5 -2
- package/i18n/locales/lazy/auth_en.json +5 -2
- package/i18n/locales/lazy/auth_es.json +5 -2
- package/i18n/locales/lazy/auth_fr.json +5 -2
- package/i18n/locales/lazy/auth_it.json +5 -2
- package/i18n/locales/lazy/auth_ja.json +5 -2
- package/i18n/locales/lazy/auth_ko.json +5 -2
- package/i18n/locales/lazy/auth_nl.json +5 -2
- package/i18n/locales/lazy/auth_pl.json +195 -0
- package/i18n/locales/lazy/auth_pt.json +5 -2
- package/i18n/locales/lazy/auth_zh.json +5 -2
- package/i18n/locales/lazy/billing_pl.json +93 -0
- package/i18n/locales/lazy/blog_pl.json +9 -0
- package/i18n/locales/lazy/cookies_pl.json +35 -0
- package/i18n/locales/lazy/crud_ar.json +89 -3
- package/i18n/locales/lazy/crud_da.json +87 -4
- package/i18n/locales/lazy/crud_de.json +89 -3
- package/i18n/locales/lazy/crud_en.json +86 -4
- package/i18n/locales/lazy/crud_es.json +91 -4
- package/i18n/locales/lazy/crud_fr.json +90 -4
- package/i18n/locales/lazy/crud_it.json +91 -4
- package/i18n/locales/lazy/crud_ja.json +89 -3
- package/i18n/locales/lazy/crud_ko.json +89 -3
- package/i18n/locales/lazy/crud_nl.json +87 -4
- package/i18n/locales/lazy/crud_pl.json +632 -0
- package/i18n/locales/lazy/crud_pt.json +89 -5
- package/i18n/locales/lazy/crud_zh.json +87 -4
- package/i18n/locales/lazy/homeTemplate_pl.json +52 -0
- package/i18n/locales/lazy/legalNotice_de.json +55 -0
- package/i18n/locales/lazy/legalNotice_pl.json +55 -0
- package/i18n/locales/lazy/oauth_pl.json +11 -0
- package/i18n/locales/lazy/privacy_pl.json +178 -0
- package/i18n/locales/lazy/terms_pl.json +200 -0
- package/index.d.ts +5696 -2999
- package/index.js +6 -6
- package/next/index.d.ts +139 -4
- package/next/index.js +545 -163
- package/next/runtime.js +3 -0
- package/package.json +5 -3
- package/server.d.ts +5322 -2855
- package/server.js +1 -1
- package/symbol-index.json +1 -1
- package/vite/index.d.ts +10 -0
- package/vite/index.js +69 -68
package/next/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { ICrudAdapter, AnyEntity, EntitySeoRecord, EntitySeoOptions, EntitySeo, LanguageRouting, languageUrls } from '@donotdev/core/server';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Footer mode constants - DRY single source of truth
|
|
@@ -658,6 +659,16 @@ interface AppConfig {
|
|
|
658
659
|
* dynamically at request time.
|
|
659
660
|
*/
|
|
660
661
|
ssr?: boolean;
|
|
662
|
+
/**
|
|
663
|
+
* Cache lifetime of the cached (static) pages and of the sitemap / llms.txt routes
|
|
664
|
+
* (Next adapter), in seconds. **Defaults to `3600`**: data edited in an admin shows
|
|
665
|
+
* within the hour. `false` = generated once per build, kept until the next deploy
|
|
666
|
+
* (sites whose content only changes with a deploy). Any other value fails the build.
|
|
667
|
+
* Ignored by Vite (no server).
|
|
668
|
+
*
|
|
669
|
+
* @since 0.2.6
|
|
670
|
+
*/
|
|
671
|
+
revalidate?: number | false;
|
|
661
672
|
}
|
|
662
673
|
|
|
663
674
|
/**
|
|
@@ -886,7 +897,11 @@ interface NextConfigOptions {
|
|
|
886
897
|
generateAppPages?: boolean;
|
|
887
898
|
/** Routing mode for Next.js */
|
|
888
899
|
routingMode?: 'pages' | 'app';
|
|
889
|
-
/**
|
|
900
|
+
/**
|
|
901
|
+
* Generate `src/proxy.next.ts`: server-side redirects for pages whose PageMeta sets
|
|
902
|
+
* `auth`, when the auth session lives in cookies (Supabase `createBrowserClient`).
|
|
903
|
+
* @default true
|
|
904
|
+
*/
|
|
890
905
|
generateMiddleware?: boolean;
|
|
891
906
|
};
|
|
892
907
|
/** Internationalization configuration (uses DRY I18nOptions) */
|
|
@@ -963,7 +978,7 @@ interface NextMetadata {
|
|
|
963
978
|
*
|
|
964
979
|
* @example
|
|
965
980
|
* ```tsx
|
|
966
|
-
* // app/layout.tsx
|
|
981
|
+
* // app/layout.next.tsx
|
|
967
982
|
* import { getMetadataForPath } from '@donotdev/core/next';
|
|
968
983
|
*
|
|
969
984
|
* export async function generateMetadata() {
|
|
@@ -987,5 +1002,125 @@ declare function getMetadataForPath(
|
|
|
987
1002
|
*/
|
|
988
1003
|
declare function clearMetadataCache(): void;
|
|
989
1004
|
|
|
990
|
-
|
|
991
|
-
|
|
1005
|
+
|
|
1006
|
+
/** One public route, as written by the build into a generated SEO route. */
|
|
1007
|
+
interface PublicRoute {
|
|
1008
|
+
/** Route path in React Router syntax (`/produits/:slug`) */
|
|
1009
|
+
path: string;
|
|
1010
|
+
/** Collection whose published records fill the `:param` segment. Required for dynamic routes. */
|
|
1011
|
+
collection?: string;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
/** One public route of the sitemap. */
|
|
1015
|
+
interface SitemapRoute extends PublicRoute {
|
|
1016
|
+
/** Pre-computed lastmod (blog posts), ISO date */
|
|
1017
|
+
lastModified?: string;
|
|
1018
|
+
/** 0.0–1.0 */
|
|
1019
|
+
priority?: number;
|
|
1020
|
+
changeFrequency?: SitemapEntry['changeFrequency'];
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/** Sitemap entry. */
|
|
1024
|
+
interface SitemapEntry {
|
|
1025
|
+
url: string;
|
|
1026
|
+
lastModified?: string;
|
|
1027
|
+
changeFrequency?:
|
|
1028
|
+
| 'always'
|
|
1029
|
+
| 'hourly'
|
|
1030
|
+
| 'daily'
|
|
1031
|
+
| 'weekly'
|
|
1032
|
+
| 'monthly'
|
|
1033
|
+
| 'yearly'
|
|
1034
|
+
| 'never';
|
|
1035
|
+
priority?: number;
|
|
1036
|
+
/** URL of the same page in every language (2+ languages) */
|
|
1037
|
+
alternates?: { languages: Record<string, string> };
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/** What the generated sitemap route passes besides its routes. */
|
|
1041
|
+
interface SitemapContext {
|
|
1042
|
+
/** Absolute production URL, no trailing slash */
|
|
1043
|
+
baseUrl: string;
|
|
1044
|
+
/** App languages (one language: one URL per page, no alternates) */
|
|
1045
|
+
routing: LanguageRouting;
|
|
1046
|
+
/** Public (anonymous) CRUD reader; required when a route lists records (`collection`) */
|
|
1047
|
+
crud?: ICrudAdapter;
|
|
1048
|
+
/** `languageUrls` from @donotdev/core/server */
|
|
1049
|
+
languageUrls: typeof languageUrls;
|
|
1050
|
+
/** `HIDDEN_STATUSES` from @donotdev/core/server: records with these statuses are not listed */
|
|
1051
|
+
hiddenStatuses: readonly string[];
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Build the sitemap entries: static routes, plus one URL per published record of each
|
|
1056
|
+
* single-param route's collection; with 2+ languages once per language URL, with alternates.
|
|
1057
|
+
*
|
|
1058
|
+
* @throws When a dynamic route has no collection or several params, or the read fails
|
|
1059
|
+
*/
|
|
1060
|
+
declare function buildSitemap(
|
|
1061
|
+
routes: readonly SitemapRoute[],
|
|
1062
|
+
context: SitemapContext
|
|
1063
|
+
): Promise<SitemapEntry[]>;
|
|
1064
|
+
|
|
1065
|
+
/** Serialize sitemap entries to sitemap.xml (with hreflang alternates). */
|
|
1066
|
+
declare function formatSitemapXml(entries: readonly SitemapEntry[]): string;
|
|
1067
|
+
|
|
1068
|
+
/** One public route of llms.txt, as written by the build. */
|
|
1069
|
+
interface LlmsTxtRoute extends PublicRoute {
|
|
1070
|
+
/** Page label in the app's language (static routes; a dynamic route uses each record's title) */
|
|
1071
|
+
title?: string;
|
|
1072
|
+
/** Page description in the app's language (static routes) */
|
|
1073
|
+
description?: string;
|
|
1074
|
+
/** Section heading (static default: the pages heading; dynamic default: the entity's plural name) */
|
|
1075
|
+
section?: string;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/** Build-written part of llms.txt. */
|
|
1079
|
+
interface LlmsTxtSource {
|
|
1080
|
+
/** Site name (appConfig.app.name) */
|
|
1081
|
+
name: string;
|
|
1082
|
+
/** Site summary (appConfig.app.description) */
|
|
1083
|
+
summary?: string;
|
|
1084
|
+
/** Absolute production URL, no trailing slash */
|
|
1085
|
+
baseUrl: string;
|
|
1086
|
+
/** Heading of the static pages section, in the app's language */
|
|
1087
|
+
pagesHeading: string;
|
|
1088
|
+
/** Same routes as the sitemap, in sitemap order */
|
|
1089
|
+
routes: readonly LlmsTxtRoute[];
|
|
1090
|
+
/** Entity i18n namespace (`entity-product`) → plural name in the app's language */
|
|
1091
|
+
entityHeadings: Readonly<Record<string, string>>;
|
|
1092
|
+
/** App default language: record titles/descriptions are formatted in it */
|
|
1093
|
+
language: string;
|
|
1094
|
+
/** Entity namespaces and `crud` in `language` (namespace → translation JSON) */
|
|
1095
|
+
translations: Readonly<Record<string, Record<string, unknown>>>;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/** What the generated llms.txt route passes besides the build-written source. */
|
|
1099
|
+
interface LlmsTxtContext {
|
|
1100
|
+
/** The app's entity definitions (`import * as entities from 'entities'`) */
|
|
1101
|
+
entities: Readonly<Record<string, unknown>>;
|
|
1102
|
+
/** Public (anonymous) CRUD reader; required when a route lists records (`collection`) */
|
|
1103
|
+
crud?: ICrudAdapter;
|
|
1104
|
+
/** `deriveEntitySeo` from @donotdev/core/server */
|
|
1105
|
+
deriveEntitySeo: (
|
|
1106
|
+
entity: AnyEntity,
|
|
1107
|
+
data: EntitySeoRecord,
|
|
1108
|
+
options: EntitySeoOptions
|
|
1109
|
+
) => EntitySeo;
|
|
1110
|
+
/** `HIDDEN_STATUSES` from @donotdev/core/server: records with these statuses are not listed */
|
|
1111
|
+
hiddenStatuses: readonly string[];
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
/**
|
|
1115
|
+
* Build the app's llms.txt: the sitemap's pages, static ones under the pages heading,
|
|
1116
|
+
* entity records under their entity's plural name with their `deriveEntitySeo` title.
|
|
1117
|
+
*
|
|
1118
|
+
* @throws When a static route has no label, a collection has no entity definition or
|
|
1119
|
+
* heading, a published record has no title, or the read fails
|
|
1120
|
+
*/
|
|
1121
|
+
declare function buildLlmsTxt(
|
|
1122
|
+
source: LlmsTxtSource & LlmsTxtContext
|
|
1123
|
+
): Promise<string>;
|
|
1124
|
+
|
|
1125
|
+
export { buildLlmsTxt, buildSitemap, clearMetadataCache, defineNextConfig, definePostCSSConfig, formatSitemapXml, getMetadataForPath };
|
|
1126
|
+
export type { LlmsTxtContext, LlmsTxtRoute, LlmsTxtSource, NextConfigOptions, PublicRoute, SitemapContext, SitemapEntry, SitemapRoute };
|