本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}