@url-sanitize/cli 0.1.4 → 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.
Files changed (3) hide show
  1. package/README.md +5 -2
  2. package/dist/bin.js +10 -6
  3. package/package.json +3 -3
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
 
@@ -26,7 +29,7 @@ printf '%s\n' "https://example.com/?utm_source=x" | url-sanitize -
26
29
  The npm CLI is pure TypeScript so it installs without native package setup. For
27
30
  the smallest standalone binary, use `cargo install url-sanitize` or the GitHub
28
31
  Release installer from the root README. For OS-specific native install commands,
29
- see the [install guide](https://github.com/antonio-orionus/url-sanitize/blob/main/docs/install.md).
32
+ see the [root README](https://github.com/antonio-orionus/url-sanitize#install).
30
33
 
31
34
  ## License
32
35
 
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})`,
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]...",
@@ -168,7 +172,7 @@ function printHelp(stream) {
168
172
  " --unwrap-redirects Unwrap redirector URLs (default)",
169
173
  " --no-unwrap-redirects Leave redirector URLs untouched",
170
174
  " --block-domains Emit blocked for domain-blocked URLs",
171
- " --version Print version + catalog hash",
175
+ " --version Print version + catalog hash/date",
172
176
  " -h, --help Show this help",
173
177
  "",
174
178
  "Runtime: TypeScript",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@url-sanitize/cli",
3
- "version": "0.1.4",
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": "0.1.4",
15
- "@url-sanitize/core": "0.1.4"
14
+ "@url-sanitize/core": "2.0.0",
15
+ "@url-sanitize/merged": "2.0.0"
16
16
  },
17
17
  "keywords": [
18
18
  "cli",