.getInstance(SourceMapFormat.V3); Path javaSourcePath = sourceFile.javaSourceDir.getCanonicalFile().toPath(); String sourceRoot = getSourceRoot() != null ? getSourceRoot().toString()
private void generateTypeScriptSourceMapFile(SourceFile sourceFile) throws IOException { if (sourceFile.getSourceMap() == null) { return; } SourceMapGenerator generator = SourceMapGeneratorFactory.getInstance(SourceMapFormat.V3); String javaSourceFilePath = sourceFile.getTsFile().getAbsoluteFile().getCanonicalFile().getParentFile().toPath() .relativize(sourceFile.getJavaFile().getAbsoluteFile().getCanonicalFile().toPath()).toString(); for (Entry entry : sourceFile.getSourceMap().getSortedEntries(new Comparator<SourceMap.Entry>() { @Override public int compare(Entry e1, Entry e2) { return e1.getOutputPosition().compareTo(e2.getOutputPosition()); } })) { generator.addMapping(javaSourceFilePath, null, new FilePosition(entry.getInputPosition().getLine(), entry.getInputPosition().getColumn()), new FilePosition(entry.getOutputPosition().getLine(), entry.getOutputPosition().getColumn()), new FilePosition(entry.getOutputPosition().getLine(), entry.getOutputPosition().getColumn() + 1)); } File outputFile = new File(sourceFile.getTsFile().getPath() + ".map"); try (FileWriter writer = new FileWriter(outputFile, false)) { generator.appendTo(writer, sourceFile.getTsFile().getName()); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Constructor to get source map class to use. * * @param sourceMapDetailLevel used to control the output details of source map */ public DefaultGssSourceMapGenerator(SourceMapDetailLevel sourceMapDetailLevel) { Preconditions.checkState(sourceMapDetailLevel != null); this.mappings = new ArrayDeque<>(); this.generator = SourceMapGeneratorFactory.getInstance(SourceMapFormat.V3); this.allMappings = new ArrayList<>(); this.sourceMapDetailLevel = sourceMapDetailLevel; this.detailLevelPredicate = DETAIL_LEVEL_PREDICATES.get(this.sourceMapDetailLevel); }
@Override SourceMap getInstance() { return new SourceMap( SourceMapGeneratorFactory.getInstance(SourceMapFormat.DEFAULT)); } },
@Override SourceMap getInstance() { return new SourceMap( SourceMapGeneratorFactory.getInstance(SourceMapFormat.V3)); } };
@Override SourceMap getInstance() { return new SourceMap( SourceMapGeneratorFactory.getInstance(SourceMapFormat.V3)); } };
@Override SourceMap getInstance() { return new SourceMap( SourceMapGeneratorFactory.getInstance(SourceMapFormat.DEFAULT)); } },