diff --git a/lib/internal/module.js b/lib/internal/module.js index a2f990ee643073..49bd9b84eee9a1 100644 --- a/lib/internal/module.js +++ b/lib/internal/module.js @@ -1,14 +1,5 @@ 'use strict'; -exports = module.exports = { - makeRequireFunction, - stripBOM, - stripShebang, - addBuiltinLibsToObject -}; - -exports.requireDepth = 0; - // Invoke with makeRequireFunction(module) where |module| is the Module object // to use as the context for the require() function. function makeRequireFunction(mod) { @@ -85,7 +76,7 @@ function stripShebang(content) { return content; } -exports.builtinLibs = [ +const builtinLibs = [ 'assert', 'buffer', 'child_process', 'cluster', 'crypto', 'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'https', 'net', 'os', 'path', 'punycode', 'querystring', 'readline', 'repl', 'stream', 'string_decoder', 'tls', 'tty', @@ -94,7 +85,7 @@ exports.builtinLibs = [ function addBuiltinLibsToObject(object) { // Make built-in modules available directly (loaded lazily). - exports.builtinLibs.forEach((name) => { + builtinLibs.forEach((name) => { // Goals of this mechanism are: // - Lazy loading of built-in modules // - Having all built-in modules available as non-enumerable properties @@ -130,3 +121,12 @@ function addBuiltinLibsToObject(object) { }); }); } + +module.exports = exports = { + addBuiltinLibsToObject, + builtinLibs, + makeRequireFunction, + requireDepth: 0, + stripBOM, + stripShebang +};