Nicolò Ribaudo 05b22d2597 Update @babel/helper-wrap-function templates (#6984)
This commit introduces 4 changes:

1) Function declarations are wrapped using function declarations.
   This has two advantages:
    - We can rely on native hoisting, instead of using _blockHoist
    - The function isn't wrapped until it is called. This avoids
      problems where `regeneratorRuntime.wrap` was called before
      that `babel-polyfill` was imported.

   Example:
     function fn() {}
     // becomes
     function fn() { return _fn.apply(this, arguments); }
     function _fn() {
       _fn = _wrapper(/* Original function ... */);
       return _fn.apply(this, arguments);
     }

2) Use a single template for both named and anonymous function
   expressions. They already had the same behavior, but the one
   used for named functions was a bit longer.

3) Use normal functions instead of arrow functions to wrap
   function expressions.

4) Generate a name based on the original one for wrapped
   functions (e.g. `foo` becomes `_foo` instead of `_ref`).
2017-12-13 16:21:58 +01:00
2017-11-10 13:39:48 +01:00
2017-11-21 20:03:16 -05:00
2017-12-02 08:59:08 -05:00
2017-11-21 20:03:16 -05:00
2017-11-21 20:03:16 -05:00
2016-10-17 10:51:49 -04:00
2017-11-24 15:18:13 +02:00
2017-11-21 20:03:16 -05:00
2017-11-21 20:03:16 -05:00
2017-11-21 20:03:16 -05:00
2017-12-02 09:38:52 -05:00
2017-01-05 22:12:12 +01:00
2017-12-07 17:36:49 -05:00
2017-12-07 17:36:49 -05:00

babel

The compiler for writing next generation JavaScript.

Travis Status CircleCI Status Coverage Status Slack Status npm Downloads

Supporting Babel

Backers on Open Collective Sponsors on Open Collective Business Strategy Status

Babel is community-driven and thus mostly maintained by a group of volunteers. It has a lot of companies and projects using it but almost no sponsors/people funded to work on it. If you'd like to help maintain the future of the project, please consider:

Intro

Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.

In

// ES2015 arrow function
[1, 2, 3].map((n) => n + 1);

Out

[1, 2, 3].map(function(n) {
  return n + 1;
});

Try it out at our REPL.

FAQ

Who maintains Babel?

Mostly a handful of volunteers! Please check out our team page!

Looking for support?

For questions and support please visit join our Slack Community, ask a question on Stack Overflow, or ping us on Twitter.

Is there a Babel song?

I'm so glad you asked: Hallelujah —— In Praise of Babel by @angus-c. Tweet us your recordings!

Where are the docs?

Check out our website: babeljs.io, and report issues/features at babel/website.

Want to report a bug or request a feature?

Please read through our CONTRIBUTING.md and fill out the issue template at babel/issues!

Want to contribute to Babel?

Check out our CONTRIBUTING.md to get started with setting up the repo.

  • If you have already joined Slack, join our #development channel and say hi!
  • Check out the issues with the good first issue and help wanted label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
  • Our discussions/notes/roadmap: babel/notes
  • Our progress on TC39 proposals: babel/proposals

How is the repo structured?

The Babel repo is managed as a monorepo that is composed of many npm packages.

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

License

MIT

Description
No description provided
Readme 79 MiB
Languages
JavaScript 99.5%
Makefile 0.3%
HTML 0.1%