babel-preset-react-app-new 1.0.3 → 2.0.1
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/create.js +15 -15
- package/package.json +9 -12
package/create.js
CHANGED
|
@@ -20,6 +20,15 @@ const validateBoolOption = (name, value, defaultValue) => {
|
|
|
20
20
|
return value;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
const hasJsxRuntime = (() => {
|
|
24
|
+
try {
|
|
25
|
+
require.resolve('react/jsx-runtime');
|
|
26
|
+
return true;
|
|
27
|
+
} catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
|
|
23
32
|
module.exports = function (api, opts, env) {
|
|
24
33
|
if (!opts) {
|
|
25
34
|
opts = {};
|
|
@@ -30,7 +39,6 @@ module.exports = function (api, opts, env) {
|
|
|
30
39
|
var isEnvTest = env === 'test';
|
|
31
40
|
|
|
32
41
|
var useESModules = validateBoolOption('useESModules', opts.useESModules, isEnvDevelopment || isEnvProduction);
|
|
33
|
-
var isFlowEnabled = validateBoolOption('flow', opts.flow, true);
|
|
34
42
|
var isTypeScriptEnabled = validateBoolOption('typescript', opts.typescript, true);
|
|
35
43
|
var areHelpersEnabled = validateBoolOption('helpers', opts.helpers, true);
|
|
36
44
|
var useAbsoluteRuntime = validateBoolOption('absoluteRuntime', opts.absoluteRuntime, true);
|
|
@@ -57,6 +65,11 @@ module.exports = function (api, opts, env) {
|
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
return {
|
|
68
|
+
assumptions: {
|
|
69
|
+
setPublicClassFields: true,
|
|
70
|
+
privateFieldsAsProperties: true,
|
|
71
|
+
setPublicClassFields: true
|
|
72
|
+
},
|
|
60
73
|
presets: [
|
|
61
74
|
isEnvTest && [
|
|
62
75
|
// ES features necessary for user's Node version
|
|
@@ -91,26 +104,13 @@ module.exports = function (api, opts, env) {
|
|
|
91
104
|
// Will use the native built-in instead of trying to polyfill
|
|
92
105
|
// behavior for any plugins that require one.
|
|
93
106
|
...(opts.runtime !== 'automatic' ? { useBuiltIns: true } : {}),
|
|
94
|
-
runtime: opts.runtime || 'classic'
|
|
107
|
+
runtime: opts.runtime || (hasJsxRuntime ? 'automatic' : 'classic')
|
|
95
108
|
}
|
|
96
109
|
],
|
|
97
110
|
isTypeScriptEnabled && [require('@babel/preset-typescript').default]
|
|
98
111
|
].filter(Boolean),
|
|
99
112
|
plugins: [
|
|
100
113
|
[require('@babel/plugin-proposal-decorators').default, { legacy: true }],
|
|
101
|
-
[
|
|
102
|
-
require('@babel/plugin-transform-class-properties').default,
|
|
103
|
-
{
|
|
104
|
-
loose: true
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
[require('@babel/plugin-transform-private-methods').default, { loose: true }],
|
|
108
|
-
[
|
|
109
|
-
require('@babel/plugin-proposal-private-property-in-object').default,
|
|
110
|
-
{
|
|
111
|
-
loose: true
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
114
|
// Polyfills the runtime needed for async/await, generators, and friends
|
|
115
115
|
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
|
|
116
116
|
[
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-react-app-new",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Babel preset used by Create React App",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/facebook/create-react-app.git",
|
|
7
|
+
"url": "git+https://github.com/facebook/create-react-app.git",
|
|
8
8
|
"directory": "packages/babel-preset-react-app"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
@@ -21,15 +21,12 @@
|
|
|
21
21
|
"test.js"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@babel/core": "^7.
|
|
25
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
26
|
-
"@babel/plugin-
|
|
27
|
-
"@babel/
|
|
28
|
-
"@babel/
|
|
29
|
-
"@babel/
|
|
30
|
-
"@babel/
|
|
31
|
-
"@babel/preset-react": "^7.24.1",
|
|
32
|
-
"@babel/preset-typescript": "^7.24.1",
|
|
33
|
-
"@babel/runtime": "^7.24.5"
|
|
24
|
+
"@babel/core": "^7.28.5",
|
|
25
|
+
"@babel/plugin-proposal-decorators": "^7.28.0",
|
|
26
|
+
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
27
|
+
"@babel/preset-env": "^7.28.5",
|
|
28
|
+
"@babel/preset-react": "^7.28.5",
|
|
29
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
30
|
+
"@babel/runtime": "^7.28.4"
|
|
34
31
|
}
|
|
35
32
|
}
|