esbuild-plugins-node-modules-polyfill
Version:
Polyfills nodejs builtin modules and globals for the browser.
32 lines (31 loc) • 1.03 kB
TypeScript
import { PartialMessage, Plugin } from "esbuild";
//#region src/lib/utils/util.d.ts
declare const escapeRegex: (str: string) => string;
declare const commonJsTemplate: ({
importPath
}: {
importPath: string;
}) => string;
declare const normalizeNodeBuiltinPath: (path: string) => string;
//#endregion
//#region src/lib/plugin.d.ts
interface NodePolyfillsOptions {
fallback?: 'empty' | 'error' | 'none';
formatError?: (this: void, args: {
importer: string;
moduleName: string;
polyfillExists: boolean;
}) => PartialMessage | Promise<PartialMessage>;
globals?: {
Buffer?: boolean;
process?: boolean;
};
modules?: Record<string, boolean | 'empty' | 'error'> | string[];
name?: string;
namespace?: string;
overrides?: Record<string, string>;
}
declare const nodeModulesPolyfillPlugin: (options?: NodePolyfillsOptions) => Plugin;
//#endregion
export { NodePolyfillsOptions, commonJsTemplate, escapeRegex, nodeModulesPolyfillPlugin, normalizeNodeBuiltinPath };
//# sourceMappingURL=index.d.ts.map