diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 459fdbbd992628..15bf869790e9ce 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2321,7 +2321,6 @@ Type: Runtime Please use `Server.prototype.setSecureContext()` instead. - ### DEP0123: setting the TLS ServerName to an IP address + +Type: Runtime + +This property is a reference to the instance itself. + [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array diff --git a/lib/repl.js b/lib/repl.js index 5db94641a3c3d1..c9004fdda041eb 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -176,8 +176,15 @@ function REPLServer(prompt, // Context id for use with the inspector protocol. self[kContextId] = undefined; - // Just for backwards compat, see github.com/joyent/node/pull/7127 - self.rli = this; + let rli = self; + Object.defineProperty(self, 'rli', { + get: util.deprecate(() => rli, + 'REPLServer.rli is deprecated', 'DEP0XXX'), + set: util.deprecate((val) => rli = val, + 'REPLServer.rli is deprecated', 'DEP0XXX'), + enumerable: true, + configurable: true + }); const savedRegExMatches = ['', '', '', '', '', '', '', '', '', '']; const sep = '\u0000\u0000\u0000'; diff --git a/test/parallel/test-repl-options.js b/test/parallel/test-repl-options.js index 8d9f8e5b0703c4..72e39c441358da 100644 --- a/test/parallel/test-repl-options.js +++ b/test/parallel/test-repl-options.js @@ -25,6 +25,12 @@ const ArrayStream = require('../common/arraystream'); const assert = require('assert'); const repl = require('repl'); +common.expectWarning({ + DeprecationWarning: { + DEP0XXX: 'REPLServer.rli is deprecated' + } +}); + // Create a dummy stream that does nothing const stream = new ArrayStream();