purifai 3.0.0 → 3.0.2
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/DISCLAIMER.md +34 -0
- package/LICENSE +1 -28
- package/README.md +193 -151
- package/benchmark/results/v3.json +1334 -1334
- package/docs/benchmarks/v3.md +45 -45
- package/package.json +15 -5
package/docs/benchmarks/v3.md
CHANGED
|
@@ -11,19 +11,19 @@ pnpm run bench
|
|
|
11
11
|
pnpm run bench:check
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
- Run date: 2026-08-
|
|
15
|
-
- Runtime: v24.
|
|
14
|
+
- Run date: 2026-08-30T19:22:56.884Z
|
|
15
|
+
- Runtime: v24.16.0
|
|
16
16
|
- Platform: darwin arm64
|
|
17
17
|
- CPU: Apple M1 (8 logical cores)
|
|
18
18
|
- Memory: 8192.00 MiB
|
|
19
|
-
- Packages: purifai 3.0.
|
|
19
|
+
- Packages: purifai 3.0.2, striptags 3.2.0, html-to-text 10.0.0
|
|
20
20
|
- Corpus SHA-256: `fe131490fda5dfb290654d3ff7f6f126471362e6debe47e2f0aced0dbad7b4d5`
|
|
21
21
|
|
|
22
22
|
The throughput path uses already-materialized strings for every implementation. Each worker calibrates a batch to at least 100 ms, performs 10 warmup batches, then records 40 batches with `process.hrtime.bigint()`. Median and p95 are nearest-rank values per conversion. Each package/corpus pair runs in a fresh process.
|
|
23
23
|
|
|
24
24
|
The memory path is different by design: Purifai streaming receives lazily generated chunks of at most 16,384 code units, while one-shot tools receive the same logical document after materialization. Each mode runs alone under `node --expose-gc` in 7 fresh processes. The table gates the nearest-rank median of those process peak-RSS values and retains every raw sample in JSON. Purifai one-shot memory is reported separately and is not presented as streaming memory.
|
|
25
25
|
|
|
26
|
-
Artifact: 23,689 bytes for the complete minified ESM runtime at gzip level 9;
|
|
26
|
+
Artifact: 23,689 bytes for the complete minified ESM runtime at gzip level 9; 69,819 bytes for the npm tarball.
|
|
27
27
|
|
|
28
28
|
## Release gates
|
|
29
29
|
|
|
@@ -31,58 +31,58 @@ Artifact: 23,689 bytes for the complete minified ESM runtime at gzip level 9; 68
|
|
|
31
31
|
| --- | --- | --- |
|
|
32
32
|
| reviewed readability fixtures | PASS | Purifai 8/8; striptags 0/8 |
|
|
33
33
|
| non-reader body removal | PASS | Purifai 5/5; striptags script calibration leak observed |
|
|
34
|
-
| hostile-tags hostile p95 | PASS | Purifai 2.
|
|
35
|
-
| hostile-comments hostile p95 | PASS | Purifai
|
|
36
|
-
| hostile-entities hostile p95 | PASS | Purifai 2.
|
|
37
|
-
| hostile-raw hostile p95 | PASS | Purifai 2.
|
|
38
|
-
| readable-large streaming RSS | PASS | Purifai 66.
|
|
39
|
-
| hostile-tags streaming RSS | PASS | Purifai
|
|
40
|
-
| hostile-comments streaming RSS | PASS | Purifai
|
|
41
|
-
| hostile-entities streaming RSS | PASS | Purifai
|
|
42
|
-
| hostile-raw streaming RSS | PASS | Purifai 60.
|
|
34
|
+
| hostile-tags hostile p95 | PASS | Purifai 2.751 ms; html-to-text 3.130 ms |
|
|
35
|
+
| hostile-comments hostile p95 | PASS | Purifai 1.032 ms; html-to-text 1.614 ms |
|
|
36
|
+
| hostile-entities hostile p95 | PASS | Purifai 2.513 ms; html-to-text 3.226 ms |
|
|
37
|
+
| hostile-raw hostile p95 | PASS | Purifai 2.249 ms; html-to-text 2.465 ms |
|
|
38
|
+
| readable-large streaming RSS | PASS | Purifai 66.00 MiB; html-to-text 82.83 MiB |
|
|
39
|
+
| hostile-tags streaming RSS | PASS | Purifai 60.94 MiB; html-to-text 62.55 MiB |
|
|
40
|
+
| hostile-comments streaming RSS | PASS | Purifai 57.98 MiB; html-to-text 63.91 MiB |
|
|
41
|
+
| hostile-entities streaming RSS | PASS | Purifai 59.75 MiB; html-to-text 66.31 MiB |
|
|
42
|
+
| hostile-raw streaming RSS | PASS | Purifai 60.06 MiB; html-to-text 62.55 MiB |
|
|
43
43
|
|
|
44
44
|
## Throughput
|
|
45
45
|
|
|
46
46
|
| Corpus | Package | Median ms | p95 ms | Conversions/sample |
|
|
47
47
|
| --- | --- | ---: | ---: | ---: |
|
|
48
|
-
| readable-small | purifai | 0.019 | 0.
|
|
49
|
-
| readable-small | html-to-text | 0.
|
|
48
|
+
| readable-small | purifai | 0.019 | 0.019 | 16384–16384 |
|
|
49
|
+
| readable-small | html-to-text | 0.188 | 0.196 | 1024–1024 |
|
|
50
50
|
| readable-small | striptags | 0.009 | 0.009 | 32768–32768 |
|
|
51
|
-
| readable-large | purifai | 8.
|
|
52
|
-
| readable-large | html-to-text | 13.
|
|
53
|
-
| readable-large | striptags | 4.
|
|
54
|
-
| hostile-tags | purifai | 2.
|
|
55
|
-
| hostile-tags | html-to-text |
|
|
56
|
-
| hostile-tags | striptags | 2.
|
|
57
|
-
| hostile-comments | purifai | 0.
|
|
58
|
-
| hostile-comments | html-to-text | 1.
|
|
59
|
-
| hostile-comments | striptags | 2.
|
|
60
|
-
| hostile-entities | purifai | 2.
|
|
61
|
-
| hostile-entities | html-to-text |
|
|
62
|
-
| hostile-entities | striptags | 2.
|
|
63
|
-
| hostile-raw | purifai |
|
|
64
|
-
| hostile-raw | html-to-text | 2.
|
|
65
|
-
| hostile-raw | striptags | 1.
|
|
51
|
+
| readable-large | purifai | 8.934 | 9.093 | 32–32 |
|
|
52
|
+
| readable-large | html-to-text | 13.807 | 15.767 | 16–16 |
|
|
53
|
+
| readable-large | striptags | 4.354 | 4.625 | 64–64 |
|
|
54
|
+
| hostile-tags | purifai | 2.714 | 2.751 | 128–128 |
|
|
55
|
+
| hostile-tags | html-to-text | 3.044 | 3.130 | 128–128 |
|
|
56
|
+
| hostile-tags | striptags | 2.361 | 2.822 | 128–128 |
|
|
57
|
+
| hostile-comments | purifai | 0.976 | 1.032 | 256–256 |
|
|
58
|
+
| hostile-comments | html-to-text | 1.539 | 1.614 | 256–256 |
|
|
59
|
+
| hostile-comments | striptags | 2.421 | 3.117 | 128–128 |
|
|
60
|
+
| hostile-entities | purifai | 2.363 | 2.513 | 128–128 |
|
|
61
|
+
| hostile-entities | html-to-text | 3.041 | 3.226 | 128–128 |
|
|
62
|
+
| hostile-entities | striptags | 2.655 | 2.878 | 128–128 |
|
|
63
|
+
| hostile-raw | purifai | 2.143 | 2.249 | 128–128 |
|
|
64
|
+
| hostile-raw | html-to-text | 2.327 | 2.465 | 128–128 |
|
|
65
|
+
| hostile-raw | striptags | 1.869 | 2.024 | 128–128 |
|
|
66
66
|
|
|
67
67
|
## Peak memory
|
|
68
68
|
|
|
69
69
|
| Corpus | Mode | Max RSS MiB | Retained heap MiB |
|
|
70
70
|
| --- | --- | ---: | ---: |
|
|
71
|
-
| readable-large | purifai-stream | 66.
|
|
72
|
-
| readable-large | purifai-one-shot | 67.
|
|
73
|
-
| readable-large | html-to-text | 82.
|
|
74
|
-
| hostile-tags | purifai-stream |
|
|
75
|
-
| hostile-tags | purifai-one-shot | 60.
|
|
76
|
-
| hostile-tags | html-to-text | 62.
|
|
77
|
-
| hostile-comments | purifai-stream |
|
|
78
|
-
| hostile-comments | purifai-one-shot | 58.
|
|
79
|
-
| hostile-comments | html-to-text | 63.
|
|
80
|
-
| hostile-entities | purifai-stream |
|
|
81
|
-
| hostile-entities | purifai-one-shot | 61.
|
|
82
|
-
| hostile-entities | html-to-text | 66.
|
|
83
|
-
| hostile-raw | purifai-stream | 60.
|
|
84
|
-
| hostile-raw | purifai-one-shot |
|
|
85
|
-
| hostile-raw | html-to-text | 62.
|
|
71
|
+
| readable-large | purifai-stream | 66.00 | 1.05 |
|
|
72
|
+
| readable-large | purifai-one-shot | 67.83 | 1.87 |
|
|
73
|
+
| readable-large | html-to-text | 82.83 | 2.46 |
|
|
74
|
+
| hostile-tags | purifai-stream | 60.94 | 0.93 |
|
|
75
|
+
| hostile-tags | purifai-one-shot | 60.72 | 0.88 |
|
|
76
|
+
| hostile-tags | html-to-text | 62.55 | 2.22 |
|
|
77
|
+
| hostile-comments | purifai-stream | 57.98 | 0.91 |
|
|
78
|
+
| hostile-comments | purifai-one-shot | 58.77 | 0.99 |
|
|
79
|
+
| hostile-comments | html-to-text | 63.91 | 2.24 |
|
|
80
|
+
| hostile-entities | purifai-stream | 59.75 | 0.96 |
|
|
81
|
+
| hostile-entities | purifai-one-shot | 61.13 | 1.99 |
|
|
82
|
+
| hostile-entities | html-to-text | 66.31 | 2.69 |
|
|
83
|
+
| hostile-raw | purifai-stream | 60.06 | 0.95 |
|
|
84
|
+
| hostile-raw | purifai-one-shot | 60.77 | 0.92 |
|
|
85
|
+
| hostile-raw | html-to-text | 62.55 | 2.22 |
|
|
86
86
|
|
|
87
87
|
## Interpretation and limits
|
|
88
88
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "purifai",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Bounded streaming conversion from untrusted HTML to readable plain text, with zero dependencies and no DOM.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"docs/benchmarks/v3.md",
|
|
19
19
|
"docs/migration-v3.md",
|
|
20
20
|
"README.md",
|
|
21
|
-
"LICENSE"
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"DISCLAIMER.md"
|
|
22
23
|
],
|
|
23
24
|
"type": "module",
|
|
24
25
|
"sideEffects": false,
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"build": "tsup index.ts --format cjs,esm --minify --clean && pnpm run build:dts",
|
|
28
29
|
"build:dts": "tsc -p tsconfig.dts.json && node -e \"require('fs').copyFileSync('dist/index.d.ts','dist/index.d.cts')\"",
|
|
29
30
|
"test": "pnpm run test:core",
|
|
30
|
-
"test:unit": "pnpm run build && node --test test/v3/api.test.js test/v3/entities.test.js test/v3/entities-exhaustive.test.js test/v3/scanner.test.js test/v3/readability.test.js test/v3/special-elements.test.js test/v3/links-images.test.js test/v3/limits.test.js test/v3/stream.test.js",
|
|
31
|
+
"test:unit": "pnpm run build && node --test test/v3/api.test.js test/v3/entities.test.js test/v3/entities-exhaustive.test.js test/v3/scanner.test.js test/v3/readability.test.js test/v3/special-elements.test.js test/v3/links-images.test.js test/v3/limits.test.js test/v3/stream.test.js test/v3/provenance.test.js",
|
|
31
32
|
"test:core": "pnpm run entities:check && pnpm run typecheck && pnpm run test:unit && pnpm run test:fuzz && pnpm run test:sinks && node test/package-smoke.mjs",
|
|
32
33
|
"test:fuzz": "pnpm run build && node --test test/v3/fuzz.test.js",
|
|
33
34
|
"test:sinks": "pnpm run build && node --test test/v3/sinks.test.js",
|
|
@@ -66,11 +67,20 @@
|
|
|
66
67
|
"backend",
|
|
67
68
|
"nodejs",
|
|
68
69
|
"browser",
|
|
69
|
-
"edge-runtime"
|
|
70
|
+
"edge-runtime",
|
|
71
|
+
"sanitizer",
|
|
72
|
+
"sanitize",
|
|
73
|
+
"html-sanitizer",
|
|
74
|
+
"xss",
|
|
75
|
+
"cross-site-scripting",
|
|
76
|
+
"xss-prevention",
|
|
77
|
+
"security",
|
|
78
|
+
"strip-tags",
|
|
79
|
+
"escape-html"
|
|
70
80
|
],
|
|
71
81
|
"author": "Purifai Team <it@worksonmy.dev>",
|
|
72
82
|
"license": "MIT",
|
|
73
|
-
"homepage": "https://
|
|
83
|
+
"homepage": "https://purifai.worksonmy.dev",
|
|
74
84
|
"repository": {
|
|
75
85
|
"type": "git",
|
|
76
86
|
"url": "git+https://github.com/moji2002/purifai.git"
|