babel-preset-expo 57.0.13 → 57.0.15
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/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NodePath, types as t } from '@babel/core';
|
|
2
2
|
/** Determine which bundler is being used. */
|
|
3
|
-
export declare function getBundler(caller?: any):
|
|
3
|
+
export declare function getBundler(caller?: any): 'metro' | 'webpack' | 'jest' | null;
|
|
4
4
|
export declare function getPlatform(caller?: any): string | null;
|
|
5
5
|
export declare function getEngine(caller?: any): 'hermes' | 'default' | (string & {});
|
|
6
6
|
export declare function getPossibleProjectRoot(caller?: any): string | null | undefined;
|
package/build/configs/expo.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface ExpoConfigOptions {
|
|
|
12
12
|
isReactCompilerEnabled: boolean;
|
|
13
13
|
isModernEngine: boolean;
|
|
14
14
|
baseUrl: string;
|
|
15
|
-
bundler: 'metro' | 'webpack' | null;
|
|
15
|
+
bundler: 'metro' | 'webpack' | 'jest' | null;
|
|
16
16
|
inlineEnvironmentVariables?: boolean;
|
|
17
17
|
lazyDecorators: LazyDecoratorsOptions;
|
|
18
18
|
reanimated: boolean | undefined;
|
|
@@ -2,25 +2,35 @@
|
|
|
2
2
|
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.expoImportMetaTransformPluginFactory = expoImportMetaTransformPluginFactory;
|
|
5
|
+
const node_url_1 = require("node:url");
|
|
5
6
|
const common_1 = require("../common");
|
|
6
7
|
function expoImportMetaTransformPluginFactory(pluginEnabled) {
|
|
7
8
|
return (api) => {
|
|
8
9
|
const { types: t } = api;
|
|
9
10
|
const platform = api.caller(common_1.getPlatform);
|
|
11
|
+
const bundler = api.caller(common_1.getBundler);
|
|
10
12
|
return {
|
|
11
13
|
name: 'expo-import-meta-transform',
|
|
12
14
|
visitor: {
|
|
13
|
-
MetaProperty(path) {
|
|
15
|
+
MetaProperty(path, state) {
|
|
14
16
|
const { node } = path;
|
|
15
17
|
if (node.meta.name === 'import' && node.property.name === 'meta') {
|
|
16
|
-
if (
|
|
18
|
+
if (bundler === 'jest') {
|
|
19
|
+
// NOTE(@kitten): Jest runs each file in Node, so `import.meta.url` can be the module's own file URL.
|
|
20
|
+
const { filename } = state.file.opts;
|
|
21
|
+
path.replaceWith(t.objectExpression([
|
|
22
|
+
t.objectProperty(t.identifier('url'), filename ? t.stringLiteral((0, node_url_1.pathToFileURL)(filename).href) : t.nullLiteral()),
|
|
23
|
+
]));
|
|
24
|
+
}
|
|
25
|
+
else if (!pluginEnabled) {
|
|
17
26
|
if (platform !== 'web') {
|
|
18
27
|
throw path.buildCodeFrameError('`import.meta` is not supported in Hermes. Enable the polyfill `transformImportMeta` in babel-preset-expo to use this syntax.');
|
|
19
28
|
}
|
|
20
|
-
return;
|
|
21
29
|
}
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
else {
|
|
31
|
+
const replacement = t.memberExpression(t.identifier('globalThis'), t.identifier('__ExpoImportMetaRegistry'));
|
|
32
|
+
path.replaceWith(replacement);
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
35
|
},
|
|
26
36
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-meta-transform-plugin.js","sourceRoot":"","sources":["../../src/plugins/import-meta-transform-plugin.ts"],"names":[],"mappings":";AAAA,8DAA8D;;
|
|
1
|
+
{"version":3,"file":"import-meta-transform-plugin.js","sourceRoot":"","sources":["../../src/plugins/import-meta-transform-plugin.ts"],"names":[],"mappings":";AAAA,8DAA8D;;AAO9D,oFAyCC;AA7CD,uCAAyC;AAEzC,sCAAoD;AAEpD,SAAgB,oCAAoC,CAAC,aAAsB;IACzE,OAAO,CAAC,GAA6C,EAAa,EAAE;QAClE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,GAAG,CAAC;QACzB,M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CAAC;gBACH,CAAC;aACF;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "57.0.
|
|
3
|
+
"version": "57.0.15",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@babel/runtime": "^7.20.0",
|
|
35
35
|
"expo": "*",
|
|
36
|
-
"expo-widgets": "^57.0.
|
|
36
|
+
"expo-widgets": "^57.0.24",
|
|
37
37
|
"react-refresh": ">=0.14.0 <1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
@@ -101,12 +101,12 @@
|
|
|
101
101
|
"jest": "^29.2.1",
|
|
102
102
|
"react-refresh": "^0.14.2",
|
|
103
103
|
"resolve-from": "^5.0.0",
|
|
104
|
-
"@expo/metro-config": "57.0.
|
|
105
|
-
"expo-splash-screen": "57.0.9",
|
|
104
|
+
"@expo/metro-config": "57.0.13",
|
|
106
105
|
"expo-module-scripts": "56.0.3",
|
|
107
|
-
"expo": "57.0.
|
|
106
|
+
"expo-splash-screen": "57.0.10",
|
|
107
|
+
"expo": "57.0.28"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "58da4edafcb043872c3ed9bf8f5957e6544d0a9c",
|
|
110
110
|
"scripts": {
|
|
111
111
|
"build": "expo-module build",
|
|
112
112
|
"clean": "expo-module clean",
|