index.d.mts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { MessagePort } from 'node:worker_threads';
  2. import { R as RequiredProperty } from '../../types-Cxp8y2TL.js';
  3. type ScopedImport = (specifier: string, parent: string) => Promise<any>;
  4. type TsconfigOptions = false | string;
  5. type InitializationOptions = {
  6. namespace?: string;
  7. port?: MessagePort;
  8. tsconfig?: TsconfigOptions;
  9. };
  10. type RegisterOptions = {
  11. namespace?: string;
  12. onImport?: (url: string) => void;
  13. tsconfig?: TsconfigOptions;
  14. };
  15. type Unregister = () => Promise<void>;
  16. type NamespacedUnregister = Unregister & {
  17. import: ScopedImport;
  18. unregister: Unregister;
  19. };
  20. type Register = {
  21. (options: RequiredProperty<RegisterOptions, 'namespace'>): NamespacedUnregister;
  22. (options?: RegisterOptions): Unregister;
  23. };
  24. declare const register: Register;
  25. type Options = {
  26. parentURL: string;
  27. onImport?: (url: string) => void;
  28. tsconfig?: TsconfigOptions;
  29. };
  30. declare const tsImport: (specifier: string, options: string | Options) => Promise<any>;
  31. export { type InitializationOptions, type NamespacedUnregister, type Register, type RegisterOptions, type ScopedImport, type Unregister, register, tsImport };