@url-sanitize/cli 1.0.0 → 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/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # @url-sanitize/cli
2
2
 
3
- Command-line tool for removing tracking parameters and unwrapping tracking redirects from URLs.
3
+ Command-line tool for removing tracking parameters and unwrapping tracking redirects from URLs with the merged multi-source catalog.
4
+
5
+ The default catalog combines ClearURLs, AdGuard URL Tracking Protection, Brave
6
+ Debouncer, and Firefox Query Stripping rules.
4
7
 
5
8
  ## Install
6
9
 
package/dist/bin.js CHANGED
@@ -3,8 +3,8 @@
3
3
  // src/bin.ts
4
4
  import { readFileSync } from "fs";
5
5
  import { createRequire } from "module";
6
- import { clearurlsCatalog, clearurlsMetadata } from "@url-sanitize/clearurls";
7
6
  import { compileSanitizer } from "@url-sanitize/core";
7
+ import { mergedCatalog, mergedMetadata } from "@url-sanitize/merged";
8
8
  var args = process.argv.slice(2);
9
9
  runTypeScriptCli(args);
10
10
  function runTypeScriptCli(rawArgs) {
@@ -14,7 +14,7 @@ function runTypeScriptCli(rawArgs) {
14
14
  }
15
15
  if (rawArgs.includes("--version")) {
16
16
  process.stdout.write(
17
- `url-sanitize ${packageVersion()} (catalog ${clearurlsMetadata.hash} ${clearurlsMetadata.fetchedAt})
17
+ `url-sanitize ${packageVersion()} (catalog ${catalogHash()} ${mergedMetadata.generatedAt})
18
18
  `
19
19
  );
20
20
  process.exit(0);
@@ -26,7 +26,7 @@ function runTypeScriptCli(rawArgs) {
26
26
  process.stderr.write("run `url-sanitize --help` for usage\n");
27
27
  process.exit(1);
28
28
  }
29
- const sanitize = compileSanitizer(clearurlsCatalog, parsed.options);
29
+ const sanitize = compileSanitizer(mergedCatalog, parsed.options);
30
30
  let anyBlocked = false;
31
31
  for (const url of parsed.urls) {
32
32
  anyBlocked = emit(sanitize(url), parsed.json, parsed.explain) || anyBlocked;
@@ -148,12 +148,16 @@ function packageVersion() {
148
148
  const pkg = require2("../package.json");
149
149
  return pkg.version ?? "0.0.0";
150
150
  }
151
+ function catalogHash() {
152
+ const hashes = mergedCatalog.sources.map((source) => source.hash).filter(Boolean).join(":");
153
+ return hashes || mergedCatalog.version;
154
+ }
151
155
  function printHelp(stream) {
152
156
  stream.write(
153
157
  [
154
- `url-sanitize ${packageVersion()} (catalog ${clearurlsMetadata.hash} ${clearurlsMetadata.fetchedAt})`,
158
+ `url-sanitize ${packageVersion()} (catalog ${catalogHash()} ${mergedMetadata.generatedAt})`,
155
159
  "",
156
- "Strip tracking parameters from URLs.",
160
+ "Strip tracking parameters from URLs with the merged multi-source catalog.",
157
161
  "",
158
162
  "USAGE:",
159
163
  " url-sanitize [OPTIONS] [URL]...",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@url-sanitize/cli",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Command-line tool to remove tracking parameters and unwrap tracking redirects from URLs.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,8 +11,8 @@
11
11
  "dist"
12
12
  ],
13
13
  "dependencies": {
14
- "@url-sanitize/clearurls": "1.0.0",
15
- "@url-sanitize/core": "1.0.0"
14
+ "@url-sanitize/core": "2.0.0",
15
+ "@url-sanitize/merged": "2.0.0"
16
16
  },
17
17
  "keywords": [
18
18
  "cli",