From 421355367cda0e2f337277d214ee8af106a399ac Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 7 May 2020 20:19:08 +0200 Subject: [PATCH 1/5] repl: remove deprecated .rli The .rli property is just a reference to the active REPL instance and it was deprecated for a long time. To improve maintainability of the REPL this feature is removed. Signed-off-by: Ruben Bridgewater --- doc/api/deprecations.md | 5 ++++- lib/repl.js | 10 ---------- test/parallel/test-repl-options.js | 16 ---------------- 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 79060f1db76db8..9717065370da43 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2385,12 +2385,15 @@ Setting the TLS ServerName to an IP address is not permitted by ### DEP0124: using `REPLServer.rli` -Type: Runtime +Type: End-of-Life This property is a reference to the instance itself. diff --git a/lib/repl.js b/lib/repl.js index 41aaf126e39b94..66972275ebecdf 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -299,16 +299,6 @@ function REPLServer(prompt, domainSet.add(this._domain); - let rli = this; - ObjectDefineProperty(this, 'rli', { - get: deprecate(() => rli, - 'REPLServer.rli is deprecated', 'DEP0124'), - set: deprecate((val) => rli = val, - 'REPLServer.rli is deprecated', 'DEP0124'), - enumerable: true, - configurable: true - }); - const savedRegExMatches = ['', '', '', '', '', '', '', '', '', '']; const sep = '\u0000\u0000\u0000'; const regExMatcher = new RegExp(`^${sep}(.*)${sep}(.*)${sep}(.*)${sep}(.*)` + diff --git a/test/parallel/test-repl-options.js b/test/parallel/test-repl-options.js index cb7b2f08b65468..3f6e16ee47fba2 100644 --- a/test/parallel/test-repl-options.js +++ b/test/parallel/test-repl-options.js @@ -37,7 +37,6 @@ common.expectWarning({ 'repl._builtinLibs is deprecated. Check module.builtinModules instead', DEP0141: 'repl.inputStream and repl.outputStream is deprecated. ' + 'Use repl.input and repl.output instead', - DEP0124: 'REPLServer.rli is deprecated', } }); @@ -62,14 +61,6 @@ assert.strictEqual(r1.ignoreUndefined, false); assert.strictEqual(r1.replMode, repl.REPL_MODE_SLOPPY); assert.strictEqual(r1.historySize, 30); -// Test r1 for backwards compact -assert.strictEqual(r1.rli.input, stream); -assert.strictEqual(r1.rli.output, stream); -assert.strictEqual(r1.rli.input, r1.inputStream); -assert.strictEqual(r1.rli.output, r1.outputStream); -assert.strictEqual(r1.rli.terminal, true); -assert.strictEqual(r1.useColors, r1.rli.terminal); - // 2 function writer() {} @@ -98,13 +89,6 @@ assert.strictEqual(r2.writer, writer); assert.strictEqual(r2.replMode, repl.REPL_MODE_STRICT); assert.strictEqual(r2.historySize, 50); -// Test r2 for backwards compact -assert.strictEqual(r2.rli.input, stream); -assert.strictEqual(r2.rli.output, stream); -assert.strictEqual(r2.rli.input, r2.inputStream); -assert.strictEqual(r2.rli.output, r2.outputStream); -assert.strictEqual(r2.rli.terminal, false); - // 3, breakEvalOnSigint and eval supplied together should cause a throw const r3 = () => repl.start({ breakEvalOnSigint: true, From cc525793712e59980a6670a5e6a48b1014ef3ceb Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 7 May 2020 20:22:12 +0200 Subject: [PATCH 2/5] repl: remove deprecated bufferedCommand property This property is deprecated since Node.js v9.0.0 and to improve maintainability of the REPL it is now removed. Signed-off-by: Ruben Bridgewater --- doc/api/deprecations.md | 5 ++++- lib/repl.js | 9 --------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 9717065370da43..18104d0249baab 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1547,12 +1547,15 @@ code, no replacement API is provided. ### DEP0074: `REPLServer.bufferedCommand` -Type: Runtime +Type: End-of-Life The `REPLServer.bufferedCommand` property was deprecated in favor of [`REPLServer.clearBufferedCommand()`][]. diff --git a/lib/repl.js b/lib/repl.js index 66972275ebecdf..d33b26f947caef 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -626,15 +626,6 @@ function REPLServer(prompt, }); self.clearBufferedCommand(); - ObjectDefineProperty(this, 'bufferedCommand', { - get: deprecate(() => self[kBufferedCommandSymbol], - 'REPLServer.bufferedCommand is deprecated', - 'DEP0074'), - set: deprecate((val) => self[kBufferedCommandSymbol] = val, - 'REPLServer.bufferedCommand is deprecated', - 'DEP0074'), - enumerable: true - }); function completer(text, cb) { complete.call(self, text, self.editorMode ? From f3829eb2425eb1c5caf201b095d8a050b13a6456 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 7 May 2020 20:28:19 +0200 Subject: [PATCH 3/5] repl: remove deprecated repl.parseREPLKeyword() function This removes the deprecated REPLServer.parseREPLKeyword function. It is deprecated for a long time and should not provide any benefit to users. To improve the maintainability of the REPL module, it's now removed. Signed-off-by: Ruben Bridgewater --- doc/api/deprecations.md | 5 ++++- lib/repl.js | 5 ----- test/parallel/test-repl-deprecations.js | 16 ---------------- 3 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 test/parallel/test-repl-deprecations.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 18104d0249baab..5b1caa00ac82ed 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1564,12 +1564,15 @@ The `REPLServer.bufferedCommand` property was deprecated in favor of ### DEP0075: `REPLServer.parseREPLKeyword()` -Type: Runtime +Type: End-of-Life `REPLServer.parseREPLKeyword()` was removed from userland visibility. diff --git a/lib/repl.js b/lib/repl.js index d33b26f947caef..457eabb97c3577 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -679,11 +679,6 @@ function REPLServer(prompt, return false; } - self.parseREPLKeyword = deprecate( - _parseREPLKeyword, - 'REPLServer.parseREPLKeyword() is deprecated', - 'DEP0075'); - self.on('close', function emitExit() { if (paused) { pausedBuffer.push(['close']); diff --git a/test/parallel/test-repl-deprecations.js b/test/parallel/test-repl-deprecations.js deleted file mode 100644 index dbd50eb469f15a..00000000000000 --- a/test/parallel/test-repl-deprecations.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const repl = require('repl'); - -testParseREPLKeyword(); - -function testParseREPLKeyword() { - const server = repl.start({ prompt: '> ' }); - const warn = 'REPLServer.parseREPLKeyword() is deprecated'; - - common.expectWarning('DeprecationWarning', warn, 'DEP0075'); - assert.ok(server.parseREPLKeyword('clear')); - assert.ok(!server.parseREPLKeyword('tacos')); - server.close(); -} From 01d93225c8f132c9d2bc3ab1def98835d548ad36 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 7 May 2020 20:31:03 +0200 Subject: [PATCH 4/5] repl: remove deprecated repl.turnOffEditorMode() function This function is deprecated for multiple years and provides very little benefit to users. Thus, it's removed to improve the maintainability of the REPL module. Signed-off-by: Ruben Bridgewater --- doc/api/deprecations.md | 5 ++++- lib/repl.js | 5 ----- test/parallel/test-repl-turn-off-editor-mode.js | 14 -------------- 3 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 test/parallel/test-repl-turn-off-editor-mode.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 5b1caa00ac82ed..56dee4ebf84aa0 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1628,12 +1628,15 @@ supported API. ### DEP0078: `REPLServer.turnOffEditorMode()` -Type: Runtime +Type: End-of-Life `REPLServer.turnOffEditorMode()` was removed from userland visibility. diff --git a/lib/repl.js b/lib/repl.js index 457eabb97c3577..9b2b4a0a03ceab 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1034,11 +1034,6 @@ REPLServer.prototype.setPrompt = function setPrompt(prompt) { Interface.prototype.setPrompt.call(this, prompt); }; -REPLServer.prototype.turnOffEditorMode = deprecate( - function() { _turnOffEditorMode(this); }, - 'REPLServer.turnOffEditorMode() is deprecated', - 'DEP0078'); - const requireRE = /\brequire\s*\(\s*['"`](([\w@./-]+\/)?(?:[\w@./-]*))(?![^'"`])$/; const fsAutoCompleteRE = /fs(?:\.promises)?\.\s*[a-z][a-zA-Z]+\(\s*["'](.*)/; const simpleExpressionRE = diff --git a/test/parallel/test-repl-turn-off-editor-mode.js b/test/parallel/test-repl-turn-off-editor-mode.js deleted file mode 100644 index a966899b2c6391..00000000000000 --- a/test/parallel/test-repl-turn-off-editor-mode.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; -const common = require('../common'); -const repl = require('repl'); - -testTurnOffEditorMode(); - -function testTurnOffEditorMode() { - const server = repl.start({ prompt: '> ' }); - const warn = 'REPLServer.turnOffEditorMode() is deprecated'; - - common.expectWarning('DeprecationWarning', warn, 'DEP0078'); - server.turnOffEditorMode(); - server.close(); -} From eae6e38048172213ef0ecf10bd0339e58d5bd7ef Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 7 May 2020 20:33:01 +0200 Subject: [PATCH 5/5] repl: remove deprecated repl.memory function This removes the memory function. It is deprecated for a long time while not being really helpful being exposed. Thus, it is removed to improve maintainability of the REPL module. Signed-off-by: Ruben Bridgewater --- doc/api/deprecations.md | 5 ++++- lib/repl.js | 5 ----- test/parallel/test-repl-memory-deprecation.js | 15 --------------- 3 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 test/parallel/test-repl-memory-deprecation.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 56dee4ebf84aa0..1d39dfc337636b 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1696,12 +1696,15 @@ file descriptors. ### DEP0082: `REPLServer.prototype.memory()` -Type: Runtime +Type: End-of-Life `REPLServer.prototype.memory()` is only necessary for the internal mechanics of the `REPLServer` itself. Do not use this function. diff --git a/lib/repl.js b/lib/repl.js index 9b2b4a0a03ceab..03632e25a361c2 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1369,11 +1369,6 @@ REPLServer.prototype.defineCommand = function(keyword, cmd) { this.commands[keyword] = cmd; }; -REPLServer.prototype.memory = deprecate( - _memory, - 'REPLServer.memory() is deprecated', - 'DEP0082'); - // TODO(BridgeAR): This should be replaced with acorn to build an AST. The // language became more complex and using a simple approach like this is not // sufficient anymore. diff --git a/test/parallel/test-repl-memory-deprecation.js b/test/parallel/test-repl-memory-deprecation.js deleted file mode 100644 index 07d377d8fbf9fc..00000000000000 --- a/test/parallel/test-repl-memory-deprecation.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const repl = require('repl'); - -testMemory(); - -function testMemory() { - const server = repl.start({ prompt: '> ' }); - const warn = 'REPLServer.memory() is deprecated'; - - common.expectWarning('DeprecationWarning', warn, 'DEP0082'); - assert.strictEqual(server.memory(), undefined); - server.close(); -}