@vmz/vmz 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
package/dist/native-addon.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export declare function
|
|
1
|
+
export interface NativeAddon {
|
|
2
|
+
generatePrettyJson?: (json: string) => string;
|
|
3
|
+
authorJson5ToCanonicalJson?: (source: string) => string;
|
|
4
|
+
loadLocalePlan?: (projectRoot: string) => string;
|
|
5
|
+
loadDocumentRoutePlan?: (projectRoot: string) => string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
/** Load the N-API addon or throw (production printers must not fall back to TS). */
|
|
9
|
+
export declare function requireNativeAddon(): NativeAddon;
|
|
10
|
+
export declare function tryLoadNativeAddon(): NativeAddon | null;
|
package/dist/native-addon.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Load the N-API `.node` addon without importing `index.js`
|
|
4
3
|
* (avoids cycles with modules re-exported from the package entry).
|
|
@@ -8,12 +7,8 @@ import { createRequire } from 'node:module';
|
|
|
8
7
|
import path from 'node:path';
|
|
9
8
|
import { fileURLToPath } from 'node:url';
|
|
10
9
|
const require = createRequire(import.meta.url);
|
|
11
|
-
/** @type {any} */
|
|
12
10
|
let cached;
|
|
13
|
-
/**
|
|
14
|
-
* Load the N-API addon or throw (production printers must not fall back to TS).
|
|
15
|
-
* @returns {any}
|
|
16
|
-
*/
|
|
11
|
+
/** Load the N-API addon or throw (production printers must not fall back to TS). */
|
|
17
12
|
export function requireNativeAddon() {
|
|
18
13
|
const native = tryLoadNativeAddon();
|
|
19
14
|
if (!native) {
|
|
@@ -21,9 +16,6 @@ export function requireNativeAddon() {
|
|
|
21
16
|
}
|
|
22
17
|
return native;
|
|
23
18
|
}
|
|
24
|
-
/**
|
|
25
|
-
* @returns {any | null}
|
|
26
|
-
*/
|
|
27
19
|
export function tryLoadNativeAddon() {
|
|
28
20
|
if (cached !== undefined)
|
|
29
21
|
return cached;
|
|
@@ -58,7 +50,6 @@ export function tryLoadNativeAddon() {
|
|
|
58
50
|
: triple;
|
|
59
51
|
const pkgRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
60
52
|
const name = `@vmz/vmz-${short}`;
|
|
61
|
-
/** @type {string[]} */
|
|
62
53
|
const candidates = [];
|
|
63
54
|
try {
|
|
64
55
|
const resolved = require.resolve(`${name}/package.json`);
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
* @param {{ projectRoot?: string | null }} [opts]
|
|
13
13
|
* @returns {{ rewrittenFiles: number, vendoredModules: string[], bareSpecs: string[] }}
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
interface PackClientBareImportsOpts {
|
|
16
|
+
projectRoot?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export declare function packClientBareImports(outDir: string, opts?: PackClientBareImportsOpts): {
|
|
16
19
|
rewrittenFiles: number;
|
|
17
20
|
vendoredModules: string[];
|
|
18
21
|
bareSpecs: any[];
|
|
@@ -23,3 +26,4 @@ export declare function packClientBareImports(outDir: any, opts?: {}): {
|
|
|
23
26
|
/** @param {string} js */
|
|
24
27
|
export declare function collectBareSpecs(js: any): unknown[];
|
|
25
28
|
export declare function rewriteRelativeTsSpecs(js: any): any;
|
|
29
|
+
export {};
|
|
@@ -7,18 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Not full oxc chunk-split/minify (`oxc-pending` remains for release minify).
|
|
9
9
|
*/
|
|
10
|
-
// @ts-nocheck
|
|
11
10
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'node:fs';
|
|
12
11
|
import path from 'node:path';
|
|
13
12
|
import { createRequire } from 'node:module';
|
|
14
13
|
import { resolvePackageRoot } from './packages.js';
|
|
15
14
|
const VENDOR_DIR = 'vendor';
|
|
16
15
|
const SKIP_PREFIXES = ['node:', 'nodejs:', 'cloudflare:', 'data:', 'http:', 'https:', 'vmz:', '#'];
|
|
17
|
-
/**
|
|
18
|
-
* @param {string} outDir
|
|
19
|
-
* @param {{ projectRoot?: string | null }} [opts]
|
|
20
|
-
* @returns {{ rewrittenFiles: number, vendoredModules: string[], bareSpecs: string[] }}
|
|
21
|
-
*/
|
|
22
16
|
export function packClientBareImports(outDir, opts = {}) {
|
|
23
17
|
const projectRoot = opts.projectRoot ? path.resolve(opts.projectRoot) : path.dirname(path.resolve(outDir));
|
|
24
18
|
/** @type {Map<string, string>} bareSpec → absolute vendored .js path */
|
package/dist/pack.d.ts
CHANGED
|
@@ -23,28 +23,29 @@ export declare function ensureRuntimeCompanions(outDir: any, coreDist: any): any
|
|
|
23
23
|
* projectRoot?: string | null,
|
|
24
24
|
* }} [opts]
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
interface PackFromDeploymentIrOpts {
|
|
27
|
+
release?: boolean;
|
|
28
|
+
profileId?: string;
|
|
29
|
+
assembly?: string;
|
|
30
|
+
preferredClientFace?: string;
|
|
31
|
+
coreDist?: string | null;
|
|
32
|
+
projectRoot?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export declare function packFromDeploymentIr(outDir: string, opts?: PackFromDeploymentIrOpts): {
|
|
27
35
|
manifest: {
|
|
28
36
|
schema: string;
|
|
29
|
-
profileId:
|
|
30
|
-
assembly:
|
|
37
|
+
profileId: string | null;
|
|
38
|
+
assembly: string | null;
|
|
31
39
|
release: boolean;
|
|
32
|
-
preferredClientFace:
|
|
33
|
-
deploymentSchema:
|
|
40
|
+
preferredClientFace: string;
|
|
41
|
+
deploymentSchema: unknown;
|
|
34
42
|
unitCount: number;
|
|
35
|
-
units:
|
|
43
|
+
units: unknown[];
|
|
36
44
|
minify: string;
|
|
37
45
|
treeShakeBasis: string;
|
|
38
46
|
bundler: string;
|
|
39
|
-
clientPackageLowering:
|
|
40
|
-
|
|
41
|
-
rewrittenFiles: number;
|
|
42
|
-
bareSpecs: any[];
|
|
43
|
-
vendoredModules: string[];
|
|
44
|
-
unresolvedBareSpecs: any[];
|
|
45
|
-
skippedVmzExports: any[];
|
|
46
|
-
remainingBareSpecs: any[];
|
|
47
|
-
};
|
|
47
|
+
clientPackageLowering: Record<string, unknown>;
|
|
48
|
+
packDigest?: string;
|
|
48
49
|
};
|
|
49
50
|
path: string;
|
|
50
51
|
clientPackages: {
|
|
@@ -56,3 +57,4 @@ export declare function packFromDeploymentIr(outDir: any, opts?: {}): {
|
|
|
56
57
|
remainingBareSpecs: any[];
|
|
57
58
|
};
|
|
58
59
|
};
|
|
60
|
+
export {};
|
package/dist/pack.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* and lower browser-unreachable bare package imports to `dist/vendor/**`.
|
|
4
4
|
* Full oxc minify/chunk-split lands progressively (`oxc-pending` on release minify).
|
|
5
5
|
*/
|
|
6
|
-
// @ts-nocheck
|
|
7
6
|
import crypto from 'node:crypto';
|
|
8
7
|
import { copyFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
9
8
|
import path from 'node:path';
|
|
@@ -33,17 +32,6 @@ export function ensureRuntimeCompanions(outDir, coreDist) {
|
|
|
33
32
|
}
|
|
34
33
|
return copied;
|
|
35
34
|
}
|
|
36
|
-
/**
|
|
37
|
-
* @param {string} outDir
|
|
38
|
-
* @param {{
|
|
39
|
-
* release?: boolean,
|
|
40
|
-
* profileId?: string,
|
|
41
|
-
* assembly?: string,
|
|
42
|
-
* preferredClientFace?: string,
|
|
43
|
-
* coreDist?: string | null,
|
|
44
|
-
* projectRoot?: string | null,
|
|
45
|
-
* }} [opts]
|
|
46
|
-
*/
|
|
47
35
|
export function packFromDeploymentIr(outDir, opts = {}) {
|
|
48
36
|
ensureRuntimeCompanions(outDir, opts.coreDist);
|
|
49
37
|
// Browser ESM cannot resolve bare npm specs — materialize reachable packages first
|
package/dist/packages.d.ts
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* npm / pnpm workspace package resolution helpers (session).
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* Does not invent VMZ semantics — only filesystem / npm layout facts for plugins.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} project
|
|
17
|
-
* @returns {ResolvedPackage[]}
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveWorkspacePackages(project: any): any[];
|
|
20
|
-
/**
|
|
21
|
-
* Resolve a package name to an absolute root (workspace first, then node_modules).
|
|
22
|
-
* @param {string} project
|
|
23
|
-
* @param {string} name
|
|
24
|
-
* @returns {string | null}
|
|
25
|
-
*/
|
|
26
|
-
export declare function resolvePackageRoot(project: any, name: any): any;
|
|
4
|
+
export interface ResolvedPackage {
|
|
5
|
+
name: string;
|
|
6
|
+
root: string;
|
|
7
|
+
private?: boolean;
|
|
8
|
+
hasSrc: boolean;
|
|
9
|
+
version?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Resolve workspace packages under a project (package.json workspaces or pnpm-workspace.yaml). */
|
|
12
|
+
export declare function resolveWorkspacePackages(project: string): ResolvedPackage[];
|
|
13
|
+
export declare function resolvePackageRoot(project: string, name: string): string | null;
|
package/dist/packages.js
CHANGED
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* npm / pnpm workspace package resolution helpers (session).
|
|
4
3
|
*/
|
|
5
4
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
6
5
|
import path from 'node:path';
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {object} ResolvedPackage
|
|
9
|
-
* @property {string} name
|
|
10
|
-
* @property {string} root
|
|
11
|
-
* @property {boolean} [private]
|
|
12
|
-
* @property {boolean} hasSrc
|
|
13
|
-
* @property {string} [version]
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Resolve workspace packages under a project (package.json workspaces or pnpm-workspace.yaml).
|
|
17
|
-
* Does not invent VMZ semantics — only filesystem / npm layout facts for plugins.
|
|
18
|
-
*
|
|
19
|
-
* @param {string} project
|
|
20
|
-
* @returns {ResolvedPackage[]}
|
|
21
|
-
*/
|
|
6
|
+
/** Resolve workspace packages under a project (package.json workspaces or pnpm-workspace.yaml). */
|
|
22
7
|
export function resolveWorkspacePackages(project) {
|
|
23
8
|
const root = path.resolve(project);
|
|
24
9
|
const patterns = readWorkspacePatterns(root);
|
|
25
|
-
/** @type {Map<string, ResolvedPackage>} */
|
|
26
10
|
const out = new Map();
|
|
27
11
|
// Always include the project itself when it has package.json.
|
|
28
12
|
const self = readPkg(root);
|
|
@@ -37,12 +21,6 @@ export function resolveWorkspacePackages(project) {
|
|
|
37
21
|
}
|
|
38
22
|
return [...out.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
39
23
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Resolve a package name to an absolute root (workspace first, then node_modules).
|
|
42
|
-
* @param {string} project
|
|
43
|
-
* @param {string} name
|
|
44
|
-
* @returns {string | null}
|
|
45
|
-
*/
|
|
46
24
|
export function resolvePackageRoot(project, name) {
|
|
47
25
|
const hit = resolveWorkspacePackages(project).find((p) => p.name === name);
|
|
48
26
|
if (hit)
|
|
@@ -52,10 +30,6 @@ export function resolvePackageRoot(project, name) {
|
|
|
52
30
|
return nm;
|
|
53
31
|
return null;
|
|
54
32
|
}
|
|
55
|
-
/**
|
|
56
|
-
* @param {string} root
|
|
57
|
-
* @returns {string[]}
|
|
58
|
-
*/
|
|
59
33
|
function readWorkspacePatterns(root) {
|
|
60
34
|
const patterns = [];
|
|
61
35
|
const pkgPath = path.join(root, 'package.json');
|
|
@@ -88,11 +62,6 @@ function readWorkspacePatterns(root) {
|
|
|
88
62
|
}
|
|
89
63
|
return [...new Set(patterns)];
|
|
90
64
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Minimal glob: supports `packages/*`, `examples/*`, exact dirs. No `**`.
|
|
93
|
-
* @param {string} root
|
|
94
|
-
* @param {string} pattern
|
|
95
|
-
*/
|
|
96
65
|
function expandWorkspacePattern(root, pattern) {
|
|
97
66
|
const cleaned = pattern.replace(/\\/g, '/').replace(/\/$/, '');
|
|
98
67
|
if (!cleaned.includes('*')) {
|
|
@@ -107,7 +76,6 @@ function expandWorkspacePattern(root, pattern) {
|
|
|
107
76
|
const base = path.join(root, prefix);
|
|
108
77
|
if (!existsSync(base))
|
|
109
78
|
return [];
|
|
110
|
-
/** @type {string[]} */
|
|
111
79
|
const dirs = [];
|
|
112
80
|
for (const name of readdirSync(base, { withFileTypes: true })) {
|
|
113
81
|
if (!name.isDirectory())
|
|
@@ -120,10 +88,6 @@ function expandWorkspacePattern(root, pattern) {
|
|
|
120
88
|
}
|
|
121
89
|
return dirs;
|
|
122
90
|
}
|
|
123
|
-
/**
|
|
124
|
-
* @param {string} dir
|
|
125
|
-
* @returns {ResolvedPackage | null}
|
|
126
|
-
*/
|
|
127
91
|
function readPkg(dir) {
|
|
128
92
|
const pkgPath = path.join(dir, 'package.json');
|
|
129
93
|
if (!existsSync(pkgPath))
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vmz plan` — dump frozen Rust plans via N-API; registered on `@vmz/commander`.
|
|
3
|
+
*/
|
|
4
|
+
import type { Command, ParsedOptions } from '@vmz/commander';
|
|
5
|
+
export declare function registerPlanCommands(parent: Command): void;
|
|
6
|
+
export declare function runPlanKind(kind: 'locale' | 'document-route', options: ParsedOptions): number;
|
package/dist/plan-cmd.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vmz plan` — dump frozen Rust plans via N-API; registered on `@vmz/commander`.
|
|
3
|
+
*/
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { loadDocumentRoutePlan, loadLocalePlan, mapPlanDiagnostics } from './author-input.js';
|
|
6
|
+
import { log } from './log.js';
|
|
7
|
+
import { emitPrettyJson } from './pretty-json.js';
|
|
8
|
+
export function registerPlanCommands(parent) {
|
|
9
|
+
const withJson = (cmd) => cmd.option('--json [file]', 'cli.opt.json');
|
|
10
|
+
withJson(parent.command('locale', 'cli.cmd.plan.locale')).action((options) => runPlanKind('locale', options));
|
|
11
|
+
withJson(parent.command('document-route|document_route', 'cli.cmd.plan.document-route')).action((options) => runPlanKind('document-route', options));
|
|
12
|
+
}
|
|
13
|
+
export function runPlanKind(kind, options) {
|
|
14
|
+
const rootArg = typeof options._[0] === 'string' ? options._[0] : '.';
|
|
15
|
+
const root = path.resolve(rootArg);
|
|
16
|
+
let plan;
|
|
17
|
+
switch (kind) {
|
|
18
|
+
case 'locale':
|
|
19
|
+
plan = loadLocalePlan(root);
|
|
20
|
+
break;
|
|
21
|
+
case 'document-route':
|
|
22
|
+
plan = loadDocumentRoutePlan(root);
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
log.errorId('cli.err.unknown_plan_kind', { kind: String(kind) });
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
const diagnostics = mapPlanDiagnostics(plan?.diagnostics || []);
|
|
29
|
+
const hardErrors = diagnostics.filter((d) => d.severity === 'error');
|
|
30
|
+
if (diagnostics.length) {
|
|
31
|
+
log.diagnostics(diagnostics);
|
|
32
|
+
}
|
|
33
|
+
emitPrettyJson(typeof options.json === 'string' ? options.json : true, plan);
|
|
34
|
+
return hardErrors.length ? 1 : 0;
|
|
35
|
+
}
|
package/dist/plugin-host.js
CHANGED
package/dist/port.d.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* Used by `vmz dev` when `--port` is omitted.
|
|
4
|
-
*
|
|
5
|
-
* @param {string} host
|
|
6
|
-
* @param {number} [start=5173]
|
|
7
|
-
* @param {number} [maxTries=50]
|
|
8
|
-
* @returns {Promise<number>}
|
|
9
|
-
*/
|
|
10
|
-
export declare function findAvailablePort(host: any, start?: number, maxTries?: number): Promise<unknown>;
|
|
1
|
+
/** Probe for a free TCP port starting at `start` (inclusive). Used by `vmz dev` when `--port` is omitted. */
|
|
2
|
+
export declare function findAvailablePort(host: string, start?: number, maxTries?: number): Promise<number>;
|
package/dist/port.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import net from 'node:net';
|
|
3
|
-
/**
|
|
4
|
-
* Probe for a free TCP port starting at `start` (inclusive).
|
|
5
|
-
* Used by `vmz dev` when `--port` is omitted.
|
|
6
|
-
*
|
|
7
|
-
* @param {string} host
|
|
8
|
-
* @param {number} [start=5173]
|
|
9
|
-
* @param {number} [maxTries=50]
|
|
10
|
-
* @returns {Promise<number>}
|
|
11
|
-
*/
|
|
2
|
+
/** Probe for a free TCP port starting at `start` (inclusive). Used by `vmz dev` when `--port` is omitted. */
|
|
12
3
|
export function findAvailablePort(host, start = 5173, maxTries = 50) {
|
|
13
4
|
const first = Number(start);
|
|
14
5
|
if (!Number.isFinite(first) || first <= 0) {
|
|
@@ -24,7 +15,7 @@ export function findAvailablePort(host, start = 5173, maxTries = 50) {
|
|
|
24
15
|
const server = net.createServer();
|
|
25
16
|
server.unref();
|
|
26
17
|
server.once('error', (err) => {
|
|
27
|
-
if (err
|
|
18
|
+
if (err?.code === 'EADDRINUSE') {
|
|
28
19
|
port += 1;
|
|
29
20
|
attempt();
|
|
30
21
|
return;
|
package/dist/pretty-json.d.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @param {unknown} value
|
|
11
|
-
*/
|
|
12
|
-
export declare function writePrettyJsonFile(filePath: any, value: any): void;
|
|
13
|
-
/**
|
|
14
|
-
* CLI `--json` helper: write to a path when `target` is a string, else stdout.
|
|
15
|
-
* @param {string | boolean | undefined} target
|
|
16
|
-
* @param {unknown} value
|
|
17
|
-
* @param {{ logWrote?: (path: string) => void }} [opts]
|
|
18
|
-
*/
|
|
19
|
-
export declare function emitPrettyJson(target: any, value: any, opts?: {}): void;
|
|
1
|
+
export interface EmitPrettyJsonOpts {
|
|
2
|
+
logWrote?: (path: string) => void;
|
|
3
|
+
}
|
|
4
|
+
/** Pretty-print a value through `vmz-generator` (N-API). Returns pretty JSON without trailing newline. */
|
|
5
|
+
export declare function generatePrettyJson(value: unknown): string;
|
|
6
|
+
/** Write a pretty JSON artifact with a trailing newline. */
|
|
7
|
+
export declare function writePrettyJsonFile(filePath: string, value: unknown): void;
|
|
8
|
+
/** CLI `--json` helper: write to a path when `target` is a string, else stdout. */
|
|
9
|
+
export declare function emitPrettyJson(target: string | boolean | undefined, value: unknown, opts?: EmitPrettyJsonOpts): void;
|
package/dist/pretty-json.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Production JSON artifact printer — always via N-API JsonCodeGenerator.
|
|
4
3
|
* Do not use `JSON.stringify(x, null, 2)` for on-disk artifacts.
|
|
5
4
|
*/
|
|
6
5
|
import fs from 'node:fs';
|
|
7
6
|
import { requireNativeAddon } from './native-addon.js';
|
|
8
|
-
/**
|
|
9
|
-
* Pretty-print a value through `vmz-generator` (N-API).
|
|
10
|
-
* @param {unknown} value
|
|
11
|
-
* @returns {string} Pretty JSON without trailing newline.
|
|
12
|
-
*/
|
|
7
|
+
/** Pretty-print a value through `vmz-generator` (N-API). Returns pretty JSON without trailing newline. */
|
|
13
8
|
export function generatePrettyJson(value) {
|
|
14
9
|
const native = requireNativeAddon();
|
|
15
10
|
if (typeof native.generatePrettyJson !== 'function') {
|
|
@@ -17,20 +12,11 @@ export function generatePrettyJson(value) {
|
|
|
17
12
|
}
|
|
18
13
|
return native.generatePrettyJson(JSON.stringify(value));
|
|
19
14
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Write a pretty JSON artifact with a trailing newline.
|
|
22
|
-
* @param {string} filePath
|
|
23
|
-
* @param {unknown} value
|
|
24
|
-
*/
|
|
15
|
+
/** Write a pretty JSON artifact with a trailing newline. */
|
|
25
16
|
export function writePrettyJsonFile(filePath, value) {
|
|
26
17
|
fs.writeFileSync(filePath, `${generatePrettyJson(value)}\n`, 'utf8');
|
|
27
18
|
}
|
|
28
|
-
/**
|
|
29
|
-
* CLI `--json` helper: write to a path when `target` is a string, else stdout.
|
|
30
|
-
* @param {string | boolean | undefined} target
|
|
31
|
-
* @param {unknown} value
|
|
32
|
-
* @param {{ logWrote?: (path: string) => void }} [opts]
|
|
33
|
-
*/
|
|
19
|
+
/** CLI `--json` helper: write to a path when `target` is a string, else stdout. */
|
|
34
20
|
export function emitPrettyJson(target, value, opts = {}) {
|
|
35
21
|
const text = generatePrettyJson(value);
|
|
36
22
|
if (typeof target === 'string') {
|