Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: deprecate REPLServer.rli #26260

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,6 @@ Type: Runtime

Please use `Server.prototype.setSecureContext()` instead.


BridgeAR marked this conversation as resolved.
Show resolved Hide resolved
<a id="DEP0123"></a>
### DEP0123: setting the TLS ServerName to an IP address
<!-- YAML
Expand All @@ -2336,6 +2335,19 @@ Type: Runtime
Setting the TLS ServerName to an IP address is not permitted by
[RFC 6066][]. This will be ignored in a future version.

<a id="DEP0XXX"></a>
### DEP0XXX: using REPLServer#rli
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/REPLACEME
description: Runtime deprecation.
-->

Type: Runtime

This property is just a reference to the instance itself.
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved

[`--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
Expand Down
11 changes: 9 additions & 2 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 6 additions & 0 deletions test/parallel/test-repl-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down