From 5a8e573fc5ca51765daf09b80fcec5bc7b1d0142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 3 Dec 2018 17:12:59 +0100 Subject: [PATCH 1/2] Add blog post for v7.2.0 --- website/blog/2018-12-03-7.2.0.md | 81 ++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 website/blog/2018-12-03-7.2.0.md diff --git a/website/blog/2018-12-03-7.2.0.md b/website/blog/2018-12-03-7.2.0.md new file mode 100644 index 0000000000..ac2759dbc3 --- /dev/null +++ b/website/blog/2018-12-03-7.2.0.md @@ -0,0 +1,81 @@ +--- +layout: post +title: "7.2.0 Released: Private Instance Methods" +author: Nicolò Ribaudo +authorURL: https://twitter.com/NicoloRibaudo +date: 2018-12-03 12:00:00 +categories: announcements +share_text: "Babel 7.2.0 Released" +--- + +We just released a new minor version of Babel! + +This release includes support for private instance methods and a bunch of bug fixes regarding Flow and TypeScript types. You can read the whole changelog [on GitHub](https://github.com/babel/babel/releases/tag/v7.2.0). + + + +A lot of new contributors fixed bugs or implemented new features in this release: thanks to [Gcaufy](https://github.com/Gcaufy), [Grigory Moroz](https://github.com/morozRed), [Paul Happ](https://github.com/phapp88), [Tim McClure](https://github.com/tim-mc) and [Veaceslav Cotruta](https://github.com/katrotz)! + +A big shout out to Bloomberg for sponsoring the implementation of private class elements! This support for private _instance_ methods is a follow-up to private _static_ fields released in Babel [7.1.0](https://babeljs.io/blog/2018/09/17/7.1.0#private-static-fields-stage-3). + +If you or your company wants to support Babel and the evolution of JavaScript, but aren't sure how, you can donate to us on [OpenCollective](https://opencollective.com/babel) or, better yet, work with us on the implementation of [new ECMAScript proposals](https://github.com/babel/proposals) directly! + +## Highlights + +### Private Instance Methods ([#8654](https://github.com/babel/babel/pull/8654)) + +```javascript= +class Person { + #age = 19; + + #increaseAge() { + this.#age++; + } + + birthday() { + this.#increaseAge(); + alert("Happy Birthday!"); + } +} +``` + +Thanks to [Tim](https://github.com/tim-mc) for implementing this proposal, and to [Nicolò](https://twitter.com/NicoloRibaudo) and [Justin](https://github.com/jridgewell) for the reviews! + +You can test private methods by adding the `@babel/plugin-proposal-private-methods` plugin to your Babel configuration, or enabling the `stage-3` preset in the [repl](https://babeljs.io/repl/build/master#?presets=stage-3). + +Private accessors [are also coming](https://github.com/babel/babel/pull/9101), and we have done some big internal refactoring that allows us to add support for private elements to decorators soon :tada:. + +### "Smart" Pipeline Operator Parsing ([#8289](https://github.com/babel/babel/pull/8289)) + +Thanks to the work of [James DiGioia](https://github.com/mAAdhaTTah), `@babel/parser`now also supports the [Smart Pipeline Operator](https://github.com/js-choi/proposal-smart-pipelines/), in addition to the [Simple](https://github.com/tc39/proposal-pipeline-operator) version. + +We currently only support the "core" of the smart pipeline proposal, and not the additional features. + +```javascript= +// "Smart" +const result = 2 |> double |> 3 + # |> toStringBase(2, #); // "111" + +// "Simple" +const result = 2 |> double |> (x => 3 + x) |> (x => toStringBase(2, x)); +``` + +Babel implements multiple variants of this proposal to help TC39 understand what the community wants. For this reason, testing and feedback are highly welcome, but expect it to have changes in the future. + +If you are directly using `@babel/parser` and you want to test this proposal, you can pass the `proposal: "smart"` option to the pipeline plugin: + +```javascript= +const ast = babel.parse(code, { + plugins: [ + ["pipelineOperator", { proposal: "smart" }] + ] +}) +``` + +We don't support transpiling this syntax yet, but it will come soon. + +### Plugin Names ([#8769](https://github.com/babel/babel/pull/8769)) + +Every official plugin now provides Babel its name. Although this doesn't affect normal Babel use, when used in conjunction with [Time Travel](https://github.com/babel/website/pull/1736) it allows to see exactly what each plugins is doing to your code. You can test in using the [repl](https://babeljs.io/repl/build/master#?timeTravel=true): + +![](https://i.imgur.com/AzKc37i.gif) + From 2f1e12dd976042e373ca10b5f17af7cd5b6c1944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 3 Dec 2018 19:42:04 +0100 Subject: [PATCH 2/2] Review by Brian --- website/blog/2018-12-03-7.2.0.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/website/blog/2018-12-03-7.2.0.md b/website/blog/2018-12-03-7.2.0.md index ac2759dbc3..b71a3f71b9 100644 --- a/website/blog/2018-12-03-7.2.0.md +++ b/website/blog/2018-12-03-7.2.0.md @@ -18,7 +18,7 @@ A lot of new contributors fixed bugs or implemented new features in this release A big shout out to Bloomberg for sponsoring the implementation of private class elements! This support for private _instance_ methods is a follow-up to private _static_ fields released in Babel [7.1.0](https://babeljs.io/blog/2018/09/17/7.1.0#private-static-fields-stage-3). -If you or your company wants to support Babel and the evolution of JavaScript, but aren't sure how, you can donate to us on [OpenCollective](https://opencollective.com/babel) or, better yet, work with us on the implementation of [new ECMAScript proposals](https://github.com/babel/proposals) directly! +If you or your company wants to support Babel and the evolution of JavaScript, but aren't sure how, you can donate to us on [OpenCollective](https://opencollective.com/babel) and, better yet, work with us on the implementation of [new ECMAScript proposals](https://github.com/babel/proposals) directly! ## Highlights @@ -47,7 +47,7 @@ Private accessors [are also coming](https://github.com/babel/babel/pull/9101), a ### "Smart" Pipeline Operator Parsing ([#8289](https://github.com/babel/babel/pull/8289)) -Thanks to the work of [James DiGioia](https://github.com/mAAdhaTTah), `@babel/parser`now also supports the [Smart Pipeline Operator](https://github.com/js-choi/proposal-smart-pipelines/), in addition to the [Simple](https://github.com/tc39/proposal-pipeline-operator) version. +Thanks to the work of [James DiGioia](https://github.com/mAAdhaTTah), `@babel/parser` now also supports the [Smart Pipeline Operator](https://github.com/js-choi/proposal-smart-pipelines/), in addition to the [Simple](https://github.com/tc39/proposal-pipeline-operator) version. We currently only support the "core" of the smart pipeline proposal, and not the additional features. @@ -59,7 +59,7 @@ const result = 2 |> double |> 3 + # |> toStringBase(2, #); // "111" const result = 2 |> double |> (x => 3 + x) |> (x => toStringBase(2, x)); ``` -Babel implements multiple variants of this proposal to help TC39 understand what the community wants. For this reason, testing and feedback are highly welcome, but expect it to have changes in the future. +Babel implements multiple variants of this proposal to help TC39 test and gather feedback from the community. As with all proposals, expect changes in the future. If you are directly using `@babel/parser` and you want to test this proposal, you can pass the `proposal: "smart"` option to the pipeline plugin: @@ -75,7 +75,6 @@ We don't support transpiling this syntax yet, but it will come soon. ### Plugin Names ([#8769](https://github.com/babel/babel/pull/8769)) -Every official plugin now provides Babel its name. Although this doesn't affect normal Babel use, when used in conjunction with [Time Travel](https://github.com/babel/website/pull/1736) it allows to see exactly what each plugins is doing to your code. You can test in using the [repl](https://babeljs.io/repl/build/master#?timeTravel=true): +Every official plugin now provides Babel its name. Although this doesn't affect normal Babel use, it provides a consistent identifier for each plugin. This is particularly useful for things like [Time Travel](https://github.com/babel/website/pull/1736), which allows you to see exactly what each plugin is doing to your code. You can see this in effect via our [repl](https://babeljs.io/repl/build/master#?timeTravel=true): ![](https://i.imgur.com/AzKc37i.gif) -