babel-preset-expo 13.3.0-canary-20250729-d8899ae → 14.0.0
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/expo-inline-manifest-plugin.js +42 -13
- package/build/index.js +12 -1
- package/package.json +19 -8
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expoInlineManifestPlugin = expoInlineManifestPlugin;
|
|
4
|
-
const config_1 = require("expo/config");
|
|
5
4
|
const common_1 = require("./common");
|
|
6
5
|
const debug = require('debug')('expo:babel:inline-manifest');
|
|
7
6
|
// Convert expo value to PWA value
|
|
@@ -29,18 +28,19 @@ const RESTRICTED_MANIFEST_FIELDS = [
|
|
|
29
28
|
'assetBundlePatterns',
|
|
30
29
|
];
|
|
31
30
|
function getExpoConstantsManifest(projectRoot) {
|
|
32
|
-
const
|
|
33
|
-
|
|
31
|
+
const config = getConfigMemo(projectRoot);
|
|
32
|
+
if (!config)
|
|
33
|
+
return null;
|
|
34
|
+
const manifest = applyWebDefaults(config);
|
|
34
35
|
for (const field of RESTRICTED_MANIFEST_FIELDS) {
|
|
35
36
|
delete manifest[field];
|
|
36
37
|
}
|
|
37
38
|
return manifest;
|
|
38
39
|
}
|
|
39
|
-
function applyWebDefaults(
|
|
40
|
+
function applyWebDefaults({ config, appName, webName }) {
|
|
41
|
+
const appJSON = config.exp;
|
|
40
42
|
// For RN CLI support
|
|
41
43
|
const { web: webManifest = {}, splash = {}, ios = {}, android = {} } = appJSON;
|
|
42
|
-
// rn-cli apps use a displayName value as well.
|
|
43
|
-
const { appName, webName } = (0, config_1.getNameFromConfig)(appJSON);
|
|
44
44
|
const languageISOCode = webManifest.lang;
|
|
45
45
|
const primaryColor = appJSON.primaryColor;
|
|
46
46
|
const description = appJSON.description;
|
|
@@ -97,18 +97,45 @@ function getExpoAppManifest(projectRoot) {
|
|
|
97
97
|
return process.env.APP_MANIFEST;
|
|
98
98
|
}
|
|
99
99
|
const exp = getExpoConstantsManifest(projectRoot);
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
if (exp) {
|
|
101
|
+
debug('public manifest', exp);
|
|
102
|
+
return JSON.stringify(exp);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
debug('public manifest is null. `expo/config` is not available');
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
|
-
let
|
|
109
|
+
let configMemo;
|
|
104
110
|
function getConfigMemo(projectRoot) {
|
|
105
|
-
if (
|
|
106
|
-
|
|
111
|
+
if (configMemo === undefined) {
|
|
112
|
+
let expoConfig;
|
|
113
|
+
try {
|
|
114
|
+
// This is an optional dependency. In practice, it will resolve in all Expo projects/apps
|
|
115
|
+
// since `expo` is a direct dependency in those. If `babel-preset-expo` is used independently
|
|
116
|
+
// this will fail and we won't return a config
|
|
117
|
+
expoConfig = require('expo/config');
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if ('code' in error && error.code === 'MODULE_NOT_FOUND') {
|
|
121
|
+
return (configMemo = null);
|
|
122
|
+
}
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
const { getConfig, getNameFromConfig } = expoConfig;
|
|
126
|
+
const config = getConfig(projectRoot, {
|
|
107
127
|
isPublicConfig: true,
|
|
108
128
|
skipSDKVersionRequirement: true,
|
|
109
129
|
});
|
|
130
|
+
// rn-cli apps use a displayName value as well.
|
|
131
|
+
const { appName, webName } = getNameFromConfig(config.exp);
|
|
132
|
+
configMemo = {
|
|
133
|
+
config,
|
|
134
|
+
appName,
|
|
135
|
+
webName,
|
|
136
|
+
};
|
|
110
137
|
}
|
|
111
|
-
return
|
|
138
|
+
return configMemo;
|
|
112
139
|
}
|
|
113
140
|
// Convert `process.env.APP_MANIFEST` to a modified web-specific variation of the app.json public manifest.
|
|
114
141
|
function expoInlineManifestPlugin(api) {
|
|
@@ -142,7 +169,9 @@ function expoInlineManifestPlugin(api) {
|
|
|
142
169
|
}) &&
|
|
143
170
|
!parent.parentPath.isAssignmentExpression()) {
|
|
144
171
|
const manifest = getExpoAppManifest(projectRoot);
|
|
145
|
-
|
|
172
|
+
if (manifest !== null) {
|
|
173
|
+
parent.replaceWith(t.stringLiteral(manifest));
|
|
174
|
+
}
|
|
146
175
|
}
|
|
147
176
|
},
|
|
148
177
|
},
|
package/build/index.js
CHANGED
|
@@ -11,6 +11,14 @@ 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';
|
|
14
22
|
function getOptions(options, platform) {
|
|
15
23
|
const tag = platform === 'web' ? 'web' : 'native';
|
|
16
24
|
return {
|
|
@@ -200,7 +208,10 @@ function babelPresetExpo(api, options = {}) {
|
|
|
200
208
|
// Defaults to undefined, set to `true` to disable `@babel/plugin-transform-flow-strip-types`
|
|
201
209
|
disableFlowStripTypesTransform: platformOptions.disableFlowStripTypesTransform,
|
|
202
210
|
// Defaults to undefined, set to `false` to disable `@babel/plugin-transform-runtime`
|
|
203
|
-
|
|
211
|
+
// Passed on unchanged in most cases, except when `true` where we pass `BABEL_RUNTIME_RANGE` to avoid the 7.0.0-beta.0 default
|
|
212
|
+
enableBabelRuntime: platformOptions.enableBabelRuntime === true
|
|
213
|
+
? BABEL_RUNTIME_RANGE
|
|
214
|
+
: platformOptions.enableBabelRuntime,
|
|
204
215
|
// This reduces the amount of transforms required, as Hermes supports many modern language features.
|
|
205
216
|
unstable_transformProfile: platformOptions.unstable_transformProfile,
|
|
206
217
|
// Set true to disable `@babel/plugin-transform-react-jsx` and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -40,6 +40,15 @@
|
|
|
40
40
|
"eslintConfig": {
|
|
41
41
|
"extends": "universe/node"
|
|
42
42
|
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react-refresh": ">=0.14.0 <1.0.0",
|
|
45
|
+
"expo": "*"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"expo": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
43
52
|
"dependencies": {
|
|
44
53
|
"@babel/helper-module-imports": "^7.25.9",
|
|
45
54
|
"@babel/plugin-proposal-decorators": "^7.12.9",
|
|
@@ -56,19 +65,21 @@
|
|
|
56
65
|
"@babel/plugin-transform-parameters": "^7.24.7",
|
|
57
66
|
"@babel/preset-react": "^7.22.15",
|
|
58
67
|
"@babel/preset-typescript": "^7.23.0",
|
|
59
|
-
"@react-native/babel-preset": "0.
|
|
68
|
+
"@react-native/babel-preset": "0.81.0",
|
|
60
69
|
"babel-plugin-react-compiler": "^19.1.0-rc.2",
|
|
61
|
-
"babel-plugin-react-native-web": "~0.
|
|
70
|
+
"babel-plugin-react-native-web": "~0.21.0",
|
|
62
71
|
"babel-plugin-transform-flow-enums": "^0.0.2",
|
|
63
72
|
"babel-plugin-syntax-hermes-parser": "^0.25.1",
|
|
64
73
|
"debug": "^4.3.4",
|
|
65
|
-
"react-refresh": "^0.14.2",
|
|
66
74
|
"resolve-from": "^5.0.0"
|
|
67
75
|
},
|
|
68
76
|
"devDependencies": {
|
|
77
|
+
"@babel/core": "^7.26.0",
|
|
69
78
|
"@types/babel__core": "^7.20.5",
|
|
70
|
-
"@expo/metro": "~0.1.
|
|
71
|
-
"expo-module-scripts": "
|
|
72
|
-
"jest": "^29.2.1"
|
|
73
|
-
|
|
79
|
+
"@expo/metro": "~0.1.1",
|
|
80
|
+
"expo-module-scripts": "^5.0.0",
|
|
81
|
+
"jest": "^29.2.1",
|
|
82
|
+
"react-refresh": "^0.14.2"
|
|
83
|
+
},
|
|
84
|
+
"gitHead": "cb7062e2c17d1fb09522834aaaac0e19b766df62"
|
|
74
85
|
}
|