import { BatchModuleResolver, WeslJsPlugin } from "wesl"; //#region ../wesl-tooling/src/LoadWeslToml.d.ts /** Configuration from wesl.toml */ interface WeslToml { /** WESL edition (e.g. "unstable_2025") */ edition: string; /** glob patterns to find .wesl/.wgsl files. Relative to the toml directory. */ include: string[]; /** base directory for wesl files. Relative to the toml directory. */ root: string; /** glob patterns to exclude directories. */ exclude?: string[]; /** package manager ("npm" or "cargo") */ "package-manager"?: string; /** names of directly referenced wesl shader packages (e.g. npm package names), or "auto" for auto-detection */ dependencies?: string[] | string; } /** Information about the loaded wesl.toml file and its location */ interface WeslTomlInfo { /** The path to the toml file, relative to the cwd, undefined if no toml file */ tomlFile: string | undefined; /** The absolute path to the directory that contains the toml. * Paths inside the toml are relative to this. */ tomlDir: string; /** The wesl root, relative to the projectDir. * This lets loadModules do `path.resolve(projectDir, resolvedRoot)` */ resolvedRoot: string; /** The underlying toml file */ toml: WeslToml; } //#endregion //#region src/PluginExtension.d.ts /** function type required for emit extensions */ type ExtensionEmitFn = (/** absolute path to the shader to which the extension is attached */ shaderPath: string, /** support functions available to plugin extensions */ pluginApi: PluginExtensionApi, /** static conditions specified on the js import */ conditions?: Record, /** plugin-level options from query params (e.g., { include: "all" }) */ options?: Record) => Promise; /** an extension that runs inside the wesl-js build plugin */ interface PluginExtension extends WeslJsPlugin { /** javascript imports with this suffix will trigger the plugin */ extensionName: string; /** generate javascript text for js/ts importers to use. * e.g. import myPluginJs from "./foo.wesl?myPlugin"; */ emitFn: ExtensionEmitFn; } interface ProjectSources { weslSrc: Record; dependencies: string[]; } /** api supplied to plugin extensions */ interface PluginExtensionApi { weslToml: () => Promise; weslSrc: () => Promise>; weslRegistry: () => Promise; weslMain: (baseId: string) => Promise; weslDependencies: () => Promise; /** weslRoot relative to tomlDir, with forward slashes. */ debugWeslRoot: () => Promise; /** Get weslSrc scoped to modules reachable from a root, plus their deps. */ scopedProject: (rootModuleName: string) => Promise; /** Fetch project sources, either all or scoped to reachable modules. */ fetchProject: (rootModuleName: string, options?: Record) => Promise; } //#endregion export { ProjectSources as i, PluginExtension as n, PluginExtensionApi as r, ExtensionEmitFn as t };