/* auto-generated by NAPI-RS */
/* eslint-disable */
export interface AstroDiagnostic {
  message: string
  severity: DiagnosticSeverity
  position: Range
}

export declare enum AstroFrontmatterStatus {
  DoesntExist = 'doesnt-exist',
  /** An opening fence with no closing one. */
  Open = 'open',
  Closed = 'closed'
}

/**
 * Convert an Astro source file to TSX for TypeScript editor tooling.
 *
 * Recoverable parse errors produce best-effort TSX and set `hasParseErrors`.
 * Diagnostics include ranges in the original source.
 */
export declare function convertToTsx(source: string, options?: ConvertToTsxOptions | undefined | null): ConvertToTsxResult

export interface ConvertToTsxOptions {
  /**
   * Filename used to name the component (e.g. `MyPage.astro` produces
   * `MyPageAstroComponent`, also exported as `MyPage` for auto-imports
   * unless frontmatter already exports that name).
   */
  filename?: string
  /**
   * Appends fallback declarations for `Fragment` and `Astro`. Off by default.
   * A specialized `Astro` declaration is emitted regardless of this option
   * when frontmatter declares `Props` or exports `getStaticPaths`.
   */
  ambientTypes?: boolean
}

export interface ConvertToTsxResult {
  code: string
  /**
   * UTF-16 range of the clean-name re-export in `code`, including its trailing newline.
   * Absent for dynamic routes, filenames without a matching clean component name,
   * and names already exported by frontmatter.
   */
  generatedComponentExport?: Range
  /** TypeScript Content Mapper span mappings in UTF-16 code units. */
  mappings: [virtualStart: number, virtualLength: number, originalStart: number, originalLength: number, kind: 0 | 1 | 2, features?: number][]
  /** Range of the frontmatter section within `code`. */
  frontmatter: Range
  /** Range of the template within `code`, excluding the `<Fragment>` wrappers. */
  body: Range
  frontmatterStatus: AstroFrontmatterStatus
  /** Range of the frontmatter in the original source, fences included. */
  frontmatterSource: Range
  scripts: Array<ExtractedScript>
  styles: Array<ExtractedStyle>
  diagnostics: Array<AstroDiagnostic>
  hasParseErrors: boolean
}

export declare enum DiagnosticSeverity {
  Error = 1,
  Warning = 2,
  Information = 3,
  Hint = 4
}

export interface ExtractedScript {
  /** Range of `content` in the original source. */
  position: Range
  content: string
  type: ExtractedScriptType
}

/**
 * A bare `<script>` is Astro-processed; attributes opt out of that processing.
 * `Unknown` includes both dynamic and unrecognized `type` values.
 */
export declare enum ExtractedScriptType {
  /** A bare `<script>` that Astro processes and bundles as a module. */
  ProcessedModule = 'processed-module',
  /** A non-processed `<script type="module">`. */
  Module = 'module',
  /** A non-processed script containing JavaScript or TypeScript. */
  Inline = 'inline',
  /** JavaScript extracted from an HTML event-handler attribute. */
  EventAttribute = 'event-attribute',
  /** A JSON or browser data block such as an import map. */
  Json = 'json',
  /** Script content preserved by the `is:raw` directive. */
  Raw = 'raw',
  /** A dynamic or unrecognized `type` attribute. */
  Unknown = 'unknown'
}

export interface ExtractedStyle {
  /** Range of `content` in the original source. */
  position: Range
  content: string
  type: ExtractedStyleType
  /** Normalized `lang` attribute: `css` when absent, `unknown` when dynamic. */
  lang: string
}

export declare enum ExtractedStyleType {
  Tag = 'tag',
  StyleAttribute = 'style-attribute'
}

export interface Range {
  start: number
  end: number
}
