lib: lazy loading and cleanup
This is a start towards an very incremental refactoring of core module loading the occurs at startup. Every core module that is loaded automatically adds to the overall cold start time of the node.js process. While this specific PR is not likely to have much impact, the goal is to start moving towards lazy-loading where it is practical. Fixed a bug or two and cleaned up a few other bits along the way.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines