Skip to content
Permalink
Browse files

module: refactor internal/module export style

PR-URL: #12644
Reviewed-By: Brian White <mscdex@mscdex.net>
  • Loading branch information...
jasnell committed Apr 24, 2017
1 parent 579ff2a commit ed0716f0e9659c267519c18eaafb2b52b9ffc2d1
Showing with 11 additions and 11 deletions.
  1. +11 −11 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
};

0 comments on commit ed0716f

Please sign in to comment.
You can’t perform that action at this time.