( rawMap: ExistingRawSourceMap, file: string, )
| 1866 | } |
| 1867 | |
| 1868 | export async function formatPostcssSourceMap( |
| 1869 | rawMap: ExistingRawSourceMap, |
| 1870 | file: string, |
| 1871 | ): Promise<ExistingRawSourceMap> { |
| 1872 | const inputFileDir = path.dirname(file) |
| 1873 | |
| 1874 | // Note: the real `Sourcemap#sources` maybe `null`, but rollup typing is not handle it. |
| 1875 | const sources = rawMap.sources!.map((source) => { |
| 1876 | const cleanSource = cleanUrl(decodeURIComponent(source!)) |
| 1877 | |
| 1878 | // postcss virtual files |
| 1879 | if (cleanSource[0] === '<' && cleanSource.endsWith('>')) { |
| 1880 | return `\0${cleanSource}` |
| 1881 | } |
| 1882 | |
| 1883 | return normalizePath(path.resolve(inputFileDir, cleanSource)) |
| 1884 | }) |
| 1885 | |
| 1886 | return { |
| 1887 | file, |
| 1888 | mappings: rawMap.mappings, |
| 1889 | names: rawMap.names, |
| 1890 | sources, |
| 1891 | sourcesContent: rawMap.sourcesContent, |
| 1892 | version: rawMap.version, |
| 1893 | } |
| 1894 | } |
| 1895 | |
| 1896 | function combineSourcemapsIfExists( |
| 1897 | filename: string, |
no test coverage detected