import { BuildReport, BuildReport as BuildReport$1 } from "@crustjs/core"; //#region src/distribute.d.ts /** * What one build distributes: a runtime `package` (a root-only JavaScript * bundle that needs the runtime installed) or standalone `binary` executables * in platform packages behind a Node launcher. */ declare const ARTIFACT_KINDS: readonly ["package", "binary"]; type ArtifactKind = (typeof ARTIFACT_KINDS)[number]; /** * One file `crust build` generated or compiled into the staged tree. `target` * is the canonical compiler target of a platform package (`bun-linux-x64`), * absent for the root package. Extension build hook output is reported by * command in the `BuildReport`s instead, not repeated here. */ type BuildArtifact = { kind: "package-json"; path: string; target?: string; } | { kind: "launcher"; path: string; command: string; } | { kind: "executable"; path: string; command: string; target: string; } | { kind: "bundle"; path: string; command: string; }; //#endregion //#region src/build.d.ts /** Options of the programmatic {@link build}; `crust build` maps its flags onto them. */ type BuildOptions = { /** Project root whose package.json `bin` and `crust` are read. Default: `process.cwd()`. */ cwd?: string; /** * `"package"` for a runtime package (a root-only JavaScript bundle that runs * on the installed runtime) or `"binary"` for standalone executables in * platform packages. Overrides package.json `crust.artifact`; one of the two * is required. */ artifact?: ArtifactKind; /** * Canonical compiler targets, or `"host"` for this machine. Overrides * package.json `crust.targets`; omit both to stage every target of the * binary compiler. Rejected for runtime packages. */ targets?: readonly string[]; /** Env files inlining `PUBLIC_*` build-time constants, resolved against `cwd`. Rejected for deno. */ envFiles?: readonly string[]; /** Minify the output. Default: true for bun and node; an explicit `true` is rejected for deno. */ minify?: boolean; /** Materialize Command Snapshots and run Extension build hooks before compiling. Default: true. */ validate?: boolean; /** Receives each progress line `crust build` would print; silent when omitted. Warnings arrive as `"stderr"`. */ onLog?: (line: string, stream: "stdout" | "stderr") => void; }; /** What {@link build} staged in `stageDir` (`/.crust`). */ type BuildResult = { stageDir: string; /** Generated package.json files, launchers, and compiled commands; see {@link BuildArtifact}. */ artifacts: BuildArtifact[]; /** Extension build hook output per command; absent when `validate` was false. */ reports?: Record; }; /** * Stages the publishable npm tree in `/.crust` for one runtime/artifact * combination: a root package with one `bin/.js` per package.json * `bin` entry, each the command's bundle (artifact `package`) or a Node * launcher (artifact `binary`), plus for binaries one platform package per * target holding one executable per command. Command names and source entries * come from `bin`; the runtime, artifact, Bun plugins, extra directories, and * external dependencies from package.json `crust`. Bundling and Command * Snapshots run in bun subprocesses (bun on PATH, or the running Bun * executable), so this works under Node as well when Bun is installed; Deno * binaries and Deno runtime packages (experimental, deno 2.5.0 or newer) need * deno on PATH, and Node binaries a node on PATH that Crust's tsdown can build * executables with. * * Throws on any failure. Planning and compiler-selection failures (bad * options or package.json, a missing or hung compiler, an engines mismatch) leave the * previous `.crust/` stage untouched; later failures leave a wiped stage * without a completion `manifest.json`. Overlapping calls for the same real * project directory are rejected across processes before staging. An interrupted * process may leave `.crust.lock`; remove it only when no build is running. */ export declare function build(options?: BuildOptions): Promise; //#endregion export type { BuildArtifact, BuildOptions, BuildReport, BuildResult };