Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
hzoo
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
11 ms
·
61.
▲
by
hzoo
10y ago
It's not a whole/brand new parser though. It's mostly acorn + JSX/Flow/everything experimental that wouldn't be in acorn anyway (until stage 4) for Babel.
62.
▲
by
hzoo
10y ago
Maybe I didn't word that correctly. It was created as a set of babel plugins but because like you said users shouldn't know what a babel preset is we have the cli tool which acts the same as babel-cli so you don't need to do
63.
▲
by
hzoo
10y ago
The way the minifier is currently implemented is just as a babel preset. We figured users would want to use the tool standalone without babel and the simpliest thing we thought of was to wraps babel-cli and pass in the preset. https:/
64.
▲
by
hzoo
10y ago
I would like that too! I don't think there have been any features added since the last one with Babel 6 release. Yeah there's multiple JavaScript parsers: esprima, acorn, shift, babylon (uglify has their own parser I think). There
65.
▲
Babili: An ES6+ aware minifier based on Babel
(babeljs.io)
94 points
by
hzoo
10y ago
|
44 comments
66.
▲
by
hzoo
10y ago
Yeah, the transformation itself shouldn't be bad. Made a Babel transform real quick for this particular example: http://astexplorer.net/#/ZT6HYai08w
67.
▲
by
hzoo
10y ago
If you don't want to use regenerator and your environment supports generators already you can use the async-to-generator transform https://gist.github.com/rauchg/8199de60db48026a6670620a1c33b...
68.
▲
by
hzoo
10y ago
Yep, it's our plan to do something like that with community help - have a PR open for discussion at https://github.com/babel/babel/pull/3476 . Also https://twitter.com/samccone/status
69.
▲
by
hzoo
10y ago
You can use the env option to change the transforms per env http://babeljs.io/docs/usage/babelrc/#env-option
70.
▲
by
hzoo
10y ago
As others have mentioned there are node and browser specific presets you can use. Also opened a PR for discussion about adding an environment award preset in babel or supporting it in core at https://github.com/babel/ba
71.
▲
by
hzoo
10y ago
Yeah, there will be Object.keys/Object.values/Object.entries and you can use it in an for of loop. for (let [key, value] of Object.entries({a: 1})) { console.log(key, value); }
72.
▲
by
hzoo
10y ago
There's also http://www.graspjs.com which also uses acorn.
73.
▲
by
hzoo
11y ago
Haha sorry the code itself is a joke right - I just mean the setup in the package.json (I posted it above) FYI: in reference to https://twitter.com/rauchg/status/712799807073419264
74.
▲
by
hzoo
11y ago
I left a comment on the site - but try https://gist.github.com/rauchg/5b032c2c2166e4e36713#file-pac... npm i -D babel-cli babel-preset-es2015 babel-preset-stage-0 babel-plugin-transform-runtime echo "export defaul
75.
▲
by
hzoo
11y ago
Yeah I think we can try adding something like that to the homepage. npm install --save-dev babel-cli babel-preset-es2015 echo '{ "presets": ["es2015"] }' > .babelrc echo "console.log(`1 + 1 = ${1 + 1}`)
76.
▲
by
hzoo
11y ago
If we don't decide to include "everything" by default, we can work on better docs (help is appreciated in where that could be improved as well as contributors!), and create a better setup experience with something like a `bab