try-path.d.ts 816 B

123456789101112131415
  1. import { MappingEntry } from "./mapping-entry";
  2. export interface TryPath {
  3. readonly type: "file" | "extension" | "index" | "package";
  4. readonly path: string;
  5. }
  6. /**
  7. * Builds a list of all physical paths to try by:
  8. * 1. Check for file named exactly as request.
  9. * 2. Check for files named as request ending in any of the extensions.
  10. * 3. Check for file specified in package.json's main property.
  11. * 4. Check for files named as request ending in "index" with any of the extensions.
  12. */
  13. export declare function getPathsToTry(extensions: ReadonlyArray<string>, absolutePathMappings: ReadonlyArray<MappingEntry>, requestedModule: string): ReadonlyArray<TryPath> | undefined;
  14. export declare function getStrippedPath(tryPath: TryPath): string;
  15. export declare function exhaustiveTypeException(check: never): never;