Skip to content

Instantly share code, notes, and snippets.

@threepointone
Created January 20, 2015 20:55
Show Gist options
  • Save threepointone/67c73c9089838004afac to your computer and use it in GitHub Desktop.
Save threepointone/67c73c9089838004afac to your computer and use it in GitHub Desktop.
io.js compatibility
diff --git a/src/clj/cljs/repl/node_repl.js b/src/clj/cljs/repl/node_repl.js
index 6bc1cd2..46e7f7e 100644
--- a/src/clj/cljs/repl/node_repl.js
+++ b/src/clj/cljs/repl/node_repl.js
@@ -1,6 +1,7 @@
process.env.NODE_DISABLE_COLORS = true;
-var net = require("net");
+var net = require("net"),
+ vm = require('vm');
var PORT = 5001;
try {
@@ -27,7 +28,7 @@ net.createServer(function (socket) {
// not sure how \0's are getting through - David
data = data.replace(/\0/g, "");
try {
- ret = process.binding('evals').NodeScript.runInThisContext.call(
+ ret = vm.runInThisContext.call(
global, data, "repl");
} catch (e) {
err = e;
diff --git a/src/clj/cljs/util.clj b/src/clj/cljs/util.clj
index 6611aa2..9b0e7ef 100644
--- a/src/clj/cljs/util.clj
+++ b/src/clj/cljs/util.clj
@@ -14,7 +14,7 @@
[java.net URL]))
;; next line is auto-generated by the build-script - Do not edit!
-(def ^:dynamic *clojurescript-version*)
+(def ^:dynamic *clojurescript-version* {:major 0, :minor 0, :qualifier 2695})
(defn ^String clojurescript-version
"Returns clojurescript version as a printable string."
diff --git a/src/cljs/cljs/bootstrap_node.js b/src/cljs/cljs/bootstrap_node.js
index 861b3cb..5abcfb0 100644
--- a/src/cljs/cljs/bootstrap_node.js
+++ b/src/cljs/cljs/bootstrap_node.js
@@ -40,7 +40,8 @@
*/
-var fs = require('fs');
+var fs = require('fs'),
+ vm = require('vm');
var path = require('path');
var CLJS_ROOT = "./";
@@ -76,7 +77,7 @@ global.CLOSURE_IMPORT_SCRIPT = function(src) {
// Declared here so it can be used to require base.js
function nodeGlobalRequire(file) {
- process.binding('evals').NodeScript.runInThisContext.call(
+ vm.runInThisContext.call(
global, fs.readFileSync(file), file);
}
diff --git a/src/cljs/cljs/core.cljs b/src/cljs/cljs/core.cljs
index 12e7611..9b79e8d 100644
--- a/src/cljs/cljs/core.cljs
+++ b/src/cljs/cljs/core.cljs
@@ -13,7 +13,7 @@
(:import goog.string.StringBuffer))
;; next line is auto-generated by the build-script - Do not edit!
-(def *clojurescript-version*)
+(def *clojurescript-version* "0.0-2695")
(def *unchecked-if* false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment