import { GenerateDtsOptions } from "@bunup/dts"; import { BunPlugin as BunPlugin2, CompileBuildOptions } from "bun"; type PackageJson = { /** The parsed content of the package.json file */ data: Record | null; /** The path to the package.json file */ path: string | null; }; /** * Represents the meta data of the build */ type BuildMeta = { /** The package.json file */ packageJson: PackageJson; /** The root directory of the build */ rootDir: string; }; type BuildOutputFile = { /** * The entry point for which this file was generated * * Undefined for non-entry point files (e.g., assets, sourcemaps, chunks) */ entrypoint: string | undefined; /** The kind of the file */ kind: "entry-point" | "chunk" | "asset" | "sourcemap" | "bytecode" | "executable"; /** Absolute path to the generated file */ fullPath: string; /** Path to the generated file relative to the root directory */ pathRelativeToRootDir: string; /** Path to the generated file relative to the output directory */ pathRelativeToOutdir: string; /** Whether the file is a dts file */ dts: boolean; /** The format of the output file */ format: Format; /** The size of the file in bytes */ size: number; }; /** * Build configuration and metadata used during build execution. */ type BuildContext = { /** Build configuration options that were used */ options: BuildOptions; /** Build execution metadata */ meta: BuildMeta; }; /** * Build output containing generated files and build context. */ type BuildResult = { /** Generated output files */ files: BuildOutputFile[]; /** Build configuration and metadata that were used */ build: BuildContext; }; /** * Context provided when build starts. */ type OnBuildStartCtx = { /** Build configuration options that will be used */ options: BuildOptions; }; /** * Context provided when build completes. * Flattened structure for easy access in plugin hooks. */ type OnBuildDoneCtx = { /** Generated output files */ files: BuildOutputFile[]; /** Build configuration options that were used */ options: BuildOptions; /** Build execution metadata */ meta: BuildMeta; }; /** * Hooks that can be implemented by Bunup plugins. */ type BunupPluginHooks = { /** * Called when a build is successfully completed. */ onBuildDone?: (ctx: OnBuildDoneCtx) => MaybePromise; /** * Called before a build starts. */ onBuildStart?: (ctx: OnBuildStartCtx) => MaybePromise; }; /** * Represents a Bunup-specific plugin */ type BunupPlugin = { /** Optional name for the plugin */ name?: string; /** The hooks implemented by this plugin */ hooks: BunupPluginHooks; }; type CustomExports = Record>>; type Exclude2 = ((ctx: BuildContext) => string[] | undefined) | string[]; interface ExportsOptions { /** * Additional fields to preserve alongside automatically generated exports * * @see https://bunup.dev/docs/extra-options/exports#customexports */ customExports?: (ctx: BuildContext) => CustomExports | undefined; /** * Export keys to exclude from the generated exports field in package.json * * This option filters out specific keys from the final exports object * after all exports have been internally generated. Use glob patterns or exact * key strings (e.g., ".", "./utils", "./components/*") to match the * keys you want to exclude. * * @example * ```ts * // Exclude specific keys * exclude: ["./internal", "./utils"] * * // Exclude using glob patterns * exclude: ["./internal/*", "./private-*"] * * // Dynamic exclusion based on build context * exclude: (ctx) => { * return ["./debug"] * } * ``` * * @see https://bunup.dev/docs/extra-options/exports#exclude */ exclude?: Exclude2; /** * Whether to automatically exclude CLI entry points from the exports field * * When enabled (default), CLI-related entry points are automatically excluded * from package exports since they are typically used for binaries and should * not be exposed as importable package exports. * * The plugin uses glob patterns to match common CLI entry point patterns: * - Files or directories named "cli" (e.g., `cli.ts`, `cli/index.ts`) * - Files or directories named "bin" (e.g., `bin.ts`, `bin/index.ts`) * - CLI-related paths in src directory (e.g., `src/cli.ts`, `src/bin/index.ts`) * * If you want to include CLI entries in your exports, set this to `false` and * optionally use the `exclude` option for more granular control. * * @default true * @see https://bunup.dev/docs/extra-options/exports#excludecli */ excludeCli?: boolean; /** * Whether to exclude CSS files from being added to the exports field * * @default false */ excludeCss?: boolean; /** * Whether to include "./package.json": "./package.json" in the exports field * * @default true * @see https://bunup.dev/docs/extra-options/exports#includepackagejson */ includePackageJson?: boolean; /** * Whether to add a wildcard that allows deep imports * * When true, adds "./*": "./*" to exports, making all files accessible * When false (default), only explicit exports are accessible * * @default false * @see https://bunup.dev/docs/extra-options/exports#all */ all?: boolean; } /** * A plugin that generates the exports field in the package.json file automatically. * * @see https://bunup.dev/docs/extra-options/exports */ declare function exports(options?: ExportsOptions): BunupPlugin; import { BunPlugin } from "bun"; type InjectStylesOptions = { /** * Custom function to inject CSS into the document head. * * By default, bunup uses its own `injectStyle` function that creates a `