module: CJS / ESM resolver sharing and refactoring
This extracts just the resolver refactoring component from https://github.com/nodejs/node/pull/34718.
I hope that the negative diff speaks for itself at least!
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines