/** * One JSX attribute as it appears on a candidate `` element. * * Discriminated on `kind`: a `'spread'` attribute (`{...rest}`) has no * name; a `'named'` attribute has one. Encoding the distinction in the * type prevents the "name is null when isSpread is true" coupling from * silently drifting. */ export type CandidateAttribute = { kind: 'named'; /** Attribute identifier (e.g. `'schema'`, `'onSubmit'`). */ name: string; /** Byte range of the entire attribute, inclusive of name + value. */ range: { start: number; end: number; }; /** Raw source slice for this attribute (used to preserve formatting). */ source: string; } | { kind: 'spread'; range: { start: number; end: number; }; source: string; }; export interface CandidateSite { /** * Byte range of the *opening tag* (e.g. `` or * `` for self-closing). The closing tag (if any) is * tracked separately. */ openingRange: { start: number; end: number; }; /** Byte range of the closing tag, or null for self-closing elements. */ closingRange: { start: number; end: number; } | null; /** Source location of the opening tag, for diagnostics (1-indexed line). */ loc: { line: number; column: number; }; /** True iff the element is ``. */ selfClosing: boolean; /** All attributes in source order, including the `schema` attribute. */ attributes: CandidateAttribute[]; /** The identifier name from `schema={identifier}`. */ schemaIdentifier: string; /** Children source slice (between opening and closing tags), or '' if self-closing. */ childrenSource: string; } export interface ScanResult { /** Candidate sites that may be transformable. resolveSchema validates them. */ candidates: CandidateSite[]; /** Sites that matched `` but failed an early structural check. */ skipped: SkippedSite[]; } export interface SkippedSite { loc: { line: number; column: number; }; reason: string; } /** * Scan a source string for `` JSX elements. Returns candidates * for further validation by `resolveSchema` plus an array of sites that * structurally don't qualify (and thus need a DEBUG diagnostic). * * Returns `null` (a discriminator distinct from "scanned and found * nothing") when the substring fast-path filtered the file out — the * caller can short-circuit before allocating anything else. * * On a Babel parse failure, returns a `ScanResult` with zero candidates * and a single skip diagnostic naming the parser error so it surfaces * in the buildEnd summary. We deliberately don't propagate the parse * error — Vite's main pipeline will report the user's syntax problem * elsewhere with better context. */ export declare function scanJsx(source: string): ScanResult | null; //# sourceMappingURL=scan-jsx.d.ts.map