(
sourceMap: SourceMap,
genPosition: {line: number; column: number},
)
| 16 | } |
| 17 | |
| 18 | export async function originalPositionFor( |
| 19 | sourceMap: SourceMap, |
| 20 | genPosition: {line: number; column: number}, |
| 21 | ): Promise<SourceLocation> { |
| 22 | // Note: The `SourceMap` type from the compiler is different to `RawSourceMap` |
| 23 | // from the `source-map` package, but the method we rely on works as expected. |
| 24 | const smc = await new SourceMapConsumer(sourceMap as any); |
| 25 | // Note: We don't return the original object as it also contains a `name` property |
| 26 | // which is always null and we don't want to include that in our assertions... |
| 27 | const {line, column, source} = smc.originalPositionFor(genPosition); |
| 28 | return {line, column, source}; |
| 29 | } |
| 30 | |
| 31 | export function extractSourceMap(source: string): SourceMap | null { |
| 32 | let idx = source.lastIndexOf('\n//#'); |
no outgoing calls
no test coverage detected
searching dependent graphs…