Import
import {
clearCachedReleaseAssetManifests,
clearReleaseAssetManifestCache,
contentTypeForExtension,
getReadyManifestForRender,
getReadyManifestForRenderAsync,
hasImmutableReleaseAssetDependencies,
} from "veryfront/release-assets";
Examples
Validate an API response before consuming its manifest body.
import { parseReadyReleaseAssetManifestResponse } from "veryfront/release-assets";
const expectedReleaseId = "release-123";
const response = await fetch("/api/releases/current/asset-manifest");
const ready = parseReadyReleaseAssetManifestResponse(
await response.json(),
expectedReleaseId,
);
if (!ready) throw new Error("Invalid release asset manifest response");
const manifest = ready.manifest;
Build an immutable URL for a published JavaScript asset
import { releaseAssetUrl } from "veryfront/release-assets";
const url = releaseAssetUrl("a".repeat(64), "js");
Exports
Components
| Name | Description | Source |
|---|---|---|
RELEASE_ASSET_BASE_PATH | Public asset base path served on the project’s own domain (proxy-owned). | source |
RELEASE_ASSET_CONTENT_TYPE_ALLOWLIST | Allowlist of accepted content types (upstream + upload validation). | source |
RELEASE_ASSET_CONTENT_TYPES | Content types permitted for release assets. | source |
RELEASE_ASSET_DEPENDENCY_IMPORT_MAP_ENV_FLAG | Env flag that enables manifest dependency import-map rewrites (default OFF). | source |
RELEASE_ASSET_IMMUTABLE_MAX_AGE_SECONDS | Immutable cache max-age in seconds (1 year). | source |
RELEASE_ASSET_MANIFEST_ENV_FLAG | Env flag that enables HTML manifest consumption in production (default OFF). | source |
RELEASE_ASSET_MANIFEST_LIMITS | Work and memory bounds enforced by every manifest producer and consumer. | source |
RELEASE_ASSET_MANIFEST_SCHEMA_VERSION | Current manifest body schema version. | source |
RELEASE_ASSET_MAX_PENDING_BYTES | Maximum aggregate bytes retained while preparing one asset generation. | source |
RELEASE_ASSET_MAX_SIZE_BYTES | Maximum size (bytes) for a single uploaded asset (10 MB). | source |
RELEASE_ASSET_UPLOAD_CONCURRENCY | Bounded upload concurrency when posting assets during a build. | source |
RELEASE_MODULE_RUNTIME_VERSION_PARAM | Query param that scopes fallback module URLs to the Veryfront runtime build. | source |
RELEASE_MODULE_VERSION_PARAM | Query param that scopes fallback module URLs to an immutable release. | source |
Functions
| Name | Description | Source |
|---|---|---|
clearCachedReleaseAssetManifests | Clear cached manifest bodies while keeping registered fetchers intact. | source |
clearReleaseAssetManifestCache | Clear the cache and fetcher registry (tests / adapter teardown). | source |
contentTypeForExtension | Resolve the content type for an extension, or null if not allowed. | source |
getReadyManifestForRender | Return a ready manifest for releaseId if one is cached, else null. | source |
getReadyManifestForRenderAsync | Await a ready manifest for releaseId. | source |
hasImmutableReleaseAssetDependencies | True only when manifest dependency entries are safe immutable rewrite targets. | source |
isAllowedReleaseAssetContentType | True when the value is a valid allowlisted release asset content type. | source |
isReleaseAssetManifestEnabled | True when production manifest consumption is enabled via env flag. | source |
isValidContentHash | Validate a content hash is exactly 64 lowercase hex characters. | source |
normalizeManifestModuleKey | Normalize a logical module path to the manifest’s key convention. | source |
parseReadyReleaseAssetManifestResponse | Parse an untrusted ready response without executing accessors. | source |
parseReleaseAssetManifest | Parse an untrusted manifest without requiring a registered schema extension. | source |
registerManifestFetcherForRelease | Register a project-scoped manifest fetcher for the given releaseId. | source |
releaseAssetUrl | Map a 64-hex content hash + extension to its public asset URL. | source |
resolveManifestModuleUrl | Resolve a module URL through the manifest. | source |
resolveManifestRoutePreloadUrls | Resolve the route closure module URLs for preload hints from the manifest. | source |
routeForPage | Derive a route path from a page module logical path. | source |
unregisterManifestFetcherForRelease | Remove the manifest fetcher for the given releaseId. | source |
Types
| Name | Description | Source |
|---|---|---|
ImmutableReleaseAssetManifest | Manifest whose dependency entries name uploaded content-addressed assets. | source |
ReadyManifestReadOptions | Controls revalidation behavior for awaited manifest reads. | source |
ReadyReleaseAssetManifestResponse | Strict ready response with a generation-matched validated manifest body. | source |
ReleaseAssetContentType | MIME types accepted for immutable release asset uploads and responses. | source |
ReleaseAssetCssEntry | Content-addressed CSS entry. | source |
ReleaseAssetDependencyMode | Capability represented by entries in the manifest dependency map. | source |
ReleaseAssetEntry | Content-addressed JavaScript module entry. | source |
ReleaseAssetExtension | File extensions supported by the immutable release asset endpoint. | source |
ReleaseAssetManifest | Validated, immutable release asset manifest v2 body. | source |
ReleaseAssetManifestFetchContext | Cancellation context passed to a release-scoped manifest fetcher. | source |
ReleaseAssetManifestFetcher | Fetcher used to retrieve a manifest for a release. Registered per-releaseId by the runtime adapter that owns that release, so the correct project-scoped token is always used. Returns null when the manifest is unavailable. | source |
ReleaseAssetManifestFetcherCleanup | Idempotent cleanup for one fetcher registration. | source |
ReleaseAssetManifestResponse | Response shape for the GET asset-manifest endpoint. | source |
ReleaseAssetManifestState | Manifest lifecycle states (DB-owned; mirrored here for runtime checks). | source |
ReleaseAssetRouteEntry | Per-route module and CSS closure. | source |
Constants
| Name | Description | Source |
|---|---|---|
getReleaseAssetManifestSchema | Extension-backed validator for the strict release asset manifest v2 body. | source |