PTAL
https://codereview.appspot.com/7810043/diff/4001/src/node/command.js
File src/node/command.js (right):
https://codereview.appspot.com/7810043/diff/4001/src/node/command.js#newcode38
src/node/command.js:38: flags.option('--traceur-options', 'xxxxx');
On 2013/03/15 14:58:04, usrbincc wrote:
> flags.option('--traceur-options <OPTIONS>', 'specify feature
options');
> I'm wondering about this, though. You can't pass '--traceur-options'
in
> the hypothetical '#!/usr/bin/env traceur' case.
> It's possible for '#!/usr/bin/traceur
--traceur-options=opt1,opt2=false'
> but it's unlikely traceur can reliably get to a standard location on
all
> systems.
> Hypothetical at the moment, since this code doesn't handle shebang
yet.
> ----
> On the other hand, I'm not sure this will ever see common use, since
in
> the normal case, you can just specify args directly.
> ./traceur --strict-semicolons --block-binding file.js
> Maybe just remove '--traceur-options' and implement 'Options:' in a
> follow-up?
I think I forgot to upload a new version.
My current plan is to not include this in this patch. We can and should
revisit how to pass along params to traceur, node and v8 at some point.
https://codereview.appspot.com/7810043/diff/4001/src/node/command.js#newcode75
src/node/command.js:75: flags.parse(process.argv);
On 2013/03/15 14:58:04, usrbincc wrote:
> A little gotcha with passing args on to the script:
> # compiles instead of interpreting
> ./traceur interp-test.js --out out.js
> # this works
> ./traceur -- interp-test.js --out out.js
> '--' works, but most interpreters I know handle this without
> needing help. Probably just ignore for now, since this cannot be
> separated from the fact that we use Commander.js .
Lets try to track all these gotchas in new bugs. It is pretty lame that
I cannot use traceur to interpret an es6 file that takes an --out
command line flag.
https://codereview.appspot.com/7810043/diff/4001/src/node/compiler.js
File src/node/compiler.js (left):
https://codereview.appspot.com/7810043/diff/4001/src/node/compiler.js#oldcode30
src/node/compiler.js:30: require('./traceur.js');
On 2013/03/15 14:58:04, usrbincc wrote:
> Will compiler.js ever be used separately from command.js? If so, this
> still needs to be in here. According to node docs, this should only
get
> executed once, even if you 'require' several times, so it shouldn't
hurt
> to leave it in.
Good point. Putting it back.
https://codereview.appspot.com/7810043/diff/4001/src/node/interpreter.js
File src/node/interpreter.js (left):
https://codereview.appspot.com/7810043/diff/4001/src/node/interpreter.js#oldcode32
src/node/interpreter.js:32: argv[0] = 'traceur';
On 2013/03/15 14:58:04, usrbincc wrote:
> I know this mirrors node convention:
> ['node', 'file.js', 'arg1', 'arg2']
> ['traceur', 'file.js', 'arg1', 'arg2']
> but I still prefer the bash and python convention:
> ['file.js', 'arg1', 'arg2']
> though ruby and perl inexplicably do:
> ['arg1', 'arg2']
> Couldn't resist a mini-rant. But this is node convention, so there is
> some logic to it.
I want us to be able to replace "node foo.js" with "traceur foo.js" so I
don't think we have much of an option here.
https://codereview.appspot.com/7810043/