@htyf-mp/cli 0.3.2 → 0.3.3
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/package.json +1 -1
- package/src/HtyfImportsPlugin.mjs +37 -31
- package/src/shared-output.json +92 -78
package/package.json
CHANGED
|
@@ -40,59 +40,64 @@ function getSharedConfig() {
|
|
|
40
40
|
// ==================== 工具函数 ====================
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* 从 module.context 中提取包名与真实包根目录
|
|
44
44
|
* @param {string} moduleContext - 模块上下文路径
|
|
45
|
-
* @returns {string|null}
|
|
45
|
+
* @returns {{ packageName: string, packageRoot: string }|null}
|
|
46
46
|
*/
|
|
47
|
-
function
|
|
47
|
+
function extractPackageInfo(moduleContext) {
|
|
48
48
|
if (!moduleContext?.includes('node_modules')) {
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const match = moduleContext.match(PNPM_PACKAGE_REGEX);
|
|
53
|
-
|
|
53
|
+
if (!match?.[1]) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
packageName: match[1],
|
|
59
|
+
packageRoot: moduleContext.slice(0, match.index + match[0].length),
|
|
60
|
+
};
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
/**
|
|
57
64
|
* 检查包是否包含 native 代码(带缓存)
|
|
58
|
-
* @param {string}
|
|
65
|
+
* @param {string} packageRoot - 包在 node_modules 中的真实根目录
|
|
59
66
|
* @returns {boolean} 是否包含 native 代码
|
|
60
67
|
*/
|
|
61
|
-
function hasNativeCode(
|
|
62
|
-
if (!
|
|
68
|
+
function hasNativeCode(packageRoot) {
|
|
69
|
+
if (!packageRoot) {
|
|
63
70
|
return false;
|
|
64
71
|
}
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return nativeCodeCache.get(packageName);
|
|
73
|
+
if (nativeCodeCache.has(packageRoot)) {
|
|
74
|
+
return nativeCodeCache.get(packageRoot);
|
|
69
75
|
}
|
|
70
76
|
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
const iosPath = path.join(packageRoot, 'ios');
|
|
78
|
+
const androidPath = path.join(packageRoot, 'android');
|
|
79
|
+
|
|
75
80
|
const hasNative = fse.pathExistsSync(iosPath) || fse.pathExistsSync(androidPath);
|
|
76
|
-
nativeCodeCache.set(
|
|
77
|
-
|
|
81
|
+
nativeCodeCache.set(packageRoot, hasNative);
|
|
82
|
+
|
|
78
83
|
return hasNative;
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
/**
|
|
82
87
|
* 获取包版本(带缓存)
|
|
83
|
-
* @param {string}
|
|
88
|
+
* @param {string} packageRoot - 包在 node_modules 中的真实根目录
|
|
84
89
|
* @returns {string|null} 包版本,如果无法获取则返回 null
|
|
85
90
|
*/
|
|
86
|
-
function getPackageVersion(
|
|
87
|
-
if (!
|
|
91
|
+
function getPackageVersion(packageRoot) {
|
|
92
|
+
if (!packageRoot) {
|
|
88
93
|
return null;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
if (versionCache.has(
|
|
92
|
-
return versionCache.get(
|
|
96
|
+
if (versionCache.has(packageRoot)) {
|
|
97
|
+
return versionCache.get(packageRoot);
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
const pkgJsonPath = path.join(
|
|
100
|
+
const pkgJsonPath = path.join(packageRoot, 'package.json');
|
|
96
101
|
let version = null;
|
|
97
102
|
|
|
98
103
|
try {
|
|
@@ -101,11 +106,10 @@ function getPackageVersion(packageName) {
|
|
|
101
106
|
version = pkgJson.version || null;
|
|
102
107
|
}
|
|
103
108
|
} catch (error) {
|
|
104
|
-
// 静默失败,返回 null
|
|
105
109
|
version = null;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
|
-
versionCache.set(
|
|
112
|
+
versionCache.set(packageRoot, version);
|
|
109
113
|
return version;
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -290,29 +294,31 @@ export class HtyfModulesPlugin {
|
|
|
290
294
|
continue;
|
|
291
295
|
}
|
|
292
296
|
|
|
293
|
-
const
|
|
294
|
-
if (!
|
|
297
|
+
const packageInfo = extractPackageInfo(module.context);
|
|
298
|
+
if (!packageInfo) {
|
|
295
299
|
continue;
|
|
296
300
|
}
|
|
297
301
|
|
|
302
|
+
const { packageName, packageRoot } = packageInfo;
|
|
303
|
+
|
|
298
304
|
// 如果已经处理过该包,跳过
|
|
299
305
|
if (dependencyMap.has(packageName)) {
|
|
300
306
|
const existing = dependencyMap.get(packageName);
|
|
301
|
-
// 如果之前不是 native
|
|
302
|
-
if (!existing.nativeModule && hasNativeCode(
|
|
307
|
+
// 如果之前不是 native 模块,基于当前 module 的真实路径再次检查
|
|
308
|
+
if (!existing.nativeModule && hasNativeCode(packageRoot)) {
|
|
303
309
|
existing.nativeModule = true;
|
|
304
310
|
nativeModules.add(packageName);
|
|
305
311
|
}
|
|
306
312
|
continue;
|
|
307
313
|
}
|
|
308
314
|
|
|
309
|
-
//
|
|
315
|
+
// 首次处理该包,version / nativeModule 均基于 module.context 解析出的真实路径
|
|
310
316
|
// react-native 必须视为原生依赖,无论是否检测到 ios/android 目录
|
|
311
317
|
const nativeModule =
|
|
312
|
-
packageName === "react-native" ? true : hasNativeCode(
|
|
318
|
+
packageName === "react-native" ? true : hasNativeCode(packageRoot);
|
|
313
319
|
const dependencyInfo = {
|
|
314
320
|
name: packageName,
|
|
315
|
-
version: getPackageVersion(
|
|
321
|
+
version: getPackageVersion(packageRoot),
|
|
316
322
|
nativeModule,
|
|
317
323
|
};
|
|
318
324
|
|
package/src/shared-output.json
CHANGED
|
@@ -1,101 +1,115 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@bam.tech/react-native-image-resizer": "3.0.11",
|
|
3
2
|
"@borndotcom/react-native-godot": "1.0.1",
|
|
4
3
|
"@boterop/react-native-background-timer": "2.6.0",
|
|
5
|
-
"@callstack/repack": "5.2.
|
|
4
|
+
"@callstack/repack": "5.2.5",
|
|
6
5
|
"@d11/react-native-fast-image": "8.13.0",
|
|
7
|
-
"@dr.pogodin/react-native-fs": "2.
|
|
8
|
-
"@
|
|
9
|
-
"@
|
|
10
|
-
"@react-native-async-storage/async-storage": "
|
|
6
|
+
"@dr.pogodin/react-native-fs": "2.39.1",
|
|
7
|
+
"@kesha-antonov/react-native-background-downloader": "4.5.6",
|
|
8
|
+
"@lodev09/react-native-true-sheet": "3.11.1",
|
|
9
|
+
"@react-native-async-storage/async-storage": "3.1.1",
|
|
11
10
|
"@react-native-camera-roll/camera-roll": "7.10.2",
|
|
12
11
|
"@react-native-clipboard/clipboard": "1.16.3",
|
|
13
12
|
"@react-native-community/blur": "4.4.1",
|
|
14
13
|
"@react-native-community/checkbox": "0.5.20",
|
|
15
|
-
"@react-native-community/datetimepicker": "
|
|
16
|
-
"@react-native-community/
|
|
17
|
-
"@react-native-community/
|
|
18
|
-
"@react-native-
|
|
19
|
-
"@react-native-
|
|
20
|
-
"@react-native-documents/picker": "11.0.3",
|
|
14
|
+
"@react-native-community/datetimepicker": "9.1.0",
|
|
15
|
+
"@react-native-community/netinfo": "12.0.1",
|
|
16
|
+
"@react-native-community/slider": "5.2.0",
|
|
17
|
+
"@react-native-documents/picker": "12.0.1",
|
|
18
|
+
"@react-native-documents/viewer": "4.0.0",
|
|
21
19
|
"@react-native-masked-view/masked-view": "0.3.2",
|
|
22
20
|
"@react-native-picker/picker": "2.11.4",
|
|
23
21
|
"@react-native-segmented-control/segmented-control": "2.5.7",
|
|
24
|
-
"@sayem314/react-native-keep-awake": "
|
|
25
|
-
"@shopify/react-native-skia": "2.
|
|
26
|
-
"expo": "
|
|
27
|
-
"expo-asset": "
|
|
28
|
-
"expo-audio": "
|
|
29
|
-
"expo-brightness": "
|
|
30
|
-
"expo-camera": "
|
|
31
|
-
"expo-clipboard": "
|
|
32
|
-
"expo-constants": "
|
|
33
|
-
"expo-crypto": "
|
|
34
|
-
"expo-document-picker": "
|
|
35
|
-
"expo-
|
|
36
|
-
"expo-
|
|
37
|
-
"expo-
|
|
38
|
-
"expo-
|
|
39
|
-
"expo-
|
|
40
|
-
"expo-
|
|
41
|
-
"expo-
|
|
42
|
-
"expo-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"react-native
|
|
49
|
-
"react-
|
|
50
|
-
"react-native-
|
|
51
|
-
"react-native-
|
|
52
|
-
"react-native-
|
|
53
|
-
"react-native-
|
|
22
|
+
"@sayem314/react-native-keep-awake": "2.0.0",
|
|
23
|
+
"@shopify/react-native-skia": "2.6.8",
|
|
24
|
+
"expo": "56.0.12",
|
|
25
|
+
"expo-asset": "56.0.17",
|
|
26
|
+
"expo-audio": "56.0.12",
|
|
27
|
+
"expo-brightness": "56.0.5",
|
|
28
|
+
"expo-camera": "56.0.8",
|
|
29
|
+
"expo-clipboard": "56.0.4",
|
|
30
|
+
"expo-constants": "56.0.18",
|
|
31
|
+
"expo-crypto": "56.0.4",
|
|
32
|
+
"expo-document-picker": "56.0.4",
|
|
33
|
+
"expo-file-system": "56.0.8",
|
|
34
|
+
"expo-font": "56.0.7",
|
|
35
|
+
"expo-keep-awake": "56.0.3",
|
|
36
|
+
"expo-linear-gradient": "56.0.4",
|
|
37
|
+
"expo-linking": "56.0.14",
|
|
38
|
+
"expo-modules-autolinking": "56.0.16",
|
|
39
|
+
"expo-modules-core": "56.0.17",
|
|
40
|
+
"expo-router": "56.2.11",
|
|
41
|
+
"expo-system-ui": "56.0.5",
|
|
42
|
+
"expo-video": "56.1.4",
|
|
43
|
+
"jcore-react-native": "2.3.6",
|
|
44
|
+
"jpush-react-native": "3.2.7",
|
|
45
|
+
"llama.rn": "0.12.5",
|
|
46
|
+
"lottie-react-native": "7.3.8",
|
|
47
|
+
"react-airplay": "2.0.2",
|
|
48
|
+
"react-native-agora": "4.6.2",
|
|
49
|
+
"react-native-avoid-softinput": "9.0.0",
|
|
50
|
+
"react-native-background-actions": "4.1.0",
|
|
51
|
+
"react-native-ble-manager": "12.5.0",
|
|
52
|
+
"react-native-blob-util": "0.24.10",
|
|
53
|
+
"react-native-camera-kit": "18.0.0",
|
|
54
54
|
"react-native-config": "1.6.1",
|
|
55
|
-
"react-native-device-info": "15.0.
|
|
56
|
-
"react-native-edge-to-edge": "1.
|
|
57
|
-
"react-native-enriched": "0.
|
|
58
|
-
"react-native-
|
|
59
|
-
"react-native-
|
|
55
|
+
"react-native-device-info": "15.0.2",
|
|
56
|
+
"react-native-edge-to-edge": "1.8.1",
|
|
57
|
+
"react-native-enriched-html": "1.0.0",
|
|
58
|
+
"react-native-enriched-markdown": "0.6.0",
|
|
59
|
+
"react-native-file-access": "4.0.3",
|
|
60
|
+
"react-native-gesture-handler": "3.0.2",
|
|
60
61
|
"react-native-get-random-values": "2.0.0",
|
|
61
|
-
"react-native-global-exception-handler": "1.0.
|
|
62
|
-
"react-native-google-mobile-ads": "16.0
|
|
63
|
-
"react-native-
|
|
64
|
-
"react-native-
|
|
65
|
-
"react-native-image-colors": "2.5.1",
|
|
62
|
+
"react-native-global-exception-handler": "1.0.2",
|
|
63
|
+
"react-native-google-mobile-ads": "16.4.0",
|
|
64
|
+
"react-native-iap": "15.3.4",
|
|
65
|
+
"react-native-image-colors": "2.6.0",
|
|
66
66
|
"react-native-image-picker": "8.2.1",
|
|
67
|
-
"react-native-keyboard-controller": "1.
|
|
68
|
-
"react-native-keychain": "10.0.0",
|
|
67
|
+
"react-native-keyboard-controller": "1.21.12",
|
|
69
68
|
"react-native-linear-gradient": "2.8.3",
|
|
70
|
-
"react-native-localize": "3.
|
|
71
|
-
"react-native-
|
|
72
|
-
"react-native-
|
|
69
|
+
"react-native-localize": "3.7.0",
|
|
70
|
+
"react-native-media-toolkit": "2.3.6",
|
|
71
|
+
"react-native-mmkv": "4.3.2",
|
|
72
|
+
"react-native-nitro-bg-timer-plus": "0.3.2",
|
|
73
|
+
"react-native-nitro-buffer": "0.2.2",
|
|
74
|
+
"react-native-nitro-cookies": "1.2.0",
|
|
75
|
+
"react-native-nitro-fetch": "1.4.2",
|
|
76
|
+
"react-native-nitro-geolocation": "1.4.1",
|
|
77
|
+
"react-native-nitro-haptics": "0.2.3",
|
|
78
|
+
"react-native-nitro-http-server": "1.9.2",
|
|
79
|
+
"react-native-nitro-markdown": "0.8.1",
|
|
80
|
+
"react-native-nitro-modules": "0.35.10",
|
|
81
|
+
"react-native-nitro-player": "1.4.3",
|
|
82
|
+
"react-native-nitro-sound": "0.2.15",
|
|
83
|
+
"react-native-nitro-sqlite": "9.6.0",
|
|
84
|
+
"react-native-nitro-sse": "2.3.1",
|
|
85
|
+
"react-native-nitro-text-decoder": "0.2.0",
|
|
86
|
+
"react-native-nitro-unzip": "0.5.3",
|
|
87
|
+
"react-native-nitro-websockets": "1.0.3",
|
|
73
88
|
"react-native-orientation-locker": "1.7.0",
|
|
74
|
-
"react-native-pager-view": "
|
|
75
|
-
"react-native-permissions": "5.
|
|
76
|
-
"react-native-
|
|
77
|
-
"react-native-quick-
|
|
78
|
-
"react-native-
|
|
79
|
-
"react-native-
|
|
80
|
-
"react-native-
|
|
81
|
-
"react-native-
|
|
82
|
-
"react-native-
|
|
83
|
-
"react-native-
|
|
84
|
-
"react-native-splash-view": "0.0.
|
|
85
|
-
"react-native-svg": "15.15.
|
|
89
|
+
"react-native-pager-view": "8.0.2",
|
|
90
|
+
"react-native-permissions": "5.6.0",
|
|
91
|
+
"react-native-qr-kit": "1.1.6",
|
|
92
|
+
"react-native-quick-base64": "3.0.0",
|
|
93
|
+
"react-native-quick-crypto": "1.1.5",
|
|
94
|
+
"react-native-reanimated": "4.5.0",
|
|
95
|
+
"react-native-restart": "0.0.28",
|
|
96
|
+
"react-native-safe-area-context": "5.8.0",
|
|
97
|
+
"react-native-screens": "4.25.2",
|
|
98
|
+
"react-native-share": "12.3.1",
|
|
99
|
+
"react-native-splash-view": "0.0.21",
|
|
100
|
+
"react-native-svg": "15.15.5",
|
|
101
|
+
"react-native-teleport": "1.1.9",
|
|
86
102
|
"react-native-track-player": "5.0.0-alpha0-nightly-359af5a12d712d3b685530aed9b9625865a25d74",
|
|
87
103
|
"react-native-vector-icons": "10.3.0",
|
|
88
|
-
"react-native-video": "6.
|
|
89
|
-
"react-native-view-shot": "
|
|
90
|
-
"react-native-vision-camera": "4.7.3",
|
|
104
|
+
"react-native-video": "6.19.2",
|
|
105
|
+
"react-native-view-shot": "5.1.1",
|
|
91
106
|
"react-native-vlc-media-player": "1.0.98",
|
|
92
107
|
"react-native-volume-manager": "2.0.8",
|
|
93
108
|
"react-native-webrtc": "124.0.7",
|
|
94
|
-
"react-native-webview": "
|
|
95
|
-
"react-native-wgpu": "0.4.1",
|
|
109
|
+
"react-native-webview": "14.0.1",
|
|
96
110
|
"react-native-wifi-reborn": "4.13.6",
|
|
97
|
-
"react-native-worklets": "0.
|
|
98
|
-
"react-native-worklets-core": "1.6.
|
|
99
|
-
"
|
|
100
|
-
"react-native": "0.
|
|
111
|
+
"react-native-worklets": "0.10.0",
|
|
112
|
+
"react-native-worklets-core": "1.6.3",
|
|
113
|
+
"whisper.rn": "0.6.0",
|
|
114
|
+
"react-native": "0.86.0"
|
|
101
115
|
}
|