( code: string, filePath: string, )
| 9 | // based on vite |
| 10 | // https://github.com/vitejs/vite/blob/84079a84ad94de4c1ef4f1bdb2ab448ff2c01196/packages/vite/src/node/server/sourcemap.ts#L149 |
| 11 | export function extractSourcemapFromFile( |
| 12 | code: string, |
| 13 | filePath: string, |
| 14 | ): ExtractedSourceMap | undefined { |
| 15 | const map = ( |
| 16 | convertSourceMap.fromSource(code) |
| 17 | || convertSourceMap.fromMapFileSource( |
| 18 | code, |
| 19 | createConvertSourceMapReadMap(filePath), |
| 20 | ) |
| 21 | )?.toObject() |
| 22 | return map ? { map } : undefined |
| 23 | } |
| 24 | |
| 25 | function createConvertSourceMapReadMap(originalFileName: string) { |
| 26 | return (filename: string) => { |
no test coverage detected