module: improve resolve paths validation
The first commit is just #27598, which I've included here just to avoid conflicts later.
This PR adds input validation to require.resolve()
's paths
option. Prior to this change, passing in a non-array value lead to a misleading 'module not found' error.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines