-
-
Notifications
You must be signed in to change notification settings - Fork 543
Closed
Labels
Description
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'
const myContext = new Context({
myGlobal: require('./some-file')
})
const repl = new REPL(myContext)
repl.run()
Alternatives you've considered
Forking and modifying ts-node or a similar project to fit my needs.
MarcManiez and NickSeagull