@alloc/html-bundle
Version:
Bundle your HTML assets with Esbuild and LightningCSS. Custom plugins, HMR platform, and more.
92 lines (91 loc) • 3.44 kB
text/typescript
import { Attribute, Element, ParentNode } from '@web/parse5-utils';
import * as esbuild from 'esbuild';
import { Config } from '../config.mjs';
export declare function compileClientModule(file: string, config: Config, format?: esbuild.Format): Promise<string>;
export interface RelativeScript {
readonly node: Element;
readonly srcAttr: Attribute;
readonly srcPath: string;
readonly outPath: string;
readonly isModule: boolean;
}
export declare function findRelativeScripts(document: ParentNode, file: string, config: Config): RelativeScript[];
export declare function buildRelativeScripts(scripts: RelativeScript[], config: Config, flags?: {
watch?: boolean;
write?: boolean;
}): Promise<esbuild.BuildResult<{
write: boolean;
bundle: true;
entryPoints: string[];
outdir: string;
outbase: string;
plugins: esbuild.Plugin[];
splitting: boolean;
preserveSymlinks?: boolean | undefined;
outfile?: string | undefined;
metafile?: boolean | undefined;
external?: string[] | undefined;
packages?: "external" | undefined;
alias?: Record<string, string> | undefined;
loader?: {
[ext: string]: esbuild.Loader;
} | undefined;
resolveExtensions?: string[] | undefined;
mainFields?: string[] | undefined;
conditions?: string[] | undefined;
allowOverwrite?: boolean | undefined;
tsconfig?: string | undefined;
outExtension?: {
[ext: string]: string;
} | undefined;
publicPath?: string | undefined;
entryNames?: string | undefined;
chunkNames?: string | undefined;
assetNames?: string | undefined;
inject?: string[] | undefined;
banner?: {
[type: string]: string;
} | undefined;
footer?: {
[type: string]: string;
} | undefined;
stdin?: esbuild.StdinOptions | undefined;
absWorkingDir?: string | undefined;
nodePaths?: string[] | undefined;
sourcemap: boolean | "external" | "linked" | "inline" | "both" | undefined;
legalComments?: "external" | "linked" | "inline" | "none" | "eof" | undefined;
sourceRoot?: string | undefined;
sourcesContent?: boolean | undefined;
format: esbuild.Format;
globalName?: string | undefined;
target?: string | string[] | undefined;
supported?: Record<string, boolean> | undefined;
platform?: esbuild.Platform | undefined;
mangleProps?: RegExp | undefined;
reserveProps?: RegExp | undefined;
mangleQuoted?: boolean | undefined;
mangleCache?: Record<string, string | false> | undefined;
drop?: esbuild.Drop[] | undefined;
minify: boolean;
minifyWhitespace?: boolean | undefined;
minifyIdentifiers?: boolean | undefined;
minifySyntax?: boolean | undefined;
charset: esbuild.Charset;
treeShaking?: boolean | undefined;
ignoreAnnotations?: boolean | undefined;
jsx?: "transform" | "preserve" | "automatic" | undefined;
jsxFactory?: string | undefined;
jsxFragment?: string | undefined;
jsxImportSource?: string | undefined;
jsxDev?: boolean | undefined;
jsxSideEffects?: boolean | undefined;
define: {
[key: string]: string;
} & Record<string, string>;
pure?: string[] | undefined;
keepNames?: boolean | undefined;
color?: boolean | undefined;
logLevel?: esbuild.LogLevel | undefined;
logLimit?: number | undefined;
logOverride?: Record<string, esbuild.LogLevel> | undefined;
}>>;