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 @ ecb084b3 #230

Open
wants to merge 60 commits into
base: cn-v7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
629a534
[FIX] broken link (#2883)
houtan-rocky Mar 27, 2024
90125ef
Update plugin-proposal-optional-chaining-assign.md (#2884)
SharakPL Mar 29, 2024
6678bf7
Add docs for bugfix-firefox-class-in-computed-class-key (#2885)
nicolo-ribaudo Apr 3, 2024
85c50cc
Fix typo in preset-typescript.md (#2886)
askoufis Apr 10, 2024
f151f34
Update Babel types docs (#2887)
babel-bot Apr 29, 2024
d75348f
Docs updates for `transform-runtime` cleanup (#2872)
nicolo-ribaudo Apr 29, 2024
014d07f
Bump Babel 8 node.js requirements (#2888)
JLHwung Apr 30, 2024
c375585
Update plugin-transform-typescript.md (#2889)
Dunqing May 11, 2024
b013f24
docs: update Babel/estree ast difference (#2892)
sxzz Jun 1, 2024
9018180
[Babel 8] Migration guide for `extra.shorthand` (#2891)
liuxingbaoyu Jun 3, 2024
13c9277
fix transform-dynamic-import 404 (#2894)
JLHwung Jun 4, 2024
873907a
fix dynamic-import proposal link (#2896)
JLHwung Jun 4, 2024
806e689
docs: typo in plugin-proposal-decorators (#2900)
fi3ework Jun 19, 2024
d8df2be
Document that regexp plugins only handle regexp literals (#2901)
nicolo-ribaudo Jun 20, 2024
449f038
fix(docsearch): better text contrast for active hit (#2905)
Den-dp Jul 6, 2024
4caa527
docs(options.md): clarify `--source-maps` CLI option (#2898)
jedwards1211 Jul 9, 2024
7242463
docs(assumptions): Remove references to `noObjectSuper` & `noUndeclar…
rschristian Jul 9, 2024
cf9d765
Update plugins-list.md (#2909)
JLHwung Jul 9, 2024
2852ab6
Bump ws from 7.5.9 to 7.5.10 (#2910)
dependabot[bot] Jul 9, 2024
f172a96
Bump webpack-dev-middleware from 5.3.3 to 5.3.4 (#2911)
dependabot[bot] Jul 9, 2024
ba5ca18
Bump braces from 3.0.2 to 3.0.3 (#2912)
dependabot[bot] Jul 9, 2024
22b7ea1
Bump ua-parser-js from 0.7.32 to 0.7.38 (#2913)
dependabot[bot] Jul 9, 2024
4f109ed
Bump follow-redirects from 1.15.3 to 1.15.6 (#2914)
dependabot[bot] Jul 9, 2024
3f0e414
Bump tar from 6.1.13 to 6.2.1 (#2917)
dependabot[bot] Jul 9, 2024
c5d1741
Bump semver from 5.7.1 to 5.7.2 (#2916)
dependabot[bot] Jul 9, 2024
8b91f98
Bump express from 4.18.2 to 4.19.2 (#2915)
dependabot[bot] Jul 9, 2024
97be67f
Add migration docs for removing methods starting with `_` (#2918)
liuxingbaoyu Jul 10, 2024
eab1cea
Fix REPL CORS error (#2920)
liuxingbaoyu Jul 15, 2024
90481ce
[Babel 8] Doc for removing some `NodePath` methods (#2924)
liuxingbaoyu Jul 26, 2024
6ea5704
Add duplicate-named-capturing-groups to ES2025 (#2893)
JLHwung Jul 26, 2024
3dd2641
Add docs for plugin-bugfix-safari-class-field-initializer-scope (#2921)
davidtaylorhq Jul 26, 2024
5c02185
Add docs for `uncheckedRequire` option (#2928)
nicolo-ribaudo Jul 26, 2024
05b6483
Add release post for 7.25.0 (#2927)
nicolo-ribaudo Jul 26, 2024
7d5e624
Remove tag from 7.25.0 blog post
nicolo-ribaudo Jul 26, 2024
7ff59f9
The Safari bug is _before_ 16
nicolo-ribaudo Jul 26, 2024
06d451b
add 7.25.0 to past versions (#2929)
JLHwung Jul 26, 2024
86dee74
Update 2024-07-26-7.25.0.md
nicolo-ribaudo Jul 27, 2024
3d3732c
fix(options): fix nested directives usage (#2908)
Armanio Jul 29, 2024
f9eeddd
fix(options): fix plugin / present entries anchors (#2930)
davidlj95 Jul 31, 2024
287e0ad
improve Babel generator docs (#2931)
JLHwung Aug 1, 2024
b3f6ea3
Updated Broken Link Broken Link #2934 (#2936)
Dwij1704 Aug 11, 2024
eccff2f
Add Route4Me sponsor logo (#2938)
nicolo-ribaudo Aug 19, 2024
4cfea29
Migration: min Node.js version for Babel 8 (#2947)
nicolo-ribaudo Sep 4, 2024
9423c66
Add Igalia as a base support sponsor (#2946)
nicolo-ribaudo Sep 4, 2024
4bad02b
[babel 8] Docs for babel/node args order (#2950)
nicolo-ribaudo Sep 6, 2024
b5d8f96
[Babel 8] doc: Remove `decimal` from parser (#2945)
liuxingbaoyu Sep 6, 2024
1c62dd8
[Babel 8] doc: Split `typeParameter` of `TSMappedType` (#2939)
liuxingbaoyu Sep 6, 2024
e159676
Fix codeblock titles (#2960)
JLHwung Sep 12, 2024
7369e6e
Bump webpack from 5.89.0 to 5.94.0 (#2962)
dependabot[bot] Sep 12, 2024
20e7a27
add diff to additionalLanguages (#2963)
JLHwung Sep 13, 2024
61d93d1
Docs for `importAssertions` and `importReflection` removal (#2948)
nicolo-ribaudo Sep 16, 2024
9291421
bump Babel 8 to 8.0.0-alpha.12 (#2961)
JLHwung Sep 17, 2024
ec30c0a
Bump Docusaurus to 3.5 (#2966)
JLHwung Sep 18, 2024
7ac5548
Update parser.md (#2968)
skyclouds2001 Sep 24, 2024
936f390
Fix `annexB` option name (#2972)
JLHwung Oct 2, 2024
c8052c2
Update Babel types docs (#2973)
babel-bot Oct 2, 2024
e9829a4
Add 7.25.0 to features timeline
nicolo-ribaudo Oct 2, 2024
3390b4f
update shipped proposals docs (#2958)
JLHwung Oct 8, 2024
ecb084b
update import assertions compat data (#2979)
JLHwung Oct 9, 2024
03c5927
docs(en): merging all conflicts
docschina-bot Oct 9, 2024
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
38 changes: 22 additions & 16 deletions _redirects
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,23 @@ https://babel.netlify.com/* https://babeljs.io/:splat 301!
/docs/plugins/external-helpers/ /docs/babel-plugin-external-helpers

# Plugins renamed from -proposal- to -transform-
/docs/babel-plugin-proposal-class-static-block /docs/babel-plugin-transform-class-static-block
/docs/babel-plugin-proposal-private-property-in-object /docs/babel-plugin-transform-private-property-in-object
/docs/babel-plugin-proposal-class-properties /docs/babel-plugin-transform-class-properties
/docs/babel-plugin-proposal-private-methods /docs/babel-plugin-transform-private-methods
/docs/babel-plugin-proposal-numeric-separator /docs/babel-plugin-transform-numeric-separator
/docs/babel-plugin-proposal-logical-assignment-operators /docs/babel-plugin-transform-logical-assignment-operators
/docs/babel-plugin-proposal-nullish-coalescing-operator /docs/babel-plugin-transform-nullish-coalescing-operator
/docs/babel-plugin-proposal-optional-chaining /docs/babel-plugin-transform-optional-chaining
/docs/babel-plugin-proposal-json-strings /docs/babel-plugin-transform-json-strings
/docs/babel-plugin-proposal-optional-catch-binding /docs/babel-plugin-transform-optional-catch-binding
/docs/babel-plugin-proposal-async-generator-functions /docs/babel-plugin-transform-async-generator-functions
/docs/babel-plugin-proposal-object-rest-spread /docs/babel-plugin-transform-object-rest-spread
/docs/babel-plugin-proposal-unicode-property-regex /docs/babel-plugin-transform-unicode-property-regex
/docs/babel-plugin-proposal-unicode-sets-regex /docs/babel-plugin-transform-unicode-sets-regex
/docs/babel-plugin-proposal-export-namespace-from /docs/babel-plugin-transform-export-namespace-from
/docs/babel-plugin-proposal-class-static-block /docs/babel-plugin-transform-class-static-block
/docs/babel-plugin-proposal-private-property-in-object /docs/babel-plugin-transform-private-property-in-object
/docs/babel-plugin-proposal-class-properties /docs/babel-plugin-transform-class-properties
/docs/babel-plugin-proposal-private-methods /docs/babel-plugin-transform-private-methods
/docs/babel-plugin-proposal-numeric-separator /docs/babel-plugin-transform-numeric-separator
/docs/babel-plugin-proposal-dynamic-import /docs/babel-plugin-transform-dynamic-import
/docs/babel-plugin-proposal-logical-assignment-operators /docs/babel-plugin-transform-logical-assignment-operators
/docs/babel-plugin-proposal-nullish-coalescing-operator /docs/babel-plugin-transform-nullish-coalescing-operator
/docs/babel-plugin-proposal-optional-chaining /docs/babel-plugin-transform-optional-chaining
/docs/babel-plugin-proposal-json-strings /docs/babel-plugin-transform-json-strings
/docs/babel-plugin-proposal-optional-catch-binding /docs/babel-plugin-transform-optional-catch-binding
/docs/babel-plugin-proposal-async-generator-functions /docs/babel-plugin-transform-async-generator-functions
/docs/babel-plugin-proposal-object-rest-spread /docs/babel-plugin-transform-object-rest-spread
/docs/babel-plugin-proposal-unicode-property-regex /docs/babel-plugin-transform-unicode-property-regex
/docs/babel-plugin-proposal-unicode-sets-regex /docs/babel-plugin-transform-unicode-sets-regex
/docs/babel-plugin-proposal-export-namespace-from /docs/babel-plugin-transform-export-namespace-from
/docs/babel-plugin-proposal-duplicate-named-capturing-groups-regex /docs/babel-plugin-transform-duplicate-named-capturing-groups-regex

# Legacy redirects
/docs/en/babel-plugin-transform-decorators /docs/babel-plugin-proposal-decorators
Expand All @@ -92,8 +94,9 @@ https://babel.netlify.com/* https://babeljs.io/:splat 301!
/docs/en/next/tools/* /setup

# Blog rewrites
/7.25.0 /blog/2024/07/26/7.25.0
/7.24.0 /blog/2024/02/28/7.24.0
/7.23.0 /blog/2023/09/25/7.22.0
/7.23.0 /blog/2023/09/25/7.23.0
/7.22.0 /blog/2023/05/26/7.22.0
/7.21.0 /blog/2023/02/20/7.21.0
/7.20.0 /blog/2022/10/27/7.20.0
Expand Down Expand Up @@ -139,3 +142,6 @@ https://babel.netlify.com/* https://babeljs.io/:splat 301!
# Docusaurus v1 compat

/docs/en/* /docs/:splat

# CircleCI CORS
/circleci/api/* https://circleci.com/api/v1.1/project/github/babel/babel/:splat 200
2 changes: 0 additions & 2 deletions docs/assumptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ class Child extends Parent {
"mutableTemplateObject": true,
"noClassCalls": true,
"noDocumentAll": true,
"noObjectSuper": true,
"noUndeclaredVariablesCheck": true,
"objectRestNoSymbols": true,
"privateFieldsAsProperties": true,
"pureGetters": true,
Expand Down
9 changes: 9 additions & 0 deletions docs/features-timeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ Which major new features did we introduce in each Babel version? This page inclu
Additionally, use this timeline to track some other important efforts, such as the [babel-polyfills](https://github.com/babel/babel-polyfills) project.

<ol class="timeline-container">
<li data-date="Jul 2024">

## Babel 7.25.0

[blog post](https://babeljs.io/blog/2024/07/26/7.25.0)

- Enable the Stage 4 [duplicated named capturing groups](https://github.com/tc39/proposal-duplicate-named-capturing-groups/) proposal by default

</li>
<li data-date="Feb 2024">

## Babel 7.24.0
Expand Down
21 changes: 20 additions & 1 deletion docs/generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: babel-generator
title: "@babel/generator"
---

> Turns an AST into code.
> Turns Babel AST into code.

## Install

Expand Down Expand Up @@ -33,6 +33,25 @@ const output = generate(
The symbols like white spaces or new line characters are not preserved in the AST. When Babel generator prints code from the AST, the output format is not guaranteed.
:::

### Parser plugins support
Babel generator supports all the listed [Babel parser plugins](./parser.md#plugins) except `estree`. Note that parser plugins do not transform the code. For example,
if you pass JSX `<div></div>` to babel generator, the result will still contain the `div` JSX element.

```js title="JavaScript"
import { parse } from "@babel/parser";
import generate from "@babel/generator";

const code = "const Example = () => <div>example</div>";
const ast = parse(code, { plugins: ["jsx" ] });

const output = generate(
ast,
);

// true
output.includes("<div>");
```

## Options

<details>
Expand Down
2 changes: 1 addition & 1 deletion docs/helper-environment-visitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if (path.isMethod()) {

Suppose we are migrating from vanilla JavaScript to ES Modules. Now that the `this` keyword is equivalent to `undefined` at the top level of an ESModule ([spec](https://tc39.es/ecma262/#sec-module-environment-records-getthisbinding)), we want to replace all top-level `this` to [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis):

```js title=input.js
```js title="input.js"
// replace this expression to `globalThis.foo = "top"`
this.foo = "top";

Expand Down
16 changes: 15 additions & 1 deletion docs/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,29 @@ NODE_NO_READLINE=1 rlwrap --always-readline npx babel-node
### Usage

```sh title="Shell"
babel-node [options] [ -e script | script.js ] [arguments]
babel-node [options] [ -e script | [--] script.js ] [arguments]
```

:::babel7

When arguments for user script have names conflicting with node options, double dash placed before script name can be used to resolve ambiguities

```sh title="Shell"
npx babel-node --inspect --presets @babel/preset-env -- script.js --inspect
```

:::

:::babel8

Options for Node.js and Babel must be placed before the file name, while arguments for the script (that will be available as `process.argv`) must be placed after.

```sh title="Shell"
npx babel-node --arg-for-babel script.js --arg-for-script.js
```

:::

### Options

| Option | Default | Description |
Expand Down
11 changes: 6 additions & 5 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ babelrcRoots: [

### `plugins`

Type: `Array<PluginEntry | Plugin>` ([`PluginEntry`](#plugin-preset-entries))<br />
Type: `Array<PluginEntry | Plugin>` ([`PluginEntry`](#pluginpreset-entries))<br />
Default: `[]`<br />

An array of plugins to activate when processing this file. For more information on how
Expand All @@ -295,7 +295,7 @@ representation of a plugin or preset, you should use [`babel.createConfigItem()`

### `presets`

Type: `Array<PresetEntry>` ([`PresetEntry`](#plugin-preset-entries))<br />
Type: `Array<PresetEntry>` ([`PresetEntry`](#pluginpreset-entries))<br />
Default: `[]`<br />

An array of presets to activate when processing this file. For more information on how
Expand Down Expand Up @@ -365,7 +365,7 @@ If a minor version is not specified, Babel will interpret it as `MAJOR.0`. For e

#### No targets

:::babel7
::::babel7

When no targets are specified: Babel will assume you are targeting the oldest browsers possible. For example, `@babel/preset-env` will transform all ES2015-ES2020 code to be ES5 compatible.

Expand All @@ -389,7 +389,7 @@ Because of this, Babel's behavior is different than [browserslist](https://githu

We recognize this isn’t ideal and will be revisiting this in Babel v8.

:::
::::

:::babel8

Expand Down Expand Up @@ -612,7 +612,8 @@ Default: `false`<br />
- `"inline"` to generate a sourcemap and append it as a data URL to the end of the code, but not include it in the result object.
- `"both"` is the same as inline, but will include the map in the result object.

`@babel/cli` overloads some of these to also affect how maps are written to disk:
Options in configuration files have no effect on whether `@babel/cli` writes files separate `.map` files to disk.
When the `--source-maps` CLI option is passed to `@babel/cli` it will also control whether `.map` files are written:

- `true` will write the map to a `.map` file on disk
- `"inline"` will write the file directly, so it will have a `data:` containing the map
Expand Down
Loading
Loading