miaoda-expo-devkit 0.1.1-beta.83 → 0.1.1-beta.85
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/dist/babel/preset.js
CHANGED
|
@@ -43,7 +43,13 @@ function presetExpoDevkit(api, options = {}) {
|
|
|
43
43
|
["babel-preset-expo", {
|
|
44
44
|
jsxImportSource: "nativewind",
|
|
45
45
|
// 全平台禁止自动注入,由下方手动注入统一管理
|
|
46
|
-
worklets: false
|
|
46
|
+
worklets: false,
|
|
47
|
+
// babel-preset-expo 在 SDK 56 之前默认不转换 import.meta,
|
|
48
|
+
// 但部分 npm 包(如 zustand v5 的 devtools 中间件)的 ESM 构建
|
|
49
|
+
// 包含 import.meta.env,Metro 遇到会直接报错。
|
|
50
|
+
// 显式开启后,Babel 会在编译阶段将 import.meta.env 替换为
|
|
51
|
+
// process.env,所有平台均安全,SDK 56 升级后此选项会自动成为默认值。
|
|
52
|
+
unstable_transformImportMeta: true
|
|
47
53
|
}],
|
|
48
54
|
"nativewind/babel"
|
|
49
55
|
],
|
|
@@ -91,6 +91,11 @@ function collectRoutesNeedingHide(layoutDir) {
|
|
|
91
91
|
if (import_node_fs.default.existsSync(layoutDir)) scan(layoutDir);
|
|
92
92
|
return results;
|
|
93
93
|
}
|
|
94
|
+
function getJSXName(n) {
|
|
95
|
+
if (n.type === "JSXIdentifier") return n.name ?? "";
|
|
96
|
+
if (n.type === "JSXMemberExpression") return `${n.object?.name ?? ""}.${n.property?.name ?? ""}`;
|
|
97
|
+
return "";
|
|
98
|
+
}
|
|
94
99
|
function getStringAttr(attrs, attrName) {
|
|
95
100
|
for (const attr of attrs) {
|
|
96
101
|
if (attr.type !== "JSXAttribute") continue;
|
|
@@ -148,19 +153,22 @@ var noUnregisteredDynamicTabRouteRule = {
|
|
|
148
153
|
const layoutDir = import_node_path2.default.dirname(context.filename);
|
|
149
154
|
if (import_node_path2.default.relative(appDir, layoutDir).startsWith("..")) return {};
|
|
150
155
|
const hiddenNames = /* @__PURE__ */ new Set();
|
|
156
|
+
let hasTabsNavigator = false;
|
|
151
157
|
return {
|
|
152
158
|
JSXOpeningElement(node) {
|
|
153
|
-
const nameNode = node
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
const { name: nameNode, attributes: attrs } = node;
|
|
160
|
+
const jsxName = getJSXName(nameNode);
|
|
161
|
+
if (jsxName === "Tabs" || jsxName === "Tabs.Navigator") {
|
|
162
|
+
hasTabsNavigator = true;
|
|
156
163
|
}
|
|
157
|
-
|
|
164
|
+
if (jsxName !== "Tabs.Screen") return;
|
|
158
165
|
const screenName = getStringAttr(attrs, "name");
|
|
159
166
|
if (screenName && isHiddenTab(attrs)) {
|
|
160
167
|
hiddenNames.add(screenName);
|
|
161
168
|
}
|
|
162
169
|
},
|
|
163
170
|
"Program:exit"() {
|
|
171
|
+
if (!hasTabsNavigator) return;
|
|
164
172
|
const routes = collectRoutesNeedingHide(layoutDir);
|
|
165
173
|
for (const name of routes) {
|
|
166
174
|
if (!hiddenNames.has(name)) {
|