@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.
Files changed (131) hide show
  1. package/dist/application-cmd.d.ts +6 -16
  2. package/dist/application-cmd.js +34 -180
  3. package/dist/author-input.d.ts +40 -19
  4. package/dist/author-input.js +2 -16
  5. package/dist/build-assemble.d.ts +63 -41
  6. package/dist/build-assemble.js +42 -43
  7. package/dist/bundler-adapter.d.ts +46 -48
  8. package/dist/bundler-adapter.js +4 -43
  9. package/dist/cdn-policy.d.ts +77 -93
  10. package/dist/cdn-policy.js +10 -16
  11. package/dist/cli-localize.d.ts +34 -0
  12. package/dist/cli-localize.js +58 -0
  13. package/dist/cli.d.ts +8 -19
  14. package/dist/cli.js +69 -252
  15. package/dist/content-addressed-assets.d.ts +24 -10
  16. package/dist/content-addressed-assets.js +2 -7
  17. package/dist/delivery-profile.d.ts +54 -27
  18. package/dist/delivery-profile.js +15 -13
  19. package/dist/dev-session.d.ts +29 -23
  20. package/dist/dev-session.js +0 -21
  21. package/dist/dev-watch-roots.d.ts +34 -25
  22. package/dist/dev-watch-roots.js +0 -31
  23. package/dist/document-build.d.ts +22 -97
  24. package/dist/document-build.js +4 -19
  25. package/dist/document-check.d.ts +30 -53
  26. package/dist/document-check.js +14 -29
  27. package/dist/document-cmd.d.ts +3 -6
  28. package/dist/document-cmd.js +19 -79
  29. package/dist/document-designs.d.ts +5 -8
  30. package/dist/document-designs.js +2 -15
  31. package/dist/document-enrich.d.ts +52 -24
  32. package/dist/document-enrich.js +4 -32
  33. package/dist/document-evidence.d.ts +46 -43
  34. package/dist/document-evidence.js +6 -47
  35. package/dist/document-integrate.d.ts +13 -29
  36. package/dist/document-integrate.js +2 -13
  37. package/dist/document-interactive.d.ts +45 -67
  38. package/dist/document-interactive.js +9 -50
  39. package/dist/document-layout-render.d.ts +7 -16
  40. package/dist/document-layout-render.js +0 -17
  41. package/dist/document-locale.d.ts +12 -25
  42. package/dist/document-locale.js +3 -14
  43. package/dist/document-markdown.d.ts +9 -5
  44. package/dist/document-markdown.js +0 -4
  45. package/dist/document-routing-config.d.ts +7 -14
  46. package/dist/document-routing-config.js +0 -9
  47. package/dist/document-scan.d.ts +14 -18
  48. package/dist/document-scan.js +2 -23
  49. package/dist/document-schema.d.ts +154 -41
  50. package/dist/document-schema.js +0 -35
  51. package/dist/embedded-packaging.d.ts +20 -8
  52. package/dist/embedded-packaging.js +0 -1
  53. package/dist/explain-cmd.d.ts +4 -3
  54. package/dist/explain-cmd.js +16 -65
  55. package/dist/index.d.ts +70 -143
  56. package/dist/index.js +16 -136
  57. package/dist/invocation.d.ts +29 -50
  58. package/dist/invocation.js +11 -57
  59. package/dist/locale-check.d.ts +69 -70
  60. package/dist/locale-check.js +5 -66
  61. package/dist/locale-cmd.d.ts +2 -5
  62. package/dist/locale-cmd.js +62 -142
  63. package/dist/locale-delivery.d.ts +294 -191
  64. package/dist/locale-delivery.js +8 -94
  65. package/dist/locale-route-emit.d.ts +23 -9
  66. package/dist/locale-route-emit.js +0 -7
  67. package/dist/locale-router.d.ts +189 -162
  68. package/dist/locale-router.js +13 -122
  69. package/dist/locale-runtime.d.ts +292 -262
  70. package/dist/locale-runtime.js +8 -102
  71. package/dist/locale-schema.js +0 -1
  72. package/dist/locale-tooling.d.ts +100 -63
  73. package/dist/locale-tooling.js +7 -45
  74. package/dist/log.d.ts +22 -15
  75. package/dist/log.js +24 -21
  76. package/dist/native-addon.d.ts +10 -9
  77. package/dist/native-addon.js +1 -10
  78. package/dist/pack-client-packages.d.ts +5 -1
  79. package/dist/pack-client-packages.js +0 -6
  80. package/dist/pack.d.ts +17 -15
  81. package/dist/pack.js +0 -12
  82. package/dist/packages.d.ts +10 -23
  83. package/dist/packages.js +1 -37
  84. package/dist/plan-cmd.d.ts +6 -0
  85. package/dist/plan-cmd.js +35 -0
  86. package/dist/plugin-host.js +0 -1
  87. package/dist/port.d.ts +2 -10
  88. package/dist/port.js +2 -11
  89. package/dist/pretty-json.d.ts +9 -19
  90. package/dist/pretty-json.js +3 -17
  91. package/dist/production-observability.d.ts +37 -181
  92. package/dist/production-observability.js +1 -9
  93. package/dist/production-test-pack.d.ts +17 -3
  94. package/dist/production-test-pack.js +0 -2
  95. package/dist/public-static-assets.d.ts +6 -1
  96. package/dist/public-static-assets.js +0 -5
  97. package/dist/refactor-cmd.d.ts +3 -6
  98. package/dist/refactor-cmd.js +16 -69
  99. package/dist/release-cmd.d.ts +7 -6
  100. package/dist/release-cmd.js +17 -59
  101. package/dist/release-pack.d.ts +7 -3
  102. package/dist/release-pack.js +0 -6
  103. package/dist/resolve.d.ts +15 -19
  104. package/dist/resolve.js +1 -15
  105. package/dist/server-artifact.d.ts +30 -75
  106. package/dist/server-artifact.js +0 -10
  107. package/dist/server-language-backend.d.ts +22 -79
  108. package/dist/server-language-backend.js +0 -26
  109. package/dist/site-delivery.d.ts +46 -59
  110. package/dist/site-delivery.js +3 -8
  111. package/dist/site-favicon.d.ts +6 -1
  112. package/dist/site-favicon.js +0 -5
  113. package/dist/static-emit.d.ts +73 -103
  114. package/dist/static-emit.js +1 -26
  115. package/dist/test-cmd.d.ts +3 -5
  116. package/dist/test-cmd.js +15 -25
  117. package/dist/test-compile.js +0 -1
  118. package/dist/test-discover.js +0 -1
  119. package/dist/test-logic.js +0 -1
  120. package/dist/test-protocol.js +0 -1
  121. package/dist/toolchain-dx.d.ts +11 -0
  122. package/dist/toolchain-dx.js +10 -0
  123. package/dist/watch-diff.d.ts +4 -13
  124. package/dist/watch-diff.js +0 -17
  125. package/dist/wechat-packaging.d.ts +8 -7
  126. package/dist/wechat-packaging.js +0 -6
  127. package/locales/en-US/cli.json +105 -0
  128. package/locales/locales.json +4 -0
  129. package/package.json +15 -12
  130. package/dist/resolve-native-cli.d.ts +0 -14
  131. package/dist/resolve-native-cli.js +0 -84
@@ -5,7 +5,6 @@
5
5
  * JS under assets/ always rewrites ESM `./` → `../` so barrels (vmz-dom → dom-core)
6
6
  * resolve at dist root — never prefer hashed siblings for JS (second-hop 404).
7
7
  */
8
- // @ts-nocheck
9
8
  import crypto from 'node:crypto';
10
9
  import fs from 'node:fs';
11
10
  import path from 'node:path';
@@ -89,9 +88,7 @@ export function emitContentAddressedAssets(distDir, opts = {}) {
89
88
  const assetsDir = path.join(abs, 'assets');
90
89
  fs.mkdirSync(assetsDir, { recursive: true });
91
90
  const candidates = Array.isArray(opts.candidates) ? opts.candidates : collectCandidates(abs);
92
- /** @type {Array<Record<string, any>>} */
93
91
  const objects = [];
94
- /** @type {Record<string, string>} */
95
92
  const rewrites = {};
96
93
  const ordered = orderCandidates(candidates);
97
94
  for (const rel of ordered) {
@@ -168,7 +165,6 @@ export function emitContentAddressedAssets(distDir, opts = {}) {
168
165
  */
169
166
  function orderCandidates(candidates) {
170
167
  const set = new Set(candidates.map((c) => String(c).replace(/\\/g, '/').replace(/^\//, '')));
171
- /** @type {string[]} */
172
168
  const out = [];
173
169
  for (const name of DEFAULT_CANDIDATES) {
174
170
  if (set.has(name) && !CSS_AGGREGATORS.has(name) && !JS_ENTRY_AGGREGATORS.has(name))
@@ -208,9 +204,9 @@ function ingestCandidate(absDist, rel, rewrites, objects, opts) {
208
204
  const src = path.join(absDist, ...logical.split('/'));
209
205
  if (!fs.existsSync(src) || !fs.statSync(src).isFile())
210
206
  return;
211
- let buf = fs.readFileSync(src);
207
+ let buf = Buffer.from(fs.readFileSync(src));
212
208
  if (typeof opts.transform === 'function') {
213
- buf = opts.transform(buf);
209
+ buf = Buffer.from(opts.transform(buf));
214
210
  }
215
211
  const digest = sha256Hex(buf);
216
212
  const ext = path.extname(logical) || '';
@@ -280,7 +276,6 @@ export function assertSharedAssetPath(distDir, a, b, ext = '.js') {
280
276
  return { ok: true, assetPath: rel, digest: da };
281
277
  }
282
278
  function collectCandidates(distDir) {
283
- /** @type {string[]} */
284
279
  const out = [];
285
280
  for (const name of DEFAULT_CANDIDATES) {
286
281
  if (fs.existsSync(path.join(distDir, name)))
@@ -7,6 +7,50 @@ export declare const BUILD_PROFILE_SELECTION_SCHEMA = "vmz.build.profile_selecti
7
7
  /** Browser-era assembly kinds (04 B5). `static-cdn` was renamed to `web-static`. */
8
8
  export declare const ASSEMBLIES: readonly string[];
9
9
  export declare const SERVER_RUNTIMES: readonly string[];
10
+ interface SiteAuthoring {
11
+ artifact: string;
12
+ sources: unknown;
13
+ siteId?: unknown;
14
+ resolution?: unknown;
15
+ activation?: unknown;
16
+ expectedCompatibility?: unknown;
17
+ failure?: unknown;
18
+ failurePolicy?: unknown;
19
+ update?: unknown;
20
+ updatePolicy?: unknown;
21
+ rollback?: unknown;
22
+ rollbackPolicy?: unknown;
23
+ security?: unknown;
24
+ securityPolicy?: unknown;
25
+ }
26
+ export interface WechatPackagingData {
27
+ appId?: string;
28
+ projectName?: string;
29
+ title?: string;
30
+ }
31
+ interface DeliveryAuthoringTable {
32
+ schema: string;
33
+ default: string;
34
+ profiles: Record<string, unknown>;
35
+ sugar: boolean;
36
+ packaging?: {
37
+ wechat: WechatPackagingData;
38
+ };
39
+ digest?: string;
40
+ }
41
+ interface BuildProfileSelection {
42
+ schema: string;
43
+ profileId: string;
44
+ name: string;
45
+ nameExplicit: boolean;
46
+ host: string;
47
+ assembly: string;
48
+ serverRuntime: string | null;
49
+ hasSiteSources: boolean;
50
+ authoringDigest: string | undefined;
51
+ fromCli: boolean;
52
+ digest?: string;
53
+ }
10
54
  /** Official built-in aliases when not overridden in config. */
11
55
  export declare const BUILTIN_PROFILES: Readonly<{
12
56
  'web-client': {
@@ -44,28 +88,21 @@ export declare function normalizeProfileArtifactName(id: any, rawName: any, diag
44
88
  * @param {{ name?: string, id?: string } | null | undefined} profile
45
89
  */
46
90
  export declare function resolveProfileArtifactDir(outDir: any, profile: any): any;
47
- export declare function pickSiteAuthoring(raw: any): {
48
- artifact: string;
49
- sources: any;
50
- };
91
+ export declare function pickSiteAuthoring(raw: any): SiteAuthoring;
51
92
  /**
52
93
  * `delivery.packaging.wechat` — vendor identity, not WeChat JSON / wx APIs.
53
94
  * @param {unknown} raw
54
95
  * @param {Array<{ code: string, message: string }>} diagnostics
55
96
  */
56
- export declare function pickDeliveryPackaging(raw: any, diagnostics: any): {
57
- wechat?: undefined;
58
- } | {
59
- wechat: {};
60
- };
97
+ export declare function pickDeliveryPackaging(raw: unknown, diagnostics: Array<{
98
+ code: string;
99
+ message: string;
100
+ }>): {
101
+ wechat: WechatPackagingData;
102
+ } | null;
61
103
  export declare function normalizeDeliveryAuthoring(raw: any): {
62
104
  ok: boolean;
63
- table: {
64
- schema: string;
65
- default: string;
66
- profiles: {};
67
- sugar: boolean;
68
- };
105
+ table: DeliveryAuthoringTable;
69
106
  diagnostics?: undefined;
70
107
  } | {
71
108
  ok: boolean;
@@ -82,21 +119,11 @@ export declare function selectBuildProfile(table: any, cliProfile?: string): {
82
119
  profile?: undefined;
83
120
  } | {
84
121
  ok: boolean;
85
- selection: {
86
- schema: string;
87
- profileId: any;
88
- name: any;
89
- nameExplicit: boolean;
90
- host: any;
91
- assembly: any;
92
- serverRuntime: any;
93
- hasSiteSources: boolean;
94
- authoringDigest: any;
95
- fromCli: boolean;
96
- };
122
+ selection: BuildProfileSelection;
97
123
  profile: any;
98
124
  diagnostics?: undefined;
99
125
  };
100
126
  export declare function semanticIdsForAssembly(assembly: any): string[];
101
127
  export declare function canonicalJson(value: any): string;
102
128
  export declare function sha256Hex(text: any): string;
129
+ export {};
@@ -2,7 +2,6 @@
2
2
  * B0 — Delivery profile authoring normalize + CLI --profile resolve.
3
3
  * Pure data only; expands legacy site-delivery sugar into profiles[default].
4
4
  */
5
- // @ts-nocheck
6
5
  import crypto from 'node:crypto';
7
6
  import path from 'node:path';
8
7
  export const DELIVERY_PROFILE_AUTHORING_SCHEMA = 'vmz.delivery.authoring.v0';
@@ -106,11 +105,12 @@ export function pickSiteAuthoring(raw) {
106
105
  export function pickDeliveryPackaging(raw, diagnostics) {
107
106
  if (!isPlainObject(raw) || raw.packaging == null)
108
107
  return null;
109
- if (!isPlainObject(raw.packaging)) {
108
+ const packagingRaw = raw.packaging;
109
+ if (!isPlainObject(packagingRaw)) {
110
110
  diagnostics.push({ code: 'delivery.packaging', message: 'delivery.packaging must be an object' });
111
111
  return null;
112
112
  }
113
- for (const key of Object.keys(raw.packaging)) {
113
+ for (const key of Object.keys(packagingRaw)) {
114
114
  if (key !== 'wechat') {
115
115
  diagnostics.push({
116
116
  code: 'delivery.packaging.vendor',
@@ -118,9 +118,9 @@ export function pickDeliveryPackaging(raw, diagnostics) {
118
118
  });
119
119
  }
120
120
  }
121
- const wechat = raw.packaging.wechat;
121
+ const wechat = packagingRaw.wechat;
122
122
  if (wechat == null)
123
- return {};
123
+ return null;
124
124
  if (!isPlainObject(wechat)) {
125
125
  diagnostics.push({
126
126
  code: 'delivery.packaging.wechat',
@@ -128,7 +128,8 @@ export function pickDeliveryPackaging(raw, diagnostics) {
128
128
  });
129
129
  return null;
130
130
  }
131
- for (const [k, v] of Object.entries(wechat)) {
131
+ const wechatObj = wechat;
132
+ for (const [k, v] of Object.entries(wechatObj)) {
132
133
  if (typeof v === 'function') {
133
134
  diagnostics.push({
134
135
  code: 'delivery.packaging.executable',
@@ -150,13 +151,13 @@ export function pickDeliveryPackaging(raw, diagnostics) {
150
151
  }
151
152
  }
152
153
  const out = {};
153
- if (typeof wechat.appId === 'string' && wechat.appId.trim())
154
- out.appId = wechat.appId.trim();
155
- if (typeof wechat.projectName === 'string' && wechat.projectName.trim()) {
156
- out.projectName = wechat.projectName.trim();
154
+ if (typeof wechatObj.appId === 'string' && wechatObj.appId.trim())
155
+ out.appId = wechatObj.appId.trim();
156
+ if (typeof wechatObj.projectName === 'string' && wechatObj.projectName.trim()) {
157
+ out.projectName = wechatObj.projectName.trim();
157
158
  }
158
- if (typeof wechat.title === 'string' && wechat.title.trim())
159
- out.title = wechat.title.trim();
159
+ if (typeof wechatObj.title === 'string' && wechatObj.title.trim())
160
+ out.title = wechatObj.title.trim();
160
161
  return { wechat: out };
161
162
  }
162
163
  function normalizeProfileEntry(entry, id, diagnostics) {
@@ -344,8 +345,9 @@ export function normalizeDeliveryAuthoring(raw) {
344
345
  default: defaultId,
345
346
  profiles,
346
347
  sugar,
347
- ...(packaging ? { packaging } : {}),
348
348
  };
349
+ if (packaging)
350
+ table.packaging = packaging;
349
351
  table.digest = sha256Hex(canonicalJson(table));
350
352
  return { ok: true, table };
351
353
  }
@@ -9,33 +9,39 @@
9
9
  * 2. Soft reload only re-imports affected pages unless shared `lib/` / full rebuild.
10
10
  * 3. Soft reload failure → **auto-respawn** serve-host (fresh ESM graph), not "keep broken host".
11
11
  */
12
- /**
13
- * @typedef {object} DevSessionOptions
14
- * @property {string} project
15
- * @property {string} outDir
16
- * @property {string} [host]
17
- * @property {number} [port]
18
- * @property {number} [pollMs]
19
- * @property {'browser' | 'mini-program-wechat'} [target]
20
- * @property {AbortSignal} [signal]
21
- * @property {typeof createWorkspace} [createWorkspaceFn]
22
- * @property {(opts: { project: string, outDir: string, host: string, port: number }) => import('node:child_process').ChildProcess} [spawnHostFn]
23
- * @property {(host: string, port: number, payload?: object) => Promise<void>} [softReloadFn]
24
- */
25
- /**
26
- * @param {DevSessionOptions} options
27
- */
28
- export declare function createDevSession(options: any): {
12
+ import { createWorkspace } from './index.js';
13
+ interface DevSessionOptions {
14
+ project: string;
15
+ outDir: string;
16
+ host?: string;
17
+ port?: number;
18
+ pollMs?: number;
19
+ target?: 'browser' | 'mini-program-wechat';
20
+ signal?: AbortSignal;
21
+ createWorkspaceFn?: typeof createWorkspace;
22
+ spawnHostFn?: (opts: {
23
+ project: string;
24
+ outDir: string;
25
+ host: string;
26
+ port: number;
27
+ }) => import('node:child_process').ChildProcess;
28
+ softReloadFn?: (host: string, port: number, payload?: object) => Promise<void>;
29
+ }
30
+ export declare function createDevSession(options: DevSessionOptions): {
29
31
  ws: any;
30
- rebuild: (changes: any) => any;
32
+ rebuild: (changes?: Array<{
33
+ path: string;
34
+ kind: "update" | "delete";
35
+ }>) => any;
31
36
  start: () => Promise<void>;
32
37
  stop: () => Promise<void>;
33
- project: any;
34
- outDir: any;
35
- host: any;
36
- port: any;
38
+ project: string;
39
+ outDir: string;
40
+ host: string;
41
+ port: number;
37
42
  };
38
43
  /** @deprecated use fileFingerprintMap */
39
44
  export declare function srcFingerprint(srcDir: any): number;
40
45
  /** @deprecated */
41
- export declare function listWatchedFiles(srcDir: any): any[];
46
+ export declare function listWatchedFiles(srcDir: any): string[];
47
+ export {};
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Long-lived Node dev session (/session).
4
3
  *
@@ -19,22 +18,6 @@ import { emitLocaleRuntimeModules, localeHasErrors } from './locale-check.js';
19
18
  import { log } from './log.js';
20
19
  import { coalesceRootBurst, collectDevWatchRoots, classifyWatchRoot, isDependencyPath, mergeDirtySets } from './dev-watch-roots.js';
21
20
  import { diffFingerprints, fileFingerprintMap } from './watch-diff.js';
22
- /**
23
- * @typedef {object} DevSessionOptions
24
- * @property {string} project
25
- * @property {string} outDir
26
- * @property {string} [host]
27
- * @property {number} [port]
28
- * @property {number} [pollMs]
29
- * @property {'browser' | 'mini-program-wechat'} [target]
30
- * @property {AbortSignal} [signal]
31
- * @property {typeof createWorkspace} [createWorkspaceFn]
32
- * @property {(opts: { project: string, outDir: string, host: string, port: number }) => import('node:child_process').ChildProcess} [spawnHostFn]
33
- * @property {(host: string, port: number, payload?: object) => Promise<void>} [softReloadFn]
34
- */
35
- /**
36
- * @param {DevSessionOptions} options
37
- */
38
21
  export function createDevSession(options) {
39
22
  const project = options.project;
40
23
  const outDir = options.outDir;
@@ -46,12 +29,8 @@ export function createDevSession(options) {
46
29
  const spawnHost = options.spawnHostFn ?? defaultSpawnHost;
47
30
  const softReload = options.softReloadFn ?? defaultSoftReload;
48
31
  const ws = createWs({ root: project, outDir });
49
- /** @type {import('node:child_process').ChildProcess | null} */
50
32
  let child = null;
51
33
  let stopped = false;
52
- /**
53
- * @param {Array<{ path: string, kind: 'update' | 'delete' }>} [changes]
54
- */
55
34
  function rebuild(changes) {
56
35
  if (changes?.length)
57
36
  ws.updateFiles(changes);
@@ -2,19 +2,16 @@
2
2
  * Dev watch helpers: coalesce multi-file bursts without dropping dirty set,
3
3
  * and derive extra watch roots from the compile graph (deployment unit sources).
4
4
  */
5
- /**
6
- * @typedef {{ changed: string[], deleted: string[] }} DirtySet
7
- */
8
- /**
9
- * Merge dirty sets: later change cancels delete and vice versa.
10
- * @param {DirtySet} a
11
- * @param {DirtySet} b
12
- * @returns {DirtySet}
13
- */
14
- export declare function mergeDirtySets(a: any, b: any): {
15
- changed: unknown[];
16
- deleted: unknown[];
17
- };
5
+ export interface DirtySet {
6
+ changed: string[];
7
+ deleted: string[];
8
+ }
9
+ interface CoalesceRootBurstOpts {
10
+ sleep?: (ms: number) => Promise<void>;
11
+ maxRounds?: number;
12
+ settleMs?: number;
13
+ }
14
+ export declare function mergeDirtySets(a: DirtySet, b: DirtySet): DirtySet;
18
15
  /**
19
16
  * Wait until `root` stops changing; return the **accumulated** dirty set since `initial`.
20
17
  * Updates `fingerprints` for `root` as it polls. Does **not** discard `initial`.
@@ -25,28 +22,28 @@ export declare function mergeDirtySets(a: any, b: any): {
25
22
  * @param {{ sleep?: (ms: number) => Promise<void>, maxRounds?: number, settleMs?: number }} [opts]
26
23
  * @returns {Promise<DirtySet>}
27
24
  */
28
- export declare function coalesceRootBurst(root: any, fingerprints: any, initial: any, opts?: {}): Promise<{
29
- changed: any[];
30
- deleted: any[];
25
+ export declare function coalesceRootBurst(root: string, fingerprints: Map<string, Map<string, string>>, initial: DirtySet, opts?: CoalesceRootBurstOpts): Promise<{
26
+ changed: string[];
27
+ deleted: string[];
31
28
  }>;
32
29
  /**
33
30
  * Walk up from a file to find a package.json directory.
34
31
  * @param {string} file
35
32
  * @returns {string | null}
36
33
  */
37
- export declare function findPackageRoot(file: any): string;
34
+ export declare function findPackageRoot(file: string): string | null;
38
35
  /**
39
36
  * Prefer package/src when present; otherwise the directory containing the source file.
40
37
  * @param {string} sourceFile
41
38
  * @returns {string | null}
42
39
  */
43
- export declare function watchRootForSourceFile(sourceFile: any): string;
40
+ export declare function watchRootForSourceFile(sourceFile: string): string | null;
44
41
  /**
45
42
  * Absolute roots for workspace / file / link deps that have a src tree.
46
43
  * @param {string} project
47
44
  * @returns {string[]}
48
45
  */
49
- export declare function localLinkDependencyRoots(project: any): any[];
46
+ export declare function localLinkDependencyRoots(project: string): string[];
50
47
  /**
51
48
  * Collect watch roots: project src/locales/documents + compile-graph external sources
52
49
  * + local link/workspace package roots. Never adds a bare registry node_modules tree.
@@ -54,10 +51,14 @@ export declare function localLinkDependencyRoots(project: any): any[];
54
51
  * @param {{ project: string, outDir: string }} opts
55
52
  * @returns {{ roots: string[], dependencyRoots: string[], applicationRoots: string[] }}
56
53
  */
57
- export declare function collectDevWatchRoots(opts: any): {
58
- roots: any[];
59
- dependencyRoots: unknown[];
60
- applicationRoots: any[];
54
+ interface CollectDevWatchRootsOpts {
55
+ project: string;
56
+ outDir: string;
57
+ }
58
+ export declare function collectDevWatchRoots(opts: CollectDevWatchRootsOpts): {
59
+ roots: string[];
60
+ dependencyRoots: string[];
61
+ applicationRoots: string[];
61
62
  };
62
63
  /**
63
64
  * Classify which watch bucket a root belongs to.
@@ -71,10 +72,18 @@ export declare function collectDevWatchRoots(opts: any): {
71
72
  * }} ctx
72
73
  * @returns {'src' | 'locales' | 'docs' | 'designs' | 'dep' | 'other'}
73
74
  */
74
- export declare function classifyWatchRoot(root: any, ctx: any): "src" | "locales" | "docs" | "designs" | "dep" | "other";
75
+ export interface ClassifyWatchRootCtx {
76
+ src: string;
77
+ docsRoot: string;
78
+ localesRoot: string;
79
+ designsRoot: string;
80
+ dependencyRoots: string[];
81
+ }
82
+ export declare function classifyWatchRoot(root: string, ctx: ClassifyWatchRootCtx): 'src' | 'locales' | 'docs' | 'designs' | 'dep' | 'other';
75
83
  /**
76
84
  * Classify whether a changed file lives under a dependency watch root (not app src).
77
85
  * @param {string} file
78
86
  * @param {string[]} dependencyRoots
79
87
  */
80
- export declare function isDependencyPath(file: any, dependencyRoots: any): any;
88
+ export declare function isDependencyPath(file: string, dependencyRoots: string[]): boolean;
89
+ export {};
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Dev watch helpers: coalesce multi-file bursts without dropping dirty set,
4
3
  * and derive extra watch roots from the compile graph (deployment unit sources).
@@ -6,15 +5,6 @@
6
5
  import { existsSync, readFileSync, realpathSync } from 'node:fs';
7
6
  import path from 'node:path';
8
7
  import { diffFingerprints, fileFingerprintMap } from './watch-diff.js';
9
- /**
10
- * @typedef {{ changed: string[], deleted: string[] }} DirtySet
11
- */
12
- /**
13
- * Merge dirty sets: later change cancels delete and vice versa.
14
- * @param {DirtySet} a
15
- * @param {DirtySet} b
16
- * @returns {DirtySet}
17
- */
18
8
  export function mergeDirtySets(a, b) {
19
9
  const changed = new Set(a?.changed || []);
20
10
  const deleted = new Set(a?.deleted || []);
@@ -142,13 +132,6 @@ export function localLinkDependencyRoots(project) {
142
132
  }
143
133
  return roots;
144
134
  }
145
- /**
146
- * Collect watch roots: project src/locales/documents + compile-graph external sources
147
- * + local link/workspace package roots. Never adds a bare registry node_modules tree.
148
- *
149
- * @param {{ project: string, outDir: string }} opts
150
- * @returns {{ roots: string[], dependencyRoots: string[], applicationRoots: string[] }}
151
- */
152
135
  export function collectDevWatchRoots(opts) {
153
136
  const project = path.resolve(opts.project);
154
137
  const outDir = path.resolve(opts.outDir);
@@ -156,7 +139,6 @@ export function collectDevWatchRoots(opts) {
156
139
  const docsRoot = path.join(project, 'documents');
157
140
  const localesRoot = path.join(project, 'locales');
158
141
  const designsRoot = path.join(project, 'designs');
159
- /** @type {string[]} */
160
142
  const applicationRoots = [];
161
143
  if (existsSync(src))
162
144
  applicationRoots.push(src);
@@ -166,7 +148,6 @@ export function collectDevWatchRoots(opts) {
166
148
  applicationRoots.push(localesRoot);
167
149
  if (existsSync(designsRoot))
168
150
  applicationRoots.push(designsRoot);
169
- /** @type {Set<string>} */
170
151
  const depSet = new Set();
171
152
  const depJson = path.join(outDir, 'vmz-deployment.json');
172
153
  if (existsSync(depJson)) {
@@ -209,18 +190,6 @@ export function collectDevWatchRoots(opts) {
209
190
  }
210
191
  return { roots, dependencyRoots, applicationRoots };
211
192
  }
212
- /**
213
- * Classify which watch bucket a root belongs to.
214
- * @param {string} root
215
- * @param {{
216
- * src: string,
217
- * docsRoot: string,
218
- * localesRoot: string,
219
- * designsRoot: string,
220
- * dependencyRoots: string[],
221
- * }} ctx
222
- * @returns {'src' | 'locales' | 'docs' | 'designs' | 'dep' | 'other'}
223
- */
224
193
  export function classifyWatchRoot(root, ctx) {
225
194
  if (root === ctx.src)
226
195
  return 'src';
@@ -1,100 +1,25 @@
1
- /**
2
- * @param {{ projectRoot: string, outDir?: string, appDistDir?: string, strict?: boolean, engines?: { markdown?: string } }} opts
3
- */
4
- export declare function buildDocuments(opts: any): Promise<{
5
- ok: boolean;
6
- manifest: {
7
- schema: string;
8
- root: string;
9
- defaultLocale: any;
10
- locales: any[];
11
- localeLabels: any;
12
- collections: any[];
13
- mounts: any[];
14
- pages: {
15
- identity: any;
16
- sourcePath: any;
17
- route: any;
18
- anchors: any[];
19
- }[];
20
- diagnostics: any[];
1
+ import { buildDocumentIslands, buildDocumentSearch } from './document-interactive.js';
2
+ import { type DocumentManifest } from './document-schema.js';
3
+ export interface BuildDocumentsOpts {
4
+ projectRoot: string;
5
+ outDir?: string;
6
+ appDistDir?: string;
7
+ strict?: boolean;
8
+ engines?: {
9
+ markdown?: string;
21
10
  };
22
- outDir: string;
23
- pages: any[];
24
- search?: undefined;
25
- islands?: undefined;
26
- } | {
11
+ }
12
+ export interface BuildDocumentsPageResult {
13
+ route: string;
14
+ htmlPath: string;
15
+ viewPath: string;
16
+ }
17
+ export interface BuildDocumentsResult {
27
18
  ok: boolean;
28
- manifest: {
29
- schema: string;
30
- evidence: {
31
- schema: string;
32
- fences: any[];
33
- apiRefs: any[];
34
- testSelections: any[];
35
- status: string;
36
- };
37
- search: {
38
- schema: string;
39
- status: string;
40
- version: any;
41
- records: any[];
42
- };
43
- islands: {
44
- schema: string;
45
- hydrate: string;
46
- fullPageHydrate: boolean;
47
- islands: {
48
- name: string;
49
- kind: string;
50
- resume: string;
51
- index: any;
52
- }[];
53
- status: string;
54
- };
55
- build: {
56
- engine: any;
57
- outDir: string;
58
- designs: string;
59
- designsCss: any;
60
- hostShell: string;
61
- pages: any[];
62
- evidence: string;
63
- search: string;
64
- islands: string;
65
- };
66
- root: string;
67
- defaultLocale: any;
68
- locales: any[];
69
- localeLabels: any;
70
- collections: any[];
71
- mounts: any[];
72
- pages: {
73
- identity: any;
74
- sourcePath: any;
75
- route: any;
76
- anchors: any[];
77
- }[];
78
- diagnostics: any[];
79
- };
19
+ manifest: DocumentManifest;
80
20
  outDir: string;
81
- pages: any[];
82
- search: {
83
- schema: string;
84
- status: string;
85
- version: any;
86
- records: any[];
87
- };
88
- islands: {
89
- schema: string;
90
- hydrate: string;
91
- fullPageHydrate: boolean;
92
- islands: {
93
- name: string;
94
- kind: string;
95
- resume: string;
96
- index: any;
97
- }[];
98
- status: string;
99
- };
100
- }>;
21
+ pages: BuildDocumentsPageResult[];
22
+ search?: ReturnType<typeof buildDocumentSearch>;
23
+ islands?: ReturnType<typeof buildDocumentIslands>;
24
+ }
25
+ export declare function buildDocuments(opts: BuildDocumentsOpts): Promise<BuildDocumentsResult>;