Skip to content

Update node 22 - #28

Open
mbaumgartl wants to merge 13 commits into
mainfrom
update-node-22
Open

Update node 22#28
mbaumgartl wants to merge 13 commits into
mainfrom
update-node-22

Conversation

@mbaumgartl

@mbaumgartl mbaumgartl commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Raises the minimum supported Node.js version to 22 and does the cleanup that unlocks / follows from it.

  • BREAKING: engines.node bumped to >=22; ecmaVersion in eslint.config.js bumped to 2023 accordingly.
  • CI matrix updated to test against Node 22, 24, 26.
  • Replaced all Object.prototype.hasOwnProperty.call(...) occurrences with Object.hasOwn().
  • Updated ESLint (9 → 10) and related plugins; fixed the no-useless-assignment violations this surfaced.
  • Updated remaining dependencies: @xmldom/xmldom, chokidar (4 → 5), luxon, serve-static (1 → 2), globals, jsdoc, prettier.
  • Removed the content-type dependency. lib/url-parser.js now parses Content-Type headers with Node's built-in node:util MIMEType, which throws on malformed input — no third-party parser needed.
  • All core Node module require()s are now prefixed with node:.
  • lib/config-loader.js: replaced the manual recursive directory walk with fs.glob(); config parsing and resource loading now happen inline while walking. Note: fs.glob() silently skips unreadable directories instead of throwing, unlike the old readdir/stat walk — worth a second look if that matters for your setup.

content-type@2 no longer throws on malformed Content-Type headers, so
the previous try/catch became dead code (also untested). Since Flora
should still reject a malformed header (unlike a valid-but-unsupported
one, e.g. "text/plain", which is left untouched), the check is now
done explicitly instead of relying on parse() throwing.
@mbaumgartl mbaumgartl self-assigned this Aug 7, 2026
mbaumgartl and others added 6 commits August 10, 2026 16:03
Node's built-in MIMEType/MIMEParams (available since Node 22, the
project's minimum supported version) implements the same WHATWG
media-type parsing as the content-type package, so the dependency
can be dropped.
Follows the node: scheme already used for e.g. node:test/node:assert
in the test suite, making all core module imports consistently
distinguishable from third-party and local requires.
The recursive walk() (readdir + stat per entry) is replaced by a
single fs.glob('*/**/{config.*,index.js}') call, which handles the
recursion and file-type filtering natively. Since walk() had only
one call site and is now just a short loop, it's inlined into
configLoader instead of kept as a separate function.

Co-Authored-By: Claude <noreply@anthropic.com>
Config parsing is now done inline as each config.* file is
discovered by the fs.glob loop, instead of in a separate Promise.all
pass over the collected resources afterwards. This drops the
intermediate configFile bookkeeping property, at the cost of parsing
configs sequentially instead of concurrently.

Errors are now raised as ImplementationError (consistent with the
rest of lib/), wrapping the original parser error via `cause`
instead of rewriting its message.
Loading a resource's index.js is now done inline as it's discovered
by the fs.glob loop, instead of in a separate Promise.all pass. Since
require() is synchronous, the Promise wrapper that pass used is no
longer needed, and the intermediate instanceFile bookkeeping property
can be dropped along with it.
Replace the access().then(() => true).catch(() => false) boolean
dance with a plain try/catch around fs.access().

Also throw ImplementationError instead of a plain Error, consistent
with the rest of the file, and rephrase the message to "Cannot
access ..." since access() can fail for reasons other than the
directory not existing (e.g. missing permissions); the original
error is attached as cause.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant