Confine checked artifact loading and browser asset lookup
This commit is contained in:
@@ -15,48 +15,7 @@ import {
|
||||
type ArtifactImplementation,
|
||||
} from "../src/execution-world/index.js";
|
||||
|
||||
const buildFixture = (plan: ExecutionPlan) => {
|
||||
const expected = plan.definition.packages[0]!;
|
||||
const bytes = new TextEncoder().encode("export const handlers = Object.freeze({});\n");
|
||||
const implementation = (
|
||||
id: string,
|
||||
target: string,
|
||||
compatibility: ArtifactImplementation["compatibility"],
|
||||
): ArtifactImplementation => {
|
||||
const path = compatibility === "quixos-service-v1" ? "bin/service" : `portable/${target}/module.mjs`;
|
||||
const value = {
|
||||
id,
|
||||
target,
|
||||
compatibility,
|
||||
path,
|
||||
ports: "quixos-transaction-ports-v1" as const,
|
||||
...(compatibility === "quixos-js-module-v1" ? { registryExport: "handlers" } : {}),
|
||||
exports: expected.exports.map((e) => e.id),
|
||||
files: [
|
||||
{
|
||||
path,
|
||||
digest: createHash("sha256").update(bytes).digest("hex"),
|
||||
bytes: bytes.length,
|
||||
mediaType: compatibility === "quixos-service-v1" ? "application/octet-stream" : "text/javascript",
|
||||
},
|
||||
],
|
||||
};
|
||||
return { ...value, contentDigest: implementationDigest(value) };
|
||||
};
|
||||
const manifest: PackageArtifacts = {
|
||||
schemaVersion: 1,
|
||||
packageRevisionId: expected.revision,
|
||||
bindingDigest: expected.bindingDigest,
|
||||
sourceDigest: expected.sourceDigest,
|
||||
versions: plan.definition.versions,
|
||||
implementations: [
|
||||
implementation("service", "server", "quixos-service-v1"),
|
||||
implementation("server", "server", "quixos-js-module-v1"),
|
||||
implementation("browser", "browser", "quixos-js-module-v1"),
|
||||
],
|
||||
};
|
||||
return { manifest, bytes, read: async () => bytes };
|
||||
};
|
||||
import { buildArtifactFixture as buildFixture } from "./artifact-fixture.js";
|
||||
const resign = (implementation: ArtifactImplementation) => {
|
||||
const { contentDigest, ...body } = implementation;
|
||||
implementation.contentDigest = implementationDigest(body);
|
||||
|
||||
Reference in New Issue
Block a user