HNHacker News
TopNewBestAskShowJobs

hzoo

266 karma · joined March 28, 2016

submissionscomments
hzoo··on V8, Advanced JavaScript, and the Next Performance Frontier [video]
You don't have to use Babel, but if you want to use newer/syntax not in Node/v8 then yes. Always a tradeoff, but gave a talk at TC39 recently about this, https://github.com/hzoo/role-of-babel-in-js, https://twitter.com/left_pad/status/867593358977499137.

https://github.com/babel/babel-preset-env with our `"node": "current"` option can help with this.

hzoo··on What's New in Create React App
Yeah it's definetely a lot of work on both ends (also means would need to coordinate releases of both like we do with flow) but hopefully this helps the ecosystem that wants to use both (seems to be an increasingly higher number of people).
hzoo··on What's New in Create React App
Yep, and we (Babel) are trying to work with TS on integrating it into Babel similar to how flow works with Babel (parser support + a plugin/preset to strip types). Again, limited resources so if the community really wants it, we would appreciate help in reviewing PRs and testing!

https://github.com/babel/babylon/issues/320, https://github.com/babel/babylon/issues/523

hzoo··on Prepack helps make JavaScript code more efficient
Yep it is! https://twitter.com/dan_abramov/status/859817680857165824
hzoo··on Idx: Easily access deeply nested nullable fields in JavaScript
I haven't heard of this either. I guess they just wanted something that worked with minimal effort. Making the plugin and writing/coming up with spec tests takes time but albeit a better effort for the community overall. Maybe we can get more contributors for this effort now?

I made an issue for parser support, and after that we can create a babel plugin though https://github.com/babel/babylon/issues/328.

hzoo··on ECMAScript 2016+ in Firefox
Thanks! Will be working torward making the preset-env + babel-minify combo work much better soon.
hzoo··on Announcing TypeScript 2.2
FYI we do have an issue open about TS https://github.com/babel/babylon/issues/320 so that we could eventually support TS in Babel as a plugin and then create the same strip-types-plugin just like Flow.
hzoo··on Announcing TypeScript 2.2
We don't support custom syntax that isn't already a proposal (meaning it has potential to be in JS), and we also encourage using presets like https://github.com/babel/babel-preset-env instead of providing your own configuration of plugins unless you are more of a power user.

It's our intention as a tool to align with TC39 and transition users to using native JS when it's supported

hzoo··on ECMAScript 2016+ in Firefox
The purpose of Babel/transpilers is to eventually allow users to use the native versions of language features. Native support will eventually be faster (not at first), will result in less code sent to users (compiled code is larger), and easier to debug (don't need sourcemaps).

https://v8project.blogspot.com/2017/02/high-performance-es20...

I made https://github.com/babel/babel-preset-env to make it easier to transition. Hoping that Babel makes it easier to not have to think about whether you are using native or not, so we'll work on that workflow.

hzoo··on ECMAScript 2016+ in Firefox
Yep and with Babel we recommend using https://github.com/babel/babel-preset-env to compile only what's missing in the targets you support.

Hopefully we have a better solution about making multiple bundles (separate one for IE) soon

hzoo··on From AST to Lossless Syntax Tree
For JavaScript we have https://github.com/estree/estree as our JS AST spec for parsers like esprima, acorn, babylon (under a config flag), etc.

JSCS (https://github.com/jscs-dev/node-jscs) (now merged with ESLint) started a CST project as well https://github.com/cst/cst to help deal with autoformatting by adding whitespace type nodes.

Currently the community has a lot of interest in https://github.com/jlongster/prettier which just simply reprints the file from scratch in a consistent way (posted in https://news.ycombinator.com/item?id=13365470).

We also have https://github.com/benjamn/recast to help source to source transformations and https://github.com/facebook/jscodeshift.

hzoo··on Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
https://github.com/babel/babel-preset-env/ should help with this to remove the polyfills that are already supported, and with some future work to remove polyfills are unused.
hzoo··on Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
Might be a good chance to suggest using our new preset: https://github.com/babel/babel-preset-env/.

TL;DR - automate your Babel config options based on targets.

babel-preset-env: A Babel preset that can automatically determine the Babel plugins and polyfills you need based on your supported environments.

It takes the data from compat-table [1] to generate a mapping [2] between a Babel plugin and the first version that a browser/env supports. We calculate the least common denominator of your targeted envs to determine the final set of plugins to compile with.

(Feel free to ask questions, I help maintain Babel and the preset). Just released a 1.0 a few weeks ago and looking for more help and usage! Looking into more help with removing unnecessary polyfills, and determining plugins based on performance via benchmarks of native/compiled.

And yes there is a lot of work that goes into making this work correctly (and in the foreseeable future with ES2015+). Would appreciate any help moving forward. And maybe we should just replace/recommend this preset instead of anything else to fight the fatigue..

[1]: https://kangax.github.io/compat-table/es6/ [2]: https://github.com/babel/babel-preset-env/blob/master/data/p...

hzoo··on Traceur – A JavaScript.next-to-JavaScript-of-today compiler
Yep!

> We also presented Traceur at NodeConf 2011. The video is available on YouTube [1]

[1] https://www.youtube.com/watch?feature=player_detailpage&v=nt...

hzoo··on The State of Babel
Awesome! What's one of them? Hope to see you around then!
hzoo··on The State of Babel
Author here, if anyone had questions or wanted to know more about how to help out!

Personally, I'm most excited about babel-preset-env, and fixing how we work with the TC39 process via experimental plugins, and working with the community more.

For anyone wanting to get started in OSS or Babel I just started a year ago from knowing nothing about it!

hzoo··on The State of Babel
Haha fixed - or it can be a joke on the output being larger.
hzoo··on Announcing TypeScript 2.1
There's actually a useBuiltins option to remove the _extends helper if you want to use that.

https://babeljs.io/docs/plugins/transform-object-rest-spread...

Might be cool in combination with preset-env

hzoo··on The State of Babel
I know jlongster started https://github.com/jlongster/jscodefmt

https://twitter.com/jlongster/status/804888882408026113 which uses recast/babylon

hzoo··on Announcing TypeScript 2.1
You might be interested in https://github.com/babel/babel-preset-env :D.

(I'm working on it so let me know if you have questions)

hzoo··on How to contribute to an open source project on GitHub
I think it depends on the project like mentioned.

For react, the docs for the website is in the same repo as the main code under "docs/" https://github.com/facebook/react/tree/master/docs.

A lot of projects do what we do with babel: have a separate repo with the whole username.github.io name: https://github.com/babel/babel.github.io.

And a lot of projects started adding links to edit the page you are currently on: http://babeljs.io/docs/learn-es2015/ (see the "edit this page" link on the header. For yarn it's on the bottom: https://yarnpkg.com/en/docs/. That at least makes it easy to edit a specific page for typos etc. Then you can just edit it from the website

hzoo··on How to contribute to an open source project on GitHub
This is a great start!

Contributing can be a lot more than just PRs though: - answering questions on stack overflow, chat (irc, gitter, slack)

- creating a minimal code repro, checking for duplicates, checking if a bug is fixed in a later release/master branch

- writing tutorials/usage scenarios, giving talks, just using the project and providing feedback

- helping with documentation + website

- translations if possible

- reviewing other PRs

- helping with the changelog, testing prereleases

- adding to the discussion on issues

Bigger projects can have a pretty hard time with maintenance: fixing bugs, juggling PRs, making releases, answering questions, etc.

(We're looking for help on https://github.com/babel/babel and trying to figure out how we can make the project more contributor friendly!)

hzoo··on How to contribute to an open source project on GitHub
Not the best way to find an open source project to contribute to but you can check trending per language https://github.com/trending/csharp or the top starred repos that are C# https://github.com/search?l=C%23&q=language%3AC%23&ref=advse....

I'd be much easier to find a project you use or know about so you have a lot more context into the project, it's usage, documentation, etc.

hzoo··on How to contribute to an open source project on GitHub
Right! And a lot of projects have a linter in place that runs in continuous integration (travis, etc) that you can see in the PR or just locally.

In Babel we use ESLint for this https://github.com/babel/babel/blob/master/Makefile#L20-L27

hzoo··on Overview of JavaScript ES6 features
For those using Babel already or want to use ES6+ on a set of supported browsers: we have started work on https://github.com/babel/babel-preset-env. Would appreciate more testing!

It allows passing in a set of supported browsers and transpiling what is required using the lowest common denominator env (uses https://github.com/kangax/compat-table for data).

  // .babelrc with preset options
  {
    "presets": [
      ["env", {
        "targets": {
          "chrome": 52,
          "ie": 11,
          "browsers": ["last 2 versions", "safari 7"]
        }
      }]
    ]
  }
If you have questions, ask below (or make an issue)
hzoo··on Overview of JavaScript ES6 features
Working on https://github.com/babel/babel-preset-env right now which should help with this
hzoo··on Node v6.9.0 (LTS)
You can use node specific preset like other's have mentioned but working on https://github.com/babel/babel-preset-env for all future versions as well
hzoo··on Node v6.9.0 (LTS)
I've been working on https://github.com/babel/babel-preset-env/ and there's a similar request although using babel-polyfill rather than the service https://github.com/babel/babel-preset-env/issues/20
hzoo··on Babili: An ES6+ aware minifier based on Babel
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.
hzoo··on Babili: An ES6+ aware minifier based on Babel
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 all of that.

Yes, it doesn't need to be 33M that's just a result of the way it was used (babel-cli is that big) and I'm saying that it's something that we can fix

← PreviousPage 2 of 3Next →