ignore names in sourcemap

pull/5428/head
Milan Hauth 5 years ago
parent 459dd88b71
commit 880f5567da

@ -7,7 +7,7 @@ type MappingSegment =
type SourceMappings = { type SourceMappings = {
sources: string[]; sources: string[];
names: string[]; names: string[]; // names are ignored. might change in future
mappings: MappingSegment[][]; mappings: MappingSegment[][];
}; };
@ -79,16 +79,16 @@ export class StringWithSourcemap {
if (this.string == '') return other; if (this.string == '') return other;
if (other.string == '') return this; if (other.string == '') return this;
// combine sources and names // combine sources
const [sources, new_source_idx] = merge_tables(this.map.sources, other.map.sources); const [sources, new_source_idx] = merge_tables(this.map.sources, other.map.sources);
const [names, new_name_idx] = merge_tables(this.map.names, other.map.names); //const [names, new_name_idx] = merge_tables(this.map.names, other.map.names);
// update source refs and name refs in segments // update source refs
const other_mappings = other.map.mappings.map((line) => const other_mappings = other.map.mappings.map((line) =>
line.map(seg => { line.map(seg => {
const new_seg = seg.slice() as MappingSegment; const new_seg = seg.slice() as MappingSegment;
if (seg[1]) new_seg[1] = new_source_idx[seg[1]]; if (seg[1]) new_seg[1] = new_source_idx[seg[1]];
if (seg[4]) new_seg[4] = new_name_idx[seg[4]]; //if (seg[4]) new_seg[4] = new_name_idx[seg[4]];
return new_seg; return new_seg;
}) })
); );
@ -107,12 +107,10 @@ export class StringWithSourcemap {
? [] ? []
: col_offset == 0 : col_offset == 0
? other_mappings[0].slice() as MappingSegment[] ? other_mappings[0].slice() as MappingSegment[]
: other_mappings[0].map((seg) => { : other_mappings[0].map(seg => (
// shift columns // shift column
const new_seg = seg.slice() as MappingSegment; [seg[0] + col_offset].concat(seg.slice(1)) as MappingSegment
new_seg[0] = seg[0] + col_offset; ));
return new_seg;
});
const mappings: MappingSegment[][] = const mappings: MappingSegment[][] =
this.map.mappings.slice(0, -1) this.map.mappings.slice(0, -1)
@ -124,7 +122,7 @@ export class StringWithSourcemap {
return new StringWithSourcemap( return new StringWithSourcemap(
this.string + other.string, this.string + other.string,
{ sources, names, mappings } { sources, names: [], mappings }
); );
} }

Loading…
Cancel
Save