Skip to content

Commit

Permalink
repl: deprecate REPLServer.rli
Browse files Browse the repository at this point in the history
This is only a reference to the instance and should not be used.

PR-URL: #26260
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR committed Feb 28, 2019
1 parent 8bb3092 commit 5843058
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
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.
<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>

This comment has been minimized.

Copy link
@mscdex

mscdex Mar 1, 2019

Contributor

@BridgeAR aren't these supposed to be replaced?

This comment has been minimized.

Copy link
@BridgeAR

BridgeAR Mar 1, 2019

Author Member

You are right. When landing, I somehow remembered them to be changed during release.

PR incoming.

This comment has been minimized.

Copy link
@cjihrig

cjihrig Mar 1, 2019

Contributor

This comment has been minimized.

Copy link
@BridgeAR

BridgeAR Mar 1, 2019

Author Member

Thanks

### DEP0XXX: using REPLServer.rli
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/26260
description: Runtime deprecation.
-->
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
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

0 comments on commit 5843058

Please sign in to comment.