com.google.javascript.jscomp.Compiler.getSourceMap()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 JavaScript  
字(6.3k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中com.google.javascript.jscomp.Compiler.getSourceMap()方法的一些代码示例,展示了Compiler.getSourceMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Compiler.getSourceMap()方法的具体详情如下:
包路径:com.google.javascript.jscomp.Compiler
类名称:Compiler
方法名:getSourceMap

Compiler.getSourceMap介绍

暂无

代码示例

代码示例来源:origin: org.scala-js/closure-compiler-java-6

if (compiler != null && compiler.getSourceMap() != null) {
 compiler.getSourceMap().setWrapperPrefix(prefix);

代码示例来源:origin: com.google.javascript/closure-compiler

private synchronized void addFilesToSourceMap(Iterable<? extends SourceFile> files) {
 // synchronized annotation guards concurrent access to sourceMap during parsing.
 if (getOptions().sourceMapIncludeSourcesContent && getSourceMap() != null) {
  for (SourceFile file : files) {
   try {
    getSourceMap().addSourceFile(file.getName(), file.getCode());
   } catch (IOException e) {
    throw new RuntimeException("Cannot read code of a source map's source file.", e);
   }
  }
 }
}

代码示例来源:origin: com.google.javascript/closure-compiler

if (compiler != null && compiler.getSourceMap() != null) {
 compiler.getSourceMap().setWrapperPrefix(prefix);

代码示例来源:origin: org.apache.flex.flexjs.compiler/compiler-jx

compiler_.getSourceMap().appendTo(sourceMapFile, "");
sourceMapFile.close();

代码示例来源:origin: com.google.javascript/closure-compiler

/** Given an output module, convert it to a JSONFileSpec with associated sourcemap */
@GwtIncompatible("Unnecessary")
private JsonFileSpec createJsonFileFromModule(JSModule module) throws IOException {
 compiler.getSourceMap().reset();
 StringBuilder output = new StringBuilder();
 writeModuleOutput(output, module);
 JsonFileSpec jsonFile = new JsonFileSpec(output.toString(),
   getModuleOutputFileName(module));
 StringBuilder moduleSourceMap = new StringBuilder();
 compiler.getSourceMap().appendTo(moduleSourceMap,
   getModuleOutputFileName(module));
 jsonFile.setSourceMap(moduleSourceMap.toString());
 return jsonFile;
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/**
 * Given an output module, convert it to a JSONFileSpec with associated
 * sourcemap
 */
private JsonFileSpec createJsonFileFromModule(JSModule module) throws
  FlagUsageException, IOException{
 compiler.getSourceMap().reset();
 StringBuilder output = new StringBuilder();
 writeModuleOutput(output, module);
 JsonFileSpec jsonFile = new JsonFileSpec(output.toString(),
   getModuleOutputFileName(module));
 StringBuilder moduleSourceMap = new StringBuilder();
 compiler.getSourceMap().appendTo(moduleSourceMap,
   getModuleOutputFileName(module));
 jsonFile.setSourceMap(moduleSourceMap.toString());
 return jsonFile;
}

代码示例来源:origin: com.google.javascript/closure-compiler

/** Save the compiler output to a JsonFileSpec to be later written to stdout */
@GwtIncompatible("Unnecessary")
JsonFileSpec createJsonFile(B options, String outputMarker, Function<String, String> escaper)
  throws IOException {
 Appendable jsOutput = new StringBuilder();
 writeOutput(
   jsOutput, compiler, (JSModule) null, config.outputWrapper,
   outputMarker, escaper);
 JsonFileSpec jsonOutput = new JsonFileSpec(jsOutput.toString(),
   Strings.isNullOrEmpty(config.jsOutputFile) ?
     "compiled.js" : config.jsOutputFile);
 if (!Strings.isNullOrEmpty(options.sourceMapOutputPath)) {
  StringBuilder sourcemap = new StringBuilder();
  compiler.getSourceMap().appendTo(sourcemap, jsonOutput.getPath());
  jsonOutput.setSourceMap(sourcemap.toString());
 }
 return jsonOutput;
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/**
 * Save the compiler output to a JsonFileSpec to be later written to
 * stdout
 */
JsonFileSpec createJsonFile(B options, String outputMarker,
  Function<String, String> escaper) throws IOException {
 Appendable jsOutput = new StringBuilder();
 writeOutput(
   jsOutput, compiler, compiler.toSource(), config.outputWrapper,
   outputMarker, escaper);
 JsonFileSpec jsonOutput = new JsonFileSpec(jsOutput.toString(),
   Strings.isNullOrEmpty(config.jsOutputFile) ?
     "compiled.js" : config.jsOutputFile);
 if (!Strings.isNullOrEmpty(options.sourceMapOutputPath)) {
  StringBuilder sourcemap = new StringBuilder();
  compiler.getSourceMap().appendTo(sourcemap, jsonOutput.getPath());
  jsonOutput.setSourceMap(sourcemap.toString());
 }
 return jsonOutput;
}

代码示例来源:origin: com.google.javascript/closure-compiler

/**
 * Outputs the source map found in the compiler to the proper path if one exists.
 *
 * @param options The options to the Compiler.
 */
@GwtIncompatible("Unnecessary")
private void outputSourceMap(B options, String associatedName) throws IOException {
 if (Strings.isNullOrEmpty(options.sourceMapOutputPath)
   || options.sourceMapOutputPath.equals("/dev/null")) {
  return;
 }
 String outName = expandSourceMapPath(options, null);
 maybeCreateDirsForPath(outName);
 try (Writer out = fileNameToOutputWriter2(outName)) {
  compiler.getSourceMap().appendTo(out, associatedName);
 }
}

代码示例来源:origin: com.google.javascript/closure-compiler

final String getCurrentJsSource() {
 SourceMap sourceMap = getSourceMap();
 if (sourceMap != null) {
  sourceMap.reset();

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/**
 * Outputs the source map found in the compiler to the proper path if one
 * exists.
 *
 * @param options The options to the Compiler.
 */
private void outputSourceMap(B options, String associatedName)
  throws IOException {
 if (Strings.isNullOrEmpty(options.sourceMapOutputPath)) {
  return;
 }
 String outName = expandSourceMapPath(options, null);
 maybeCreateDirsForPath(outName);
 Writer out = fileNameToOutputWriter2(outName);
 try {
  compiler.getSourceMap().appendTo(out, associatedName);
 } finally {
  out.close();
 }
}

代码示例来源:origin: apache/royale-compiler

compiler_.getSourceMap().appendTo(sourceMapFile, "");
sourceMapFile.close();

代码示例来源:origin: samaxes/minify-maven-plugin

flushSourceMap(sourceMapResult, minifiedFile.getName(), compiler.getSourceMap());

代码示例来源:origin: com.samaxes.maven/minify-maven-plugin

flushSourceMap(sourceMapResult, minifiedFile.getName(), compiler.getSourceMap());

代码示例来源:origin: org.wisdom-framework/wisdom-maven-plugin

createSourceMapFile(output,compiler.getSourceMap());

代码示例来源:origin: org.scala-js/closure-compiler-java-6

try {
 if (options.sourceMapOutputPath != null) {
  compiler.getSourceMap().reset();
  compiler.getSourceMap().appendTo(mapFileOut, moduleFilename);

代码示例来源:origin: com.google.javascript/closure-compiler

try (Writer writer = fileNameToLegacyOutputWriter(moduleFilename)) {
 if (options.sourceMapOutputPath != null) {
  compiler.getSourceMap().reset();
  compiler.getSourceMap().appendTo(mapFileOut, moduleFilename);

代码示例来源:origin: prezi/spaghetti

compiler.getSourceMap().appendTo(writer, args.outputFile.getPath());
writer.close();
System.out.println("Wrote: " + args.sourceMap.getAbsolutePath());

相关文章

Compiler类方法