From 38bd879a9abaa6a86504ecb469eb4d7188edf22f Mon Sep 17 00:00:00 2001 From: Geoffry Song Date: Wed, 29 Jan 2014 13:23:19 -0500 Subject: [PATCH] Fix a typo causing module.paths to be always set as the cwd. `options.fileName` was used instead of `options.filename`. --- lib/coffee-script/coffee-script.js | 2 +- src/coffee-script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/coffee-script/coffee-script.js b/lib/coffee-script/coffee-script.js index d80ab947..d8d66e75 100644 --- a/lib/coffee-script/coffee-script.js +++ b/lib/coffee-script/coffee-script.js @@ -110,7 +110,7 @@ mainModule = require.main; mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; mainModule.moduleCache && (mainModule.moduleCache = {}); - dir = options.fileName ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.'); + dir = options.filename ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.'); mainModule.paths = require('module')._nodeModulePaths(dir); if (!helpers.isCoffee(mainModule.filename) || require.extensions) { answer = compile(code, options); diff --git a/src/coffee-script.coffee b/src/coffee-script.coffee index 41a1d399..95d89f8f 100644 --- a/src/coffee-script.coffee +++ b/src/coffee-script.coffee @@ -107,7 +107,7 @@ exports.run = (code, options = {}) -> mainModule.moduleCache and= {} # Assign paths for node_modules loading - dir = if options.fileName + dir = if options.filename path.dirname fs.realpathSync options.filename else fs.realpathSync '.'