/* auto-generated by NAPI-RS */ /* eslint-disable */ export declare const enum CompactOptions { /** No whitespace modification */ None = 'none', /** HTML-aware whitespace collapsing (default). */ Html = 'html', /** JSX-style whitespace removal. */ Jsx = 'jsx' } /** * Compile Astro file to JavaScript asynchronously on a separate thread. * * Generally `compileAstroSync` is preferable to use as it does not have the overhead * of spawning a thread. If you need to parallelize compilation of multiple files, * it is recommended to use worker threads. * * @example * ```javascript * import { compileAstro } from '@astrojs/compiler-binding'; * * const result = await compileAstro(`--- * const name = "World"; * --- *

Hello {name}!

`, { * filename: 'Component.astro', * }); * * console.log(result.code); // Generated JavaScript * ``` */ export declare function compileAstro(sourceText: string, options?: CompileOptions | undefined | null): Promise /** * Compile Astro file to JavaScript synchronously on current thread. * * @example * ```javascript * import { compileAstroSync } from '@astrojs/compiler-binding'; * * const result = compileAstroSync(`--- * const name = "World"; * --- *

Hello {name}!

`, { * filename: 'Component.astro', * }); * * console.log(result.code); // Generated JavaScript * ``` */ export declare function compileAstroSync(sourceText: string, options?: CompileOptions | undefined | null): CompileResult /** Options for compiling Astro files to JavaScript. */ export interface CompileOptions { /** * The filename of the Astro component being compiled. * Used in the `$$createComponent` call for debugging. */ filename?: string /** * A normalized version of the filename used for scope hash generation. * If not provided, falls back to `filename`. */ normalizedFilename?: string /** * The import specifier for Astro runtime functions. * Defaults to `"astro/runtime/server/index.js"`. */ internalURL?: string /** * Source map generation mode. * * - `"external"`: populate the `map` field with a JSON source map. * - `"inline"`: append an inline `//# sourceMappingURL=data:...` comment; `map` will be empty. * - `"both"`: append the inline comment **and** populate `map`. * - `undefined`: no source map (default). */ sourcemap?: 'external' | 'inline' | 'both' /** * Arguments passed to `$$createAstro` when the Astro global is used. * Defaults to `"https://astro.build"`. */ astroGlobalArgs?: string /** * Controls whitespace collapsing in the HTML output. * * - `none` (default): no whitespace modification. * - `html`: HTML-aware whitespace collapsing (collapses runs of whitespace, * preserves significant whitespace, follows HTML whitespace rules). * - `"jsx"`: strips all whitespace-only text nodes and leading/trailing * whitespace from text content (JSX-style whitespace removal). * * @default false */ compact?: 'none' | 'html' | 'jsx' /** * Enable scoped slot result handling. * When `true`, slot callbacks receive the `$$result` render context parameter. * * @default false */ resultScopedSlot?: boolean /** * Strategy for CSS scoping. * * @default "where" */ scopedStyleStrategy?: 'where' | 'class' | 'attribute' /** * URL for the view transitions animation CSS. * When set, replaces the default `"transitions.css"` bare specifier in the emitted import. */ transitionsAnimationURL?: string /** * Whether to annotate generated code with the source file path. * **Stub**: not yet implemented. * * @default false */ annotateSourceFile?: boolean /** * Whether to strip HTML comments from component slot children. * Matches the official Astro compiler behavior by default. * * @default true */ stripSlotComments?: boolean /** * Whether the caller has a `resolvePath` function. * * When `true`, the codegen will: * - Skip emitting `$$createMetadata` import * - Skip emitting `import * as $$moduleN` re-imports * - Skip emitting `export const $$metadata = ...` * - Use plain string literals instead of `$$metadata.resolvePath(...)` * * The actual path resolution is done by the JS wrapper layer using * the `resolvePath` callback post-compilation. * * @default false */ resolvePathProvided?: boolean /** * Preprocessed style content, indexed by extractable style order. * * When provided, the codegen uses these strings as CSS content instead * of reading from the AST's ``. */ content: string /** * The element's attributes as key-value pairs. * Only quoted and empty (boolean) attributes are included — expression * attributes (like `define:vars={...}`) are omitted. */ attrs: Record }