with-reg-exp.d.ts 953 B

1234567891011121314151617181920212223242526272829303132
  1. import type * as esbuild from "esbuild";
  2. import type { ModuleInfo } from "./module-info";
  3. /**
  4. * Object that contains a filter and a mapping function for replacing modules
  5. * with corresponding global variables.
  6. */
  7. export declare type GlobalsMapper<T extends string = string> = {
  8. /**
  9. * Regular expression that match module paths to be processed by this plugin.
  10. *
  11. * @see <https://esbuild.github.io/plugins/>
  12. */
  13. modulePathFilter: RegExp;
  14. /**
  15. * Function that returns either a corresponding global variable name or a
  16. * `ModuleInfo` object for the module at `modulePath`.
  17. */
  18. getModuleInfo: (modulePath: T) => string | ModuleInfo;
  19. };
  20. /**
  21. * Create a `Plugin` for replacing modules with corresponding global variables.
  22. *
  23. * @param globals See type declaration.
  24. */
  25. export declare const globalExternalsWithRegExp: <T extends string>(
  26. globals: GlobalsMapper<T>
  27. ) => esbuild.Plugin;
  28. //# sourceMappingURL=with-reg-exp.d.ts.map