/
defs.js
42 lines (38 loc) · 1018 Bytes
/
defs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
type CosmiconfigResult = {
config: any,
filepath: string,
isEmpty?: boolean,
} | null;
type LoaderResult = {
config: Object | null,
filepath: string,
};
// These are the user options with defaults applied.
type ExplorerOptions = {
stopDir: string,
cache: boolean,
transform: CosmiconfigResult => CosmiconfigResult,
packageFilenames: Array<string>,
packageProp: string,
loaders: Loaders,
searchPlaces: Array<string>,
ignoreEmptySearchPlaces: boolean,
};
type ExplorerContext = & {
loadCache: ?Map<string, Promise<CosmiconfigResult>>,
loadSyncCache: ?Map<string, CosmiconfigResult>,
searchCache: ?Map<string, Promise<CosmiconfigResult>>,
searchSyncCache: ?Map<string, CosmiconfigResult>,
};
type SyncLoader = (filepath: string, content: string) => Object | null;
type AsyncLoader = (
filepath: string,
content: string
) => Object | null | Promise<Object | null>;
type LoaderEntry = {
sync?: SyncLoader,
async?: AsyncLoader,
};
type Loaders = {
[string]: LoaderEntry,
};