| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b77c890 commit 3f27f02
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -542,6 +542,20 @@ Type: Runtime | |||
| 542 | 542 | The `tls.createSecurePair()` API was deprecated in documentation in Node.js | |
| 543 | 543 | 0.11.3. Users should use `tls.Socket` instead. | |
| 544 | 544 | ||
| 545 | + <a id="DEP0065"></a> | ||
| 546 | + ### DEP0065: repl.REPL_MODE_MAGIC and NODE_REPL_MODE=magic | ||
| 547 | + | ||
| 548 | + Type: Documentation-only | ||
| 549 | + | ||
| 550 | + The `repl` module's `REPL_MODE_MAGIC` constant, used for `replMode` option, has | ||
| 551 | + been deprecated. Its behavior has been functionally identical to that of | ||
| 552 | + `REPL_MODE_SLOPPY` since Node.js v6.0.0, when V8 5.0 was imported. Please use | ||
| 553 | + `REPL_MODE_SLOPPY` instead. | ||
| 554 | + | ||
| 555 | + The `NODE_REPL_MODE` environment variable is used to set the underlying | ||
| 556 | + `replMode` of an interactive `node` session. Its default value, `magic`, is | ||
| 557 | + similarly deprecated in favor of `sloppy`. | ||
| 558 | + | ||
| 545 | 559 | [alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding | |
| 546 | 560 | [alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size | |
| 547 | 561 | [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -408,14 +408,15 @@ changes: | |||
| 408 | 408 | command before writing to `output`. Defaults to [`util.inspect()`][]. | |
| 409 | 409 | * `completer` {Function} An optional function used for custom Tab auto | |
| 410 | 410 | completion. See [`readline.InterfaceCompleter`][] for an example. | |
| 411 | - * `replMode` - A flag that specifies whether the default evaluator executes | ||
| 412 | - all JavaScript commands in strict mode, default mode, or a hybrid mode | ||
| 413 | - ("magic" mode.) Acceptable values are: | ||
| 411 | + * `replMode` {symbol} A flag that specifies whether the default evaluator | ||
| 412 | + executes all JavaScript commands in strict mode or default (sloppy) mode. | ||
| 413 | + Acceptable values are: | ||
| 414 | 414 | * `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. | |
| 415 | 415 | * `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is | |
| 416 | 416 | equivalent to prefacing every repl statement with `'use strict'`. | |
| 417 | - * `repl.REPL_MODE_MAGIC` - attempt to evaluates expressions in default | ||
| 418 | - mode. If expressions fail to parse, re-try in strict mode. | ||
| 417 | + * `repl.REPL_MODE_MAGIC` - This value is **deprecated**, since enhanced | ||
| 418 | + spec compliance in V8 has rendered magic mode unnecessary. It is now | ||
| 419 | + equivalent to `repl.REPL_MODE_SLOPPY` (documented above). | ||
| 419 | 420 | * `breakEvalOnSigint` - Stop evaluating the current piece of code when | |
| 420 | 421 | `SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together | |
| 421 | 422 | with a custom `eval` function. Defaults to `false`. | |
@@ -461,8 +462,8 @@ environment variables: | |||
| 461 | 462 | - `NODE_REPL_HISTORY_SIZE` - Defaults to `1000`. Controls how many lines of | |
| 462 | 463 | history will be persisted if history is available. Must be a positive number. | |
| 463 | 464 | - `NODE_REPL_MODE` - May be any of `sloppy`, `strict`, or `magic`. Defaults | |
| 464 | - to `magic`, which will automatically run "strict mode only" statements in | ||
| 465 | - strict mode. | ||
| 465 | + to `sloppy`, which will allow non-strict mode code to be run. `magic` is | ||
| 466 | + **deprecated** and treated as an alias of `sloppy`. | ||
| 466 | 467 | ||
| 467 | 468 | ### Persistent History | |
| 468 | 469 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,12 +39,11 @@ function createRepl(env, opts, cb) { | |||
| 39 | 39 | ||
| 40 | 40 | opts.replMode = { | |
| 41 | 41 | 'strict': REPL.REPL_MODE_STRICT, | |
| 42 | - 'sloppy': REPL.REPL_MODE_SLOPPY, | ||
| 43 | - 'magic': REPL.REPL_MODE_MAGIC | ||
| 42 | + 'sloppy': REPL.REPL_MODE_SLOPPY | ||
| 44 | 43 | }[String(env.NODE_REPL_MODE).toLowerCase().trim()]; | |
| 45 | 44 | ||
| 46 | 45 | if (opts.replMode === undefined) { | |
| 47 | - opts.replMode = REPL.REPL_MODE_MAGIC; | ||
| 46 | + opts.replMode = REPL.REPL_MODE_SLOPPY; | ||
| 48 | 47 | } | |
| 49 | 48 | ||
| 50 | 49 | const historySize = Number(env.NODE_REPL_HISTORY_SIZE); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -633,7 +633,7 @@ exports.REPLServer = REPLServer; | |||
| 633 | 633 | ||
| 634 | 634 | exports.REPL_MODE_SLOPPY = Symbol('repl-sloppy'); | |
| 635 | 635 | exports.REPL_MODE_STRICT = Symbol('repl-strict'); | |
| 636 | - exports.REPL_MODE_MAGIC = Symbol('repl-magic'); | ||
| 636 | + exports.REPL_MODE_MAGIC = exports.REPL_MODE_SLOPPY; | ||
| 637 | 637 | ||
| 638 | 638 | // prompt is a string to print on each line for the prompt, | |
| 639 | 639 | // source is a stream to use for I/O, defaulting to stdin/stdout. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments