diff options
author | Jan Krems <jan.krems@groupon.com> | 2019-06-03 10:05:10 +0200 |
---|---|---|
committer | Jan Krems <jan.krems@gmail.com> | 2019-06-05 08:20:18 -0700 |
commit | 6a7d3ca5157a128bf0274bb5b782c00312796251 (patch) | |
tree | 4f3bb8580813f72b0d70361a5ac308e0071cc412 /deps/node-inspect/lib | |
parent | 1279e2530b1db41f2b4135357f4177d08fb33016 (diff) | |
download | android-node-v8-6a7d3ca5157a128bf0274bb5b782c00312796251.tar.gz android-node-v8-6a7d3ca5157a128bf0274bb5b782c00312796251.tar.bz2 android-node-v8-6a7d3ca5157a128bf0274bb5b782c00312796251.zip |
deps: update node-inspect to v1.11.6
Highlights:
* The `node-inspect` test suite passes against latest master.
* Removes use of deprecated `repl.rli`.
Compare: https://github.com/nodejs/node-inspect/compare/v1.11.5...v1.11.6
PR-URL: https://github.com/nodejs/node/pull/28039
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'deps/node-inspect/lib')
-rw-r--r-- | deps/node-inspect/lib/_inspect.js | 4 | ||||
-rw-r--r-- | deps/node-inspect/lib/internal/inspect_repl.js | 30 |
2 files changed, 19 insertions, 15 deletions
diff --git a/deps/node-inspect/lib/_inspect.js b/deps/node-inspect/lib/_inspect.js index 305e49915a..4d931f7a2b 100644 --- a/deps/node-inspect/lib/_inspect.js +++ b/deps/node-inspect/lib/_inspect.js @@ -198,7 +198,7 @@ class NodeInspector { suspendReplWhile(fn) { if (this.repl) { - this.repl.rli.pause(); + this.repl.pause(); } this.stdin.pause(); this.paused = true; @@ -207,7 +207,7 @@ class NodeInspector { }).then(() => { this.paused = false; if (this.repl) { - this.repl.rli.resume(); + this.repl.resume(); this.repl.displayPrompt(); } this.stdin.resume(); diff --git a/deps/node-inspect/lib/internal/inspect_repl.js b/deps/node-inspect/lib/internal/inspect_repl.js index 38fe4684cf..d9d3f89f03 100644 --- a/deps/node-inspect/lib/internal/inspect_repl.js +++ b/deps/node-inspect/lib/internal/inspect_repl.js @@ -25,6 +25,7 @@ const Path = require('path'); const Repl = require('repl'); const util = require('util'); const vm = require('vm'); +const fileURLToPath = require('url').fileURLToPath; const debuglog = util.debuglog('inspect'); @@ -89,9 +90,12 @@ function isNativeUrl(url) { return url.replace('.js', '') in NATIVES || url === 'bootstrap_node.js'; } -function getRelativePath(filename) { +function getRelativePath(filenameOrURL) { const dir = Path.join(Path.resolve(), 'x').slice(0, -1); + const filename = filenameOrURL.startsWith('file://') ? + fileURLToPath(filenameOrURL) : filenameOrURL; + // Change path to relative, if possible if (filename.indexOf(dir) === 0) { return filename.slice(dir.length); @@ -958,8 +962,8 @@ function createRepl(inspector) { get repl() { // Don't display any default messages - const listeners = repl.rli.listeners('SIGINT').slice(0); - repl.rli.removeAllListeners('SIGINT'); + const listeners = repl.listeners('SIGINT').slice(0); + repl.removeAllListeners('SIGINT'); const oldContext = repl.context; @@ -967,7 +971,7 @@ function createRepl(inspector) { // Restore all listeners process.nextTick(() => { listeners.forEach((listener) => { - repl.rli.on('SIGINT', listener); + repl.on('SIGINT', listener); }); }); @@ -975,21 +979,21 @@ function createRepl(inspector) { repl.eval = controlEval; // Swap history - history.debug = repl.rli.history; - repl.rli.history = history.control; + history.debug = repl.history; + repl.history = history.control; repl.context = oldContext; - repl.rli.setPrompt('debug> '); + repl.setPrompt('debug> '); repl.displayPrompt(); - repl.rli.removeListener('SIGINT', exitDebugRepl); + repl.removeListener('SIGINT', exitDebugRepl); repl.removeListener('exit', exitDebugRepl); exitDebugRepl = null; }; // Exit debug repl on SIGINT - repl.rli.on('SIGINT', exitDebugRepl); + repl.on('SIGINT', exitDebugRepl); // Exit debug repl on repl exit repl.on('exit', exitDebugRepl); @@ -999,10 +1003,10 @@ function createRepl(inspector) { repl.context = {}; // Swap history - history.control = repl.rli.history; - repl.rli.history = history.debug; + history.control = repl.history; + repl.history = history.debug; - repl.rli.setPrompt('> '); + repl.setPrompt('> '); print('Press Ctrl + C to leave debug repl'); repl.displayPrompt(); @@ -1077,7 +1081,7 @@ function createRepl(inspector) { repl.defineCommand('interrupt', () => { // We want this for testing purposes where sending CTRL-C can be tricky. - repl.rli.emit('SIGINT'); + repl.emit('SIGINT'); }); // Init once for the initial connection |