@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.
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
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * B5 Assemble dispatch + B6 build-proof (per-build semantic id slots).
3
3
  */
4
- // @ts-nocheck
5
4
  import { mkdirSync } from 'node:fs';
6
5
  import path from 'node:path';
7
6
  import { semanticIdsForAssembly, sha256Hex, canonicalJson } from './delivery-profile.js';
@@ -14,12 +13,9 @@ import { emitWebStatic } from './static-emit.js';
14
13
  import { writePrettyJsonFile } from './pretty-json.js';
15
14
  export const BUILD_PROOF_SCHEMA = 'vmz.build.proof.v0';
16
15
  export const ASSEMBLE_MANIFEST_SCHEMA = 'vmz.assemble.manifest.v0';
17
- /**
18
- * @param {string} outDir
19
- * @param {any} ctx
20
- */
21
16
  export async function assembleDelivery(outDir, ctx) {
22
- const { selection, profile } = ctx;
17
+ const selection = ctx.selection;
18
+ const profile = ctx.profile;
23
19
  const assembly = selection.assembly;
24
20
  const result = {
25
21
  schema: ASSEMBLE_MANIFEST_SCHEMA,
@@ -59,24 +55,25 @@ export async function assembleDelivery(outDir, ctx) {
59
55
  }
60
56
  if (assembly === 'server-host' || assembly === 'cdn+server') {
61
57
  const server = emitServerArtifact(outDir, {
62
- profileId: selection.profileId,
63
- assembly,
64
- serverRuntime: selection.serverRuntime || 'node',
65
- packDigest: ctx.pack?.packDigest || null,
58
+ profileId: String(selection.profileId ?? ''),
59
+ assembly: String(assembly),
60
+ serverRuntime: String(selection.serverRuntime || 'node'),
61
+ packDigest: ctx.pack?.packDigest ?? null,
66
62
  });
63
+ const serverArtifact = server.artifact;
67
64
  result.steps.push({
68
65
  kind: 'server-host',
69
66
  status: 'emitted',
70
- digest: server.artifact.artifactDigest,
71
- publicRoutes: server.artifact.publicRoutes?.length ?? 0,
72
- internalCapabilities: server.artifact.internalCapabilities?.length ?? 0,
67
+ digest: serverArtifact.artifactDigest,
68
+ publicRoutes: serverArtifact.publicRoutes?.length ?? 0,
69
+ internalCapabilities: serverArtifact.internalCapabilities?.length ?? 0,
73
70
  httpContractDigest: server.httpContractDigest,
74
71
  });
75
72
  result.serverArtifact = {
76
- digest: server.artifact.artifactDigest,
73
+ digest: serverArtifact.artifactDigest,
77
74
  httpContractDigest: server.httpContractDigest,
78
- schema: server.artifact.schema,
79
- selectedRuntime: server.artifact.selectedRuntime,
75
+ schema: serverArtifact.schema,
76
+ selectedRuntime: serverArtifact.selectedRuntime,
80
77
  };
81
78
  }
82
79
  const siteAuthoring = profile.sources || null;
@@ -87,32 +84,35 @@ export async function assembleDelivery(outDir, ctx) {
87
84
  const site = emitSiteDelivery(outDir, siteAuthoring, {
88
85
  siteId: ctx.siteId,
89
86
  });
87
+ const siteContract = site.contract;
90
88
  result.steps.push({
91
89
  kind: 'site-delivery',
92
- digest: site.contract.contractDigest,
90
+ digest: siteContract.contractDigest,
93
91
  });
94
92
  result.siteDelivery = {
95
- digest: site.contract.contractDigest,
96
- schema: site.contract.schema,
93
+ digest: siteContract.contractDigest,
94
+ schema: siteContract.schema,
97
95
  };
98
96
  if (assembly === 'rust-embedded') {
99
97
  const pack = emitEmbeddedPackaging(outDir, {
100
98
  siteId: ctx.siteId,
101
- contractDigest: site.contract.contractDigest,
99
+ contractDigest: siteContract.contractDigest,
102
100
  });
101
+ const packIndex = pack.index;
103
102
  result.steps.push({
104
103
  kind: 'embedded-packaging',
105
- digest: pack.index.indexDigest,
106
- objectCount: pack.index.objectCount,
104
+ digest: packIndex.indexDigest,
105
+ objectCount: packIndex.objectCount,
107
106
  });
108
107
  result.embeddedPackaging = {
109
- digest: pack.index.indexDigest,
110
- objectCount: pack.index.objectCount,
111
- schema: pack.index.schema,
108
+ digest: packIndex.indexDigest,
109
+ objectCount: packIndex.objectCount,
110
+ schema: packIndex.schema,
112
111
  };
113
112
  }
114
113
  }
115
- result.packDigest = ctx.pack?.packDigest || null;
114
+ const packCtx = ctx.pack;
115
+ result.packDigest = packCtx?.packDigest || null;
116
116
  result.assembleDigest = sha256Hex(canonicalJson({ ...result, assembleDigest: undefined }));
117
117
  const vmzDir = path.join(outDir, '_vmz');
118
118
  mkdirSync(vmzDir, { recursive: true });
@@ -120,12 +120,11 @@ export async function assembleDelivery(outDir, ctx) {
120
120
  writePrettyJsonFile(file, result);
121
121
  return { manifest: result, path: file };
122
122
  }
123
- /**
124
- * @param {string} outDir
125
- * @param {any} ctx
126
- */
127
123
  export function emitBuildProof(outDir, ctx) {
128
- const semanticIds = semanticIdsForAssembly(ctx.selection.assembly);
124
+ const selection = ctx.selection;
125
+ const assemble = ctx.assemble;
126
+ const packCtx = ctx.pack;
127
+ const semanticIds = semanticIdsForAssembly(selection.assembly);
129
128
  const slots = {
130
129
  'server-host': { status: 'not-applicable' },
131
130
  'static-delivery': { status: 'not-applicable' },
@@ -134,14 +133,14 @@ export function emitBuildProof(outDir, ctx) {
134
133
  };
135
134
  for (const id of semanticIds) {
136
135
  if (id === 'static-delivery') {
137
- const step = (ctx.assemble?.steps || []).find((s) => s.kind === 'web-static');
136
+ const step = (assemble?.steps || []).find((s) => s.kind === 'web-static');
138
137
  slots[id] = step
139
138
  ? { status: 'emitted', detail: `digest=${String(step.digest).slice(0, 12)}` }
140
139
  : { status: 'pending', detail: 'assembly requires static emit' };
141
140
  }
142
141
  else if (id === 'site-fallback') {
143
- const siteStep = (ctx.assemble?.steps || []).find((s) => s.kind === 'site-delivery');
144
- const packStep = (ctx.assemble?.steps || []).find((s) => s.kind === 'embedded-packaging');
142
+ const siteStep = (assemble?.steps || []).find((s) => s.kind === 'site-delivery');
143
+ const packStep = (assemble?.steps || []).find((s) => s.kind === 'embedded-packaging');
145
144
  if (siteStep && packStep) {
146
145
  slots[id] = {
147
146
  status: 'emitted',
@@ -159,7 +158,7 @@ export function emitBuildProof(outDir, ctx) {
159
158
  }
160
159
  }
161
160
  else if (id === 'server-host') {
162
- const step = (ctx.assemble?.steps || []).find((s) => s.kind === 'server-host');
161
+ const step = (assemble?.steps || []).find((s) => s.kind === 'server-host');
163
162
  slots[id] =
164
163
  step && step.status === 'emitted'
165
164
  ? {
@@ -173,20 +172,20 @@ export function emitBuildProof(outDir, ctx) {
173
172
  }
174
173
  else if (id === 'asset-graph') {
175
174
  slots[id] = {
176
- status: ctx.pack?.packDigest ? 'pack-digest' : 'pending',
177
- detail: ctx.pack?.packDigest
178
- ? `pack=${String(ctx.pack.packDigest).slice(0, 12)} units=${ctx.pack.unitCount ?? '?'}`
175
+ status: packCtx?.packDigest ? 'pack-digest' : 'pending',
176
+ detail: packCtx?.packDigest
177
+ ? `pack=${String(packCtx.packDigest).slice(0, 12)} units=${packCtx.unitCount ?? '?'}`
179
178
  : 'pack missing',
180
179
  };
181
180
  }
182
181
  }
183
182
  const body = {
184
183
  schema: BUILD_PROOF_SCHEMA,
185
- profileId: ctx.selection.profileId,
186
- assembly: ctx.selection.assembly,
187
- selectionDigest: ctx.selection.digest || null,
188
- packDigest: ctx.pack?.packDigest || null,
189
- assembleDigest: ctx.assemble?.assembleDigest || null,
184
+ profileId: selection.profileId,
185
+ assembly: selection.assembly,
186
+ selectionDigest: selection.digest || null,
187
+ packDigest: packCtx?.packDigest || null,
188
+ assembleDigest: assemble?.assembleDigest || null,
190
189
  release: Boolean(ctx.release),
191
190
  semanticIds,
192
191
  slots,
@@ -3,48 +3,49 @@
3
3
  *
4
4
  * Vite/Rolldown may call these helpers; they must not reverse the arrow.
5
5
  */
6
- /**
7
- * @typedef {object} DeploymentUnit
8
- * @property {string} chunkId
9
- * @property {string} kind
10
- * @property {string} source
11
- * @property {string} clientEntry
12
- * @property {string} programIr
13
- * @property {string[]} [dependsOn]
14
- * @property {string[]} [dependedBy]
15
- * @property {boolean} [rebuilt]
16
- */
17
- /**
18
- * @typedef {object} DeploymentIr
19
- * @property {string} schema
20
- * @property {DeploymentUnit[]} units
21
- * @property {string[]} [affectedChunks]
22
- * @property {string[]} [seedChunks]
23
- * @property {boolean} [islandHmr]
24
- * @property {boolean} [full]
25
- */
26
- /**
27
- * @param {string} outDir
28
- * @returns {DeploymentIr}
29
- */
30
- export declare function loadDeploymentIr(outDir: any): any;
31
- /**
32
- * Map Deployment IR → bundler entry points (absolute paths under outDir).
33
- * @param {string} outDir
34
- * @param {DeploymentIr} [ir]
35
- */
36
- export declare function planBundleInputs(outDir: any, ir?: any): any;
37
- /**
38
- * Entries that were rebuilt in the last emit (HMR / incremental pack).
39
- * @param {string} outDir
40
- * @param {DeploymentIr} [ir]
41
- */
42
- export declare function planAffectedBundleInputs(outDir: any, ir?: any): any;
43
- /**
44
- * Thin Vite plugin factory: only reads Deployment IR. No `.vmz` transform hooks.
45
- * @param {{ outDir?: string, root?: string }} [options]
46
- */
47
- export declare function createVitePluginVmzAdapter(options?: {}): {
6
+ export interface DeploymentUnit {
7
+ chunkId: string;
8
+ kind: string;
9
+ source: string;
10
+ clientEntry: string;
11
+ programIr: string;
12
+ dependsOn?: string[];
13
+ dependedBy?: string[];
14
+ rebuilt?: boolean;
15
+ }
16
+ export interface DeploymentIr {
17
+ schema: string;
18
+ units: DeploymentUnit[];
19
+ affectedChunks?: string[];
20
+ seedChunks?: string[];
21
+ islandHmr?: boolean;
22
+ full?: boolean;
23
+ }
24
+ export interface VmzAdapterOptions {
25
+ outDir?: string;
26
+ root?: string;
27
+ }
28
+ export declare function loadDeploymentIr(outDir: string): DeploymentIr;
29
+ /** Map Deployment IR → bundler entry points (absolute paths under outDir). */
30
+ export declare function planBundleInputs(outDir: string, ir?: DeploymentIr): Array<{
31
+ chunkId: string;
32
+ kind: string;
33
+ entry: string;
34
+ programIr: string;
35
+ source: string;
36
+ rebuilt: boolean;
37
+ }>;
38
+ /** Entries that were rebuilt in the last emit (HMR / incremental pack). */
39
+ export declare function planAffectedBundleInputs(outDir: string, ir?: DeploymentIr): {
40
+ chunkId: string;
41
+ kind: string;
42
+ entry: string;
43
+ programIr: string;
44
+ source: string;
45
+ rebuilt: boolean;
46
+ }[];
47
+ /** Thin Vite plugin factory: only reads Deployment IR. No `.vmz` transform hooks. */
48
+ export declare function createVitePluginVmzAdapter(options?: VmzAdapterOptions): {
48
49
  name: string;
49
50
  buildStart(): void;
50
51
  /**
@@ -52,12 +53,9 @@ export declare function createVitePluginVmzAdapter(options?: {}): {
52
53
  */
53
54
  configResolved(): void;
54
55
  };
55
- /**
56
- * Thin Rolldown plugin factory (deployment) — same contract as Vite adapter: read Deployment IR only.
57
- * @param {{ outDir?: string, root?: string }} [options]
58
- */
59
- export declare function createRolldownPluginVmzAdapter(options?: {}): {
56
+ /** Thin Rolldown plugin factory (deployment) — same contract as Vite adapter: read Deployment IR only. */
57
+ export declare function createRolldownPluginVmzAdapter(options?: VmzAdapterOptions): {
60
58
  name: string;
61
59
  buildStart(): void;
62
- options(inputOptions: any): any;
60
+ options(inputOptions: unknown): unknown;
63
61
  };
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Bundler adapter (session) — consumes Deployment IR; does not invent VMZ semantics.
4
3
  *
@@ -6,30 +5,6 @@
6
5
  */
7
6
  import { existsSync, readFileSync } from 'node:fs';
8
7
  import path from 'node:path';
9
- /**
10
- * @typedef {object} DeploymentUnit
11
- * @property {string} chunkId
12
- * @property {string} kind
13
- * @property {string} source
14
- * @property {string} clientEntry
15
- * @property {string} programIr
16
- * @property {string[]} [dependsOn]
17
- * @property {string[]} [dependedBy]
18
- * @property {boolean} [rebuilt]
19
- */
20
- /**
21
- * @typedef {object} DeploymentIr
22
- * @property {string} schema
23
- * @property {DeploymentUnit[]} units
24
- * @property {string[]} [affectedChunks]
25
- * @property {string[]} [seedChunks]
26
- * @property {boolean} [islandHmr]
27
- * @property {boolean} [full]
28
- */
29
- /**
30
- * @param {string} outDir
31
- * @returns {DeploymentIr}
32
- */
33
8
  export function loadDeploymentIr(outDir) {
34
9
  const file = path.join(outDir, 'vmz-deployment.json');
35
10
  if (!existsSync(file)) {
@@ -41,11 +16,7 @@ export function loadDeploymentIr(outDir) {
41
16
  }
42
17
  return ir;
43
18
  }
44
- /**
45
- * Map Deployment IR → bundler entry points (absolute paths under outDir).
46
- * @param {string} outDir
47
- * @param {DeploymentIr} [ir]
48
- */
19
+ /** Map Deployment IR → bundler entry points (absolute paths under outDir). */
49
20
  export function planBundleInputs(outDir, ir = loadDeploymentIr(outDir)) {
50
21
  return (ir.units || []).map((u) => ({
51
22
  chunkId: u.chunkId,
@@ -56,19 +27,12 @@ export function planBundleInputs(outDir, ir = loadDeploymentIr(outDir)) {
56
27
  rebuilt: Boolean(u.rebuilt),
57
28
  }));
58
29
  }
59
- /**
60
- * Entries that were rebuilt in the last emit (HMR / incremental pack).
61
- * @param {string} outDir
62
- * @param {DeploymentIr} [ir]
63
- */
30
+ /** Entries that were rebuilt in the last emit (HMR / incremental pack). */
64
31
  export function planAffectedBundleInputs(outDir, ir = loadDeploymentIr(outDir)) {
65
32
  const affected = new Set(ir.affectedChunks || []);
66
33
  return planBundleInputs(outDir, ir).filter((e) => e.rebuilt || affected.has(e.chunkId));
67
34
  }
68
- /**
69
- * Thin Vite plugin factory: only reads Deployment IR. No `.vmz` transform hooks.
70
- * @param {{ outDir?: string, root?: string }} [options]
71
- */
35
+ /** Thin Vite plugin factory: only reads Deployment IR. No `.vmz` transform hooks. */
72
36
  export function createVitePluginVmzAdapter(options = {}) {
73
37
  const outDir = options.outDir ?? 'dist';
74
38
  return {
@@ -88,10 +52,7 @@ export function createVitePluginVmzAdapter(options = {}) {
88
52
  },
89
53
  };
90
54
  }
91
- /**
92
- * Thin Rolldown plugin factory (deployment) — same contract as Vite adapter: read Deployment IR only.
93
- * @param {{ outDir?: string, root?: string }} [options]
94
- */
55
+ /** Thin Rolldown plugin factory (deployment) — same contract as Vite adapter: read Deployment IR only. */
95
56
  export function createRolldownPluginVmzAdapter(options = {}) {
96
57
  const outDir = options.outDir ?? 'dist';
97
58
  return {
@@ -8,94 +8,62 @@ export declare const CDN_ADAPTER_PROJECTION_SCHEMA = "vmz.cdn.adapter_projection
8
8
  export declare const CACHE_HTML = "public, max-age=0, must-revalidate";
9
9
  export declare const CACHE_ASSET_IMMUTABLE = "public, max-age=31536000, immutable";
10
10
  export declare const CACHE_META = "public, max-age=3600";
11
- /**
12
- * Build CDNPolicyManifest from StaticDeliveryManifest (+ optional redirects / locale artifact).
13
- * Locale-prefixed HTML gets LocaleId-encoded cache keys; Accept-Language must not steal body.
14
- * @param {Record<string, any>} staticManifest
15
- * @param {{
16
- * redirects?: Array<{ from: string, to: string, status?: number, reason?: string }>,
17
- * localeArtifact?: Record<string, any> | null,
18
- * }} [opts]
19
- */
20
- export declare function buildCdnPolicyManifest(staticManifest: any, opts?: {}): {
11
+ export interface CdnRedirect {
12
+ from: string;
13
+ to: string;
14
+ status?: number;
15
+ reason?: string;
16
+ }
17
+ interface BuildCdnPolicyOpts {
18
+ redirects?: CdnRedirect[];
19
+ localeArtifact?: Record<string, unknown> | null;
20
+ }
21
+ export interface CdnPolicyManifest {
21
22
  schema: string;
22
- applicationId: any;
23
+ applicationId: unknown;
23
24
  deliveryProfile: string;
24
25
  origin: string;
25
26
  spaFallback: boolean;
26
- staticManifestDigest: any;
27
- redirects: any[];
28
- headers: ({
27
+ staticManifestDigest: unknown;
28
+ redirects: CdnRedirect[];
29
+ headers: Array<{
29
30
  match: string;
30
- headers: {
31
- 'cache-control': string;
32
- 'x-robots-tag'?: undefined;
33
- };
34
- } | {
35
- match: string;
36
- headers: {
37
- 'cache-control': string;
38
- 'x-robots-tag': string;
39
- };
40
- })[];
41
- errorDocuments: any;
42
- routes: any[];
43
- localeCache: {
44
- strategy: string;
45
- varyAcceptLanguage: boolean;
46
- defaultLocale: any;
47
- routeCount: number;
48
- locales: any[];
49
- };
50
- };
31
+ headers: Record<string, string | undefined>;
32
+ }>;
33
+ errorDocuments: unknown[];
34
+ routes: unknown[];
35
+ localeCache: Record<string, unknown>;
36
+ policyDigest?: string;
37
+ }
38
+ interface EmitCdnPolicyOpts {
39
+ redirects?: CdnRedirect[];
40
+ }
41
+ interface LocalStaticHostOpts {
42
+ host?: string;
43
+ port?: number;
44
+ }
45
+ export declare function buildCdnPolicyManifest(staticManifest: Record<string, unknown>, opts?: BuildCdnPolicyOpts): CdnPolicyManifest;
51
46
  /**
52
47
  * Write CDN policy + adapter projections under dist/_vmz.
53
48
  * @param {string} distDir
54
49
  * @param {Record<string, any>} staticManifest
55
50
  * @param {{ redirects?: Array<{ from: string, to: string, status?: number, reason?: string }> }} [opts]
56
51
  */
57
- export declare function emitCdnPolicy(distDir: any, staticManifest: any, opts?: {}): {
58
- policy: {
59
- schema: string;
60
- applicationId: any;
61
- deliveryProfile: string;
62
- origin: string;
63
- spaFallback: boolean;
64
- staticManifestDigest: any;
65
- redirects: any[];
66
- headers: ({
67
- match: string;
68
- headers: {
69
- 'cache-control': string;
70
- 'x-robots-tag'?: undefined;
71
- };
72
- } | {
73
- match: string;
74
- headers: {
75
- 'cache-control': string;
76
- 'x-robots-tag': string;
77
- };
78
- })[];
79
- errorDocuments: any;
80
- routes: any[];
81
- localeCache: {
82
- strategy: string;
83
- varyAcceptLanguage: boolean;
84
- defaultLocale: any;
85
- routeCount: number;
86
- locales: any[];
87
- };
88
- };
52
+ export declare function emitCdnPolicy(distDir: string, staticManifest: Record<string, unknown>, opts?: EmitCdnPolicyOpts): {
53
+ policy: CdnPolicyManifest;
89
54
  adapters: {
90
55
  'local-static': {
91
56
  schema: string;
92
57
  adapterId: string;
93
- policyDigest: any;
58
+ policyDigest: string;
94
59
  host: string;
95
60
  spaFallback: boolean;
96
- redirects: any;
97
- headers: any;
98
- errorDocuments: any;
61
+ redirects: CdnRedirect[];
62
+ headers: {
63
+ match: string;
64
+ headers: Record<string, string | undefined>;
65
+ }[];
66
+ errorDocuments: unknown[];
99
67
  files: {
100
68
  _headers?: undefined;
101
69
  _redirects?: undefined;
@@ -103,12 +71,15 @@ export declare function emitCdnPolicy(distDir: any, staticManifest: any, opts?:
103
71
  } | {
104
72
  schema: string;
105
73
  adapterId: string;
106
- policyDigest: any;
74
+ policyDigest: string;
107
75
  host: string;
108
76
  spaFallback: boolean;
109
- redirects: any;
110
- headers: any;
111
- errorDocuments: any;
77
+ redirects: CdnRedirect[];
78
+ headers: {
79
+ match: string;
80
+ headers: Record<string, string | undefined>;
81
+ }[];
82
+ errorDocuments: unknown[];
112
83
  files: {
113
84
  _headers: string;
114
85
  _redirects: string;
@@ -117,12 +88,15 @@ export declare function emitCdnPolicy(distDir: any, staticManifest: any, opts?:
117
88
  netlify: {
118
89
  schema: string;
119
90
  adapterId: string;
120
- policyDigest: any;
91
+ policyDigest: string;
121
92
  host: string;
122
93
  spaFallback: boolean;
123
- redirects: any;
124
- headers: any;
125
- errorDocuments: any;
94
+ redirects: CdnRedirect[];
95
+ headers: {
96
+ match: string;
97
+ headers: Record<string, string | undefined>;
98
+ }[];
99
+ errorDocuments: unknown[];
126
100
  files: {
127
101
  _headers?: undefined;
128
102
  _redirects?: undefined;
@@ -130,12 +104,15 @@ export declare function emitCdnPolicy(distDir: any, staticManifest: any, opts?:
130
104
  } | {
131
105
  schema: string;
132
106
  adapterId: string;
133
- policyDigest: any;
107
+ policyDigest: string;
134
108
  host: string;
135
109
  spaFallback: boolean;
136
- redirects: any;
137
- headers: any;
138
- errorDocuments: any;
110
+ redirects: CdnRedirect[];
111
+ headers: {
112
+ match: string;
113
+ headers: Record<string, string | undefined>;
114
+ }[];
115
+ errorDocuments: unknown[];
139
116
  files: {
140
117
  _headers: string;
141
118
  _redirects: string;
@@ -148,15 +125,18 @@ export declare function emitCdnPolicy(distDir: any, staticManifest: any, opts?:
148
125
  * @param {Record<string, any>} policy
149
126
  * @param {'local-static' | 'netlify'} adapterId
150
127
  */
151
- export declare function projectCdnAdapter(policy: any, adapterId: any): {
128
+ export declare function projectCdnAdapter(policy: CdnPolicyManifest, adapterId: 'local-static' | 'netlify'): {
152
129
  schema: string;
153
130
  adapterId: string;
154
- policyDigest: any;
131
+ policyDigest: string;
155
132
  host: string;
156
133
  spaFallback: boolean;
157
- redirects: any;
158
- headers: any;
159
- errorDocuments: any;
134
+ redirects: CdnRedirect[];
135
+ headers: {
136
+ match: string;
137
+ headers: Record<string, string | undefined>;
138
+ }[];
139
+ errorDocuments: unknown[];
160
140
  files: {
161
141
  _headers?: undefined;
162
142
  _redirects?: undefined;
@@ -164,12 +144,15 @@ export declare function projectCdnAdapter(policy: any, adapterId: any): {
164
144
  } | {
165
145
  schema: string;
166
146
  adapterId: string;
167
- policyDigest: any;
147
+ policyDigest: string;
168
148
  host: string;
169
149
  spaFallback: boolean;
170
- redirects: any;
171
- headers: any;
172
- errorDocuments: any;
150
+ redirects: CdnRedirect[];
151
+ headers: {
152
+ match: string;
153
+ headers: Record<string, string | undefined>;
154
+ }[];
155
+ errorDocuments: unknown[];
173
156
  files: {
174
157
  _headers: string;
175
158
  _redirects: string;
@@ -182,7 +165,7 @@ export declare function projectCdnAdapter(policy: any, adapterId: any): {
182
165
  * @param {{ host?: string, port?: number }} [opts]
183
166
  * @returns {Promise<{ host: string, port: number, baseUrl: string, close: () => Promise<void> }>}
184
167
  */
185
- export declare function listenLocalStaticHost(distDir: any, policy: any, opts?: {}): Promise<unknown>;
168
+ export declare function listenLocalStaticHost(distDir: string, policy: Record<string, unknown>, opts?: LocalStaticHostOpts): Promise<unknown>;
186
169
  /**
187
170
  * @param {string} distDir
188
171
  * @param {Record<string, any>} policy
@@ -194,3 +177,4 @@ export declare function createLocalStaticHandler(distDir: any, policy: any): (re
194
177
  * @param {string} pathname
195
178
  */
196
179
  export declare function matchGlob(pattern: any, pathname: any): any;
180
+ export {};