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

readline: refactor readline module #12755

Closed
wants to merge 5 commits into from

Conversation

@jasnell
Copy link
Member

commented Apr 30, 2017

Refactor parts of the readline module

  • Move to more efficient module.exports = {} pattern
  • Restructure imports and other minor code cleanups
  • Move CSI (escape codes) into internal/readline for easier maintenance
  • Improve test coverage
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

readline

@jasnell jasnell changed the title Refactor readline readline: refactor readline module Apr 30, 2017

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Apr 30, 2017

@refack

This comment has been minimized.

Copy link
Member

commented Apr 30, 2017

IMHO in order not to conflict with @12711 change the variable function to arrows

@refack

This comment has been minimized.

Copy link
Member

commented Apr 30, 2017

P.S. freeBSD seems unrelated:

731	parallel/test-net-connect-local-error	
duration_ms	0.364
severity	fail
stack	
assert.js:86
  throw new assert.AssertionError({
  ^
AssertionError: undefined !== 12346 in Error: connect EADDRINUSE 127.0.0.1:12347 - Local (127.0.0.1:12346)
    at Socket.onError (/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/parallel/test-net-connect-local-error.js:13:10)
    at Socket.<anonymous> (/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/common.js:461:15)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at emitErrorNT (net.js:1302:8)
    at _combinedTickCallback (internal/process/next_tick.js:81:11)
    at process._tickCallback (internal/process/next_tick.js:105:9)
@addaleax
Copy link
Member

left a comment

Mostly LGTM, got one tiny correction though ;)

lib/internal/readline.js Outdated
@@ -7,23 +7,38 @@
const ansi =
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;

const kCSI = '\x1b';

This comment has been minimized.

Copy link
@addaleax

addaleax Apr 30, 2017

Member

The CSI would be \x1b[ (2 chars) or \x9b, this is just an escape character, so it would probably be a good idea to rename this to kEscape, or use \x1b[ here

This comment has been minimized.

Copy link
@jasnell

jasnell May 1, 2017

Author Member

Yeah, good point :-)

jasnell added 2 commits Apr 30, 2017
readline: move escape codes into internal/readline
Moves escape codes into internal/readline for easier management.

@jasnell jasnell force-pushed the jasnell:refactor-readline branch to a5521a6 May 1, 2017

@jasnell

This comment has been minimized.

Copy link
Member Author

commented May 1, 2017

@addaleax ... updated!

@addaleax

This comment has been minimized.

Copy link
Member

commented May 3, 2017

@addaleax

This comment has been minimized.

Copy link
Member

commented May 7, 2017

Landed in a398516...d37f27a

@addaleax addaleax closed this May 7, 2017

addaleax added a commit that referenced this pull request May 7, 2017
readline: use module.exports = {}
PR-URL: #12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax added a commit that referenced this pull request May 7, 2017
readline: use module.exports = {} on internal/readline
PR-URL: #12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax added a commit that referenced this pull request May 7, 2017
readline: multiple code cleanups
Variety of code maintenance updates, cleanups

PR-URL: #12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax added a commit that referenced this pull request May 7, 2017
readline: move escape codes into internal/readline
Moves escape codes into internal/readline for easier management.

PR-URL: #12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax added a commit that referenced this pull request May 7, 2017
test: expand test coverage of readline
PR-URL: #12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
anchnk pushed a commit to anchnk/node that referenced this pull request May 19, 2017
readline: use module.exports = {}
PR-URL: nodejs#12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
anchnk pushed a commit to anchnk/node that referenced this pull request May 19, 2017
readline: use module.exports = {} on internal/readline
PR-URL: nodejs#12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
anchnk pushed a commit to anchnk/node that referenced this pull request May 19, 2017
readline: multiple code cleanups
Variety of code maintenance updates, cleanups

PR-URL: nodejs#12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
anchnk pushed a commit to anchnk/node that referenced this pull request May 19, 2017
readline: move escape codes into internal/readline
Moves escape codes into internal/readline for easier management.

PR-URL: nodejs#12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
anchnk pushed a commit to anchnk/node that referenced this pull request May 19, 2017
test: expand test coverage of readline
PR-URL: nodejs#12755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@jasnell jasnell referenced this pull request May 11, 2017
@gibfahn gibfahn referenced this pull request Jun 15, 2017
2 of 3 tasks complete
@gibfahn

This comment has been minimized.

Copy link
Member

commented Jun 20, 2017

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if no let me know or add the dont-land-on label.

Very possibly not worth backporting, your call @jasnell .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.