babel-preset-expo 13.3.0-canary-20250709-136b77f → 13.3.0-canary-20250722-599a28f
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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 650 Industries (Expo). All rights reserved.
|
|
3
|
+
* Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { PluginObj } from '@babel/core';
|
|
9
|
+
declare const _default: () => PluginObj;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 650 Industries (Expo). All rights reserved.
|
|
4
|
+
* Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const core_1 = require("@babel/core");
|
|
11
|
+
// Original: https://github.com/babel/babel/blob/e5c8dc7330cb2f66c37637677609df90b31ff0de/packages/babel-plugin-transform-export-namespace-from/src/index.ts
|
|
12
|
+
// NOTE: Original plugin asserts that Babel version 7 or newer is used. This was removed for simplicity.
|
|
13
|
+
exports.default = () => ({
|
|
14
|
+
name: 'transform-export-namespace-from',
|
|
15
|
+
manipulateOptions: process.env.BABEL_8_BREAKING
|
|
16
|
+
? undefined
|
|
17
|
+
: (_, parser) => parser.plugins.push('exportNamespaceFrom'),
|
|
18
|
+
visitor: {
|
|
19
|
+
ExportNamedDeclaration(path) {
|
|
20
|
+
const { node, scope } = path;
|
|
21
|
+
const { specifiers } = node;
|
|
22
|
+
const index = core_1.types.isExportDefaultSpecifier(specifiers[0]) ? 1 : 0;
|
|
23
|
+
if (!core_1.types.isExportNamespaceSpecifier(specifiers[index]))
|
|
24
|
+
return;
|
|
25
|
+
const nodes = [];
|
|
26
|
+
if (index === 1) {
|
|
27
|
+
nodes.push(core_1.types.exportNamedDeclaration(null, [specifiers.shift()], node.source));
|
|
28
|
+
}
|
|
29
|
+
const specifier = specifiers.shift();
|
|
30
|
+
const { exported } = specifier;
|
|
31
|
+
const uid = scope.generateUidIdentifier(
|
|
32
|
+
// @ts-expect-error Identifier ?? StringLiteral
|
|
33
|
+
exported.name ?? exported.value);
|
|
34
|
+
nodes.push(withLocation(core_1.types.importDeclaration([core_1.types.importNamespaceSpecifier(uid)],
|
|
35
|
+
// @ts-expect-error
|
|
36
|
+
core_1.types.cloneNode(node.source)), node.loc), withLocation(core_1.types.exportNamedDeclaration(null, [core_1.types.exportSpecifier(core_1.types.cloneNode(uid), exported)]), node.loc));
|
|
37
|
+
if (node.specifiers.length >= 1) {
|
|
38
|
+
nodes.push(node);
|
|
39
|
+
}
|
|
40
|
+
const [importDeclaration] = path.replaceWithMultiple(nodes);
|
|
41
|
+
path.scope.registerDeclaration(importDeclaration);
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
// Inspired by https://github.com/facebook/metro/blob/8e48aa823378962beccbe37d85f1aff2c34b28b1/packages/metro-transform-plugins/src/import-export-plugin.js#L143
|
|
46
|
+
function withLocation(node, loc) {
|
|
47
|
+
if (!node.loc) {
|
|
48
|
+
return { ...node, loc };
|
|
49
|
+
}
|
|
50
|
+
return node;
|
|
51
|
+
}
|
package/build/index.js
CHANGED
|
@@ -243,7 +243,7 @@ function babelPresetExpo(api, options = {}) {
|
|
|
243
243
|
// the TypeScript plugins to ensure namespace type exports (TypeScript 5.0+) `export type * as Types from './module';`
|
|
244
244
|
// are stripped before the transform. Otherwise the transform will extraneously include the types as syntax.
|
|
245
245
|
babelPresetReactNativeEnv.overrides.push({
|
|
246
|
-
plugins: [require('
|
|
246
|
+
plugins: [require('./babel-plugin-transform-export-namespace-from')],
|
|
247
247
|
});
|
|
248
248
|
return babelPresetReactNativeEnv;
|
|
249
249
|
})(),
|
package/build/web-preset.js
CHANGED
|
@@ -21,7 +21,7 @@ const defaultPlugins = [
|
|
|
21
21
|
[require('@babel/plugin-transform-private-methods'), { loose }],
|
|
22
22
|
[require('@babel/plugin-transform-private-property-in-object'), { loose }],
|
|
23
23
|
[require('@babel/plugin-syntax-export-default-from')],
|
|
24
|
-
[require('
|
|
24
|
+
[require('./babel-plugin-transform-export-namespace-from')],
|
|
25
25
|
];
|
|
26
26
|
module.exports = function (babel, options) {
|
|
27
27
|
const extraPlugins = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-expo",
|
|
3
|
-
"version": "13.3.0-canary-
|
|
3
|
+
"version": "13.3.0-canary-20250722-599a28f",
|
|
4
4
|
"description": "The Babel preset for Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@babel/traverse": "^7.9.0",
|
|
78
78
|
"@babel/types": "^7.9.0",
|
|
79
79
|
"babel-plugin-react-compiler": "^19.0.0-beta-e993439-20250405",
|
|
80
|
-
"expo-module-scripts": "4.1.10-canary-
|
|
80
|
+
"expo-module-scripts": "4.1.10-canary-20250722-599a28f",
|
|
81
81
|
"jest": "^29.2.1"
|
|
82
82
|
}
|
|
83
83
|
}
|