config-loader.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import * as TsConfigLoader from "./tsconfig-loader";
  2. export interface ExplicitParams {
  3. baseUrl: string;
  4. paths: {
  5. [key: string]: Array<string>;
  6. };
  7. mainFields?: Array<string>;
  8. addMatchAll?: boolean;
  9. }
  10. export declare type TsConfigLoader = (params: TsConfigLoader.TsConfigLoaderParams) => TsConfigLoader.TsConfigLoaderResult;
  11. export interface ConfigLoaderParams {
  12. cwd: string;
  13. explicitParams?: ExplicitParams;
  14. tsConfigLoader?: TsConfigLoader;
  15. }
  16. export interface ConfigLoaderSuccessResult {
  17. resultType: "success";
  18. configFileAbsolutePath: string;
  19. baseUrl: string;
  20. absoluteBaseUrl: string;
  21. paths: {
  22. [key: string]: Array<string>;
  23. };
  24. mainFields?: Array<string>;
  25. addMatchAll?: boolean;
  26. }
  27. export interface ConfigLoaderFailResult {
  28. resultType: "failed";
  29. message: string;
  30. }
  31. export declare type ConfigLoaderResult = ConfigLoaderSuccessResult | ConfigLoaderFailResult;
  32. export declare function loadConfig(cwd?: string): ConfigLoaderResult;
  33. export declare function configLoader({ cwd, explicitParams, tsConfigLoader }: ConfigLoaderParams): ConfigLoaderResult;