UNPKG

896 BPlain TextView Raw
1export type ExtensionName = ".cjs" | ".js" | ".json" | ".yaml" | ".yml";
2
3export type RequiredOption = "packageJSON" | "defaultExtension" | "cwd";
4
5export type Loader = <R extends {}>(fileName: string, supperes: boolean) => R;
6
7export type ExtensionLoaderMap = Record<ExtensionName, Loader>;
8
9export type PossibleUndefined<T> = T | undefined;
10
11export interface rcConfigResult<R extends Record<string, unknown>> {
12 config: R;
13 filePath: string;
14}
15
16export interface rcConfigLoaderOption {
17 /** does look for `package.json` */
18 packageJSON?:
19 | boolean
20 | {
21 fieldName: string;
22 };
23
24 /** if config file name is not same with packageName, set the name */
25 configFileName?: string;
26
27 /** treat default(no ext file) as some extension */
28 defaultExtension?: ExtensionName | ExtensionName[];
29
30 /** where start to load */
31 cwd?: string;
32}