Problem
fdir currently imports Node.js built-in modules without the node: prefix. This prevents fdir from working in Deno, which requires the node: prefix for Node.js compatibility.
Proposed Solution
Update all built-in module imports to use the node: prefix:
'fs' → 'node:fs'
'path' → 'node:path'
'module' → 'node:module'
Benefits
- Deno compatibility: Enables
fdir to work in Deno's Node.js compatibility mode
- Explicit imports: Makes it clear these are built-in modules, not user packages
- Security: The
node: prefix ensures the node built-in module is used, not something else that's been added to the require cache
Compatibility
The node: prefix has been supported in Node.js since v12.20.0 and v14.13.1.
In fdir package.json, I see support for >=12.0.0, so this might technically be a breaking change. That said, Node 12 was EOL in 2022, and anyone on v12.0 through v.12.19 could update v12.20.
Problem
fdircurrently imports Node.js built-in modules without thenode:prefix. This preventsfdirfrom working in Deno, which requires thenode:prefix for Node.js compatibility.Proposed Solution
Update all built-in module imports to use the
node:prefix:'fs'→'node:fs''path'→'node:path''module'→'node:module'Benefits
fdirto work in Deno's Node.js compatibility modenode:prefix ensures the node built-in module is used, not something else that's been added to the require cacheCompatibility
The
node:prefix has been supported in Node.js since v12.20.0 and v14.13.1.In
fdirpackage.json, I see support for >=12.0.0, so this might technically be a breaking change. That said, Node 12 was EOL in 2022, and anyone onv12.0throughv.12.19could updatev12.20.