From 6b143a516f7ce92e33abea5f4147499db8436b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=C2=A0S=2E=C2=A0Choi?= Date: Sat, 11 Sep 2021 16:10:47 -0400 Subject: [PATCH 1/2] pipe operator: Add topicToken: ^ (caret) option --- docs/plugin-proposal-pipeline-operator.md | 43 ++++++++++++++++------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/docs/plugin-proposal-pipeline-operator.md b/docs/plugin-proposal-pipeline-operator.md index e2981937f1..98a1ac5f74 100644 --- a/docs/plugin-proposal-pipeline-operator.md +++ b/docs/plugin-proposal-pipeline-operator.md @@ -22,7 +22,7 @@ Configure which proposal to use with the required `"proposal"` option. | `"hack"` | [Hack-style pipes](https://github.com/js-choi/proposal-hack-pipes) | `v7.15.0` | ~~`"smart"`~~ | [Smart-mix pipes](https://github.com/js-choi/proposal-smart-pipelines) (deprecated) | `v7.3.0` -If `"proposal": "hack"` is used, then a `"topicToken": "%"` or `"topicToken": "#"` option must also be included. +If `"proposal": "hack"` is used, then a `"topicToken": "^"`, `"topicToken": "%"`, or `"topicToken": "#"` option must also be included. The `"proposal": "smart"` option is deprecated and subject to removal in a future major version. @@ -46,7 +46,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -[Hack pipes](https://github.com/js-choi/proposal-hack-pipes/)
`{proposal: "hack",`
`topicToken: "%"}` +[Hack pipes](https://github.com/js-choi/proposal-hack-pipes/)
`{proposal: "hack",`
`topicToken: "^"}` @@ -70,7 +70,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> o.m(%)` +`x |> o.m(^)` @@ -92,7 +92,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> o.m(0, %)` +`x |> o.m(0, ^)` @@ -114,7 +114,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> new o.m(%)` +`x |> new o.m(^)` @@ -136,7 +136,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> o[%]` +`x |> o[^]` @@ -158,7 +158,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> %[i]` +`x |> ^[i]` @@ -180,7 +180,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> % + 1` +`x |> ^ + 1` @@ -202,7 +202,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> [0, %]` +`x |> [0, ^]` @@ -224,7 +224,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> { key: % }` +`x |> { key: ^ }` @@ -242,7 +242,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> await o.m(%)` +`x |> await o.m(^)` @@ -256,7 +256,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an Not supported -`x |> (yield o.m(%))` +`x |> (yield o.m(^))` @@ -284,6 +284,15 @@ For [F# pipes with `await`](https://github.com/valtech-nyc/proposal-fsharp-pipel ] } ``` +For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `^` topic token: + +```json +{ + "plugins": [ + ["@babel/plugin-proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^" }] + ] +} +``` For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `%` topic token: @@ -331,6 +340,16 @@ require("@babel/core").transformSync("code", { }); ``` +For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `^` topic token: + +```javascript +require("@babel/core").transformSync("code", { + plugins: [ + [ "@babel/plugin-proposal-pipeline-operator", { proposal: "hack", topicToken: "^" } ], + ], +}); +``` + For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `%` topic token: ```javascript From f1af94994eaae54e222ede72fac5bc597ab0cd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=C2=A0S=2E=C2=A0Choi?= Date: Fri, 22 Oct 2021 22:54:49 -0400 Subject: [PATCH 2/2] pipe operator: Change topic examples back to `%` See tc39/proposal-pipeline-operator#250. --- docs/plugin-proposal-pipeline-operator.md | 40 +++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/plugin-proposal-pipeline-operator.md b/docs/plugin-proposal-pipeline-operator.md index 98a1ac5f74..de409bded7 100644 --- a/docs/plugin-proposal-pipeline-operator.md +++ b/docs/plugin-proposal-pipeline-operator.md @@ -22,7 +22,7 @@ Configure which proposal to use with the required `"proposal"` option. | `"hack"` | [Hack-style pipes](https://github.com/js-choi/proposal-hack-pipes) | `v7.15.0` | ~~`"smart"`~~ | [Smart-mix pipes](https://github.com/js-choi/proposal-smart-pipelines) (deprecated) | `v7.3.0` -If `"proposal": "hack"` is used, then a `"topicToken": "^"`, `"topicToken": "%"`, or `"topicToken": "#"` option must also be included. +If `"proposal": "hack"` is used, then a `"topicToken": "%"`, `"topicToken": "^"`, or `"topicToken": "#"` option must also be included. The `"proposal": "smart"` option is deprecated and subject to removal in a future major version. @@ -46,7 +46,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -[Hack pipes](https://github.com/js-choi/proposal-hack-pipes/)
`{proposal: "hack",`
`topicToken: "^"}` +[Hack pipes](https://github.com/js-choi/proposal-hack-pipes/)
`{proposal: "hack",`
`topicToken: "%"}` @@ -70,7 +70,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> o.m(^)` +`x |> o.m(%)` @@ -92,7 +92,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> o.m(0, ^)` +`x |> o.m(0, %)` @@ -114,7 +114,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> new o.m(^)` +`x |> new o.m(%)` @@ -136,7 +136,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> o[^]` +`x |> o[%]` @@ -158,7 +158,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> ^[i]` +`x |> %[i]` @@ -180,7 +180,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> ^ + 1` +`x |> % + 1` @@ -202,7 +202,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> [0, ^]` +`x |> [0, %]` @@ -224,7 +224,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> { key: ^ }` +`x |> { key: % }` @@ -242,7 +242,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an -`x |> await o.m(^)` +`x |> await o.m(%)` @@ -256,7 +256,7 @@ When TC39 accepts one of the proposals, that proposal will become the default an Not supported -`x |> (yield o.m(^))` +`x |> (yield o.m(%))` @@ -284,22 +284,22 @@ For [F# pipes with `await`](https://github.com/valtech-nyc/proposal-fsharp-pipel ] } ``` -For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `^` topic token: +For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `%` topic token: ```json { "plugins": [ - ["@babel/plugin-proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^" }] + ["@babel/plugin-proposal-pipeline-operator", { "proposal": "hack", "topicToken": "%" }] ] } ``` -For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `%` topic token: +For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `^` topic token: ```json { "plugins": [ - ["@babel/plugin-proposal-pipeline-operator", { "proposal": "hack", "topicToken": "%" }] + ["@babel/plugin-proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^" }] ] } ``` @@ -340,22 +340,22 @@ require("@babel/core").transformSync("code", { }); ``` -For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `^` topic token: +For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `%` topic token: ```javascript require("@babel/core").transformSync("code", { plugins: [ - [ "@babel/plugin-proposal-pipeline-operator", { proposal: "hack", topicToken: "^" } ], + [ "@babel/plugin-proposal-pipeline-operator", { proposal: "hack", topicToken: "%" } ], ], }); ``` -For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `%` topic token: +For [Hack pipes](https://github.com/js-choi/proposal-hack-pipes/) with `^` topic token: ```javascript require("@babel/core").transformSync("code", { plugins: [ - [ "@babel/plugin-proposal-pipeline-operator", { proposal: "hack", topicToken: "%" } ], + [ "@babel/plugin-proposal-pipeline-operator", { proposal: "hack", topicToken: "^" } ], ], }); ```