babel-preset-expo 12.0.0-preview.3 → 12.0.0-preview.5
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.
|
@@ -7,14 +7,14 @@ const FORBIDDEN_REACT_SERVER_IMPORTS = ['client-only'];
|
|
|
7
7
|
/** Prevent importing certain known imports in given environments. This is for sanity to ensure a module never accidentally gets imported unexpectedly. */
|
|
8
8
|
function environmentRestrictedImportsPlugin(api) {
|
|
9
9
|
const { types: t } = api;
|
|
10
|
-
const
|
|
11
|
-
const forbiddenPackages =
|
|
10
|
+
const isReactServer = api.caller(common_1.getIsReactServer);
|
|
11
|
+
const forbiddenPackages = isReactServer
|
|
12
12
|
? FORBIDDEN_REACT_SERVER_IMPORTS
|
|
13
13
|
: FORBIDDEN_CLIENT_IMPORTS;
|
|
14
14
|
function checkSource(source, path) {
|
|
15
15
|
forbiddenPackages.forEach((forbiddenImport) => {
|
|
16
16
|
if (source === forbiddenImport) {
|
|
17
|
-
if (
|
|
17
|
+
if (isReactServer) {
|
|
18
18
|
throw path.buildCodeFrameError(`Importing '${forbiddenImport}' module is not allowed in a React server bundle. Add the "use client" directive to this file or one of the parent modules to allow importing this module.`);
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
@@ -85,25 +85,16 @@ function expoUseDomDirectivePlugin(api) {
|
|
|
85
85
|
if (isProduction) {
|
|
86
86
|
// MUST MATCH THE EXPORT COMMAND!
|
|
87
87
|
const hash = crypto_1.default.createHash('sha1').update(outputKey).digest('hex');
|
|
88
|
-
const
|
|
89
|
-
if (platform === 'ios') {
|
|
90
|
-
proxyModule.push(`const source = { uri: "${outputName}" };`);
|
|
91
|
-
}
|
|
92
|
-
else if (platform === 'android') {
|
|
93
|
-
proxyModule.push(`const source = { uri: "file:///android_asset/${outputName}" };`);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
throw new Error('production "use dom" directive is not supported yet for platform: ' + platform);
|
|
97
|
-
}
|
|
88
|
+
proxyModule.push(`const filePath = "${hash}.html";`);
|
|
98
89
|
}
|
|
99
90
|
else {
|
|
100
91
|
proxyModule.push(
|
|
101
92
|
// Add the basename to improve the Safari debug preview option.
|
|
102
|
-
`const
|
|
93
|
+
`const filePath = "${fileBasename}?file=" + ${JSON.stringify(outputKey)};`);
|
|
103
94
|
}
|
|
104
95
|
proxyModule.push(`
|
|
105
96
|
export default React.forwardRef((props, ref) => {
|
|
106
|
-
return React.createElement(WebView, { ref, ...props,
|
|
97
|
+
return React.createElement(WebView, { ref, ...props, filePath });
|
|
107
98
|
});`);
|
|
108
99
|
// Removes all imports using babel API, that will disconnect import bindings from the program.
|
|
109
100
|
// plugin-transform-typescript TSX uses the bindings to remove type imports.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "12.0.0-preview.
|
|
3
|
+
"version": "12.0.0-preview.5",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"jest": "^29.2.1",
|
|
71
71
|
"react-compiler-runtime": "^19.0.0-beta-8a03594-20241020"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "d97ae0839fa465cee14e13ca38f3c6c84c124d82"
|
|
74
74
|
}
|