* Whether a project-relative source path is one we would read at all: no raw * control byte (NUL truncates a path in some syscalls), and on Windows no * backslash, a separator there that indexed paths never use. Nothing is * decoded: a `%` in the path is part of a file name.
(relativePath: string)
| 268 | * decoded: a `%` in the path is part of a file name. |
| 269 | */ |
| 270 | function isUsableSourcePath(relativePath: string): boolean { |
| 271 | // eslint-disable-next-line no-control-regex -- rejecting raw control bytes IS the point |
| 272 | if (/[\x00-\x1f\x7f]/.test(relativePath)) return false; |
| 273 | return !(process.platform === 'win32' && relativePath.includes('\\')); |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * Resolve a project-relative source path to an absolute path that is safe to |
no outgoing calls
no test coverage detected