babel-preset-expo 13.1.1 → 13.1.3
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ConfigAPI, types } from '@babel/core';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function expoImportMetaTransformPluginFactory(pluginEnabled: boolean): (api: ConfigAPI & {
|
|
3
3
|
types: typeof types;
|
|
4
|
-
})
|
|
4
|
+
}) => babel.PluginObj;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
path
|
|
15
|
-
|
|
4
|
+
exports.expoImportMetaTransformPluginFactory = expoImportMetaTransformPluginFactory;
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
function expoImportMetaTransformPluginFactory(pluginEnabled) {
|
|
7
|
+
return (api) => {
|
|
8
|
+
const { types: t } = api;
|
|
9
|
+
const platform = api.caller(common_1.getPlatform);
|
|
10
|
+
return {
|
|
11
|
+
name: 'expo-import-meta-transform',
|
|
12
|
+
visitor: {
|
|
13
|
+
MetaProperty(path) {
|
|
14
|
+
const { node } = path;
|
|
15
|
+
if (node.meta.name === 'import' && node.property.name === 'meta') {
|
|
16
|
+
if (!pluginEnabled) {
|
|
17
|
+
if (platform !== 'web') {
|
|
18
|
+
throw path.buildCodeFrameError('`import.meta` is not supported in Hermes. Enable the polyfill `unstable_transformImportMeta` in babel-preset-expo to use this syntax.');
|
|
19
|
+
}
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const replacement = t.memberExpression(t.identifier('globalThis'), t.identifier('__ExpoImportMetaRegistry'));
|
|
23
|
+
path.replaceWith(replacement);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
16
26
|
},
|
|
17
|
-
}
|
|
27
|
+
};
|
|
18
28
|
};
|
|
19
29
|
}
|
package/build/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const common_1 = require("./common");
|
|
|
5
5
|
const environment_restricted_imports_1 = require("./environment-restricted-imports");
|
|
6
6
|
const expo_inline_manifest_plugin_1 = require("./expo-inline-manifest-plugin");
|
|
7
7
|
const expo_router_plugin_1 = require("./expo-router-plugin");
|
|
8
|
+
const import_meta_transform_plugin_1 = require("./import-meta-transform-plugin");
|
|
8
9
|
const inline_env_vars_1 = require("./inline-env-vars");
|
|
9
10
|
const lazyImports_1 = require("./lazyImports");
|
|
10
11
|
const restricted_react_api_plugin_1 = require("./restricted-react-api-plugin");
|
|
@@ -78,8 +79,7 @@ function babelPresetExpo(api, options = {}) {
|
|
|
78
79
|
extraPlugins.push([
|
|
79
80
|
require('babel-plugin-react-compiler'),
|
|
80
81
|
{
|
|
81
|
-
|
|
82
|
-
target: '18',
|
|
82
|
+
target: '19',
|
|
83
83
|
environment: {
|
|
84
84
|
enableResetCacheOnSourceFileChanges: !isProduction,
|
|
85
85
|
...(platformOptions['react-compiler']?.environment ?? {}),
|
|
@@ -181,9 +181,7 @@ function babelPresetExpo(api, options = {}) {
|
|
|
181
181
|
if (platformOptions.disableImportExportTransform) {
|
|
182
182
|
extraPlugins.push([require('./detect-dynamic-exports').detectDynamicExports]);
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
extraPlugins.push(require('./import-meta-transform-plugin').expoImportMetaTransformPlugin);
|
|
186
|
-
}
|
|
184
|
+
extraPlugins.push((0, import_meta_transform_plugin_1.expoImportMetaTransformPluginFactory)(platformOptions.unstable_transformImportMeta === true));
|
|
187
185
|
return {
|
|
188
186
|
presets: [
|
|
189
187
|
(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.3",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -64,25 +64,20 @@
|
|
|
64
64
|
"resolve-from": "^5.0.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"babel-plugin-react-compiler": "^19.0.0-beta-
|
|
68
|
-
"react-compiler-runtime": "^19.0.0-beta-8a03594-20241020"
|
|
67
|
+
"babel-plugin-react-compiler": "^19.0.0-beta-e993439-20250405"
|
|
69
68
|
},
|
|
70
69
|
"peerDependenciesMeta": {
|
|
71
70
|
"babel-plugin-react-compiler": {
|
|
72
71
|
"optional": true
|
|
73
|
-
},
|
|
74
|
-
"react-compiler-runtime": {
|
|
75
|
-
"optional": true
|
|
76
72
|
}
|
|
77
73
|
},
|
|
78
74
|
"devDependencies": {
|
|
79
75
|
"@babel/core": "^7.20.0",
|
|
80
76
|
"@babel/traverse": "^7.9.0",
|
|
81
77
|
"@babel/types": "^7.9.0",
|
|
82
|
-
"babel-plugin-react-compiler": "^19.0.0-beta-
|
|
78
|
+
"babel-plugin-react-compiler": "^19.0.0-beta-e993439-20250405",
|
|
83
79
|
"expo-module-scripts": "^4.1.1",
|
|
84
|
-
"jest": "^29.2.1"
|
|
85
|
-
"react-compiler-runtime": "^19.0.0-beta-8a03594-20241020"
|
|
80
|
+
"jest": "^29.2.1"
|
|
86
81
|
},
|
|
87
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "dd2c7150fd75c56505aa6d3f805c14e255649c5d"
|
|
88
83
|
}
|