Programmatic API
Import Kiln compiler functions directly into TypeScript or JavaScript build scripts:
import { compileApp, compileStandalone, generateEntryPoint } from "kiln-compiler";compileApp(options)
Section titled “compileApp(options)”Executes the full end-to-end compilation workflow:
const result = compileApp({ projectDir: "./apps/web", outputFile: "./bin/app", framework: "next", // optional (auto-detected if omitted)});
console.log(result.outputFile); // Path to generated executableconsole.log(result.framework); // Detected frameworkgenerateEntryPoint(options)
Section titled “generateEntryPoint(options)”Generates the asset manifest and server entrypoint without running Bun compile:
import { generateEntryPoint, getAdapter } from "kiln-compiler";
const adapter = getAdapter("next")!;generateEntryPoint({ standaloneDir: "./.next/standalone", distDir: "./.next", projectDir: process.cwd(), adapter,});compileStandalone(options)
Section titled “compileStandalone(options)”Compiles the generated entrypoint using bun build --compile:
import { compileStandalone } from "kiln-compiler";
compileStandalone({ standaloneDir: "./.next/standalone", outfile: "./bin/app",});