2017-12-20 12:02:45 +00:00
|
|
|
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-09-28 14:52:35 +00:00
|
|
|
import { WebInspector } from "./sourcemap.mjs";
|
2020-09-28 13:50:56 +00:00
|
|
|
import {
|
|
|
|
ParseProcessor, ArgumentsProcessor, readFile,
|
|
|
|
} from "./parse-processor.mjs";
|
|
|
|
|
2017-12-20 12:02:45 +00:00
|
|
|
function processArguments(args) {
|
2020-11-10 11:47:40 +00:00
|
|
|
const processor = new ArgumentsProcessor(args);
|
2017-12-20 12:02:45 +00:00
|
|
|
if (processor.parse()) {
|
|
|
|
return processor.result();
|
|
|
|
} else {
|
|
|
|
processor.printUsageAndExit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function initSourceMapSupport() {
|
|
|
|
// Pull dev tools source maps into our name space.
|
|
|
|
SourceMap = WebInspector.SourceMap;
|
|
|
|
|
|
|
|
// Overwrite the load function to load scripts synchronously.
|
|
|
|
SourceMap.load = function(sourceMapURL) {
|
2020-11-10 11:47:40 +00:00
|
|
|
const content = readFile(sourceMapURL);
|
|
|
|
const sourceMapObject = (JSON.parse(content));
|
2017-12-20 12:02:45 +00:00
|
|
|
return new SourceMap(sourceMapURL, sourceMapObject);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-11-10 11:47:40 +00:00
|
|
|
const params = processArguments(arguments);
|
|
|
|
let sourceMap = null;
|
2017-12-20 12:02:45 +00:00
|
|
|
if (params.sourceMap) {
|
|
|
|
initSourceMapSupport();
|
|
|
|
sourceMap = SourceMap.load(params.sourceMap);
|
|
|
|
}
|
2020-11-10 11:47:40 +00:00
|
|
|
const parseProcessor = new ParseProcessor();
|
2017-12-20 12:02:45 +00:00
|
|
|
parseProcessor.processLogFile(params.logFileName);
|