Iroh
Iroh copied to clipboard
ES6 support
I think it's good to use babel
It supports new syntaxes (ES7 / ES8 / stage-X / jsx / flow / ...)
He also has a developed and convenient API for transformations
Please look at my prototype, how could this project look like using babel
https://github.com/Gvozd/Iroh/commit/21b45448f54f3b7f1ccfb1800943c30aec63650b#diff-166fafb4696a306abbebc2eb37ec80b4
Also it seems to me that moving to Babel will simplify the code of transformations
In particular, the task will simplify https://github.com/maierfelix/Iroh/issues/1
This is a draft prototype - I almost did not use the existing code, but implemented a new implementation next to it
If you like the idea, I could help translate the project into a babel
PS separately pay attention to the test pattern https://github.com/Gvozd/Iroh/commit/26c050dea2ef7e501c8f96fd56e4eb259b7fcbe5#diff-623a568601cc9823c80b885448c341cc It can be used independently of this task
If you could provide an example on how to insert a variable before a loop and then access it inside the loop's body, then I'm willed to start working with babylon - it looks really promising.
something like this? https://astexplorer.net/#/gist/8a13b6fe10fdacfde3a74ca7b39e6ba3/992f85f791f8e0db7cfa70ae3da55184954410d9
About users transpilation:
If use babel, may do any transpilation, defined in .babelrc (or as argument to Iroh.Stage) - I have TODO to this
I think, good idea do transpilation after Iroh sub-plugins, because transpilations create more additional function calls, temp variables, switch-cases and other. That not really user source, and not need debug it.
Instead this need debug user source, like AsyncFunction, or another syntax
Also, babel has plus: you may use only needed transformation. If user handled on Iroh.LOOP, not need wrap function call
UPD: https://astexplorer.net/#/gist/8a13b6fe10fdacfde3a74ca7b39e6ba3/126dfc8887ee7e64ece373ff1af575e74d65da84 I found ensureBlock method, instead manual BlockStatement createing
Babel documentation Plugin Handbook https://babeljs.io/docs/core-packages/babel-types/
Thanks, very helpful!
I'm pretty new to rollup, could you extend your fork to support babel-traverse with npm run browser? It's the only thing holding me back to start working on it
Sorry, I've never worked with a rollup
But I can work with webpack+babel bundling
If you want I can configure bundling with webpack
Thanks, I would appreciate it!
OK Until Wednesday I will transfer the assembly to Webpack
Also I'll make a cleaner version of my prototype - now it's a bit dirty, and it duplicates your existing code I will correct, that changes were only in the code of transformations
@maierfelix Please look PR #10
I'm sorry that I disappeared for a long time I research rollup in comparison with webpack(I liked rollup for less bundle size), and try build project with rollup Study rollup and attempt to build babel-core took a long time