Git Product home page Git Product logo

repl's Issues

Migrating to ESM

Hey! ๐Ÿ‘‹

I'm the maintainer of parse-imports. I'm going to publish v1.0.0 soon and migrate to ESM-only (i.e. "type": "module") without publishing a CJS version of the package.

I noticed that your package accounts for most usage of parse-imports, but also that it does not specify "type": "module", so you would encounter some issues if you try to upgrade. You have a few options:

  1. Not upgrading to v1.0.0
  2. Upgrading to v1.0.0, still targeting CJS, and using dynamic import to import parse-imports instead of require (you can't require ESM modules)
  3. Upgrading to v1.0.0 and targeting ESM (in this scenario you can import parse-imports normally)

I would recommend eventually getting to 3 because that's the direction the ecosystem is moving.

Anyways, just thought I'd give you a heads up! Feel free to close this issue after you read it

feat: customization of REPL server properties

The current implementation of the REPL server does not permit alterations to the default prompt or redirection of input and output, as observed in the existing codebase:

repl/src/repl.ts

Lines 363 to 376 in 5951b78

/**
* Start the REPL server
*/
start() {
console.log('')
this.notify('Type ".ls" to a view list of available context methods/properties')
this.server = startRepl({
prompt: `> ${this.#compiler?.supportsTypescript ? '(ts) ' : '(js) '}`,
input: process.stdin,
output: process.stdout,
terminal: process.stdout.isTTY && !Number.parseInt(process.env.NODE_NO_READLINE!, 10),
useGlobal: true,
})

To enhance flexibility and user control, I propose the introduction of a functionality that allows users to override the options supplied to the Node.js startRepl method. The proposed change is illustrated below:

  start(options) {
    console.log('')
    this.notify('Type ".ls" to a view list of available context methods/properties')

    this.server = startRepl({
      prompt: `> ${this.#compiler?.supportsTypescript ? '(ts) ' : '(js) '}`,
      input: process.stdin,
      output: process.stdout,
      terminal: process.stdout.isTTY && !Number.parseInt(process.env.NODE_NO_READLINE!, 10),
      useGlobal: true,
      ...options,
    })

This modification would grant users greater control over the REPL environment. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.