@url-sanitize/firefox 2.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Antonio Orionus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ This package bundles Firefox Query Stripping records from Mozilla Remote Settings:
2
+
3
+ https://firefox.settings.services.mozilla.com/v1/buckets/main/collections/query-stripping/records
4
+
5
+ The bundled data is licensed MPL-2.0 by its upstream maintainers.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @url-sanitize/firefox
2
+
3
+ Firefox Query Stripping catalog and adapter for [`@url-sanitize/core`](../core).
4
+
5
+ Ships a pinned snapshot of Mozilla Remote Settings query-stripping records:
6
+
7
+ ```text
8
+ https://firefox.settings.services.mozilla.com/v1/buckets/main/collections/query-stripping/records
9
+ ```
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install @url-sanitize/core @url-sanitize/firefox
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { compileSanitizer } from '@url-sanitize/core';
21
+ import { firefoxCatalog } from '@url-sanitize/firefox';
22
+
23
+ const sanitize = compileSanitizer(firefoxCatalog);
24
+ sanitize('https://example.com/?wbraid=x&id=123');
25
+ ```
26
+
27
+ ## Raw access
28
+
29
+ ```ts
30
+ import { firefoxRawData, firefoxMetadata } from '@url-sanitize/firefox/raw';
31
+ import { firefoxToCatalog } from '@url-sanitize/firefox/adapter';
32
+ ```
33
+
34
+ ## License
35
+
36
+ Adapter code is project code. Bundled Firefox Query Stripping data is
37
+ **MPL-2.0**. See [NOTICE](NOTICE).
package/data/data.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "schema": 1694684344305,
5
+ "allowList": [
6
+ "googleadservices.com"
7
+ ],
8
+ "stripList": [],
9
+ "id": "a61d2791-d7e1-42e6-9824-0dbe69c33b97",
10
+ "last_modified": 1694689843914
11
+ },
12
+ {
13
+ "schema": 1678379807899,
14
+ "allowList": [],
15
+ "stripList": [
16
+ "gclid",
17
+ "dclid",
18
+ "msclkid",
19
+ "_openstat",
20
+ "yclid",
21
+ "wickedid",
22
+ "twclid",
23
+ "_hsenc",
24
+ "__hssc",
25
+ "__hstc",
26
+ "__hsfp",
27
+ "hsctatracking",
28
+ "wbraid",
29
+ "gbraid",
30
+ "ysclid"
31
+ ],
32
+ "id": "85078bad-f31e-4d93-bb8a-81088b25d6dd",
33
+ "last_modified": 1678736907773
34
+ },
35
+ {
36
+ "schema": 1649695008608,
37
+ "allowList": [],
38
+ "stripList": [
39
+ "mc_eid",
40
+ "oly_anon_id",
41
+ "oly_enc_id",
42
+ "__s",
43
+ "vero_id",
44
+ "_hsenc",
45
+ "mkt_tok",
46
+ "fbclid"
47
+ ],
48
+ "id": "76495cfc-fac9-4079-9b5f-9ff0784484de",
49
+ "last_modified": 1649762862679
50
+ }
51
+ ]
52
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": "61578ba740b7",
3
+ "hash": "61578ba740b7bb0e9b5450eab725dd3b7be8995ba42633d9d46825745f9e0c7d",
4
+ "fetchedAt": "2026-06-03T17:40:39.112Z",
5
+ "upstream": "https://firefox.settings.services.mozilla.com/v1/buckets/main/collections/query-stripping/records",
6
+ "license": "MPL-2.0"
7
+ }
@@ -0,0 +1,6 @@
1
+ import { SanitizerCatalog } from '@url-sanitize/core';
2
+ import { FirefoxQueryStrippingData, FirefoxMetadata } from './types.js';
3
+
4
+ declare function firefoxToCatalog(data: FirefoxQueryStrippingData, meta: FirefoxMetadata): SanitizerCatalog;
5
+
6
+ export { firefoxToCatalog };
@@ -0,0 +1,43 @@
1
+ // src/adapter.ts
2
+ function firefoxToCatalog(data, meta) {
3
+ const rules = [];
4
+ for (const record of data.data) {
5
+ if (record.filter_expression) {
6
+ throw new Error(`Unsupported Firefox filter_expression in record ${record.id}`);
7
+ }
8
+ const exceptions = record.allowList.map(domainPattern);
9
+ for (const param of record.stripList) {
10
+ rules.push({
11
+ kind: "strip-param",
12
+ source: "firefox",
13
+ provider: `firefox-${record.id}`,
14
+ paramPattern: escapeRegExp(param),
15
+ exceptions
16
+ });
17
+ }
18
+ }
19
+ return {
20
+ version: meta.version,
21
+ generatedAt: meta.fetchedAt,
22
+ sources: [
23
+ {
24
+ name: "firefox",
25
+ version: meta.version,
26
+ hash: meta.hash,
27
+ license: meta.license,
28
+ upstream: meta.upstream
29
+ }
30
+ ],
31
+ rules
32
+ };
33
+ }
34
+ function domainPattern(domain) {
35
+ const escaped = escapeRegExp(domain);
36
+ return `^https?:\\/\\/([^/?#]+\\.)?${escaped}(?::[0-9]+)?(?:[/?#]|$)`;
37
+ }
38
+ function escapeRegExp(value) {
39
+ return value.replace(/[|\\{}()[\]^$+?.*]/g, "\\$&");
40
+ }
41
+ export {
42
+ firefoxToCatalog
43
+ };
@@ -0,0 +1,67 @@
1
+ // data/data.json
2
+ var data_default = {
3
+ data: [
4
+ {
5
+ schema: 1694684344305,
6
+ allowList: [
7
+ "googleadservices.com"
8
+ ],
9
+ stripList: [],
10
+ id: "a61d2791-d7e1-42e6-9824-0dbe69c33b97",
11
+ last_modified: 1694689843914
12
+ },
13
+ {
14
+ schema: 1678379807899,
15
+ allowList: [],
16
+ stripList: [
17
+ "gclid",
18
+ "dclid",
19
+ "msclkid",
20
+ "_openstat",
21
+ "yclid",
22
+ "wickedid",
23
+ "twclid",
24
+ "_hsenc",
25
+ "__hssc",
26
+ "__hstc",
27
+ "__hsfp",
28
+ "hsctatracking",
29
+ "wbraid",
30
+ "gbraid",
31
+ "ysclid"
32
+ ],
33
+ id: "85078bad-f31e-4d93-bb8a-81088b25d6dd",
34
+ last_modified: 1678736907773
35
+ },
36
+ {
37
+ schema: 1649695008608,
38
+ allowList: [],
39
+ stripList: [
40
+ "mc_eid",
41
+ "oly_anon_id",
42
+ "oly_enc_id",
43
+ "__s",
44
+ "vero_id",
45
+ "_hsenc",
46
+ "mkt_tok",
47
+ "fbclid"
48
+ ],
49
+ id: "76495cfc-fac9-4079-9b5f-9ff0784484de",
50
+ last_modified: 1649762862679
51
+ }
52
+ ]
53
+ };
54
+
55
+ // data/metadata.json
56
+ var metadata_default = {
57
+ version: "61578ba740b7",
58
+ hash: "61578ba740b7bb0e9b5450eab725dd3b7be8995ba42633d9d46825745f9e0c7d",
59
+ fetchedAt: "2026-06-03T17:40:39.112Z",
60
+ upstream: "https://firefox.settings.services.mozilla.com/v1/buckets/main/collections/query-stripping/records",
61
+ license: "MPL-2.0"
62
+ };
63
+
64
+ export {
65
+ data_default,
66
+ metadata_default
67
+ };
@@ -0,0 +1,9 @@
1
+ import { SanitizerCatalog, Sanitizer } from '@url-sanitize/core';
2
+ export { firefoxToCatalog } from './adapter.js';
3
+ export { firefoxMetadata, firefoxRawData } from './raw.js';
4
+ export { FirefoxMetadata, FirefoxQueryStrippingData, FirefoxQueryStrippingRecord } from './types.js';
5
+
6
+ declare const firefoxCatalog: SanitizerCatalog;
7
+ declare const sanitize: Sanitizer;
8
+
9
+ export { firefoxCatalog, sanitize };
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ import {
2
+ data_default,
3
+ metadata_default
4
+ } from "./chunk-ASRH34YB.js";
5
+
6
+ // src/index.ts
7
+ import { compileSanitizer } from "@url-sanitize/core";
8
+
9
+ // src/adapter.js
10
+ function firefoxToCatalog(data, meta) {
11
+ const rules = [];
12
+ for (const record of data.data) {
13
+ if (record.filter_expression) {
14
+ throw new Error(`Unsupported Firefox filter_expression in record ${record.id}`);
15
+ }
16
+ const exceptions = record.allowList.map(domainPattern);
17
+ for (const param of record.stripList) {
18
+ rules.push({
19
+ kind: "strip-param",
20
+ source: "firefox",
21
+ provider: `firefox-${record.id}`,
22
+ paramPattern: escapeRegExp(param),
23
+ exceptions
24
+ });
25
+ }
26
+ }
27
+ return {
28
+ version: meta.version,
29
+ generatedAt: meta.fetchedAt,
30
+ sources: [
31
+ {
32
+ name: "firefox",
33
+ version: meta.version,
34
+ hash: meta.hash,
35
+ license: meta.license,
36
+ upstream: meta.upstream
37
+ }
38
+ ],
39
+ rules
40
+ };
41
+ }
42
+ function domainPattern(domain) {
43
+ const escaped = escapeRegExp(domain);
44
+ return `^https?:\\/\\/([^/?#]+\\.)?${escaped}(?::[0-9]+)?(?:[/?#]|$)`;
45
+ }
46
+ function escapeRegExp(value) {
47
+ return value.replace(/[|\\{}()[\]^$+?.*]/g, "\\$&");
48
+ }
49
+
50
+ // src/raw.js
51
+ var firefoxRawData = data_default;
52
+ var firefoxMetadata = metadata_default;
53
+
54
+ // src/index.ts
55
+ var firefoxCatalog = firefoxToCatalog(firefoxRawData, firefoxMetadata);
56
+ var sanitize = compileSanitizer(firefoxCatalog);
57
+ export {
58
+ firefoxCatalog,
59
+ firefoxMetadata,
60
+ firefoxRawData,
61
+ firefoxToCatalog,
62
+ sanitize
63
+ };
package/dist/raw.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { FirefoxMetadata, FirefoxQueryStrippingData } from './types.js';
2
+
3
+ declare const firefoxRawData: FirefoxQueryStrippingData;
4
+ declare const firefoxMetadata: FirefoxMetadata;
5
+
6
+ export { firefoxMetadata, firefoxRawData };
package/dist/raw.js ADDED
@@ -0,0 +1,12 @@
1
+ import {
2
+ data_default,
3
+ metadata_default
4
+ } from "./chunk-ASRH34YB.js";
5
+
6
+ // src/raw.ts
7
+ var firefoxRawData = data_default;
8
+ var firefoxMetadata = metadata_default;
9
+ export {
10
+ firefoxMetadata,
11
+ firefoxRawData
12
+ };
@@ -0,0 +1,20 @@
1
+ interface FirefoxQueryStrippingRecord {
2
+ allowList: string[];
3
+ filter_expression?: string;
4
+ id: string;
5
+ last_modified: number;
6
+ schema: number;
7
+ stripList: string[];
8
+ }
9
+ interface FirefoxQueryStrippingData {
10
+ data: FirefoxQueryStrippingRecord[];
11
+ }
12
+ interface FirefoxMetadata {
13
+ version: string;
14
+ hash: string;
15
+ fetchedAt: string;
16
+ upstream: string;
17
+ license: string;
18
+ }
19
+
20
+ export type { FirefoxMetadata, FirefoxQueryStrippingData, FirefoxQueryStrippingRecord };
package/dist/types.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@url-sanitize/firefox",
3
+ "version": "2.0.0",
4
+ "description": "Firefox Query Stripping catalog adapter for @url-sanitize/core.",
5
+ "license": "MPL-2.0",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./adapter": {
16
+ "types": "./dist/adapter.d.ts",
17
+ "import": "./dist/adapter.js"
18
+ },
19
+ "./raw": {
20
+ "types": "./dist/raw.d.ts",
21
+ "import": "./dist/raw.js"
22
+ },
23
+ "./types": {
24
+ "types": "./dist/types.d.ts",
25
+ "import": "./dist/types.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "data",
31
+ "NOTICE"
32
+ ],
33
+ "dependencies": {
34
+ "@url-sanitize/core": "2.0.0"
35
+ },
36
+ "keywords": [
37
+ "firefox",
38
+ "query-stripping",
39
+ "url",
40
+ "tracking",
41
+ "privacy"
42
+ ],
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://github.com/antonio-orionus/url-sanitize.git",
49
+ "directory": "packages/firefox"
50
+ },
51
+ "sideEffects": false,
52
+ "scripts": {
53
+ "build": "tsup src/index.ts src/raw.ts src/adapter.ts src/types.ts --format esm --dts --clean",
54
+ "dev": "tsup src/index.ts src/raw.ts src/adapter.ts src/types.ts --format esm --dts --watch"
55
+ }
56
+ }