UNPKG

@boost/module

Version:

Module resolving and loading utilities with TypeScript support.

27 lines 1.05 kB
/// <reference types="node" /> import type { ModuleLike, PathLike } from './types'; /** * Register `.ts` and `.tsx` file extensions into Node.js's resolution algorithm. */ export declare function registerExtensions(): void; /** * Unregister `.ts` and `.tsx` file extensions. */ export declare function unregisterExtensions(): void; /** * Like `requireModule` but for loading TypeScript files ending in `ts` or `tsx`. * When imported, will transform the file using the `typescript` package, * evaluate the code in the current module context, and apply the same process * to all child imports. * * ```ts * import { requireTSModule } from '@boost/module'; * * const result = requireTSModule('../../some/module.ts'); * ``` * * > This helper rarely needs to be used directly as `requireModule` will * > call it under the hood based on the file extension. */ export declare function requireTSModule<D = unknown, N extends object = {}>(path: PathLike, requirer?: NodeRequire): ModuleLike<D, N>; //# sourceMappingURL=requireTSModule.d.ts.map