@@ -6,6 +6,9 @@ var Module = require("module"),
66 detectStrictMode = require ( "./detectStrictMode.js" ) ,
77 moduleEnv = require ( "./moduleEnv.js" ) ;
88
9+ var __get__Src = __get__ . toString ( ) ,
10+ __set__Src = __set__ . toString ( ) ;
11+
912/**
1013 * Does actual rewiring the module. For further documentation @see index.js
1114 */
@@ -26,6 +29,7 @@ function internalRewire(parentModulePath, targetPath) {
2629 // Special support for older node versions that returned an array on Module._resolveFilename
2730 // @see https://github.com/joyent/node/blob/865b077819a9271a29f982faaef99dc635b57fbc/lib/module.js#L319
2831 // TODO Remove this switch on the next major release
32+ /* istanbul ignore next because it will be removed soon */
2933 if ( Array . isArray ( targetPath ) ) {
3034 targetPath = targetPath [ 1 ] ;
3135 }
@@ -38,8 +42,8 @@ function internalRewire(parentModulePath, targetPath) {
3842
3943 // We append our special setter and getter.
4044 appendix = "\n" ;
41- appendix += "module.exports.__set__ = " + __set__ . toString ( ) + "; " ;
42- appendix += "module.exports.__get__ = " + __get__ . toString ( ) + "; " ;
45+ appendix += "module.exports.__set__ = " + __set__Src + "; " ;
46+ appendix += "module.exports.__get__ = " + __get__Src + "; " ;
4347
4448 // Check if the module uses the strict mode.
4549 // If so we must ensure that "use strict"; stays at the beginning of the module.
0 commit comments