diff --git a/src/cli-main.ts b/src/cli-main.ts index 8891e83..a0dcd8a 100644 --- a/src/cli-main.ts +++ b/src/cli-main.ts @@ -67,6 +67,7 @@ export async function main(options: Options = {}) { '--silent', 'Supress non-error logs (excluding "onSuccess" process output)' ) + .option('--pure ', 'Mark specific expressions as pure') .action(async (files: string[], flags) => { const { build } = await import('.') Object.assign(options, { diff --git a/src/index.ts b/src/index.ts index 0b6a43c..5a0ca88 100644 --- a/src/index.ts +++ b/src/index.ts @@ -101,6 +101,10 @@ export type Options = { * Skip node_modules bundling */ skipNodeModulesBundle?: boolean + /** + * @see https://esbuild.github.io/api/#pure + */ + pure?: string | string[] } export type NormalizedOptions = MarkRequired< @@ -204,6 +208,7 @@ export async function runEsbuild( minifySyntax: options.minifySyntax, keepNames: options.keepNames, incremental: !!options.watch, + pure: typeof options.pure === 'string' ? [options.pure] : options.pure, }) } catch (error) { log(format, 'error', 'Build failed')