UNPKG

esbuild-plugin-extract-helpers

Version:

Esbuild plugin to extract cjs helpers (like tslib)

14 lines (13 loc) 641 B
import { Plugin, BuildResult } from 'esbuild'; export type TOpts = { include: RegExp; exclude: RegExp; helper: string; cwd: string; }; export type TPluginOpts = Partial<TOpts>; export declare const extractHelpersPlugin: (options?: Record<string, any>) => Plugin; export declare const onEnd: (result: BuildResult, opts: TOpts) => Promise<void>; export declare const getRelativePath: (from: string, to: string, ref: string) => string; export declare const formatHelpers: (helpers: Map<string, string>) => string; export declare const formatFile: (header: string, lines: string[], refs: string[], helperPath: string) => string;