modif comtabilite
This commit is contained in:
+16
-10
@@ -25,8 +25,9 @@ try {
|
||||
}
|
||||
|
||||
var wrap = [
|
||||
'(function (exports, require, module, __filename, __dirname) { ',
|
||||
'\n});'
|
||||
'(function (internalBinding) {' +
|
||||
' return function (exports, require, module, __filename, __dirname) { ',
|
||||
'\n };\n});'
|
||||
];
|
||||
|
||||
|
||||
@@ -84,6 +85,17 @@ function req_ (id, cache) {
|
||||
}
|
||||
source = wrap[0] + source + wrap[1]
|
||||
|
||||
var internalBinding = function(name) {
|
||||
if (name === 'types') {
|
||||
return process.binding('util');
|
||||
} else {
|
||||
try {
|
||||
return process.binding(name);
|
||||
} catch (e) {}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
var cachingRequire = function require (id) {
|
||||
if (cache[id]) {
|
||||
return cache[id].exports
|
||||
@@ -92,13 +104,7 @@ function req_ (id, cache) {
|
||||
// Provide just enough to keep `graceful-fs@3` working and tests passing.
|
||||
// For now.
|
||||
return {
|
||||
internalBinding: function(name) {
|
||||
if (name === 'types') {
|
||||
return process.binding('util');
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
internalBinding: internalBinding,
|
||||
NativeModule: {
|
||||
_source: process.binding('natives'),
|
||||
nonInternalExists: function(id) {
|
||||
@@ -134,7 +140,7 @@ function req_ (id, cache) {
|
||||
} else {
|
||||
fn = runInThisContext(source, nm.filename, true);
|
||||
}
|
||||
fn(nm.exports, cachingRequire, nm, nm.filename)
|
||||
fn(internalBinding)(nm.exports, cachingRequire, nm, nm.filename, '<no dirname available>')
|
||||
nm.loaded = true
|
||||
} finally {
|
||||
nm.loading = false
|
||||
|
||||
Reference in New Issue
Block a user