@vmz/vmz 0.1.17 → 0.1.19
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 +46 -30
- 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/static-emit.d.ts
CHANGED
|
@@ -3,64 +3,51 @@
|
|
|
3
3
|
* Reuses the same Direct SSR path as serve-host (no second SSG runtime).
|
|
4
4
|
*/
|
|
5
5
|
export declare const STATIC_DELIVERY_MANIFEST_SCHEMA = "vmz.static.delivery_manifest.v0";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
path: any;
|
|
29
|
-
chunkId: any;
|
|
30
|
-
htmlPath: any;
|
|
31
|
-
classification: any;
|
|
32
|
-
localeId: any;
|
|
33
|
-
seo: {
|
|
34
|
-
title: any;
|
|
35
|
-
description: any;
|
|
36
|
-
canonical: any;
|
|
37
|
-
robots: any;
|
|
38
|
-
alternates: any;
|
|
39
|
-
};
|
|
40
|
-
}[];
|
|
41
|
-
skipped: any[];
|
|
42
|
-
seoArtifacts: {
|
|
43
|
-
sitemap: string;
|
|
44
|
-
robots: string;
|
|
45
|
-
};
|
|
46
|
-
publicAssets: {
|
|
47
|
-
schema: string;
|
|
48
|
-
status: string;
|
|
49
|
-
fileCount: number;
|
|
50
|
-
source: any;
|
|
51
|
-
};
|
|
6
|
+
export type EmitWebStaticOpts = {
|
|
7
|
+
origin?: string;
|
|
8
|
+
applicationId?: string;
|
|
9
|
+
staticParams?: Record<string, Array<Record<string, string>>>;
|
|
10
|
+
projectRoot?: string;
|
|
11
|
+
};
|
|
12
|
+
type StaticDeliveryManifest = {
|
|
13
|
+
schema: string;
|
|
14
|
+
applicationId: unknown;
|
|
15
|
+
deliveryProfile: string;
|
|
16
|
+
origin: string;
|
|
17
|
+
generatedAt: string;
|
|
18
|
+
spaFallback: boolean;
|
|
19
|
+
errorDocuments: Array<{
|
|
20
|
+
status: number;
|
|
21
|
+
path: string;
|
|
22
|
+
}>;
|
|
23
|
+
routes: unknown[];
|
|
24
|
+
skipped: unknown[];
|
|
25
|
+
seoArtifacts: {
|
|
26
|
+
sitemap: string;
|
|
27
|
+
robots: string;
|
|
52
28
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
layout: string;
|
|
59
|
-
immutable: boolean;
|
|
60
|
-
objectCount: number;
|
|
61
|
-
objects: any[];
|
|
62
|
-
rewrittenHtml: number;
|
|
29
|
+
publicAssets: {
|
|
30
|
+
schema: unknown;
|
|
31
|
+
status: unknown;
|
|
32
|
+
fileCount: number;
|
|
33
|
+
source: string | null;
|
|
63
34
|
};
|
|
35
|
+
manifestDigest?: string;
|
|
36
|
+
contentAddressedAssets?: Record<string, unknown>;
|
|
37
|
+
cdnPolicy?: unknown;
|
|
38
|
+
};
|
|
39
|
+
export declare function emitWebStatic(distDir: string, opts?: EmitWebStaticOpts): Promise<{
|
|
40
|
+
manifest: StaticDeliveryManifest;
|
|
41
|
+
htmlFiles: string[];
|
|
42
|
+
skipped: {
|
|
43
|
+
routeId: string;
|
|
44
|
+
path: string;
|
|
45
|
+
chunkId: string;
|
|
46
|
+
classification: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
}[];
|
|
49
|
+
digest: string;
|
|
50
|
+
assets: import("./content-addressed-assets.js").ContentAddressedAssetsManifest;
|
|
64
51
|
publicAssets: {
|
|
65
52
|
schema: string;
|
|
66
53
|
status: string;
|
|
@@ -76,47 +63,20 @@ export declare function emitWebStatic(distDir: any, opts?: {}): Promise<{
|
|
|
76
63
|
files: any[];
|
|
77
64
|
skippedConflicts: any[];
|
|
78
65
|
};
|
|
79
|
-
cdnPolicy:
|
|
80
|
-
schema: string;
|
|
81
|
-
applicationId: any;
|
|
82
|
-
deliveryProfile: string;
|
|
83
|
-
origin: string;
|
|
84
|
-
spaFallback: boolean;
|
|
85
|
-
staticManifestDigest: any;
|
|
86
|
-
redirects: any[];
|
|
87
|
-
headers: ({
|
|
88
|
-
match: string;
|
|
89
|
-
headers: {
|
|
90
|
-
'cache-control': string;
|
|
91
|
-
'x-robots-tag'?: undefined;
|
|
92
|
-
};
|
|
93
|
-
} | {
|
|
94
|
-
match: string;
|
|
95
|
-
headers: {
|
|
96
|
-
'cache-control': string;
|
|
97
|
-
'x-robots-tag': string;
|
|
98
|
-
};
|
|
99
|
-
})[];
|
|
100
|
-
errorDocuments: any;
|
|
101
|
-
routes: any[];
|
|
102
|
-
localeCache: {
|
|
103
|
-
strategy: string;
|
|
104
|
-
varyAcceptLanguage: boolean;
|
|
105
|
-
defaultLocale: any;
|
|
106
|
-
routeCount: number;
|
|
107
|
-
locales: any[];
|
|
108
|
-
};
|
|
109
|
-
};
|
|
66
|
+
cdnPolicy: import("./cdn-policy.js").CdnPolicyManifest;
|
|
110
67
|
cdnAdapters: {
|
|
111
68
|
'local-static': {
|
|
112
69
|
schema: string;
|
|
113
70
|
adapterId: string;
|
|
114
|
-
policyDigest:
|
|
71
|
+
policyDigest: string;
|
|
115
72
|
host: string;
|
|
116
73
|
spaFallback: boolean;
|
|
117
|
-
redirects:
|
|
118
|
-
headers:
|
|
119
|
-
|
|
74
|
+
redirects: import("./cdn-policy.js").CdnRedirect[];
|
|
75
|
+
headers: {
|
|
76
|
+
match: string;
|
|
77
|
+
headers: Record<string, string | undefined>;
|
|
78
|
+
}[];
|
|
79
|
+
errorDocuments: unknown[];
|
|
120
80
|
files: {
|
|
121
81
|
_headers?: undefined;
|
|
122
82
|
_redirects?: undefined;
|
|
@@ -124,12 +84,15 @@ export declare function emitWebStatic(distDir: any, opts?: {}): Promise<{
|
|
|
124
84
|
} | {
|
|
125
85
|
schema: string;
|
|
126
86
|
adapterId: string;
|
|
127
|
-
policyDigest:
|
|
87
|
+
policyDigest: string;
|
|
128
88
|
host: string;
|
|
129
89
|
spaFallback: boolean;
|
|
130
|
-
redirects:
|
|
131
|
-
headers:
|
|
132
|
-
|
|
90
|
+
redirects: import("./cdn-policy.js").CdnRedirect[];
|
|
91
|
+
headers: {
|
|
92
|
+
match: string;
|
|
93
|
+
headers: Record<string, string | undefined>;
|
|
94
|
+
}[];
|
|
95
|
+
errorDocuments: unknown[];
|
|
133
96
|
files: {
|
|
134
97
|
_headers: string;
|
|
135
98
|
_redirects: string;
|
|
@@ -138,12 +101,15 @@ export declare function emitWebStatic(distDir: any, opts?: {}): Promise<{
|
|
|
138
101
|
netlify: {
|
|
139
102
|
schema: string;
|
|
140
103
|
adapterId: string;
|
|
141
|
-
policyDigest:
|
|
104
|
+
policyDigest: string;
|
|
142
105
|
host: string;
|
|
143
106
|
spaFallback: boolean;
|
|
144
|
-
redirects:
|
|
145
|
-
headers:
|
|
146
|
-
|
|
107
|
+
redirects: import("./cdn-policy.js").CdnRedirect[];
|
|
108
|
+
headers: {
|
|
109
|
+
match: string;
|
|
110
|
+
headers: Record<string, string | undefined>;
|
|
111
|
+
}[];
|
|
112
|
+
errorDocuments: unknown[];
|
|
147
113
|
files: {
|
|
148
114
|
_headers?: undefined;
|
|
149
115
|
_redirects?: undefined;
|
|
@@ -151,12 +117,15 @@ export declare function emitWebStatic(distDir: any, opts?: {}): Promise<{
|
|
|
151
117
|
} | {
|
|
152
118
|
schema: string;
|
|
153
119
|
adapterId: string;
|
|
154
|
-
policyDigest:
|
|
120
|
+
policyDigest: string;
|
|
155
121
|
host: string;
|
|
156
122
|
spaFallback: boolean;
|
|
157
|
-
redirects:
|
|
158
|
-
headers:
|
|
159
|
-
|
|
123
|
+
redirects: import("./cdn-policy.js").CdnRedirect[];
|
|
124
|
+
headers: {
|
|
125
|
+
match: string;
|
|
126
|
+
headers: Record<string, string | undefined>;
|
|
127
|
+
}[];
|
|
128
|
+
errorDocuments: unknown[];
|
|
160
129
|
files: {
|
|
161
130
|
_headers: string;
|
|
162
131
|
_redirects: string;
|
|
@@ -164,3 +133,4 @@ export declare function emitWebStatic(distDir: any, opts?: {}): Promise<{
|
|
|
164
133
|
};
|
|
165
134
|
};
|
|
166
135
|
}>;
|
|
136
|
+
export {};
|
package/dist/static-emit.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* A3-static: emit per-route HTML + 404 + SEO head + StaticDeliveryManifest.
|
|
3
3
|
* Reuses the same Direct SSR path as serve-host (no second SSG runtime).
|
|
4
4
|
*/
|
|
5
|
-
// @ts-nocheck
|
|
6
5
|
import crypto from 'node:crypto';
|
|
7
6
|
import fs from 'node:fs';
|
|
8
7
|
import path from 'node:path';
|
|
@@ -19,14 +18,6 @@ import { emitPublicStaticAssets } from './public-static-assets.js';
|
|
|
19
18
|
import { filePathPatternFromChunk, isRouteBoundaryStem, listPublicPageUnits, parsePathPattern, unitBrowserPathPattern } from './route-path.js';
|
|
20
19
|
import { emitSiteFavicon, readSiteFaviconHeadHtml } from './site-favicon.js';
|
|
21
20
|
export const STATIC_DELIVERY_MANIFEST_SCHEMA = 'vmz.static.delivery_manifest.v0';
|
|
22
|
-
/**
|
|
23
|
-
* @param {string} distDir
|
|
24
|
-
* @param {{
|
|
25
|
-
* origin?: string,
|
|
26
|
-
* applicationId?: string,
|
|
27
|
-
* staticParams?: Record<string, Array<Record<string, string>>>,
|
|
28
|
-
* }} [opts]
|
|
29
|
-
*/
|
|
30
21
|
export async function emitWebStatic(distDir, opts = {}) {
|
|
31
22
|
const origin = String(opts.origin || process.env.VMZ_SITE_ORIGIN || 'https://example.test').replace(/\/$/, '');
|
|
32
23
|
const applicationId = opts.applicationId || path.basename(path.dirname(distDir));
|
|
@@ -40,19 +31,7 @@ export async function emitWebStatic(distDir, opts = {}) {
|
|
|
40
31
|
const host = await createRenderHost(distDir, { strictDeployment: true, preload: 'none' });
|
|
41
32
|
const { renderToString, renderToStream } = host;
|
|
42
33
|
const pageCatalog = listPageClientFiles(distDir);
|
|
43
|
-
/** @type {Array<{
|
|
44
|
-
* routeId: string,
|
|
45
|
-
* path: string,
|
|
46
|
-
* chunkId: string,
|
|
47
|
-
* htmlPath: string,
|
|
48
|
-
* classification: string,
|
|
49
|
-
* title: string,
|
|
50
|
-
* description: string,
|
|
51
|
-
* canonical: string,
|
|
52
|
-
* robots: string,
|
|
53
|
-
* }>} */
|
|
54
34
|
const generations = [];
|
|
55
|
-
/** @type {Array<{ routeId: string, path: string, chunkId: string, classification: string, reason: string }>} */
|
|
56
35
|
const skipped = [];
|
|
57
36
|
for (const page of pageCatalog) {
|
|
58
37
|
const pattern = page.pathPattern || patternFromSegs(page.segs);
|
|
@@ -227,7 +206,7 @@ export async function emitWebStatic(distDir, opts = {}) {
|
|
|
227
206
|
schema: publicAssets.schema,
|
|
228
207
|
status: publicAssets.status,
|
|
229
208
|
fileCount: publicAssets.fileCount ?? 0,
|
|
230
|
-
source: publicAssets.source
|
|
209
|
+
source: 'source' in publicAssets && typeof publicAssets.source === 'string' ? publicAssets.source : null,
|
|
231
210
|
},
|
|
232
211
|
};
|
|
233
212
|
const digest = sha256Hex(canonicalJson(manifest));
|
|
@@ -384,10 +363,6 @@ function guessRouteId(distDir, chunkId) {
|
|
|
384
363
|
}
|
|
385
364
|
return chunkId.split('/').pop() || chunkId;
|
|
386
365
|
}
|
|
387
|
-
/**
|
|
388
|
-
* @param {any} Page
|
|
389
|
-
* @param {{ params: Record<string, string>, props: Record<string, unknown>, pathname: string, origin: string }} ctx
|
|
390
|
-
*/
|
|
391
366
|
async function resolvePageMeta(Page, ctx) {
|
|
392
367
|
let raw = {};
|
|
393
368
|
if (typeof Page.meta === 'function') {
|
package/dist/test-cmd.d.ts
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* `vmz test` command — discovery / build / filter / TestReport orchestration.
|
|
3
3
|
* Semantics live in `@vmz/test` (optional peer — not installed with bare `@vmz/vmz`).
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export declare function cmdTest(args: any): Promise<0 | 1 | 2>;
|
|
5
|
+
import type { Cli, Command, ParsedOptions } from '@vmz/commander';
|
|
6
|
+
export declare function registerTestCommand(cli: Cli | Command): void;
|
|
7
|
+
export declare function cmdTest(args: ParsedOptions): Promise<number>;
|
package/dist/test-cmd.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* `vmz test` command — discovery / build / filter / TestReport orchestration.
|
|
4
3
|
* Semantics live in `@vmz/test` (optional peer — not installed with bare `@vmz/vmz`).
|
|
5
4
|
*/
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import os from 'node:os';
|
|
6
7
|
import path from 'node:path';
|
|
7
|
-
import { createWorkspace } from './index.js';
|
|
8
|
+
import { createWorkspace, loadVmzConfig, normalizeDeliveryAuthoring, resolveProfileArtifactDir, selectBuildProfile } from './index.js';
|
|
8
9
|
import { log } from './log.js';
|
|
9
10
|
import { generatePrettyJson } from './pretty-json.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
export function registerTestCommand(cli) {
|
|
12
|
+
cli.command('test', 'cli.cmd.test')
|
|
13
|
+
.option('--out-dir, -o <dir>', 'cli.opt.out-dir')
|
|
14
|
+
.option('--list', 'cli.opt.list')
|
|
15
|
+
.option('--json [file]', 'cli.opt.json')
|
|
16
|
+
.option('--mode <modes>', 'cli.opt.mode')
|
|
17
|
+
.option('--filter <pattern>', 'cli.opt.filter')
|
|
18
|
+
.option('--application <id>', 'cli.opt.application')
|
|
19
|
+
.option('--mounted <id>', 'cli.opt.mounted')
|
|
20
|
+
.option('--affected', 'cli.opt.affected')
|
|
21
|
+
.option('--target <id>', 'cli.opt.target')
|
|
22
|
+
.action((options) => cmdTest(options));
|
|
23
|
+
}
|
|
13
24
|
async function loadTestPackage() {
|
|
14
25
|
try {
|
|
15
26
|
return await import('@vmz/test');
|
|
@@ -19,10 +30,6 @@ async function loadTestPackage() {
|
|
|
19
30
|
throw new Error('`vmz test` needs `@vmz/test` (optional peer of `@vmz/vmz`).\n' + ' Install: pnpm add -D @vmz/test\n' + ` Detail: ${detail}`);
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
|
-
/**
|
|
23
|
-
* @param {Record<string, string | boolean> & { _: string[] }} args
|
|
24
|
-
* @returns {Promise<number>}
|
|
25
|
-
*/
|
|
26
33
|
export async function cmdTest(args) {
|
|
27
34
|
let test;
|
|
28
35
|
try {
|
|
@@ -32,11 +39,11 @@ export async function cmdTest(args) {
|
|
|
32
39
|
log.error(e instanceof Error ? e.message : String(e));
|
|
33
40
|
return 1;
|
|
34
41
|
}
|
|
35
|
-
const { discoverTestManifests, buildTestReport, parseModes, buildForCompile, runCompileManifest, runLogicManifest, runSsrManifest, runResumeManifest, runBrowserManifest, runDeploymentManifest, } = test;
|
|
42
|
+
const { discoverTestManifests, buildTestReport, parseModes, buildForCompile, runCompileManifest, runLogicManifest, runSsrManifest, runResumeManifest, runBrowserManifest, runDeploymentManifest, resolveDeliveryServeRoot, } = test;
|
|
36
43
|
const project = path.resolve(String(args._[0] || '.'));
|
|
37
44
|
let modes;
|
|
38
45
|
try {
|
|
39
|
-
modes = parseModes(
|
|
46
|
+
modes = parseModes(args.mode);
|
|
40
47
|
}
|
|
41
48
|
catch (e) {
|
|
42
49
|
log.error(e instanceof Error ? e.message : String(e));
|
|
@@ -88,7 +95,6 @@ export async function cmdTest(args) {
|
|
|
88
95
|
return file.includes(scopeId) || id.includes(scopeId);
|
|
89
96
|
});
|
|
90
97
|
}
|
|
91
|
-
/** @type {null | { schema: string, reason: string, testIds: string[], affectedChunkIds: string[], status: string }} */
|
|
92
98
|
let testSelection = null;
|
|
93
99
|
if (wantAffected) {
|
|
94
100
|
const outDir = outDirArg ? path.resolve(outDirArg) : path.join(project, 'dist');
|
|
@@ -135,15 +141,6 @@ export async function cmdTest(args) {
|
|
|
135
141
|
else if (!modes.includes('all')) {
|
|
136
142
|
selected = selected.filter((m) => Array.isArray(m.modes) && m.modes.some((x) => modes.includes(x)));
|
|
137
143
|
}
|
|
138
|
-
/** @type {Array<{
|
|
139
|
-
* testId: string,
|
|
140
|
-
* file: string,
|
|
141
|
-
* modes: string[],
|
|
142
|
-
* programId: string|null,
|
|
143
|
-
* planId: string|null,
|
|
144
|
-
* status: string,
|
|
145
|
-
* diagnostics: unknown[],
|
|
146
|
-
* }>} */
|
|
147
144
|
let tests;
|
|
148
145
|
if (wantList) {
|
|
149
146
|
tests = selected.map((m) => {
|
|
@@ -172,17 +169,35 @@ export async function cmdTest(args) {
|
|
|
172
169
|
(mm.includes('browser') && modeActive('browser')) ||
|
|
173
170
|
(mm.includes('deployment') && modeActive('deployment')));
|
|
174
171
|
});
|
|
175
|
-
/** @type {string|null} */
|
|
176
172
|
let buildOut = null;
|
|
177
|
-
/** @type {unknown[]} */
|
|
178
173
|
let buildDiags = [];
|
|
179
|
-
/** @type {string|null} */
|
|
180
174
|
let buildError = null;
|
|
175
|
+
let deliveryName = null;
|
|
181
176
|
if (needsBuild) {
|
|
182
|
-
|
|
177
|
+
// Align with `vmz build` / `vmz serve`: artifacts live under
|
|
178
|
+
// `<out-dir>/<profiles.*.name>` (default name = profile id).
|
|
179
|
+
const outDirRoot = outDirArg ? path.resolve(outDirArg) : fs.mkdtempSync(path.join(os.tmpdir(), 'vmz-test-'));
|
|
180
|
+
let buildTarget = outDirRoot;
|
|
181
|
+
try {
|
|
182
|
+
const cfg = await loadVmzConfig(project);
|
|
183
|
+
const norm = normalizeDeliveryAuthoring(cfg.delivery ?? null);
|
|
184
|
+
if (norm.ok) {
|
|
185
|
+
const selected = selectBuildProfile(norm.table, '');
|
|
186
|
+
if (selected.ok) {
|
|
187
|
+
deliveryName = String(selected.profile.name || selected.selection.profileId || '');
|
|
188
|
+
buildTarget = resolveProfileArtifactDir(outDirRoot, selected.profile);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
log.warn(`delivery profile resolve skipped: ${e instanceof Error ? e.message : String(e)}`);
|
|
194
|
+
}
|
|
195
|
+
fs.mkdirSync(buildTarget, { recursive: true });
|
|
196
|
+
const built = buildForCompile(project, buildTarget, {
|
|
183
197
|
createWorkspace,
|
|
198
|
+
deliveryName,
|
|
184
199
|
});
|
|
185
|
-
buildOut = built.outDir;
|
|
200
|
+
buildOut = resolveDeliveryServeRoot(built.outDir, deliveryName);
|
|
186
201
|
buildDiags = built.diagnostics || [];
|
|
187
202
|
if (!built.ok) {
|
|
188
203
|
buildError = built.error || 'build failed';
|
|
@@ -201,7 +216,7 @@ export async function cmdTest(args) {
|
|
|
201
216
|
programId: program.chunkId ? String(program.chunkId) : null,
|
|
202
217
|
planId: plan.ref ? String(plan.ref) : plan.schema ? String(plan.schema) : null,
|
|
203
218
|
status: 'skipped',
|
|
204
|
-
diagnostics:
|
|
219
|
+
diagnostics: [],
|
|
205
220
|
};
|
|
206
221
|
const doCompile = mModes.includes('compile') && modeActive('compile');
|
|
207
222
|
const doLogic = mModes.includes('logic') && modeActive('logic');
|
|
@@ -226,9 +241,7 @@ export async function cmdTest(args) {
|
|
|
226
241
|
tests.push(base);
|
|
227
242
|
continue;
|
|
228
243
|
}
|
|
229
|
-
/** @type {unknown[]} */
|
|
230
244
|
const diags = [];
|
|
231
|
-
/** @type {string[]} */
|
|
232
245
|
const statuses = [];
|
|
233
246
|
if (doCompile) {
|
|
234
247
|
const result = runCompileManifest(m, { outDir: buildOut });
|
|
@@ -266,7 +279,10 @@ export async function cmdTest(args) {
|
|
|
266
279
|
base.planId = result.planId ?? base.planId;
|
|
267
280
|
}
|
|
268
281
|
if (doBrowser) {
|
|
269
|
-
const result = await runBrowserManifest(m, {
|
|
282
|
+
const result = await runBrowserManifest(m, {
|
|
283
|
+
outDir: buildOut,
|
|
284
|
+
deliveryName,
|
|
285
|
+
});
|
|
270
286
|
statuses.push(result.status);
|
|
271
287
|
diags.push(...result.diagnostics);
|
|
272
288
|
base.programId = result.programId ?? base.programId;
|
package/dist/test-compile.js
CHANGED
package/dist/test-discover.js
CHANGED
package/dist/test-logic.js
CHANGED
package/dist/test-protocol.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product wiring for `@vmz/commander` / `@vmz/diagnostic`.
|
|
3
|
+
*
|
|
4
|
+
* Locales **loading** is `@vmz/commander` (`createLocalizeFromLocales` / `.locales`).
|
|
5
|
+
* Product owns only `packages/runtimes/vmz/locales/` content + thin `cli-localize` wrapper.
|
|
6
|
+
* Help lists are derived from the command tree — do not reintroduce Usage walls.
|
|
7
|
+
*/
|
|
8
|
+
export { createCli } from '@vmz/commander';
|
|
9
|
+
export type { LocalizePlugin } from '@vmz/commander';
|
|
10
|
+
export { VMZ_CLI_CATALOG_EN_US, createVmzCliLocalize, flattenCatalog, loadCliCatalog, loadCliLocalesManifest, resolveCliLocalesRoot, resolveVmzLocale, translateCatalog, vmzCliLocalize, } from './cli-localize.js';
|
|
11
|
+
export { formatDiagnostic, formatDiagnostics, t, } from '@vmz/diagnostic';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product wiring for `@vmz/commander` / `@vmz/diagnostic`.
|
|
3
|
+
*
|
|
4
|
+
* Locales **loading** is `@vmz/commander` (`createLocalizeFromLocales` / `.locales`).
|
|
5
|
+
* Product owns only `packages/runtimes/vmz/locales/` content + thin `cli-localize` wrapper.
|
|
6
|
+
* Help lists are derived from the command tree — do not reintroduce Usage walls.
|
|
7
|
+
*/
|
|
8
|
+
export { createCli } from '@vmz/commander';
|
|
9
|
+
export { VMZ_CLI_CATALOG_EN_US, createVmzCliLocalize, flattenCatalog, loadCliCatalog, loadCliLocalesManifest, resolveCliLocalesRoot, resolveVmzLocale, translateCatalog, vmzCliLocalize, } from './cli-localize.js';
|
|
10
|
+
export { formatDiagnostic, formatDiagnostics, t, } from '@vmz/diagnostic';
|
package/dist/watch-diff.d.ts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Track per-file fingerprints so dev rebuilds only dirty leaves (session).
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare function fileFingerprintMap(srcDir: any): Map<any, any>;
|
|
9
|
-
/**
|
|
10
|
-
* @param {Map<string, string>} prev
|
|
11
|
-
* @param {Map<string, string>} next
|
|
12
|
-
* @returns {{ changed: string[], deleted: string[] }}
|
|
13
|
-
*/
|
|
14
|
-
export declare function diffFingerprints(prev: any, next: any): {
|
|
15
|
-
changed: any[];
|
|
16
|
-
deleted: any[];
|
|
4
|
+
export declare function fileFingerprintMap(srcDir: string): Map<string, string>;
|
|
5
|
+
export declare function diffFingerprints(prev: Map<string, string>, next: Map<string, string>): {
|
|
6
|
+
changed: string[];
|
|
7
|
+
deleted: string[];
|
|
17
8
|
};
|
package/dist/watch-diff.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Track per-file fingerprints so dev rebuilds only dirty leaves (session).
|
|
4
3
|
*/
|
|
5
4
|
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
6
5
|
import path from 'node:path';
|
|
7
6
|
const WATCH_EXT = new Set(['.vmz', '.ts', '.tsx', '.js', '.mjs', '.css', '.json']);
|
|
8
|
-
/**
|
|
9
|
-
* @param {string} srcDir
|
|
10
|
-
* @returns {Map<string, string>}
|
|
11
|
-
*/
|
|
12
7
|
export function fileFingerprintMap(srcDir) {
|
|
13
|
-
/** @type {Map<string, string>} */
|
|
14
8
|
const map = new Map();
|
|
15
9
|
walk(srcDir, (file) => {
|
|
16
10
|
const st = statSync(file);
|
|
@@ -18,15 +12,8 @@ export function fileFingerprintMap(srcDir) {
|
|
|
18
12
|
});
|
|
19
13
|
return map;
|
|
20
14
|
}
|
|
21
|
-
/**
|
|
22
|
-
* @param {Map<string, string>} prev
|
|
23
|
-
* @param {Map<string, string>} next
|
|
24
|
-
* @returns {{ changed: string[], deleted: string[] }}
|
|
25
|
-
*/
|
|
26
15
|
export function diffFingerprints(prev, next) {
|
|
27
|
-
/** @type {string[]} */
|
|
28
16
|
const changed = [];
|
|
29
|
-
/** @type {string[]} */
|
|
30
17
|
const deleted = [];
|
|
31
18
|
for (const [file, fp] of next) {
|
|
32
19
|
if (prev.get(file) !== fp)
|
|
@@ -38,10 +25,6 @@ export function diffFingerprints(prev, next) {
|
|
|
38
25
|
}
|
|
39
26
|
return { changed, deleted };
|
|
40
27
|
}
|
|
41
|
-
/**
|
|
42
|
-
* @param {string} dir
|
|
43
|
-
* @param {(file: string) => void} fn
|
|
44
|
-
*/
|
|
45
28
|
function walk(dir, fn) {
|
|
46
29
|
if (!existsSync(dir))
|
|
47
30
|
return;
|
|
@@ -8,15 +8,16 @@ export declare const WECHAT_PACKAGING_REL = "dist/_vmz/wechat-packaging.json";
|
|
|
8
8
|
* @param {unknown} delivery
|
|
9
9
|
* @returns {{ schema: string, appId: string, projectName?: string, title?: string }}
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
interface WechatPackagingSpec {
|
|
12
12
|
schema: string;
|
|
13
|
-
appId:
|
|
14
|
-
|
|
13
|
+
appId: string;
|
|
14
|
+
projectName?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function wechatPackagingFromDelivery(delivery: unknown): WechatPackagingSpec;
|
|
15
18
|
/**
|
|
16
19
|
* Load `vmz.config.*` and write the WeChat packaging contract for the Rust packer.
|
|
17
20
|
* @param {string} project
|
|
18
21
|
*/
|
|
19
|
-
export declare function materializeWechatPackaging(project: any):
|
|
20
|
-
|
|
21
|
-
appId: any;
|
|
22
|
-
};
|
|
22
|
+
export declare function materializeWechatPackaging(project: any): WechatPackagingSpec;
|
|
23
|
+
export {};
|
package/dist/wechat-packaging.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Materialize `defineConfig({ delivery: { packaging: { wechat } } })` for wechat_pack.
|
|
3
3
|
* Pure data only. Writes `dist/_vmz/wechat-packaging.json` (not a second config entry).
|
|
4
4
|
*/
|
|
5
|
-
// @ts-nocheck
|
|
6
5
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
7
6
|
import path from 'node:path';
|
|
8
7
|
import { createJiti } from 'jiti';
|
|
@@ -24,15 +23,10 @@ function loadConfigSync(project) {
|
|
|
24
23
|
}
|
|
25
24
|
return null;
|
|
26
25
|
}
|
|
27
|
-
/**
|
|
28
|
-
* @param {unknown} delivery
|
|
29
|
-
* @returns {{ schema: string, appId: string, projectName?: string, title?: string }}
|
|
30
|
-
*/
|
|
31
26
|
export function wechatPackagingFromDelivery(delivery) {
|
|
32
27
|
const diagnostics = [];
|
|
33
28
|
const packaging = pickDeliveryPackaging(delivery && typeof delivery === 'object' ? delivery : {}, diagnostics);
|
|
34
29
|
const wechat = packaging && packaging.wechat ? packaging.wechat : {};
|
|
35
|
-
/** @type {{ schema: string, appId: string, projectName?: string, title?: string }} */
|
|
36
30
|
const out = {
|
|
37
31
|
schema: WECHAT_PACKAGING_SCHEMA,
|
|
38
32
|
appId: typeof wechat.appId === 'string' && wechat.appId.trim() ? wechat.appId.trim() : 'touristappid',
|