ManifestJson

manifest.json is the manifest file generated by the Esmx framework during the build process, used to record build artifact information. It provides a unified interface to manage build artifacts, export files, and resource statistics.

Type Definition

ManifestJson

interface ManifestJson {
  protocol: number;
  name: string;
  version: string;
  provides: Record<string, ManifestJsonProvide>;
  uses: string[];
  scopes: Record<string, Record<string, string>>;
  exports: ManifestJsonExports;
  files: string[];
  chunks: ManifestJsonChunks;
  integrity?: Record<string, string>;
}

protocol

  • Type: number
  • Description: Manifest protocol version (RFC 0001 §5), currently 2. Absent in pre-v2 manifests; readers treat absence as protocol 1 and skip v2-only checks. The linker rejects manifests whose protocol is higher than the supported version.

name

  • Type: string
  • Description: Module name, sourced from the module configuration

version

  • Type: string
  • Description: Module version, transcribed from the module's package.json at build time (RFC 0001 §5). Pre-v2 manifests default to '0.0.0' at read time.

provides

  • Type: Record<string, ManifestJsonProvide>
  • Description: Resolved versions for every pkg-export (pkg: true) package, captured at build time (RFC 0001 §5). Keys are package specifiers; values record the resolved installed version.

uses

  • Type: string[]
  • Description: Consumption edges transcribed from the module's package.json esmx.uses declaration (RFC 0001 §5). Pre-v2 manifests default to [] at read time.

scopes

  • Type: Record<string, Record<string, string>>
  • Description: ImportMap scope mapping, where keys are scope prefixes and values are specifier -> resolved mappings for runtime path-based dependency resolution

exports

  • Type: ManifestJsonExports
  • Description: Export configuration mapping, where keys are export paths and values are export item information

files

  • Type: string[]
  • Description: Complete list of build output files, containing all generated file paths

chunks

  • Type: ManifestJsonChunks
  • Description: Compiled file information mapping, where keys are source files and values are compilation details

integrity

  • Type: Record<string, string>
  • Description: Subresource Integrity (SRI) hashes for build output files, where keys are relative file paths and values are sha384- integrity strings. Only generated in production builds to avoid development overhead. Consumed by RenderContext.modulePreload() and injected into the client import map.

ManifestJsonExports

type ManifestJsonExports = Record<string, ManifestJsonExport>;

An export item configuration mapping, where the key is the export path and the value is the export item information.

ManifestJsonProvide

interface ManifestJsonProvide {
  version: string;
}

Build-time facts about one provided (pkg-export) package (RFC 0001 §5).

version

  • Type: string
  • Description: The resolved installed version of the provided package at build time, read from node_modules/<pkg>/package.json relative to the module root. Subpath specifiers (e.g. vue/jsx-runtime) resolve via their parent package. '0.0.0' when the package could not be resolved.

ManifestJsonExport

interface ManifestJsonExport {
  name: string;
  pkg: boolean;
  file: string;
  identifier: string;
}

name

  • Type: string
  • Description: Export item name

pkg

  • Type: boolean
  • Description: Whether it is a package

file

  • Type: string
  • Description: File path corresponding to the export item

identifier

  • Type: string
  • Description: Unique identifier of the export item

ManifestJsonChunks

type ManifestJsonChunks = Record<string, ManifestJsonChunk>;

A compiled file information mapping, where the key is the source file and the value is the compilation information.

ManifestJsonChunk

interface ManifestJsonChunk {
  name: string;
  js: string;
  css: string[];
  resources: string[];
}

name

  • Type: string
  • Description: Identifier of the current source file

js

  • Type: string
  • Description: JS file path after the current source file compilation

css

  • Type: string[]
  • Description: List of CSS file paths associated with the current source file

resources

  • Type: string[]
  • Description: List of other resource file paths associated with the current source file