rebase and fix lint

pull/5584/head
halfnelson 5 years ago
parent 9583d72c92
commit 713827126a

@ -104,8 +104,9 @@ function get_replacement(
let decoded_map: DecodedSourceMap;
if (processed.map) {
decoded_map = typeof processed.map === 'string' ? JSON.parse(processed.map) : processed.map;
if (typeof(decoded_map.mappings) === 'string')
if (typeof(decoded_map.mappings) === 'string') {
decoded_map.mappings = decode_mappings(decoded_map.mappings);
}
sourcemap_add_offset(decoded_map, get_location(offset + prefix.length));
}
const processed_with_map = StringWithSourcemap.from_processed(processed.code, decoded_map);
@ -146,12 +147,13 @@ export default async function preprocess(
if (processed && processed.dependencies) dependencies.push(...processed.dependencies);
source = processed ? processed.code : source;
if (processed && processed.map)
if (processed && processed.map) {
sourcemap_list.unshift(
typeof(processed.map) === 'string'
? JSON.parse(processed.map)
: processed.map
);
}
}
for (const fn of script) {

@ -59,8 +59,9 @@ function merge_tables<T>(this_table: T[], other_table): [T[], number[], boolean,
}
function pushArray<T>(_this: T[], other: T[]) {
for (let i = 0; i < other.length; i++)
for (let i = 0; i < other.length; i++) {
_this.push(other[i]);
}
}
export class StringWithSourcemap {
@ -69,15 +70,16 @@ export class StringWithSourcemap {
constructor(string = '', map = null) {
this.string = string;
if (map)
if (map) {
this.map = map as DecodedSourceMap;
else
} else {
this.map = {
version: 3,
mappings: [],
sources: [],
names: []
};
}
}
// concat in-place (mutable), return this (chainable)

Loading…
Cancel
Save