url-sanitizer 5.2.1 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,18 @@
1
+ export type DOMPurify = import('dompurify').DOMPurify;
2
+ export type InspectedDataURL = import('../index.js').InspectedDataURL;
3
+ export type InspectedURLResult = import('../index.js').InspectedURLResult;
4
+ export type SanitizeOptions = import('../index.js').SanitizeOptions;
5
+ export type InternalSanitizeOptions = import('./sanitize.js').InternalSanitizeOptions;
1
6
  export declare class SanitizeContext {
2
7
  #private;
3
- domPurify: object;
8
+ domPurify: import("dompurify").DOMPurify;
4
9
  nest: number;
5
10
  recurse: Set<any>;
6
11
  restrictScheme: boolean;
7
12
  schemeMap: Map<string, boolean>;
8
13
  allowRelative: boolean | undefined;
9
14
  debug: boolean | undefined;
10
- schemes: Set<any> | undefined;
11
- constructor(opt: object, domPurifyInstance: object);
15
+ constructor(domPurifyInstance: DOMPurify, opt?: InternalSanitizeOptions);
12
16
  private #compileRules;
13
17
  private #registerScheme;
14
18
  enter(url: string): boolean;
@@ -16,13 +20,13 @@ export declare class SanitizeContext {
16
20
  }
17
21
  export declare class SanitizeFilter {
18
22
  #private;
19
- constructor(options: object);
23
+ constructor(opt?: InternalSanitizeOptions);
20
24
  private #process;
21
25
  private #sanitizeDataURL;
22
26
  private #purify;
23
27
  private #handleSanitizeAttribute;
24
28
  private #sanitizeStandardURL;
25
- sanitize(url: string, options?: object): string | null;
26
- sanitizeBuffer(buffer: ArrayBuffer, mimeType: string, options?: object): Promise<string | null>;
27
- sanitizeDataURL(url: string, options?: object): Promise<string | null>;
29
+ sanitize(url: string, opt?: InternalSanitizeOptions): string | null;
30
+ sanitizeBuffer(buffer: ArrayBuffer, mimeType: string, opt?: InternalSanitizeOptions): Promise<string | null>;
31
+ sanitizeDataURL(url: string, opt?: InternalSanitizeOptions): Promise<string | null>;
28
32
  }
@@ -1,26 +1,9 @@
1
1
  import { URISchemes } from './scheme.js';
2
- export type InspectedDataURL = {
3
- base64: boolean;
4
- data: string;
5
- mime: string;
6
- };
7
- export type InspectedURLResult = {
8
- input: string;
9
- valid: boolean;
10
- href: string | null;
11
- relative?: boolean;
12
- reason?: string;
13
- data?: InspectedDataURL | null;
14
- origin?: string;
15
- protocol?: string;
16
- username?: string;
17
- password?: string;
18
- host?: string;
19
- hostname?: string;
20
- port?: string;
21
- pathname?: string;
22
- search?: string;
23
- hash?: string;
2
+ export type InspectedDataURL = import('../index.js').InspectedDataURL;
3
+ export type InspectedURLResult = import('../index.js').InspectedURLResult;
4
+ export type SanitizeOptions = import('../index.js').SanitizeOptions;
5
+ export type InternalSanitizeOptions = SanitizeOptions & {
6
+ schemes?: Set<string>;
24
7
  };
25
8
  export declare class URLSanitizer extends URISchemes {
26
9
  #private;
@@ -33,25 +16,8 @@ export declare class URLSanitizer extends URISchemes {
33
16
  add(scheme: string): string[];
34
17
  remove(scheme: string): boolean;
35
18
  reset(): void;
36
- sanitizeURL(url: string, opt?: {
37
- allow?: string[];
38
- deny?: string[];
39
- only?: string[];
40
- allowRelative?: boolean;
41
- debug?: boolean;
42
- revokeObjectURL?: boolean;
43
- maxBlobSize?: number;
44
- maxLength?: number;
45
- }): Promise<string | null>;
46
- sanitizeURLSync(url: string, opt?: {
47
- allow?: string[];
48
- deny?: string[];
49
- only?: string[];
50
- allowRelative?: boolean;
51
- debug?: boolean;
52
- revokeObjectURL?: boolean;
53
- maxLength?: number;
54
- }): string | null;
19
+ sanitizeURL(url: string, opt?: SanitizeOptions): Promise<string | null>;
20
+ sanitizeURLSync(url: string, opt?: SanitizeOptions): string | null;
55
21
  inspectURL(url: string): Promise<InspectedURLResult>;
56
22
  isValidURI(uri: string): boolean;
57
23
  }