-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix TLA with esnext syntax #33
Conversation
4321145
to
d7f048e
Compare
The entire point of n> is to use no babel and match node exactly. |
TLA shouldn’t even work in n> until it’s shipped in node. |
I see your point, but we are talking about a bot CLI, which has to be practical, just like devtools, or |
Fair. I still think it’s best to avoid Babel for this mode. |
I think it's fine to support TLA, but only if we avoid running code that doesn't use TLA through babel. Base babel settings: all syntax plugins enabled ON_RECEIVE_MESSAGE
NODE:
|
to be clear, I switched from acorn to babel-parser and enabled all syntax plugins (but you're right we don't need all) because I wanted to be able to parse all currently valid code for current node (12.9.0) supports those:
Enabling all of them doesn't mean
In case of note: I'd really want to avoid using regex for code, it'll fail for some cases hmm I guess the answer is yes to my previous question @brigand , we can just remove step2, and use babel-parser to detect if the AwaitExpression exists at the top level, I'll work on that |
In the steps I outlined, the 'await' regex is just to quickly skip the following steps for code that we are sure doesn't have a top level await. |
f6d5a77
to
0f4c2cf
Compare
@brigand Ok done in the last commit, in comparison this is a simpler approach caub/jellobot@fix-tla...caub:fix-tla2 but that parse twice if babel+TLA, so let's use your idea, thanks |
currently
n> class A{x=1} await 1
fails, because acorn doesn't handle esnext syntax, I could have used npm.im/acorn-stage3, but acorn-walk doesn't work with those stage3 new nodes, so I went full babel