Skip to content
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

Transpilation #18

Open
rtsao opened this issue Jan 16, 2018 · 6 comments
Open

Transpilation #18

rtsao opened this issue Jan 16, 2018 · 6 comments

Comments

@rtsao
Copy link

rtsao commented Jan 16, 2018

As of now, FastpackTranspiler supports a few, mostly non-standard syntax features (JSX, decorators) and some stage 3 features (spread).

What is the goal of this project in terms of transpilation? Some things like async/await to promises might be useful. Is a full-blown ES2015 to ES5 transpilation out of scope?

If fastpack supported something akin to babel-preset-env (where the language features are transpiled based on target runtimes) that would be awesome.

@thangngoc89
Copy link

AFAIK, this project uses Flow parser so it understands any valid Flow code.

@andreypopp
Copy link
Collaborator

Hi, we are open for PRs to add more transpilation features to fastpack. We have infra in place for adding more transpilers and tests for them. If you are interested — definitely contribute!

The reason we didn't do it yet is just lack of time. So help is greatly appreciated.

Writing AST transform in OCaml/Reason is a pleasure — for example this is React JSX transpiler — https://github.com/fastpack/fastpack/blob/master/FastpackTranspiler/ReactJSX.ml

@zindel
Copy link
Member

zindel commented Jan 18, 2018

@rtsao are there any specific missing important tranpilers in your opinion? We've purposely kept the list short for the beginning in order to only support development in the latest Chrome/FF.

@rtsao
Copy link
Author

rtsao commented Jan 18, 2018

That's what I was wondering; the set of currently implemented transforms makes sense for modern targets, but I was curious about your amenability to the adding of babel-preset-env feature parity (i.e. transpilation all the way down to ES5, depending on target).

Obviously this would be a rather large undertaking (I'd be interested in helping build this), but it would allow for more-or-less drop-in replacement for Webpack/Babel and open up the possibility of an entirely native build/compile pipeline.

@zindel
Copy link
Member

zindel commented Jan 18, 2018

@rtsao ok. That's definitely in the mid-term plan. In the short term we could add the config placeholder and prioritise targets/transpilers to support first

@andreypopp
Copy link
Collaborator

andreypopp commented Jan 18, 2018

Also to mention that in the meantime we are going to rely on babel for prod builds:

fpack src/index.js \
  --output build/js \
  --transpile '^src' \
  --postprocess 'babel --presets es2015' \
  --postprocess 'uglifyjs -cm'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants