Skip to content

Commit

Permalink
mark @Internals and improve jsdoc (#1242)
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Feb 23, 2021
1 parent 83fdf6a commit 9e34e18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions src/repl.ts
Expand Up @@ -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))
Expand Down

0 comments on commit 9e34e18

Please sign in to comment.