@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/build-assemble.js
CHANGED
|
@@ -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
|
|
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
|
|
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:
|
|
71
|
-
publicRoutes:
|
|
72
|
-
internalCapabilities:
|
|
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:
|
|
73
|
+
digest: serverArtifact.artifactDigest,
|
|
77
74
|
httpContractDigest: server.httpContractDigest,
|
|
78
|
-
schema:
|
|
79
|
-
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:
|
|
90
|
+
digest: siteContract.contractDigest,
|
|
93
91
|
});
|
|
94
92
|
result.siteDelivery = {
|
|
95
|
-
digest:
|
|
96
|
-
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:
|
|
99
|
+
contractDigest: siteContract.contractDigest,
|
|
102
100
|
});
|
|
101
|
+
const packIndex = pack.index;
|
|
103
102
|
result.steps.push({
|
|
104
103
|
kind: 'embedded-packaging',
|
|
105
|
-
digest:
|
|
106
|
-
objectCount:
|
|
104
|
+
digest: packIndex.indexDigest,
|
|
105
|
+
objectCount: packIndex.objectCount,
|
|
107
106
|
});
|
|
108
107
|
result.embeddedPackaging = {
|
|
109
|
-
digest:
|
|
110
|
-
objectCount:
|
|
111
|
-
schema:
|
|
108
|
+
digest: packIndex.indexDigest,
|
|
109
|
+
objectCount: packIndex.objectCount,
|
|
110
|
+
schema: packIndex.schema,
|
|
112
111
|
};
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
|
-
|
|
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
|
|
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 = (
|
|
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 = (
|
|
144
|
-
const packStep = (
|
|
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 = (
|
|
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:
|
|
177
|
-
detail:
|
|
178
|
-
? `pack=${String(
|
|
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:
|
|
186
|
-
assembly:
|
|
187
|
-
selectionDigest:
|
|
188
|
-
packDigest:
|
|
189
|
-
assembleDigest:
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
export declare function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
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:
|
|
60
|
+
options(inputOptions: unknown): unknown;
|
|
63
61
|
};
|
package/dist/bundler-adapter.js
CHANGED
|
@@ -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 {
|
package/dist/cdn-policy.d.ts
CHANGED
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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:
|
|
23
|
+
applicationId: unknown;
|
|
23
24
|
deliveryProfile: string;
|
|
24
25
|
origin: string;
|
|
25
26
|
spaFallback: boolean;
|
|
26
|
-
staticManifestDigest:
|
|
27
|
-
redirects:
|
|
28
|
-
headers:
|
|
27
|
+
staticManifestDigest: unknown;
|
|
28
|
+
redirects: CdnRedirect[];
|
|
29
|
+
headers: Array<{
|
|
29
30
|
match: string;
|
|
30
|
-
headers:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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:
|
|
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:
|
|
58
|
+
policyDigest: string;
|
|
94
59
|
host: string;
|
|
95
60
|
spaFallback: boolean;
|
|
96
|
-
redirects:
|
|
97
|
-
headers:
|
|
98
|
-
|
|
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:
|
|
74
|
+
policyDigest: string;
|
|
107
75
|
host: string;
|
|
108
76
|
spaFallback: boolean;
|
|
109
|
-
redirects:
|
|
110
|
-
headers:
|
|
111
|
-
|
|
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:
|
|
91
|
+
policyDigest: string;
|
|
121
92
|
host: string;
|
|
122
93
|
spaFallback: boolean;
|
|
123
|
-
redirects:
|
|
124
|
-
headers:
|
|
125
|
-
|
|
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:
|
|
107
|
+
policyDigest: string;
|
|
134
108
|
host: string;
|
|
135
109
|
spaFallback: boolean;
|
|
136
|
-
redirects:
|
|
137
|
-
headers:
|
|
138
|
-
|
|
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:
|
|
128
|
+
export declare function projectCdnAdapter(policy: CdnPolicyManifest, adapterId: 'local-static' | 'netlify'): {
|
|
152
129
|
schema: string;
|
|
153
130
|
adapterId: string;
|
|
154
|
-
policyDigest:
|
|
131
|
+
policyDigest: string;
|
|
155
132
|
host: string;
|
|
156
133
|
spaFallback: boolean;
|
|
157
|
-
redirects:
|
|
158
|
-
headers:
|
|
159
|
-
|
|
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:
|
|
147
|
+
policyDigest: string;
|
|
168
148
|
host: string;
|
|
169
149
|
spaFallback: boolean;
|
|
170
|
-
redirects:
|
|
171
|
-
headers:
|
|
172
|
-
|
|
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:
|
|
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 {};
|