match-path-async.d.ts 1.1 KB

123456789101112131415161718192021
  1. import * as MappingEntry from "./mapping-entry";
  2. import * as Filesystem from "./filesystem";
  3. /**
  4. * Function that can match a path async
  5. */
  6. export interface MatchPathAsync {
  7. (requestedModule: string, readJson: Filesystem.ReadJsonAsync | undefined, fileExists: Filesystem.FileExistsAsync | undefined, extensions: ReadonlyArray<string> | undefined, callback: MatchPathAsyncCallback): void;
  8. }
  9. export interface MatchPathAsyncCallback {
  10. (err?: Error, path?: string): void;
  11. }
  12. /**
  13. * See the sync version for docs.
  14. */
  15. export declare function createMatchPathAsync(absoluteBaseUrl: string, paths: {
  16. [key: string]: Array<string>;
  17. }, mainFields?: string[], addMatchAll?: boolean): MatchPathAsync;
  18. /**
  19. * See the sync version for docs.
  20. */
  21. export declare function matchFromAbsolutePathsAsync(absolutePathMappings: ReadonlyArray<MappingEntry.MappingEntry>, requestedModule: string, readJson: Filesystem.ReadJsonAsync | undefined, fileExists: Filesystem.FileExistsAsync | undefined, extensions: readonly string[] | undefined, callback: MatchPathAsyncCallback, mainFields?: string[]): void;