Skip to content

Commit

Permalink
use natives instead of rolling our own eval
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Aug 21, 2016
1 parent 305d884 commit 331ac8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
12 changes: 1 addition & 11 deletions fs.js
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
// eeeeeevvvvviiiiiiillllll
// more evil than monkey-patching the native builtin?
// Not sure.

var mod = require("module")
var pre = '(function (exports, require, module, __filename, __dirname) { '
var post = '});'
var src = pre + process.binding('natives').fs + post
var vm = require('vm')
var fn = vm.runInThisContext(src)
fn(exports, require, module, __filename, __dirname)
module.exports = require('natives').require('fs')
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@
"mkdirp": "^0.5.0",
"rimraf": "^2.2.8",
"tap": "^1.2.0"
},
"dependencies": {
"natives": "^1.0.1"
}
}

0 comments on commit 331ac8d

Please sign in to comment.