|
1 | 1 | var Module = require("module"), |
2 | 2 | fs = require("fs"), |
3 | | - __get__ = require("./__get__.js"), |
4 | | - __set__ = require ("./__set__.js"), |
5 | | - __with__ = require("./__with__.js"), |
6 | 3 | getImportGlobalsSrc = require("./getImportGlobalsSrc.js"), |
| 4 | + getDefinePropertySrc = require("./getDefinePropertySrc.js"), |
7 | 5 | detectStrictMode = require("./detectStrictMode.js"), |
8 | 6 | moduleEnv = require("./moduleEnv.js"); |
9 | 7 |
|
10 | | -var srcs = { |
11 | | - "__get__": __get__.toString(), |
12 | | - "__set__": __set__.toString(), |
13 | | - "__with__": __with__.toString() |
14 | | -}; |
15 | | - |
16 | 8 | /** |
17 | 9 | * Does actual rewiring the module. For further documentation @see index.js |
18 | 10 | */ |
@@ -45,15 +37,7 @@ function internalRewire(parentModulePath, targetPath) { |
45 | 37 | prelude = getImportGlobalsSrc(); |
46 | 38 |
|
47 | 39 | // We append our special setter and getter. |
48 | | - appendix = "\n"; |
49 | | - |
50 | | - Object.keys(srcs).forEach(function forEachSrc(key) { |
51 | | - appendix += "Object.defineProperty(module.exports, '" + |
52 | | - key + |
53 | | - "', {enumerable: false, value: " + |
54 | | - srcs[key] + |
55 | | - "}); "; |
56 | | - }); |
| 40 | + appendix = "\n" + getDefinePropertySrc(); |
57 | 41 |
|
58 | 42 | // Check if the module uses the strict mode. |
59 | 43 | // If so we must ensure that "use strict"; stays at the beginning of the module. |
|
0 commit comments