mod.d.ts 935 B

123456789101112131415161718192021222324252627282930313233343536
  1. declare module 'gorhill-publicsuffixlist' {
  2. type Selfie =
  3. | string
  4. | {
  5. magic: number,
  6. buf32: number[]
  7. };
  8. interface Decoder {
  9. decode: (bufferStr: string, buffer: ArrayBuffer) => void,
  10. decodeSize: (bufferStr: string) => number
  11. }
  12. interface Encoder {
  13. encode: (buffer: ArrayBuffer, length: number) => string
  14. }
  15. export interface PublicSuffixList {
  16. version: string,
  17. parse(text: string, toAscii: (input: string) => string): void,
  18. getPublicSuffix(hostname: string): string,
  19. getDomain(hostname: string): string,
  20. suffixInPSL(hostname: string): boolean,
  21. toSelfie(encoder?: null | Encoder): Selfie,
  22. fromSelfie(selfie: Selfie, decoder?: null | Decoder): boolean,
  23. enableWASM(options?: {
  24. customFetch?: null | ((url: URL) => Promise<Blob>)
  25. }): Promise<boolean>,
  26. disableWASM(): Promise<boolean>
  27. }
  28. const psl: PublicSuffixList;
  29. export default psl;
  30. }