Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Commit

Permalink
do not hardcode native modules list
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Oct 4, 2015
1 parent 61dde8d commit b3ea440
Showing 1 changed file with 10 additions and 83 deletions.
93 changes: 10 additions & 83 deletions nodeCjsDeps/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,93 +8,20 @@
'use strict';

var Klass = require('node-klass'),
assert = require('assert'),
child_process = require('child_process'),
console = require('console'),
crypto = require('crypto'),
dgram = require('dgram'),
domain = require('domain'),
freelist = require('freelist'),
http = require('http'),
_linklist = require('_linklist'),
net = require('net'),
path = require('path'),
querystring = require('querystring'),
repl = require('repl'),
stream = require('stream'),
_stream_readable = require('_stream_readable'),
_stream_writable = require('_stream_writable'),
sys = require('sys'),
tls = require('tls'),
url = require('url'),
vm = require('vm'),
buffer = require('buffer'),
cluster = require('cluster'),
constants = require('constants'),
_debugger = require('_debugger'),
dns = require('dns'),
events = require('events'),
fs = require('fs'),
https = require('https'),
module = require('module'),
os = require('os'),
punycode = require('punycode'),
readline = require('readline'),
_stream_duplex = require('_stream_duplex'),
_stream_passthrough = require('_stream_passthrough'),
_stream_transform = require('_stream_transform'),
string_decoder = require('string_decoder'),
timers = require('timers'),
tty = require('tty'),
util = require('util'),
zlib = require('zlib'),
Listener = Klass.Listener;
Listener = Klass.Listener,
vm = require('vm');

var nativeModules = Object.keys(process.binding('natives'))
.filter(function (el) { return !/^internal/.test(el); })
.reduce(function(accumulator, cur) {
accumulator[cur] = require(cur);
return accumulator;
}, {});

module.exports = Klass.define('NodeCjsDeps.Global',{

statics: {
nodejs: {
assert: assert,
child_process: child_process,
console: console,
crypto: crypto,
dgram: dgram,
domain: domain,
freelist: freelist,
http: http,
_linklist: _linklist,
net: net,
path: path,
querystring: querystring,
repl: repl,
stream: stream,
_stream_readable: _stream_readable,
_stream_writable: _stream_writable,
sys: sys,
tls: tls,
url: url,
vm: vm,
buffer: buffer,
cluster: cluster,
constants: constants,
_debugger: _debugger,
dns: dns,
events: events,
fs: fs,
https: https,
module: module,
os: os,
punycode: punycode,
readline: readline,
_stream_duplex: _stream_duplex,
_stream_passthrough: _stream_passthrough,
_stream_transform: _stream_transform,
string_decoder: string_decoder,
timers: timers,
tty: tty,
util: util,
zlib: zlib
}
nodejs: nativeModules
},

constructor: function(){
Expand Down

0 comments on commit b3ea440

Please sign in to comment.