@vmz/vmz 0.0.1 → 0.0.3

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 (79) hide show
  1. package/README.md +52 -2
  2. package/bin/vmz.js +4 -0
  3. package/dist/application-cmd.d.ts +21 -0
  4. package/dist/application-cmd.js +347 -0
  5. package/dist/bundler-adapter.d.ts +63 -0
  6. package/dist/bundler-adapter.js +110 -0
  7. package/dist/cli.d.ts +23 -0
  8. package/dist/cli.js +474 -0
  9. package/dist/dev-session.d.ts +35 -0
  10. package/dist/dev-session.js +290 -0
  11. package/dist/document-build.d.ts +99 -0
  12. package/dist/document-build.js +273 -0
  13. package/dist/document-check.d.ts +44 -0
  14. package/dist/document-check.js +246 -0
  15. package/dist/document-cmd.d.ts +8 -0
  16. package/dist/document-cmd.js +146 -0
  17. package/dist/document-designs.d.ts +9 -0
  18. package/dist/document-designs.js +126 -0
  19. package/dist/document-enrich.d.ts +23 -0
  20. package/dist/document-enrich.js +233 -0
  21. package/dist/document-evidence.d.ts +49 -0
  22. package/dist/document-evidence.js +509 -0
  23. package/dist/document-integrate.d.ts +34 -0
  24. package/dist/document-integrate.js +88 -0
  25. package/dist/document-interactive.d.ts +69 -0
  26. package/dist/document-interactive.js +254 -0
  27. package/dist/document-locale.d.ts +31 -0
  28. package/dist/document-locale.js +59 -0
  29. package/dist/document-markdown.d.ts +12 -0
  30. package/dist/document-markdown.js +45 -0
  31. package/dist/document-scan.d.ts +21 -0
  32. package/dist/document-scan.js +151 -0
  33. package/dist/document-schema.d.ts +86 -0
  34. package/dist/document-schema.js +87 -0
  35. package/dist/explain-cmd.d.ts +5 -0
  36. package/dist/explain-cmd.js +123 -0
  37. package/dist/index.d.ts +359 -0
  38. package/dist/index.js +580 -0
  39. package/dist/invocation.d.ts +91 -0
  40. package/dist/invocation.js +190 -0
  41. package/dist/locale-check.d.ts +106 -0
  42. package/dist/locale-check.js +736 -0
  43. package/dist/locale-cmd.d.ts +5 -0
  44. package/dist/locale-cmd.js +442 -0
  45. package/dist/locale-delivery.d.ts +298 -0
  46. package/dist/locale-delivery.js +443 -0
  47. package/dist/locale-router.d.ts +206 -0
  48. package/dist/locale-router.js +507 -0
  49. package/dist/locale-runtime.d.ts +406 -0
  50. package/dist/locale-runtime.js +541 -0
  51. package/dist/locale-schema.d.ts +8 -0
  52. package/dist/locale-schema.js +9 -0
  53. package/dist/locale-tooling.d.ts +118 -0
  54. package/dist/locale-tooling.js +357 -0
  55. package/dist/log.d.ts +19 -0
  56. package/dist/log.js +42 -0
  57. package/dist/packages.d.ts +26 -0
  58. package/dist/packages.js +146 -0
  59. package/dist/plugin-host.d.ts +29 -0
  60. package/dist/plugin-host.js +369 -0
  61. package/dist/refactor-cmd.d.ts +8 -0
  62. package/dist/refactor-cmd.js +156 -0
  63. package/dist/resolve-native-cli.d.ts +14 -0
  64. package/dist/resolve-native-cli.js +84 -0
  65. package/dist/resolve.d.ts +24 -0
  66. package/dist/resolve.js +55 -0
  67. package/dist/test-cmd.d.ts +9 -0
  68. package/dist/test-cmd.js +363 -0
  69. package/dist/test-compile.d.ts +2 -0
  70. package/dist/test-compile.js +3 -0
  71. package/dist/test-discover.d.ts +2 -0
  72. package/dist/test-discover.js +3 -0
  73. package/dist/test-logic.d.ts +2 -0
  74. package/dist/test-logic.js +3 -0
  75. package/dist/test-protocol.d.ts +2 -0
  76. package/dist/test-protocol.js +3 -0
  77. package/dist/watch-diff.d.ts +17 -0
  78. package/dist/watch-diff.js +56 -0
  79. package/package.json +96 -3
@@ -0,0 +1,443 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * Locale multi-host delivery: Web chunks · Mini packages · Native packs ·
4
+ * Server error envelope / formatter resources.
5
+ *
6
+ * Same MessageNode projects to all Surfaces; LocaleId is not a WebSurface concern.
7
+ */
8
+ import { createHash } from 'node:crypto';
9
+ import { DIAG_LOCALE_CHUNK_HASH_MISMATCH, DIAG_LOCALE_DELIVERY_FULL_BUNDLE, DIAG_LOCALE_HOST_MESSAGE_DIVERGENCE, DIAG_LOCALE_MINI_CROSS_PACKAGE_UNPROVEN, DIAG_LOCALE_NATIVE_PACK_APP_MISMATCH, DIAG_LOCALE_NATIVE_PACK_HAS_JS, DIAG_LOCALE_NATIVE_PACK_UNSIGNED, DIAG_LOCALE_SERVER_FORMAT_WITHOUT_CONTEXT, DIAG_LOCALE_SERVER_TRANSLATED_ERROR, FORMATTER_DATA_VERSION, LOCALE_CHUNK_MANIFEST_SCHEMA, LOCALE_DELIVERY_CHECK_SCHEMA, LOCALE_DELIVERY_RESOLUTION_SCHEMA, LOCALE_MINI_PACKAGE_PROOF_SCHEMA, LOCALE_NATIVE_PACK_SCHEMA, LOCALE_SERVER_ERROR_ENVELOPE_SCHEMA, } from './locale-schema.js';
10
+ /**
11
+ * @param {unknown} value
12
+ */
13
+ function stableHash(value) {
14
+ return createHash('sha256').update(JSON.stringify(value)).digest('hex').slice(0, 32);
15
+ }
16
+ /**
17
+ * @param {Record<string, string[]>} [fallback]
18
+ */
19
+ export function fallbackDigest(fallback = {}) {
20
+ const keys = Object.keys(fallback).sort();
21
+ const normalized = {};
22
+ for (const k of keys)
23
+ normalized[k] = [...(fallback[k] || [])];
24
+ return stableHash(normalized);
25
+ }
26
+ /**
27
+ * Hash reachable message variants for one locale.
28
+ * @param {Array<{ messageId: string, variants: Record<string, { template: string }> }>} messages
29
+ * @param {string} localeId
30
+ * @param {string[]} [reachableIds]
31
+ */
32
+ export function messageCatalogHash(messages, localeId, reachableIds) {
33
+ const allow = reachableIds ? new Set(reachableIds) : null;
34
+ /** @type {Record<string, string>} */
35
+ const slice = {};
36
+ for (const m of messages || []) {
37
+ if (allow && !allow.has(m.messageId))
38
+ continue;
39
+ const t = m.variants?.[localeId]?.template;
40
+ if (t != null)
41
+ slice[m.messageId] = t;
42
+ }
43
+ const ordered = Object.keys(slice)
44
+ .sort()
45
+ .map((k) => [k, slice[k]]);
46
+ return stableHash(ordered);
47
+ }
48
+ /**
49
+ * Build LocaleDeliveryResolution for one Host surface.
50
+ * @param {{
51
+ * host: 'web'|'mini'|'native'|'server',
52
+ * applicationId: string,
53
+ * deliveryId: string,
54
+ * planVersion?: string,
55
+ * supportedLocales: string[],
56
+ * defaultLocale: string,
57
+ * fallback?: Record<string, string[]>,
58
+ * routingRealization?: unknown,
59
+ * messages: Array<{ messageId: string, variants: Record<string, { template: string }> }>,
60
+ * reachableMessageIds?: string[],
61
+ * bundledLocales?: string[],
62
+ * allowFullClientBundle?: boolean,
63
+ * }} input
64
+ */
65
+ export function buildLocaleDeliveryResolution(input) {
66
+ /** @type {any[]} */
67
+ const diagnostics = [];
68
+ const supported = [...(input.supportedLocales || [])];
69
+ const defaultLocale = input.defaultLocale;
70
+ const reachable = input.reachableMessageIds || (input.messages || []).map((m) => m.messageId);
71
+ const bundled = input.bundledLocales && input.bundledLocales.length ? [...input.bundledLocales] : [defaultLocale];
72
+ // Never default-ship every locale into a client bundle.
73
+ if ((input.host === 'web' || input.host === 'mini') &&
74
+ bundled.length >= supported.length &&
75
+ supported.length > 1 &&
76
+ !input.allowFullClientBundle) {
77
+ diagnostics.push({
78
+ code: DIAG_LOCALE_DELIVERY_FULL_BUNDLE,
79
+ severity: 'error',
80
+ message: `${input.host} delivery must not bundle all ${supported.length} locales by default`,
81
+ });
82
+ }
83
+ /** @type {Record<string, string>} */
84
+ const messageCatalogHashes = {};
85
+ for (const loc of supported) {
86
+ messageCatalogHashes[loc] = messageCatalogHash(input.messages, loc, reachable);
87
+ }
88
+ /** @type {any[]} */
89
+ const lazyLocaleChunks = [];
90
+ for (const loc of supported) {
91
+ if (bundled.includes(loc))
92
+ continue;
93
+ lazyLocaleChunks.push({
94
+ schema: LOCALE_CHUNK_MANIFEST_SCHEMA,
95
+ localeId: loc,
96
+ host: input.host,
97
+ messageIds: reachable,
98
+ hash: messageCatalogHashes[loc],
99
+ kind: input.host === 'mini' ? 'subpackage_module' : 'locale_chunk',
100
+ });
101
+ }
102
+ const bundledChunks = bundled.map((loc) => ({
103
+ schema: LOCALE_CHUNK_MANIFEST_SCHEMA,
104
+ localeId: loc,
105
+ host: input.host,
106
+ messageIds: reachable,
107
+ hash: messageCatalogHashes[loc],
108
+ kind: input.host === 'server' ? 'server_resources' : 'bundled',
109
+ }));
110
+ return {
111
+ schema: LOCALE_DELIVERY_RESOLUTION_SCHEMA,
112
+ status: diagnostics.length ? 'failed' : 'ready',
113
+ host: input.host,
114
+ applicationId: input.applicationId,
115
+ deliveryId: input.deliveryId,
116
+ planVersion: input.planVersion || 'plan.v0',
117
+ supportedLocales: supported,
118
+ defaultLocale,
119
+ fallbackDigest: fallbackDigest(input.fallback),
120
+ routingRealization: input.routingRealization || null,
121
+ bundledLocales: bundled,
122
+ lazyLocaleChunks,
123
+ bundledChunks,
124
+ formatterDataVersion: FORMATTER_DATA_VERSION,
125
+ messageCatalogHashes,
126
+ reachableMessageIds: reachable,
127
+ diagnostics,
128
+ };
129
+ }
130
+ /**
131
+ * Validate a Native optional locale pack (signed, no JS, bound to app/plan/schema).
132
+ * @param {{
133
+ * pack: {
134
+ * schema?: string,
135
+ * applicationId: string,
136
+ * planVersion: string,
137
+ * localeId: string,
138
+ * signature?: string,
139
+ * catalog?: Record<string, string>,
140
+ * formatterDataVersion?: string,
141
+ * entries?: Array<{ path: string, kind?: string }>,
142
+ * executable?: boolean,
143
+ * },
144
+ * expectedApplicationId: string,
145
+ * expectedPlanVersion: string,
146
+ * }} input
147
+ */
148
+ export function validateNativeLocalePack(input) {
149
+ /** @type {any[]} */
150
+ const diagnostics = [];
151
+ const pack = input.pack || {};
152
+ if (!pack.signature) {
153
+ diagnostics.push({
154
+ code: DIAG_LOCALE_NATIVE_PACK_UNSIGNED,
155
+ severity: 'error',
156
+ message: 'Native locale pack must be signed',
157
+ });
158
+ }
159
+ if (pack.applicationId !== input.expectedApplicationId) {
160
+ diagnostics.push({
161
+ code: DIAG_LOCALE_NATIVE_PACK_APP_MISMATCH,
162
+ severity: 'error',
163
+ message: `pack applicationId ${pack.applicationId} != ${input.expectedApplicationId}`,
164
+ });
165
+ }
166
+ if (pack.planVersion !== input.expectedPlanVersion) {
167
+ diagnostics.push({
168
+ code: DIAG_LOCALE_NATIVE_PACK_APP_MISMATCH,
169
+ severity: 'error',
170
+ message: `pack planVersion ${pack.planVersion} != ${input.expectedPlanVersion}`,
171
+ });
172
+ }
173
+ if (pack.executable === true) {
174
+ diagnostics.push({
175
+ code: DIAG_LOCALE_NATIVE_PACK_HAS_JS,
176
+ severity: 'error',
177
+ message: 'Native locale pack must not carry executable JavaScript',
178
+ });
179
+ }
180
+ for (const e of pack.entries || []) {
181
+ const path = String(e.path || '');
182
+ const kind = String(e.kind || '');
183
+ if (/\.(js|mjs|cjs|wasm)$/i.test(path) || kind === 'javascript' || kind === 'script') {
184
+ diagnostics.push({
185
+ code: DIAG_LOCALE_NATIVE_PACK_HAS_JS,
186
+ severity: 'error',
187
+ message: `Native pack entry forbids executable ${path || kind}`,
188
+ });
189
+ }
190
+ }
191
+ if (pack.formatterDataVersion && pack.formatterDataVersion !== FORMATTER_DATA_VERSION) {
192
+ diagnostics.push({
193
+ code: DIAG_LOCALE_CHUNK_HASH_MISMATCH,
194
+ severity: 'error',
195
+ message: `formatterDataVersion ${pack.formatterDataVersion} != ${FORMATTER_DATA_VERSION}`,
196
+ });
197
+ }
198
+ return {
199
+ schema: LOCALE_NATIVE_PACK_SCHEMA,
200
+ status: diagnostics.length ? 'failed' : 'ready',
201
+ localeId: pack.localeId,
202
+ diagnostics,
203
+ pack: {
204
+ schema: LOCALE_NATIVE_PACK_SCHEMA,
205
+ applicationId: pack.applicationId,
206
+ planVersion: pack.planVersion,
207
+ localeId: pack.localeId,
208
+ signature: pack.signature || null,
209
+ formatterDataVersion: pack.formatterDataVersion || FORMATTER_DATA_VERSION,
210
+ catalogKeys: Object.keys(pack.catalog || {}).sort(),
211
+ },
212
+ };
213
+ }
214
+ /**
215
+ * Mini cross-subpackage message dependencies must be proven.
216
+ * @param {{
217
+ * packages: Array<{ id: string, messageIds: string[] }>,
218
+ * edges: Array<{ fromPackage: string, toPackage: string, messageId: string }>,
219
+ * }} input
220
+ */
221
+ export function proveMiniPackageMessages(input) {
222
+ /** @type {any[]} */
223
+ const diagnostics = [];
224
+ /** @type {Map<string, Set<string>>} */
225
+ const owned = new Map();
226
+ for (const p of input.packages || []) {
227
+ owned.set(p.id, new Set(p.messageIds || []));
228
+ }
229
+ /** @type {any[]} */
230
+ const proven = [];
231
+ for (const edge of input.edges || []) {
232
+ const target = owned.get(edge.toPackage);
233
+ if (!target || !target.has(edge.messageId)) {
234
+ diagnostics.push({
235
+ code: DIAG_LOCALE_MINI_CROSS_PACKAGE_UNPROVEN,
236
+ severity: 'error',
237
+ message: `cross-package message ${edge.messageId}: ${edge.fromPackage} -> ${edge.toPackage} unproven`,
238
+ });
239
+ continue;
240
+ }
241
+ proven.push({
242
+ fromPackage: edge.fromPackage,
243
+ toPackage: edge.toPackage,
244
+ messageId: edge.messageId,
245
+ });
246
+ }
247
+ return {
248
+ schema: LOCALE_MINI_PACKAGE_PROOF_SCHEMA,
249
+ status: diagnostics.length ? 'failed' : 'ready',
250
+ proven,
251
+ diagnostics,
252
+ };
253
+ }
254
+ /**
255
+ * Server/client boundary: ErrorCode + params only (no translated strings).
256
+ * @param {any} payload
257
+ */
258
+ export function assertServerErrorEnvelope(payload) {
259
+ /** @type {any[]} */
260
+ const diagnostics = [];
261
+ if (payload == null || typeof payload !== 'object') {
262
+ diagnostics.push({
263
+ code: DIAG_LOCALE_SERVER_TRANSLATED_ERROR,
264
+ severity: 'error',
265
+ message: 'server error envelope must be an object',
266
+ });
267
+ return { schema: LOCALE_SERVER_ERROR_ENVELOPE_SCHEMA, status: 'failed', diagnostics };
268
+ }
269
+ if (typeof payload.message === 'string' || typeof payload.text === 'string' || typeof payload.localized === 'string') {
270
+ diagnostics.push({
271
+ code: DIAG_LOCALE_SERVER_TRANSLATED_ERROR,
272
+ severity: 'error',
273
+ message: 'server must not cross boundary with translated error strings',
274
+ });
275
+ }
276
+ if (typeof payload.code !== 'string' || !payload.code) {
277
+ diagnostics.push({
278
+ code: DIAG_LOCALE_SERVER_TRANSLATED_ERROR,
279
+ severity: 'error',
280
+ message: 'server error envelope requires stable ErrorCode `code`',
281
+ });
282
+ }
283
+ return {
284
+ schema: LOCALE_SERVER_ERROR_ENVELOPE_SCHEMA,
285
+ status: diagnostics.length ? 'failed' : 'ready',
286
+ envelope: {
287
+ schema: LOCALE_SERVER_ERROR_ENVELOPE_SCHEMA,
288
+ code: payload.code,
289
+ params: payload.params || {},
290
+ },
291
+ diagnostics,
292
+ };
293
+ }
294
+ /**
295
+ * Final-user server formatting (mail/export/push) requires explicit LocaleContext.
296
+ * @param {{ localeContext?: { localeId?: string, timeZone?: string }|null, purpose: string }} input
297
+ */
298
+ export function assertServerFormatContext(input) {
299
+ /** @type {any[]} */
300
+ const diagnostics = [];
301
+ const ctx = input.localeContext;
302
+ if (!ctx?.localeId || !ctx?.timeZone) {
303
+ diagnostics.push({
304
+ code: DIAG_LOCALE_SERVER_FORMAT_WITHOUT_CONTEXT,
305
+ severity: 'error',
306
+ message: `server ${input.purpose} formatting requires explicit LocaleContext`,
307
+ });
308
+ }
309
+ return { ok: diagnostics.length === 0, diagnostics };
310
+ }
311
+ /**
312
+ * Same MessageId / catalog hashes must agree across Host projections.
313
+ * @param {Array<ReturnType<typeof buildLocaleDeliveryResolution>>} resolutions
314
+ */
315
+ export function assertHostMessageInvariant(resolutions) {
316
+ /** @type {any[]} */
317
+ const diagnostics = [];
318
+ if (!resolutions?.length)
319
+ return { ok: true, diagnostics };
320
+ const base = resolutions[0];
321
+ for (const r of resolutions.slice(1)) {
322
+ for (const loc of base.supportedLocales || []) {
323
+ if (base.messageCatalogHashes[loc] !== r.messageCatalogHashes?.[loc]) {
324
+ diagnostics.push({
325
+ code: DIAG_LOCALE_HOST_MESSAGE_DIVERGENCE,
326
+ severity: 'error',
327
+ message: `messageCatalogHashes[${loc}] diverge between ${base.host} and ${r.host}`,
328
+ });
329
+ }
330
+ }
331
+ if (base.formatterDataVersion !== r.formatterDataVersion) {
332
+ diagnostics.push({
333
+ code: DIAG_LOCALE_HOST_MESSAGE_DIVERGENCE,
334
+ severity: 'error',
335
+ message: `formatterDataVersion diverge between ${base.host} and ${r.host}`,
336
+ });
337
+ }
338
+ if (base.fallbackDigest !== r.fallbackDigest) {
339
+ diagnostics.push({
340
+ code: DIAG_LOCALE_HOST_MESSAGE_DIVERGENCE,
341
+ severity: 'error',
342
+ message: `fallbackDigest diverge between ${base.host} and ${r.host}`,
343
+ });
344
+ }
345
+ }
346
+ return { ok: diagnostics.length === 0, diagnostics };
347
+ }
348
+ /**
349
+ * Aggregate delivery proof for fixture / CLI.
350
+ * @param {{
351
+ * manifest: {
352
+ * defaultLocale: string,
353
+ * locales: Array<{ id: string }>,
354
+ * fallback?: Record<string, string[]>,
355
+ * routing?: unknown,
356
+ * },
357
+ * messages: Array<{ messageId: string, variants: Record<string, { template: string }> }>,
358
+ * applicationId?: string,
359
+ * planVersion?: string,
360
+ * reachableMessageIds?: string[],
361
+ * }} input
362
+ */
363
+ export function checkLocaleDelivery(input) {
364
+ /** @type {any[]} */
365
+ const diagnostics = [];
366
+ const supported = (input.manifest?.locales || []).map((l) => l.id);
367
+ const defaultLocale = input.manifest?.defaultLocale;
368
+ const messages = input.messages || [];
369
+ const reachable = input.reachableMessageIds || messages.map((m) => m.messageId);
370
+ const common = {
371
+ applicationId: input.applicationId || 'app.locales-fixture',
372
+ deliveryId: 'delivery.multi',
373
+ planVersion: input.planVersion || 'plan.v0',
374
+ supportedLocales: supported,
375
+ defaultLocale,
376
+ fallback: input.manifest?.fallback || {},
377
+ routingRealization: input.manifest?.routing || null,
378
+ messages,
379
+ reachableMessageIds: reachable,
380
+ bundledLocales: [defaultLocale],
381
+ };
382
+ const web = buildLocaleDeliveryResolution({ ...common, host: 'web', deliveryId: 'delivery.web' });
383
+ const mini = buildLocaleDeliveryResolution({ ...common, host: 'mini', deliveryId: 'delivery.mini' });
384
+ const native = buildLocaleDeliveryResolution({
385
+ ...common,
386
+ host: 'native',
387
+ deliveryId: 'delivery.native',
388
+ });
389
+ const server = buildLocaleDeliveryResolution({
390
+ ...common,
391
+ host: 'server',
392
+ deliveryId: 'delivery.server',
393
+ // server may include all reachable locales as resources (not a client bundle)
394
+ bundledLocales: supported,
395
+ allowFullClientBundle: true,
396
+ });
397
+ for (const r of [web, mini, native, server])
398
+ diagnostics.push(...r.diagnostics);
399
+ const invariant = assertHostMessageInvariant([web, mini, native, server]);
400
+ diagnostics.push(...invariant.diagnostics);
401
+ const packOk = validateNativeLocalePack({
402
+ pack: {
403
+ applicationId: common.applicationId,
404
+ planVersion: common.planVersion,
405
+ localeId: 'en-us',
406
+ signature: 'sig.test',
407
+ catalog: { 'account.actions.save': 'Save' },
408
+ formatterDataVersion: FORMATTER_DATA_VERSION,
409
+ entries: [{ path: 'catalog.json5', kind: 'catalog' }],
410
+ },
411
+ expectedApplicationId: common.applicationId,
412
+ expectedPlanVersion: common.planVersion,
413
+ });
414
+ // Probe only — do not fail delivery check if packOk ready.
415
+ if (packOk.status !== 'ready')
416
+ diagnostics.push(...packOk.diagnostics);
417
+ const miniProof = proveMiniPackageMessages({
418
+ packages: [
419
+ { id: 'main', messageIds: ['account.actions.save'] },
420
+ { id: 'pkg-account', messageIds: ['account.greeting', 'account.itemCount'] },
421
+ ],
422
+ edges: [{ fromPackage: 'main', toPackage: 'pkg-account', messageId: 'account.greeting' }],
423
+ });
424
+ if (miniProof.status !== 'ready')
425
+ diagnostics.push(...miniProof.diagnostics);
426
+ const errOk = assertServerErrorEnvelope({
427
+ code: 'account.email_taken',
428
+ params: { email: 'a@b.c' },
429
+ });
430
+ if (errOk.status !== 'ready')
431
+ diagnostics.push(...errOk.diagnostics);
432
+ const hasErrors = diagnostics.some((d) => d.severity === 'error');
433
+ return {
434
+ schema: LOCALE_DELIVERY_CHECK_SCHEMA,
435
+ status: hasErrors ? 'failed' : 'ready',
436
+ resolutions: { web, mini, native, server },
437
+ nativePackProbe: packOk,
438
+ miniPackageProof: miniProof,
439
+ serverErrorEnvelope: errOk,
440
+ formatterDataVersion: FORMATTER_DATA_VERSION,
441
+ diagnostics,
442
+ };
443
+ }
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Locale router / PageMeta: route realization · canonical · hreflang ·
3
+ * Link locale retain · locale-aware cache key.
4
+ *
5
+ * LocaleId is a RouteNode realization dimension — not part of stable RouteId.
6
+ */
7
+ /**
8
+ * Join locale prefix with a stable route path pattern.
9
+ * @param {string} localeId
10
+ * @param {string} pathPattern stable path without locale (e.g. /account/profile)
11
+ * @param {{ strategy?: string, defaultPrefix?: string, defaultLocale?: string }} routing
12
+ */
13
+ export declare function realizeRoutePath(localeId: any, pathPattern: any, routing?: {}): {
14
+ schema: string;
15
+ localeId: any;
16
+ path: string;
17
+ prefixed: boolean;
18
+ strategy: any;
19
+ defaultPrefix?: undefined;
20
+ } | {
21
+ schema: string;
22
+ localeId: any;
23
+ path: string;
24
+ prefixed: boolean;
25
+ strategy: string;
26
+ defaultPrefix: any;
27
+ };
28
+ /**
29
+ * Build RouteId × LocaleId realization table.
30
+ * @param {{
31
+ * routes: Array<{ routeId: string, path: string }>,
32
+ * locales: string[],
33
+ * defaultLocale: string,
34
+ * routing?: { strategy?: string, defaultPrefix?: string },
35
+ * }} input
36
+ */
37
+ export declare function buildLocaleRouteRealizationTable(input: any): {
38
+ schema: string;
39
+ status: string;
40
+ routing: {
41
+ strategy: any;
42
+ defaultPrefix: any;
43
+ defaultLocale: any;
44
+ };
45
+ realizations: any[];
46
+ diagnostics: any[];
47
+ };
48
+ /**
49
+ * Absolute URL helper.
50
+ * @param {string} origin
51
+ * @param {string} path
52
+ */
53
+ export declare function absoluteUrl(origin: any, path: any): string;
54
+ /**
55
+ * Locale-aware PageMeta for one RouteId × LocaleId.
56
+ * @param {{
57
+ * routeId: string,
58
+ * localeId: string,
59
+ * direction?: string,
60
+ * title: string,
61
+ * description?: string,
62
+ * origin: string,
63
+ * realizations: Array<{ routeId: string, localeId: string, path: string }>,
64
+ * locales: string[],
65
+ * defaultLocale: string,
66
+ * }} input
67
+ */
68
+ export declare function buildLocalePageMeta(input: any): {
69
+ schema: string;
70
+ routeId: any;
71
+ locale: any;
72
+ htmlLang: any;
73
+ dir: any;
74
+ title: any;
75
+ description: any;
76
+ canonical: string;
77
+ alternates: any[];
78
+ diagnostics: any[];
79
+ status: string;
80
+ };
81
+ /**
82
+ * `<Link to="routeId">` retains current locale — never hand-written localized paths.
83
+ * @param {{
84
+ * to: string,
85
+ * currentLocale: string,
86
+ * realizations: Array<{ routeId: string, localeId: string, path: string }>,
87
+ * }} input
88
+ */
89
+ export declare function resolveLinkHref(input: any): {
90
+ schema: string;
91
+ status: string;
92
+ to: any;
93
+ href: any;
94
+ localeId: any;
95
+ diagnostics: {
96
+ code: string;
97
+ severity: string;
98
+ message: string;
99
+ }[];
100
+ routeId?: undefined;
101
+ } | {
102
+ schema: string;
103
+ status: string;
104
+ to: any;
105
+ routeId: any;
106
+ localeId: any;
107
+ href: any;
108
+ diagnostics: any[];
109
+ };
110
+ /**
111
+ * Parse locale prefix from a pathname under prefix strategy.
112
+ * @param {string} pathname
113
+ * @param {string[]} supportedLocales
114
+ */
115
+ export declare function parseLocaleFromPath(pathname: any, supportedLocales: any): {
116
+ localeId: string;
117
+ restPath: string;
118
+ };
119
+ /**
120
+ * Plan redirect / negotiation for an incoming URL (omit-prefix aware).
121
+ * @param {{
122
+ * pathname: string,
123
+ * supportedLocales: string[],
124
+ * defaultLocale: string,
125
+ * routing?: { strategy?: string, defaultPrefix?: string },
126
+ * hostCandidates?: string[],
127
+ * preference?: string|null,
128
+ * userChoice?: string|null,
129
+ * }} input
130
+ */
131
+ export declare function planLocalePathNavigation(input: any): {
132
+ schema: string;
133
+ kind: string;
134
+ pathname: string;
135
+ routeLocale: string;
136
+ negotiatedLocale: any;
137
+ restPath: string;
138
+ redirectTo: any;
139
+ realizedPath: string;
140
+ diagnostics: any[];
141
+ contentLocale: any;
142
+ };
143
+ /**
144
+ * Locale-aware cache key — must include LocaleId so Accept-Language cannot steal content.
145
+ * @param {{ routeId: string, localeId: string, path: string }} input
146
+ */
147
+ export declare function localeAwareCacheKey(input: any): string;
148
+ /**
149
+ * Reject Vary: Accept-Language on a cache key that does not encode LocaleId.
150
+ * @param {{ cacheKey: string, varyAcceptLanguage?: boolean, localeId?: string }} input
151
+ */
152
+ export declare function assertLocaleCacheKey(input: any): {
153
+ ok: boolean;
154
+ diagnostics: any[];
155
+ };
156
+ /**
157
+ * LocaleTransition must commit Route realization + PageMeta together.
158
+ * @param {{
159
+ * fromLocale: string,
160
+ * toLocale: string,
161
+ * routeId: string,
162
+ * realizations: Array<{ routeId: string, localeId: string, path: string }>,
163
+ * pageMetaByLocale: Record<string, { locale: string, canonical: string }>,
164
+ * }} input
165
+ */
166
+ export declare function commitLocaleRouteMetaTransition(input: any): {
167
+ schema: string;
168
+ kind: string;
169
+ status: string;
170
+ fromLocale: any;
171
+ toLocale: any;
172
+ fromPath: any;
173
+ toPath: any;
174
+ pageMeta: any;
175
+ diagnostics: any[];
176
+ };
177
+ /**
178
+ * Aggregate router/meta proof.
179
+ * @param {{
180
+ * manifest: {
181
+ * defaultLocale: string,
182
+ * locales: Array<{ id: string, direction?: string }>,
183
+ * routing?: { strategy?: string, defaultPrefix?: string },
184
+ * },
185
+ * routes: Array<{ routeId: string, path: string }>,
186
+ * titles?: Record<string, Record<string, string>>,
187
+ * origin?: string,
188
+ * }} input
189
+ */
190
+ export declare function checkLocaleRouter(input: any): {
191
+ schema: string;
192
+ status: string;
193
+ realizationTable: {
194
+ schema: string;
195
+ status: string;
196
+ routing: {
197
+ strategy: any;
198
+ defaultPrefix: any;
199
+ defaultLocale: any;
200
+ };
201
+ realizations: any[];
202
+ diagnostics: any[];
203
+ };
204
+ pageMetas: any[];
205
+ diagnostics: any[];
206
+ };