/** * Build-time boundary manifest derivation. * * Scans a project for boundary definition modules (`boundaries.ts` / * `*.boundaries.ts`) and `@quantize` CSS blocks, then derives the * `BoundaryManifest` that `virtual:czap/boundaries` exports and the * `@czap/astro` integration writes to `czap-boundary-manifest.json`: each * boundary's `Boundary.make` content address plus precompiled * `CompiledOutputs` for every (motion x design) tier. * * This is the build half of the edge caching design (ADR-0003): identity * and compilation are derived here, so edge workers consume the manifest * instead of hand-typing boundary ids or bundling the CSS compiler. * * @module */ import type { Boundary } from '@czap/core'; import type { BoundaryManifest, CompiledOutputs } from '@czap/edge'; /** Options for {@link collectBoundaryManifest}. */ export interface CollectBoundaryManifestOptions { /** * Extra directory holding boundary definitions -- mirror of the plugin's * `dirs.boundary` override; scanned in addition to the project walk. */ readonly boundaryDir?: string; /** * Selector the auto-emitted viewport `@container` containment is declared * on (default `:root`) -- mirror of the plugin's `quantize.container`, so * the manifest-served CSS matches the transform layer's containment target. */ readonly container?: string; } /** The set of scannable files (boundary modules + stylesheets) from one project walk. */ export interface ProjectScan { readonly boundaryFiles: readonly string[]; readonly cssFiles: readonly string[]; } /** Project-wide boundary definitions keyed by export name, including their source module path. */ export type BoundaryDefinitionMap = ReadonlyMap; /** * Walk the project once, collecting boundary-definition modules and stylesheets. * Package-internal (not re-exported from the entry): the Vite plugin shares one scan * across the manifest + definitions derivations instead of walking the tree twice. */ export declare function scanProject(projectRoot: string): ProjectScan; /** * Collect boundary definitions over a pre-computed {@link ProjectScan} (shared with the * manifest derivation so the project tree is walked once). Package-internal. */ export declare function collectBoundaryDefinitionsFromScan(projectRoot: string, scan: ProjectScan, options?: Pick): Promise>; /** * Internal helper used by the Vite transform to share the manifest's * project-wide boundary discovery instead of falling back to per-file * convention resolution for `@quantize`. */ export declare function collectBoundaryDefinitions(projectRoot: string, options?: Pick): Promise; /** * Serialize one deduplicated boundary output into the bytes emitted as a static * CSS asset. Theme `:root` CSS is deliberately absent: themes are a * request-time axis and stay inline/tiny, while these assets remain * theme-agnostic and content-hashed. */ export declare function serializeBoundaryOutput(output: CompiledOutputs): string; /** * Derive the `BoundaryManifest` for a project. * * Walks `projectRoot` (skipping `node_modules`, build output, and VCS * directories) for boundary definition modules and `@quantize` CSS * blocks, then emits one entry per exported boundary: its minted * `ContentAddress` and precompiled per-tier outputs (deduplicated -- * `outputs` pools the distinct compiled strings, `outputsByTier` holds * pool indices). Boundaries with no `@quantize` block get an entry with * empty `outputs`/`outputsByTier` -- the id is still the sanctioned way * for hosts to derive cache configuration. * * @example * ```ts * import { collectBoundaryManifest } from '@czap/vite'; * import { resolveOutputsByTier } from '@czap/edge'; * * const manifest = await collectBoundaryManifest('/path/to/app'); * // manifest.viewport.id === 'fnv1a:…' (Boundary.make's address) * // resolveOutputsByTier(manifest.viewport)['transitions:standard'].css * ``` * * @param projectRoot - Absolute path of the project to scan. * @param options - Optional `boundaryDir` override (mirror of `dirs.boundary`). * @returns The derived manifest (empty object when nothing is found). */ export declare function collectBoundaryManifest(projectRoot: string, options?: CollectBoundaryManifestOptions): Promise; /** * {@link collectBoundaryManifest} over a pre-computed {@link ProjectScan}. Lets the Vite * plugin walk the project tree ONCE and share the scan with * {@link collectBoundaryDefinitionsFromScan}, instead of each derivation re-scanning. * Package-internal (not re-exported from the entry). */ export declare function collectBoundaryManifestFromScan(projectRoot: string, scan: ProjectScan, options?: CollectBoundaryManifestOptions): Promise; //# sourceMappingURL=boundary-manifest.d.ts.map