babel-preset-expo 11.0.0 → 11.0.2
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/client-module-proxy-plugin.js +2 -1
- package/build/common.js +15 -14
- package/build/environment-restricted-imports.js +2 -1
- package/build/expo-inline-manifest-plugin.js +3 -2
- package/build/expo-router-plugin.js +2 -1
- package/build/inline-env-vars.js +2 -1
- package/build/minify-platform-select-plugin.js +1 -1
- package/build/restricted-react-api-plugin.js +2 -1
- package/build/web-preset.js +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.reactClientReferencesPlugin =
|
|
6
|
+
exports.reactClientReferencesPlugin = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Copyright © 2024 650 Industries.
|
|
9
9
|
*/
|
|
@@ -55,3 +55,4 @@ function reactClientReferencesPlugin() {
|
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
exports.reactClientReferencesPlugin = reactClientReferencesPlugin;
|
package/build/common.js
CHANGED
|
@@ -3,20 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.hasModule =
|
|
7
|
-
exports.getBundler = getBundler;
|
|
8
|
-
exports.getPlatform = getPlatform;
|
|
9
|
-
exports.getPossibleProjectRoot = getPossibleProjectRoot;
|
|
10
|
-
exports.getIsReactServer = getIsReactServer;
|
|
11
|
-
exports.getIsDev = getIsDev;
|
|
12
|
-
exports.getIsFastRefreshEnabled = getIsFastRefreshEnabled;
|
|
13
|
-
exports.getIsProd = getIsProd;
|
|
14
|
-
exports.getIsNodeModule = getIsNodeModule;
|
|
15
|
-
exports.getBaseUrl = getBaseUrl;
|
|
16
|
-
exports.getIsServer = getIsServer;
|
|
17
|
-
exports.getExpoRouterAbsoluteAppRoot = getExpoRouterAbsoluteAppRoot;
|
|
18
|
-
exports.getInlineEnvVarsEnabled = getInlineEnvVarsEnabled;
|
|
19
|
-
exports.getAsyncRoutes = getAsyncRoutes;
|
|
6
|
+
exports.getAsyncRoutes = exports.getInlineEnvVarsEnabled = exports.getExpoRouterAbsoluteAppRoot = exports.getIsServer = exports.getBaseUrl = exports.getIsNodeModule = exports.getIsProd = exports.getIsFastRefreshEnabled = exports.getIsDev = exports.getIsReactServer = exports.getPossibleProjectRoot = exports.getPlatform = exports.getBundler = exports.hasModule = void 0;
|
|
20
7
|
const path_1 = __importDefault(require("path"));
|
|
21
8
|
function hasModule(name) {
|
|
22
9
|
try {
|
|
@@ -29,6 +16,7 @@ function hasModule(name) {
|
|
|
29
16
|
throw error;
|
|
30
17
|
}
|
|
31
18
|
}
|
|
19
|
+
exports.hasModule = hasModule;
|
|
32
20
|
/** Determine which bundler is being used. */
|
|
33
21
|
function getBundler(caller) {
|
|
34
22
|
if (!caller)
|
|
@@ -45,6 +33,7 @@ function getBundler(caller) {
|
|
|
45
33
|
// Assume anything else is Metro.
|
|
46
34
|
return 'metro';
|
|
47
35
|
}
|
|
36
|
+
exports.getBundler = getBundler;
|
|
48
37
|
function getPlatform(caller) {
|
|
49
38
|
if (!caller)
|
|
50
39
|
return null;
|
|
@@ -57,6 +46,7 @@ function getPlatform(caller) {
|
|
|
57
46
|
// unknown
|
|
58
47
|
return caller.platform;
|
|
59
48
|
}
|
|
49
|
+
exports.getPlatform = getPlatform;
|
|
60
50
|
function getPossibleProjectRoot(caller) {
|
|
61
51
|
if (!caller)
|
|
62
52
|
return null;
|
|
@@ -65,36 +55,44 @@ function getPossibleProjectRoot(caller) {
|
|
|
65
55
|
// unknown
|
|
66
56
|
return process.env.EXPO_PROJECT_ROOT;
|
|
67
57
|
}
|
|
58
|
+
exports.getPossibleProjectRoot = getPossibleProjectRoot;
|
|
68
59
|
/** If bundling for a react-server target. */
|
|
69
60
|
function getIsReactServer(caller) {
|
|
70
61
|
return caller?.isReactServer ?? false;
|
|
71
62
|
}
|
|
63
|
+
exports.getIsReactServer = getIsReactServer;
|
|
72
64
|
function getIsDev(caller) {
|
|
73
65
|
if (caller?.isDev != null)
|
|
74
66
|
return caller.isDev;
|
|
75
67
|
// https://babeljs.io/docs/options#envname
|
|
76
68
|
return process.env.BABEL_ENV === 'development' || process.env.NODE_ENV === 'development';
|
|
77
69
|
}
|
|
70
|
+
exports.getIsDev = getIsDev;
|
|
78
71
|
function getIsFastRefreshEnabled(caller) {
|
|
79
72
|
if (!caller)
|
|
80
73
|
return false;
|
|
81
74
|
return caller.isHMREnabled && !caller.isServer && !caller.isNodeModule && getIsDev(caller);
|
|
82
75
|
}
|
|
76
|
+
exports.getIsFastRefreshEnabled = getIsFastRefreshEnabled;
|
|
83
77
|
function getIsProd(caller) {
|
|
84
78
|
if (caller?.isDev != null)
|
|
85
79
|
return caller.isDev === false;
|
|
86
80
|
// https://babeljs.io/docs/options#envname
|
|
87
81
|
return process.env.BABEL_ENV === 'production' || process.env.NODE_ENV === 'production';
|
|
88
82
|
}
|
|
83
|
+
exports.getIsProd = getIsProd;
|
|
89
84
|
function getIsNodeModule(caller) {
|
|
90
85
|
return caller?.isNodeModule ?? false;
|
|
91
86
|
}
|
|
87
|
+
exports.getIsNodeModule = getIsNodeModule;
|
|
92
88
|
function getBaseUrl(caller) {
|
|
93
89
|
return caller?.baseUrl ?? '';
|
|
94
90
|
}
|
|
91
|
+
exports.getBaseUrl = getBaseUrl;
|
|
95
92
|
function getIsServer(caller) {
|
|
96
93
|
return caller?.isServer ?? false;
|
|
97
94
|
}
|
|
95
|
+
exports.getIsServer = getIsServer;
|
|
98
96
|
function getExpoRouterAbsoluteAppRoot(caller) {
|
|
99
97
|
const rootModuleId = caller?.routerRoot ?? './app';
|
|
100
98
|
if (path_1.default.isAbsolute(rootModuleId)) {
|
|
@@ -103,6 +101,7 @@ function getExpoRouterAbsoluteAppRoot(caller) {
|
|
|
103
101
|
const projectRoot = getPossibleProjectRoot(caller) || '/';
|
|
104
102
|
return path_1.default.join(projectRoot, rootModuleId);
|
|
105
103
|
}
|
|
104
|
+
exports.getExpoRouterAbsoluteAppRoot = getExpoRouterAbsoluteAppRoot;
|
|
106
105
|
function getInlineEnvVarsEnabled(caller) {
|
|
107
106
|
const isWebpack = getBundler(caller) === 'webpack';
|
|
108
107
|
const isDev = getIsDev(caller);
|
|
@@ -113,6 +112,7 @@ function getInlineEnvVarsEnabled(caller) {
|
|
|
113
112
|
// Servers have env vars left as-is to read from the environment.
|
|
114
113
|
return !isNodeModule && !isWebpack && !isDev && !isServer && !preserveEnvVars;
|
|
115
114
|
}
|
|
115
|
+
exports.getInlineEnvVarsEnabled = getInlineEnvVarsEnabled;
|
|
116
116
|
function getAsyncRoutes(caller) {
|
|
117
117
|
const isServer = getIsServer(caller);
|
|
118
118
|
if (isServer) {
|
|
@@ -125,3 +125,4 @@ function getAsyncRoutes(caller) {
|
|
|
125
125
|
}
|
|
126
126
|
return caller?.asyncRoutes ?? false;
|
|
127
127
|
}
|
|
128
|
+
exports.getAsyncRoutes = getAsyncRoutes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.environmentRestrictedImportsPlugin =
|
|
3
|
+
exports.environmentRestrictedImportsPlugin = void 0;
|
|
4
4
|
const common_1 = require("./common");
|
|
5
5
|
const FORBIDDEN_CLIENT_IMPORTS = ['server-only'];
|
|
6
6
|
const FORBIDDEN_REACT_SERVER_IMPORTS = ['client-only'];
|
|
@@ -58,3 +58,4 @@ function environmentRestrictedImportsPlugin(api) {
|
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
exports.environmentRestrictedImportsPlugin = environmentRestrictedImportsPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.expoInlineManifestPlugin =
|
|
3
|
+
exports.expoInlineManifestPlugin = void 0;
|
|
4
4
|
const config_1 = require("expo/config");
|
|
5
5
|
const common_1 = require("./common");
|
|
6
6
|
const debug = require('debug')('expo:babel:inline-manifest');
|
|
@@ -23,7 +23,7 @@ const RESTRICTED_MANIFEST_FIELDS = [
|
|
|
23
23
|
'android',
|
|
24
24
|
// Hide internal / build values
|
|
25
25
|
'plugins',
|
|
26
|
-
'hooks',
|
|
26
|
+
'hooks',
|
|
27
27
|
'_internal',
|
|
28
28
|
// Remove metro-specific values
|
|
29
29
|
'assetBundlePatterns',
|
|
@@ -146,3 +146,4 @@ function expoInlineManifestPlugin(api) {
|
|
|
146
146
|
},
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
+
exports.expoInlineManifestPlugin = expoInlineManifestPlugin;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.expoRouterBabelPlugin =
|
|
6
|
+
exports.expoRouterBabelPlugin = void 0;
|
|
7
7
|
const core_1 = require("@babel/core");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const resolve_from_1 = __importDefault(require("resolve-from"));
|
|
@@ -78,3 +78,4 @@ function expoRouterBabelPlugin(api) {
|
|
|
78
78
|
},
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
+
exports.expoRouterBabelPlugin = expoRouterBabelPlugin;
|
package/build/inline-env-vars.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.expoInlineEnvVars =
|
|
3
|
+
exports.expoInlineEnvVars = void 0;
|
|
4
4
|
const debug = require('debug')('expo:babel:env-vars');
|
|
5
5
|
function expoInlineEnvVars(api) {
|
|
6
6
|
const { types: t } = api;
|
|
@@ -26,3 +26,4 @@ function expoInlineEnvVars(api) {
|
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
+
exports.expoInlineEnvVars = expoInlineEnvVars;
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.default = minifyPlatformSelectPlugin;
|
|
11
10
|
const core_1 = require("@babel/core");
|
|
12
11
|
function minifyPlatformSelectPlugin({ types: t, }) {
|
|
13
12
|
return {
|
|
@@ -32,6 +31,7 @@ function minifyPlatformSelectPlugin({ types: t, }) {
|
|
|
32
31
|
},
|
|
33
32
|
};
|
|
34
33
|
}
|
|
34
|
+
exports.default = minifyPlatformSelectPlugin;
|
|
35
35
|
function isPlatformSelect(path) {
|
|
36
36
|
return (core_1.types.isMemberExpression(path.node.callee) &&
|
|
37
37
|
core_1.types.isIdentifier(path.node.callee.object) &&
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.environmentRestrictedReactAPIsPlugin =
|
|
3
|
+
exports.environmentRestrictedReactAPIsPlugin = void 0;
|
|
4
4
|
const INVALID_SERVER_REACT_DOM_APIS = [
|
|
5
5
|
'findDOMNode',
|
|
6
6
|
'flushSync',
|
|
@@ -113,3 +113,4 @@ function environmentRestrictedReactAPIsPlugin(api) {
|
|
|
113
113
|
},
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
+
exports.environmentRestrictedReactAPIsPlugin = environmentRestrictedReactAPIsPlugin;
|
package/build/web-preset.js
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = function (babel, options) {
|
|
|
31
31
|
require('@babel/plugin-transform-modules-commonjs'),
|
|
32
32
|
{
|
|
33
33
|
strict: false,
|
|
34
|
-
strictMode: false,
|
|
34
|
+
strictMode: false,
|
|
35
35
|
lazy: options.lazyImportExportTransform,
|
|
36
36
|
allowTopLevelThis: true, // dont rewrite global `this` -> `undefined`
|
|
37
37
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@babel/plugin-transform-parameters": "^7.22.15",
|
|
48
48
|
"@babel/preset-typescript": "^7.23.0",
|
|
49
49
|
"@babel/preset-react": "^7.22.15",
|
|
50
|
-
"@react-native/babel-preset": "~0.74.
|
|
50
|
+
"@react-native/babel-preset": "~0.74.81",
|
|
51
51
|
"babel-plugin-react-native-web": "~0.19.10",
|
|
52
52
|
"react-refresh": "0.14.0"
|
|
53
53
|
},
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"expo-module-scripts": "^3.3.0",
|
|
57
57
|
"jest": "^29.2.1"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "ee4f30ef3b5fa567ad1bf94794197f7683fdd481"
|
|
60
60
|
}
|