Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rewire.js')
-rw-r--r--lib/rewire.js23
1 files changed, 3 insertions, 20 deletions
diff --git a/lib/rewire.js b/lib/rewire.js
index 1d240d4..e678f37 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") {
@@ -27,14 +23,6 @@ function internalRewire(parentModulePath, targetPath, opts) {
// Resolve full filename relative to the parent module
targetPath = Module._resolveFilename(targetPath, parentModulePath);
- // Special support for older node versions that returned an array on Module._resolveFilename
- // @see https://github.com/joyent/node/blob/865b077819a9271a29f982faaef99dc635b57fbc/lib/module.js#L319
- // TODO Remove this switch on the next major release
- /* istanbul ignore next because it will be removed soon */
- if (Array.isArray(targetPath)) {
- targetPath = targetPath[1];
- }
-
// Create testModule as it would be created by require()
targetModule = new Module(targetPath, parentModulePath);
@@ -59,12 +47,7 @@ function internalRewire(parentModulePath, targetPath, opts) {
}
moduleEnv.inject(prelude, appendix);
-
- if(isTransform) {
- moduleEnv.compile(targetModule, src, targetPath);
- } else {
- moduleEnv.load(targetModule);
- }
+ moduleEnv.load(targetModule);
return targetModule.exports;
}