uri.all.min.d.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. export interface URIComponents {
  2. scheme?: string;
  3. userinfo?: string;
  4. host?: string;
  5. port?: number | string;
  6. path?: string;
  7. query?: string;
  8. fragment?: string;
  9. reference?: string;
  10. error?: string;
  11. }
  12. export interface URIOptions {
  13. scheme?: string;
  14. reference?: string;
  15. tolerant?: boolean;
  16. absolutePath?: boolean;
  17. iri?: boolean;
  18. unicodeSupport?: boolean;
  19. domainHost?: boolean;
  20. }
  21. export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
  22. scheme: string;
  23. parse(components: ParentComponents, options: Options): Components;
  24. serialize(components: Components, options: Options): ParentComponents;
  25. unicodeSupport?: boolean;
  26. domainHost?: boolean;
  27. absolutePath?: boolean;
  28. }
  29. export interface URIRegExps {
  30. NOT_SCHEME: RegExp;
  31. NOT_USERINFO: RegExp;
  32. NOT_HOST: RegExp;
  33. NOT_PATH: RegExp;
  34. NOT_PATH_NOSCHEME: RegExp;
  35. NOT_QUERY: RegExp;
  36. NOT_FRAGMENT: RegExp;
  37. ESCAPE: RegExp;
  38. UNRESERVED: RegExp;
  39. OTHER_CHARS: RegExp;
  40. PCT_ENCODED: RegExp;
  41. IPV4ADDRESS: RegExp;
  42. IPV6ADDRESS: RegExp;
  43. }
  44. export declare const SCHEMES: {
  45. [scheme: string]: URISchemeHandler;
  46. };
  47. export declare function pctEncChar(chr: string): string;
  48. export declare function pctDecChars(str: string): string;
  49. export declare function parse(uriString: string, options?: URIOptions): URIComponents;
  50. export declare function removeDotSegments(input: string): string;
  51. export declare function serialize(components: URIComponents, options?: URIOptions): string;
  52. export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents;
  53. export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string;
  54. export declare function normalize(uri: string, options?: URIOptions): string;
  55. export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents;
  56. export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean;
  57. export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean;
  58. export declare function escapeComponent(str: string, options?: URIOptions): string;
  59. export declare function unescapeComponent(str: string, options?: URIOptions): string;