Skip to content

Commit

Permalink
feat(register): add cwd param
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Apr 9, 2022
1 parent e6bc77f commit 9d2005e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/register.ts
Expand Up @@ -45,14 +45,22 @@ function getCoreModules(
return coreModules;
}

export interface RegisterParams extends ExplicitParams {
/**
* Defaults to `--project` CLI flag or `process.cwd()`
*/
cwd?: string;
}

/**
* Installs a custom module load function that can adhere to paths in tsconfig.
* Returns a function to undo paths registration.
*/
export function register(explicitParams: ExplicitParams): () => void {
export function register(params?: RegisterParams): () => void {
const configLoaderResult = configLoader({
cwd: options.cwd,
explicitParams,
cwd: params?.cwd ?? options.cwd,
explicitParams:
params && (params.baseUrl || params.paths) ? params : undefined,
});

if (configLoaderResult.resultType === "failed") {
Expand Down

0 comments on commit 9d2005e

Please sign in to comment.