bolinfest/plovr

languageIn/languageOut aren't respected in the extract command

Closed this issue · 2 comments

Specifically, the compiler will bail if I'm using ES6 anywhere in my JS, even if I pass the language-in option in the config. I've already looked into this and submitted a PR: #132

My minimal repro follows:

plovr.json

{
    "id": "es6-bug",
    "mode": "ADVANCED",
    "level": "VERBOSE",
    "language": "en",
    "language-in": "ECMASCRIPT6",
    "language-out": "ECMASCRIPT5",
    "inputs": ["bug.soy", "bug.js"],
    "output-file": "out.js"
}

bug.soy

{namespace BugSoy}
/**
 */
{template .message}
{msg desc="example"}Extract me!{/msg}
{/template}

bug.js

const msg = soy.renderAsFragment(BugSoy.message, {});
console.log(msg);

Console output

Robin$ java -jar plovr.jar extract plovr.json
Exception in thread "main" java.lang.RuntimeException: JSCompiler errors
bug.js:1: ERROR - this language feature is only supported for ECMASCRIPT6 mode or better: const declaration. Use --language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT to enable ES6 features.
const msg = soy.renderAsFragment(BugSoy.message, {});
^
nicks commented

Great test case! I put it in the repo under testdata/issue131 so it doesn't regress.

nicks commented

(also, let us know if you'd need us to do a release for this fix)