Skip to content

Extending ts-node  #983

Description

@watzon

Desired Behavior

Allow complete control over the creation of a new REPL in code, including the ability to inject a new custom context.

Is this request related to a problem?

There are many instances where one may want to extend the behavior of ts-node by creating their own REPL that wraps it and injects a custom context. One such case is creating a REPL for a framework such as AdonisJS, which is what I'm trying to do. The problem currently is, as far as I can tell, there is no way to inject a custom context outside of using the --require flag, but that just requires a file.

It would be nice to, in my own code, be able to do something like this:

import{REPL,Context}from'ts-node'constmyContext=newContext({myGlobal: require('./some-file')})constrepl=newREPL(myContext)repl.run()

Alternatives you've considered

Forking and modifying ts-node or a similar project to fit my needs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions