-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhost-module-resolution.mts
101 lines (92 loc) · 2.16 KB
/
host-module-resolution.mts
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**
* @file Interfaces - ModuleResolutionHost
* @module tsconfig-utils/interfaces/ModuleResolutionHost
*/
import type { ModuleId } from '@flex-development/mlly'
/**
* Module resolution host API.
*
* The module resolution host acts a bridge between the TypeScript compiler and
* the file system.
*/
interface ModuleResolutionHost {
/**
* Check if a directory exists at `id`.
*
* @see {@linkcode ModuleId}
*
* @this {void}
*
* @param {ModuleId} id
* The module id to check
* @return {boolean}
* `true` if directory exists at `id`, `false` otherwise
*/
directoryExists(this: void, id: ModuleId): boolean
/**
* Check if a file exists at `id`.
*
* @see {@linkcode ModuleId}
*
* @this {void}
*
* @param {ModuleId} id
* The module id to check
* @return {boolean}
* `true` if file exists at `id`, `false` otherwise
*/
fileExists(this: void, id: ModuleId): boolean
/**
* Get the path to current working directory.
*
* @this {void}
*
* @return {string}
* Path to current working directory
*/
getCurrentDirectory(this: void): string
/**
* Get a list of subdirectories.
*
* @see {@linkcode ModuleId}
*
* @this {void}
*
* @param {ModuleId} id
* The directory path or URL to read
* @return {string[]}
* List of subdirectory names
*/
getDirectories(this: void, id: ModuleId): string[]
/**
* Get the contents of a file.
*
* @see {@linkcode ModuleId}
*
* @this {void}
*
* @param {ModuleId} id
* The file path or URL to read
* @return {Buffer | string}
* File contents or `undefined` if file does not exist at `id`
*/
readFile(this: void, id: ModuleId): string | undefined
/**
* Get the resolved pathname of `id`.
*
* @see {@linkcode ModuleId}
*
* @this {void}
*
* @param {ModuleId} id
* The path or `file:` URL to handle
* @return {string}
* Canonical pathname of `id`
*/
realpath(this: void, id: ModuleId): string
/**
* Treat filenames as case-sensitive?
*/
useCaseSensitiveFileNames?: ((this: void) => boolean) | boolean | undefined
}
export type { ModuleResolutionHost as default }