import { type Fs, type Glob, type Ps } from "webappwiz/system"; import type { Bundle } from "./bundle.js"; /** What a `BunBundle` builds through; the real system by default. */ export interface BunBundleOptions { fs?: Fs; ps?: Ps; glob?: Glob; } /** * Builds a package into `dist/`: one bundle per entry point, the declarations * beside them, and a manifest of its own, so that directory is a whole package * and the one thing a release sends. What goes out is JavaScript, so a consumer * needs neither Bun nor a bundler nor a compiler pass over somebody else's * source, and the source never leaves the repository. * * A package needing something made before it compiles says so with a `build` * script in its manifest, and that runs first: `arbor` builds the page it * serves, which its own source then imports. The compiler still runs after, * because what a package makes for itself is its business and what it publishes * as is the release's. * * A package that reads files of its own at runtime lists them in its * manifest's `files`, as globs from its root, and they are copied into `dist` * where they sit in the source. The build inlines what is imported, but a file * read off disk is invisible to it, and would otherwise be missing only once * published. */ export declare class BunBundle implements Bundle { private readonly fs; private readonly ps; private readonly glob; constructor(opts?: BunBundleOptions); build(dir: string): Promise; clean(dir: string): Promise; /** Copies every file a `files` glob matches into the same place in `dist`. */ private copy; /** The JavaScript and the declarations for every entry point a package has. */ private compile; /** * The declaration files a package keeps at its root, which say what its * non-code imports are. Nothing loads the workspace tsconfig during a build, * so anything ambient has to be handed over by name or tsc will not believe * in it: `rules` imports each rule's markdown, and `md.d.ts` is what says * markdown is a string. */ private ambient; /** * Points every relative specifier in the emitted declarations at a `.js` * file. tsc writes them bare, which a consumer resolving as node16 rejects * outright, and which with `skipLibCheck` on it does not report at all: the * references quietly fail and every export becomes `any`, so the types are * lost without anybody being told. A `.js` specifier resolves to the * declaration beside it under both node16 and bundler resolution, so the one * output serves either. * * This runs over whatever is in `dist`, however it got there, so a package * building itself does not have to remember. A specifier that already names * a file is left alone, which is what makes running it twice harmless. */ private point; private run; }