outputJs = passed ? compiler.getJavascript() : null;
outputHtml = passed ? compiler.getStaticHtml() : null;
} else if ("javascript".equals(language)) {
PluginMeta meta = new PluginMeta(fetcher, policy);
passed = true;
JsOptimizer optimizer = new JsOptimizer(mq);
for (File f : inputs) {
try {
if (f.getName().endsWith(".env.json")) {
loadEnvJsonFile(f, optimizer, mq);
} else {
ParseTreeNode parsedInput = new ParserContext(mq)
.withInput(new InputSource(f.getCanonicalFile().toURI()))
.withConfig(meta)
.build();
if (parsedInput != null) {
optimizer.addInput((Statement) parsedInput);
}
}
} catch (IOException ex) {
logger.println("Failed to read " + f);
passed = false;
} catch (ParseException ex) {
logger.println("Failed to parse " + f);
ex.toMessageQueue(mq);
passed = false;
} catch (IllegalStateException e) {
logger.println("Failed to configure parser " + e.getMessage());
passed = false;
}
}
outputJs = optimizer.optimize();
outputHtml = null;
} else {
throw new RuntimeException("Unrecognized language: " + language);
}
passed = passed && !hasErrors(mq);