/* auto-generated by NAPI-RS */ /* eslint-disable */ export * from '@oxc-project/types'; export declare class MagicString { /** Get source text from utf8 offset. */ getSourceText(start: number, end: number): string /** Get 0-based line and column number from utf8 offset. */ getLineColumnNumber(offset: number): LineColumn /** Get UTF16 byte offset from UTF8 byte offset. */ getUtf16ByteOffset(offset: number): number length(): number toString(): string append(input: string): this appendLeft(index: number, input: string): this appendRight(index: number, input: string): this indent(): this prepend(input: string): this prependLeft(index: number, input: string): this prependRight(index: number, input: string): this relocate(start: number, end: number, to: number): this remove(start: number, end: number): this } export declare class ParseResult { get program(): import("@oxc-project/types").Program get module(): EcmaScriptModule get comments(): Array get errors(): Array get magicString(): MagicString } export interface Comment { type: 'Line' | 'Block' value: string start: number end: number } export interface EcmaScriptModule { /** * Has ESM syntax. * * i.e. `import` and `export` statements, and `import.meta`. * * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files. */ hasModuleSyntax: boolean /** Import Statements. */ staticImports: Array /** Export Statements. */ staticExports: Array /** Span positions` of `import.meta` */ importMetas: Array } export interface ErrorLabel { message?: string start: number end: number } export interface ExportExportName { kind: ExportExportNameKind name?: string start?: number end?: number } export declare const enum ExportExportNameKind { /** `export { name } */ Name = 'Name', /** `export default expression` */ Default = 'Default', /** `export * from "mod" */ None = 'None' } export interface ExportImportName { kind: ExportImportNameKind name?: string start?: number end?: number } export declare const enum ExportImportNameKind { /** `export { name } */ Name = 'Name', /** `export * as ns from "mod"` */ All = 'All', /** `export * from "mod"` */ AllButDefault = 'AllButDefault', /** Does not have a specifier. */ None = 'None' } export interface ExportLocalName { kind: ExportLocalNameKind name?: string start?: number end?: number } export declare const enum ExportLocalNameKind { /** `export { name } */ Name = 'Name', /** `export default expression` */ Default = 'Default', /** * If the exported value is not locally accessible from within the module. * `export default function () {}` */ None = 'None' } export interface ImportName { kind: ImportNameKind name?: string start?: number end?: number } export declare const enum ImportNameKind { /** `import { x } from "mod"` */ Name = 'Name', /** `import * as ns from "mod"` */ NamespaceObject = 'NamespaceObject', /** `import defaultExport from "mod"` */ Default = 'Default' } export interface LineColumn { line: number column: number } export interface OverwriteOptions { contentOnly: boolean } export interface OxcError { severity: Severity message: string labels: Array helpMessage?: string } /** * Parse asynchronously. * * Note: This function can be slower than `parseSync` due to the overhead of spawning a thread. */ export declare function parseAsync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): Promise export interface ParserOptions { sourceType?: 'script' | 'module' | 'unambiguous' | undefined /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */ lang?: 'js' | 'jsx' | 'ts' | 'tsx' /** * Emit `ParenthesizedExpression` in AST. * * If this option is true, parenthesized expressions are represented by * (non-standard) `ParenthesizedExpression` nodes that have a single `expression` property * containing the expression inside parentheses. * * Default: true */ preserveParens?: boolean } /** Parse synchronously. */ export declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): ParseResult /** * Parse without returning anything. * * This is for benchmark purposes such as measuring napi communication overhead. */ export declare function parseWithoutReturn(filename: string, sourceText: string, options?: ParserOptions | undefined | null): void export declare const enum Severity { Error = 'Error', Warning = 'Warning', Advice = 'Advice' } export interface SourceMapOptions { includeContent?: boolean source?: string hires?: boolean } export interface Span { start: number end: number } export interface StaticExport { start: number end: number entries: Array } export interface StaticExportEntry { start: number end: number moduleRequest?: ValueSpan /** The name under which the desired binding is exported by the module`. */ importName: ExportImportName /** The name used to export this binding by this module. */ exportName: ExportExportName /** The name that is used to locally access the exported value from within the importing module. */ localName: ExportLocalName } export interface StaticImport { /** Start of import statement. */ start: number /** End of import statement. */ end: number /** * Import source. * * ```js * import { foo } from "mod"; * // ^^^ * ``` */ moduleRequest: ValueSpan /** * Import specifiers. * * Empty for `import "mod"`. */ entries: Array } export interface StaticImportEntry { /** * The name under which the desired binding is exported by the module. * * ```js * import { foo } from "mod"; * // ^^^ * import { foo as bar } from "mod"; * // ^^^ * ``` */ importName: ImportName /** * The name that is used to locally access the imported value from within the importing module. * ```js * import { foo } from "mod"; * // ^^^ * import { foo as bar } from "mod"; * // ^^^ * ``` */ localName: ValueSpan /** * Whether this binding is for a TypeScript type-only import. * * `true` for the following imports: * ```ts * import type { foo } from "mod"; * import { type foo } from "mod"; * ``` */ isType: boolean } export interface ValueSpan { value: string start: number end: number }