/** * Node-only Vite integration for Three Blocks applications. * * Before changing the Three transforms, receipts, or overlay wiring, read * docs/maintenance/shader-precompile-system.md and * docs/maintenance/three-webgpu-release-compatibility.md. * * Browser and worker modules consume `three-blocks/vite/config`, which this plugin * resolves in memory. Nothing from this file is included in those bundles. */ import type { Plugin } from 'vite'; import type { TextConfiguration } from '../text-runtime/index.js'; import { type ThreeBlocksBuildReceipt, type ThreeBlocksClientConfig, type ThreeBlocksRendererReceipt, type ThreeBlocksShaderSceneBuildConfig, type ThreeBlocksShaderState, type ThreeBlocksTextState } from './types.js'; export { THREE_BLOCKS_VITE_SCHEMA_VERSION, type ThreeBlocksAssetBuildConfig, type ThreeBlocksAssetReceipt, type ThreeBlocksBuildReceipt, type ThreeBlocksClientConfig, type ThreeBlocksCodecRuntimeConfig, type ThreeBlocksDracoRuntime, type ThreeBlocksKtx2Runtime, type ThreeBlocksMeshoptDecoder, type ThreeBlocksMeshoptRuntime, type ThreeBlocksRendererReceipt, type ThreeBlocksShaderBuildConfig, type ThreeBlocksShaderCaptureBuildConfig, type ThreeBlocksShaderReceipt, type ThreeBlocksShaderSceneBuildConfig, type ThreeBlocksShaderState, type ThreeBlocksShaderTiming, type ThreeBlocksShaderVerification, type ThreeBlocksStatsBuildConfig, type ThreeBlocksTextBuildConfig, type ThreeBlocksTextReceipt, type ThreeBlocksTextState, type ThreeBlocksViteCommand, } from './types.js'; export { inspectThreeBlocksProject, type InspectThreeBlocksProjectOptions, type ThreeBlocksProjectInspection, type ThreeBlocksShaderInspection, type ThreeBlocksTextInspection, } from './inspection.js'; export { ThreeBlocksViteError, type ThreeBlocksViteErrorCode } from './errors.js'; export { THREE_BLOCKS_SUPPORTED_THREE_RANGE, THREE_BLOCKS_THREE_CAPTURE_TRANSFORM_VERSION, THREE_BLOCKS_THREE_CODEC_TRANSFORM_VERSION, THREE_BLOCKS_THREE_HOOK_TRANSFORM_VERSION, THREE_BLOCKS_THREE_R186_HOOK_TRANSFORM_VERSION, isSupportedThreeVersion, shimKtx2WorkerBodyForTests, transformThreeCodecLoaderUrls, transformThreeCoreShaderInputs, transformThreeWebgpuCaptureInstrumentation, transformThreeWebgpuProviderHooks, type ThreeCaptureInstrumentationResult, type ThreeCodecLoaderTransformResult, type ThreeProviderHookTransformResult, } from './three-patch/index.js'; export declare const THREE_BLOCKS_CLIENT_CONFIG_ID: "three-blocks/vite/config"; export interface ThreeBlocksCodecOptions { /** Emit and serve the glTF Draco decoder. Defaults to true. */ readonly draco?: boolean; /** Emit and serve the Basis/KTX2 transcoder. Defaults to true. */ readonly ktx2?: boolean; /** Expose the Meshopt decoder through a lazy Three.js module import. Defaults to true. */ readonly meshopt?: boolean; /** Relative output directory. Defaults to `_three-blocks/codecs`. */ readonly outputDirectory?: string; } export interface ThreeBlocksStatsOptions { /** Defaults to true for the development server. */ readonly development?: boolean; /** Defaults to false for production builds. */ readonly production?: boolean; } export interface ThreeBlocksRendererOptions { /** Rendering execution owner. Inferred as worker for scaffolds and page otherwise. */ readonly owner?: ThreeBlocksRendererReceipt['owner']; } export interface ThreeBlocksShaderRefreshResult { readonly state: ThreeBlocksShaderState; readonly pipelines?: number; readonly changed?: readonly string[]; readonly scenes?: Readonly>; } export interface ThreeBlocksShaderOptions { /** @deprecated The plugin now inspects project shader metadata directly. */ readonly state?: ThreeBlocksShaderState; /** Fail a production build unless the manifest is fresh. */ readonly strict?: boolean; /** * `'build'` (the default wherever `@three-blocks/devtools` is installed) captures the built * bundle natively in Node when `vite build` closes and writes * `/three-blocks/shaders/..json`, whenever no fresh committed * capture exists. A build host without a GPU adapter ships a live-compiling output, and * `strict` fails the build instead. `false` keeps the manifests committed source only. */ readonly capture?: 'build' | false; /** @deprecated The plugin now derives pipeline coverage from committed artifacts. */ readonly pipelines?: number; /** @deprecated The plugin now derives changed inputs from the semantic input closure. */ readonly changed?: readonly string[]; /** @deprecated The plugin now derives the scene matrix from project shader metadata. */ readonly scenes?: Readonly>; /** * @deprecated The plugin now re-inspects project shader metadata on relevant * file changes. Kept temporarily for existing integrations. */ readonly refresh?: () => Promise; } export interface ThreeBlocksTextOptions { readonly enabled?: boolean; /** Static public text configuration used for no-GPU coverage and checksum inspection. */ readonly configuration?: TextConfiguration; /** Result from the public text artifact inspection. */ readonly state?: Exclude; readonly atlases?: number; readonly glyphs?: number; /** * Missing-glyph command used by the development server. Defaults to * `three-blocks text generate`; false disables automatic generation. */ readonly generate?: false | { readonly command?: string; readonly args?: readonly string[]; }; } export interface ThreeBlocksReceiptOptions { /** Print the final receipt after a successful production bundle. Defaults to true. */ readonly print?: boolean; /** Receive the same stable state printed in the terminal. */ readonly onBuild?: (receipt: ThreeBlocksBuildReceipt) => void; } export type ThreeBlocksOverlayPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'; export interface ThreeBlocksOverlayOptions { /** Screen corner for the Logo chip. Defaults to `bottom-left`. */ readonly position?: ThreeBlocksOverlayPosition; /** * Keep the overlay in production builds, in showcase mode (no * development-only HMR guidance). Off by default — intended for published * demos and showcases, not end-user applications. */ readonly production?: boolean; } export interface ThreeBlocksViteOptions { readonly codecs?: false | ThreeBlocksCodecOptions; readonly stats?: boolean | ThreeBlocksStatsOptions; /** Rendering execution owner used by receipts, the overlay, and worker HMR. */ readonly renderer?: ThreeBlocksRendererOptions; /** Shader inspection/precompile integration. False keeps adopted plain Three.js projects neutral. */ readonly shaders?: false | ThreeBlocksShaderOptions; readonly text?: boolean | ThreeBlocksTextOptions; readonly receipt?: ThreeBlocksReceiptOptions; /** * The in-page dev overlay (Logo chip → live status panel). Development * server by default; `overlay.production` opts a build into the same * surface for demos and showcases. `?tbOverlay=0` disables it per page. * Defaults to enabled in development only. */ readonly overlay?: boolean | ThreeBlocksOverlayOptions; } export interface ThreeBlocksVitePluginApi { readonly getClientConfig: () => ThreeBlocksClientConfig | undefined; readonly getBuildReceipt: () => ThreeBlocksBuildReceipt | undefined; } export type ThreeBlocksVitePlugin = Plugin & { readonly api: ThreeBlocksVitePluginApi; }; /** Format the human receipt from the same state exposed to automation. */ export declare function formatThreeBlocksBuildReceipt(receipt: ThreeBlocksBuildReceipt): string; /** * Configure Vite for a single Three.js instance, worker ESM, stable TSL names, runtime * codec delivery, and typed compile-time application state. */ export declare function threeBlocks(options?: ThreeBlocksViteOptions): ThreeBlocksVitePlugin; export default threeBlocks;