@vmz/vmz 0.1.17 → 0.1.18

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 (131) hide show
  1. package/dist/application-cmd.d.ts +6 -16
  2. package/dist/application-cmd.js +34 -180
  3. package/dist/author-input.d.ts +40 -19
  4. package/dist/author-input.js +2 -16
  5. package/dist/build-assemble.d.ts +63 -41
  6. package/dist/build-assemble.js +42 -43
  7. package/dist/bundler-adapter.d.ts +46 -48
  8. package/dist/bundler-adapter.js +4 -43
  9. package/dist/cdn-policy.d.ts +77 -93
  10. package/dist/cdn-policy.js +10 -16
  11. package/dist/cli-localize.d.ts +34 -0
  12. package/dist/cli-localize.js +58 -0
  13. package/dist/cli.d.ts +8 -19
  14. package/dist/cli.js +69 -252
  15. package/dist/content-addressed-assets.d.ts +24 -10
  16. package/dist/content-addressed-assets.js +2 -7
  17. package/dist/delivery-profile.d.ts +54 -27
  18. package/dist/delivery-profile.js +15 -13
  19. package/dist/dev-session.d.ts +29 -23
  20. package/dist/dev-session.js +0 -21
  21. package/dist/dev-watch-roots.d.ts +34 -25
  22. package/dist/dev-watch-roots.js +0 -31
  23. package/dist/document-build.d.ts +22 -97
  24. package/dist/document-build.js +4 -19
  25. package/dist/document-check.d.ts +30 -53
  26. package/dist/document-check.js +14 -29
  27. package/dist/document-cmd.d.ts +3 -6
  28. package/dist/document-cmd.js +19 -79
  29. package/dist/document-designs.d.ts +5 -8
  30. package/dist/document-designs.js +2 -15
  31. package/dist/document-enrich.d.ts +52 -24
  32. package/dist/document-enrich.js +4 -32
  33. package/dist/document-evidence.d.ts +46 -43
  34. package/dist/document-evidence.js +6 -47
  35. package/dist/document-integrate.d.ts +13 -29
  36. package/dist/document-integrate.js +2 -13
  37. package/dist/document-interactive.d.ts +45 -67
  38. package/dist/document-interactive.js +9 -50
  39. package/dist/document-layout-render.d.ts +7 -16
  40. package/dist/document-layout-render.js +0 -17
  41. package/dist/document-locale.d.ts +12 -25
  42. package/dist/document-locale.js +3 -14
  43. package/dist/document-markdown.d.ts +9 -5
  44. package/dist/document-markdown.js +0 -4
  45. package/dist/document-routing-config.d.ts +7 -14
  46. package/dist/document-routing-config.js +0 -9
  47. package/dist/document-scan.d.ts +14 -18
  48. package/dist/document-scan.js +2 -23
  49. package/dist/document-schema.d.ts +154 -41
  50. package/dist/document-schema.js +0 -35
  51. package/dist/embedded-packaging.d.ts +20 -8
  52. package/dist/embedded-packaging.js +0 -1
  53. package/dist/explain-cmd.d.ts +4 -3
  54. package/dist/explain-cmd.js +16 -65
  55. package/dist/index.d.ts +70 -143
  56. package/dist/index.js +16 -136
  57. package/dist/invocation.d.ts +29 -50
  58. package/dist/invocation.js +11 -57
  59. package/dist/locale-check.d.ts +69 -70
  60. package/dist/locale-check.js +5 -66
  61. package/dist/locale-cmd.d.ts +2 -5
  62. package/dist/locale-cmd.js +62 -142
  63. package/dist/locale-delivery.d.ts +294 -191
  64. package/dist/locale-delivery.js +8 -94
  65. package/dist/locale-route-emit.d.ts +23 -9
  66. package/dist/locale-route-emit.js +0 -7
  67. package/dist/locale-router.d.ts +189 -162
  68. package/dist/locale-router.js +13 -122
  69. package/dist/locale-runtime.d.ts +292 -262
  70. package/dist/locale-runtime.js +8 -102
  71. package/dist/locale-schema.js +0 -1
  72. package/dist/locale-tooling.d.ts +100 -63
  73. package/dist/locale-tooling.js +7 -45
  74. package/dist/log.d.ts +22 -15
  75. package/dist/log.js +24 -21
  76. package/dist/native-addon.d.ts +10 -9
  77. package/dist/native-addon.js +1 -10
  78. package/dist/pack-client-packages.d.ts +5 -1
  79. package/dist/pack-client-packages.js +0 -6
  80. package/dist/pack.d.ts +17 -15
  81. package/dist/pack.js +0 -12
  82. package/dist/packages.d.ts +10 -23
  83. package/dist/packages.js +1 -37
  84. package/dist/plan-cmd.d.ts +6 -0
  85. package/dist/plan-cmd.js +35 -0
  86. package/dist/plugin-host.js +0 -1
  87. package/dist/port.d.ts +2 -10
  88. package/dist/port.js +2 -11
  89. package/dist/pretty-json.d.ts +9 -19
  90. package/dist/pretty-json.js +3 -17
  91. package/dist/production-observability.d.ts +37 -181
  92. package/dist/production-observability.js +1 -9
  93. package/dist/production-test-pack.d.ts +17 -3
  94. package/dist/production-test-pack.js +0 -2
  95. package/dist/public-static-assets.d.ts +6 -1
  96. package/dist/public-static-assets.js +0 -5
  97. package/dist/refactor-cmd.d.ts +3 -6
  98. package/dist/refactor-cmd.js +16 -69
  99. package/dist/release-cmd.d.ts +7 -6
  100. package/dist/release-cmd.js +17 -59
  101. package/dist/release-pack.d.ts +7 -3
  102. package/dist/release-pack.js +0 -6
  103. package/dist/resolve.d.ts +15 -19
  104. package/dist/resolve.js +1 -15
  105. package/dist/server-artifact.d.ts +30 -75
  106. package/dist/server-artifact.js +0 -10
  107. package/dist/server-language-backend.d.ts +22 -79
  108. package/dist/server-language-backend.js +0 -26
  109. package/dist/site-delivery.d.ts +46 -59
  110. package/dist/site-delivery.js +3 -8
  111. package/dist/site-favicon.d.ts +6 -1
  112. package/dist/site-favicon.js +0 -5
  113. package/dist/static-emit.d.ts +73 -103
  114. package/dist/static-emit.js +1 -26
  115. package/dist/test-cmd.d.ts +3 -5
  116. package/dist/test-cmd.js +15 -25
  117. package/dist/test-compile.js +0 -1
  118. package/dist/test-discover.js +0 -1
  119. package/dist/test-logic.js +0 -1
  120. package/dist/test-protocol.js +0 -1
  121. package/dist/toolchain-dx.d.ts +11 -0
  122. package/dist/toolchain-dx.js +10 -0
  123. package/dist/watch-diff.d.ts +4 -13
  124. package/dist/watch-diff.js +0 -17
  125. package/dist/wechat-packaging.d.ts +8 -7
  126. package/dist/wechat-packaging.js +0 -6
  127. package/locales/en-US/cli.json +105 -0
  128. package/locales/locales.json +4 -0
  129. package/package.json +15 -12
  130. package/dist/resolve-native-cli.d.ts +0 -14
  131. package/dist/resolve-native-cli.js +0 -84
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Locale multi-host delivery: Web chunks · Mini packages · Native packs ·
4
3
  * Server error envelope / formatter resources.
@@ -7,15 +6,9 @@
7
6
  */
8
7
  import { createHash } from 'node:crypto';
9
8
  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
9
  function stableHash(value) {
14
10
  return createHash('sha256').update(JSON.stringify(value)).digest('hex').slice(0, 32);
15
11
  }
16
- /**
17
- * @param {Record<string, string[]>} [fallback]
18
- */
19
12
  export function fallbackDigest(fallback = {}) {
20
13
  const keys = Object.keys(fallback).sort();
21
14
  const normalized = {};
@@ -23,15 +16,9 @@ export function fallbackDigest(fallback = {}) {
23
16
  normalized[k] = [...(fallback[k] || [])];
24
17
  return stableHash(normalized);
25
18
  }
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
- */
19
+ /** Hash reachable message variants for one locale. */
32
20
  export function messageCatalogHash(messages, localeId, reachableIds) {
33
21
  const allow = reachableIds ? new Set(reachableIds) : null;
34
- /** @type {Record<string, string>} */
35
22
  const slice = {};
36
23
  for (const m of messages || []) {
37
24
  if (allow && !allow.has(m.messageId))
@@ -45,25 +32,8 @@ export function messageCatalogHash(messages, localeId, reachableIds) {
45
32
  .map((k) => [k, slice[k]]);
46
33
  return stableHash(ordered);
47
34
  }
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
- */
35
+ /** Build LocaleDeliveryResolution for one Host surface. */
65
36
  export function buildLocaleDeliveryResolution(input) {
66
- /** @type {any[]} */
67
37
  const diagnostics = [];
68
38
  const supported = [...(input.supportedLocales || [])];
69
39
  const defaultLocale = input.defaultLocale;
@@ -80,12 +50,10 @@ export function buildLocaleDeliveryResolution(input) {
80
50
  message: `${input.host} delivery must not bundle all ${supported.length} locales by default`,
81
51
  });
82
52
  }
83
- /** @type {Record<string, string>} */
84
53
  const messageCatalogHashes = {};
85
54
  for (const loc of supported) {
86
55
  messageCatalogHashes[loc] = messageCatalogHash(input.messages, loc, reachable);
87
56
  }
88
- /** @type {any[]} */
89
57
  const lazyLocaleChunks = [];
90
58
  for (const loc of supported) {
91
59
  if (bundled.includes(loc))
@@ -127,26 +95,8 @@ export function buildLocaleDeliveryResolution(input) {
127
95
  diagnostics,
128
96
  };
129
97
  }
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
- */
98
+ /** Validate a Native optional locale pack (signed, no JS, bound to app/plan/schema). */
148
99
  export function validateNativeLocalePack(input) {
149
- /** @type {any[]} */
150
100
  const diagnostics = [];
151
101
  const pack = input.pack || {};
152
102
  if (!pack.signature) {
@@ -211,22 +161,13 @@ export function validateNativeLocalePack(input) {
211
161
  },
212
162
  };
213
163
  }
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
- */
164
+ /** Mini cross-subpackage message dependencies must be proven. */
221
165
  export function proveMiniPackageMessages(input) {
222
- /** @type {any[]} */
223
166
  const diagnostics = [];
224
- /** @type {Map<string, Set<string>>} */
225
167
  const owned = new Map();
226
168
  for (const p of input.packages || []) {
227
169
  owned.set(p.id, new Set(p.messageIds || []));
228
170
  }
229
- /** @type {any[]} */
230
171
  const proven = [];
231
172
  for (const edge of input.edges || []) {
232
173
  const target = owned.get(edge.toPackage);
@@ -251,12 +192,8 @@ export function proveMiniPackageMessages(input) {
251
192
  diagnostics,
252
193
  };
253
194
  }
254
- /**
255
- * Server/client boundary: ErrorCode + params only (no translated strings).
256
- * @param {any} payload
257
- */
195
+ /** Server/client boundary: ErrorCode + params only (no translated strings). */
258
196
  export function assertServerErrorEnvelope(payload) {
259
- /** @type {any[]} */
260
197
  const diagnostics = [];
261
198
  if (payload == null || typeof payload !== 'object') {
262
199
  diagnostics.push({
@@ -291,12 +228,8 @@ export function assertServerErrorEnvelope(payload) {
291
228
  diagnostics,
292
229
  };
293
230
  }
294
- /**
295
- * Final-user server formatting (mail/export/push) requires explicit LocaleContext.
296
- * @param {{ localeContext?: { localeId?: string, timeZone?: string }|null, purpose: string }} input
297
- */
231
+ /** Final-user server formatting (mail/export/push) requires explicit LocaleContext. */
298
232
  export function assertServerFormatContext(input) {
299
- /** @type {any[]} */
300
233
  const diagnostics = [];
301
234
  const ctx = input.localeContext;
302
235
  if (!ctx?.localeId || !ctx?.timeZone) {
@@ -308,12 +241,8 @@ export function assertServerFormatContext(input) {
308
241
  }
309
242
  return { ok: diagnostics.length === 0, diagnostics };
310
243
  }
311
- /**
312
- * Same MessageId / catalog hashes must agree across Host projections.
313
- * @param {Array<ReturnType<typeof buildLocaleDeliveryResolution>>} resolutions
314
- */
244
+ /** Same MessageId / catalog hashes must agree across Host projections. */
315
245
  export function assertHostMessageInvariant(resolutions) {
316
- /** @type {any[]} */
317
246
  const diagnostics = [];
318
247
  if (!resolutions?.length)
319
248
  return { ok: true, diagnostics };
@@ -345,23 +274,8 @@ export function assertHostMessageInvariant(resolutions) {
345
274
  }
346
275
  return { ok: diagnostics.length === 0, diagnostics };
347
276
  }
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
- */
277
+ /** Aggregate delivery proof for fixture / CLI. */
363
278
  export function checkLocaleDelivery(input) {
364
- /** @type {any[]} */
365
279
  const diagnostics = [];
366
280
  const supported = (input.manifest?.locales || []).map((l) => l.id);
367
281
  const defaultLocale = input.manifest?.defaultLocale;
@@ -3,15 +3,13 @@
3
3
  * Consumed by serve-host + static-emit; LocaleId stays out of stable RouteId.
4
4
  */
5
5
  export declare const LOCALE_ROUTE_REALIZATION_ARTIFACT_SCHEMA = "vmz.locale.route_realization.v0";
6
- /**
7
- * @param {string} projectRoot
8
- * @param {string} distDir
9
- * @param {{ origin?: string }} [opts]
10
- */
11
- export declare function emitLocaleRouteRealization(projectRoot: any, distDir: any, opts?: {}): {
6
+ export interface EmitLocaleRouteRealizationOpts {
7
+ origin?: string;
8
+ }
9
+ export declare function emitLocaleRouteRealization(projectRoot: string, distDir: string, opts?: EmitLocaleRouteRealizationOpts): {
12
10
  ok: boolean;
13
11
  written: any[];
14
- diagnostics: any;
12
+ diagnostics: import("./locale-check.js").LocaleDiagnostic[];
15
13
  artifact: any;
16
14
  } | {
17
15
  ok: boolean;
@@ -30,8 +28,24 @@ export declare function emitLocaleRouteRealization(projectRoot: any, distDir: an
30
28
  routeId: string;
31
29
  path: string;
32
30
  }[];
33
- realizations: any[];
34
- pageMetas: any[];
31
+ realizations: import("./locale-router.js").LocaleRealization[];
32
+ pageMetas: {
33
+ schema: string;
34
+ routeId: string;
35
+ locale: string;
36
+ htmlLang: string;
37
+ dir: string;
38
+ title: string;
39
+ description: string;
40
+ canonical: string;
41
+ alternates: {
42
+ localeId: string;
43
+ hreflang: string;
44
+ href: string;
45
+ }[];
46
+ diagnostics: import("./locale-router.js").LocaleDiagnostic[];
47
+ status: string;
48
+ }[];
35
49
  };
36
50
  diagnostics: any[];
37
51
  };
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Emit RouteId × LocaleId realization (+ PageMeta / hreflang seed) into dist/_vmz.
4
3
  * Consumed by serve-host + static-emit; LocaleId stays out of stable RouteId.
@@ -10,11 +9,6 @@ import { buildLocalePageMeta, buildLocaleRouteRealizationTable } from './locale-
10
9
  import { writePrettyJsonFile } from './pretty-json.js';
11
10
  import { listPublicPageUnits, unitBrowserPathPattern } from './route-path.js';
12
11
  export const LOCALE_ROUTE_REALIZATION_ARTIFACT_SCHEMA = 'vmz.locale.route_realization.v0';
13
- /**
14
- * @param {string} projectRoot
15
- * @param {string} distDir
16
- * @param {{ origin?: string }} [opts]
17
- */
18
12
  export function emitLocaleRouteRealization(projectRoot, distDir, opts = {}) {
19
13
  const report = checkLocales({ projectRoot, checkUnused: false });
20
14
  if (localeHasErrors(report)) {
@@ -54,7 +48,6 @@ export function emitLocaleRouteRealization(projectRoot, distDir, opts = {}) {
54
48
  return { ok: false, written: [], diagnostics: table.diagnostics || [], artifact: null };
55
49
  }
56
50
  const origin = String(opts.origin || process.env.VMZ_SITE_ORIGIN || 'https://example.test').replace(/\/$/, '');
57
- /** @type {any[]} */
58
51
  const pageMetas = [];
59
52
  for (const route of routes) {
60
53
  for (const loc of locales) {
@@ -4,94 +4,112 @@
4
4
  *
5
5
  * LocaleId is a RouteNode realization dimension — not part of stable RouteId.
6
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?: {}): {
7
+ export interface LocaleRoutingOpts {
8
+ strategy?: string;
9
+ defaultPrefix?: string;
10
+ defaultLocale?: string;
11
+ }
12
+ export interface LocaleRouteEntry {
13
+ routeId: string;
14
+ path: string;
15
+ }
16
+ export interface LocaleRealization {
17
+ routeId: string;
18
+ localeId: string;
19
+ path: string;
20
+ pathPattern?: string;
21
+ prefixed?: boolean;
22
+ strategy?: string;
23
+ defaultPrefix?: string;
24
+ schema?: string;
25
+ }
26
+ export interface LocaleDiagnostic {
27
+ code: string;
28
+ severity: string;
29
+ message: string;
30
+ }
31
+ /** Join locale prefix with a stable route path pattern. */
32
+ export declare function realizeRoutePath(localeId: string, pathPattern: string, routing?: LocaleRoutingOpts): {
14
33
  schema: string;
15
- localeId: any;
34
+ localeId: string;
16
35
  path: string;
17
36
  prefixed: boolean;
18
- strategy: any;
37
+ strategy: string;
19
38
  defaultPrefix?: undefined;
20
39
  } | {
21
40
  schema: string;
22
- localeId: any;
41
+ localeId: string;
23
42
  path: string;
24
43
  prefixed: boolean;
25
44
  strategy: string;
26
- defaultPrefix: any;
45
+ defaultPrefix: string;
27
46
  };
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): {
47
+ /** Build RouteId × LocaleId realization table. */
48
+ export declare function buildLocaleRouteRealizationTable(input: {
49
+ routes: LocaleRouteEntry[];
50
+ locales: string[];
51
+ defaultLocale: string;
52
+ routing?: LocaleRoutingOpts;
53
+ }): {
38
54
  schema: string;
39
55
  status: string;
40
56
  routing: {
41
- strategy: any;
42
- defaultPrefix: any;
43
- defaultLocale: any;
57
+ strategy: string;
58
+ defaultPrefix: string;
59
+ defaultLocale: string;
44
60
  };
45
- realizations: any[];
46
- diagnostics: any[];
61
+ realizations: LocaleRealization[];
62
+ diagnostics: LocaleDiagnostic[];
47
63
  };
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): {
64
+ /** Absolute URL helper. */
65
+ export declare function absoluteUrl(origin: string, path: string): string;
66
+ /** Locale-aware PageMeta for one RouteId × LocaleId. */
67
+ export declare function buildLocalePageMeta(input: {
68
+ routeId: string;
69
+ localeId: string;
70
+ direction?: string;
71
+ title: string;
72
+ description?: string;
73
+ origin: string;
74
+ realizations: Array<{
75
+ routeId: string;
76
+ localeId: string;
77
+ path: string;
78
+ }>;
79
+ locales: string[];
80
+ defaultLocale: string;
81
+ }): {
69
82
  schema: string;
70
- routeId: any;
71
- locale: any;
72
- htmlLang: any;
73
- dir: any;
74
- title: any;
75
- description: any;
83
+ routeId: string;
84
+ locale: string;
85
+ htmlLang: string;
86
+ dir: string;
87
+ title: string;
88
+ description: string;
76
89
  canonical: string;
77
- alternates: any[];
78
- diagnostics: any[];
90
+ alternates: {
91
+ localeId: string;
92
+ hreflang: string;
93
+ href: string;
94
+ }[];
95
+ diagnostics: LocaleDiagnostic[];
79
96
  status: string;
80
97
  };
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): {
98
+ /** `<Link to="routeId">` retains current locale — never hand-written localized paths. */
99
+ export declare function resolveLinkHref(input: {
100
+ to: string;
101
+ currentLocale: string;
102
+ realizations: Array<{
103
+ routeId: string;
104
+ localeId: string;
105
+ path: string;
106
+ }>;
107
+ }): {
90
108
  schema: string;
91
109
  status: string;
92
- to: any;
110
+ to: string;
93
111
  href: any;
94
- localeId: any;
112
+ localeId: string;
95
113
  diagnostics: {
96
114
  code: string;
97
115
  severity: string;
@@ -101,126 +119,135 @@ export declare function resolveLinkHref(input: any): {
101
119
  } | {
102
120
  schema: string;
103
121
  status: string;
104
- to: any;
105
- routeId: any;
106
- localeId: any;
107
- href: any;
122
+ to: string;
123
+ routeId: string;
124
+ localeId: string;
125
+ href: string;
108
126
  diagnostics: any[];
109
127
  };
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): {
128
+ /** Parse locale prefix from a pathname under prefix strategy. */
129
+ export declare function parseLocaleFromPath(pathname: string, supportedLocales: string[]): {
116
130
  localeId: string;
117
131
  restPath: string;
118
132
  };
119
- /**
120
- * Rewrite a same-app href to the given LocaleId via route realization.
121
- * Stable path (no locale) is recovered first, then re-realized — Link never hardcodes locale.
122
- * @param {string} href
123
- * @param {string} localeId
124
- * @param {{
125
- * locales?: Array<{ id: string }|string>,
126
- * defaultLocale?: string,
127
- * routing?: { strategy?: string, defaultPrefix?: string, defaultLocale?: string },
128
- * }} artifact
129
- */
130
- export declare function localizeSameAppHref(href: any, localeId: any, artifact: any): any;
131
- /**
132
- * Rewrite `<a data-vmz-route href>` in HTML body to retain `localeId`.
133
- * @param {string} html
134
- * @param {string} localeId
135
- * @param {Parameters<typeof localizeSameAppHref>[2]} artifact
136
- * @param {(s: string) => string} [escapeAttr]
137
- */
138
- export declare function localizeBodyLinks(html: any, localeId: any, artifact: any, escapeAttr?: (s: any) => string): any;
139
- /**
140
- * Plan redirect / negotiation for an incoming URL (omit-prefix aware).
141
- * @param {{
142
- * pathname: string,
143
- * supportedLocales: string[],
144
- * defaultLocale: string,
145
- * routing?: { strategy?: string, defaultPrefix?: string },
146
- * hostCandidates?: string[],
147
- * preference?: string|null,
148
- * userChoice?: string|null,
149
- * }} input
150
- */
151
- export declare function planLocalePathNavigation(input: any): {
133
+ export interface LocaleHrefArtifact {
134
+ locales?: Array<{
135
+ id: string;
136
+ } | string>;
137
+ defaultLocale?: string;
138
+ routing?: LocaleRoutingOpts;
139
+ }
140
+ /** Rewrite a same-app href to the given LocaleId via route realization. */
141
+ export declare function localizeSameAppHref(href: string, localeId: string, artifact: LocaleHrefArtifact): string;
142
+ /** Rewrite `<a data-vmz-route href>` in HTML body to retain `localeId`. */
143
+ export declare function localizeBodyLinks(html: string, localeId: string, artifact: LocaleHrefArtifact, escapeAttr?: (s: string) => string): string;
144
+ /** Plan redirect / negotiation for an incoming URL (omit-prefix aware). */
145
+ export declare function planLocalePathNavigation(input: {
146
+ pathname: string;
147
+ supportedLocales: string[];
148
+ defaultLocale: string;
149
+ routing?: LocaleRoutingOpts;
150
+ hostCandidates?: string[];
151
+ preference?: string | null;
152
+ userChoice?: string | null;
153
+ }): {
152
154
  schema: string;
153
155
  kind: string;
154
156
  pathname: string;
155
157
  routeLocale: string;
156
- negotiatedLocale: any;
158
+ negotiatedLocale: string;
157
159
  restPath: string;
158
- redirectTo: any;
160
+ redirectTo: string;
159
161
  realizedPath: string;
160
- diagnostics: any[];
161
- contentLocale: any;
162
+ diagnostics: LocaleDiagnostic[];
163
+ contentLocale: string;
162
164
  };
163
- /**
164
- * Locale-aware cache key — must include LocaleId so Accept-Language cannot steal content.
165
- * @param {{ routeId: string, localeId: string, path: string }} input
166
- */
167
- export declare function localeAwareCacheKey(input: any): string;
168
- /**
169
- * Reject Vary: Accept-Language on a cache key that does not encode LocaleId.
170
- * @param {{ cacheKey: string, varyAcceptLanguage?: boolean, localeId?: string }} input
171
- */
172
- export declare function assertLocaleCacheKey(input: any): {
165
+ /** Locale-aware cache key — must include LocaleId so Accept-Language cannot steal content. */
166
+ export declare function localeAwareCacheKey(input: {
167
+ routeId: string;
168
+ localeId: string;
169
+ path: string;
170
+ }): string;
171
+ /** Reject Vary: Accept-Language on a cache key that does not encode LocaleId. */
172
+ export declare function assertLocaleCacheKey(input: {
173
+ cacheKey: string;
174
+ varyAcceptLanguage?: boolean;
175
+ localeId?: string;
176
+ }): {
173
177
  ok: boolean;
174
- diagnostics: any[];
178
+ diagnostics: LocaleDiagnostic[];
175
179
  };
176
- /**
177
- * LocaleTransition must commit Route realization + PageMeta together.
178
- * @param {{
179
- * fromLocale: string,
180
- * toLocale: string,
181
- * routeId: string,
182
- * realizations: Array<{ routeId: string, localeId: string, path: string }>,
183
- * pageMetaByLocale: Record<string, { locale: string, canonical: string }>,
184
- * }} input
185
- */
186
- export declare function commitLocaleRouteMetaTransition(input: any): {
180
+ /** LocaleTransition must commit Route realization + PageMeta together. */
181
+ export declare function commitLocaleRouteMetaTransition(input: {
182
+ fromLocale: string;
183
+ toLocale: string;
184
+ routeId: string;
185
+ realizations: Array<{
186
+ routeId: string;
187
+ localeId: string;
188
+ path: string;
189
+ }>;
190
+ pageMetaByLocale: Record<string, {
191
+ locale: string;
192
+ canonical: string;
193
+ }>;
194
+ }): {
187
195
  schema: string;
188
196
  kind: string;
189
197
  status: string;
190
- fromLocale: any;
191
- toLocale: any;
192
- fromPath: any;
193
- toPath: any;
194
- pageMeta: any;
195
- diagnostics: any[];
198
+ fromLocale: string;
199
+ toLocale: string;
200
+ fromPath: string;
201
+ toPath: string;
202
+ pageMeta: {
203
+ locale: string;
204
+ canonical: string;
205
+ };
206
+ diagnostics: LocaleDiagnostic[];
196
207
  };
197
- /**
198
- * Aggregate router/meta proof.
199
- * @param {{
200
- * manifest: {
201
- * defaultLocale: string,
202
- * locales: Array<{ id: string, direction?: string }>,
203
- * routing?: { strategy?: string, defaultPrefix?: string },
204
- * },
205
- * routes: Array<{ routeId: string, path: string }>,
206
- * titles?: Record<string, Record<string, string>>,
207
- * origin?: string,
208
- * }} input
209
- */
210
- export declare function checkLocaleRouter(input: any): {
208
+ /** Aggregate router/meta proof. */
209
+ export declare function checkLocaleRouter(input: {
210
+ manifest: {
211
+ defaultLocale: string;
212
+ locales: Array<{
213
+ id: string;
214
+ direction?: string;
215
+ }>;
216
+ routing?: LocaleRoutingOpts;
217
+ };
218
+ routes: LocaleRouteEntry[];
219
+ titles?: Record<string, Record<string, string>>;
220
+ origin?: string;
221
+ }): {
211
222
  schema: string;
212
223
  status: string;
213
224
  realizationTable: {
214
225
  schema: string;
215
226
  status: string;
216
227
  routing: {
217
- strategy: any;
218
- defaultPrefix: any;
219
- defaultLocale: any;
228
+ strategy: string;
229
+ defaultPrefix: string;
230
+ defaultLocale: string;
220
231
  };
221
- realizations: any[];
222
- diagnostics: any[];
232
+ realizations: LocaleRealization[];
233
+ diagnostics: LocaleDiagnostic[];
223
234
  };
224
- pageMetas: any[];
225
- diagnostics: any[];
235
+ pageMetas: {
236
+ schema: string;
237
+ routeId: string;
238
+ locale: string;
239
+ htmlLang: string;
240
+ dir: string;
241
+ title: string;
242
+ description: string;
243
+ canonical: string;
244
+ alternates: {
245
+ localeId: string;
246
+ hreflang: string;
247
+ href: string;
248
+ }[];
249
+ diagnostics: LocaleDiagnostic[];
250
+ status: string;
251
+ }[];
252
+ diagnostics: LocaleDiagnostic[];
226
253
  };