babel-preset-expo 11.1.0-canary-20240904-69100c1 → 11.1.0-canary-20240927-ab8a962
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.
|
@@ -113,14 +113,16 @@ function getConfigMemo(projectRoot) {
|
|
|
113
113
|
// Convert `process.env.APP_MANIFEST` to a modified web-specific variation of the app.json public manifest.
|
|
114
114
|
function expoInlineManifestPlugin(api) {
|
|
115
115
|
const { types: t } = api;
|
|
116
|
+
const isReactServer = api.caller(common_1.getIsReactServer);
|
|
116
117
|
const platform = api.caller(common_1.getPlatform);
|
|
117
118
|
const possibleProjectRoot = api.caller(common_1.getPossibleProjectRoot);
|
|
119
|
+
const shouldInline = platform === 'web' || isReactServer;
|
|
118
120
|
return {
|
|
119
121
|
name: 'expo-inline-manifest-plugin',
|
|
120
122
|
visitor: {
|
|
121
123
|
MemberExpression(path, state) {
|
|
122
|
-
// Web-only feature
|
|
123
|
-
if (
|
|
124
|
+
// Web-only/React Server-only feature: the native manifest is provided dynamically by the client.
|
|
125
|
+
if (!shouldInline) {
|
|
124
126
|
return;
|
|
125
127
|
}
|
|
126
128
|
if (!t.isIdentifier(path.node.object, { name: 'process' }) ||
|
package/build/index.js
CHANGED
|
@@ -148,10 +148,10 @@ function babelPresetExpo(api, options = {}) {
|
|
|
148
148
|
}
|
|
149
149
|
if (platform === 'web') {
|
|
150
150
|
extraPlugins.push(require('babel-plugin-react-native-web'));
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
}
|
|
152
|
+
// Webpack uses the DefinePlugin to provide the manifest to `expo-constants`.
|
|
153
|
+
if (bundler !== 'webpack') {
|
|
154
|
+
extraPlugins.push(expo_inline_manifest_plugin_1.expoInlineManifestPlugin);
|
|
155
155
|
}
|
|
156
156
|
if ((0, common_1.hasModule)('expo-router')) {
|
|
157
157
|
extraPlugins.push(expo_router_plugin_1.expoRouterBabelPlugin);
|
|
@@ -52,8 +52,8 @@ function expoUseDomDirectivePlugin(api) {
|
|
|
52
52
|
}
|
|
53
53
|
const outputKey = url_1.default.pathToFileURL(filePath).href;
|
|
54
54
|
const proxyModule = [
|
|
55
|
-
`import React from 'react'
|
|
56
|
-
import { WebView } from 'expo/dom/internal';`,
|
|
55
|
+
`import React from 'react';`,
|
|
56
|
+
`import { WebView } from 'expo/dom/internal';`,
|
|
57
57
|
];
|
|
58
58
|
if (isProduction) {
|
|
59
59
|
// MUST MATCH THE EXPORT COMMAND!
|
|
@@ -78,6 +78,16 @@ import { WebView } from 'expo/dom/internal';`,
|
|
|
78
78
|
export default React.forwardRef((props, ref) => {
|
|
79
79
|
return React.createElement(WebView, { ref, ...props, source });
|
|
80
80
|
});`);
|
|
81
|
+
// Removes all imports using babel API, that will disconnect import bindings from the program.
|
|
82
|
+
// plugin-transform-typescript TSX uses the bindings to remove type imports.
|
|
83
|
+
// If the DOM component has `import React from 'react';`,
|
|
84
|
+
// the plugin-transform-typescript treats it as an typed import and removes it.
|
|
85
|
+
// That will futher cause undefined `React` error.
|
|
86
|
+
path.traverse({
|
|
87
|
+
ImportDeclaration(path) {
|
|
88
|
+
path.remove();
|
|
89
|
+
},
|
|
90
|
+
});
|
|
81
91
|
// Clear the body
|
|
82
92
|
path.node.body = [];
|
|
83
93
|
path.node.directives = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "11.1.0-canary-
|
|
3
|
+
"version": "11.1.0-canary-20240927-ab8a962",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@babel/core": "^7.20.0",
|
|
65
65
|
"babel-plugin-react-compiler": "0.0.0-experimental-334f00b-20240725",
|
|
66
|
-
"expo-module-scripts": "3.6.0-canary-
|
|
66
|
+
"expo-module-scripts": "3.6.0-canary-20240927-ab8a962",
|
|
67
67
|
"jest": "^29.2.1"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "ab8a962d2c3dddbda124a6bd88d24475831dae00"
|
|
70
70
|
}
|