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

babel-node should support NODE_REPL_HISTORY #10739

Open
0xdevalias opened this issue Nov 20, 2019 · 1 comment
Open

babel-node should support NODE_REPL_HISTORY #10739

0xdevalias opened this issue Nov 20, 2019 · 1 comment

Comments

@0xdevalias
Copy link

@0xdevalias 0xdevalias commented Nov 20, 2019

Feature Request

Is your feature request related to a problem? Please describe.

Using node directly to start a reply allows us to use the NODE_REPL_HISTORY env var to maintain our history. This provides a more direct/'nicer' way than having to resort to the rlwrap workaround described at https://babeljs.io/docs/en/next/babel-node.html

The babel-node repl.start() is at https://github.com/babel/babel/blob/master/packages/babel-node/src/_babel-node.js#L214-L222:

function replStart() {
  repl.start({
    prompt: "> ",
    input: process.stdin,
    output: process.stdout,
    eval: replEval,
    useGlobal: true,
  });
}

If replServer.setupHistory(historyPath, callback) exists we could just call that, otherwise we could use the older method from v8.12.0 to implement similar.

Describe the solution you'd like

Being able to use an env var such as NODE_REPL_HISTORY or BABEL_NODE_REPL_HISTORY to support readline history directly within babel-node.

Describe alternatives you've considered

Tried various forms of working with the rlwrap workaround, but none seem as simple/concise/contained as the above (mostly around SIGINT passthrough and seeing the (To exit, press ^C again or type .exit) line)

The following StackOverflow comment describes how we should be able to make this work using .inputrc and rlwrap-direct-keypress, but I couldn't seem to get that to work either (on macOS catalina):

I thought that maybe because @babel/node doesn't install/suggest to install kexec by default, if I included that it may pass through better, but it did not:

@babel-bot

This comment has been minimized.

Copy link
Collaborator

@babel-bot babel-bot commented Nov 20, 2019

Hey @0xdevalias! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

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