|
@ -22,15 +22,6 @@ var context; |
|
|
|
|
|
|
|
|
var disableColors = process.env.NODE_DISABLE_COLORS ? true : false; |
|
|
var disableColors = process.env.NODE_DISABLE_COLORS ? true : false; |
|
|
|
|
|
|
|
|
function cwdRequire (id) { |
|
|
|
|
|
if (id.match(/^\.\.\//) || id.match(/^\.\//)) { |
|
|
|
|
|
id = path.join(process.cwd(), id); |
|
|
|
|
|
} |
|
|
|
|
|
return require(id); |
|
|
|
|
|
} |
|
|
|
|
|
Object.keys(require).forEach(function (k) { |
|
|
|
|
|
cwdRequire[k] = require[k]; |
|
|
|
|
|
}); |
|
|
|
|
|
// hack for require.resolve("./relative") to work properly.
|
|
|
// hack for require.resolve("./relative") to work properly.
|
|
|
module.filename = process.cwd() + "/repl"; |
|
|
module.filename = process.cwd() + "/repl"; |
|
|
|
|
|
|
|
@ -38,7 +29,7 @@ function resetContext() { |
|
|
context = Script.createContext(); |
|
|
context = Script.createContext(); |
|
|
for (var i in global) context[i] = global[i]; |
|
|
for (var i in global) context[i] = global[i]; |
|
|
context.module = module; |
|
|
context.module = module; |
|
|
context.require = cwdRequire; |
|
|
context.require = require; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|