index.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /// <reference types="node" />
  2. /// <reference types="node" />
  3. import { CompileOptions } from 'degenerator';
  4. /**
  5. * Built-in PAC functions.
  6. */
  7. import dateRange from './dateRange';
  8. import dnsDomainIs from './dnsDomainIs';
  9. import dnsDomainLevels from './dnsDomainLevels';
  10. import dnsResolve from './dnsResolve';
  11. import isInNet from './isInNet';
  12. import isPlainHostName from './isPlainHostName';
  13. import isResolvable from './isResolvable';
  14. import localHostOrDomainIs from './localHostOrDomainIs';
  15. import myIpAddress from './myIpAddress';
  16. import shExpMatch from './shExpMatch';
  17. import timeRange from './timeRange';
  18. import weekdayRange from './weekdayRange';
  19. import type { QuickJSWASMModule } from '@tootallnate/quickjs-emscripten';
  20. /**
  21. * Returns an asynchronous `FindProxyForURL()` function
  22. * from the given JS string (from a PAC file).
  23. */
  24. export declare function createPacResolver(qjs: QuickJSWASMModule, _str: string | Buffer, _opts?: PacResolverOptions): (url: string | URL, _host?: string) => Promise<string>;
  25. export type GMT = 'GMT';
  26. export type Hour = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
  27. export type Day = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;
  28. export type Weekday = 'SUN' | 'MON' | 'TUE' | 'WED' | 'THU' | 'FRI' | 'SAT';
  29. export type Month = 'JAN' | 'FEB' | 'MAR' | 'APR' | 'MAY' | 'JUN' | 'JUL' | 'AUG' | 'SEP' | 'OCT' | 'NOV' | 'DEC';
  30. export type PacResolverOptions = CompileOptions;
  31. export interface FindProxyForURLCallback {
  32. (err?: Error | null, result?: string): void;
  33. }
  34. export type FindProxyForURL = ReturnType<typeof createPacResolver>;
  35. export declare const sandbox: Readonly<{
  36. alert: (message?: string) => void;
  37. dateRange: typeof dateRange;
  38. dnsDomainIs: typeof dnsDomainIs;
  39. dnsDomainLevels: typeof dnsDomainLevels;
  40. dnsResolve: typeof dnsResolve;
  41. isInNet: typeof isInNet;
  42. isPlainHostName: typeof isPlainHostName;
  43. isResolvable: typeof isResolvable;
  44. localHostOrDomainIs: typeof localHostOrDomainIs;
  45. myIpAddress: typeof myIpAddress;
  46. shExpMatch: typeof shExpMatch;
  47. timeRange: typeof timeRange;
  48. weekdayRange: typeof weekdayRange;
  49. }>;
  50. //# sourceMappingURL=index.d.ts.map