@vmz/vmz 0.0.2 → 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.
- package/README.md +13 -9
- package/dist/application-cmd.d.ts +1 -2
- package/dist/application-cmd.js +9 -10
- package/dist/bundler-adapter.d.ts +2 -3
- package/dist/bundler-adapter.js +2 -3
- package/dist/cli.d.ts +10 -2
- package/dist/cli.js +119 -15
- package/dist/dev-session.d.ts +2 -2
- package/dist/dev-session.js +3 -3
- package/dist/document-build.js +1 -2
- package/dist/document-check.d.ts +1 -1
- package/dist/document-check.js +4 -4
- package/dist/document-cmd.d.ts +1 -2
- package/dist/document-cmd.js +2 -3
- package/dist/document-designs.js +1 -1
- package/dist/document-enrich.js +2 -3
- package/dist/document-evidence.d.ts +4 -4
- package/dist/document-evidence.js +20 -12
- package/dist/document-integrate.d.ts +0 -1
- package/dist/document-integrate.js +0 -1
- package/dist/document-interactive.d.ts +11 -11
- package/dist/document-interactive.js +12 -13
- package/dist/document-locale.d.ts +1 -1
- package/dist/document-locale.js +1 -1
- package/dist/document-markdown.d.ts +1 -2
- package/dist/document-markdown.js +13 -7
- package/dist/document-scan.d.ts +4 -4
- package/dist/document-scan.js +4 -4
- package/dist/document-schema.d.ts +28 -29
- package/dist/document-schema.js +28 -29
- package/dist/explain-cmd.js +3 -3
- package/dist/index.d.ts +340 -789
- package/dist/index.js +91 -80
- package/dist/invocation.d.ts +91 -0
- package/dist/invocation.js +190 -0
- package/dist/locale-check.d.ts +3 -3
- package/dist/locale-check.js +5 -6
- package/dist/locale-cmd.js +6 -7
- package/dist/locale-delivery.d.ts +38 -38
- package/dist/locale-delivery.js +39 -40
- package/dist/locale-router.d.ts +39 -40
- package/dist/locale-router.js +39 -40
- package/dist/locale-runtime.d.ts +39 -39
- package/dist/locale-runtime.js +44 -45
- package/dist/locale-schema.d.ts +1 -2
- package/dist/locale-schema.js +1 -2
- package/dist/locale-tooling.d.ts +13 -13
- package/dist/locale-tooling.js +14 -15
- package/dist/log.d.ts +1 -1
- package/dist/log.js +1 -1
- package/dist/packages.d.ts +1 -2
- package/dist/packages.js +1 -2
- package/dist/plugin-host.d.ts +1 -2
- package/dist/plugin-host.js +2 -3
- package/dist/refactor-cmd.d.ts +1 -1
- package/dist/refactor-cmd.js +6 -6
- package/dist/resolve-native-cli.d.ts +14 -0
- package/dist/resolve-native-cli.js +84 -0
- package/dist/resolve.d.ts +1 -2
- package/dist/resolve.js +1 -2
- package/dist/test-cmd.d.ts +2 -2
- package/dist/test-cmd.js +37 -17
- package/dist/watch-diff.d.ts +1 -1
- package/dist/watch-diff.js +1 -1
- package/package.json +31 -16
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* `vmz` CLI invocation modes (JS gate only; Rust binary stays full).
|
|
4
|
+
*
|
|
5
|
+
* Three modes — do not collapse them:
|
|
6
|
+
* - **developer**: monorepo source checkout (`packages/runtimes/vmz`, not under node_modules)
|
|
7
|
+
* - **project**: app's `node_modules/vmz` or `node_modules/@vmz/vmz` (pnpm/npm/yarn)
|
|
8
|
+
* - **global**: npm/pnpm global (or any install under node_modules that is not the nearest project one)
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import { spawn } from 'node:child_process';
|
|
12
|
+
import { existsSync, realpathSync } from 'node:fs';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
/** @typedef {'developer' | 'project' | 'global'} InvocationMode */
|
|
16
|
+
/**
|
|
17
|
+
* Package root of the running `vmz` / `@vmz/vmz` install (`…/vmz`, not `…/vmz/dist`).
|
|
18
|
+
* @param {string} [fromUrl]
|
|
19
|
+
*/
|
|
20
|
+
export function resolveThisPackageRoot(fromUrl = import.meta.url) {
|
|
21
|
+
return path.resolve(path.dirname(fileURLToPath(fromUrl)), '..');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} p
|
|
25
|
+
*/
|
|
26
|
+
function tryRealpath(p) {
|
|
27
|
+
try {
|
|
28
|
+
return realpathSync(p);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return path.resolve(p);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Walk from `startDir` for nearest project `vmz` / `@vmz/vmz` package root.
|
|
36
|
+
* @param {string} startDir
|
|
37
|
+
* @returns {string | null} realpath of package root
|
|
38
|
+
*/
|
|
39
|
+
export function findNearestProjectVmz(startDir) {
|
|
40
|
+
let dir = path.resolve(startDir);
|
|
41
|
+
for (;;) {
|
|
42
|
+
const candidates = [path.join(dir, 'node_modules', 'vmz'), path.join(dir, 'node_modules', '@vmz', 'vmz')];
|
|
43
|
+
for (const candidate of candidates) {
|
|
44
|
+
const pkgJson = path.join(candidate, 'package.json');
|
|
45
|
+
if (existsSync(pkgJson)) {
|
|
46
|
+
return tryRealpath(candidate);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const parent = path.dirname(dir);
|
|
50
|
+
if (parent === dir)
|
|
51
|
+
return null;
|
|
52
|
+
dir = parent;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Resolve CLI entry for a `vmz` package root (`bin/vmz.js`).
|
|
57
|
+
* @param {string} packageRoot
|
|
58
|
+
* @returns {string | null}
|
|
59
|
+
*/
|
|
60
|
+
export function resolveVmzBin(packageRoot) {
|
|
61
|
+
const bin = path.join(packageRoot, 'bin', 'vmz.js');
|
|
62
|
+
if (existsSync(bin))
|
|
63
|
+
return tryRealpath(bin);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Install lives under a `node_modules` tree (npm -g, pnpm store link, etc.).
|
|
68
|
+
* Workspace source checkout (`packages/runtimes/vmz`) does not → developer mode.
|
|
69
|
+
* @param {string} packageRoot
|
|
70
|
+
*/
|
|
71
|
+
export function isUnderNodeModules(packageRoot) {
|
|
72
|
+
const norm = path.normalize(packageRoot);
|
|
73
|
+
const parts = norm.split(path.sep);
|
|
74
|
+
return parts.includes('node_modules');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Classify how this process was launched.
|
|
78
|
+
*
|
|
79
|
+
* | mode | thisPackageRoot | rule |
|
|
80
|
+
* |-------------|-----------------------------------------|-------------------------------------------|
|
|
81
|
+
* | developer | monorepo `packages/runtimes/vmz` | not under `node_modules` |
|
|
82
|
+
* | project | app `node_modules/(@vmz/)vmz` | under node_modules ∧ equals nearest |
|
|
83
|
+
* | global | global / unrelated node_modules install | under node_modules ∧ not nearest project |
|
|
84
|
+
*
|
|
85
|
+
* @param {{
|
|
86
|
+
* cwd?: string,
|
|
87
|
+
* thisPackageRoot?: string,
|
|
88
|
+
* }} [opts]
|
|
89
|
+
* @returns {{
|
|
90
|
+
* mode: InvocationMode,
|
|
91
|
+
* cwd: string,
|
|
92
|
+
* thisPackageRoot: string,
|
|
93
|
+
* nearestProjectVmz: string | null,
|
|
94
|
+
* isDeveloper: boolean,
|
|
95
|
+
* isProjectLocal: boolean,
|
|
96
|
+
* isGlobalLike: boolean,
|
|
97
|
+
* }}
|
|
98
|
+
*/
|
|
99
|
+
export function getInvocationContext(opts = {}) {
|
|
100
|
+
const cwd = path.resolve(opts.cwd ?? process.cwd());
|
|
101
|
+
const thisPackageRoot = tryRealpath(opts.thisPackageRoot ?? resolveThisPackageRoot());
|
|
102
|
+
const nearestProjectVmz = findNearestProjectVmz(cwd);
|
|
103
|
+
const underNm = isUnderNodeModules(thisPackageRoot);
|
|
104
|
+
/** @type {InvocationMode} */
|
|
105
|
+
let mode;
|
|
106
|
+
if (!underNm) {
|
|
107
|
+
mode = 'developer';
|
|
108
|
+
}
|
|
109
|
+
else if (nearestProjectVmz != null && nearestProjectVmz === thisPackageRoot) {
|
|
110
|
+
mode = 'project';
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
mode = 'global';
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
mode,
|
|
117
|
+
cwd,
|
|
118
|
+
thisPackageRoot,
|
|
119
|
+
nearestProjectVmz,
|
|
120
|
+
isDeveloper: mode === 'developer',
|
|
121
|
+
isProjectLocal: mode === 'project',
|
|
122
|
+
/** @deprecated prefer `mode === 'global'`; kept for call sites */
|
|
123
|
+
isGlobalLike: mode === 'global',
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Commands allowed in **global** mode without re-exec / refusal.
|
|
128
|
+
* Developer + project modes allow the full CLI.
|
|
129
|
+
* @param {string | undefined} cmd
|
|
130
|
+
*/
|
|
131
|
+
export function isGlobalAllowedCommand(cmd) {
|
|
132
|
+
if (!cmd)
|
|
133
|
+
return true;
|
|
134
|
+
return (cmd === 'help' ||
|
|
135
|
+
cmd === '-h' ||
|
|
136
|
+
cmd === '--help' ||
|
|
137
|
+
cmd === 'version' ||
|
|
138
|
+
cmd === '-V' ||
|
|
139
|
+
cmd === '--version' ||
|
|
140
|
+
cmd === 'new' ||
|
|
141
|
+
cmd === 'init');
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @param {string} bin
|
|
145
|
+
* @param {string[]} argv full argv including command (e.g. `['check', '.']`)
|
|
146
|
+
* @returns {Promise<number>}
|
|
147
|
+
*/
|
|
148
|
+
export function reexecProjectVmz(bin, argv) {
|
|
149
|
+
return new Promise((resolve) => {
|
|
150
|
+
const child = spawn(process.execPath, [bin, ...argv], {
|
|
151
|
+
stdio: 'inherit',
|
|
152
|
+
env: process.env,
|
|
153
|
+
});
|
|
154
|
+
child.on('error', () => resolve(1));
|
|
155
|
+
child.on('exit', (code, signal) => {
|
|
156
|
+
if (signal)
|
|
157
|
+
resolve(1);
|
|
158
|
+
else
|
|
159
|
+
resolve(code ?? 1);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Guard for project-only commands when the current install is **global** mode.
|
|
165
|
+
* Developer / project → proceed. Global + local present → re-exec. Global alone → refuse.
|
|
166
|
+
*
|
|
167
|
+
* @returns {Promise<{ action: 'proceed' } | { action: 'exit', code: number }>}
|
|
168
|
+
*/
|
|
169
|
+
export async function gateGlobalProjectCommand(opts) {
|
|
170
|
+
const { argv, cwd = process.cwd(), thisPackageRoot, reexec = reexecProjectVmz, logError = (msg) => console.error(msg) } = opts;
|
|
171
|
+
const ctx = getInvocationContext({ cwd, thisPackageRoot });
|
|
172
|
+
if (ctx.mode !== 'global') {
|
|
173
|
+
return { action: 'proceed' };
|
|
174
|
+
}
|
|
175
|
+
if (ctx.nearestProjectVmz && ctx.nearestProjectVmz !== ctx.thisPackageRoot) {
|
|
176
|
+
const bin = resolveVmzBin(ctx.nearestProjectVmz);
|
|
177
|
+
if (!bin) {
|
|
178
|
+
logError('found project `@vmz/vmz` / `vmz` but bin/vmz.js is missing.');
|
|
179
|
+
return { action: 'exit', code: 1 };
|
|
180
|
+
}
|
|
181
|
+
const code = await reexec(bin, argv);
|
|
182
|
+
return { action: 'exit', code };
|
|
183
|
+
}
|
|
184
|
+
logError('this `vmz` is a global install (mode=global); project commands need a project install.');
|
|
185
|
+
logError('Install in the app: pnpm add -D @vmz/vmz');
|
|
186
|
+
logError('Or scaffold: vmz new <dir>');
|
|
187
|
+
logError('Then run: pnpm exec vmz <command>');
|
|
188
|
+
logError('(developer mode: run from vmz-framework packages/runtimes/vmz source — full CLI)');
|
|
189
|
+
return { action: 'exit', code: 1 };
|
|
190
|
+
}
|
package/dist/locale-check.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export declare function checkLocales(opts: any): {
|
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
69
|
* Scan src for `#locales/<catalog>` imports and `messageId` string literals after import.
|
|
70
|
-
* First-slice heuristic — full VPG edges land with compiler
|
|
70
|
+
* First-slice heuristic — full VPG edges land with compiler deepen.
|
|
71
71
|
*/
|
|
72
72
|
export declare function scanLocaleUsages(projectRoot: any): {
|
|
73
73
|
catalogs: Set<unknown>;
|
|
@@ -75,13 +75,13 @@ export declare function scanLocaleUsages(projectRoot: any): {
|
|
|
75
75
|
importedNames: Map<any, any>;
|
|
76
76
|
};
|
|
77
77
|
/**
|
|
78
|
-
* Emit typed module stubs for `#locales/*` (
|
|
78
|
+
* Emit typed module stubs for `#locales/*` ( surface).
|
|
79
79
|
* @param {ReturnType<typeof checkLocales>} report
|
|
80
80
|
* @param {string} outDir
|
|
81
81
|
*/
|
|
82
82
|
export declare function emitLocaleTypedModules(report: any, outDir: any): any[];
|
|
83
83
|
/**
|
|
84
|
-
* MessageId rename plan
|
|
84
|
+
* MessageId rename plan — WorkspaceEdit-shaped, no parallel rename IR.
|
|
85
85
|
* @param {ReturnType<typeof checkLocales>} report
|
|
86
86
|
* @param {string} fromId
|
|
87
87
|
* @param {string} toId
|
package/dist/locale-check.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* Locale
|
|
4
|
-
* Design: 规划设计/vmz/28 · I0/I1
|
|
3
|
+
* Locale check + message contracts / typed module projection.
|
|
5
4
|
*
|
|
6
5
|
* Not an I18n IR: filesystem + MessageCatalogManifest projection into VPG-shaped views.
|
|
7
6
|
*/
|
|
@@ -485,7 +484,7 @@ export function checkLocales(opts) {
|
|
|
485
484
|
}
|
|
486
485
|
}
|
|
487
486
|
}
|
|
488
|
-
//
|
|
487
|
+
// scan source for #locales/* imports / message references.
|
|
489
488
|
const used = scanLocaleUsages(projectRoot);
|
|
490
489
|
/** @type {any[]} */
|
|
491
490
|
const typedModules = [];
|
|
@@ -611,7 +610,7 @@ function walkCatalogFiles(dir, fn) {
|
|
|
611
610
|
}
|
|
612
611
|
/**
|
|
613
612
|
* Scan src for `#locales/<catalog>` imports and `messageId` string literals after import.
|
|
614
|
-
* First-slice heuristic — full VPG edges land with compiler
|
|
613
|
+
* First-slice heuristic — full VPG edges land with compiler deepen.
|
|
615
614
|
*/
|
|
616
615
|
export function scanLocaleUsages(projectRoot) {
|
|
617
616
|
/** @type {Set<string>} */
|
|
@@ -658,7 +657,7 @@ function walkSource(dir, fn) {
|
|
|
658
657
|
}
|
|
659
658
|
}
|
|
660
659
|
/**
|
|
661
|
-
* Emit typed module stubs for `#locales/*` (
|
|
660
|
+
* Emit typed module stubs for `#locales/*` ( surface).
|
|
662
661
|
* @param {ReturnType<typeof checkLocales>} report
|
|
663
662
|
* @param {string} outDir
|
|
664
663
|
*/
|
|
@@ -696,7 +695,7 @@ export function emitLocaleTypedModules(report, outDir) {
|
|
|
696
695
|
return written;
|
|
697
696
|
}
|
|
698
697
|
/**
|
|
699
|
-
* MessageId rename plan
|
|
698
|
+
* MessageId rename plan — WorkspaceEdit-shaped, no parallel rename IR.
|
|
700
699
|
* @param {ReturnType<typeof checkLocales>} report
|
|
701
700
|
* @param {string} fromId
|
|
702
701
|
* @param {string} toId
|
package/dist/locale-cmd.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* `vmz locale` CLI (
|
|
4
|
-
* Design: 规划设计/vmz/28 §12
|
|
3
|
+
* `vmz locale` CLI (–).
|
|
5
4
|
*/
|
|
6
5
|
import fs from 'node:fs';
|
|
7
6
|
import path from 'node:path';
|
|
@@ -14,7 +13,7 @@ import { checkLocaleRuntime } from './locale-runtime.js';
|
|
|
14
13
|
import { checkLocaleConformance, diffLocaleCatalogs, explainLocaleMessage, extractHardcodedText, pseudoLocalizeCatalog, } from './locale-tooling.js';
|
|
15
14
|
import { log } from './log.js';
|
|
16
15
|
function printLocaleHelp() {
|
|
17
|
-
console.log(`vmz locale — /locales application i18n (
|
|
16
|
+
console.log(`vmz locale — /locales application i18n (–)
|
|
18
17
|
|
|
19
18
|
Usage:
|
|
20
19
|
vmz locale check [project] Check locales.json5 + catalogs + param contracts
|
|
@@ -160,7 +159,7 @@ function cmdLocaleRename(args) {
|
|
|
160
159
|
else {
|
|
161
160
|
log.info(`rename plan ${fromId} → ${toId} edits=${plan.edits.length}`);
|
|
162
161
|
for (const e of plan.edits)
|
|
163
|
-
console.log(`
|
|
162
|
+
console.log(` ${e.path}`);
|
|
164
163
|
}
|
|
165
164
|
return plan.status === 'ready' ? 0 : 1;
|
|
166
165
|
}
|
|
@@ -329,7 +328,7 @@ function cmdLocaleExplain(args) {
|
|
|
329
328
|
else {
|
|
330
329
|
log.info(`explain ${report.messageId}: resolved=${report.resolvedLocale} params=${(report.params || []).map((p) => p.name).join(',') || '(none)'}`);
|
|
331
330
|
for (const [loc, v] of Object.entries(report.variants || {})) {
|
|
332
|
-
console.log(`
|
|
331
|
+
console.log(` ${loc}\t${v.template}`);
|
|
333
332
|
}
|
|
334
333
|
}
|
|
335
334
|
return report.status === 'ready' ? 0 : 1;
|
|
@@ -355,9 +354,9 @@ function cmdLocaleDiff(args) {
|
|
|
355
354
|
else {
|
|
356
355
|
log.info(`diff ${baseLocale} → ${targetLocale}: missing=${report.summary.missingInTarget} changed=${report.summary.changed} params=${report.summary.paramMismatches}`);
|
|
357
356
|
for (const id of report.missingInTarget || [])
|
|
358
|
-
console.log(`
|
|
357
|
+
console.log(` - missing ${id}`);
|
|
359
358
|
for (const c of report.changed || [])
|
|
360
|
-
console.log(`
|
|
359
|
+
console.log(` ~ ${c.messageId}`);
|
|
361
360
|
}
|
|
362
361
|
return 0;
|
|
363
362
|
}
|
|
@@ -12,18 +12,18 @@ export declare function messageCatalogHash(messages: any, localeId: any, reachab
|
|
|
12
12
|
/**
|
|
13
13
|
* Build LocaleDeliveryResolution for one Host surface.
|
|
14
14
|
* @param {{
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
15
|
+
* host: 'web'|'mini'|'native'|'server',
|
|
16
|
+
* applicationId: string,
|
|
17
|
+
* deliveryId: string,
|
|
18
|
+
* planVersion?: string,
|
|
19
|
+
* supportedLocales: string[],
|
|
20
|
+
* defaultLocale: string,
|
|
21
|
+
* fallback?: Record<string, string[]>,
|
|
22
|
+
* routingRealization?: unknown,
|
|
23
|
+
* messages: Array<{ messageId: string, variants: Record<string, { template: string }> }>,
|
|
24
|
+
* reachableMessageIds?: string[],
|
|
25
|
+
* bundledLocales?: string[],
|
|
26
|
+
* allowFullClientBundle?: boolean,
|
|
27
27
|
* }} input
|
|
28
28
|
*/
|
|
29
29
|
export declare function buildLocaleDeliveryResolution(input: any): {
|
|
@@ -55,19 +55,19 @@ export declare function buildLocaleDeliveryResolution(input: any): {
|
|
|
55
55
|
/**
|
|
56
56
|
* Validate a Native optional locale pack (signed, no JS, bound to app/plan/schema).
|
|
57
57
|
* @param {{
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
58
|
+
* pack: {
|
|
59
|
+
* schema?: string,
|
|
60
|
+
* applicationId: string,
|
|
61
|
+
* planVersion: string,
|
|
62
|
+
* localeId: string,
|
|
63
|
+
* signature?: string,
|
|
64
|
+
* catalog?: Record<string, string>,
|
|
65
|
+
* formatterDataVersion?: string,
|
|
66
|
+
* entries?: Array<{ path: string, kind?: string }>,
|
|
67
|
+
* executable?: boolean,
|
|
68
|
+
* },
|
|
69
|
+
* expectedApplicationId: string,
|
|
70
|
+
* expectedPlanVersion: string,
|
|
71
71
|
* }} input
|
|
72
72
|
*/
|
|
73
73
|
export declare function validateNativeLocalePack(input: any): {
|
|
@@ -88,8 +88,8 @@ export declare function validateNativeLocalePack(input: any): {
|
|
|
88
88
|
/**
|
|
89
89
|
* Mini cross-subpackage message dependencies must be proven.
|
|
90
90
|
* @param {{
|
|
91
|
-
*
|
|
92
|
-
*
|
|
91
|
+
* packages: Array<{ id: string, messageIds: string[] }>,
|
|
92
|
+
* edges: Array<{ fromPackage: string, toPackage: string, messageId: string }>,
|
|
93
93
|
* }} input
|
|
94
94
|
*/
|
|
95
95
|
export declare function proveMiniPackageMessages(input: any): {
|
|
@@ -134,18 +134,18 @@ export declare function assertHostMessageInvariant(resolutions: any): {
|
|
|
134
134
|
diagnostics: any[];
|
|
135
135
|
};
|
|
136
136
|
/**
|
|
137
|
-
* Aggregate
|
|
137
|
+
* Aggregate delivery proof for fixture / CLI.
|
|
138
138
|
* @param {{
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
139
|
+
* manifest: {
|
|
140
|
+
* defaultLocale: string,
|
|
141
|
+
* locales: Array<{ id: string }>,
|
|
142
|
+
* fallback?: Record<string, string[]>,
|
|
143
|
+
* routing?: unknown,
|
|
144
|
+
* },
|
|
145
|
+
* messages: Array<{ messageId: string, variants: Record<string, { template: string }> }>,
|
|
146
|
+
* applicationId?: string,
|
|
147
|
+
* planVersion?: string,
|
|
148
|
+
* reachableMessageIds?: string[],
|
|
149
149
|
* }} input
|
|
150
150
|
*/
|
|
151
151
|
export declare function checkLocaleDelivery(input: any): {
|
package/dist/locale-delivery.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* Locale
|
|
3
|
+
* Locale multi-host delivery: Web chunks · Mini packages · Native packs ·
|
|
4
4
|
* Server error envelope / formatter resources.
|
|
5
|
-
* Design: 规划设计/vmz/28 §9–§10
|
|
6
5
|
*
|
|
7
6
|
* Same MessageNode projects to all Surfaces; LocaleId is not a WebSurface concern.
|
|
8
7
|
*/
|
|
@@ -49,18 +48,18 @@ export function messageCatalogHash(messages, localeId, reachableIds) {
|
|
|
49
48
|
/**
|
|
50
49
|
* Build LocaleDeliveryResolution for one Host surface.
|
|
51
50
|
* @param {{
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
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,
|
|
64
63
|
* }} input
|
|
65
64
|
*/
|
|
66
65
|
export function buildLocaleDeliveryResolution(input) {
|
|
@@ -131,19 +130,19 @@ export function buildLocaleDeliveryResolution(input) {
|
|
|
131
130
|
/**
|
|
132
131
|
* Validate a Native optional locale pack (signed, no JS, bound to app/plan/schema).
|
|
133
132
|
* @param {{
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
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,
|
|
147
146
|
* }} input
|
|
148
147
|
*/
|
|
149
148
|
export function validateNativeLocalePack(input) {
|
|
@@ -215,8 +214,8 @@ export function validateNativeLocalePack(input) {
|
|
|
215
214
|
/**
|
|
216
215
|
* Mini cross-subpackage message dependencies must be proven.
|
|
217
216
|
* @param {{
|
|
218
|
-
*
|
|
219
|
-
*
|
|
217
|
+
* packages: Array<{ id: string, messageIds: string[] }>,
|
|
218
|
+
* edges: Array<{ fromPackage: string, toPackage: string, messageId: string }>,
|
|
220
219
|
* }} input
|
|
221
220
|
*/
|
|
222
221
|
export function proveMiniPackageMessages(input) {
|
|
@@ -347,18 +346,18 @@ export function assertHostMessageInvariant(resolutions) {
|
|
|
347
346
|
return { ok: diagnostics.length === 0, diagnostics };
|
|
348
347
|
}
|
|
349
348
|
/**
|
|
350
|
-
* Aggregate
|
|
349
|
+
* Aggregate delivery proof for fixture / CLI.
|
|
351
350
|
* @param {{
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
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[],
|
|
362
361
|
* }} input
|
|
363
362
|
*/
|
|
364
363
|
export function checkLocaleDelivery(input) {
|
package/dist/locale-router.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Locale
|
|
2
|
+
* Locale router / PageMeta: route realization · canonical · hreflang ·
|
|
3
3
|
* Link locale retain · locale-aware cache key.
|
|
4
|
-
* Design: 规划设计/vmz/28 §6 · §10 · 20
|
|
5
4
|
*
|
|
6
5
|
* LocaleId is a RouteNode realization dimension — not part of stable RouteId.
|
|
7
6
|
*/
|
|
8
7
|
/**
|
|
9
8
|
* Join locale prefix with a stable route path pattern.
|
|
10
9
|
* @param {string} localeId
|
|
11
|
-
* @param {string} pathPattern
|
|
10
|
+
* @param {string} pathPattern stable path without locale (e.g. /account/profile)
|
|
12
11
|
* @param {{ strategy?: string, defaultPrefix?: string, defaultLocale?: string }} routing
|
|
13
12
|
*/
|
|
14
13
|
export declare function realizeRoutePath(localeId: any, pathPattern: any, routing?: {}): {
|
|
@@ -29,10 +28,10 @@ export declare function realizeRoutePath(localeId: any, pathPattern: any, routin
|
|
|
29
28
|
/**
|
|
30
29
|
* Build RouteId × LocaleId realization table.
|
|
31
30
|
* @param {{
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
31
|
+
* routes: Array<{ routeId: string, path: string }>,
|
|
32
|
+
* locales: string[],
|
|
33
|
+
* defaultLocale: string,
|
|
34
|
+
* routing?: { strategy?: string, defaultPrefix?: string },
|
|
36
35
|
* }} input
|
|
37
36
|
*/
|
|
38
37
|
export declare function buildLocaleRouteRealizationTable(input: any): {
|
|
@@ -55,15 +54,15 @@ export declare function absoluteUrl(origin: any, path: any): string;
|
|
|
55
54
|
/**
|
|
56
55
|
* Locale-aware PageMeta for one RouteId × LocaleId.
|
|
57
56
|
* @param {{
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
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,
|
|
67
66
|
* }} input
|
|
68
67
|
*/
|
|
69
68
|
export declare function buildLocalePageMeta(input: any): {
|
|
@@ -82,9 +81,9 @@ export declare function buildLocalePageMeta(input: any): {
|
|
|
82
81
|
/**
|
|
83
82
|
* `<Link to="routeId">` retains current locale — never hand-written localized paths.
|
|
84
83
|
* @param {{
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
84
|
+
* to: string,
|
|
85
|
+
* currentLocale: string,
|
|
86
|
+
* realizations: Array<{ routeId: string, localeId: string, path: string }>,
|
|
88
87
|
* }} input
|
|
89
88
|
*/
|
|
90
89
|
export declare function resolveLinkHref(input: any): {
|
|
@@ -120,13 +119,13 @@ export declare function parseLocaleFromPath(pathname: any, supportedLocales: any
|
|
|
120
119
|
/**
|
|
121
120
|
* Plan redirect / negotiation for an incoming URL (omit-prefix aware).
|
|
122
121
|
* @param {{
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
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,
|
|
130
129
|
* }} input
|
|
131
130
|
*/
|
|
132
131
|
export declare function planLocalePathNavigation(input: any): {
|
|
@@ -157,11 +156,11 @@ export declare function assertLocaleCacheKey(input: any): {
|
|
|
157
156
|
/**
|
|
158
157
|
* LocaleTransition must commit Route realization + PageMeta together.
|
|
159
158
|
* @param {{
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
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 }>,
|
|
165
164
|
* }} input
|
|
166
165
|
*/
|
|
167
166
|
export declare function commitLocaleRouteMetaTransition(input: any): {
|
|
@@ -176,16 +175,16 @@ export declare function commitLocaleRouteMetaTransition(input: any): {
|
|
|
176
175
|
diagnostics: any[];
|
|
177
176
|
};
|
|
178
177
|
/**
|
|
179
|
-
* Aggregate
|
|
178
|
+
* Aggregate router/meta proof.
|
|
180
179
|
* @param {{
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
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,
|
|
189
188
|
* }} input
|
|
190
189
|
*/
|
|
191
190
|
export declare function checkLocaleRouter(input: any): {
|