Skip to content
Permalink
Browse files

repl: deprecate REPLServer.rli

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 Jan 21, 2019
1 parent 8bb3092 commit 584305841d0fabee5d96ae43badfa271da99a19f
Showing with 28 additions and 3 deletions.
  1. +13 −1 doc/api/deprecations.md
  2. +9 −2 lib/repl.js
  3. +6 −0 test/parallel/test-repl-options.js
@@ -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
@@ -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.

@mscdex

mscdex Mar 1, 2019

Contributor

@BridgeAR aren't these supposed to be replaced?

This comment has been minimized.

@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.

@cjihrig

This comment has been minimized.

@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
@@ -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';
@@ -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();

0 comments on commit 5843058

Please sign in to comment.
You can’t perform that action at this time.