Build checked asynchronous service registries with Nix
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { generatePortableTypeScriptBindings } from "../bindings/portable.js";
|
||||
import { generatePortableTypeScriptBindings, generateRemoteTypeScriptBindings } from "../bindings/portable.js";
|
||||
import { type ExecutionPlan, ExecutionPlanError, hexDigest } from "./plan.js";
|
||||
import { type ArtifactReader, type PackageArtifacts } from "./artifacts.js";
|
||||
import { loadArtifactWorld, type LoadedArtifactWorld } from "./files.js";
|
||||
@@ -53,6 +53,24 @@ export function expectedArtifactReceipt(
|
||||
sources.set(path, bytes);
|
||||
return { target, 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 (
|
||||
manifest.implementations.some(
|
||||
(implementation) =>
|
||||
implementation.compatibility === "quixos-js-module-v1" &&
|
||||
implementation.exports.some((id) =>
|
||||
pkg.exports.some((entry) => entry.id === id && entry.execution.kind === "remote"),
|
||||
),
|
||||
)
|
||||
) {
|
||||
const path = "share/quixos/generated/remote.ts";
|
||||
const bytes = new TextEncoder().encode(
|
||||
generateRemoteTypeScriptBindings(plan.definition.bindingSchema, pkg.revision),
|
||||
);
|
||||
sources.set(path, bytes);
|
||||
generated.push({ target: "server", path, digest: hashBytes(bytes), bytes: bytes.length });
|
||||
}
|
||||
return {
|
||||
receipt: {
|
||||
schemaVersion: 1,
|
||||
|
||||
Reference in New Issue
Block a user