1 | export interface Options {
|
2 |
|
3 | files?: string[]
|
4 |
|
5 | cwd?: string
|
6 |
|
7 | stopDir?: string
|
8 |
|
9 | packageKey?: string
|
10 |
|
11 | parseJSON?: (str: string) => any
|
12 | }
|
13 |
|
14 | export interface LoadResult {
|
15 |
|
16 | path?: string
|
17 |
|
18 | data?: any
|
19 | }
|
20 |
|
21 | export interface AsyncLoader {
|
22 |
|
23 | name?: string
|
24 | test: RegExp
|
25 | load(filepath: string): Promise<any>
|
26 | }
|
27 |
|
28 | export interface SyncLoader {
|
29 |
|
30 | name?: string
|
31 | test: RegExp
|
32 | loadSync(filepath: string): any
|
33 | }
|
34 |
|
35 | export interface MultiLoader {
|
36 |
|
37 | name?: string
|
38 | test: RegExp
|
39 | load(filepath: string): Promise<any>
|
40 | loadSync(filepath: string): any
|
41 | }
|
42 |
|
43 | declare class JoyCon {
|
44 | constructor(public options?: Options)
|
45 |
|
46 | resolve(files?: string[] | Options, cwd?: string, stopDir?: string): Promise<string | null>
|
47 | resolveSync(files?: string[] | Options, cwd?: string, stopDir?: string): string | null
|
48 |
|
49 | load(files?: string[] | Options, cwd?: string, stopDir?: string): Promise<LoadResult>
|
50 | loadSync(files?: string[] | Options, cwd?: string, stopDir?: string): LoadResult
|
51 |
|
52 | addLoader(loader: AsyncLoader | SyncLoader | MultiLoader): this
|
53 | removeLoader(name: string): this
|
54 |
|
55 | /** Clear internal cache */
|
56 | clearCache(): this
|
57 | }
|
58 |
|
59 |
|
60 | export default JoyCon
|