Read a file as UTF-8, returning undefined if it's missing or unreadable.
(filePath: string)
| 28 | |
| 29 | /** Read a file as UTF-8, returning undefined if it's missing or unreadable. */ |
| 30 | function readText(filePath: string): string | undefined { |
| 31 | try { |
| 32 | return fs.readFileSync(filePath, "utf8") |
| 33 | } catch { |
| 34 | return undefined |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /** Resolve an @include path relative to the including file's directory. */ |
| 39 | function resolveInclude(ref: string, baseDir: string): string { |