Conversation
WalkthroughThis pull request establishes Node.js version enforcement by adding an Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Around line 7-9: Update the package.json engines.node minimum to match the
Node APIs used: change the "engines.node" value from ">=14.0.0" to ">=18.17.0"
so runtime environments support AbortSignal.timeout(), parseArgs, and styleText;
locate the engines.node entry in package.json and replace the version string
accordingly and run a quick install/test to verify compatibility.
In `@README.md`:
- Line 5: Update the documented Node version and the package.json engines to
reflect the actual minimum required Node runtime: change the README text "Node
v14+" to "Node 20.12.0+ (or 21.7.0+ if you prefer a stable release without
experimental warnings)" and update the "engines" field in package.json from
">=14.0.0" to the chosen minimum (e.g., ">=20.12.0" or ">=21.7.0"); verify this
aligns with the import usage of styleText from node:util in bin/htaccess-punk.js
so the declared engine matches the runtime API used.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9c5ddf00-50ee-4bc5-9553-c355aa3adf1b
📒 Files selected for processing (3)
.npmrcREADME.mdpackage.json
| "engines" : { | ||
| "node" : ">=14.0.0" | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify runtime APIs used vs declared engine floor.
set -euo pipefail
echo "Declared engines:"
rg -n '"engines"|"node"' package.json -n -A2 -B1
echo
echo "AbortSignal.timeout usage:"
rg -nP '\bAbortSignal\.timeout\s*\(' -g '!**/node_modules/**'
echo
echo "parseArgs/styleText usage:"
rg -nP 'from\s+[\"\x27]node:util[\"\x27]|\\bparseArgs\\s*\\(|\\bstyleText\\s*\\(' -g '!**/node_modules/**'
echo
echo "CI node versions under test:"
rg -n 'node-version|matrix:|node:' .github/workflows -g '*.yml' -g '*.yaml'Repository: j9t/htaccess-punk
Length of output: 485
🏁 Script executed:
# Check for parseArgs import and usage
echo "=== Checking for parseArgs import ==="
cat -n bin/htaccess-punk.js | head -20
echo -e "\n=== Checking for any 'node:util' imports ==="
rg "node:util|parseArgs|styleText" -n
echo -e "\n=== CI workflows node versions ==="
find .github/workflows -name "*.yml" -o -name "*.yaml" | head -5
cat .github/workflows/*.yml .github/workflows/*.yaml 2>/dev/null | grep -i "node" | head -20Repository: j9t/htaccess-punk
Length of output: 2709
engines.node minimum is too low for APIs already used.
Line 8 declares >=14.0.0, but the codebase uses APIs that require significantly newer versions: AbortSignal.timeout() (Node 17.3+), parseArgs (Node 18.3+), and styleText (Node 18.17+). The lowest common floor is >=18.17.0. Raise the minimum to prevent runtime crashes on unsupported versions.
Suggested patch
- "engines" : {
- "node" : ">=14.0.0"
+ "engines": {
+ "node": ">=18.17.0"
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "engines" : { | |
| "node" : ">=14.0.0" | |
| }, | |
| "engines": { | |
| "node": ">=18.17.0" | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package.json` around lines 7 - 9, Update the package.json engines.node
minimum to match the Node APIs used: change the "engines.node" value from
">=14.0.0" to ">=18.17.0" so runtime environments support AbortSignal.timeout(),
parseArgs, and styleText; locate the engines.node entry in package.json and
replace the version string accordingly and run a quick install/test to verify
compatibility.
| [](https://www.npmjs.com/package/htaccess-punk) [](https://github.com/j9t/htaccess-punk/actions) [](https://socket.dev/npm/package/htaccess-punk) | ||
|
|
||
| .htaccess Punk checks the redirect targets defined in `.htaccess` files. It follows redirect chains to verify where they ultimately resolve and what HTTP status they return, thus helping to fight redirect rot. | ||
| .htaccess Punk checks the redirect targets defined in `.htaccess` files. It follows redirect chains to verify where they ultimately resolve and what HTTP status they return, thus helping to fight redirect rot. It requires Node v14+. |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat README.md | head -20Repository: j9t/htaccess-punk
Length of output: 1050
🏁 Script executed:
cat package.json | head -50Repository: j9t/htaccess-punk
Length of output: 1028
🏁 Script executed:
cat bin/htaccess-punk.jsRepository: j9t/htaccess-punk
Length of output: 3793
🏁 Script executed:
cat src/index.jsRepository: j9t/htaccess-punk
Length of output: 4308
🌐 Web query:
Node.js parseArgs util minimum version requirement
💡 Result:
The minimum Node.js version required to use the util.parseArgs function is v16.17.0 or v18.3.0. It was added as an experimental feature in these versions via PR #42675 (merged May 2022) and later stabilized.
Citations:
- 1: https://stackoverflow.com/questions/78154815/the-requested-module-nodeutil-does-not-provide-an-export-named-parseargs
- 2: https://nodejs.cn/api/util/util_parseargs_config.html
- 3: https://nodejs.org/en/blog/release/v18.3.0
- 4: https://raw.githubusercontent.com/nodejs/node/main/doc/changelogs/CHANGELOG_V18.md
- 5: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V18.md
- 6: https://nodejs.org/tr/blog/release/v16.17.0
- 7: util: add tokens to parseArgs nodejs/node#43459
- 8: v16.17.0 release proposal nodejs/node#44098
🌐 Web query:
Node.js fetch native API minimum version requirement
💡 Result:
The native Fetch API in Node.js is available starting from version 18.0.0, where it was introduced as an experimental feature enabled by default (disable with --no-experimental-fetch). It remained experimental through versions 18-20. In Node.js 21.0.0, Fetch was promoted to stable. As of 2026, all current LTS versions (20, 22, 24) and later include stable native Fetch with no flags required. For production use without experimental warnings or instability, the minimum recommended version is Node.js 21.
Citations:
- 1: https://blog.logrocket.com/fetch-api-node-js/
- 2: https://nodejs.org/en/learn/getting-started/fetch
- 3: https://nodejs.dev/en/learn/getting-started/fetch
- 4: https://nodejs.org/en/blog/release/v18.0.0
- 5: https://nodejs.org/en/blog/release/v21.0.0
- 6: https://nodejs.org/en/blog/release/v20.0.0
🌐 Web query:
Node.js AbortSignal.timeout minimum version requirement
💡 Result:
Node.js AbortSignal.timeout requires Node.js version 16.14.0 or 17.3.0 minimum.
Citations:
- 1: nodejs/node@62c4b4c85b
- 2: lib: add AbortSignal.timeout nodejs/node#40899
- 3: https://nodejs.org/en/blog/release/v17.3.0
- 4: v17.3.0 release proposal nodejs/node#41167
- 5: https://nodejs.org/en/blog/release/v16.14.0
🌐 Web query:
Node.js util.styleText minimum version requirement
💡 Result:
The minimum Node.js version required to use util.styleText is v20.12.0 or v21.7.0. It was added as a semver-minor feature in these releases via PR #51850, which merged on 2024-02-26. It is available (but experimental/unstable) in Node.js 20.12+ and 21.7+, became stable in v22.13.0 and v23.5.0. Prior versions like v18 and v21.0.0 do not have it. As of 2026-03-25, all maintained LTS versions (20, 22, 24) support it since v20.12.0.
Citations:
- 1: util: add styleText API to text formatting nodejs/node#51850
- 2: https://nodejs.org/en/blog/migrations/chalk-to-styletext
- 3: The requested module 'node:util' does not provide an export named 'styleText' resend/react-email#2574
- 4: Change Request: Replace
chalkwith Node.js' nativestyleTextin v10 eslint/eslint#20012 - 5: https://nodejs.org/en/blog/release/v21.7.0
- 6: https://nodejs.cn/api/v23/util/util_styletext_format_text_options.html
- 7: https://nodejs.org/en/blog/release/v20.12.0
Documented and configured Node version is inaccurate.
Line 5 states Node v14+ and package.json specifies >=14.0.0, but the code uses styleText from node:util (imported in bin/htaccess-punk.js), which requires Node 20.12.0 or later. Update both the README and package.json engines field to reflect the actual minimum supported version: Node 20.12.0 (or 21.7.0+ if preferring a stable release without experimental warnings).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.md` at line 5, Update the documented Node version and the package.json
engines to reflect the actual minimum required Node runtime: change the README
text "Node v14+" to "Node 20.12.0+ (or 21.7.0+ if you prefer a stable release
without experimental warnings)" and update the "engines" field in package.json
from ">=14.0.0" to the chosen minimum (e.g., ">=20.12.0" or ">=21.7.0"); verify
this aligns with the import usage of styleText from node:util in
bin/htaccess-punk.js so the declared engine matches the runtime API used.
|
Thanks for filing this, @adollar28cents, much appreciated…! (Somehow I missed the notification, apologies for the delay.) .htaccess Punk supports Node LTS as governed by the .nvmrc file. That is assumed to work. Node 14 is long EOL, so I would not make special provisions for this. I understand this means that in some cases, the tool cannot be used, but I do believe that Node LTS is a reasonably long ramp to strike a balance between offering solid support but also keeping the tech stack modern and focused. Will close this one accordingly, but open to chat more! Thanks again for the PR! |
Hi Jens,
I tried out this package on a computer using a very old version of node and it errored out when I ran it. I found that the null coalescing operator requires Node 14, so I updated my version and found these changes to the library that would alert users to this situation in the future if accepted.
Summary by CodeRabbit