babel-preset-expo 13.1.2 → 13.1.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.
|
@@ -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");
|
|
@@ -180,9 +181,7 @@ function babelPresetExpo(api, options = {}) {
|
|
|
180
181
|
if (platformOptions.disableImportExportTransform) {
|
|
181
182
|
extraPlugins.push([require('./detect-dynamic-exports').detectDynamicExports]);
|
|
182
183
|
}
|
|
183
|
-
|
|
184
|
-
extraPlugins.push(require('./import-meta-transform-plugin').expoImportMetaTransformPlugin);
|
|
185
|
-
}
|
|
184
|
+
extraPlugins.push((0, import_meta_transform_plugin_1.expoImportMetaTransformPluginFactory)(platformOptions.unstable_transformImportMeta === true));
|
|
186
185
|
return {
|
|
187
186
|
presets: [
|
|
188
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.4",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"@babel/traverse": "^7.9.0",
|
|
77
77
|
"@babel/types": "^7.9.0",
|
|
78
78
|
"babel-plugin-react-compiler": "^19.0.0-beta-e993439-20250405",
|
|
79
|
-
"expo-module-scripts": "^4.1.
|
|
79
|
+
"expo-module-scripts": "^4.1.2",
|
|
80
80
|
"jest": "^29.2.1"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "cb9fdd93f76f28e2ace4f66080b2386d87239553"
|
|
83
83
|
}
|