everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
93 lines • 5.01 kB
text/typescript
import { Verified } from "../verify/engine.cjs";
import { BuildEntryReport } from "every-plugin/build/artifact-names";
import { SourceRef, WorkspaceVersionManifest } from "every-plugin/version-manifest";
//#region src/services/deploy/version-manifest.d.ts
/** Read a workspace dist's build-report.json (ticket 01's entry-name report). */
declare function readBuildReport(distRoot: string): BuildEntryReport | null;
/**
* Compose the workspace's version manifest from the dist build reports and
* the **server-computed** SRI map of the upload response (MAP decision 6 —
* SRI is authoritative from the storage boundary, never computed
* client-side). Returns null when the dist predates hashed entry names
* (no report, or the SRI map lacks the entry) — the deploy leg then aborts:
* uploaded workspaces must pin.
*/
declare function composeWorkspaceVersionManifest(input: {
report: BuildEntryReport;
ssrReport?: BuildEntryReport | null;
integrityMap: Record<string, string>;
/** full per-file SRI map of the dist — recorded for the next deploy's diff */
files?: Record<string, string>;
/** slot-relative immutable version directory (`versions/<dirId>`, #826) —
* artifact coordinates resolve against it instead of the slot root */
dir?: string;
/** source archive reference (publish.sourcePublish) — server-computed SRI */
source?: SourceRef;
/** the repo HEAD the build was produced from — best-effort, may be absent */
gitSha?: string;
}): WorkspaceVersionManifest | null;
/**
* Version-manifest resolution (atomic-deploys 04): a config remote's
* `pin` ({ manifest, integrity }) resolves to the derived entry-level fields
* every consumer needs. Verification and the process-lifetime
* last-known-good cache live in the verify engine; a fetch or SRI failure
* with nothing cached propagates (a boot-time resolution failure fails the
* deploy, which is the platform's rollback).
*/
interface ResolvedRemoteVersion {
/** The remote's production base (slot root — unprefixed by the version dir). */
base: string;
/** Absolute URL of the content-hashed container entry. */
entryUrl: string;
entryIntegrity: string;
/** Absolute URL of the hashed browser manifest (mf-manifest), when present. */
browserManifestUrl?: string;
/** Absolute URL of the content-hashed SSR entry, when present. */
ssrEntryUrl?: string;
ssrIntegrity?: string;
/** Shared-singleton `name → version` the pinned build embedded (#546) —
* stamped onto UI remotes so the host's composition guard can detect a
* platform skew before loading. */
sharedVersions?: Record<string, string>;
/** Slot-relative immutable version directory the artifact coordinates
* resolve against (`versions/<dirId>`, #826) — undefined on legacy
* manifests, which resolve against the slot root. */
dir?: string;
/** Full per-file digest map of the dist (object path → SRI), when the
* pinned manifest carries one — the diff base for skip-unchanged uploads. */
files?: Record<string, string>;
/** Source archive reference from the pinned manifest (publish.sourcePublish). */
source?: SourceRef;
}
interface RemoteDigest {
/** versioned manifest filename, relative to the remote's production base */
manifest: string;
/** the manifest document's own SRI */
integrity: string;
}
declare function clearRemoteVersionCache(): void;
/** Every artifact URL the resolved pin attests, keyed by the URL the runtime
* actually fetches (the resolved hashed entry, the ssr entry, and each file
* in the pin's files map) → its SRI. Integrity-in-pipeline keying: register
* these and the loader verifies bytes at fetch time (#642's fork class —
* fixed-name keying beside hashed fetches — cannot reconstruct this map). */
declare function resolvedIntegrityMap(r: ResolvedRemoteVersion): Record<string, string>;
/**
* The container manifest document a pinned boot registers (#874): the pin's
* hashed browser manifest copy when the build emitted one — immutable in both
* the CDN layout and the staged flat layout — else the fixed name under the
* pin's immutable version directory (#826; CDN only — staged dists are flat
* on disk), else the fixed name at the slot root. The last tier is the
* legacy/dev shape, and the tier the #874 incident rode: reading the fixed
* name at the mutable slot root lets a later root publish move bytes the
* child's pin never named.
*/
declare function pinnedManifestDocumentUrl(fallbackUrl: string, resolved: Pick<ResolvedRemoteVersion, "base" | "dir" | "browserManifestUrl">): string;
declare function resolveRemoteVersion(input: {
base: string;
digest: RemoteDigest;
fetchImpl?: typeof fetch;
}): Promise<Verified<ResolvedRemoteVersion>>;
//#endregion
export { RemoteDigest, ResolvedRemoteVersion, clearRemoteVersionCache, composeWorkspaceVersionManifest, pinnedManifestDocumentUrl, readBuildReport, resolveRemoteVersion, resolvedIntegrityMap };
//# sourceMappingURL=version-manifest.d.cts.map