API / @aihu/tsc

@aihu/tsc

Compiler & tooling

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.

version
0.2.4
exports
9
values
6
types
3
01

buildMappings

functionagent
function buildMappings(source: string, generated: string): CodeMapping[]

Map the generated surface back onto the source, line by line.

02

createAihuLanguagePlugin

function
function createAihuLanguagePlugin<T = string>( tsModule: typeof ts, options?: AihuLanguagePluginOptions, ): LanguagePlugin<T, AihuVirtualCode>
03

getUncompilableFiles

function
function getUncompilableFiles(): ReadonlySet<string>
04

keepDiagnosticCode

function
function keepDiagnosticCode( code: number | string | undefined, fileName: string | undefined, strictTemplates: boolean, ): boolean

The 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.

05

run

function
function run(options: RunOptions = {}): number
06

IMPLICIT_ANY_CODES

const
const IMPLICIT_ANY_CODES

Implicit-`any` diagnostics, suppressed for `.aihu` files only.

07

AihuLanguagePluginOptions

interface
interface 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
}
08

AihuVirtualCode

interface
interface AihuVirtualCode extends VirtualCode {
  id: 'main'
  languageId: 'typescript'
}
09

RunOptions

interface
interface 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
}