Skip to content
Browse files

runtime javascript compiler so everything works from node too

  • Loading branch information...
1 parent 4d91bb4 commit 4db888a2b91be1796584fea89b80a2073fb5394c @substack substack committed Mar 26, 2011
Showing with 18 additions and 2 deletions.
  1. +16 −0 dcrypt.js
  2. +2 −2 package.json
View
16 dcrypt.js
@@ -0,0 +1,16 @@
+var fs = require('fs');
+var cs = require('coffee-script');
+
+var filename = __dirname + '/dcrypt.coffee';
+var coffee = fs.readFileSync(filename, 'utf8');
+var js = cs.compile(coffee, { filename : filename });
+
+var vm = require('vm');
+vm.runInNewContext(js, {
+ exports : exports,
+ module : module,
+ require : require,
+ Buffer : Buffer,
+ process : process,
+ global : global,
+});
View
4 package.json
@@ -28,12 +28,12 @@
"mail": "dcrypt@dekz.net",
"web": "https://github.com/dekz/dcrypt/issues"
},
- "main": "./dcrypt.coffee",
+ "main": "./dcrypt.js",
"dependencies": {
"coffee-script": ">= 0.9.5 < 1.1.0"
},
"engines": {
"node": ">= 0.4.2 < 0.5.0",
"npm": ">= 0.3.15 < 1.0.0"
}
-}
+}

0 comments on commit 4db888a

Please sign in to comment.
Something went wrong with that request. Please try again.