@graphql-mesh/include
Version:
32 lines (31 loc) • 1.02 kB
TypeScript
/**
* Import a module, ESM or CJS at the provided {@link path}.
*
* If the included module has a "default" export, it will be returned instead.
*
* If the module at {@link path} is not found, `null` will be returned.
*/
export declare function include<T = any>(path: string): Promise<T>;
export interface RegisterTsconfigPathsOptions {
/**
* Accepts a path to a file or directory to search up for a {@link configName} file.
*
* @default process.cwd()
*/
cwd?: string;
/**
* The file name of the TypeScript config file.
*
* Can be changed using the `MESH_INCLUDE_TSCONFIG_SEARCH_PATH` environment variable.
*
* @default 'tsconfig.json'
*/
configName?: string;
}
/**
* Parses the closest `(t|j)sconfig.json` paths and augments Node's module
* resolution to consider those paths during imports.
*
* @returns The unregister function.
*/
export declare function registerTsconfigPaths({ cwd, configName, }?: RegisterTsconfigPathsOptions): () => void;