@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htyf-mp/cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "红糖云服app小程序模板-cli",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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} 包名,如果无法提取则返回 null
45
+ * @returns {{ packageName: string, packageRoot: string }|null}
46
46
  */
47
- function extractPackageName(moduleContext) {
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
- return match?.[1] || null;
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} packageName - 包名
65
+ * @param {string} packageRoot - 包在 node_modules 中的真实根目录
59
66
  * @returns {boolean} 是否包含 native 代码
60
67
  */
61
- function hasNativeCode(packageName) {
62
- if (!packageName) {
68
+ function hasNativeCode(packageRoot) {
69
+ if (!packageRoot) {
63
70
  return false;
64
71
  }
65
72
 
66
- // 使用缓存避免重复的文件系统访问
67
- if (nativeCodeCache.has(packageName)) {
68
- return nativeCodeCache.get(packageName);
73
+ if (nativeCodeCache.has(packageRoot)) {
74
+ return nativeCodeCache.get(packageRoot);
69
75
  }
70
76
 
71
- const packagePath = path.join(nodeModulesPath, packageName);
72
- const iosPath = path.join(packagePath, 'ios');
73
- const androidPath = path.join(packagePath, 'android');
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(packageName, hasNative);
77
-
81
+ nativeCodeCache.set(packageRoot, hasNative);
82
+
78
83
  return hasNative;
79
84
  }
80
85
 
81
86
  /**
82
87
  * 获取包版本(带缓存)
83
- * @param {string} packageName - 包名
88
+ * @param {string} packageRoot - 包在 node_modules 中的真实根目录
84
89
  * @returns {string|null} 包版本,如果无法获取则返回 null
85
90
  */
86
- function getPackageVersion(packageName) {
87
- if (!packageName) {
91
+ function getPackageVersion(packageRoot) {
92
+ if (!packageRoot) {
88
93
  return null;
89
94
  }
90
95
 
91
- if (versionCache.has(packageName)) {
92
- return versionCache.get(packageName);
96
+ if (versionCache.has(packageRoot)) {
97
+ return versionCache.get(packageRoot);
93
98
  }
94
99
 
95
- const pkgJsonPath = path.join(nodeModulesPath, packageName, 'package.json');
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(packageName, version);
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 packageName = extractPackageName(module.context);
294
- if (!packageName) {
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(packageName)) {
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(packageName);
318
+ packageName === "react-native" ? true : hasNativeCode(packageRoot);
313
319
  const dependencyInfo = {
314
320
  name: packageName,
315
- version: getPackageVersion(packageName),
321
+ version: getPackageVersion(packageRoot),
316
322
  nativeModule,
317
323
  };
318
324
 
@@ -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.3",
4
+ "@callstack/repack": "5.2.5",
6
5
  "@d11/react-native-fast-image": "8.13.0",
7
- "@dr.pogodin/react-native-fs": "2.36.1",
8
- "@dr.pogodin/react-native-static-server": "0.25.3",
9
- "@openim/rn-client-sdk": "3.8.3-patch.10.2",
10
- "@react-native-async-storage/async-storage": "2.2.0",
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": "8.5.1",
16
- "@react-native-community/geolocation": "3.4.0",
17
- "@react-native-community/netinfo": "11.4.1",
18
- "@react-native-community/slider": "5.1.1",
19
- "@react-native-cookies/cookies": "6.2.1",
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": "1.4.0",
25
- "@shopify/react-native-skia": "2.4.7",
26
- "expo": "54.0.29",
27
- "expo-asset": "12.0.11",
28
- "expo-audio": "1.1.0",
29
- "expo-brightness": "14.0.8",
30
- "expo-camera": "17.0.10",
31
- "expo-clipboard": "8.0.8",
32
- "expo-constants": "18.0.12",
33
- "expo-crypto": "15.0.8",
34
- "expo-document-picker": "14.0.8",
35
- "expo-font": "14.0.10",
36
- "expo-linear-gradient": "15.0.8",
37
- "expo-linking": "8.0.10",
38
- "expo-modules-autolinking": "3.0.23",
39
- "expo-modules-core": "3.0.29",
40
- "expo-router": "6.0.19",
41
- "expo-system-ui": "6.0.9",
42
- "expo-video": "3.0.15",
43
- "jcore-react-native": "2.3.2",
44
- "jpush-react-native": "3.2.1",
45
- "llama.rn": "0.9.3",
46
- "lottie-react-native": "7.3.4",
47
- "react-airplay": "1.2.0",
48
- "react-native-agora": "4.5.3",
49
- "react-native-avoid-softinput": "8.0.2",
50
- "react-native-background-actions": "4.0.1",
51
- "react-native-ble-manager": "12.4.1",
52
- "react-native-blob-util": "0.24.5",
53
- "react-native-compressor": "1.13.0",
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.1",
56
- "react-native-edge-to-edge": "1.7.0",
57
- "react-native-enriched": "0.2.0",
58
- "react-native-file-access": "3.2.0",
59
- "react-native-gesture-handler": "2.29.1",
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.1",
62
- "react-native-google-mobile-ads": "16.0.1",
63
- "react-native-haptic-feedback": "2.3.3",
64
- "react-native-iap": "14.5.0",
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.20.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.6.0",
71
- "react-native-mmkv": "4.1.0",
72
- "react-native-nitro-modules": "0.31.10",
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": "7.0.2",
75
- "react-native-permissions": "5.4.4",
76
- "react-native-quick-base64": "2.2.2",
77
- "react-native-quick-crypto": "1.0.0",
78
- "react-native-reanimated": "4.2.0",
79
- "react-native-restart": "0.0.27",
80
- "react-native-safe-area-context": "5.6.2",
81
- "react-native-screens": "4.18.0",
82
- "react-native-share": "12.2.1",
83
- "react-native-sound": "0.13.0",
84
- "react-native-splash-view": "0.0.19",
85
- "react-native-svg": "15.15.1",
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.18.0",
89
- "react-native-view-shot": "4.0.3",
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": "13.16.0",
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.7.1",
98
- "react-native-worklets-core": "1.6.2",
99
- "react-native-zip-archive": "7.0.2",
100
- "react-native": "0.83.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
  }