esm: skip file: URL conversion to path when possible
require('node:path').extname
has to do several checks to comply with relative paths, however URL
instances are always absolute so skipping the translation to a path and implement a simplified version of extname
makes sense IMHO.
We could potentially do the same for basename
, but it's only used in the error path where performance don't matter as much, so this PR is only doing extname
.