@cloudhal/astro-renderer 0.6.3 → 0.6.4

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.
Files changed (59) hide show
  1. package/dist/src/astro-env.d.ts +9 -0
  2. package/dist/src/cloudflare-entry.d.ts +6 -0
  3. package/dist/src/cloudflare-entry.js +135 -6
  4. package/dist/src/integration.js +34 -5
  5. package/dist/src/runtime-workerd.d.ts +26 -0
  6. package/dist/src/runtime-workerd.js +63 -3
  7. package/dist/src/runtime.d.ts +18 -0
  8. package/dist/src/runtime.js +19 -0
  9. package/dist/src/status-hook.d.ts +36 -0
  10. package/dist/src/status-hook.js +141 -0
  11. package/dist/src/status-html.d.ts +51 -0
  12. package/dist/src/status-html.js +157 -0
  13. package/dist/src/status-middleware.d.ts +6 -0
  14. package/dist/src/status-middleware.js +61 -0
  15. package/dist/src/status-page.d.ts +94 -0
  16. package/dist/src/status-page.js +323 -0
  17. package/dist/src/status-serve.d.ts +44 -0
  18. package/dist/src/status-serve.js +112 -0
  19. package/dist/src/status-strings/ar.d.ts +2 -0
  20. package/dist/src/status-strings/ar.js +34 -0
  21. package/dist/src/status-strings/catalog.d.ts +8 -0
  22. package/dist/src/status-strings/catalog.js +52 -0
  23. package/dist/src/status-strings/de.d.ts +2 -0
  24. package/dist/src/status-strings/de.js +34 -0
  25. package/dist/src/status-strings/en.d.ts +46 -0
  26. package/dist/src/status-strings/en.js +47 -0
  27. package/dist/src/status-strings/es.d.ts +2 -0
  28. package/dist/src/status-strings/es.js +34 -0
  29. package/dist/src/status-strings/fa.d.ts +2 -0
  30. package/dist/src/status-strings/fa.js +34 -0
  31. package/dist/src/status-strings/fr.d.ts +2 -0
  32. package/dist/src/status-strings/fr.js +34 -0
  33. package/dist/src/status-strings/he.d.ts +2 -0
  34. package/dist/src/status-strings/he.js +34 -0
  35. package/dist/src/status-strings/hi.d.ts +2 -0
  36. package/dist/src/status-strings/hi.js +34 -0
  37. package/dist/src/status-strings/id.d.ts +2 -0
  38. package/dist/src/status-strings/id.js +34 -0
  39. package/dist/src/status-strings/it.d.ts +2 -0
  40. package/dist/src/status-strings/it.js +34 -0
  41. package/dist/src/status-strings/ja.d.ts +2 -0
  42. package/dist/src/status-strings/ja.js +34 -0
  43. package/dist/src/status-strings/ko.d.ts +2 -0
  44. package/dist/src/status-strings/ko.js +34 -0
  45. package/dist/src/status-strings/nl.d.ts +2 -0
  46. package/dist/src/status-strings/nl.js +34 -0
  47. package/dist/src/status-strings/pl.d.ts +2 -0
  48. package/dist/src/status-strings/pl.js +34 -0
  49. package/dist/src/status-strings/pt-BR.d.ts +2 -0
  50. package/dist/src/status-strings/pt-BR.js +34 -0
  51. package/dist/src/status-strings/ru.d.ts +2 -0
  52. package/dist/src/status-strings/ru.js +34 -0
  53. package/dist/src/status-strings/tr.d.ts +2 -0
  54. package/dist/src/status-strings/tr.js +34 -0
  55. package/dist/src/status-strings/uk.d.ts +2 -0
  56. package/dist/src/status-strings/uk.js +34 -0
  57. package/dist/src/status-strings/zh-Hans.d.ts +2 -0
  58. package/dist/src/status-strings/zh-Hans.js +34 -0
  59. package/package.json +23 -7
@@ -0,0 +1,323 @@
1
+ /**
2
+ * Status pages (RFC-0043 §1): the one page a site answers with when it cannot show its pages —
3
+ * not published yet, in maintenance, unavailable, failed, or behind an expired preview link —
4
+ * with the right status code, `Retry-After`, `no-store` and its own CSP. Pure and Worker-safe:
5
+ * it imports only the catalog and the template, takes an injected clock, and never throws (a
6
+ * broken input degrades to the English page). Where it is served: `cloudflare-entry.ts` before
7
+ * Astro, `status-middleware.ts` in `cloudhal dev`, and the starter's routes as their fallback.
8
+ */
9
+ import {
10
+ messageHtml,
11
+
12
+
13
+
14
+ statusDocument,
15
+ } from "./status-html.js";
16
+ import { STATUS_CATALOG } from "./status-strings/catalog.js";
17
+
18
+
19
+ // The hook's types, so a theme imports everything from one subpath (§1.7).
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ export const SITE_STATES = [
31
+ "not-published",
32
+ "maintenance",
33
+ "unavailable",
34
+ "error",
35
+ "preview-expired",
36
+ ];
37
+
38
+ export const isSiteState = (value ) =>
39
+ (SITE_STATES ).includes(value);
40
+
41
+
42
+    
43
+
44
+  
45
+
46
+  
47
+
48
+
49
+
50
+  
51
+
52
+  
53
+
54
+
55
+
56
+  
57
+
58
+
59
+
60
+ /** The built-in page's own policy (§1.3): inline style, same-origin images, nothing else. */
61
+ export const STATUS_CSP =
62
+ "default-src 'none'; style-src 'unsafe-inline'; img-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
63
+
64
+ /** The built-in document never exceeds this (§1.3); a test draws every state in every language. */
65
+ export const STATUS_PAGE_LIMIT = 8192;
66
+
67
+ /** A theme hook's document may be this large before the built-in page is used instead (§1.7). */
68
+ export const HOOK_HTML_LIMIT = 65536;
69
+
70
+ const STATUS = {
71
+ "not-published": 503,
72
+ maintenance: 503,
73
+ unavailable: 503,
74
+ error: 500,
75
+ "preview-expired": 410,
76
+ };
77
+
78
+ const NOINDEX = new Set(["not-published", "preview-expired"]);
79
+
80
+ /** RTL scripts by primary language subtag (CLDR), for locales the catalog does not list. */
81
+ const RTL = new Set(["ar", "fa", "he", "ur", "ps", "ckb", "dv", "yi", "ug", "sd", "ks", "ku"]);
82
+
83
+ export function statusCode(state ) {
84
+ return STATUS[state];
85
+ }
86
+
87
+ /** Delay-seconds (§1.2), or nothing for `error` and `preview-expired`. */
88
+ export function retryAfter(
89
+ state ,
90
+ input ,
91
+ ) {
92
+ if (state === "not-published") return "3600";
93
+ if (state === "unavailable") return "300";
94
+ if (state !== "maintenance") return undefined;
95
+ const end = input.until ? Date.parse(input.until.at) : Number.NaN;
96
+ if (!Number.isFinite(end)) return "3600";
97
+ return String(Math.max(60, Math.ceil((end - input.now) / 1000)));
98
+ }
99
+
100
+ /**
101
+ * The catalog locale for a site locale (§1.4): exact, then the primary language subtag
102
+ * (`pt-PT` → `pt-BR`, `zh-HK` → `zh-Hans`), then English.
103
+ */
104
+ export function catalogLocale(locale ) {
105
+ if (Object.hasOwn(STATUS_CATALOG, locale)) return locale;
106
+ const language = locale.toLowerCase().split("-")[0] ?? "";
107
+ if (Object.hasOwn(STATUS_CATALOG, language)) return language;
108
+ const same = Object.keys(STATUS_CATALOG).find((l) => l.split("-")[0]?.toLowerCase() === language);
109
+ return same ?? "en";
110
+ }
111
+
112
+ /** `<html dir>` for a locale: the catalog's entry, else by script. */
113
+ export function statusDirection(locale ) {
114
+ const entry = STATUS_CATALOG[catalogLocale(locale)];
115
+ if (entry && catalogLocale(locale) !== "en") return entry.dir;
116
+ if (locale === "en") return "ltr";
117
+ const [language = "", script] = locale.toLowerCase().split("-");
118
+ if (script === "latn" || script === "cyrl") return "ltr";
119
+ return RTL.has(language) ? "rtl" : "ltr";
120
+ }
121
+
122
+ /** ICU simple arguments only (§1.5): `{name}` is replaced, anything else is left as it is. */
123
+ export function fillMessage(message , params ) {
124
+ return message.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (all, name ) =>
125
+ Object.hasOwn(params, name) ? (params[name] ) : all,
126
+ );
127
+ }
128
+
129
+ function wordsOf(state , page , m ) {
130
+ switch (state) {
131
+ case "not-published":
132
+ return m.notPublished;
133
+ case "maintenance":
134
+ return page === "coming-soon" ? m.comingSoon : m.maintenance;
135
+ case "unavailable":
136
+ return m.unavailable;
137
+ case "error":
138
+ return m.error;
139
+ case "preview-expired":
140
+ return m.previewExpired;
141
+ }
142
+ }
143
+
144
+ /** "2 November, 11:00 GMT+3" in the page's locale and the site's zone (Western digits as Studio). */
145
+ function formatUntil(at , timeZone , intl ) {
146
+ const t = Date.parse(at);
147
+ if (!Number.isFinite(t)) return undefined;
148
+ const options = {
149
+ day: "numeric",
150
+ month: "long",
151
+ hour: "2-digit",
152
+ minute: "2-digit",
153
+ timeZoneName: "short",
154
+ };
155
+ for (const zone of [timeZone, "UTC"]) {
156
+ try {
157
+ return new Intl.DateTimeFormat(intl, { ...options, timeZone: zone ?? "UTC" }).format(t);
158
+ } catch {
159
+ // an unknown zone: UTC next
160
+ }
161
+ }
162
+ return undefined;
163
+ }
164
+
165
+ /** The words of a page in its language: what the theme hook gets as `strings` (§1.7). */
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+ export function statusStrings(state , input ) {
177
+ const locale = catalogLocale(input.locale);
178
+ const entry = STATUS_CATALOG[locale] ?? (STATUS_CATALOG.en );
179
+ const m = entry.messages;
180
+ const words = wordsOf(state, input.page, m);
181
+ const until =
182
+ state === "maintenance" && input.until
183
+ ? formatUntil(input.until.at, input.until.timeZone, entry.intl ?? locale)
184
+ : undefined;
185
+ return {
186
+ locale,
187
+ dir: entry.dir,
188
+ title: words.title,
189
+ body: words.body,
190
+ builtWith: m.builtWith,
191
+ ...(until ? { untilText: fillMessage(m.backBy, { time: until }) } : {}),
192
+ ...(state === "error" && input.rayId
193
+ ? { referenceText: fillMessage(m.reference, { reference: input.rayId }) }
194
+ : {}),
195
+ };
196
+ }
197
+
198
+ /** Only a same-origin media URL may be the logo (CSP `img-src 'self'`, §1.6). */
199
+ const sameOriginLogo = (src ) =>
200
+ src && /^\/media\/[^\s"'<>]+$/.test(src) ? src : undefined;
201
+
202
+ function documentOf(state , input , css ) {
203
+ const s = statusStrings(state, input);
204
+ const message = state === "maintenance" ? input.message : undefined;
205
+ return {
206
+ state,
207
+ locale: s.locale,
208
+ dir: s.dir,
209
+ noindex: NOINDEX.has(state),
210
+ words: { title: s.title, body: s.body, builtWith: s.builtWith },
211
+ siteName: state === "unavailable" ? undefined : input.site?.name,
212
+ logo:
213
+ state === "not-published" || state === "unavailable"
214
+ ? undefined
215
+ : sameOriginLogo(input.site?.logo),
216
+ ...(message?.text.trim()
217
+ ? {
218
+ message: {
219
+ text: message.text,
220
+ locale: message.locale,
221
+ dir: statusDirection(message.locale),
222
+ },
223
+ }
224
+ : {}),
225
+ until: s.untilText,
226
+ reference: s.referenceText,
227
+ theme: state === "maintenance" || state === "preview-expired" ? input.theme : undefined,
228
+ css,
229
+ };
230
+ }
231
+
232
+ const NEUTRAL = { locale: "en", now: 0 };
233
+
234
+ /** The same document as a string, for theme hooks that only restyle it (§1.7). Never throws. */
235
+ export function statusPageHtml(
236
+ state ,
237
+ input ,
238
+ options = {},
239
+ ) {
240
+ try {
241
+ return statusDocument(documentOf(state, input, options.css));
242
+ } catch {
243
+ return statusDocument(documentOf(state, NEUTRAL));
244
+ }
245
+ }
246
+
247
+ /** The headers every status response carries (§1.2), for an HTML page or a plain answer. */
248
+ export function statusHeaders(
249
+ state ,
250
+ input ,
251
+ contentType ,
252
+ csp = STATUS_CSP,
253
+ ) {
254
+ const headers = new Headers({
255
+ "content-type": contentType,
256
+ "cache-control": "no-store",
257
+ "cloudflare-cdn-cache-control": "no-store",
258
+ "x-cloudhal-state": state,
259
+ "x-content-type-options": "nosniff",
260
+ "referrer-policy": "no-referrer",
261
+ });
262
+ const retry = retryAfter(state, input);
263
+ if (retry) headers.set("retry-after", retry);
264
+ if (NOINDEX.has(state)) headers.set("x-robots-tag", "noindex");
265
+ if (contentType.startsWith("text/html")) headers.set("content-security-policy", csp);
266
+ return headers;
267
+ }
268
+
269
+
270
+
271
+
272
+
273
+  
274
+
275
+
276
+
277
+
278
+
279
+
280
+ /** The built-in page: status, headers and body. Never throws. */
281
+ export function statusPage(
282
+ state ,
283
+ input ,
284
+ options = {},
285
+ ) {
286
+ const html = options.html ?? statusPageHtml(state, input);
287
+ const headers = statusHeaders(
288
+ state,
289
+ input,
290
+ "text/html; charset=utf-8",
291
+ options.html ? (options.csp ?? STATUS_CSP) : STATUS_CSP,
292
+ );
293
+ return new Response(options.method === "HEAD" ? null : html, {
294
+ status: statusCode(state),
295
+ headers,
296
+ });
297
+ }
298
+
299
+ /** Machine endpoints in the same states (§2.3): short plain text or JSON, same status and headers. */
300
+ export function statusPlain(
301
+ state ,
302
+ input ,
303
+ as ,
304
+ options = {},
305
+ ) {
306
+ const s = statusStrings(state, input);
307
+ const body =
308
+ as === "json"
309
+ ? JSON.stringify({ error: state, message: `${s.title}. ${s.body}` })
310
+ : `${s.title}. ${s.body}\n`;
311
+ const headers = statusHeaders(
312
+ state,
313
+ input,
314
+ as === "json" ? "application/json; charset=utf-8" : "text/plain; charset=utf-8",
315
+ );
316
+ return new Response(options.method === "HEAD" ? null : body, {
317
+ status: statusCode(state),
318
+ headers,
319
+ });
320
+ }
321
+
322
+ /** The owner's message as the hook sees it (`messageHtml`, §1.7). */
323
+ export { messageHtml } from "./status-html.js";
@@ -0,0 +1,44 @@
1
+ /**
2
+ * What the Site Worker entry and the dev middleware need around `statusPage` (RFC-0043 §1.4,
3
+ * §1.6, §1.8): which paths get a page rather than the theme's own answer, the page's locale from
4
+ * the request's host or path prefix, and the site data each state may show. Worker-safe.
5
+ */
6
+ import type { Site } from "@cloudhal/core-contracts";
7
+ import type { SiteState, StatusPageInput, StatusTheme } from "./status-page.js";
8
+ /** Feeds, sitemaps, `llms.txt`, search JSON, manifests: machines read these (§2.3). */
9
+ export declare const MACHINE_PATH: RegExp;
10
+ /**
11
+ * True for a path that gets the status page before the first publish (§2.3): everything a
12
+ * person opens in a browser. `robots.txt`, media, static assets, `/.well-known/`, the
13
+ * operator endpoints, comment endpoints and machine paths keep their own answers.
14
+ */
15
+ export declare function isStatusPagePath(pathname: string): boolean;
16
+ /** What choosing the locale needs of a site (`localeRequest` reads nothing else). */
17
+ export interface LocaleSite {
18
+ readonly locales: readonly string[];
19
+ readonly defaultLocale: string;
20
+ readonly localization?: Site["localization"] | undefined;
21
+ }
22
+ /** The path without trailing slashes (`/` for the root), in one linear pass: request text. */
23
+ export declare function trimTrailingSlashes(pathname: string): string;
24
+ /** §1.4: the locale of the request's host or path prefix when it is the site's, else the default. */
25
+ export declare function statusLocale(site: LocaleSite, host: string, pathname: string): string;
26
+ /**
27
+ * §1.3: the site's look as the status page may use it — `brand` (else `seed`), `surface` and
28
+ * `text` when they are `#rrggbb`, and the `typePairing` choice as a system font stack. Read from
29
+ * the published snapshot's site node only; everything else in `theme.config` is ignored.
30
+ */
31
+ export declare function statusTheme(site: Pick<Site, "theme">): StatusTheme | undefined;
32
+ /** The site's logo when it is a same-origin media URL (§1.6). */
33
+ export declare function statusLogo(site: Pick<Site, "brand">): string | undefined;
34
+ /**
35
+ * §1.6: the site data a state may show. `live` is the site node as it is now (the name only);
36
+ * `published` the published snapshot's, which also brings the logo and the theme tokens.
37
+ */
38
+ export declare function statusInput(state: SiteState, sites: {
39
+ live?: Site | undefined;
40
+ published?: Site | undefined;
41
+ }, request: {
42
+ host: string;
43
+ pathname: string;
44
+ }, now: number): StatusPageInput;
@@ -0,0 +1,112 @@
1
+ /**
2
+ * What the Site Worker entry and the dev middleware need around `statusPage` (RFC-0043 §1.4,
3
+ * §1.6, §1.8): which paths get a page rather than the theme's own answer, the page's locale from
4
+ * the request's host or path prefix, and the site data each state may show. Worker-safe.
5
+ */
6
+
7
+ import { isCommentsPath } from "./comments.js";
8
+ import { localeRequest } from "./locales.js";
9
+ import { matchMediaRoute } from "./media-route.js";
10
+
11
+
12
+ /** Feeds, sitemaps, `llms.txt`, search JSON, manifests: machines read these (§2.3). */
13
+ export const MACHINE_PATH = /\.(?:xml|txt|json|rss|atom|webmanifest)$/i;
14
+
15
+ /**
16
+ * True for a path that gets the status page before the first publish (§2.3): everything a
17
+ * person opens in a browser. `robots.txt`, media, static assets, `/.well-known/`, the
18
+ * operator endpoints, comment endpoints and machine paths keep their own answers.
19
+ */
20
+ export function isStatusPagePath(pathname ) {
21
+ if (pathname === "/robots.txt") return false;
22
+ if (matchMediaRoute(pathname)) return false;
23
+ if (/^\/(?:_astro|_cloudhal|__cloudhal|\.well-known)\//.test(pathname)) return false;
24
+ if (isCommentsPath(pathname)) return false;
25
+ return !MACHINE_PATH.test(pathname);
26
+ }
27
+
28
+ /** What choosing the locale needs of a site (`localeRequest` reads nothing else). */
29
+
30
+
31
+
32
+
33
+
34
+
35
+ /** The path without trailing slashes (`/` for the root), in one linear pass: request text. */
36
+ export function trimTrailingSlashes(pathname ) {
37
+ let end = pathname.length;
38
+ while (end > 0 && pathname.charCodeAt(end - 1) === 47) end--;
39
+ return end === 0 ? "/" : pathname.slice(0, end);
40
+ }
41
+
42
+ /** §1.4: the locale of the request's host or path prefix when it is the site's, else the default. */
43
+ export function statusLocale(site , host , pathname ) {
44
+ const path = trimTrailingSlashes(pathname);
45
+ try {
46
+ return localeRequest(site , host, path).locale;
47
+ } catch {
48
+ return site.defaultLocale || "en";
49
+ }
50
+ }
51
+
52
+ const HEX = /^#[0-9a-f]{6}$/i;
53
+ const FONTS = {
54
+ editorial: "serif",
55
+ classic: "serif",
56
+ technical: "mono",
57
+ system: "sans",
58
+ modern: "sans",
59
+ humanist: "sans",
60
+ };
61
+
62
+ /**
63
+ * §1.3: the site's look as the status page may use it — `brand` (else `seed`), `surface` and
64
+ * `text` when they are `#rrggbb`, and the `typePairing` choice as a system font stack. Read from
65
+ * the published snapshot's site node only; everything else in `theme.config` is ignored.
66
+ */
67
+ export function statusTheme(site ) {
68
+ const config = (site.theme.config ?? {}) ;
69
+ const color = (key ) => {
70
+ const v = config[key];
71
+ return typeof v === "string" && HEX.test(v) ? v.toLowerCase() : undefined;
72
+ };
73
+ const pairing = config.typePairing;
74
+ const theme = {
75
+ brand: color("brand") ?? color("seed"),
76
+ surface: color("surface"),
77
+ text: color("text"),
78
+ font: typeof pairing === "string" ? FONTS[pairing] : undefined,
79
+ };
80
+ return Object.values(theme).some((v) => v !== undefined) ? theme : undefined;
81
+ }
82
+
83
+ /** The site's logo when it is a same-origin media URL (§1.6). */
84
+ export function statusLogo(site ) {
85
+ const src = site.brand?.logo?.src;
86
+ return src?.startsWith("/media/") ? src : undefined;
87
+ }
88
+
89
+ /**
90
+ * §1.6: the site data a state may show. `live` is the site node as it is now (the name only);
91
+ * `published` the published snapshot's, which also brings the logo and the theme tokens.
92
+ */
93
+ export function statusInput(
94
+ state ,
95
+ sites ,
96
+ request ,
97
+ now ,
98
+ ) {
99
+ const site = sites.published ?? sites.live;
100
+ const locale = site ? statusLocale(site, request.host, request.pathname) : "en";
101
+ if (state === "unavailable" || state === "error" || !site) return { locale, now };
102
+ const showsBrand = sites.published !== undefined && state !== "not-published";
103
+ return {
104
+ locale,
105
+ now,
106
+ site: {
107
+ name: site.name,
108
+ ...(showsBrand && sites.published ? { logo: statusLogo(sites.published) } : {}),
109
+ },
110
+ ...(showsBrand && sites.published ? { theme: statusTheme(sites.published) } : {}),
111
+ };
112
+ }
@@ -0,0 +1,2 @@
1
+ import type { StatusMessages } from "./en.js";
2
+ export declare const messages: StatusMessages;
@@ -0,0 +1,34 @@
1
+ // Generated by `pnpm i18n:import` (ADR-0034): ar status page messages.
2
+ // Do not edit: change the translation file and import it; only English is edited here.
3
+ // hash: b5c519cedb1faeba
4
+
5
+
6
+ export const messages = {
7
+ notPublished: {
8
+ title: "قريبًا",
9
+ body: "لم يُنشر هذا الموقع بعد. عُد للزيارة قريبًا.",
10
+ },
11
+ maintenance: {
12
+ title: "سنعود قريبًا",
13
+ body: "هذا الموقع قيد الصيانة. شكرًا لصبرك.",
14
+ },
15
+ comingSoon: {
16
+ title: "قريبًا",
17
+ body: "لم يُفتح هذا الموقع بعد. عُد للزيارة قريبًا.",
18
+ },
19
+ unavailable: {
20
+ title: "غير متاح مؤقتًا",
21
+ body: "يتعذر الوصول إلى هذا الموقع الآن. يُرجى المحاولة مجددًا بعد بضع دقائق.",
22
+ },
23
+ error: {
24
+ title: "حدث خطأ ما",
25
+ body: "تعذر عرض هذه الصفحة. يُرجى المحاولة مجددًا بعد قليل.",
26
+ },
27
+ previewExpired: {
28
+ title: "انتهت صلاحية رابط المعاينة هذا",
29
+ body: "اطلب رابطًا جديدًا لعرض هذا الإصدار.",
30
+ },
31
+ backBy: "نعود بحلول {time}",
32
+ reference: "المرجع: {reference}",
33
+ builtWith: "صُنع باستخدام Cloudhal",
34
+ };
@@ -0,0 +1,8 @@
1
+ import { type StatusMessages } from "./en.js";
2
+ export interface StatusCatalogEntry {
3
+ readonly messages: StatusMessages;
4
+ readonly dir: "ltr" | "rtl";
5
+ /** The tag `Intl` formats with when it differs from the locale (Western digits, ADR-0033). */
6
+ readonly intl?: string;
7
+ }
8
+ export declare const STATUS_CATALOG: Readonly<Record<string, StatusCatalogEntry>>;
@@ -0,0 +1,52 @@
1
+ // Generated by `pnpm i18n:import` (ADR-0034, RFC-0043 §1.5): every registered language's
2
+ // status-page messages with its writing direction and `Intl` tag from Studio's locale registry.
3
+ // Do not edit: add a language to `apps/studio/src/i18n/locales.ts` and import its catalogs.
4
+
5
+ import { messages as ar } from "./ar.js";
6
+ import { messages as de } from "./de.js";
7
+ import { en, } from "./en.js";
8
+ import { messages as es } from "./es.js";
9
+ import { messages as fa } from "./fa.js";
10
+ import { messages as fr } from "./fr.js";
11
+ import { messages as he } from "./he.js";
12
+ import { messages as hi } from "./hi.js";
13
+ import { messages as id } from "./id.js";
14
+ import { messages as it } from "./it.js";
15
+ import { messages as ja } from "./ja.js";
16
+ import { messages as ko } from "./ko.js";
17
+ import { messages as nl } from "./nl.js";
18
+ import { messages as pl } from "./pl.js";
19
+ import { messages as pt_BR } from "./pt-BR.js";
20
+ import { messages as ru } from "./ru.js";
21
+ import { messages as tr } from "./tr.js";
22
+ import { messages as uk } from "./uk.js";
23
+ import { messages as zh_Hans } from "./zh-Hans.js";
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+ export const STATUS_CATALOG = {
33
+ en: { messages: en, dir: "ltr" },
34
+ tr: { messages: tr, dir: "ltr" },
35
+ de: { messages: de, dir: "ltr" },
36
+ es: { messages: es, dir: "ltr" },
37
+ fr: { messages: fr, dir: "ltr" },
38
+ it: { messages: it, dir: "ltr" },
39
+ "pt-BR": { messages: pt_BR, dir: "ltr" },
40
+ nl: { messages: nl, dir: "ltr" },
41
+ pl: { messages: pl, dir: "ltr" },
42
+ ru: { messages: ru, dir: "ltr" },
43
+ uk: { messages: uk, dir: "ltr" },
44
+ ja: { messages: ja, dir: "ltr" },
45
+ ko: { messages: ko, dir: "ltr" },
46
+ "zh-Hans": { messages: zh_Hans, dir: "ltr" },
47
+ hi: { messages: hi, dir: "ltr" },
48
+ id: { messages: id, dir: "ltr" },
49
+ ar: { messages: ar, dir: "rtl", intl: "ar-u-nu-latn" },
50
+ fa: { messages: fa, dir: "rtl", intl: "fa-u-nu-latn" },
51
+ he: { messages: he, dir: "rtl" },
52
+ };
@@ -0,0 +1,2 @@
1
+ import type { StatusMessages } from "./en.js";
2
+ export declare const messages: StatusMessages;
@@ -0,0 +1,34 @@
1
+ // Generated by `pnpm i18n:import` (ADR-0034): de status page messages.
2
+ // Do not edit: change the translation file and import it; only English is edited here.
3
+ // hash: 96c78422069956fb
4
+
5
+
6
+ export const messages = {
7
+ notPublished: {
8
+ title: "Demnächst",
9
+ body: "Diese Website ist noch nicht veröffentlicht. Schauen Sie bald wieder vorbei.",
10
+ },
11
+ maintenance: {
12
+ title: "Wir sind bald zurück",
13
+ body: "Diese Website wird gerade gewartet. Vielen Dank für Ihre Geduld.",
14
+ },
15
+ comingSoon: {
16
+ title: "Demnächst",
17
+ body: "Diese Website ist noch nicht geöffnet. Schauen Sie bald wieder vorbei.",
18
+ },
19
+ unavailable: {
20
+ title: "Vorübergehend nicht erreichbar",
21
+ body: "Diese Website ist gerade nicht erreichbar. Bitte versuchen Sie es in ein paar Minuten erneut.",
22
+ },
23
+ error: {
24
+ title: "Etwas ist schiefgelaufen",
25
+ body: "Diese Seite konnte nicht angezeigt werden. Bitte versuchen Sie es gleich noch einmal.",
26
+ },
27
+ previewExpired: {
28
+ title: "Dieser Vorschaulink ist abgelaufen",
29
+ body: "Bitten Sie um einen neuen Link, um diese Version zu sehen.",
30
+ },
31
+ backBy: "Zurück bis {time}",
32
+ reference: "Referenz: {reference}",
33
+ builtWith: "Erstellt mit Cloudhal",
34
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The words of the status pages (RFC-0043 §1.5): English is the source of truth for the keys,
3
+ * edited here by hand; every other registered language is generated by `pnpm i18n:import` from
4
+ * `.i18n/<locale>/status.json` (ADR-0034) and `catalog.ts` lists them all. Messages are ICU
5
+ * MessageFormat 1 restricted to simple `{argument}`s: nothing here counts or selects, so the
6
+ * renderer substitutes them itself and no compiler ships in the site Worker.
7
+ */
8
+ export declare const en: {
9
+ /** Before the first publish (503): the site's name may sit above it. */
10
+ notPublished: {
11
+ title: string;
12
+ body: string;
13
+ };
14
+ /** Maintenance mode with the `maintenance` wording (503). */
15
+ maintenance: {
16
+ title: string;
17
+ body: string;
18
+ };
19
+ /** Maintenance mode with the `coming-soon` wording: a published site kept private until launch (503). */
20
+ comingSoon: {
21
+ title: string;
22
+ body: string;
23
+ };
24
+ /** The Worker serves no site, or its store cannot be read (503). */
25
+ unavailable: {
26
+ title: string;
27
+ body: string;
28
+ };
29
+ /** A render failure (500); the page shows a reference id a visitor can quote. */
30
+ error: {
31
+ title: string;
32
+ body: string;
33
+ };
34
+ /** An expired, forged or otherwise invalid preview link (410). */
35
+ previewExpired: {
36
+ title: string;
37
+ body: string;
38
+ };
39
+ /** When maintenance ends; {time} is a date and time in the site's time zone. */
40
+ backBy: string;
41
+ /** The error page's request id; {reference} is the id a visitor can quote to the owner. */
42
+ reference: string;
43
+ /** The footer of the built-in page. */
44
+ builtWith: string;
45
+ };
46
+ export type StatusMessages = typeof en;