Creates a new REPL instance with optional configuration
Optionaloptions: { compiler?: Compiler; historyFilePath?: string } & ReplOptionsConfiguration options for the REPL
Optionalcompiler?: CompilerCustom compiler for transforming user input
OptionalhistoryFilePath?: stringPath to store command history
Custom compiler for transforming user input
Path to store command history
Colors reference
OptionalserverReference to the repl server. Available after the start method
is invoked
Register a callback to be invoked once the server is ready
Function to call when the REPL is ready
Register a custom loader function to be added to the context
The name of the method
The function to execute
Optionaloptions: MethodOptionsOptional configuration for the method
Returns the collection of registered methods
Register a compiler. Make sure register the compiler before calling the start method
The compiler instance to use for transforming code
Start the REPL server
Optionalcontext: Record<string, any>Optional initial context to populate the REPL with
A REPL (Read-Eval-Print Loop) server implementation that provides an interactive command line interface for executing JavaScript/TypeScript code with custom methods and context management.
Example