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

docs(en): merge website/main into babeljs.cn/cn-v7 @ 85c50ccf #196

Open
wants to merge 5 commits into
base: cn-v7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/plugin-bugfix-firefox-class-in-computed-class-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
id: babel-plugin-bugfix-firefox-class-in-computed-class-key
title: "@babel/plugin-bugfix-firefox-class-in-computed-class-key"
sidebar_label: bugfix-firefox-class-in-computed-class-key
---

This bugfix plugin transforms classes inside computed keys of other classes to workaround a [SpiderMonkey bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1887677) with private class elements.

:::tip
This plugin is included in `@babel/preset-env`, and Babel will automatically enable this plugin for you when your `targets` are affected by the browser bug.
:::

:::warning
Terser versions older than 5.30.2 will undo the transform done by this plugin. Make sure to use at least version 5.30.2, or set the Terser's [`compress.inline`](https://terser.org/docs/options/#compress-options) option to `false`.
:::

## Installation

```shell npm2yarn
npm install --save-dev @babel/plugin-bugfix-firefox-class-in-computed-class-key
```

## Usage

### With a configuration file (Recommended)

```json title="babel.config.json"
{
"plugins": ["@babel/plugin-bugfix-firefox-class-in-computed-class-key"]
}
```

### Via CLI

```sh title="Shell"
babel --plugins @babel/plugin-bugfix-firefox-class-in-computed-class-key script.js
```

### Via Node API

```js title="JavaScript"
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-bugfix-firefox-class-in-computed-class-key"],
});
```
10 changes: 6 additions & 4 deletions docs/plugin-proposal-optional-chaining-assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ npm install --save-dev @babel/plugin-proposal-optional-chaining-assign
```json title="babel.config.json"
{
"plugins": [
"@babel/plugin-proposal-optional-chaining-assign",
{
"version": "2023-07"
}
[
"@babel/plugin-proposal-optional-chaining-assign",
{
"version": "2023-07"
}
]
]
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/preset-typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Added in: `v7.23.0`

When set to `true`, Babel will rewrite `.ts`/`.mts`/`.cts` extensions in import declarations to `.js`/`.mjs`/`.cjs`.

This option, when used together with TypeScript's [`allowImportingTsExtension`](https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions) option, allows to write complete relative specifiers in import declaratoinss while using the same extension used by the source files.
This option, when used together with TypeScript's [`allowImportingTsExtension`](https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions) option, allows to write complete relative specifiers in import declarations while using the same extension used by the source files.

As an example, given this project structure (where `src` contains the source files, and `dist` the compiled files):
```
Expand Down
4 changes: 4 additions & 0 deletions website/data/tools/node/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ require("@babel/core").transform("code", {

<blockquote class="alert alert--info">
<p>
<<<<<<< HEAD
关于 Babel 的完整 API 文档请查阅<a href="/docs/usage/api/">使用文档</a>。
=======
Explore the <a href="/docs/babel-core">@babel/core documentation</a> for the full API.
>>>>>>> 85c50ccf2bb460f155f0e51140af3c726285a67a
</p>
</blockquote>
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ module.exports = {
type: "category",
label: "Bugfix",
items: [
"babel-plugin-bugfix-firefox-class-in-computed-class-key",
"babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression",
"babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining",
],
Expand Down
Loading