2017-12-12 13:35:33 +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 {
|
|
|
|
MapProcessor, ArgumentsProcessor, readFile
|
|
|
|
} from "./map-processor.mjs";
|
|
|
|
|
2017-12-12 13:35:33 +00:00
|
|
|
function processArguments(args) {
|
|
|
|
var processor = new ArgumentsProcessor(args);
|
|
|
|
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) {
|
|
|
|
var content = readFile(sourceMapURL);
|
|
|
|
var sourceMapObject = (JSON.parse(content));
|
|
|
|
return new SourceMap(sourceMapURL, sourceMapObject);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
var params = processArguments(arguments);
|
|
|
|
var sourceMap = null;
|
|
|
|
if (params.sourceMap) {
|
|
|
|
initSourceMapSupport();
|
|
|
|
sourceMap = SourceMap.load(params.sourceMap);
|
|
|
|
}
|
|
|
|
var mapProcessor = new MapProcessor();
|
|
|
|
mapProcessor.processLogFile(params.logFileName);
|