miaoda-expo-devkit 0.1.1-beta.2 → 0.1.1-beta.21
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/plugin-jsx-source.d.ts +2 -0
- package/dist/babel/plugin-jsx-source.js +12 -3
- package/dist/babel/plugin-lucide-react-native.d.ts +25 -0
- package/dist/babel/plugin-lucide-react-native.js +14723 -0
- package/dist/babel/preset.d.ts +8 -0
- package/dist/babel/preset.js +9 -5
- package/dist/cli/lint.js +23 -0
- package/dist/metro.d.mts +214 -55
- package/dist/metro.d.ts +214 -55
- package/dist/metro.js +224 -66
- package/dist/metro.mjs +223 -66
- package/dist/rules/no-duplicate-expo-router-url.js +2 -2
- package/dist/rules/no-missing-css-import.js +98 -0
- package/dist/rules/no-undeclared-expo-plugin.js +4 -0
- package/dist/rules/no-unused-expo-plugin.js +162 -0
- package/dist/stubs/expo-blur-stub.js +29 -0
- package/dist/stubs/expo-camera-stub.js +28 -0
- package/dist/stubs/expo-image-stub.js +28 -0
- package/dist/stubs/expo-linear-gradient-stub.js +28 -0
- package/dist/stubs/expo-notifications-stub.js +168 -0
- package/dist/stubs/lgui-control.js +96 -9
- package/oxlint-config.json +49 -0
- package/package.json +60 -12
- package/tsconfig-base.json +7 -0
|
@@ -14,8 +14,10 @@ import { types, PluginObj } from '@babel/core';
|
|
|
14
14
|
*
|
|
15
15
|
* 对于纯文本节点:
|
|
16
16
|
* <div>hello world</div>
|
|
17
|
+
* <div>{"hello world"}</div>
|
|
17
18
|
* 转换后:
|
|
18
19
|
* <div dataSet={{"mdId": "path/to/file.tsx:10:4", "componentContent": "{\"text\":\"hello world\"}"}}>hello world</div>
|
|
20
|
+
* <div dataSet={{"mdId": "path/to/file.tsx:11:4", "componentContent": "{\"text\":\"hello world\"}"}}>{"hello world"}</div>
|
|
19
21
|
*
|
|
20
22
|
* 用法(babel.config.js):
|
|
21
23
|
*
|
|
@@ -69,9 +69,18 @@ function getTextNodeContent(t, path) {
|
|
|
69
69
|
const children = parent.children;
|
|
70
70
|
if (children.length !== 1) return null;
|
|
71
71
|
const child = children[0];
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
if (t.isJSXText(child)) {
|
|
73
|
+
const text = child.value.trim();
|
|
74
|
+
return text || null;
|
|
75
|
+
}
|
|
76
|
+
if (t.isJSXExpressionContainer(child) && t.isStringLiteral(child.expression)) {
|
|
77
|
+
const text = child.expression.value.trim();
|
|
78
|
+
return text || null;
|
|
79
|
+
}
|
|
80
|
+
if (t.isJSXExpressionContainer(child) && t.isNumericLiteral(child.expression)) {
|
|
81
|
+
return String(child.expression.value);
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
75
84
|
}
|
|
76
85
|
function shouldSkipElement(t, name) {
|
|
77
86
|
if (t.isJSXIdentifier(name)) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import babelCore from '@babel/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* babel-plugin-lucide-react-native
|
|
5
|
+
*
|
|
6
|
+
* 将 lucide-react-native 的具名导入转换为按图标文件直接导入,绕过 Metro
|
|
7
|
+
* 缺乏 tree-shaking 的问题,避免将整个图标库打进 bundle。
|
|
8
|
+
*
|
|
9
|
+
* 转换示意:
|
|
10
|
+
* import { Star, BookHeart } from "lucide-react-native"
|
|
11
|
+
* →
|
|
12
|
+
* import _Star from "lucide-react-native/dist/cjs/icons/star"
|
|
13
|
+
* import _BookHeart from "lucide-react-native/dist/cjs/icons/book-heart"
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
type Core = typeof babelCore;
|
|
17
|
+
interface Config extends babelCore.PluginPass {
|
|
18
|
+
opts: {
|
|
19
|
+
/** 使用 ESM 格式(dist/esm)。默认 false,使用 CJS(dist/cjs)。 */
|
|
20
|
+
useES?: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
declare function lucideReactNativePlugin({ types: t }: Core): babelCore.PluginObj<Config>;
|
|
24
|
+
|
|
25
|
+
export { lucideReactNativePlugin as default };
|