import { Artifact, CompilerOptions } from '@cashscript/utils'; import { PathLike } from 'fs'; import { CashScriptErrorListener } from './ast/error-listeners.js'; import { CashScriptWarningListener } from './Warnings.js'; export declare const DEFAULT_COMPILER_OPTIONS: CompilerOptions; export interface CompileOptions extends CompilerOptions { errorListener?: CashScriptErrorListener; warningListener?: CashScriptWarningListener; } export interface CompileStringOptions extends CompileOptions { files?: Record; } /** * Compile a CashScript source string to an {@link Artifact}. * * @param code - The CashScript source code to compile. * @param compilerOptions - Optional compiler options that override the defaults. * @returns The compiled CashScript artifact, including ABI, bytecode and debug information. * @throws If the source code contains a syntax, semantic, or type error, or an import cannot be resolved. * @remarks Compilation warnings (e.g. unused variables) are passed to the `warningListener` compiler * option, or printed with `console.warn` when no listener is provided. */ export declare const compileString: (code: string, compilerOptions?: CompileStringOptions) => Artifact; /** * Read a `.cash` source file from disk and compile it to an `Artifact`. * * Import directives are resolved from the filesystem: file paths (starting with './' or '../') * relative to the importing file's directory, and package imports (e.g. 'pkg/math.cash') * from node_modules directories, walking up from the importing file's directory. * * @param codeFile - The path to the `.cash` source file. * @param compilerOptions - Optional compiler options that override the defaults. * @returns The compiled CashScript artifact. * @throws If the file cannot be read, or if the source contains a compilation error. */ export declare const compileFile: (codeFile: PathLike, compilerOptions?: CompileOptions) => Artifact; export interface InternalCompilerOptions extends CompilerOptions { disableInlining?: boolean; } export declare function compileStringInternal(code: string, compilerOptions?: CompileStringOptions & InternalCompilerOptions): Artifact; export declare function compileFileInternal(codeFile: PathLike, compilerOptions?: CompileOptions & InternalCompilerOptions): Artifact;