feat: use inversify autoProvide inject

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-02-26 10:15:33 +08:00
parent 7e4c44eadd
commit 3143851969
26 changed files with 128 additions and 153 deletions

View File

@ -90,17 +90,21 @@ export class MiaoScriptConsole implements Console {
try {
if (fileName.endsWith('js')) {
var file = Paths.get(fileName + '.map');
if (!this.sourceMaps[fileName]) {
if (this.sourceMaps[fileName] === undefined) {
if (file.toFile().exists()) {
var sourceMapObj = JSON.parse(new JavaString(Files.readAllBytes(file), "UTF-8"))
this.sourceMaps[fileName] = new SourceMapBuilder(sourceMapObj)
} else {
this.sourceMaps[fileName] = null;
}
}
if (this.sourceMaps[fileName]) {
var sourceMapping = this.sourceMaps[fileName].getSource(lineNumber, lineNumber);
var sourceMapping = this.sourceMaps[fileName].getSource(lineNumber, 0);
if (sourceMapping) {
if(lineNumber != sourceMapping.mapping.sourceLine){
fileName = fileName.replace(".js", ".ts");
lineNumber = sourceMapping.mapping.sourceLine;
}
}
}
}