HNHacker News
TopNewBestAskShowJobs

hzoo

266 karma · joined March 28, 2016

submissionscomments
hzoo··on Babili: An ES6+ aware minifier based on Babel
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://github.com/babel/babili/blob/master/packages/babili/...

I was thinking about using bundledDependencies or maybe just running webpack/rollup over the whole thing, feel free to make an issue.

hzoo··on Babili: An ES6+ aware minifier based on Babel
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 was an effort to standardize as well in https://github.com/estree/estree.

EDIT:

However, in Babel 6 there were a few (nice) incompatible changes to the AST which was unfortunate for interop and other tools (https://github.com/babel/babel-eslint had to make a lot of changes).

I don't want to speak for him, but I think a lot of the decisions to fork (parser, etc) at the time were most likely made like mentioned above to move faster. And at the time, Sebastian was basically the only one working on it. Maybe more context from his post: https://medium.com/@sebmck/2015-in-review-51ac7035e272#.qcyz...

hzoo··on LogicJS adds logic programming to JavaScript
Yeah, the transformation itself shouldn't be bad.

Made a Babel transform real quick for this particular example:

http://astexplorer.net/#/ZT6HYai08w

hzoo··on JavaScript async/await implemented in V8
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...
hzoo··on WebKit is now 100% ES6 complete
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/722826060161617923.

hzoo··on Node.js v6.0 Released
You can use the env option to change the transforms per env http://babeljs.io/docs/usage/babelrc/#env-option
hzoo··on Node.js v6.0 Released
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/babel/pull/3476.

hzoo··on The average size of Web pages is now the average size of a Doom install
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); }

hzoo··on Es-search: Search ECMAScript structurally
There's also http://www.graspjs.com which also uses acorn.
hzoo··on Babel 6 – useless by default
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

hzoo··on Babel 6 – useless by default
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 default async function requireFromTwitter (id) {}" > index.js

echo '{ "presets": ["es2015","stage-0"], "plugins": ["transform-runtime"] }' > .babelrc

./node_modules/.bin/babel-node index.js

hzoo··on Babel 6 – useless by default
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}`);" > index.js

./node_modules/.bin/babel-node index.js.

I would link to http://babeljs.io/docs/usage/cli/ since users wouldn't get what babel-node vs babel is.

The init cli is certainly something we should do; I mentioned this in a comment below.(issue is https://phabricator.babeljs.io/T6956)

hzoo··on Babel 6 – useless by default
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 `babel init` command. We can also run that/error when a user tries to run babel without specifying a preset/plugin.

http://babeljs.io/docs/setup/#babel_cli

← PreviousPage 3 of 3