Skip to content

Commit

Permalink
Fix Template strings break sourcemaps alangpierce#825
Browse files Browse the repository at this point in the history
  • Loading branch information
Septh committed Feb 6, 2024
1 parent 61c05e1 commit 1ff1ba3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/computeSourceMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {GenMapping, maybeAddSegment, toEncodedMap} from "@jridgewell/gen-mapping

import type {SourceMapOptions} from "./index";
import type {Token} from "./parser/tokenizer";
import {TokenType as tt} from "./parser/tokenizer/types";
import {charCodes} from "./parser/util/charcodes";
import type {RootTransformerResult} from "./transformers/RootTransformer";

Expand Down Expand Up @@ -71,6 +72,8 @@ export default function computeSourceMap(
* position of the token.
*/
function computeSourceColumns(code: string, tokens: Array<Token>): Array<number> {
tokens = tokens.filter((token) => token.end > token.start || token.type === tt.eof);

const sourceColumns: Array<number> = new Array(tokens.length);
let tokenIndex = 0;
let currentMapping = tokens[tokenIndex].start;
Expand Down

0 comments on commit 1ff1ba3

Please sign in to comment.