babel-preset-react-app-new 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +14 -45
  2. package/create.js +0 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,63 +1,32 @@
1
- # babel-preset-react-app
1
+ # babel-preset-react-app-new
2
2
 
3
- This package includes the Babel preset used by [Create React App](https://github.com/facebook/create-react-app).<br>
4
- Please refer to its documentation:
3
+ `babel-preset-react-app-new` 是从官方的 [`babel-preset-react-app`](https://github.com/facebook/create-react-app/tree/main/packages/babel-preset-react-app) **fork** 而来的 Babel 预设配置。它主要用于 `tiger-new` 及其相关生态,或作为独立项目的通用 React Babel 预设。
5
4
 
6
- - [Getting Started](https://facebook.github.io/create-react-app/docs/getting-started) – How to create a new app.
7
- - [User Guide](https://facebook.github.io/create-react-app/) – How to develop apps bootstrapped with Create React App.
5
+ ---
8
6
 
9
- ## Usage in Create React App Projects
7
+ ## tiger-new 项目中的使用
10
8
 
11
- The easiest way to use this configuration is with [Create React App](https://github.com/facebook/create-react-app), which includes it by default. **You don’t need to install it separately in Create React App projects.**
9
+ 如果你使用的是 **`tiger-new` 脚手架创建的项目**,
10
+ **通常不需要手动安装或配置本 preset**。
12
11
 
13
- ## Usage Outside of Create React App
12
+ `tiger-new` 会在内部自动引入并配置 `babel-preset-react-app-new`。
14
13
 
15
- If you want to use this Babel preset in a project not built with Create React App, you can install it with the following steps.
14
+ ---
16
15
 
17
- First, [install Babel](https://babeljs.io/docs/setup/).
16
+ ## 在非 tiger-new 项目中的使用
18
17
 
19
- Then install babel-preset-react-app-new.
18
+ ### 1. 安装 preset
20
19
 
21
20
  ```sh
22
- npm install babel-preset-react-app-new --save-dev
21
+ $ npm install babel-preset-react-app-new --save-dev
23
22
  ```
24
23
 
25
- Then create a file named `.babelrc` with following contents in the root folder of your project:
24
+ ### 2. 配置 Babel
26
25
 
27
- ```json
28
- {
29
- "presets": ["react-app-new"]
30
- }
31
- ```
32
-
33
- This preset uses the `useBuiltIns` option with [transform-object-rest-spread](https://babeljs.io/docs/plugins/transform-object-rest-spread/) and [transform-react-jsx](https://babeljs.io/docs/plugins/transform-react-jsx/), which assumes that `Object.assign` is available or polyfilled.
34
-
35
- ## Usage with Flow
36
-
37
- Make sure you have a `.flowconfig` file at the root directory. You can also use the `flow` option on `.babelrc`:
26
+ 在你的 Babel 配置文件(如 `.babelrc` 或 `babel.config.js`)中,添加 `babel-preset-react-app-new` 作为预设:
38
27
 
39
28
  ```json
40
29
  {
41
- "presets": [["react-app-new", { "flow": true, "typescript": false }]]
42
- }
43
- ```
44
-
45
- ## Usage with TypeScript
46
-
47
- Make sure you have a `tsconfig.json` file at the root directory. You can also use the `typescript` option on `.babelrc`:
48
-
49
- ```json
50
- {
51
- "presets": [["react-app-new", { "flow": false, "typescript": true }]]
52
- }
53
- ```
54
-
55
- ## Absolute Runtime Paths
56
-
57
- Absolute paths are enabled by default for imports. To use relative paths instead, set the `absoluteRuntime` option in `.babelrc` to `false`:
58
-
59
- ```
60
- {
61
- "presets": [["react-app-new", { "absoluteRuntime": false }]]
30
+ "presets": ["react-app-new"]
62
31
  }
63
32
  ```
package/create.js CHANGED
@@ -114,7 +114,6 @@ module.exports = function (api, opts, env) {
114
114
  plugins: [
115
115
  [require('@babel/plugin-proposal-decorators').default, { legacy: true }],
116
116
  [require('@babel/plugin-transform-class-properties').default],
117
- [require('@babel/plugin-transform-private-methods').default],
118
117
  // Polyfills the runtime needed for async/await, generators, and friends
119
118
  // https://babeljs.io/docs/en/babel-plugin-transform-runtime
120
119
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-react-app-new",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Babel preset used by Create React App",
5
5
  "repository": {
6
6
  "type": "git",