import esbuild from "esbuild"; import type { Context } from "../context.js"; import { Resource } from "../resource.js"; /** * Properties for creating or updating an esbuild bundle */ export interface BundleProps extends Partial { /** * Entry point for the bundle * Path to the source file to bundle (e.g., "src/handler.ts") */ entryPoint: string; /** * Output directory for the bundle * Directory where the bundled file will be written */ outdir?: string; /** * Output filename for the bundle * Full path to the output file, overrides outdir if specified */ outfile?: string; /** * Bundle format * iife: Immediately Invoked Function Expression * cjs: CommonJS * esm: ECMAScript Modules */ format?: "iife" | "cjs" | "esm"; /** * Target environment * Examples: 'node16', 'node18', 'es2020' */ target?: string | string[]; /** * Whether to minify the output */ minify?: boolean; /** * Whether to generate sourcemaps * inline: Include sourcemap in bundle * external: Generate separate .map file * both: Generate both inline and external */ sourcemap?: boolean | "inline" | "external" | "both"; /** * External packages to exclude from bundle * Array of package names to mark as external */ external?: string[]; /** * Platform to target * browser: Browser environment * node: Node.js environment * neutral: Platform-agnostic */ platform?: "browser" | "node" | "neutral"; /** * Additional esbuild options * Any other valid esbuild BuildOptions */ options?: Partial; } /** * Output returned after bundle creation/update */ export interface Bundle

extends Resource<"esbuild::Bundle">, BundleProps { /** * Path to the bundled file * Absolute or relative path to the generated bundle */ path: P extends { outdir: string; } | { outfile: string; } ? string : undefined; /** * SHA-256 hash of the bundle contents * Used for cache busting and content verification */ hash: string; /** * The content of the bundle (the .js or .mjs file) */ content: string; } /** * esbuild Bundle Resource * * Creates and manages bundled JavaScript/TypeScript files using esbuild. * Supports various output formats, sourcemaps, and platform targets. * * @example * // Bundle a TypeScript file for Node.js * const bundle = await Bundle("handler", { * entryPoint: "src/handler.ts", * outdir: ".alchemy/.out", * format: "esm", * platform: "node", * target: "node18" * }); */ export declare const Bundle: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context>, id: string, props: Props) => Promise>); export declare function bundle(props: BundleProps): Promise; loader?: { [ext: string]: esbuild.Loader; }; resolveExtensions?: string[]; mainFields?: string[]; conditions?: string[]; allowOverwrite?: boolean; tsconfig?: string; outExtension?: { [ext: string]: string; }; publicPath?: string; entryNames?: string; chunkNames?: string; assetNames?: string; inject?: string[]; banner?: { [type: string]: string; }; footer?: { [type: string]: string; }; stdin?: esbuild.StdinOptions; plugins?: esbuild.Plugin[]; absWorkingDir?: string; nodePaths?: string[]; legalComments?: "none" | "inline" | "eof" | "linked" | "external"; sourceRoot?: string; sourcesContent?: boolean; globalName?: string; supported?: Record; mangleProps?: RegExp; reserveProps?: RegExp; mangleQuoted?: boolean; mangleCache?: Record; drop?: esbuild.Drop[]; dropLabels?: string[]; minifyWhitespace?: boolean; minifyIdentifiers?: boolean; minifySyntax?: boolean; lineLimit?: number; charset?: esbuild.Charset; treeShaking?: boolean; ignoreAnnotations?: boolean; jsx?: "transform" | "preserve" | "automatic"; jsxFactory?: string; jsxFragment?: string; jsxImportSource?: string; jsxDev?: boolean; jsxSideEffects?: boolean; define?: { [key: string]: string; }; pure?: string[]; keepNames?: boolean; color?: boolean; logLevel?: esbuild.LogLevel; logLimit?: number; logOverride?: Record; tsconfigRaw?: string | esbuild.TsconfigRaw; }>>; //# sourceMappingURL=bundle.d.ts.map