fop-cli 3.9.4 → 3.9.6
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 +47 -5
- package/install.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,15 +6,36 @@ A Rust port of the EasyList FOP tool for sorting and cleaning ad-blocking filter
|
|
|
6
6
|
|
|
7
7
|
- **Filter sorting**: Alphabetically sorts blocking rules and element hiding rules
|
|
8
8
|
- **Domain combining**: Merges rules with identical selectors/patterns but different domains
|
|
9
|
-
- **Option normalization**: Converts uBO-specific options to standard ABP format
|
|
9
|
+
- **Option normalization**: Converts uBO-specific options to standard ABP format (can be disabled)
|
|
10
10
|
- **Wildcard cleanup**: Removes unnecessary wildcards from filters
|
|
11
11
|
- **Validation**: Removes invalid/overly-broad rules (TLD-only, too short, etc.)
|
|
12
|
-
- **Git
|
|
12
|
+
- **Git integration**: Commit changes directly to repositories (can be disabled)
|
|
13
13
|
- **easylist_adservers.txt validation**: Ensures rules start with `|` or `/`
|
|
14
|
+
- **Parallel processing**: Uses all CPU cores for faster processing via Rayon
|
|
15
|
+
|
|
16
|
+
## Extended Syntax Support
|
|
17
|
+
|
|
18
|
+
FOP preserves extended filter syntax from various adblockers:
|
|
19
|
+
|
|
20
|
+
### uBlock Origin
|
|
21
|
+
- Scriptlet injection: `##+js(...)`, `##^script:has-text(...)`
|
|
22
|
+
- Procedural cosmetics: `:has-text()`, `:has()`, `:upward()`, `:remove()`, `:style()`, `:matches-css()`, `:xpath()`, `:remove-attr()`, `:remove-class()`, `:watch-attr()`, `:min-text-length()`, `:others()`
|
|
23
|
+
- Network options: `redirect=`, `redirect-rule=`, `removeparam=`, `denyallow=`, `replace=`, `header=`, `permissions=`, `to=`, `from=`, `method=`
|
|
24
|
+
- Regex domain rules: `/regex/##+js(...)`
|
|
25
|
+
|
|
26
|
+
### AdGuard
|
|
27
|
+
- Scriptlet injection: `#%#//scriptlet(...)`
|
|
28
|
+
- CSS injection: `#$#body { ... }`
|
|
29
|
+
- Exceptions: `#@%#`, `#@$#`
|
|
30
|
+
|
|
31
|
+
### Adblock Plus
|
|
32
|
+
- Extended selectors: `:-abp-has()`, `:-abp-contains()`, `:-abp-properties()`
|
|
33
|
+
- Action syntax: `{remove: true;}`, `{height:...}`, `{display:...}`
|
|
34
|
+
- Snippets: `#$#hide-if-contains`, `#$#simulate-mouse-event`
|
|
14
35
|
|
|
15
36
|
## Requirements
|
|
16
37
|
|
|
17
|
-
- Rust 1.
|
|
38
|
+
- Rust 1.80+ (install from https://rustup.rs)
|
|
18
39
|
|
|
19
40
|
## Building
|
|
20
41
|
|
|
@@ -31,6 +52,14 @@ cargo build --release
|
|
|
31
52
|
|
|
32
53
|
## Installation
|
|
33
54
|
|
|
55
|
+
### From npm (recommended)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install -g fop-cli
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### From source
|
|
62
|
+
|
|
34
63
|
```bash
|
|
35
64
|
# Install to /usr/local/bin (may need sudo)
|
|
36
65
|
make install
|
|
@@ -55,6 +84,9 @@ fop /path/to/easylist
|
|
|
55
84
|
fop --no-commit /path/to/easylist
|
|
56
85
|
fop -n .
|
|
57
86
|
|
|
87
|
+
# Sort without converting uBO options to ABP format
|
|
88
|
+
fop --no-ubo-convert /path/to/ublock-filters
|
|
89
|
+
|
|
58
90
|
# Sort multiple directories
|
|
59
91
|
fop -n ~/easylist ~/easyprivacy ~/fanboy-addon
|
|
60
92
|
```
|
|
@@ -63,8 +95,10 @@ fop -n ~/easylist ~/easyprivacy ~/fanboy-addon
|
|
|
63
95
|
|
|
64
96
|
| Option | Description |
|
|
65
97
|
|--------|-------------|
|
|
66
|
-
| `-n, --no-commit` | Just sort files, skip Git
|
|
98
|
+
| `-n, --no-commit` | Just sort files, skip Git commit prompts |
|
|
67
99
|
| `--just-sort` | Alias for `--no-commit` |
|
|
100
|
+
| `--no-ubo-convert` | Skip uBO to ABP option conversion (keep `xhr`, `3p`, `1p`, etc.) |
|
|
101
|
+
| `--no-msg-check` | Skip commit message format validation (M:/A:/P:) |
|
|
68
102
|
| `-h, --help` | Show help message |
|
|
69
103
|
| `-V, --version` | Show version number |
|
|
70
104
|
|
|
@@ -98,6 +132,14 @@ This Rust version is a drop-in replacement for both `FOP.py` and `FOP-nocommit.p
|
|
|
98
132
|
| `python3 FOP.py` | `fop` |
|
|
99
133
|
| `python3 FOP-nocommit.py` | `fop --no-commit` or `fop -n` |
|
|
100
134
|
|
|
135
|
+
## Performance
|
|
136
|
+
|
|
137
|
+
The Rust version is significantly faster than Python FOP due to:
|
|
138
|
+
- Compiled native code
|
|
139
|
+
- Parallel file processing with Rayon
|
|
140
|
+
- Optimized regex handling
|
|
141
|
+
- Efficient memory management
|
|
142
|
+
|
|
101
143
|
## License
|
|
102
144
|
|
|
103
145
|
GPL-3.0 (same as original Python FOP)
|
|
@@ -105,4 +147,4 @@ GPL-3.0 (same as original Python FOP)
|
|
|
105
147
|
## Credits
|
|
106
148
|
|
|
107
149
|
- Original Python FOP by Michael (EasyList project)
|
|
108
|
-
- Rust port maintains feature parity with Python version 3.9
|
|
150
|
+
- Rust port maintains feature parity with Python version 3.9
|
package/install.js
CHANGED
|
@@ -7,16 +7,16 @@ const path = require('path');
|
|
|
7
7
|
const { execSync } = require('child_process');
|
|
8
8
|
|
|
9
9
|
// Configuration - UPDATE THESE FOR YOUR RELEASE
|
|
10
|
-
const VERSION = '3.9.
|
|
10
|
+
const VERSION = '3.9.6';
|
|
11
11
|
const GITHUB_REPO = 'ryanbr/fop-rs'; // Change to your repo
|
|
12
12
|
const BINARY_NAME = 'fop';
|
|
13
13
|
|
|
14
14
|
// Platform mapping
|
|
15
15
|
const PLATFORMS = {
|
|
16
|
-
'darwin-x64':
|
|
17
|
-
'darwin-arm64':
|
|
18
|
-
'linux-x64':
|
|
19
|
-
'linux-arm64':
|
|
16
|
+
'darwin-x64': `-macos-x86_64`,
|
|
17
|
+
'darwin-arm64': `-macos-arm64`,
|
|
18
|
+
'linux-x64': `-linux-x86_64`,
|
|
19
|
+
'linux-arm64': `-linux-arm64`,
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
function getPlatformBinary() {
|
|
@@ -24,14 +24,14 @@ function getPlatformBinary() {
|
|
|
24
24
|
const arch = process.arch;
|
|
25
25
|
const key = `${platform}-${arch}`;
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
27
|
+
const suffix = PLATFORMS[key];
|
|
28
|
+
if (!suffix) {
|
|
29
29
|
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
30
30
|
console.error('Supported platforms:', Object.keys(PLATFORMS).join(', '));
|
|
31
31
|
process.exit(1);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
return
|
|
34
|
+
return `fop-${VERSION}${suffix}`;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function getDownloadUrl(binaryName) {
|