Skip to content

Commit ed0716f

Browse files
committed
module: refactor internal/module export style
PR-URL: #12644 Reviewed-By: Brian White <[email protected]>
1 parent 579ff2a commit ed0716f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/internal/module.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
'use strict';
22

3-
exports = module.exports = {
4-
makeRequireFunction,
5-
stripBOM,
6-
stripShebang,
7-
addBuiltinLibsToObject
8-
};
9-
10-
exports.requireDepth = 0;
11-
123
// Invoke with makeRequireFunction(module) where |module| is the Module object
134
// to use as the context for the require() function.
145
function makeRequireFunction(mod) {
@@ -85,7 +76,7 @@ function stripShebang(content) {
8576
return content;
8677
}
8778

88-
exports.builtinLibs = [
79+
const builtinLibs = [
8980
'assert', 'buffer', 'child_process', 'cluster', 'crypto', 'dgram', 'dns',
9081
'domain', 'events', 'fs', 'http', 'https', 'net', 'os', 'path', 'punycode',
9182
'querystring', 'readline', 'repl', 'stream', 'string_decoder', 'tls', 'tty',
@@ -94,7 +85,7 @@ exports.builtinLibs = [
9485

9586
function addBuiltinLibsToObject(object) {
9687
// Make built-in modules available directly (loaded lazily).
97-
exports.builtinLibs.forEach((name) => {
88+
builtinLibs.forEach((name) => {
9889
// Goals of this mechanism are:
9990
// - Lazy loading of built-in modules
10091
// - Having all built-in modules available as non-enumerable properties
@@ -130,3 +121,12 @@ function addBuiltinLibsToObject(object) {
130121
});
131122
});
132123
}
124+
125+
module.exports = exports = {
126+
addBuiltinLibsToObject,
127+
builtinLibs,
128+
makeRequireFunction,
129+
requireDepth: 0,
130+
stripBOM,
131+
stripShebang
132+
};

0 commit comments

Comments
 (0)