Skip to content

Commit

Permalink
module: add builtinModules
Browse files Browse the repository at this point in the history
Provides list of all builtin modules in Node.

Includes modules of all types:
- prefixed (ex: _tls_common)
- deprecated (ex: sys)
- regular (ex: vm)
  • Loading branch information
maclover7 committed Nov 26, 2017
1 parent ad80c21 commit 46f19ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ function Module(id, parent) {
}
module.exports = Module;

const builtinModules = Object.keys(NativeModule._source)
.filter(NativeModule.nonInternalExists);

Object.freeze(builtinModules);
Module.builtinModules = builtinModules;

Module._cache = Object.create(null);
Module._pathCache = Object.create(null);
Module._extensions = Object.create(null);
Expand Down

0 comments on commit 46f19ef

Please sign in to comment.