/** * Virtual module resolution and loading for czap design primitives. * * Handles Vite's `resolveId` and `load` for virtual module specifiers * that provide runtime access to token, boundary, and theme * definitions. * * Virtual IDs: * * - `virtual:czap/tokens` -- JS exports of token definitions (from * `collectTokenManifest`); degrades to an empty-object stub outside the * plugin. * - `virtual:czap/tokens.css` -- CSS custom properties compiled from all * collected tokens (`compileCollectedTokensCss`); degrades to `:root {}` * outside the plugin. * - `virtual:czap/boundaries` -- the build-derived boundary manifest * (`{ [name]: { id, outputs, outputsByTier } }`); the plugin supplies the * manifest collected by `collectBoundaryManifest`, and the module * degrades to an empty-object stub only when loaded outside the * plugin (e.g. by a bare type-checker pass). * - `virtual:czap/themes` -- JS exports of theme definitions (from * `collectThemeManifest`); degrades to an empty-object stub outside the * plugin. * - `virtual:czap/hmr-client` -- Client-side HMR handler for * `czap:update` events. * - `virtual:czap/wasm-url` -- Resolved WASM runtime URL (or `null`). * - `virtual:czap/config` -- Typed handle for the workspace * `czap.config.ts` hub. * * @module */ import type { BoundaryManifest } from '@czap/edge'; import { type ThemeManifest, type TokenManifest } from './token-manifest.js'; declare const VIRTUAL_IDS: readonly ["virtual:czap/tokens", "virtual:czap/tokens.css", "virtual:czap/boundaries", "virtual:czap/themes", "virtual:czap/hmr-client", "virtual:czap/wasm-url", "virtual:czap/config"]; /** Recognised virtual module specifiers. */ export type VirtualModuleId = (typeof VIRTUAL_IDS)[number]; /** * Resolve a virtual module ID to its internal null-byte-prefixed form * (as expected by Vite's module graph). Returns `undefined` when `id` * is not a recognised czap virtual module. */ export declare function resolveVirtualId(id: string): string | undefined; /** * Return `true` when `id` is a fully-resolved czap virtual module * (null-byte-prefixed). Callers use this to gate `load` handler * dispatch. */ export declare function isVirtualId(id: string): boolean; /** * Optional dynamic data threaded from the plugin into * {@link loadVirtualModule} for virtual modules whose content is derived * at build time rather than stubbed. */ export interface VirtualModuleData { /** Boundary manifest for `virtual:czap/boundaries` (from `collectBoundaryManifest`). */ readonly boundaries?: BoundaryManifest; /** Public asset URLs per boundary output-pool index. */ readonly boundaryAssetUrls?: BoundaryAssetUrlMap; /** Token manifest for `virtual:czap/tokens` and `virtual:czap/tokens.css`. */ readonly tokens?: TokenManifest; /** Theme manifest for `virtual:czap/themes`. */ readonly themes?: ThemeManifest; } /** Public asset URLs keyed by boundary export name and output-pool index. */ export type BoundaryAssetUrlMap = Readonly>>>; /** * Return the source for a resolved virtual module ID. * * `virtual:czap/boundaries` exports the build-derived boundary manifest * when the plugin passes one via `data.boundaries`; without data it * degrades to an empty-object stub (valid JS for type-checkers and * bundlers running outside the plugin). * * Token and theme virtual modules export build-collected definitions when * the plugin passes manifest data; without data they degrade to empty stubs * (valid for type-checkers and bundlers running outside the plugin). * * The `hmr-client` module is the client-side HMR handler that the * plugin injects into the page via `transformIndexHtml`. */ export declare function loadVirtualModule(id: string, data?: VirtualModuleData): string | undefined; export {}; //# sourceMappingURL=virtual-modules.d.ts.map