Convert CommonJS to ES Modules

Modernize legacy Node.js modules from require/module.exports to ES module syntax.

category:modernization
node
esm
modules
migration
0

Prompt

Refactor this file from CommonJS to ES Modules.

Steps:
- Replace require() with import statements
- Replace module.exports / exports.foo with export default / named exports
- Ensure file extensions are explicit when required by your bundler/runtime
- Move side-effect imports to the top of the file

Explain any runtime implications (e.g. __dirname, top-level await).