diff --git a/src/compiler/utils/string_with_sourcemap.ts b/src/compiler/utils/string_with_sourcemap.ts index 4a442b964a..dc182a6321 100644 --- a/src/compiler/utils/string_with_sourcemap.ts +++ b/src/compiler/utils/string_with_sourcemap.ts @@ -291,8 +291,7 @@ export function apply_preprocessor_sourcemap(filename: string, svelte_map: Sourc return result_map as SourceMap; } -// find attached sourcemap in processed.code -// TODO? handle multiple attached maps, combine with processed.map +// parse attached sourcemap in processed.code export function parse_attached_sourcemap(processed: Processed): void { const magic_prefix = '\n/*# sourceMappingURL=data:application/json;'; const cut_index = processed.code.lastIndexOf('\n'); diff --git a/test/sourcemaps/samples/attached-sourcemap/test.js b/test/sourcemaps/samples/attached-sourcemap/test.js index fde2190808..c5b4d7989d 100644 --- a/test/sourcemaps/samples/attached-sourcemap/test.js +++ b/test/sourcemaps/samples/attached-sourcemap/test.js @@ -7,7 +7,8 @@ export function test({ input, css, js }) { let out_obj, loc_output, actual, loc_input, expected; out_obj = js; - // we need the seconds occurence in output.js + // we need the second occurence of 'done_replace_script_2' in output.js + // the first occurence is mapped back to markup '{done_replace_script_2}' loc_output = out_obj.locate_1('done_replace_script_2'); loc_output = out_obj.locate_1('done_replace_script_2', loc_output.character + 1); actual = out_obj.mapConsumer.originalPositionFor(loc_output); @@ -22,7 +23,6 @@ export function test({ input, css, js }) { out_obj = css; loc_output = out_obj.locate_1('.done_replace_style_2'); actual = out_obj.mapConsumer.originalPositionFor(loc_output); - // first occurence in input.svelte loc_input = input.locate_1('.replace_me_style'); expected = { source: 'input.svelte',