import * as Effect from "effect/Effect"; import * as Path from "effect/Path"; import * as Schema from "effect/Schema"; import * as Stream from "effect/Stream"; import type * as rolldown from "rolldown"; import { type BundleAnalyzerPluginOptions } from "./BundleAnalyzerPlugin.ts"; import { type PurePluginOptions } from "./PurePlugin.ts"; /** * Extra options accepted by {@link build} / {@link watch} on top of the * standard rolldown input/output options. */ export interface BundleExtraOptions { /** * Configures the {@link purePlugin} which annotates top-level * call/new expressions in matching packages with `/*#__PURE__*\/` * so rolldown can tree-shake them. * * - `undefined` (default): plugin is enabled with the default packages * (`effect`, `@effect/*`, `alchemy`, `@alchemy.run/*`, * `@distilled.cloud/*` — see `DEFAULT_PURE_PACKAGES`). * - `PurePluginOptions`: plugin is enabled with the provided options. * `packages` extends the defaults; set `replaceDefaults: true` to * replace them instead. * - `false`: plugin is disabled. */ readonly pure?: PurePluginOptions | false; /** * Configures the {@link bundleAnalyzerPlugin} which emits a bundle analysis * report alongside the bundle output, describing chunks, modules, and the * import graph reachable from each entry point. * * - `undefined` / `false` (default): plugin is disabled. * - `true`: plugin is enabled with default options. * - `BundleAnalyzerPluginOptions`: plugin is enabled with the provided options. */ readonly bundleAnalyzer?: BundleAnalyzerPluginOptions | boolean; } /** * The user-facing bundler configuration shared by every resource that * bundles an entrypoint with rolldown (AWS Lambda Function, Batch * JobDefinition, App Runner Service, ECR image sources, EC2 hosted * instances, Docker service images, Cloudflare container images, …): * rolldown input/output overrides plus the {@link BundleExtraOptions} * (pure-annotation packages via `pure`, bundle analyzer). * * Top-level calls in `effect`, `@effect/*`, `alchemy`, `@alchemy.run/*`, * and `@distilled.cloud/*` are annotated as pure by default so unused * code from those packages is tree-shaken out of the bundle; list * additional packages via `pure.packages`, or disable annotation with * `pure: false`. */ export interface BundleConfig extends BundleExtraOptions { /** * Rolldown input options overrides. */ readonly input?: Partial; /** * Rolldown output options overrides. */ readonly output?: Partial; } export interface BundleOutput { /** * The files in the bundle. * The first file is the entry. */ readonly files: [BundleFile, ...BundleFile[]]; /** * The SHA-256 hash of all files in the bundle. */ readonly hash: string; } export interface BundleFile { readonly path: string; readonly content: string | Uint8Array; readonly hash: string; } declare const BundleError_base: Schema.Class; }>, import("effect/Cause").YieldableError>; export declare class BundleError extends BundleError_base { } export type BundleWatchEvent = BundleWatchEvent.Start | BundleWatchEvent.Success | BundleWatchEvent.Error; export declare namespace BundleWatchEvent { interface Start { readonly _tag: "Start"; } interface Success { readonly _tag: "Success"; readonly output: BundleOutput; } interface Error { readonly _tag: "Error"; readonly error: BundleError; } } /** * Build a bundle using rolldown from the given input options and output options. * @param inputOptions - The input options for the bundle. * @param outputOptions - The output options for the bundle. * @returns The bundle output. */ export declare const build: (inputOptions: rolldown.InputOptions, outputOptions?: rolldown.OutputOptions, extra?: BundleExtraOptions) => Effect.Effect; /** * Watch for changes in the bundle and return a stream of bundle output. * @param inputOptions - The input options for the bundle. * @param outputOptions - The output options for the bundle. * @returns A stream of Result instances containing either the bundle output or an error. */ export declare const watch: (inputOptions: rolldown.InputOptions, outputOptions?: rolldown.OutputOptions, extra?: BundleExtraOptions) => Stream.Stream; export declare const virtualEntryPlugin: Effect.Effect<(content: (importPath: string) => string) => { name: string; options: { order: "pre"; handler(this: rolldown.MinimalPluginContext, inputOptions: rolldown.InputOptions): undefined; }; resolveId: { filter: { id: RegExp; }; handler(this: rolldown.PluginContext, id: string): { id: string; } | null; }; load: { filter: { id: RegExp; }; handler(this: rolldown.PluginContext, id: string): { code: string; moduleType: "ts"; }; }; }, never, Path.Path>; export declare function bundleOutputFromRolldownOutputBundle(bundle: rolldown.OutputBundle): Effect.Effect; export declare function bundleErrorFromUnknown(error: unknown): BundleError; export declare function bundleOutputFromFiles(files: [BundleFile, ...BundleFile[]]): Effect.Effect; export {}; //# sourceMappingURL=Bundle.d.ts.map