@url-sanitize/clearurls 2.0.3 → 2.0.5

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.
package/dist/adapter.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { SanitizerCatalog } from '@url-sanitize/core';
2
- import { ClearUrlsData, ClearUrlsMetadata } from './types.js';
3
-
4
- declare function clearurlsToCatalog(data: ClearUrlsData, meta: ClearUrlsMetadata): SanitizerCatalog;
5
-
6
- export { clearurlsToCatalog };
1
+ import { ClearUrlsData, ClearUrlsMetadata } from "./types.js";
2
+ import { SanitizerCatalog } from "@url-sanitize/core";
3
+ //#region src/adapter.d.ts
4
+ export declare function clearurlsToCatalog(data: ClearUrlsData, meta: ClearUrlsMetadata): SanitizerCatalog;
5
+ //#endregion
package/dist/adapter.js CHANGED
@@ -1,6 +1,67 @@
1
- import {
2
- clearurlsToCatalog
3
- } from "./chunk-43SRPR7A.js";
4
- export {
5
- clearurlsToCatalog
6
- };
1
+ //#region src/adapter.ts
2
+ function clearurlsToCatalog(data, meta) {
3
+ const rules = [];
4
+ for (const [name, provider] of Object.entries(data.providers)) {
5
+ const exceptions = provider.exceptions ?? [];
6
+ if (provider.completeProvider) {
7
+ rules.push({
8
+ kind: "block-domain",
9
+ source: "clearurls",
10
+ provider: name,
11
+ urlPattern: provider.urlPattern,
12
+ exceptions
13
+ });
14
+ continue;
15
+ }
16
+ for (const pattern of provider.rawRules ?? []) rules.push({
17
+ kind: "raw-replace",
18
+ source: "clearurls",
19
+ provider: name,
20
+ urlPattern: provider.urlPattern,
21
+ pattern,
22
+ replacement: "",
23
+ exceptions
24
+ });
25
+ for (const pattern of provider.redirections ?? []) rules.push({
26
+ kind: "unwrap-redirect",
27
+ source: "clearurls",
28
+ provider: name,
29
+ urlPattern: provider.urlPattern,
30
+ pattern,
31
+ captureGroup: 1,
32
+ exceptions
33
+ });
34
+ for (const paramPattern of provider.rules ?? []) rules.push({
35
+ kind: "strip-param",
36
+ source: "clearurls",
37
+ provider: name,
38
+ urlPattern: provider.urlPattern,
39
+ paramPattern,
40
+ exceptions,
41
+ isReferralMarketing: false
42
+ });
43
+ for (const paramPattern of provider.referralMarketing ?? []) rules.push({
44
+ kind: "strip-param",
45
+ source: "clearurls",
46
+ provider: name,
47
+ urlPattern: provider.urlPattern,
48
+ paramPattern,
49
+ exceptions,
50
+ isReferralMarketing: true
51
+ });
52
+ }
53
+ return {
54
+ version: meta.version,
55
+ generatedAt: meta.fetchedAt,
56
+ sources: [{
57
+ name: "clearurls",
58
+ version: meta.version,
59
+ hash: meta.hash,
60
+ license: "LGPL-3.0-only",
61
+ upstream: meta.upstream
62
+ }],
63
+ rules
64
+ };
65
+ }
66
+ //#endregion
67
+ export { clearurlsToCatalog };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { SanitizerCatalog, Sanitizer } from '@url-sanitize/core';
2
- export { clearurlsToCatalog } from './adapter.js';
3
- import { ClearUrlsMetadata } from './types.js';
4
- export { ClearUrlsData, ClearUrlsProvider } from './types.js';
5
-
6
- declare const clearurlsCatalog: SanitizerCatalog;
7
- declare const clearurlsMetadata: ClearUrlsMetadata;
8
- declare const sanitize: Sanitizer;
9
-
10
- export { ClearUrlsMetadata, clearurlsCatalog, clearurlsMetadata, sanitize };
1
+ import { ClearUrlsData, ClearUrlsMetadata, ClearUrlsProvider } from "./types.js";
2
+ import { clearurlsToCatalog } from "./adapter.js";
3
+ import { Sanitizer, SanitizerCatalog } from "@url-sanitize/core";
4
+ //#region src/index.d.ts
5
+ export declare const clearurlsCatalog: SanitizerCatalog;
6
+ export declare const clearurlsMetadata: ClearUrlsMetadata;
7
+ export declare const sanitize: Sanitizer;
8
+ //#endregion
9
+ export { type ClearUrlsData, type ClearUrlsMetadata, type ClearUrlsProvider, clearurlsToCatalog };
package/dist/index.js CHANGED
@@ -1,22 +1,9 @@
1
- import {
2
- clearurlsToCatalog
3
- } from "./chunk-43SRPR7A.js";
4
- import {
5
- data_default,
6
- metadata_default
7
- } from "./chunk-TAQSU2JX.js";
8
-
9
- // src/index.ts
1
+ import { n as data_default, t as metadata_default } from "./metadata-DH5nhI6x.js";
2
+ import { clearurlsToCatalog } from "./adapter.js";
10
3
  import { compileSanitizer } from "@url-sanitize/core";
11
- var clearurlsCatalog = clearurlsToCatalog(
12
- data_default,
13
- metadata_default
14
- );
15
- var clearurlsMetadata = metadata_default;
16
- var sanitize = compileSanitizer(clearurlsCatalog);
17
- export {
18
- clearurlsCatalog,
19
- clearurlsMetadata,
20
- clearurlsToCatalog,
21
- sanitize
22
- };
4
+ //#region src/index.ts
5
+ const clearurlsCatalog = clearurlsToCatalog(data_default, metadata_default);
6
+ const clearurlsMetadata = metadata_default;
7
+ const sanitize = compileSanitizer(clearurlsCatalog);
8
+ //#endregion
9
+ export { clearurlsCatalog, clearurlsMetadata, clearurlsToCatalog, sanitize };