diff options
Diffstat (limited to 'lib/rewire.js')
-rw-r--r-- | lib/rewire.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/rewire.js b/lib/rewire.js index 1d240d4..536929d 100644 --- a/lib/rewire.js +++ b/lib/rewire.js @@ -9,15 +9,11 @@ var Module = require("module"), /** * Does actual rewiring the module. For further documentation @see index.js */ -function internalRewire(parentModulePath, targetPath, opts) { +function internalRewire(parentModulePath, targetPath) { var targetModule, prelude, appendix, - src, - isTransform; - - opts = typeof opts === "object" ? opts : {}; - isTransform = !!opts.convertConst; + src; // Checking params if (typeof targetPath !== "string") { @@ -60,12 +56,13 @@ function internalRewire(parentModulePath, targetPath, opts) { moduleEnv.inject(prelude, appendix); - if(isTransform) { - moduleEnv.compile(targetModule, src, targetPath); - } else { + if (targetPath.match(/\.coffee$/)) { moduleEnv.load(targetModule); + } else { + moduleEnv.compile(targetModule, src, targetPath); } + return targetModule.exports; } |