@athenna/core
Version:
One foundation for multiple applications.
80 lines (79 loc) • 2.13 kB
TypeScript
/**
* @athenna/core
*
* (c) João Lenon <lenon@athenna.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import type { Command } from '#src/repl/helpers/Command';
import type { REPLServer, ReplOptions } from 'node:repl';
import { CommandBuilder } from '#src/repl/helpers/CommandBuilder';
type REPLWriteKey = {
sequence?: string | undefined;
name?: string | undefined;
ctrl?: boolean | undefined;
meta?: boolean | undefined;
shift?: boolean | undefined;
};
export declare class ReplImpl {
/**
* Holds the repl session.
*/
session: REPLServer;
/**
* Start the repl session.
*/
start(options?: ReplOptions): Promise<REPLServer>;
/**
* Shutdown all Athenna providers on exit.
*/
shutdownProviders(): this;
/**
* Define a command in the repl session.
*/
command(signature: string): CommandBuilder;
/**
* Define a command using the implementation class.
*/
commandImpl(command: typeof Command): ReplImpl;
/**
* Display the repl prompt.
*/
displayPrompt(preserveCursor?: boolean): ReplImpl;
/**
* Set a different prompt to the repl session.
*/
setPrompt(prompt: string): ReplImpl;
/**
* Write some message in the repl session.
*/
write(message: string | Buffer, key?: REPLWriteKey): ReplImpl;
/**
* Clean the repl session content by simulating
* pressing CTRL + L.
*/
clean(): ReplImpl;
/**
* Remove the domain error handler from the repl session.
*/
removeDomainErrorHandler(): ReplImpl;
/**
* Set a key value in the repl context.
*/
setInContext(key: string, value: any): ReplImpl;
/**
* Import a module in the repl session.
*/
import(key: string, path: string): Promise<void>;
/**
* Import a module and register all it properties
* in the repl context.
*/
importAll(path: string): Promise<void>;
/**
* Import the repl module.
*/
private importRepl;
}
export {};