@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* Document
|
|
4
|
-
* Design: 规划设计/vmz/19 §5–6 · §8 D3
|
|
3
|
+
* Document Interactive — search index + Island-only resume plan.
|
|
5
4
|
*
|
|
6
5
|
* Not a Doc IR: build artifacts + ResumeEntry-shaped island hosts.
|
|
7
6
|
* Static HTML stays no-JS readable; islands resume later, never full-page hydrate.
|
|
@@ -27,10 +26,10 @@ export function htmlToSearchText(html) {
|
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
29
28
|
* @param {{
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* manifest: any,
|
|
30
|
+
* enriched: { byId: Map<string, any> },
|
|
31
|
+
* evidence: any,
|
|
32
|
+
* version?: string | null,
|
|
34
33
|
* }} opts
|
|
35
34
|
*/
|
|
36
35
|
export function buildDocumentSearch(opts) {
|
|
@@ -114,9 +113,9 @@ export function buildDocumentSearch(opts) {
|
|
|
114
113
|
/**
|
|
115
114
|
* Island-only resume plan for document surfaces.
|
|
116
115
|
* @param {{
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
116
|
+
* evidence: any,
|
|
117
|
+
* searchHref?: string,
|
|
118
|
+
* fenceBodies?: Map<string, string>,
|
|
120
119
|
* }} opts
|
|
121
120
|
*/
|
|
122
121
|
export function buildDocumentIslands(opts) {
|
|
@@ -216,10 +215,10 @@ export function collectFenceBodies(analyzedByPageId, pages) {
|
|
|
216
215
|
/**
|
|
217
216
|
* Render SSR island shells (no script — resume later).
|
|
218
217
|
* @param {{
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
218
|
+
* islands: any,
|
|
219
|
+
* searchIndexHref: string,
|
|
220
|
+
* pageKey: string,
|
|
221
|
+
* locale: string,
|
|
223
222
|
* }} opts
|
|
224
223
|
*/
|
|
225
224
|
export function renderIslandShellsHtml(opts) {
|
package/dist/document-locale.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Document
|
|
3
|
-
* Design: 规划设计/vmz/19 §3 · 23 §0(runtime.ts;与 plugin-host 同一 importMaybeTs).
|
|
2
|
+
* Document — resolve engines.markdown via the official plugin runtime.
|
|
4
3
|
*/
|
|
5
4
|
/**
|
|
6
5
|
* @param {{ engines?: { markdown?: string } }} [opts]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* Document
|
|
4
|
-
* Design: 规划设计/vmz/19 §3 · 23 §0(runtime.ts;与 plugin-host 同一 importMaybeTs).
|
|
3
|
+
* Document — resolve engines.markdown via the official plugin runtime.
|
|
5
4
|
*/
|
|
6
5
|
import { createRequire } from 'node:module';
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { importMaybeTs } from './plugin-host.js';
|
|
@@ -14,17 +14,23 @@ const require = createRequire(import.meta.url);
|
|
|
14
14
|
export async function resolveMarkdownEngine(opts = {}) {
|
|
15
15
|
const id = opts.engines?.markdown || 'markdown-it';
|
|
16
16
|
if (id !== 'markdown-it') {
|
|
17
|
-
throw new Error(`unsupported engines.markdown ${JSON.stringify(id)} (
|
|
17
|
+
throw new Error(`unsupported engines.markdown ${JSON.stringify(id)} (markdown-it only)`);
|
|
18
18
|
}
|
|
19
|
-
let runtimeFile;
|
|
19
|
+
let runtimeFile = null;
|
|
20
20
|
try {
|
|
21
21
|
const pkg = require.resolve('@vmz/plugin-markdown-it/package.json');
|
|
22
22
|
runtimeFile = path.join(path.dirname(pkg), 'runtime.ts');
|
|
23
23
|
}
|
|
24
|
-
catch
|
|
25
|
-
//
|
|
24
|
+
catch {
|
|
25
|
+
// Developer mode: monorepo source checkout.
|
|
26
26
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
27
|
-
|
|
27
|
+
const fallback = path.resolve(here, '../../../plugins/vmz-plugin-markdown-it/runtime.ts');
|
|
28
|
+
if (existsSync(fallback))
|
|
29
|
+
runtimeFile = fallback;
|
|
30
|
+
}
|
|
31
|
+
if (!runtimeFile || !existsSync(runtimeFile)) {
|
|
32
|
+
throw new Error('markdown engine needs `@vmz/plugin-markdown-it` (optional peer of `@vmz/vmz`).\n' +
|
|
33
|
+
' Install: pnpm add -D @vmz/plugin-markdown-it');
|
|
28
34
|
}
|
|
29
35
|
const mod = await importMaybeTs(runtimeFile);
|
|
30
36
|
if (typeof mod.analyzeMarkdown !== 'function') {
|
package/dist/document-scan.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Scan /documents tree → pages + locale dirs
|
|
2
|
+
* Scan /documents tree → pages + locale dirs .
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* PageKey from locale-relative markdown path (strip extension; index → parent or "index").
|
|
@@ -9,9 +9,9 @@ export declare function pageKeyFromRel(relMd: any): any;
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {string} documentsRoot absolute path to .../documents
|
|
11
11
|
* @returns {{
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* locales: string[],
|
|
13
|
+
* pages: Array<{ identity: { pageKey: string, locale: string }, sourcePath: string }>,
|
|
14
|
+
* diagnostics: Array<{ code: string, severity: string, message: string, path?: string }>,
|
|
15
15
|
* }}
|
|
16
16
|
*/
|
|
17
17
|
export declare function scanDocumentsTree(documentsRoot: any): {
|
package/dist/document-scan.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* Scan /documents tree → pages + locale dirs
|
|
3
|
+
* Scan /documents tree → pages + locale dirs .
|
|
4
4
|
*/
|
|
5
5
|
import fs from 'node:fs';
|
|
6
6
|
import path from 'node:path';
|
|
@@ -50,9 +50,9 @@ export function pageKeyFromRel(relMd) {
|
|
|
50
50
|
/**
|
|
51
51
|
* @param {string} documentsRoot absolute path to .../documents
|
|
52
52
|
* @returns {{
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
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
56
|
* }}
|
|
57
57
|
*/
|
|
58
58
|
export function scanDocumentsTree(documentsRoot) {
|
|
@@ -1,51 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Document
|
|
3
|
-
* Design: 规划设计/vmz/19 §2.3 · D0
|
|
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
6
|
/** @typedef {{ pageKey: string, locale: string }} PageIdentity */
|
|
8
7
|
/** @typedef {{
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* identity: PageIdentity,
|
|
9
|
+
* sourcePath: string,
|
|
10
|
+
* route?: string | null,
|
|
11
|
+
* anchors?: string[],
|
|
13
12
|
* }} PageRecord */
|
|
14
13
|
/** @typedef {{
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* id: string,
|
|
15
|
+
* sourceRoot: string,
|
|
16
|
+
* pageKeys: string[],
|
|
18
17
|
* }} DocumentCollection */
|
|
19
18
|
/** @typedef {{
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* collectionId: string,
|
|
20
|
+
* routeBase: string,
|
|
21
|
+
* mode: 'integrated' | 'standalone',
|
|
23
22
|
* }} DocumentMount */
|
|
24
23
|
/** @typedef {{
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
24
|
+
* code: string,
|
|
25
|
+
* severity: 'error' | 'warning',
|
|
26
|
+
* message: string,
|
|
27
|
+
* path?: string,
|
|
29
28
|
* }} DocumentDiagnostic */
|
|
30
29
|
/** @typedef {{
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
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[],
|
|
40
39
|
* }} DocumentManifest */
|
|
41
40
|
export declare const DOCUMENT_MANIFEST_SCHEMA = "vmz.document.manifest.v0";
|
|
42
|
-
/** Static page view fragment
|
|
41
|
+
/** Static page view fragment — not a Doc IR. */
|
|
43
42
|
export declare const DOCUMENT_VIEW_SCHEMA = "vmz.document.view.v0";
|
|
44
|
-
/**
|
|
43
|
+
/** Evidence projection (fences + API refs) — not a Doc IR. */
|
|
45
44
|
export declare const DOCUMENT_EVIDENCE_SCHEMA = "vmz.document.evidence.v0";
|
|
46
|
-
/**
|
|
45
|
+
/** Search index (SearchRecord[]) — not a Doc IR. */
|
|
47
46
|
export declare const DOCUMENT_SEARCH_SCHEMA = "vmz.document.search.v0";
|
|
48
|
-
/**
|
|
47
|
+
/** Island-only resume plan for search/playground — not a Doc IR. */
|
|
49
48
|
export declare const DOCUMENT_ISLANDS_SCHEMA = "vmz.document.islands.v0";
|
|
50
49
|
/** Top-level non-locale reserved names under /documents */
|
|
51
50
|
export declare const DOCUMENT_RESERVED_TOP: Set<string>;
|
package/dist/document-schema.js
CHANGED
|
@@ -1,52 +1,51 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* Document
|
|
4
|
-
* Design: 规划设计/vmz/19 §2.3 · D0
|
|
3
|
+
* Document contract — schema constants & diagnostic codes.
|
|
5
4
|
*
|
|
6
5
|
* Not a Doc IR: this is a filesystem/manifest projection only.
|
|
7
6
|
*/
|
|
8
7
|
/** @typedef {{ pageKey: string, locale: string }} PageIdentity */
|
|
9
8
|
/** @typedef {{
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* identity: PageIdentity,
|
|
10
|
+
* sourcePath: string,
|
|
11
|
+
* route?: string | null,
|
|
12
|
+
* anchors?: string[],
|
|
14
13
|
* }} PageRecord */
|
|
15
14
|
/** @typedef {{
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* id: string,
|
|
16
|
+
* sourceRoot: string,
|
|
17
|
+
* pageKeys: string[],
|
|
19
18
|
* }} DocumentCollection */
|
|
20
19
|
/** @typedef {{
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* collectionId: string,
|
|
21
|
+
* routeBase: string,
|
|
22
|
+
* mode: 'integrated' | 'standalone',
|
|
24
23
|
* }} DocumentMount */
|
|
25
24
|
/** @typedef {{
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* code: string,
|
|
26
|
+
* severity: 'error' | 'warning',
|
|
27
|
+
* message: string,
|
|
28
|
+
* path?: string,
|
|
30
29
|
* }} DocumentDiagnostic */
|
|
31
30
|
/** @typedef {{
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
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[],
|
|
41
40
|
* }} DocumentManifest */
|
|
42
41
|
export const DOCUMENT_MANIFEST_SCHEMA = 'vmz.document.manifest.v0';
|
|
43
|
-
/** Static page view fragment
|
|
42
|
+
/** Static page view fragment — not a Doc IR. */
|
|
44
43
|
export const DOCUMENT_VIEW_SCHEMA = 'vmz.document.view.v0';
|
|
45
|
-
/**
|
|
44
|
+
/** Evidence projection (fences + API refs) — not a Doc IR. */
|
|
46
45
|
export const DOCUMENT_EVIDENCE_SCHEMA = 'vmz.document.evidence.v0';
|
|
47
|
-
/**
|
|
46
|
+
/** Search index (SearchRecord[]) — not a Doc IR. */
|
|
48
47
|
export const DOCUMENT_SEARCH_SCHEMA = 'vmz.document.search.v0';
|
|
49
|
-
/**
|
|
48
|
+
/** Island-only resume plan for search/playground — not a Doc IR. */
|
|
50
49
|
export const DOCUMENT_ISLANDS_SCHEMA = 'vmz.document.islands.v0';
|
|
51
50
|
/** Top-level non-locale reserved names under /documents */
|
|
52
51
|
export const DOCUMENT_RESERVED_TOP = new Set(['package.json', 'documents.config.ts', 'documents.config.json', 'documents.config.js', 'public']);
|
package/dist/explain-cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* `vmz explain` — DX causal explain queries
|
|
3
|
+
* `vmz explain` — DX causal explain queries .
|
|
4
4
|
*
|
|
5
5
|
* @param {string[]} argv args after `explain`
|
|
6
6
|
*/
|
|
@@ -69,10 +69,10 @@ export function cmdExplain(argv) {
|
|
|
69
69
|
for (const e of chain) {
|
|
70
70
|
const from = e.from ? `${e.from.kind}:${e.from.id}` : '?';
|
|
71
71
|
const to = e.to ? `${e.to.kind}:${e.to.id}` : '?';
|
|
72
|
-
console.log(`
|
|
72
|
+
console.log(` ${from} -> ${to} (${e.reason})`);
|
|
73
73
|
}
|
|
74
74
|
if (chain.length === 0) {
|
|
75
|
-
console.log('
|
|
75
|
+
console.log(' (empty chain)');
|
|
76
76
|
}
|
|
77
77
|
return 0;
|
|
78
78
|
}
|