@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
package/dist/refactor-cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* `vmz refactor` —
|
|
3
|
+
* `vmz refactor` — RouteId/field safe rename (plan + atomic apply).
|
|
4
4
|
*/
|
|
5
5
|
import { createWorkspace } from './index.js';
|
|
6
6
|
import { log } from './log.js';
|
|
@@ -23,7 +23,7 @@ export async function cmdRefactor(argv) {
|
|
|
23
23
|
return 1;
|
|
24
24
|
}
|
|
25
25
|
function printRefactorHelp() {
|
|
26
|
-
console.log(`vmz refactor — workspace edit plans
|
|
26
|
+
console.log(`vmz refactor — workspace edit plans
|
|
27
27
|
|
|
28
28
|
Usage:
|
|
29
29
|
vmz refactor rename --kind <route_id|field|method|component|capability> --from <id> --to <id> [path]
|
|
@@ -136,16 +136,16 @@ function cmdRename(argv) {
|
|
|
136
136
|
else {
|
|
137
137
|
log.info(`rename ${kind} \`${from}\` → \`${to}\` → ${plan.status}`);
|
|
138
138
|
for (const p of plan.preconditions || []) {
|
|
139
|
-
console.log(`
|
|
139
|
+
console.log(` precondition: ${p}`);
|
|
140
140
|
}
|
|
141
141
|
for (const e of plan.edits || []) {
|
|
142
|
-
console.log(`
|
|
142
|
+
console.log(` edit ${e.path} @${e.start}..${e.end} → ${JSON.stringify(e.newText)}`);
|
|
143
143
|
}
|
|
144
144
|
for (const d of plan.diagnostics || []) {
|
|
145
|
-
console.log(`
|
|
145
|
+
console.log(` ${d.severity || 'info'}: ${d.message}`);
|
|
146
146
|
}
|
|
147
147
|
if ((plan.edits || []).length === 0) {
|
|
148
|
-
console.log('
|
|
148
|
+
console.log(' edits: (none)');
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
return plan.status === 'rejected' ? 1 : 0;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the native `vmz` CLI binary (vmz-tools), never the Node wrapper.
|
|
3
|
+
* Used by `vmz lsp` / `vmz mcp` so stdio servers stay one binary for all hosts.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} [startDir]
|
|
7
|
+
* @returns {string | null}
|
|
8
|
+
*/
|
|
9
|
+
export declare function findRepoRoot(startDir?: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* @param {{ cwd?: string }} [opts]
|
|
12
|
+
* @returns {string | null} absolute path to native vmz binary
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveNativeVmzCli(opts?: {}): any;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the native `vmz` CLI binary (vmz-tools), never the Node wrapper.
|
|
4
|
+
* Used by `vmz lsp` / `vmz mcp` so stdio servers stay one binary for all hosts.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, statSync } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
const exe = process.platform === 'win32' ? 'vmz.exe' : 'vmz';
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} [startDir]
|
|
12
|
+
* @returns {string | null}
|
|
13
|
+
*/
|
|
14
|
+
export function findRepoRoot(startDir = process.cwd()) {
|
|
15
|
+
let dir = path.resolve(startDir);
|
|
16
|
+
for (let i = 0; i < 12; i++) {
|
|
17
|
+
if (existsSync(path.join(dir, 'Cargo.toml')) && existsSync(path.join(dir, 'package.json'))) {
|
|
18
|
+
return dir;
|
|
19
|
+
}
|
|
20
|
+
const parent = path.dirname(dir);
|
|
21
|
+
if (parent === dir)
|
|
22
|
+
break;
|
|
23
|
+
dir = parent;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Prefer the newer of release/debug so a fresh `cargo build` is not shadowed by a stale release.
|
|
29
|
+
* @param {string} repo
|
|
30
|
+
* @returns {string | null}
|
|
31
|
+
*/
|
|
32
|
+
function pickNewestProfileBinary(repo) {
|
|
33
|
+
/** @type {{ path: string, mtime: number } | null} */
|
|
34
|
+
let best = null;
|
|
35
|
+
for (const profile of ['release', 'debug']) {
|
|
36
|
+
const candidate = path.join(repo, 'target', profile, exe);
|
|
37
|
+
if (!existsSync(candidate))
|
|
38
|
+
continue;
|
|
39
|
+
let mtime = 0;
|
|
40
|
+
try {
|
|
41
|
+
mtime = statSync(candidate).mtimeMs;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (!best || mtime > best.mtime)
|
|
47
|
+
best = { path: candidate, mtime };
|
|
48
|
+
}
|
|
49
|
+
return best?.path ?? null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @param {{ cwd?: string }} [opts]
|
|
53
|
+
* @returns {string | null} absolute path to native vmz binary
|
|
54
|
+
*/
|
|
55
|
+
export function resolveNativeVmzCli(opts = {}) {
|
|
56
|
+
if (typeof process.env.VMZ_NATIVE === 'string' && process.env.VMZ_NATIVE.trim()) {
|
|
57
|
+
const p = path.resolve(process.env.VMZ_NATIVE.trim());
|
|
58
|
+
if (existsSync(p))
|
|
59
|
+
return p;
|
|
60
|
+
}
|
|
61
|
+
const roots = [];
|
|
62
|
+
if (opts.cwd)
|
|
63
|
+
roots.push(path.resolve(opts.cwd));
|
|
64
|
+
roots.push(process.cwd());
|
|
65
|
+
try {
|
|
66
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
67
|
+
// packages/runtimes/vmz/dist → repo root
|
|
68
|
+
roots.push(path.resolve(here, '../../../..'));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
/* ignore */
|
|
72
|
+
}
|
|
73
|
+
const seen = new Set();
|
|
74
|
+
for (const start of roots) {
|
|
75
|
+
const repo = findRepoRoot(start);
|
|
76
|
+
if (!repo || seen.has(repo))
|
|
77
|
+
continue;
|
|
78
|
+
seen.add(repo);
|
|
79
|
+
const picked = pickNewestProfileBinary(repo);
|
|
80
|
+
if (picked)
|
|
81
|
+
return picked;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
package/dist/resolve.d.ts
CHANGED
package/dist/resolve.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* Shared project path resolution for the Node CLI host
|
|
4
|
-
* Design: `规划设计/vmz/14-Node-NAPI与插件宿主.md`
|
|
3
|
+
* Shared project path resolution for the Node CLI host .
|
|
5
4
|
*/
|
|
6
5
|
import { existsSync, readFileSync } from 'node:fs';
|
|
7
6
|
import path from 'node:path';
|
package/dist/test-cmd.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `vmz test` command
|
|
3
|
-
* Semantics live in `@vmz/test
|
|
2
|
+
* `vmz test` command — discovery / build / filter / TestReport orchestration.
|
|
3
|
+
* Semantics live in `@vmz/test` (optional peer — not installed with bare `@vmz/vmz`).
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @param {Record<string, string | boolean> & { _: string[] }} args
|
package/dist/test-cmd.js
CHANGED
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* `vmz test` command
|
|
4
|
-
* Semantics live in `@vmz/test
|
|
3
|
+
* `vmz test` command — discovery / build / filter / TestReport orchestration.
|
|
4
|
+
* Semantics live in `@vmz/test` (optional peer — not installed with bare `@vmz/vmz`).
|
|
5
5
|
*/
|
|
6
6
|
import path from 'node:path';
|
|
7
|
-
import { discoverTestManifests, buildTestReport, parseModes, buildForCompile, runCompileManifest, runLogicManifest, runSsrManifest, runResumeManifest, runBrowserManifest, runDeploymentManifest, } from '@vmz/test';
|
|
8
7
|
import { createWorkspace } from './index.js';
|
|
9
8
|
import { log } from './log.js';
|
|
9
|
+
/**
|
|
10
|
+
* @returns {Promise<typeof import('@vmz/test')>}
|
|
11
|
+
*/
|
|
12
|
+
async function loadTestPackage() {
|
|
13
|
+
try {
|
|
14
|
+
return await import('@vmz/test');
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
const detail = e instanceof Error ? e.message : String(e);
|
|
18
|
+
throw new Error('`vmz test` needs `@vmz/test` (optional peer of `@vmz/vmz`).\n' + ' Install: pnpm add -D @vmz/test\n' + ` Detail: ${detail}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
10
21
|
/**
|
|
11
22
|
* @param {Record<string, string | boolean> & { _: string[] }} args
|
|
12
23
|
* @returns {Promise<number>}
|
|
13
24
|
*/
|
|
14
25
|
export async function cmdTest(args) {
|
|
26
|
+
let test;
|
|
27
|
+
try {
|
|
28
|
+
test = await loadTestPackage();
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
log.error(e instanceof Error ? e.message : String(e));
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
const { discoverTestManifests, buildTestReport, parseModes, buildForCompile, runCompileManifest, runLogicManifest, runSsrManifest, runResumeManifest, runBrowserManifest, runDeploymentManifest, } = test;
|
|
15
35
|
const project = path.resolve(String(args._[0] || '.'));
|
|
16
36
|
let modes;
|
|
17
37
|
try {
|
|
@@ -74,7 +94,7 @@ export async function cmdTest(args) {
|
|
|
74
94
|
const ws = createWorkspace({ root: project, outDir });
|
|
75
95
|
try {
|
|
76
96
|
if (typeof ws.selectTestsAffected !== 'function') {
|
|
77
|
-
log.error('selectTestsAffected missing on Workspace
|
|
97
|
+
log.error('selectTestsAffected missing on Workspace — rebuild native (`pnpm napi:build`)');
|
|
78
98
|
return 1;
|
|
79
99
|
}
|
|
80
100
|
const raw = ws.selectTestsAffected();
|
|
@@ -85,14 +105,14 @@ export async function cmdTest(args) {
|
|
|
85
105
|
log.error(`test selection not JSON: ${e}`);
|
|
86
106
|
return 1;
|
|
87
107
|
}
|
|
88
|
-
log.info(`affected selection: ${testSelection.status}
|
|
108
|
+
log.info(`affected selection: ${testSelection.status} — ${testSelection.reason} (chunks=${(testSelection.affectedChunkIds || []).length})`);
|
|
89
109
|
const ids = new Set((testSelection.testIds || []).map(String));
|
|
90
110
|
const chunks = new Set((testSelection.affectedChunkIds || []).map(String));
|
|
91
111
|
if (ids.size > 0) {
|
|
92
112
|
selected = selected.filter((m) => ids.has(String(m.id || '')));
|
|
93
113
|
}
|
|
94
114
|
else if (chunks.size > 0) {
|
|
95
|
-
// Scaffold fallback: match manifest program.chunkId until graph
|
|
115
|
+
// Scaffold fallback: match manifest program.chunkId until graph->test edges exist.
|
|
96
116
|
selected = selected.filter((m) => {
|
|
97
117
|
const program = m.program && typeof m.program === 'object' ? m.program : {};
|
|
98
118
|
const chunk = program.chunkId ? String(program.chunkId) : '';
|
|
@@ -115,13 +135,13 @@ export async function cmdTest(args) {
|
|
|
115
135
|
selected = selected.filter((m) => Array.isArray(m.modes) && m.modes.some((x) => modes.includes(x)));
|
|
116
136
|
}
|
|
117
137
|
/** @type {Array<{
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
138
|
+
* testId: string,
|
|
139
|
+
* file: string,
|
|
140
|
+
* modes: string[],
|
|
141
|
+
* programId: string|null,
|
|
142
|
+
* planId: string|null,
|
|
143
|
+
* status: string,
|
|
144
|
+
* diagnostics: unknown[],
|
|
125
145
|
* }>} */
|
|
126
146
|
let tests;
|
|
127
147
|
if (wantList) {
|
|
@@ -288,7 +308,7 @@ export async function cmdTest(args) {
|
|
|
288
308
|
else {
|
|
289
309
|
console.log(`vmz test: ${tests.length} test(s) under ${project}`);
|
|
290
310
|
for (const t of tests) {
|
|
291
|
-
console.log(`
|
|
311
|
+
console.log(` ${t.testId}\t${t.file}\t[${t.modes.join(',')}]`);
|
|
292
312
|
}
|
|
293
313
|
}
|
|
294
314
|
if (errors.length) {
|
|
@@ -316,10 +336,10 @@ export async function cmdTest(args) {
|
|
|
316
336
|
}
|
|
317
337
|
console.log(`vmz test: ${tests.length} test(s) — ${reportStatus}`);
|
|
318
338
|
for (const t of tests) {
|
|
319
|
-
console.log(`
|
|
339
|
+
console.log(` ${t.status}\t${t.testId}\t${t.file}`);
|
|
320
340
|
for (const d of t.diagnostics || []) {
|
|
321
341
|
if (d && typeof d === 'object' && d.severity === 'error') {
|
|
322
|
-
console.log(`
|
|
342
|
+
console.log(` ! ${d.message}`);
|
|
323
343
|
if (process.env.GITHUB_ACTIONS === 'true') {
|
|
324
344
|
const msg = String(d.message || 'error').replace(/[\r\n]+/g, ' ');
|
|
325
345
|
console.log(`::error title=vmz test ${t.testId}::${msg}`);
|
|
@@ -333,7 +353,7 @@ export async function cmdTest(args) {
|
|
|
333
353
|
}
|
|
334
354
|
}
|
|
335
355
|
if (tests.length === 0) {
|
|
336
|
-
console.log('
|
|
356
|
+
console.log(' (add *.vmz.test.json manifests)');
|
|
337
357
|
}
|
|
338
358
|
if (errors.length)
|
|
339
359
|
return 2;
|
package/dist/watch-diff.d.ts
CHANGED
package/dist/watch-diff.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
* Track per-file fingerprints so dev rebuilds only dirty leaves (
|
|
3
|
+
* Track per-file fingerprints so dev rebuilds only dirty leaves (session).
|
|
4
4
|
*/
|
|
5
5
|
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
6
6
|
import path from 'node:path';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vmz/vmz",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "VMZ Node toolchain — N-API workspace session + CLI",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,25 +48,40 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@vmz/
|
|
52
|
-
"@vmz/plugin
|
|
53
|
-
"@vmz/protocol": "0.0.
|
|
54
|
-
"@vmz/test": "0.0.2",
|
|
51
|
+
"@vmz/core": "0.0.3",
|
|
52
|
+
"@vmz/plugin": "0.0.3",
|
|
53
|
+
"@vmz/protocol": "0.0.3",
|
|
55
54
|
"jiti": "^2.6.1",
|
|
56
|
-
"json5": "^2.2.3"
|
|
55
|
+
"json5": "^2.2.3"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@vmz/plugin-markdown-it": "0.0.3",
|
|
59
|
+
"@vmz/test": "0.0.3",
|
|
57
60
|
"typescript": "^5.8.3"
|
|
58
61
|
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"@vmz/plugin-markdown-it": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"@vmz/test": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"typescript": {
|
|
70
|
+
"optional": true
|
|
71
|
+
}
|
|
72
|
+
},
|
|
59
73
|
"files": [
|
|
60
74
|
"bin",
|
|
61
75
|
"dist",
|
|
62
|
-
"*.node",
|
|
63
76
|
"README.md"
|
|
64
77
|
],
|
|
65
78
|
"scripts": {
|
|
66
|
-
"build:native": "node ../../../scripts/build
|
|
79
|
+
"build:native": "node ../../../scripts/build/napi.mjs",
|
|
67
80
|
"build": "pnpm run build:native && pnpm run build:js",
|
|
68
|
-
"test": "node ./tests/run-node-tests.
|
|
69
|
-
"
|
|
81
|
+
"test": "node --experimental-strip-types ./tests/run-node-tests.ts",
|
|
82
|
+
"verify": "node --import ../../../scripts/test/resolve-ts-from-js.mjs --experimental-strip-types ./tests/conformance/run.ts",
|
|
83
|
+
"verify:list": "node --import ../../../scripts/test/resolve-ts-from-js.mjs --experimental-strip-types ./tests/conformance/run.ts --list",
|
|
84
|
+
"build:js": "tsc -p tsconfig.json && node ../../../scripts/build/copy-vmz-public-api.mjs"
|
|
70
85
|
},
|
|
71
86
|
"keywords": [
|
|
72
87
|
"vmz",
|
|
@@ -75,12 +90,12 @@
|
|
|
75
90
|
"cli"
|
|
76
91
|
],
|
|
77
92
|
"optionalDependencies": {
|
|
78
|
-
"@vmz/vmz-win32-x64": "0.0.
|
|
79
|
-
"@vmz/vmz-win32-arm64": "0.0.
|
|
80
|
-
"@vmz/vmz-darwin-x64": "0.0.
|
|
81
|
-
"@vmz/vmz-darwin-arm64": "0.0.
|
|
82
|
-
"@vmz/vmz-linux-x64": "0.0.
|
|
83
|
-
"@vmz/vmz-linux-arm64": "0.0.
|
|
93
|
+
"@vmz/vmz-win32-x64": "0.0.3",
|
|
94
|
+
"@vmz/vmz-win32-arm64": "0.0.3",
|
|
95
|
+
"@vmz/vmz-darwin-x64": "0.0.3",
|
|
96
|
+
"@vmz/vmz-darwin-arm64": "0.0.3",
|
|
97
|
+
"@vmz/vmz-linux-x64": "0.0.3",
|
|
98
|
+
"@vmz/vmz-linux-arm64": "0.0.3"
|
|
84
99
|
},
|
|
85
100
|
"publishConfig": {
|
|
86
101
|
"access": "public"
|