aihu-tsc — `tsc` for projects containing .aihu Single File Components. Type-checks .aihu sources as virtual TypeScript, with no .aihu.ts files written to disk.
buildMappingsfunction buildMappings(source: string, generated: string): CodeMapping[]Map the generated surface back onto the source, line by line.
createAihuLanguagePluginfunction createAihuLanguagePlugin<T = string>( tsModule: typeof ts, options?: AihuLanguagePluginOptions, ): LanguagePlugin<T, AihuVirtualCode>getUncompilableFilesfunction getUncompilableFiles(): ReadonlySet<string>keepDiagnosticCodefunction keepDiagnosticCode( code: number | string | undefined, fileName: string | undefined, strictTemplates: boolean, ): booleanThe one diagnostic-suppression policy, shared with the language server (step 5): an editor squiggle and a CI failure must apply the SAME filter, or the split-brain this unification removes would creep back in as editor-only implicit-any noise.
loadTscProjectConfigasync function loadTscProjectConfig( root: string, ): Promise<{ target?: 'client' | 'server' | 'universal'; strictTemplates?: boolean }>Load `{ target, strictTemplates }` from `root`'s `vite.config.ts`.
runfunction run(options: RunOptions = {}): numberIMPLICIT_ANY_CODESconst IMPLICIT_ANY_CODESImplicit-`any` diagnostics, suppressed for `.aihu` files only.
AihuLanguagePluginOptionsinterface AihuLanguagePluginOptions {
/**
* #486 step 4 — switch the sidecar's attribute/component-prop type layer on
* (`aihu-tsc --strict-templates`). Default off: the virtual code is
* byte-identical to the pre-#486 surface.
*/
strictTemplates?: boolean
/**
* Build target threaded to `compileSidecar` (`--target`) — see its own doc
* comment in `@aihu/compiler` for why this affects type-check accuracy.
* Sourced from the project's `vite.config.ts` (`AihuConfig.compiler.target`)
* by `run()`/the language server's project-config loader; a caller with no
* config to read leaves this unset and gets the binary's own default
* (`universal`).
*/
target?: 'client' | 'server' | 'universal'
}AihuVirtualCodeinterface AihuVirtualCode extends VirtualCode {
id: 'main'
languageId: 'typescript'
}RunOptionsinterface RunOptions {
/** Path to a tsconfig.json, or a directory containing one. Defaults to cwd. */
project?: string
/** Report implicit-`any` inside .aihu files too. */
strictTemplates?: boolean
cwd?: string
/**
* Build target threaded to `compileSidecar` (`--target`) — sourced from the
* project's `vite.config.ts` (`AihuConfig.compiler.target`) by the CLI
* entry (`bin/aihu-tsc.mjs`) via `loadTscProjectConfig()`, since `run()`
* itself is synchronous. See `compileSidecar`'s doc comment in
* `@aihu/compiler` for why this affects type-check accuracy.
*/
target?: 'client' | 'server' | 'universal'
}