meta: switch to minify-html; fixed test glob on package.json; removed console.log#602
meta: switch to minify-html; fixed test glob on package.json; removed console.log#602
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
cc @nodejs/web-infra if we could fast-track this to unblock nodejs/node that'd be great! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #602 +/- ##
==========================================
- Coverage 78.68% 78.68% -0.01%
==========================================
Files 127 127
Lines 12435 12432 -3
Branches 882 882
==========================================
- Hits 9785 9782 -3
Misses 2645 2645
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
| File | Base | Head | Diff |
|---|---|---|---|
webcrypto.html |
334.63 KB | 320.52 KB | -14.12 KB (-4.22%) |
fs.html |
927.66 KB | 913.86 KB | -13.80 KB (-1.49%) |
crypto.html |
1007.81 KB | 997.54 KB | -10.27 KB (-1.02%) |
n-api.html |
767.40 KB | 758.37 KB | -9.03 KB (-1.18%) |
os.html |
83.60 KB | 75.44 KB | -8.16 KB (-9.76%) |
errors.html |
349.54 KB | 341.49 KB | -8.06 KB (-2.30%) |
http2.html |
743.37 KB | 736.76 KB | -6.61 KB (-0.89%) |
http.html |
597.92 KB | 591.76 KB | -6.15 KB (-1.03%) |
cli.html |
287.69 KB | 281.55 KB | -6.14 KB (-2.13%) |
util.html |
714.55 KB | 708.75 KB | -5.80 KB (-0.81%) |
test.html |
801.86 KB | 796.46 KB | -5.41 KB (-0.67%) |
quic.html |
142.57 KB | 137.37 KB | -5.20 KB (-3.65%) |
stream.html |
808.70 KB | 803.53 KB | -5.17 KB (-0.64%) |
dns.html |
215.95 KB | 210.83 KB | -5.11 KB (-2.37%) |
buffer.html |
1.07 MB | 1.06 MB | -4.96 KB (-0.45%) |
process.html |
682.75 KB | 678.01 KB | -4.75 KB (-0.69%) |
sqlite.html |
189.60 KB | 184.96 KB | -4.63 KB (-2.44%) |
net.html |
216.24 KB | 211.85 KB | -4.39 KB (-2.03%) |
deprecations.html |
263.15 KB | 258.89 KB | -4.26 KB (-1.62%) |
webstreams.html |
270.41 KB | 266.23 KB | -4.18 KB (-1.54%) |
perf_hooks.html |
349.49 KB | 345.37 KB | -4.12 KB (-1.18%) |
tls.html |
263.44 KB | 259.34 KB | -4.10 KB (-1.56%) |
readline.html |
204.62 KB | 200.71 KB | -3.91 KB (-1.91%) |
esm.html |
126.35 KB | 122.63 KB | -3.72 KB (-2.95%) |
zlib.html |
276.26 KB | 272.57 KB | -3.69 KB (-1.33%) |
events.html |
546.23 KB | 542.63 KB | -3.60 KB (-0.66%) |
module.html |
326.54 KB | 322.97 KB | -3.56 KB (-1.09%) |
url.html |
321.86 KB | 318.34 KB | -3.52 KB (-1.09%) |
vm.html |
334.30 KB | 330.92 KB | -3.38 KB (-1.01%) |
worker_threads.html |
386.29 KB | 382.97 KB | -3.32 KB (-0.86%) |
child_process.html |
442.26 KB | 439.01 KB | -3.25 KB (-0.74%) |
v8.html |
312.33 KB | 309.17 KB | -3.15 KB (-1.01%) |
diagnostics_channel.html |
224.98 KB | 221.97 KB | -3.01 KB (-1.34%) |
globals.html |
123.17 KB | 120.21 KB | -2.96 KB (-2.40%) |
assert.html |
466.93 KB | 464.31 KB | -2.62 KB (-0.56%) |
inspector.html |
113.27 KB | 110.78 KB | -2.49 KB (-2.20%) |
dgram.html |
155.64 KB | 153.16 KB | -2.48 KB (-1.59%) |
modules.html |
151.05 KB | 148.57 KB | -2.48 KB (-1.64%) |
packages.html |
121.24 KB | 118.90 KB | -2.34 KB (-1.93%) |
cluster.html |
198.22 KB | 195.91 KB | -2.32 KB (-1.17%) |
intl.html |
42.78 KB | 40.50 KB | -2.28 KB (-5.34%) |
repl.html |
217.57 KB | 215.29 KB | -2.28 KB (-1.05%) |
timers.html |
89.38 KB | 87.22 KB | -2.16 KB (-2.42%) |
single-executable-applications.html |
85.22 KB | 83.06 KB | -2.16 KB (-2.53%) |
console.html |
97.90 KB | 95.78 KB | -2.12 KB (-2.17%) |
path.html |
95.76 KB | 93.73 KB | -2.03 KB (-2.12%) |
tty.html |
43.63 KB | 41.61 KB | -2.03 KB (-4.65%) |
https.html |
155.65 KB | 153.63 KB | -2.01 KB (-1.29%) |
async_context.html |
200.56 KB | 198.55 KB | -2.01 KB (-1.00%) |
async_hooks.html |
219.76 KB | 217.77 KB | -1.99 KB (-0.91%) |
index.html |
17.06 KB | 15.18 KB | -1.88 KB (-11.04%) |
addons.html |
338.04 KB | 336.17 KB | -1.87 KB (-0.55%) |
debugger.html |
38.11 KB | 36.28 KB | -1.83 KB (-4.80%) |
tracing.html |
89.42 KB | 87.59 KB | -1.83 KB (-2.04%) |
domain.html |
101.17 KB | 99.35 KB | -1.81 KB (-1.79%) |
permissions.html |
37.47 KB | 35.66 KB | -1.81 KB (-4.83%) |
typescript.html |
33.90 KB | 32.16 KB | -1.74 KB (-5.13%) |
report.html |
187.86 KB | 186.13 KB | -1.73 KB (-0.92%) |
wasi.html |
45.27 KB | 43.55 KB | -1.73 KB (-3.81%) |
environment_variables.html |
24.61 KB | 22.91 KB | -1.70 KB (-6.92%) |
querystring.html |
33.76 KB | 32.07 KB | -1.68 KB (-4.98%) |
punycode.html |
34.40 KB | 32.73 KB | -1.67 KB (-4.87%) |
string_decoder.html |
40.21 KB | 38.60 KB | -1.61 KB (-4.00%) |
documentation.html |
25.74 KB | 24.13 KB | -1.60 KB (-6.23%) |
embedding.html |
49.68 KB | 48.08 KB | -1.60 KB (-3.22%) |
synopsis.html |
25.47 KB | 23.93 KB | -1.55 KB (-6.07%) |
orama-db Generator
| File | Base | Head | Diff |
|---|---|---|---|
orama-db.json |
8.03 MB | 8.03 MB | -1.78 KB (-0.02%) |
web Generator
| File | Base | Head | Diff |
|---|---|---|---|
fs.html |
1.28 MB | 1.30 MB | +21.59 KB (+1.65%) |
n-api.html |
803.75 KB | 821.53 KB | +17.78 KB (+2.21%) |
cli.html |
488.14 KB | 503.99 KB | +15.85 KB (+3.25%) |
deprecations.html |
494.54 KB | 510.35 KB | +15.81 KB (+3.20%) |
http2.html |
731.40 KB | 747.03 KB | +15.63 KB (+2.14%) |
http.html |
703.11 KB | 718.52 KB | +15.41 KB (+2.19%) |
quic.html |
354.04 KB | 368.77 KB | +14.73 KB (+4.16%) |
buffer.html |
851.96 KB | 865.12 KB | +13.16 KB (+1.54%) |
stream.html |
818.62 KB | 831.44 KB | +12.82 KB (+1.57%) |
crypto.html |
982.98 KB | 995.71 KB | +12.73 KB (+1.29%) |
process.html |
649.26 KB | 661.58 KB | +12.32 KB (+1.90%) |
errors.html |
456.15 KB | 466.83 KB | +10.68 KB (+2.34%) |
util.html |
652.39 KB | 662.85 KB | +10.46 KB (+1.60%) |
webcrypto.html |
520.65 KB | 530.53 KB | +9.88 KB (+1.90%) |
test.html |
683.39 KB | 692.94 KB | +9.55 KB (+1.40%) |
webstreams.html |
336.90 KB | 346.19 KB | +9.29 KB (+2.76%) |
perf_hooks.html |
367.03 KB | 375.58 KB | +8.55 KB (+2.33%) |
net.html |
351.01 KB | 359.39 KB | +8.38 KB (+2.39%) |
globals.html |
224.42 KB | 232.38 KB | +7.95 KB (+3.54%) |
events.html |
435.91 KB | 443.77 KB | +7.87 KB (+1.80%) |
worker_threads.html |
351.88 KB | 358.95 KB | +7.08 KB (+2.01%) |
tls.html |
348.71 KB | 355.08 KB | +6.38 KB (+1.83%) |
zlib.html |
276.71 KB | 281.95 KB | +5.25 KB (+1.90%) |
url.html |
332.62 KB | 337.71 KB | +5.09 KB (+1.53%) |
v8.html |
304.11 KB | 309.18 KB | +5.07 KB (+1.67%) |
dns.html |
282.65 KB | 287.42 KB | +4.76 KB (+1.68%) |
child_process.html |
362.31 KB | 366.84 KB | +4.53 KB (+1.25%) |
vm.html |
330.00 KB | 334.39 KB | +4.39 KB (+1.33%) |
readline.html |
238.78 KB | 242.96 KB | +4.18 KB (+1.75%) |
cluster.html |
189.81 KB | 193.94 KB | +4.13 KB (+2.18%) |
module.html |
309.61 KB | 313.70 KB | +4.09 KB (+1.32%) |
inspector.html |
165.17 KB | 169.14 KB | +3.97 KB (+2.40%) |
dgram.html |
184.06 KB | 188.00 KB | +3.94 KB (+2.14%) |
modules.html |
175.76 KB | 179.21 KB | +3.45 KB (+1.96%) |
diagnostics_channel.html |
217.61 KB | 220.98 KB | +3.37 KB (+1.55%) |
sqlite.html |
238.12 KB | 241.41 KB | +3.29 KB (+1.38%) |
console.html |
139.67 KB | 142.92 KB | +3.25 KB (+2.32%) |
path.html |
132.35 KB | 135.46 KB | +3.10 KB (+2.34%) |
assert.html |
321.72 KB | 324.76 KB | +3.05 KB (+0.95%) |
os.html |
135.53 KB | 132.56 KB | -2.97 KB (-2.19%) |
timers.html |
124.83 KB | 127.80 KB | +2.97 KB (+2.38%) |
packages.html |
153.46 KB | 156.28 KB | +2.82 KB (+1.84%) |
repl.html |
176.02 KB | 178.79 KB | +2.77 KB (+1.57%) |
https.html |
144.54 KB | 147.30 KB | +2.76 KB (+1.91%) |
async_context.html |
158.17 KB | 160.70 KB | +2.54 KB (+1.60%) |
tty.html |
88.54 KB | 90.98 KB | +2.44 KB (+2.76%) |
addons.html |
263.10 KB | 265.30 KB | +2.20 KB (+0.84%) |
async_hooks.html |
155.24 KB | 157.33 KB | +2.10 KB (+1.35%) |
punycode.html |
61.38 KB | 63.14 KB | +1.76 KB (+2.87%) |
tracing.html |
82.47 KB | 84.15 KB | +1.68 KB (+2.04%) |
report.html |
174.88 KB | 176.53 KB | +1.65 KB (+0.94%) |
wasi.html |
66.58 KB | 68.21 KB | +1.62 KB (+2.43%) |
single-executable-applications.html |
100.23 KB | 101.85 KB | +1.62 KB (+1.61%) |
querystring.html |
61.00 KB | 62.54 KB | +1.55 KB (+2.53%) |
domain.html |
102.22 KB | 103.50 KB | +1.28 KB (+1.25%) |
string_decoder.html |
53.33 KB | 54.56 KB | +1.23 KB (+2.30%) |
esm.html |
152.24 KB | 153.44 KB | +1.20 KB (+0.79%) |
typescript.html |
52.83 KB | 53.90 KB | +1.06 KB (+2.01%) |
environment_variables.html |
43.01 KB | 44.05 KB | +1.04 KB (+2.42%) |
synopsis.html |
41.73 KB | 42.77 KB | +1.04 KB (+2.49%) |
embedding.html |
58.51 KB | 59.51 KB | +1.00 KB (+1.71%) |
documentation.html |
37.14 KB | 38.11 KB | +985.00 B (+2.59%) |
permissions.html |
54.07 KB | 55.01 KB | +958.00 B (+1.73%) |
debugger.html |
53.60 KB | 54.49 KB | +910.00 B (+1.66%) |
intl.html |
57.18 KB | 57.90 KB | +737.00 B (+1.26%) |
index.html |
35.20 KB | 35.70 KB | +512.00 B (+1.42%) |
There was a problem hiding this comment.
Pull request overview
This PR updates the project’s HTML minification approach to improve platform support, tightens Node test discovery to avoid picking up built artifacts (e.g., out/), and removes debugging logs from tests.
Changes:
- Replace
@swc/htmlusage with@minify-html/nodein HTML generation/minification paths. - Restrict Node’s test runner to
src/**/*.test.mjsand adjust coverage/CI scripts accordingly. - Remove
console.logstatements from test suites.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/queries/tests/index.test.mjs | Removes a stray console.log from query tests. |
| src/utils/configuration/tests/index.test.mjs | Removes a stray console.log from configuration tests. |
| src/generators/web/utils/processing.mjs | Switches HTML minification implementation for the web generator. |
| src/generators/legacy-html/index.mjs | Switches HTML minification implementation for the legacy HTML generator. |
| src/generators/legacy-html-all/index.mjs | Switches HTML minification implementation for the combined legacy HTML output. |
| package.json | Updates test scripts to target src/**/*.test.mjs and swaps dependencies. |
| npm-shrinkwrap.json | Locks @minify-html/node and removes @swc/html and related packages. |
| .github/dependabot.yml | Updates Dependabot pattern from @swc/html to @minify-html/node. |
Files not reviewed (1)
- npm-shrinkwrap.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "test": "node --test --experimental-test-module-mocks 'src/**/*.test.mjs'", | ||
| "test:coverage": "c8 node --test --experimental-test-module-mocks 'src/**/*.test.mjs'", | ||
| "test:ci": "c8 --reporter=lcov node --test --experimental-test-module-mocks 'src/**/*.test.mjs' --test-reporter=@reporters/github --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=junit.xml --test-reporter=spec --test-reporter-destination=stdout", | ||
| "test:update-snapshots": "node --test --experimental-test-module-mocks --test-update-snapshots 'src/**/*.test.mjs'", | ||
| "test:watch": "node --test --experimental-test-module-mocks --watch 'src/**/*.test.mjs'", |
There was a problem hiding this comment.
The test file glob is wrapped in single quotes. On Windows (npm scripts executed via cmd.exe), single quotes are not stripped, so Node receives the literal quotes in the argument and the pattern won’t match (tests may not run / CI may fail). Use an unquoted glob, or wrap the glob in double quotes (escaped for JSON) to be cross-platform.
| "test": "node --test --experimental-test-module-mocks 'src/**/*.test.mjs'", | |
| "test:coverage": "c8 node --test --experimental-test-module-mocks 'src/**/*.test.mjs'", | |
| "test:ci": "c8 --reporter=lcov node --test --experimental-test-module-mocks 'src/**/*.test.mjs' --test-reporter=@reporters/github --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=junit.xml --test-reporter=spec --test-reporter-destination=stdout", | |
| "test:update-snapshots": "node --test --experimental-test-module-mocks --test-update-snapshots 'src/**/*.test.mjs'", | |
| "test:watch": "node --test --experimental-test-module-mocks --watch 'src/**/*.test.mjs'", | |
| "test": "node --test --experimental-test-module-mocks \"src/**/*.test.mjs\"", | |
| "test:coverage": "c8 node --test --experimental-test-module-mocks \"src/**/*.test.mjs\"", | |
| "test:ci": "c8 --reporter=lcov node --test --experimental-test-module-mocks \"src/**/*.test.mjs\" --test-reporter=@reporters/github --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=junit.xml --test-reporter=spec --test-reporter-destination=stdout", | |
| "test:update-snapshots": "node --test --experimental-test-module-mocks --test-update-snapshots \"src/**/*.test.mjs\"", | |
| "test:watch": "node --test --experimental-test-module-mocks --watch \"src/**/*.test.mjs\"", |
|
|
||
| if (config.minify) { | ||
| ({ code: result } = await minify(result)); | ||
| result = Buffer.from(minifyHtml.minify(Buffer.from(result), {})); |
There was a problem hiding this comment.
When config.minify is enabled, result becomes a Buffer, so this function may return a Buffer instead of the string it returned before (and which callers/types may expect). Consider keeping result as a string (e.g., convert the minified output back to a string) or otherwise ensure a consistent return type regardless of minify.
| result = Buffer.from(minifyHtml.minify(Buffer.from(result), {})); | |
| const minifiedBuffer = Buffer.from(minifyHtml.minify(Buffer.from(result), {})); | |
| result = minifiedBuffer.toString('utf8'); |
To be fair in this case was a glib native binding, not missing a prebuilt swc. Im also fine for yet another alternative tho. Just worrying about performance. |
|
We could do a fallback, ie try a binding and if not don't minify? |
This PR moves from @swc/html as not being supported on all platforms we need; It also fixes the glob pattern for test scripts, if you had out/ folder tests would fail lol; and removes some console.logs() from tests.