diff --git a/src/index.ts b/src/index.ts index 6a69b5758..914e7b205 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,8 +7,9 @@ import { fileURLToPath } from 'url' import type * as _ts from 'typescript' import { Module, createRequire as nodeCreateRequire, createRequireFromPath as nodeCreateRequireFromPath } from 'module' import type _createRequire from 'create-require' -// tslint:disable-next-line:deprecation -export const createRequire = nodeCreateRequire ?? nodeCreateRequireFromPath ?? require('create-require') as typeof _createRequire + +/** @internal */ +export const createRequire = nodeCreateRequire ?? nodeCreateRequireFromPath ?? require('create-require') as typeof _createRequire // tslint:disable-line:deprecation export { createRepl, CreateReplOptions, ReplService } from './repl' @@ -343,6 +344,7 @@ export interface TypeInfo { /** * Default register options, including values specified via environment * variables. + * @internal */ export const DEFAULTS: RegisterOptions = { cwd: env.TS_NODE_CWD ?? env.TS_NODE_DIR, // tslint:disable-line:deprecation @@ -435,7 +437,7 @@ export interface Service { /** * Re-export of `Service` interface for backwards-compatibility * @deprecated use `Service` instead - * @see Service + * @see {Service} */ export type Register = Service diff --git a/src/repl.ts b/src/repl.ts index a0b9c60e5..2b8074021 100644 --- a/src/repl.ts +++ b/src/repl.ts @@ -46,6 +46,16 @@ export interface CreateReplOptions { stderr?: NodeJS.WritableStream } +/** + * Create a ts-node REPL instance. + * + * Usage example: + * + * const repl = tsNode.createRepl() + * const service = tsNode.create({...repl.evalAwarePartialHost}) + * repl.setService(service) + * repl.start() + */ export function createRepl (options: CreateReplOptions = {}) { let service = options.service const state = options.state ?? new EvalState(join(process.cwd(), EVAL_FILENAME))