(replModule)
| 793 | const path = require('path'); |
| 794 | |
| 795 | function fixReplRequire(replModule) { |
| 796 | try { |
| 797 | // Hack for require.resolve("./relative") to work properly. |
| 798 | replModule.filename = path.resolve('repl'); |
| 799 | } catch { |
| 800 | // path.resolve('repl') fails when the current working directory has been |
| 801 | // deleted. Fall back to the directory name of the (absolute) executable |
| 802 | // path. It's not really correct but what are the alternatives? |
| 803 | const dirname = path.dirname(process.execPath); |
| 804 | replModule.filename = path.resolve(dirname, 'repl'); |
| 805 | } |
| 806 | |
| 807 | // Hack for repl require to work properly with node_modules folders |
| 808 | replModule.paths = CJSModule._nodeModulePaths(replModule.filename); |
| 809 | } |
| 810 | |
| 811 | let nextREPLResourceNumber = 1; |
| 812 | // This prevents v8 code cache from getting confused and using a different |
no test coverage detected
searching dependent graphs…