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: remove magic mode #19187

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,16 +560,16 @@ The `tls.createSecurePair()` API was deprecated in documentation in Node.js
<a id="DEP0065"></a>
### DEP0065: repl.REPL_MODE_MAGIC and NODE_REPL_MODE=magic

Type: Documentation-only
Type: End-of-Life

The `repl` module's `REPL_MODE_MAGIC` constant, used for `replMode` option, has
been deprecated. Its behavior has been functionally identical to that of
been removed. Its behavior has been functionally identical to that of
`REPL_MODE_SLOPPY` since Node.js v6.0.0, when V8 5.0 was imported. Please use
`REPL_MODE_SLOPPY` instead.

The `NODE_REPL_MODE` environment variable is used to set the underlying
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is still okay here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I see it: yes. Because the environment variable still exists.

`replMode` of an interactive `node` session. Its default value, `magic`, is
similarly deprecated in favor of `sloppy`.
`replMode` of an interactive `node` session. Its value, `magic`, is also
removed. Please use `sloppy` instead.

<a id="DEP0066"></a>
### DEP0066: outgoingMessage.\_headers, outgoingMessage.\_headerNames
Expand Down
11 changes: 5 additions & 6 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ Returns `true` if `keyword` is a valid keyword, otherwise `false`.
<!-- YAML
added: v0.1.91
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/REPLACEME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was landed with a mistake.
I will make a PR with a fix (with some other minor link fixes in the docs).

description: The `REPL_MAGIC_MODE` replMode was removed.
- version: v5.8.0
pr-url: https://github.com/nodejs/node/pull/5388
description: The `options` parameter is optional now.
Expand Down Expand Up @@ -462,9 +465,6 @@ changes:
* `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
* `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is
equivalent to prefacing every repl statement with `'use strict'`.
* `repl.REPL_MODE_MAGIC` - This value is **deprecated**, since enhanced
spec compliance in V8 has rendered magic mode unnecessary. It is now
equivalent to `repl.REPL_MODE_SLOPPY` (documented above).
* `breakEvalOnSigint` - Stop evaluating the current piece of code when
`SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together
with a custom `eval` function. Defaults to `false`.
Expand Down Expand Up @@ -512,9 +512,8 @@ environment variables:
REPL history. Whitespace will be trimmed from the value.
- `NODE_REPL_HISTORY_SIZE` - Defaults to `1000`. Controls how many lines of
history will be persisted if history is available. Must be a positive number.
- `NODE_REPL_MODE` - May be any of `sloppy`, `strict`, or `magic`. Defaults
to `sloppy`, which will allow non-strict mode code to be run. `magic` is
**deprecated** and treated as an alias of `sloppy`.
- `NODE_REPL_MODE` - May be either `sloppy` or `strict`. Defaults
to `sloppy`, which will allow non-strict mode code to be run.

### Persistent History

Expand Down
1 change: 0 additions & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,6 @@ exports.REPLServer = REPLServer;

exports.REPL_MODE_SLOPPY = Symbol('repl-sloppy');
exports.REPL_MODE_STRICT = Symbol('repl-strict');
exports.REPL_MODE_MAGIC = exports.REPL_MODE_SLOPPY;

// prompt is a string to print on each line for the prompt,
// source is a stream to use for I/O, defaulting to stdin/stdout.
Expand Down
16 changes: 3 additions & 13 deletions test/parallel/test-repl-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const r2 = repl.start({
ignoreUndefined: true,
eval: evaler,
writer: writer,
replMode: repl.REPL_MODE_STRICT
replMode: repl.REPL_MODE_STRICT,
historySize: 50
});
assert.strictEqual(r2.input, stream);
assert.strictEqual(r2.output, stream);
Expand All @@ -79,6 +80,7 @@ assert.strictEqual(r2.useGlobal, true);
assert.strictEqual(r2.ignoreUndefined, true);
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);
Expand All @@ -87,18 +89,6 @@ assert.strictEqual(r2.rli.input, r2.inputStream);
assert.strictEqual(r2.rli.output, r2.outputStream);
assert.strictEqual(r2.rli.terminal, false);

// testing out "magic" replMode
const r3 = repl.start({
input: stream,
output: stream,
writer: writer,
replMode: repl.REPL_MODE_MAGIC,
historySize: 50
});

assert.strictEqual(r3.replMode, repl.REPL_MODE_MAGIC);
assert.strictEqual(r3.historySize, 50);

// Verify that defaults are used when no arguments are provided
const r4 = repl.start();

Expand Down