node.d.ts 791 B

1234567891011121314151617181920212223
  1. import { TransformOptions } from 'esbuild';
  2. declare type LOADERS = 'js' | 'jsx' | 'ts' | 'tsx';
  3. declare const FILE_LOADERS: Record<string, LOADERS>;
  4. declare type EXTENSIONS = keyof typeof FILE_LOADERS;
  5. interface RegisterOptions extends TransformOptions {
  6. extensions?: EXTENSIONS[];
  7. /**
  8. * Auto-ignore node_modules. Independent of any matcher.
  9. * @default true
  10. */
  11. hookIgnoreNodeModules?: boolean;
  12. /**
  13. * A matcher function, will be called with path to a file. Should return truthy if the file should be hooked, falsy otherwise.
  14. */
  15. hookMatcher?(fileName: string): boolean;
  16. }
  17. declare function register(esbuildOptions?: RegisterOptions): {
  18. unregister(): void;
  19. };
  20. declare type Register = ReturnType<typeof register>;
  21. export { Register, register };