Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for decorators 2023-05 #2788

Merged
merged 2 commits into from
May 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions docs/plugin-proposal-decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ npm install --save-dev @babel/plugin-proposal-decorators
```json title="babel.config.json"
{
"plugins": [
["@babel/plugin-proposal-decorators", { "version": "2023-01" }]
["@babel/plugin-proposal-decorators", { "version": "2023-05" }]
]
}
```
Expand All @@ -72,7 +72,7 @@ npm install --save-dev @babel/plugin-proposal-decorators
```js title="JavaScript"
require("@babel/core").transformSync("code", {
plugins: [
["@babel/plugin-proposal-decorators", { version: "2023-01" }],
["@babel/plugin-proposal-decorators", { version: "2023-05" }],
]
});
```
Expand All @@ -84,16 +84,18 @@ require("@babel/core").transformSync("code", {

| Version | Changes |
| --- | --- |
| `v7.22.0` | Added support for `version: "2023-05"` |
| `v7.21.0` | Added support for `version: "2023-01"` |
| `v7.19.0` | Added support for `version: "2022-03"` |
| `v7.17.0` | Added the `version` option with support for `"2021-12"`, `"2018-09"` and `"legacy"` |
</details>

### `version`

`"2023-01"`, `"2022-03"`, `"2021-12"`, `"2018-09"` or `"legacy"`.
`"2023-05"`, `"2023-01"`, `"2022-03"`, `"2021-12"`, `"2018-09"` or `"legacy"`.

Selects the decorators proposal to use:
- `"2023-05"` is the proposal version after the updates that reached consensus in the March and May 2023 TC39 meetings, integrating [these changes](https://github.com/pzuraq/ecma262/compare/e86128e13b63a3c2efc3728f76c8332756752b02...c4465e44d514c6c1dba810487ec2721ccd6b08f9).
- `"2023-01"` is the proposal version after the updates that reached consensus in the January 2023 TC39 meeting, integrating [`pzuraq/ecma262#4`](https://github.com/pzuraq/ecma262/pull/4).
- `"2022-03"` is the proposal version that reached consensus for Stage 3 in the March 2022 TC39 meeting. You can read more about it at [`tc39/proposal-decorators@8ca65c046d`](https://github.com/tc39/proposal-decorators/tree/8ca65c046dd5e9aa3846a1fe5df343a6f7efd9f8).
- `"2021-12"` is the proposal version as it was presented to TC39 in Dec 2021. You can read more about it at [`tc39/proposal-decorators@d6c056fa06`](https://github.com/tc39/proposal-decorators/tree/d6c056fa061646178c34f361bad33d583316dc85).
Expand All @@ -107,7 +109,7 @@ If you specify the `decoratorsBeforeExport` option, `version` defaults to `"2018
### `decoratorsBeforeExport`

This option:
- is disallowed when using `version: "legacy"`, `version: "2022-03"`, or `version: "2023-01"`;
- is disallowed when using `version: "legacy"`, `version: "2022-03"`, `version: "2023-01"`, or `version: "2023-05"`;
- is required when using `version: "2018-09"`;
- is optional and defaults to `false` when using `version: "2021-12"`.

Expand Down Expand Up @@ -155,7 +157,7 @@ If you are already using `@babel/preset-env`, you can safely remove `@babel/plug
"presets": ["@babel/preset-env"],
"plugins": [
- "@babel/plugin-proposal-class-properties",
["@babel/plugin-proposal-decorators", { "version": "2023-01" }]
["@babel/plugin-proposal-decorators", { "version": "2023-05" }]
]
}
```
Expand Down