| 1 | import * as Filesystem from "./filesystem";
|
|---|
| 2 | import * as MappingEntry from "./mapping-entry";
|
|---|
| 3 | /**
|
|---|
| 4 | * Function that can match a path
|
|---|
| 5 | */
|
|---|
| 6 | export interface MatchPath {
|
|---|
| 7 | (requestedModule: string, readJson?: Filesystem.ReadJsonSync, fileExists?: (name: string) => boolean, extensions?: ReadonlyArray<string>): string | undefined;
|
|---|
| 8 | }
|
|---|
| 9 | /**
|
|---|
| 10 | * Creates a function that can resolve paths according to tsconfig paths property.
|
|---|
| 11 | * @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig.
|
|---|
| 12 | * @param paths The paths as specified in tsconfig.
|
|---|
| 13 | * @param mainFields A list of package.json field names to try when resolving module files.
|
|---|
| 14 | * @param addMatchAll Add a match-all "*" rule if none is present
|
|---|
| 15 | * @returns a function that can resolve paths.
|
|---|
| 16 | */
|
|---|
| 17 | export declare function createMatchPath(absoluteBaseUrl: string, paths: {
|
|---|
| 18 | [key: string]: Array<string>;
|
|---|
| 19 | }, mainFields?: string[], addMatchAll?: boolean): MatchPath;
|
|---|
| 20 | /**
|
|---|
| 21 | * Finds a path from tsconfig that matches a module load request.
|
|---|
| 22 | * @param absolutePathMappings The paths to try as specified in tsconfig but resolved to absolute form.
|
|---|
| 23 | * @param requestedModule The required module name.
|
|---|
| 24 | * @param readJson Function that can read json from a path (useful for testing).
|
|---|
| 25 | * @param fileExists Function that checks for existence of a file at a path (useful for testing).
|
|---|
| 26 | * @param extensions File extensions to probe for (useful for testing).
|
|---|
| 27 | * @param mainFields A list of package.json field names to try when resolving module files.
|
|---|
| 28 | * @returns the found path, or undefined if no path was found.
|
|---|
| 29 | */
|
|---|
| 30 | export declare function matchFromAbsolutePaths(absolutePathMappings: ReadonlyArray<MappingEntry.MappingEntry>, requestedModule: string, readJson?: Filesystem.ReadJsonSync, fileExists?: Filesystem.FileExistsSync, extensions?: Array<string>, mainFields?: string[]): string | undefined;
|
|---|