babel-preset-expo 13.1.0 → 13.1.1
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 +1 -2
- package/build/common.js +15 -16
- package/build/define-plugin.js +17 -7
- package/build/detect-dynamic-exports.js +1 -2
- package/build/environment-restricted-imports.js +1 -2
- package/build/expo-inline-manifest-plugin.js +2 -3
- package/build/expo-router-plugin.js +1 -2
- package/build/import-meta-transform-plugin.js +1 -2
- package/build/inline-env-vars.js +1 -2
- package/build/minify-platform-select-plugin.js +1 -1
- package/build/restricted-react-api-plugin.js +1 -2
- package/build/server-actions-plugin.js +18 -9
- package/build/use-dom-directive-plugin.js +1 -2
- 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 = reactClientReferencesPlugin;
|
|
7
7
|
/**
|
|
8
8
|
* Copyright © 2024 650 Industries.
|
|
9
9
|
*/
|
|
@@ -214,7 +214,6 @@ function reactClientReferencesPlugin(api) {
|
|
|
214
214
|
},
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
|
-
exports.reactClientReferencesPlugin = reactClientReferencesPlugin;
|
|
218
217
|
function assertExpoMetadata(metadata) {
|
|
219
218
|
if (metadata && typeof metadata === 'object') {
|
|
220
219
|
return;
|
package/build/common.js
CHANGED
|
@@ -3,7 +3,21 @@ 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.
|
|
6
|
+
exports.hasModule = 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.getReactCompiler = getReactCompiler;
|
|
17
|
+
exports.getIsServer = getIsServer;
|
|
18
|
+
exports.getExpoRouterAbsoluteAppRoot = getExpoRouterAbsoluteAppRoot;
|
|
19
|
+
exports.getInlineEnvVarsEnabled = getInlineEnvVarsEnabled;
|
|
20
|
+
exports.getAsyncRoutes = getAsyncRoutes;
|
|
7
21
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
22
|
function hasModule(name) {
|
|
9
23
|
try {
|
|
@@ -16,7 +30,6 @@ function hasModule(name) {
|
|
|
16
30
|
throw error;
|
|
17
31
|
}
|
|
18
32
|
}
|
|
19
|
-
exports.hasModule = hasModule;
|
|
20
33
|
/** Determine which bundler is being used. */
|
|
21
34
|
function getBundler(caller) {
|
|
22
35
|
assertExpoBabelCaller(caller);
|
|
@@ -34,7 +47,6 @@ function getBundler(caller) {
|
|
|
34
47
|
// Assume anything else is Metro.
|
|
35
48
|
return 'metro';
|
|
36
49
|
}
|
|
37
|
-
exports.getBundler = getBundler;
|
|
38
50
|
function getPlatform(caller) {
|
|
39
51
|
assertExpoBabelCaller(caller);
|
|
40
52
|
if (!caller)
|
|
@@ -48,7 +60,6 @@ function getPlatform(caller) {
|
|
|
48
60
|
// unknown
|
|
49
61
|
return caller.platform;
|
|
50
62
|
}
|
|
51
|
-
exports.getPlatform = getPlatform;
|
|
52
63
|
function getPossibleProjectRoot(caller) {
|
|
53
64
|
assertExpoBabelCaller(caller);
|
|
54
65
|
if (!caller)
|
|
@@ -58,13 +69,11 @@ function getPossibleProjectRoot(caller) {
|
|
|
58
69
|
// unknown
|
|
59
70
|
return process.env.EXPO_PROJECT_ROOT;
|
|
60
71
|
}
|
|
61
|
-
exports.getPossibleProjectRoot = getPossibleProjectRoot;
|
|
62
72
|
/** If bundling for a react-server target. */
|
|
63
73
|
function getIsReactServer(caller) {
|
|
64
74
|
assertExpoBabelCaller(caller);
|
|
65
75
|
return caller?.isReactServer ?? false;
|
|
66
76
|
}
|
|
67
|
-
exports.getIsReactServer = getIsReactServer;
|
|
68
77
|
function assertExpoBabelCaller(caller) { }
|
|
69
78
|
function getIsDev(caller) {
|
|
70
79
|
assertExpoBabelCaller(caller);
|
|
@@ -73,14 +82,12 @@ function getIsDev(caller) {
|
|
|
73
82
|
// https://babeljs.io/docs/options#envname
|
|
74
83
|
return process.env.BABEL_ENV === 'development' || process.env.NODE_ENV === 'development';
|
|
75
84
|
}
|
|
76
|
-
exports.getIsDev = getIsDev;
|
|
77
85
|
function getIsFastRefreshEnabled(caller) {
|
|
78
86
|
assertExpoBabelCaller(caller);
|
|
79
87
|
if (!caller)
|
|
80
88
|
return false;
|
|
81
89
|
return caller.isHMREnabled && !caller.isServer && !caller.isNodeModule && getIsDev(caller);
|
|
82
90
|
}
|
|
83
|
-
exports.getIsFastRefreshEnabled = getIsFastRefreshEnabled;
|
|
84
91
|
function getIsProd(caller) {
|
|
85
92
|
assertExpoBabelCaller(caller);
|
|
86
93
|
if (caller?.isDev != null)
|
|
@@ -88,26 +95,21 @@ function getIsProd(caller) {
|
|
|
88
95
|
// https://babeljs.io/docs/options#envname
|
|
89
96
|
return process.env.BABEL_ENV === 'production' || process.env.NODE_ENV === 'production';
|
|
90
97
|
}
|
|
91
|
-
exports.getIsProd = getIsProd;
|
|
92
98
|
function getIsNodeModule(caller) {
|
|
93
99
|
return caller?.isNodeModule ?? false;
|
|
94
100
|
}
|
|
95
|
-
exports.getIsNodeModule = getIsNodeModule;
|
|
96
101
|
function getBaseUrl(caller) {
|
|
97
102
|
assertExpoBabelCaller(caller);
|
|
98
103
|
return caller?.baseUrl ?? '';
|
|
99
104
|
}
|
|
100
|
-
exports.getBaseUrl = getBaseUrl;
|
|
101
105
|
function getReactCompiler(caller) {
|
|
102
106
|
assertExpoBabelCaller(caller);
|
|
103
107
|
return caller?.supportsReactCompiler ?? false;
|
|
104
108
|
}
|
|
105
|
-
exports.getReactCompiler = getReactCompiler;
|
|
106
109
|
function getIsServer(caller) {
|
|
107
110
|
assertExpoBabelCaller(caller);
|
|
108
111
|
return caller?.isServer ?? false;
|
|
109
112
|
}
|
|
110
|
-
exports.getIsServer = getIsServer;
|
|
111
113
|
function getExpoRouterAbsoluteAppRoot(caller) {
|
|
112
114
|
assertExpoBabelCaller(caller);
|
|
113
115
|
const rootModuleId = caller?.routerRoot ?? './app';
|
|
@@ -117,7 +119,6 @@ function getExpoRouterAbsoluteAppRoot(caller) {
|
|
|
117
119
|
const projectRoot = getPossibleProjectRoot(caller) || '/';
|
|
118
120
|
return node_path_1.default.join(projectRoot, rootModuleId);
|
|
119
121
|
}
|
|
120
|
-
exports.getExpoRouterAbsoluteAppRoot = getExpoRouterAbsoluteAppRoot;
|
|
121
122
|
function getInlineEnvVarsEnabled(caller) {
|
|
122
123
|
assertExpoBabelCaller(caller);
|
|
123
124
|
const isWebpack = getBundler(caller) === 'webpack';
|
|
@@ -129,7 +130,6 @@ function getInlineEnvVarsEnabled(caller) {
|
|
|
129
130
|
// Servers have env vars left as-is to read from the environment.
|
|
130
131
|
return !isNodeModule && !isWebpack && !isDev && !isServer && !preserveEnvVars;
|
|
131
132
|
}
|
|
132
|
-
exports.getInlineEnvVarsEnabled = getInlineEnvVarsEnabled;
|
|
133
133
|
function getAsyncRoutes(caller) {
|
|
134
134
|
assertExpoBabelCaller(caller);
|
|
135
135
|
const isServer = getIsServer(caller);
|
|
@@ -143,4 +143,3 @@ function getAsyncRoutes(caller) {
|
|
|
143
143
|
}
|
|
144
144
|
return caller?.asyncRoutes ?? false;
|
|
145
145
|
}
|
|
146
|
-
exports.getAsyncRoutes = getAsyncRoutes;
|
package/build/define-plugin.js
CHANGED
|
@@ -22,13 +22,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
22
22
|
}) : function(o, v) {
|
|
23
23
|
o["default"] = v;
|
|
24
24
|
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
32
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
43
|
const t = __importStar(require("@babel/types"));
|
|
34
44
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectDynamicExports =
|
|
3
|
+
exports.detectDynamicExports = detectDynamicExports;
|
|
4
4
|
const debug = require('debug')('expo:babel:exports');
|
|
5
5
|
// A babel pass to detect the usage of `module.exports` or `exports` in a module for use in
|
|
6
6
|
// export all expansion passes during tree shaking.
|
|
@@ -79,7 +79,6 @@ function detectDynamicExports(api) {
|
|
|
79
79
|
},
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
exports.detectDynamicExports = detectDynamicExports;
|
|
83
82
|
function assertExpoMetadata(metadata) {
|
|
84
83
|
if (metadata && typeof metadata === 'object') {
|
|
85
84
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.environmentRestrictedImportsPlugin =
|
|
3
|
+
exports.environmentRestrictedImportsPlugin = environmentRestrictedImportsPlugin;
|
|
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,4 +58,3 @@ 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 = expoInlineManifestPlugin;
|
|
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', // hooks no longer exists in the typescript type but should still be removed
|
|
27
27
|
'_internal',
|
|
28
28
|
// Remove metro-specific values
|
|
29
29
|
'assetBundlePatterns',
|
|
@@ -148,4 +148,3 @@ function expoInlineManifestPlugin(api) {
|
|
|
148
148
|
},
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
|
-
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 = expoRouterBabelPlugin;
|
|
7
7
|
/**
|
|
8
8
|
* Copyright © 2024 650 Industries.
|
|
9
9
|
*/
|
|
@@ -67,4 +67,3 @@ function expoRouterBabelPlugin(api) {
|
|
|
67
67
|
},
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
exports.expoRouterBabelPlugin = expoRouterBabelPlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.expoImportMetaTransformPlugin =
|
|
4
|
+
exports.expoImportMetaTransformPlugin = expoImportMetaTransformPlugin;
|
|
5
5
|
function expoImportMetaTransformPlugin(api) {
|
|
6
6
|
const { types: t } = api;
|
|
7
7
|
return {
|
|
@@ -17,4 +17,3 @@ function expoImportMetaTransformPlugin(api) {
|
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
exports.expoImportMetaTransformPlugin = expoImportMetaTransformPlugin;
|
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 = expoInlineEnvVars;
|
|
4
4
|
const debug = require('debug')('expo:babel:env-vars');
|
|
5
5
|
function expoInlineEnvVars(api) {
|
|
6
6
|
const { types: t } = api;
|
|
@@ -26,4 +26,3 @@ function expoInlineEnvVars(api) {
|
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
exports.expoInlineEnvVars = expoInlineEnvVars;
|
|
@@ -7,6 +7,7 @@
|
|
|
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;
|
|
10
11
|
const core_1 = require("@babel/core");
|
|
11
12
|
function minifyPlatformSelectPlugin({ types: t, }) {
|
|
12
13
|
return {
|
|
@@ -31,7 +32,6 @@ function minifyPlatformSelectPlugin({ types: t, }) {
|
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
}
|
|
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 = environmentRestrictedReactAPIsPlugin;
|
|
4
4
|
const INVALID_SERVER_REACT_DOM_APIS = [
|
|
5
5
|
'findDOMNode',
|
|
6
6
|
'flushSync',
|
|
@@ -113,4 +113,3 @@ function environmentRestrictedReactAPIsPlugin(api) {
|
|
|
113
113
|
},
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
exports.environmentRestrictedReactAPIsPlugin = environmentRestrictedReactAPIsPlugin;
|
|
@@ -24,15 +24,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
24
24
|
}) : function(o, v) {
|
|
25
25
|
o["default"] = v;
|
|
26
26
|
});
|
|
27
|
-
var __importStar = (this && this.__importStar) || function (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
34
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.reactServerActionsPlugin =
|
|
45
|
+
exports.reactServerActionsPlugin = reactServerActionsPlugin;
|
|
36
46
|
const core_1 = require("@babel/core");
|
|
37
47
|
// @ts-expect-error: missing types
|
|
38
48
|
const helper_module_imports_1 = require("@babel/helper-module-imports");
|
|
@@ -508,7 +518,6 @@ function reactServerActionsPlugin(api) {
|
|
|
508
518
|
},
|
|
509
519
|
};
|
|
510
520
|
}
|
|
511
|
-
exports.reactServerActionsPlugin = reactServerActionsPlugin;
|
|
512
521
|
const getFreeVariables = (path) => {
|
|
513
522
|
const freeVariablesSet = new Set();
|
|
514
523
|
const programScope = path.scope.getProgramParent();
|
|
@@ -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.expoUseDomDirectivePlugin =
|
|
6
|
+
exports.expoUseDomDirectivePlugin = expoUseDomDirectivePlugin;
|
|
7
7
|
/**
|
|
8
8
|
* Copyright © 2024 650 Industries.
|
|
9
9
|
*/
|
|
@@ -124,7 +124,6 @@ function expoUseDomDirectivePlugin(api) {
|
|
|
124
124
|
},
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
exports.expoUseDomDirectivePlugin = expoUseDomDirectivePlugin;
|
|
128
127
|
function assertExpoMetadata(metadata) {
|
|
129
128
|
if (metadata && typeof metadata === 'object') {
|
|
130
129
|
return;
|
package/build/web-preset.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = function (babel, options) {
|
|
|
30
30
|
require('@babel/plugin-transform-modules-commonjs'),
|
|
31
31
|
{
|
|
32
32
|
strict: false,
|
|
33
|
-
strictMode: false,
|
|
33
|
+
strictMode: false, // prevent "use strict" injections
|
|
34
34
|
lazy: options.lazyImportExportTransform,
|
|
35
35
|
allowTopLevelThis: true, // dont rewrite global `this` -> `undefined`
|
|
36
36
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.1",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"@babel/traverse": "^7.9.0",
|
|
81
81
|
"@babel/types": "^7.9.0",
|
|
82
82
|
"babel-plugin-react-compiler": "^19.0.0-beta-9ee70a1-20241017",
|
|
83
|
-
"expo-module-scripts": "^4.1.
|
|
83
|
+
"expo-module-scripts": "^4.1.1",
|
|
84
84
|
"jest": "^29.2.1",
|
|
85
85
|
"react-compiler-runtime": "^19.0.0-beta-8a03594-20241020"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "1914bb35d23af23078da37e70988261844436505"
|
|
88
88
|
}
|