@@ -7,24 +7,19 @@ var Module = require("module"),
77detectStrictMode = require ( "./detectStrictMode.js" ) ,
88moduleEnv = require ( "./moduleEnv.js" ) ;
99
10- var __get__Src = __get__ . toString ( ) ,
11- __set__Src = __set__ . toString ( ) ,
12- __with__Src = __with__ . toString ( ) ;
10+ var srcs = {
11+ "__get__" :__get__ . toString ( ) ,
12+ "__set__" :__set__ . toString ( ) ,
13+ "__with__" :__with__ . toString ( )
14+ } ;
1315
1416/**
1517 * Does actual rewiring the module. For further documentation @see index.js
1618 */
1719function internalRewire ( parentModulePath , targetPath ) {
1820var targetModule ,
1921prelude ,
20- appendix ,
21- srcs ;
22-
23- srcs = {
24- "__get__" :__get__Src ,
25- "__set__" :__set__Src ,
26- "__with__" :__with__Src
27- } ;
22+ appendix ;
2823
2924// Checking params
3025if ( typeof targetPath !== "string" ) {
@@ -48,19 +43,15 @@ function internalRewire(parentModulePath, targetPath) {
4843// We prepend a list of all globals declared with var so they can be overridden (without changing original globals)
4944prelude = getImportGlobalsSrc ( ) ;
5045
51-
5246// We append our special setter and getter.
5347appendix = "\n" ;
5448
55- Object . keys ( srcs ) . forEach ( function ( key ) {
56- var str = [
57- "Object.defineProperty(module.exports, '" ,
58- key ,
59- "', {enumerable: false, value: " ,
60- srcs [ key ] ,
61- "}); "
62- ] . join ( "" ) ;
63- appendix += str ;
49+ Object . keys ( srcs ) . forEach ( function forEachSrc ( key ) {
50+ appendix += "Object.defineProperty(module.exports, '" +
51+ key +
52+ "', {enumerable: false, value: " +
53+ srcs [ key ] +
54+ "}); " ;
6455} ) ;
6556
6657// Check if the module uses the strict mode.