import type { Callable, Context, Isolate, Script } from "./types"; export type TypeScriptLoader = "ts" | "tsx"; export type SourceFileLoader = "js" | "jsx" | "ts" | "tsx"; export type TranspileTypeScriptOptions = { /** * Bun loader used for the source. Use `"tsx"` / `"jsx"` when tenant/plugin * source may contain JSX syntax. */ loader?: SourceFileLoader; /** * Bun transpilation target. Defaults to `"bun"` because isolate code runs * inside Bun/JavaScriptCore. */ target?: "bun" | "browser" | "node"; }; export type SourceFileOptions = TranspileTypeScriptOptions & { /** * Override the loader inferred from the file extension. */ loader?: SourceFileLoader; }; /** * Transpile TypeScript with Bun's native transpiler before sending source to * the isolate. This does not type-check; run `tsc --noEmit` separately when * you need diagnostics. */ export declare const transpileTypeScript: (source: string, options?: TranspileTypeScriptOptions) => string; /** * Read a real source file from disk. This is intentionally a tiny helper so * callers can keep tenant/plugin code in normal `.ts`, `.tsx`, `.js`, or * `.jsx` files with editor diagnostics, generics, and stack-friendly names. */ export declare const readSourceFile: (filePath: string | URL) => Promise; /** * Read and transpile a source file with Bun's native transpiler. The loader is * inferred from `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, or `.cjs` unless supplied. */ export declare const transpileSourceFile: (filePath: string | URL, options?: SourceFileOptions) => Promise; /** * Transpile TypeScript and compile it as an isolate script. */ export declare const compileTypeScript: (isolate: Isolate, source: string, options?: TranspileTypeScriptOptions) => Promise