当前位置: 首页>>代码示例>>Java>>正文


Java CompilerOptions.setTrustedStrings方法代码示例

本文整理汇总了Java中com.google.javascript.jscomp.CompilerOptions.setTrustedStrings方法的典型用法代码示例。如果您正苦于以下问题:Java CompilerOptions.setTrustedStrings方法的具体用法?Java CompilerOptions.setTrustedStrings怎么用?Java CompilerOptions.setTrustedStrings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.javascript.jscomp.CompilerOptions的用法示例。


在下文中一共展示了CompilerOptions.setTrustedStrings方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCompilerOptions

import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
public CompilerOptions getCompilerOptions() {
  final CompilerOptions options = new CompilerOptions();
  options.setClosurePass(true);

  options.setCheckGlobalNamesLevel(CheckLevel.ERROR);
  // Report duplicate definitions, e.g. for accidentally duplicated externs.
  options.setWarningLevel(DiagnosticGroups.DUPLICATE_VARS, CheckLevel.ERROR);

  options.setLanguage(CompilerOptions.LanguageMode.ECMASCRIPT_2015);
  options.setLanguageOut(CompilerOptions.LanguageMode.NO_TRANSPILE);

  // Do not transpile module declarations
  options.setWrapGoogModulesForWhitespaceOnly(false);
  // Stop escaping the characters "=&<>"
  options.setTrustedStrings(true);
  options.setPreferSingleQuotes(true);

  // Compiler passes must be disabled to disable down-transpilation to ES5.
  options.skipAllCompilerPasses();
  // turns off optimizations.
  options.setChecksOnly(true);
  options.setPreserveDetailedSourceInfo(true);
  options.setParseJsDocDocumentation(Config.JsDocParsing.INCLUDE_DESCRIPTIONS_NO_WHITESPACE);

  return options;
}
 
开发者ID:angular,项目名称:clutz,代码行数:27,代码来源:Options.java

示例2: initCompilerOptions

import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
protected CompilerOptions initCompilerOptions() {
    CompilerOptions opts = new CompilerOptions();
    opts.setSummaryDetailLevel(1);
    opts.prettyPrint = true;

    // MIT-LL's integrated demo script requires this setting since
    // it uses trailing commas in object literals.
    opts.setLanguageIn(LanguageMode.ECMASCRIPT5);
    opts.setGenerateExports(false);
    opts.setPreferLineBreakAtEndOfFile(false);
    opts.setTrustedStrings(true);

    /*
    DependencyOptions dopts = new DependencyOptions();
    dopts.setDependencyPruning(true);
    dopts.setMoocherDropping(true);
    opts.setDependencyOptions(dopts);
    */

    return opts;
}
 
开发者ID:blackoutjack,项目名称:jamweaver,代码行数:22,代码来源:JSSourceManager.java

示例3: generateCode

import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
public String generateCode(AbstractCompiler compiler, Node node) {
  // TODO(mknichel): Fix all the formatting problems with this code.
  // How does this play with goog.scope?
  if (node.isNormalBlock()) {
    // Avoid printing the {}'s
    node.setToken(Token.SCRIPT);
  }
  CompilerOptions compilerOptions = new CompilerOptions();
  compilerOptions.setPreferSingleQuotes(true);
  compilerOptions.setUseOriginalNamesInOutput(true);
  // We're refactoring existing code, so no need to escape values inside strings.
  compilerOptions.setTrustedStrings(true);
  return new CodePrinter.Builder(node)
      .setCompilerOptions(compilerOptions)
      .setTypeRegistry(compiler.getTypeRegistry())
      .setPrettyPrint(true)
      .setLineBreak(true)
      .setOutputTypes(true)
      .build();
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:21,代码来源:SuggestedFix.java

示例4: createCompilerOptions

import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
private CompilerOptions createCompilerOptions() {
  CompilerOptions options = new CompilerOptions();

  this.compilationLevel.setOptionsForCompilationLevel(options);
  if (this.debugOptions) {
    this.compilationLevel.setDebugOptionsForCompilationLevel(options);
  }

  options.setEnvironment(this.environment);

  options.setPrettyPrint(this.prettyPrint);
  options.setPrintInputDelimiter(this.printInputDelimiter);
  options.setPreferSingleQuotes(this.preferSingleQuotes);
  options.setGenerateExports(this.generateExports);

  options.setLanguageIn(this.languageIn);
  options.setLanguageOut(this.languageOut);
  options.setOutputCharset(this.outputEncoding);

  this.warningLevel.setOptionsForWarningLevel(options);
  options.setManageClosureDependencies(manageDependencies);
  convertEntryPointParameters(options);
  options.setTrustedStrings(true);
  options.setAngularPass(angularPass);

  if (replaceProperties) {
    convertPropertiesMap(options);
  }

  convertDefineParameters(options);

  for (Warning warning : warnings) {
    CheckLevel level = warning.getLevel();
    String groupName = warning.getGroup();
    DiagnosticGroup group = new DiagnosticGroups().forName(groupName);
    if (group == null) {
      throw new BuildException(
          "Unrecognized 'warning' option value (" + groupName + ")");
    }
    options.setWarningLevel(group, level);
  }

  if (!Strings.isNullOrEmpty(sourceMapFormat)) {
    options.setSourceMapFormat(Format.valueOf(sourceMapFormat));
  }

  if (!Strings.isNullOrEmpty(sourceMapLocationMapping)) {
    String[] tokens = sourceMapLocationMapping.split("\\|", -1);
    LocationMapping lm = new LocationMapping(tokens[0], tokens[1]);
    options.setSourceMapLocationMappings(Arrays.asList(lm));
  }

  options.setApplyInputSourceMaps(applyInputSourceMaps);

  if (sourceMapOutputFile != null) {
    File parentFile = sourceMapOutputFile.getParentFile();
    if (parentFile.mkdirs()) {
      log("Created missing parent directory " + parentFile, Project.MSG_DEBUG);
    }
    options.setSourceMapOutputPath(parentFile.getAbsolutePath());
  }
  return options;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:64,代码来源:CompileTask.java

示例5: createCompilerOptions

import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
private CompilerOptions createCompilerOptions() {
  CompilerOptions options = new CompilerOptions();

  this.compilationLevel.setOptionsForCompilationLevel(options);
  if (this.debugOptions) {
    this.compilationLevel.setDebugOptionsForCompilationLevel(options);
  }

  options.prettyPrint = this.prettyPrint;
  options.printInputDelimiter = this.printInputDelimiter;
  options.generateExports = this.generateExports;

  options.setLanguageIn(this.languageIn);
  options.setOutputCharset(this.outputEncoding);

  this.warningLevel.setOptionsForWarningLevel(options);
  options.setManageClosureDependencies(manageDependencies);
  convertEntryPointParameters(options);
  options.setTrustedStrings(true);

  if (replaceProperties) {
    convertPropertiesMap(options);
  }

  convertDefineParameters(options);

  for (Warning warning : warnings) {
    CheckLevel level = warning.getLevel();
    String groupName = warning.getGroup();
    DiagnosticGroup group = new DiagnosticGroups().forName(groupName);
    if (group == null) {
      throw new BuildException(
          "Unrecognized 'warning' option value (" + groupName + ")");
    }
    options.setWarningLevel(group, level);
  }

  if (!Strings.isNullOrEmpty(sourceMapFormat)) {
    options.sourceMapFormat = Format.valueOf(sourceMapFormat);
  }

  if (sourceMapOutputFile != null) {
    File parentFile = sourceMapOutputFile.getParentFile();
    if (parentFile.mkdirs()) {
      log("Created missing parent directory " + parentFile, Project.MSG_DEBUG);
    }
    options.sourceMapOutputPath = parentFile.getAbsolutePath();
  }
  return options;
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:51,代码来源:CompileTask.java


注:本文中的com.google.javascript.jscomp.CompilerOptions.setTrustedStrings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。