[JS CLI] Support sourcemap generation for IR BE in CLI

#KT-46551 In Progress
This commit is contained in:
Zalim Bashorov
2021-07-01 21:54:46 +03:00
committed by teamcityserver
parent 5a3efc1a98
commit 2460f5f9ae
6 changed files with 90 additions and 24 deletions
@@ -62,7 +62,7 @@ public class SourceMap3Builder implements SourceMapBuilder {
@SuppressWarnings("unchecked")
JsonObject json = new JsonObject();
json.getProperties().put("version", new JsonNumber(3));
json.getProperties().put("file", new JsonString(generatedFile.getName()));
if (generatedFile != null) json.getProperties().put("file", new JsonString(generatedFile.getName()));
appendSources(json);
appendSourcesContent(json);
json.getProperties().put("names", new JsonArray());
@@ -230,8 +230,8 @@ abstract class BasicIrBoxTest(
val dependencyPaths = mutableListOf<String>()
dependencies.forEach { (moduleId, code) ->
val wrappedCode = wrapWithModuleEmulationMarkers(code, config.moduleKind, moduleId)
dependencies.forEach { (moduleId, outputs) ->
val wrappedCode = wrapWithModuleEmulationMarkers(outputs.jsCode, config.moduleKind, moduleId)
val dependencyPath = outputFile.absolutePath.replace("_v5.js", "-${moduleId}_v5.js")
dependencyPaths += dependencyPath
File(dependencyPath).write(wrappedCode)