-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use natives instead of rolling our own eval
- Loading branch information
Showing
2 changed files
with
4 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,5 +38,8 @@ | |
"mkdirp": "^0.5.0", | ||
"rimraf": "^2.2.8", | ||
"tap": "^1.2.0" | ||
}, | ||
"dependencies": { | ||
"natives": "^1.0.1" | ||
} | ||
} |