(filePath: string)
| 57 | } |
| 58 | |
| 59 | export function readSourceFileSnapshot(filePath: string): SourceFileSnapshot { |
| 60 | const bytes = readFileSync(filePath); |
| 61 | const stat = statSync(filePath); |
| 62 | const text = bytes.toString("utf8"); |
| 63 | return { |
| 64 | text, |
| 65 | hash: hashSourceBytes(bytes), |
| 66 | mtimeMs: stat.mtimeMs, |
| 67 | size: stat.size, |
| 68 | eol: detectSourceEol(text), |
| 69 | }; |
| 70 | } |
| 71 | |
| 72 | export function sourceFileSnapshotFromText(text: string): SourceFileSnapshot { |
| 73 | const bytes = Buffer.from(text, "utf8"); |
no test coverage detected