Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface ExplicitParams {
paths: { [key: string]: Array<string> };
mainFields?: (string | string[])[];
addMatchAll?: boolean;
extensions?: ReadonlyArray<string>
}

export type TsConfigLoader = (
Expand Down
6 changes: 3 additions & 3 deletions src/match-path-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export function createMatchPath(
absoluteBaseUrl: string,
paths: { [key: string]: Array<string> },
mainFields: (string | string[])[] = ["main"],
addMatchAll: boolean = true
addMatchAll: boolean = true,
extensions?: ReadonlyArray<string>
): MatchPath {
const absolutePaths = MappingEntry.getAbsoluteMappingEntries(
absoluteBaseUrl,
Expand All @@ -40,7 +41,6 @@ export function createMatchPath(
requestedModule: string,
readJson?: Filesystem.ReadJsonSync,
fileExists?: Filesystem.FileExistsSync,
extensions?: Array<string>
) =>
matchFromAbsolutePaths(
absolutePaths,
Expand Down Expand Up @@ -68,7 +68,7 @@ export function matchFromAbsolutePaths(
requestedModule: string,
readJson: Filesystem.ReadJsonSync = Filesystem.readJsonFromDiskSync,
fileExists: Filesystem.FileExistsSync = Filesystem.fileExistsSync,
extensions: Array<string> = Object.keys(require.extensions),
extensions: ReadonlyArray<string> = Object.keys(require.extensions),
mainFields: (string | string[])[] = ["main"]
): string | undefined {
const tryPaths = TryPath.getPathsToTry(
Expand Down
3 changes: 2 additions & 1 deletion src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export function register(params?: RegisterParams): () => void {
configLoaderResult.absoluteBaseUrl,
configLoaderResult.paths,
configLoaderResult.mainFields,
configLoaderResult.addMatchAll
configLoaderResult.addMatchAll,
explicitParams?.extensions,
);

// Patch node's module loading
Expand Down