babel-preset-expo 14.0.3 → 14.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/build/common.d.ts +1 -0
- package/build/common.js +20 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +5 -12
- package/build/web-preset.js +4 -3
- package/package.json +8 -4
package/build/common.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare function getBaseUrl(caller?: any): string;
|
|
|
14
14
|
export declare function getReactCompiler(caller?: any): boolean;
|
|
15
15
|
export declare function getIsServer(caller?: any): boolean;
|
|
16
16
|
export declare function getMetroSourceType(caller?: any): "script" | "module" | "asset" | undefined;
|
|
17
|
+
export declare function getBabelRuntimeVersion(caller?: any): string;
|
|
17
18
|
export declare function getExpoRouterAbsoluteAppRoot(caller?: any): string;
|
|
18
19
|
export declare function getInlineEnvVarsEnabled(caller?: any): boolean;
|
|
19
20
|
export declare function getAsyncRoutes(caller?: any): boolean;
|
package/build/common.js
CHANGED
|
@@ -16,6 +16,7 @@ exports.getBaseUrl = getBaseUrl;
|
|
|
16
16
|
exports.getReactCompiler = getReactCompiler;
|
|
17
17
|
exports.getIsServer = getIsServer;
|
|
18
18
|
exports.getMetroSourceType = getMetroSourceType;
|
|
19
|
+
exports.getBabelRuntimeVersion = getBabelRuntimeVersion;
|
|
19
20
|
exports.getExpoRouterAbsoluteAppRoot = getExpoRouterAbsoluteAppRoot;
|
|
20
21
|
exports.getInlineEnvVarsEnabled = getInlineEnvVarsEnabled;
|
|
21
22
|
exports.getAsyncRoutes = getAsyncRoutes;
|
|
@@ -119,6 +120,25 @@ function getMetroSourceType(caller) {
|
|
|
119
120
|
assertExpoBabelCaller(caller);
|
|
120
121
|
return caller?.metroSourceType;
|
|
121
122
|
}
|
|
123
|
+
function getBabelRuntimeVersion(caller) {
|
|
124
|
+
assertExpoBabelCaller(caller);
|
|
125
|
+
let babelRuntimeVersion;
|
|
126
|
+
if (typeof caller?.babelRuntimeVersion === 'string') {
|
|
127
|
+
babelRuntimeVersion = caller.babelRuntimeVersion;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
try {
|
|
131
|
+
babelRuntimeVersion = require('@babel/runtime/package.json').version;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (error.code !== 'MODULE_NOT_FOUND')
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// NOTE(@kitten): The default shouldn't be higher than `expo/package.json`'s `@babel/runtime` version
|
|
139
|
+
// or `babel-preset-expo/package.json`'s peer dependency range for `@babel/runtime`
|
|
140
|
+
return babelRuntimeVersion ?? '^7.20.0';
|
|
141
|
+
}
|
|
122
142
|
function getExpoRouterAbsoluteAppRoot(caller) {
|
|
123
143
|
assertExpoBabelCaller(caller);
|
|
124
144
|
const rootModuleId = caller?.routerRoot ?? './app';
|
package/build/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ type BabelPresetExpoPlatformOptions = {
|
|
|
21
21
|
disableImportExportTransform?: boolean;
|
|
22
22
|
disableDeepImportWarnings?: boolean;
|
|
23
23
|
disableFlowStripTypesTransform?: boolean;
|
|
24
|
-
enableBabelRuntime?: boolean;
|
|
24
|
+
enableBabelRuntime?: boolean | string;
|
|
25
25
|
unstable_transformProfile?: 'default' | 'hermes-stable' | 'hermes-canary';
|
|
26
26
|
/** Settings to pass to `babel-plugin-react-compiler`. Set as `false` to disable the plugin. */
|
|
27
27
|
'react-compiler'?: false | {
|
package/build/index.js
CHANGED
|
@@ -11,14 +11,6 @@ const lazyImports_1 = require("./lazyImports");
|
|
|
11
11
|
const restricted_react_api_plugin_1 = require("./restricted-react-api-plugin");
|
|
12
12
|
const server_actions_plugin_1 = require("./server-actions-plugin");
|
|
13
13
|
const use_dom_directive_plugin_1 = require("./use-dom-directive-plugin");
|
|
14
|
-
// NOTE(@kitten): This shouldn't be higher than `expo/package.json`'s `@babel/runtime` version
|
|
15
|
-
// (the lowest version constraint we have).
|
|
16
|
-
// TODO(@kitten): This is a hotfix! In theory, we should pass an absolute runtime path
|
|
17
|
-
// and skip the internal resolution, which would mean we'd be able to guarantee a version here,
|
|
18
|
-
// but for now, we don't
|
|
19
|
-
// WARN: This does not reproduce in the expo/expo monorepo and we're not sure why. If you're changing this, run `expo export -p android` against this reproduction:
|
|
20
|
-
// - https://github.com/kitten/expo-bug-nested-async-generator-function-repro
|
|
21
|
-
const BABEL_RUNTIME_RANGE = '^7.20.0';
|
|
22
14
|
function getOptions(options, platform) {
|
|
23
15
|
const tag = platform === 'web' ? 'web' : 'native';
|
|
24
16
|
return {
|
|
@@ -207,10 +199,11 @@ function babelPresetExpo(api, options = {}) {
|
|
|
207
199
|
const presetOpts = {
|
|
208
200
|
// Defaults to undefined, set to `true` to disable `@babel/plugin-transform-flow-strip-types`
|
|
209
201
|
disableFlowStripTypesTransform: platformOptions.disableFlowStripTypesTransform,
|
|
210
|
-
// Defaults to
|
|
211
|
-
//
|
|
212
|
-
enableBabelRuntime: platformOptions.enableBabelRuntime
|
|
213
|
-
|
|
202
|
+
// Defaults to Babel caller's `babelRuntimeVersion` or the version of `@babel/runtime` for this package's peer
|
|
203
|
+
// Set to `false` to disable `@babel/plugin-transform-runtime`
|
|
204
|
+
enableBabelRuntime: platformOptions.enableBabelRuntime == null ||
|
|
205
|
+
platformOptions.enableBabelRuntime === true
|
|
206
|
+
? (0, common_1.getBabelRuntimeVersion)()
|
|
214
207
|
: platformOptions.enableBabelRuntime,
|
|
215
208
|
// This reduces the amount of transforms required, as Hermes supports many modern language features.
|
|
216
209
|
unstable_transformProfile: platformOptions.unstable_transformProfile,
|
package/build/web-preset.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* https://github.com/facebook/react-native/blob/2af1da42ff517232f1309efed7565fe9ddbbac77/packages/react-native-babel-preset/src/configs/main.js#L1
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
const common_1 = require("./common");
|
|
13
14
|
// use `this.foo = bar` instead of `this.defineProperty('foo', ...)`
|
|
14
15
|
const loose = true;
|
|
15
16
|
const defaultPlugins = [
|
|
@@ -38,14 +39,14 @@ module.exports = function (babel, options) {
|
|
|
38
39
|
]);
|
|
39
40
|
}
|
|
40
41
|
if (!options || options.enableBabelRuntime !== false) {
|
|
41
|
-
// Allows configuring a specific runtime version to optimize output
|
|
42
|
-
const isVersion = typeof options?.enableBabelRuntime === 'string';
|
|
43
42
|
extraPlugins.push([
|
|
44
43
|
require('@babel/plugin-transform-runtime'),
|
|
45
44
|
{
|
|
46
45
|
helpers: true,
|
|
47
46
|
regenerator: false,
|
|
48
|
-
|
|
47
|
+
enableBabelRuntime: options.enableBabelRuntime == null || options.enableBabelRuntime === true
|
|
48
|
+
? (0, common_1.getBabelRuntimeVersion)()
|
|
49
|
+
: options.enableBabelRuntime,
|
|
49
50
|
},
|
|
50
51
|
]);
|
|
51
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.4",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -41,10 +41,14 @@
|
|
|
41
41
|
"extends": "universe/node"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
+
"@babel/runtime": "^7.20.0",
|
|
44
45
|
"react-refresh": ">=0.14.0 <1.0.0",
|
|
45
46
|
"expo": "*"
|
|
46
47
|
},
|
|
47
48
|
"peerDependenciesMeta": {
|
|
49
|
+
"@babel/runtime": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
48
52
|
"expo": {
|
|
49
53
|
"optional": true
|
|
50
54
|
}
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
"@babel/plugin-transform-parameters": "^7.24.7",
|
|
66
70
|
"@babel/preset-react": "^7.22.15",
|
|
67
71
|
"@babel/preset-typescript": "^7.23.0",
|
|
68
|
-
"@react-native/babel-preset": "0.81.
|
|
72
|
+
"@react-native/babel-preset": "0.81.1",
|
|
69
73
|
"babel-plugin-react-compiler": "^19.1.0-rc.2",
|
|
70
74
|
"babel-plugin-react-native-web": "~0.21.0",
|
|
71
75
|
"babel-plugin-transform-flow-enums": "^0.0.2",
|
|
@@ -77,9 +81,9 @@
|
|
|
77
81
|
"@babel/core": "^7.26.0",
|
|
78
82
|
"@types/babel__core": "^7.20.5",
|
|
79
83
|
"@expo/metro": "~0.1.1",
|
|
80
|
-
"expo-module-scripts": "^5.0.
|
|
84
|
+
"expo-module-scripts": "^5.0.4",
|
|
81
85
|
"jest": "^29.2.1",
|
|
82
86
|
"react-refresh": "^0.14.2"
|
|
83
87
|
},
|
|
84
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "48faa7b9a9f93a7660cb80aa118c7f6bf0aeff38"
|
|
85
89
|
}
|