( projectDir: string | null, sourceFile: string, )
| 57 | } |
| 58 | |
| 59 | export function toProjectAbsolutePath( |
| 60 | projectDir: string | null, |
| 61 | sourceFile: string, |
| 62 | ): string | undefined { |
| 63 | const trimmedSource = sourceFile.trim(); |
| 64 | if (!trimmedSource) return undefined; |
| 65 | |
| 66 | const normalizedSource = trimmedSource.replace(/\\/g, "/"); |
| 67 | if (isAbsoluteFilePath(normalizedSource)) return normalizedSource; |
| 68 | |
| 69 | const normalizedRoot = projectDir?.trim().replace(/\\/g, "/").replace(/\/+$/, ""); |
| 70 | if (!normalizedRoot) return undefined; |
| 71 | |
| 72 | return `${normalizedRoot}/${normalizedSource.replace(/^\.?\//, "")}`; |
| 73 | } |
| 74 | |
| 75 | export function normalizeDomEditStyleValue(property: string, value: string): string { |
| 76 | const trimmed = value.trim(); |
no test coverage detected