JS backend: sourcemap should use absolute file urls.
#KT-927 in progress (cherry picked from commit 8931d26)
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -54,11 +54,11 @@ public final class K2JSTranslator {
|
|||||||
K2JSTranslator translator = new K2JSTranslator(config);
|
K2JSTranslator translator = new K2JSTranslator(config);
|
||||||
File outFile = new File(outputPath);
|
File outFile = new File(outputPath);
|
||||||
TextOutputImpl output = new TextOutputImpl();
|
TextOutputImpl output = new TextOutputImpl();
|
||||||
SourceMapBuilder sourceMapBuilder = config.isSourcemap() ? new SourceMapBuilder(outFile.getName(), output, new SourceMapBuilderConsumer()) : null;
|
SourceMapBuilder sourceMapBuilder = config.isSourcemap() ? new SourceMapBuilder(outFile, output, new SourceMapBuilderConsumer()) : null;
|
||||||
String programCode = translator.generateProgramCode(files, mainCall, output, sourceMapBuilder);
|
String programCode = translator.generateProgramCode(files, mainCall, output, sourceMapBuilder);
|
||||||
FileUtil.writeToFile(outFile, programCode);
|
FileUtil.writeToFile(outFile, programCode);
|
||||||
if (sourceMapBuilder != null) {
|
if (sourceMapBuilder != null) {
|
||||||
FileUtil.writeToFile(new File(outFile.getParentFile(), sourceMapBuilder.getOutFilename()), sourceMapBuilder.build());
|
FileUtil.writeToFile(sourceMapBuilder.getOutFile(), sourceMapBuilder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ class SourceMapBuilderConsumer implements PairConsumer<SourceMapBuilder, Object>
|
|||||||
assert document != null;
|
assert document != null;
|
||||||
int line = document.getLineNumber(offset);
|
int line = document.getLineNumber(offset);
|
||||||
int column = offset - document.getLineStartOffset(line);
|
int column = offset - document.getLineStartOffset(line);
|
||||||
builder.addMapping(file.getViewProvider().getVirtualFile().getPath(), line, column);
|
builder.addMapping(file.getViewProvider().getVirtualFile().getUrl(), line, column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user