Build checked component artifacts and shared React session SDK (WI-09)
This commit is contained in:
@@ -3,6 +3,7 @@ import { generatePortableTypeScriptBindings, generateRemoteTypeScriptBindings }
|
||||
import { type ExecutionPlan, ExecutionPlanError, hexDigest } from "./plan.js";
|
||||
import { type ArtifactReader, type PackageArtifacts } from "./artifacts.js";
|
||||
import { loadArtifactWorld, type LoadedArtifactWorld } from "./files.js";
|
||||
import { generateComponentClientBindings, componentAssetDeclarations } from "./client-contracts.js";
|
||||
|
||||
export interface ArtifactReceipt {
|
||||
schemaVersion: 1;
|
||||
@@ -57,6 +58,16 @@ export function expectedArtifactReceipt(
|
||||
sources.set(path, bytes);
|
||||
return { target, path, digest: hashBytes(bytes), bytes: bytes.length };
|
||||
});
|
||||
if (manifest.components?.length) {
|
||||
for (const [path, source] of [
|
||||
["share/quixos/generated/client.ts", generateComponentClientBindings(plan, pkg.revision)],
|
||||
["share/quixos/generated/component-assets.d.ts", componentAssetDeclarations()],
|
||||
] as const) {
|
||||
const bytes = new TextEncoder().encode(source);
|
||||
sources.set(path, bytes);
|
||||
generated.push({ target: "window", path, digest: hashBytes(bytes), bytes: bytes.length });
|
||||
}
|
||||
}
|
||||
// Custom language services need no TypeScript adapter. A checked JS module
|
||||
// exporting remote handlers does, and must carry the exact generated source.
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user