@vmz/vmz 0.1.16 → 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.
- package/dist/application-cmd.d.ts +6 -16
- package/dist/application-cmd.js +34 -180
- package/dist/author-input.d.ts +40 -19
- package/dist/author-input.js +2 -16
- package/dist/build-assemble.d.ts +63 -41
- package/dist/build-assemble.js +42 -43
- package/dist/bundler-adapter.d.ts +46 -48
- package/dist/bundler-adapter.js +4 -43
- package/dist/cdn-policy.d.ts +77 -93
- package/dist/cdn-policy.js +10 -16
- package/dist/cli-localize.d.ts +34 -0
- package/dist/cli-localize.js +58 -0
- package/dist/cli.d.ts +8 -19
- package/dist/cli.js +69 -252
- package/dist/content-addressed-assets.d.ts +24 -10
- package/dist/content-addressed-assets.js +2 -7
- package/dist/delivery-profile.d.ts +54 -27
- package/dist/delivery-profile.js +15 -13
- package/dist/dev-session.d.ts +29 -23
- package/dist/dev-session.js +0 -21
- package/dist/dev-watch-roots.d.ts +34 -25
- package/dist/dev-watch-roots.js +0 -31
- package/dist/document-build.d.ts +22 -97
- package/dist/document-build.js +4 -19
- package/dist/document-check.d.ts +30 -53
- package/dist/document-check.js +14 -29
- package/dist/document-cmd.d.ts +3 -6
- package/dist/document-cmd.js +19 -79
- package/dist/document-designs.d.ts +5 -8
- package/dist/document-designs.js +2 -15
- package/dist/document-enrich.d.ts +52 -24
- package/dist/document-enrich.js +4 -32
- package/dist/document-evidence.d.ts +46 -43
- package/dist/document-evidence.js +6 -47
- package/dist/document-integrate.d.ts +13 -29
- package/dist/document-integrate.js +2 -13
- package/dist/document-interactive.d.ts +45 -67
- package/dist/document-interactive.js +9 -50
- package/dist/document-layout-render.d.ts +7 -16
- package/dist/document-layout-render.js +0 -17
- package/dist/document-locale.d.ts +12 -25
- package/dist/document-locale.js +3 -14
- package/dist/document-markdown.d.ts +9 -5
- package/dist/document-markdown.js +0 -4
- package/dist/document-routing-config.d.ts +7 -14
- package/dist/document-routing-config.js +0 -9
- package/dist/document-scan.d.ts +14 -18
- package/dist/document-scan.js +2 -23
- package/dist/document-schema.d.ts +154 -41
- package/dist/document-schema.js +0 -35
- package/dist/embedded-packaging.d.ts +20 -8
- package/dist/embedded-packaging.js +0 -1
- package/dist/explain-cmd.d.ts +4 -3
- package/dist/explain-cmd.js +16 -65
- package/dist/index.d.ts +70 -143
- package/dist/index.js +16 -136
- package/dist/invocation.d.ts +29 -50
- package/dist/invocation.js +11 -57
- package/dist/locale-check.d.ts +69 -70
- package/dist/locale-check.js +5 -66
- package/dist/locale-cmd.d.ts +2 -5
- package/dist/locale-cmd.js +62 -142
- package/dist/locale-delivery.d.ts +294 -191
- package/dist/locale-delivery.js +8 -94
- package/dist/locale-route-emit.d.ts +23 -9
- package/dist/locale-route-emit.js +0 -7
- package/dist/locale-router.d.ts +189 -162
- package/dist/locale-router.js +13 -122
- package/dist/locale-runtime.d.ts +292 -262
- package/dist/locale-runtime.js +8 -102
- package/dist/locale-schema.js +0 -1
- package/dist/locale-tooling.d.ts +100 -63
- package/dist/locale-tooling.js +7 -45
- package/dist/log.d.ts +22 -15
- package/dist/log.js +24 -21
- package/dist/native-addon.d.ts +10 -9
- package/dist/native-addon.js +1 -10
- package/dist/pack-client-packages.d.ts +5 -1
- package/dist/pack-client-packages.js +0 -6
- package/dist/pack.d.ts +17 -15
- package/dist/pack.js +0 -12
- package/dist/packages.d.ts +10 -23
- package/dist/packages.js +1 -37
- package/dist/plan-cmd.d.ts +6 -0
- package/dist/plan-cmd.js +35 -0
- package/dist/plugin-host.js +0 -1
- package/dist/port.d.ts +2 -10
- package/dist/port.js +2 -11
- package/dist/pretty-json.d.ts +9 -19
- package/dist/pretty-json.js +3 -17
- package/dist/production-observability.d.ts +37 -181
- package/dist/production-observability.js +1 -9
- package/dist/production-test-pack.d.ts +17 -3
- package/dist/production-test-pack.js +0 -2
- package/dist/public-static-assets.d.ts +6 -1
- package/dist/public-static-assets.js +0 -5
- package/dist/refactor-cmd.d.ts +3 -6
- package/dist/refactor-cmd.js +16 -69
- package/dist/release-cmd.d.ts +7 -6
- package/dist/release-cmd.js +17 -59
- package/dist/release-pack.d.ts +7 -3
- package/dist/release-pack.js +0 -6
- package/dist/resolve.d.ts +15 -19
- package/dist/resolve.js +1 -15
- package/dist/server-artifact.d.ts +30 -75
- package/dist/server-artifact.js +0 -10
- package/dist/server-language-backend.d.ts +22 -79
- package/dist/server-language-backend.js +0 -26
- package/dist/site-delivery.d.ts +46 -59
- package/dist/site-delivery.js +3 -8
- package/dist/site-favicon.d.ts +6 -1
- package/dist/site-favicon.js +0 -5
- package/dist/static-emit.d.ts +73 -103
- package/dist/static-emit.js +1 -26
- package/dist/test-cmd.d.ts +3 -5
- package/dist/test-cmd.js +15 -25
- package/dist/test-compile.js +0 -1
- package/dist/test-discover.js +0 -1
- package/dist/test-logic.js +0 -1
- package/dist/test-protocol.js +0 -1
- package/dist/toolchain-dx.d.ts +11 -0
- package/dist/toolchain-dx.js +10 -0
- package/dist/watch-diff.d.ts +4 -13
- package/dist/watch-diff.js +0 -17
- package/dist/wechat-packaging.d.ts +8 -7
- package/dist/wechat-packaging.js +0 -6
- package/locales/en-US/cli.json +105 -0
- package/locales/locales.json +4 -0
- package/package.json +15 -12
- package/dist/resolve-native-cli.d.ts +0 -14
- package/dist/resolve-native-cli.js +0 -84
|
@@ -2,19 +2,10 @@
|
|
|
2
2
|
* Integrated DocumentMount — compile host chrome via DocumentLayout + createRenderHost.
|
|
3
3
|
* Replaces the removed regex template lowering in document-host-chrome.ts.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
12
|
-
* @param {string} html
|
|
13
|
-
*/
|
|
14
|
-
export declare function assertCompiledShellHtml(html: any): void;
|
|
15
|
-
/**
|
|
16
|
-
* @param {string} distDir
|
|
17
|
-
* @param {string} localeId
|
|
18
|
-
* @param {string} slotHtml
|
|
19
|
-
*/
|
|
20
|
-
export declare function renderCompiledDocumentLayout(distDir: any, localeId: any, slotHtml: any): Promise<any>;
|
|
5
|
+
declare global {
|
|
6
|
+
var __vmzLocaleIdHint: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveDocumentLayoutChunkId(distDir: string): string | null;
|
|
9
|
+
export declare function assertIntegratedDistReady(distDir: string): string;
|
|
10
|
+
export declare function assertCompiledShellHtml(html: string): void;
|
|
11
|
+
export declare function renderCompiledDocumentLayout(distDir: string, localeId: string, slotHtml: string): Promise<string>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Integrated DocumentMount — compile host chrome via DocumentLayout + createRenderHost.
|
|
4
3
|
* Replaces the removed regex template lowering in document-host-chrome.ts.
|
|
@@ -7,7 +6,6 @@ import fs from 'node:fs';
|
|
|
7
6
|
import path from 'node:path';
|
|
8
7
|
import { pathToFileURL } from 'node:url';
|
|
9
8
|
import { createRenderHost } from '@vmz/core/render-host';
|
|
10
|
-
/** @param {string} distDir */
|
|
11
9
|
export function resolveDocumentLayoutChunkId(distDir) {
|
|
12
10
|
for (const chunkId of ['layouts/DocumentLayout', 'components/DocumentLayout']) {
|
|
13
11
|
if (fs.existsSync(path.join(distDir, `${chunkId}.client.js`)))
|
|
@@ -15,9 +13,6 @@ export function resolveDocumentLayoutChunkId(distDir) {
|
|
|
15
13
|
}
|
|
16
14
|
return null;
|
|
17
15
|
}
|
|
18
|
-
/**
|
|
19
|
-
* @param {string} distDir
|
|
20
|
-
*/
|
|
21
16
|
export function assertIntegratedDistReady(distDir) {
|
|
22
17
|
const dom = path.join(distDir, 'vmz-dom.js');
|
|
23
18
|
if (!fs.existsSync(dom)) {
|
|
@@ -29,9 +24,6 @@ export function assertIntegratedDistReady(distDir) {
|
|
|
29
24
|
}
|
|
30
25
|
return chunkId;
|
|
31
26
|
}
|
|
32
|
-
/**
|
|
33
|
-
* @param {string} html
|
|
34
|
-
*/
|
|
35
27
|
export function assertCompiledShellHtml(html) {
|
|
36
28
|
const header = html.match(/<header[^>]*data-vmz-fixture="site-header"[\s\S]*?<\/header>/i)?.[0] ?? '';
|
|
37
29
|
const footer = html.match(/<footer[^>]*data-vmz-fixture="site-footer"[\s\S]*?<\/footer>/i)?.[0] ?? '';
|
|
@@ -48,20 +40,11 @@ export function assertCompiledShellHtml(html) {
|
|
|
48
40
|
throw new Error('document layout SSR missing compiled SiteHeader/SiteFooter fixtures');
|
|
49
41
|
}
|
|
50
42
|
}
|
|
51
|
-
/**
|
|
52
|
-
* @param {string} distDir
|
|
53
|
-
* @param {string} chunkId
|
|
54
|
-
*/
|
|
55
43
|
async function loadCtor(distDir, chunkId) {
|
|
56
44
|
const href = pathToFileURL(path.join(distDir, `${chunkId}.client.js`)).href;
|
|
57
45
|
const mod = await import(`${href}?t=${Date.now()}`);
|
|
58
46
|
return mod.default;
|
|
59
47
|
}
|
|
60
|
-
/**
|
|
61
|
-
* @param {string} distDir
|
|
62
|
-
* @param {string} localeId
|
|
63
|
-
* @param {string} slotHtml
|
|
64
|
-
*/
|
|
65
48
|
export async function renderCompiledDocumentLayout(distDir, localeId, slotHtml) {
|
|
66
49
|
const chunkId = assertIntegratedDistReady(distDir);
|
|
67
50
|
const prevHint = globalThis.__vmzLocaleIdHint;
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Locale key validation & canonicalization .
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Map soft-normalized key through alias table.
|
|
11
|
-
* @param {string} soft
|
|
12
|
-
*/
|
|
13
|
-
export declare function canonicalLocale(soft: any): any;
|
|
14
|
-
/**
|
|
15
|
-
* Validate a top-level locale directory name.
|
|
16
|
-
* @param {string} literal
|
|
17
|
-
* @returns {{ ok: true, soft: string, canonical: string } | { ok: false, code: string, message: string }}
|
|
18
|
-
*/
|
|
19
|
-
export declare function validateLocaleLiteral(literal: any): {
|
|
20
|
-
ok: boolean;
|
|
4
|
+
export type ValidateLocaleResult = {
|
|
5
|
+
ok: true;
|
|
6
|
+
soft: string;
|
|
7
|
+
canonical: string;
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
21
10
|
code: string;
|
|
22
11
|
message: string;
|
|
23
|
-
soft?: undefined;
|
|
24
|
-
canonical?: undefined;
|
|
25
|
-
} | {
|
|
26
|
-
ok: boolean;
|
|
27
|
-
soft: string;
|
|
28
|
-
canonical: any;
|
|
29
|
-
code?: undefined;
|
|
30
|
-
message?: undefined;
|
|
31
12
|
};
|
|
13
|
+
/** Soft-normalize for alias / conflict detection (does not validate). */
|
|
14
|
+
export declare function softNormalizeLocale(raw: string): string;
|
|
15
|
+
/** Map soft-normalized key through alias table. */
|
|
16
|
+
export declare function canonicalLocale(soft: string): string;
|
|
17
|
+
/** Validate a top-level locale directory name. */
|
|
18
|
+
export declare function validateLocaleLiteral(literal: string): ValidateLocaleResult;
|
package/dist/document-locale.js
CHANGED
|
@@ -1,33 +1,22 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Locale key validation & canonicalization .
|
|
4
3
|
*/
|
|
5
4
|
import { LOCALE_ALIASES } from './document-schema.js';
|
|
6
5
|
/** Literal must be lowercase ASCII BCP 47-ish with `-` separators only. */
|
|
7
6
|
const LOCALE_LITERAL_RE = /^[a-z]{2,3}(-[a-z0-9]+)*$/;
|
|
8
|
-
/**
|
|
9
|
-
* Soft-normalize for alias / conflict detection (does not validate).
|
|
10
|
-
* @param {string} raw
|
|
11
|
-
*/
|
|
7
|
+
/** Soft-normalize for alias / conflict detection (does not validate). */
|
|
12
8
|
export function softNormalizeLocale(raw) {
|
|
13
9
|
return String(raw || '')
|
|
14
10
|
.trim()
|
|
15
11
|
.toLowerCase()
|
|
16
12
|
.replace(/_/g, '-');
|
|
17
13
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Map soft-normalized key through alias table.
|
|
20
|
-
* @param {string} soft
|
|
21
|
-
*/
|
|
14
|
+
/** Map soft-normalized key through alias table. */
|
|
22
15
|
export function canonicalLocale(soft) {
|
|
23
16
|
const s = softNormalizeLocale(soft);
|
|
24
17
|
return LOCALE_ALIASES[s] || s;
|
|
25
18
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Validate a top-level locale directory name.
|
|
28
|
-
* @param {string} literal
|
|
29
|
-
* @returns {{ ok: true, soft: string, canonical: string } | { ok: false, code: string, message: string }}
|
|
30
|
-
*/
|
|
19
|
+
/** Validate a top-level locale directory name. */
|
|
31
20
|
export function validateLocaleLiteral(literal) {
|
|
32
21
|
const name = String(literal || '');
|
|
33
22
|
if (!name) {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Document — resolve engines.markdown via the official plugin runtime.
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
engine
|
|
4
|
+
export interface ResolveMarkdownEngineOpts {
|
|
5
|
+
engines?: {
|
|
6
|
+
markdown?: string;
|
|
7
|
+
};
|
|
8
|
+
/** Reserved for engine resolution relative to the project (unused by markdown-it). */
|
|
9
|
+
projectRoot?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveMarkdownEngine(opts?: ResolveMarkdownEngineOpts): Promise<{
|
|
12
|
+
engine: string;
|
|
9
13
|
analyzeMarkdown: any;
|
|
10
14
|
renderMarkdown: any;
|
|
11
15
|
slugify: any;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Document — resolve engines.markdown via the official plugin runtime.
|
|
4
3
|
*/
|
|
@@ -8,9 +7,6 @@ import path from 'node:path';
|
|
|
8
7
|
import { fileURLToPath } from 'node:url';
|
|
9
8
|
import { importMaybeTs } from './plugin-host.js';
|
|
10
9
|
const require = createRequire(import.meta.url);
|
|
11
|
-
/**
|
|
12
|
-
* @param {{ engines?: { markdown?: string } }} [opts]
|
|
13
|
-
*/
|
|
14
10
|
export async function resolveMarkdownEngine(opts = {}) {
|
|
15
11
|
const id = opts.engines?.markdown || 'markdown-it';
|
|
16
12
|
if (id !== 'markdown-it') {
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project locale routing — consume Rust LocalePlan (no author JSON5 in TS).
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
defaultLocale: any;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @param {string} routeBase
|
|
15
|
-
* @param {string} pageKey
|
|
16
|
-
*/
|
|
17
|
-
export declare function docsRouteNone(routeBase: any, pageKey: any): string;
|
|
4
|
+
export interface LocalesRouting {
|
|
5
|
+
strategy?: string;
|
|
6
|
+
defaultPrefix?: string;
|
|
7
|
+
defaultLocale?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function loadLocalesRouting(projectRoot: string): LocalesRouting | null;
|
|
10
|
+
export declare function docsRouteNone(routeBase: string, pageKey: string): string;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Project locale routing — consume Rust LocalePlan (no author JSON5 in TS).
|
|
4
3
|
*/
|
|
5
4
|
import { loadLocalePlan } from './author-input.js';
|
|
6
|
-
/**
|
|
7
|
-
* @param {string} projectRoot
|
|
8
|
-
* @returns {{ strategy?: string, defaultPrefix?: string, defaultLocale?: string } | null}
|
|
9
|
-
*/
|
|
10
5
|
export function loadLocalesRouting(projectRoot) {
|
|
11
6
|
const plan = loadLocalePlan(projectRoot);
|
|
12
7
|
if (!plan || plan.diagnostics?.some((d) => d.code === 'vmz::locale::manifest_missing')) {
|
|
@@ -19,10 +14,6 @@ export function loadLocalesRouting(projectRoot) {
|
|
|
19
14
|
defaultLocale: plan.defaultLocale || undefined,
|
|
20
15
|
};
|
|
21
16
|
}
|
|
22
|
-
/**
|
|
23
|
-
* @param {string} routeBase
|
|
24
|
-
* @param {string} pageKey
|
|
25
|
-
*/
|
|
26
17
|
export function docsRouteNone(routeBase, pageKey) {
|
|
27
18
|
const base = String(routeBase || '/').replace(/\/$/, '') || '';
|
|
28
19
|
const key = pageKey === 'index' ? '' : pageKey.replace(/\\/g, '/');
|
package/dist/document-scan.d.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Scan /documents tree → pages + locale dirs .
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
locales: any[];
|
|
19
|
-
pages: any[];
|
|
20
|
-
diagnostics: any[];
|
|
21
|
-
};
|
|
4
|
+
import { type DocumentDiagnostic, type PageIdentity } from './document-schema.js';
|
|
5
|
+
interface ScannedPage {
|
|
6
|
+
identity: PageIdentity;
|
|
7
|
+
sourcePath: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ScanDocumentsTreeResult {
|
|
10
|
+
locales: string[];
|
|
11
|
+
pages: ScannedPage[];
|
|
12
|
+
diagnostics: DocumentDiagnostic[];
|
|
13
|
+
}
|
|
14
|
+
/** PageKey from locale-relative markdown path (strip extension; index → parent or "index"). */
|
|
15
|
+
export declare function pageKeyFromRel(relMd: string): string;
|
|
16
|
+
export declare function scanDocumentsTree(documentsRoot: string): ScanDocumentsTreeResult;
|
|
17
|
+
export {};
|
package/dist/document-scan.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Scan /documents tree → pages + locale dirs .
|
|
4
3
|
*/
|
|
@@ -6,11 +5,6 @@ import fs from 'node:fs';
|
|
|
6
5
|
import path from 'node:path';
|
|
7
6
|
import { DIAG, DOCUMENT_RESERVED_TOP } from './document-schema.js';
|
|
8
7
|
import { canonicalLocale, softNormalizeLocale, validateLocaleLiteral } from './document-locale.js';
|
|
9
|
-
/**
|
|
10
|
-
* @param {string} dir
|
|
11
|
-
* @param {(rel: string) => void} visit
|
|
12
|
-
* @param {string} [prefix]
|
|
13
|
-
*/
|
|
14
8
|
function walkMd(dir, visit, prefix = '') {
|
|
15
9
|
let entries;
|
|
16
10
|
try {
|
|
@@ -32,10 +26,7 @@ function walkMd(dir, visit, prefix = '') {
|
|
|
32
26
|
}
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
|
-
/**
|
|
36
|
-
* PageKey from locale-relative markdown path (strip extension; index → parent or "index").
|
|
37
|
-
* @param {string} relMd e.g. guide/install.md | index.md | guide/index.md
|
|
38
|
-
*/
|
|
29
|
+
/** PageKey from locale-relative markdown path (strip extension; index → parent or "index"). */
|
|
39
30
|
export function pageKeyFromRel(relMd) {
|
|
40
31
|
const norm = relMd.replace(/\\/g, '/').replace(/^\.\//, '');
|
|
41
32
|
let withoutExt = norm.replace(/\.md$/i, '');
|
|
@@ -47,20 +38,9 @@ export function pageKeyFromRel(relMd) {
|
|
|
47
38
|
}
|
|
48
39
|
return withoutExt.replace(/^\/+|\/+$/g, '') || 'index';
|
|
49
40
|
}
|
|
50
|
-
/**
|
|
51
|
-
* @param {string} documentsRoot absolute path to .../documents
|
|
52
|
-
* @returns {{
|
|
53
|
-
* locales: string[],
|
|
54
|
-
* pages: Array<{ identity: { pageKey: string, locale: string }, sourcePath: string }>,
|
|
55
|
-
* diagnostics: Array<{ code: string, severity: string, message: string, path?: string }>,
|
|
56
|
-
* }}
|
|
57
|
-
*/
|
|
58
41
|
export function scanDocumentsTree(documentsRoot) {
|
|
59
|
-
/** @type {Array<{ code: string, severity: string, message: string, path?: string }>} */
|
|
60
42
|
const diagnostics = [];
|
|
61
|
-
/** @type {string[]} */
|
|
62
43
|
const locales = [];
|
|
63
|
-
/** @type {Array<{ identity: { pageKey: string, locale: string }, sourcePath: string }>} */
|
|
64
44
|
const pages = [];
|
|
65
45
|
if (!fs.existsSync(documentsRoot) || !fs.statSync(documentsRoot).isDirectory()) {
|
|
66
46
|
diagnostics.push({
|
|
@@ -71,7 +51,6 @@ export function scanDocumentsTree(documentsRoot) {
|
|
|
71
51
|
});
|
|
72
52
|
return { locales, pages, diagnostics };
|
|
73
53
|
}
|
|
74
|
-
/** @type {Map<string, string[]>} canonical → literals */
|
|
75
54
|
const byCanonical = new Map();
|
|
76
55
|
const top = fs.readdirSync(documentsRoot, { withFileTypes: true });
|
|
77
56
|
for (const ent of top) {
|
|
@@ -92,7 +71,7 @@ export function scanDocumentsTree(documentsRoot) {
|
|
|
92
71
|
if (!ent.isDirectory())
|
|
93
72
|
continue;
|
|
94
73
|
const v = validateLocaleLiteral(ent.name);
|
|
95
|
-
if (
|
|
74
|
+
if (v.ok === false) {
|
|
96
75
|
diagnostics.push({
|
|
97
76
|
code: v.code,
|
|
98
77
|
severity: 'error',
|
|
@@ -3,40 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Not a Doc IR: this is a filesystem/manifest projection only.
|
|
5
5
|
*/
|
|
6
|
-
/** @typedef {{ pageKey: string, locale: string }} PageIdentity */
|
|
7
|
-
/** @typedef {{
|
|
8
|
-
* identity: PageIdentity,
|
|
9
|
-
* sourcePath: string,
|
|
10
|
-
* route?: string | null,
|
|
11
|
-
* anchors?: string[],
|
|
12
|
-
* }} PageRecord */
|
|
13
|
-
/** @typedef {{
|
|
14
|
-
* id: string,
|
|
15
|
-
* sourceRoot: string,
|
|
16
|
-
* pageKeys: string[],
|
|
17
|
-
* }} DocumentCollection */
|
|
18
|
-
/** @typedef {{
|
|
19
|
-
* collectionId: string,
|
|
20
|
-
* routeBase: string,
|
|
21
|
-
* mode: 'integrated' | 'standalone',
|
|
22
|
-
* }} DocumentMount */
|
|
23
|
-
/** @typedef {{
|
|
24
|
-
* code: string,
|
|
25
|
-
* severity: 'error' | 'warning',
|
|
26
|
-
* message: string,
|
|
27
|
-
* path?: string,
|
|
28
|
-
* }} DocumentDiagnostic */
|
|
29
|
-
/** @typedef {{
|
|
30
|
-
* schema: typeof DOCUMENT_MANIFEST_SCHEMA,
|
|
31
|
-
* root: string,
|
|
32
|
-
* defaultLocale: string | null,
|
|
33
|
-
* locales: string[],
|
|
34
|
-
* localeLabels: Record<string, string>,
|
|
35
|
-
* collections: DocumentCollection[],
|
|
36
|
-
* mounts: DocumentMount[],
|
|
37
|
-
* pages: PageRecord[],
|
|
38
|
-
* diagnostics: DocumentDiagnostic[],
|
|
39
|
-
* }} DocumentManifest */
|
|
40
6
|
export declare const DOCUMENT_MANIFEST_SCHEMA = "vmz.document.manifest.v0";
|
|
41
7
|
/** Static page view fragment — not a Doc IR. */
|
|
42
8
|
export declare const DOCUMENT_VIEW_SCHEMA = "vmz.document.view.v0";
|
|
@@ -46,16 +12,163 @@ export declare const DOCUMENT_EVIDENCE_SCHEMA = "vmz.document.evidence.v0";
|
|
|
46
12
|
export declare const DOCUMENT_SEARCH_SCHEMA = "vmz.document.search.v0";
|
|
47
13
|
/** Island-only resume plan for search/playground — not a Doc IR. */
|
|
48
14
|
export declare const DOCUMENT_ISLANDS_SCHEMA = "vmz.document.islands.v0";
|
|
15
|
+
export interface PageIdentity {
|
|
16
|
+
pageKey: string;
|
|
17
|
+
locale: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PageRecord {
|
|
20
|
+
identity: PageIdentity;
|
|
21
|
+
sourcePath: string;
|
|
22
|
+
route?: string | null;
|
|
23
|
+
anchors?: string[];
|
|
24
|
+
title?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DocumentCollection {
|
|
27
|
+
id: string;
|
|
28
|
+
sourceRoot: string;
|
|
29
|
+
pageKeys: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface DocumentMount {
|
|
32
|
+
collectionId: string;
|
|
33
|
+
routeBase: string;
|
|
34
|
+
mode: 'integrated' | 'standalone';
|
|
35
|
+
}
|
|
36
|
+
export interface DocumentDiagnostic {
|
|
37
|
+
code: string;
|
|
38
|
+
severity: 'error' | 'warning';
|
|
39
|
+
message: string;
|
|
40
|
+
path?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface DocumentFenceRecord {
|
|
43
|
+
lang: string;
|
|
44
|
+
info?: string;
|
|
45
|
+
lineStart?: number;
|
|
46
|
+
lineEnd?: number;
|
|
47
|
+
pageKey: string;
|
|
48
|
+
locale: string;
|
|
49
|
+
path?: string;
|
|
50
|
+
run?: string | null;
|
|
51
|
+
source?: string | null;
|
|
52
|
+
playground?: boolean;
|
|
53
|
+
status?: string;
|
|
54
|
+
detail?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface DocumentApiMatch {
|
|
57
|
+
chunkId?: string;
|
|
58
|
+
name?: string;
|
|
59
|
+
source?: string;
|
|
60
|
+
capabilities?: string[];
|
|
61
|
+
stableId?: {
|
|
62
|
+
kind: string;
|
|
63
|
+
id?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface DocumentApiRef {
|
|
67
|
+
query: string;
|
|
68
|
+
pageKey: string;
|
|
69
|
+
locale: string;
|
|
70
|
+
path?: string;
|
|
71
|
+
status: string;
|
|
72
|
+
matches: DocumentApiMatch[];
|
|
73
|
+
}
|
|
74
|
+
export interface DocumentEvidence {
|
|
75
|
+
schema: typeof DOCUMENT_EVIDENCE_SCHEMA;
|
|
76
|
+
fences: DocumentFenceRecord[];
|
|
77
|
+
apiRefs: DocumentApiRef[];
|
|
78
|
+
testSelections: unknown[];
|
|
79
|
+
status: string;
|
|
80
|
+
}
|
|
81
|
+
export interface DocumentSearchHeading {
|
|
82
|
+
id: string;
|
|
83
|
+
level: number;
|
|
84
|
+
text: string;
|
|
85
|
+
}
|
|
86
|
+
export interface DocumentSearchRecord {
|
|
87
|
+
kind: string;
|
|
88
|
+
id: string;
|
|
89
|
+
locale: string;
|
|
90
|
+
pageKey: string;
|
|
91
|
+
route?: string | null;
|
|
92
|
+
title?: string;
|
|
93
|
+
text?: string;
|
|
94
|
+
headings?: DocumentSearchHeading[];
|
|
95
|
+
headingId?: string;
|
|
96
|
+
headingLevel?: number;
|
|
97
|
+
apiSymbolIds?: string[];
|
|
98
|
+
apiSymbolId?: string;
|
|
99
|
+
stableId?: {
|
|
100
|
+
kind: string;
|
|
101
|
+
id?: string;
|
|
102
|
+
};
|
|
103
|
+
version?: string | null;
|
|
104
|
+
}
|
|
105
|
+
export interface DocumentSearchIndex {
|
|
106
|
+
schema: typeof DOCUMENT_SEARCH_SCHEMA;
|
|
107
|
+
status: string;
|
|
108
|
+
version: string | null;
|
|
109
|
+
records: DocumentSearchRecord[];
|
|
110
|
+
}
|
|
111
|
+
export interface DocumentIslandFence {
|
|
112
|
+
lang?: string;
|
|
113
|
+
run?: string | null;
|
|
114
|
+
playground?: boolean;
|
|
115
|
+
source?: string | null;
|
|
116
|
+
pageKey: string;
|
|
117
|
+
locale: string;
|
|
118
|
+
path?: string;
|
|
119
|
+
lineStart?: number;
|
|
120
|
+
lineEnd?: number;
|
|
121
|
+
status?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface DocumentIsland {
|
|
124
|
+
name: string;
|
|
125
|
+
kind: string;
|
|
126
|
+
resume: string;
|
|
127
|
+
index?: string | null;
|
|
128
|
+
fence?: DocumentIslandFence;
|
|
129
|
+
preview?: string | null;
|
|
130
|
+
}
|
|
131
|
+
export interface DocumentIslandsPlan {
|
|
132
|
+
schema: typeof DOCUMENT_ISLANDS_SCHEMA;
|
|
133
|
+
hydrate: string;
|
|
134
|
+
fullPageHydrate: boolean;
|
|
135
|
+
islands: DocumentIsland[];
|
|
136
|
+
status: string;
|
|
137
|
+
}
|
|
138
|
+
export interface DocumentBuildMeta {
|
|
139
|
+
engine?: string;
|
|
140
|
+
outDir?: string;
|
|
141
|
+
designs?: string | null;
|
|
142
|
+
designsCss?: string | null;
|
|
143
|
+
hostShell?: string;
|
|
144
|
+
pages?: Array<{
|
|
145
|
+
route: string;
|
|
146
|
+
htmlPath: string;
|
|
147
|
+
viewPath: string;
|
|
148
|
+
}>;
|
|
149
|
+
evidence?: string;
|
|
150
|
+
search?: string;
|
|
151
|
+
islands?: string;
|
|
152
|
+
}
|
|
153
|
+
export interface DocumentManifest {
|
|
154
|
+
schema: typeof DOCUMENT_MANIFEST_SCHEMA;
|
|
155
|
+
root: string;
|
|
156
|
+
defaultLocale: string | null;
|
|
157
|
+
locales: string[];
|
|
158
|
+
localeLabels: Record<string, string>;
|
|
159
|
+
collections: DocumentCollection[];
|
|
160
|
+
mounts: DocumentMount[];
|
|
161
|
+
pages: PageRecord[];
|
|
162
|
+
diagnostics: DocumentDiagnostic[];
|
|
163
|
+
evidence?: DocumentEvidence;
|
|
164
|
+
search?: DocumentSearchIndex;
|
|
165
|
+
islands?: DocumentIslandsPlan;
|
|
166
|
+
build?: DocumentBuildMeta;
|
|
167
|
+
}
|
|
49
168
|
/** Top-level non-locale reserved names under /documents */
|
|
50
169
|
export declare const DOCUMENT_RESERVED_TOP: Set<string>;
|
|
51
170
|
/** Known locale aliases → canonical key (lowercase, hyphen). */
|
|
52
|
-
export declare const LOCALE_ALIASES:
|
|
53
|
-
'zh-cn': string;
|
|
54
|
-
'zh-sg': string;
|
|
55
|
-
'zh-tw': string;
|
|
56
|
-
'zh-hk': string;
|
|
57
|
-
'zh-mo': string;
|
|
58
|
-
};
|
|
171
|
+
export declare const LOCALE_ALIASES: Record<string, string>;
|
|
59
172
|
export declare const DIAG: {
|
|
60
173
|
LOCALE_INVALID: string;
|
|
61
174
|
LOCALE_CASE: string;
|
package/dist/document-schema.js
CHANGED
|
@@ -1,43 +1,8 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Document contract — schema constants & diagnostic codes.
|
|
4
3
|
*
|
|
5
4
|
* Not a Doc IR: this is a filesystem/manifest projection only.
|
|
6
5
|
*/
|
|
7
|
-
/** @typedef {{ pageKey: string, locale: string }} PageIdentity */
|
|
8
|
-
/** @typedef {{
|
|
9
|
-
* identity: PageIdentity,
|
|
10
|
-
* sourcePath: string,
|
|
11
|
-
* route?: string | null,
|
|
12
|
-
* anchors?: string[],
|
|
13
|
-
* }} PageRecord */
|
|
14
|
-
/** @typedef {{
|
|
15
|
-
* id: string,
|
|
16
|
-
* sourceRoot: string,
|
|
17
|
-
* pageKeys: string[],
|
|
18
|
-
* }} DocumentCollection */
|
|
19
|
-
/** @typedef {{
|
|
20
|
-
* collectionId: string,
|
|
21
|
-
* routeBase: string,
|
|
22
|
-
* mode: 'integrated' | 'standalone',
|
|
23
|
-
* }} DocumentMount */
|
|
24
|
-
/** @typedef {{
|
|
25
|
-
* code: string,
|
|
26
|
-
* severity: 'error' | 'warning',
|
|
27
|
-
* message: string,
|
|
28
|
-
* path?: string,
|
|
29
|
-
* }} DocumentDiagnostic */
|
|
30
|
-
/** @typedef {{
|
|
31
|
-
* schema: typeof DOCUMENT_MANIFEST_SCHEMA,
|
|
32
|
-
* root: string,
|
|
33
|
-
* defaultLocale: string | null,
|
|
34
|
-
* locales: string[],
|
|
35
|
-
* localeLabels: Record<string, string>,
|
|
36
|
-
* collections: DocumentCollection[],
|
|
37
|
-
* mounts: DocumentMount[],
|
|
38
|
-
* pages: PageRecord[],
|
|
39
|
-
* diagnostics: DocumentDiagnostic[],
|
|
40
|
-
* }} DocumentManifest */
|
|
41
6
|
export const DOCUMENT_MANIFEST_SCHEMA = 'vmz.document.manifest.v0';
|
|
42
7
|
/** Static page view fragment — not a Doc IR. */
|
|
43
8
|
export const DOCUMENT_VIEW_SCHEMA = 'vmz.document.view.v0';
|
|
@@ -3,20 +3,32 @@
|
|
|
3
3
|
* Packaging only — does not invent route / MIME / fallback semantics.
|
|
4
4
|
*/
|
|
5
5
|
export declare const EMBEDDED_RESOURCE_INDEX_SCHEMA = "vmz.embedded.resource_index.v0";
|
|
6
|
+
interface EmbeddedPackagingOpts {
|
|
7
|
+
siteId?: string;
|
|
8
|
+
contractDigest?: string | null;
|
|
9
|
+
}
|
|
10
|
+
interface EmbeddedResourceIndex {
|
|
11
|
+
schema: string;
|
|
12
|
+
siteId: string | null;
|
|
13
|
+
contractDigest: string | null;
|
|
14
|
+
objectCount: number;
|
|
15
|
+
objects: Array<{
|
|
16
|
+
path: string;
|
|
17
|
+
digest: string;
|
|
18
|
+
blob: string;
|
|
19
|
+
bytes: number;
|
|
20
|
+
}>;
|
|
21
|
+
indexDigest?: string;
|
|
22
|
+
}
|
|
6
23
|
/**
|
|
7
24
|
* Walk outDir and build path → digest → relative blob path map.
|
|
8
25
|
* Copies files into `dist/_vmz/embedded-baseline/` (whole release, no file-level mix).
|
|
9
26
|
* @param {string} outDir
|
|
10
27
|
* @param {{ siteId?: string, contractDigest?: string | null }} [opts]
|
|
11
28
|
*/
|
|
12
|
-
export declare function emitEmbeddedPackaging(outDir:
|
|
13
|
-
index:
|
|
14
|
-
schema: string;
|
|
15
|
-
siteId: any;
|
|
16
|
-
contractDigest: any;
|
|
17
|
-
objectCount: number;
|
|
18
|
-
objects: any[];
|
|
19
|
-
};
|
|
29
|
+
export declare function emitEmbeddedPackaging(outDir: string, opts?: EmbeddedPackagingOpts): {
|
|
30
|
+
index: EmbeddedResourceIndex;
|
|
20
31
|
indexPath: string;
|
|
21
32
|
baselineDir: string;
|
|
22
33
|
};
|
|
34
|
+
export {};
|
package/dist/explain-cmd.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @returns {number}
|
|
2
|
+
* `vmz explain` — DX causal explain; registered on `@vmz/commander`.
|
|
4
3
|
*/
|
|
5
|
-
|
|
4
|
+
import type { Cli, ParsedOptions } from '@vmz/commander';
|
|
5
|
+
export declare function registerExplainCommand(cli: Cli): void;
|
|
6
|
+
export declare function cmdExplain(args: ParsedOptions): number;
|