babel-preset-react-app-new 0.0.2 → 0.0.4
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.
- package/README.md +6 -6
- package/create.js +4 -9
- package/dependencies.js +2 -2
- package/package.json +16 -15
package/README.md
CHANGED
|
@@ -16,17 +16,17 @@ If you want to use this Babel preset in a project not built with Create React Ap
|
|
|
16
16
|
|
|
17
17
|
First, [install Babel](https://babeljs.io/docs/setup/).
|
|
18
18
|
|
|
19
|
-
Then install babel-preset-react-app.
|
|
19
|
+
Then install babel-preset-react-app-new.
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
npm install babel-preset-react-app --save-dev
|
|
22
|
+
npm install babel-preset-react-app-new --save-dev
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Then create a file named `.babelrc` with following contents in the root folder of your project:
|
|
26
26
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
|
29
|
-
"presets": ["react-app"]
|
|
29
|
+
"presets": ["react-app-new"]
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -38,7 +38,7 @@ Make sure you have a `.flowconfig` file at the root directory. You can also use
|
|
|
38
38
|
|
|
39
39
|
```json
|
|
40
40
|
{
|
|
41
|
-
"presets": [["react-app", { "flow": true, "typescript": false }]]
|
|
41
|
+
"presets": [["react-app-new", { "flow": true, "typescript": false }]]
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -48,7 +48,7 @@ Make sure you have a `tsconfig.json` file at the root directory. You can also us
|
|
|
48
48
|
|
|
49
49
|
```json
|
|
50
50
|
{
|
|
51
|
-
"presets": [["react-app", { "flow": false, "typescript": true }]]
|
|
51
|
+
"presets": [["react-app-new", { "flow": false, "typescript": true }]]
|
|
52
52
|
}
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -58,6 +58,6 @@ Absolute paths are enabled by default for imports. To use relative paths instead
|
|
|
58
58
|
|
|
59
59
|
```
|
|
60
60
|
{
|
|
61
|
-
"presets": [["react-app", { "absoluteRuntime": false }]]
|
|
61
|
+
"presets": [["react-app-new", { "absoluteRuntime": false }]]
|
|
62
62
|
}
|
|
63
63
|
```
|
package/create.js
CHANGED
|
@@ -14,7 +14,7 @@ const validateBoolOption = (name, value, defaultValue) => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
if (typeof value !== 'boolean') {
|
|
17
|
-
throw new Error(`Preset react-app: '${name}' option must be a boolean.`);
|
|
17
|
+
throw new Error(`Preset react-app-new: '${name}' option must be a boolean.`);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
return value;
|
|
@@ -40,7 +40,7 @@ module.exports = function (api, opts, env) {
|
|
|
40
40
|
absoluteRuntimePath = path.dirname(require.resolve('@babel/runtime/package.json'));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
var corejsVerson = '3.
|
|
43
|
+
var corejsVerson = '3.31';
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
46
|
corejsVerson = require('core-js/package.json').version;
|
|
@@ -48,7 +48,7 @@ module.exports = function (api, opts, env) {
|
|
|
48
48
|
|
|
49
49
|
if (!isEnvDevelopment && !isEnvProduction && !isEnvTest) {
|
|
50
50
|
throw new Error(
|
|
51
|
-
'Using `babel-preset-react-app` requires that you specify `NODE_ENV` or ' +
|
|
51
|
+
'Using `babel-preset-react-app-new` requires that you specify `NODE_ENV` or ' +
|
|
52
52
|
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
|
53
53
|
'"test", and "production". Instead, received: ' +
|
|
54
54
|
JSON.stringify(env) +
|
|
@@ -130,8 +130,7 @@ module.exports = function (api, opts, env) {
|
|
|
130
130
|
// ],
|
|
131
131
|
// },
|
|
132
132
|
// ],
|
|
133
|
-
|
|
134
|
-
isTypeScriptEnabled && [require('@babel/plugin-proposal-decorators').default, false],
|
|
133
|
+
[require('@babel/plugin-proposal-decorators').default, { legacy: true }],
|
|
135
134
|
// class { handleClick = () => { } }
|
|
136
135
|
// Enable loose mode to use assignment instead of defineProperty
|
|
137
136
|
// See discussion in https://github.com/facebook/create-react-app/issues/4263
|
|
@@ -193,10 +192,6 @@ module.exports = function (api, opts, env) {
|
|
|
193
192
|
isFlowEnabled && {
|
|
194
193
|
exclude: /\.tsx?$/,
|
|
195
194
|
plugins: [require('@babel/plugin-transform-flow-strip-types').default]
|
|
196
|
-
},
|
|
197
|
-
isTypeScriptEnabled && {
|
|
198
|
-
test: /\.tsx?$/,
|
|
199
|
-
plugins: [[require('@babel/plugin-proposal-decorators').default, { legacy: true }]]
|
|
200
195
|
}
|
|
201
196
|
].filter(Boolean)
|
|
202
197
|
};
|
package/dependencies.js
CHANGED
|
@@ -14,7 +14,7 @@ const validateBoolOption = (name, value, defaultValue) => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
if (typeof value !== 'boolean') {
|
|
17
|
-
throw new Error(`Preset react-app: '${name}' option must be a boolean.`);
|
|
17
|
+
throw new Error(`Preset react-app-new: '${name}' option must be a boolean.`);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
return value;
|
|
@@ -52,7 +52,7 @@ module.exports = function (api, opts) {
|
|
|
52
52
|
|
|
53
53
|
if (!isEnvDevelopment && !isEnvProduction && !isEnvTest) {
|
|
54
54
|
throw new Error(
|
|
55
|
-
'Using `babel-preset-react-app` requires that you specify `NODE_ENV` or ' +
|
|
55
|
+
'Using `babel-preset-react-app-new` requires that you specify `NODE_ENV` or ' +
|
|
56
56
|
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
|
57
57
|
'"test", and "production". Instead, received: ' +
|
|
58
58
|
JSON.stringify(env) +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-react-app-new",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Babel preset used by Create React App",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,20 +21,21 @@
|
|
|
21
21
|
"test.js"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@babel/core": "^7.
|
|
25
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
26
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
27
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.
|
|
28
|
-
"@babel/plugin-proposal-numeric-separator": "^7.
|
|
29
|
-
"@babel/plugin-proposal-optional-chaining": "^7.
|
|
30
|
-
"@babel/plugin-proposal-private-
|
|
31
|
-
"@babel/plugin-
|
|
32
|
-
"@babel/plugin-transform-
|
|
33
|
-
"@babel/plugin-transform-
|
|
34
|
-
"@babel/
|
|
35
|
-
"@babel/preset-
|
|
36
|
-
"@babel/preset-
|
|
37
|
-
"@babel/
|
|
24
|
+
"@babel/core": "^7.22.9",
|
|
25
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
26
|
+
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
27
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
28
|
+
"@babel/plugin-proposal-numeric-separator": "^7.18.6",
|
|
29
|
+
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
30
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
31
|
+
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
32
|
+
"@babel/plugin-transform-flow-strip-types": "^7.22.5",
|
|
33
|
+
"@babel/plugin-transform-react-display-name": "^7.22.5",
|
|
34
|
+
"@babel/plugin-transform-runtime": "^7.22.9",
|
|
35
|
+
"@babel/preset-env": "^7.22.9",
|
|
36
|
+
"@babel/preset-react": "^7.22.5",
|
|
37
|
+
"@babel/preset-typescript": "^7.22.5",
|
|
38
|
+
"@babel/runtime": "^7.22.6",
|
|
38
39
|
"babel-plugin-macros": "^3.1.0",
|
|
39
40
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24"
|
|
40
41
|
}
|