zcw-shared 1.46.2 → 1.47.2

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.
Files changed (480) hide show
  1. package/dist/functions/async/sleep.d.ts +5 -0
  2. package/dist/functions/async/sleep.js +6 -0
  3. package/dist/functions/async/sleep.js.map +1 -0
  4. package/dist/functions/async/timeout.d.ts +6 -0
  5. package/dist/functions/async/timeout.js +12 -0
  6. package/dist/functions/async/timeout.js.map +1 -0
  7. package/dist/functions/browser/computePosition.d.ts +6 -0
  8. package/dist/functions/browser/computePosition.js +49 -0
  9. package/dist/functions/browser/computePosition.js.map +1 -0
  10. package/dist/functions/browser/createSharedKeyboardCenter.d.ts +18 -0
  11. package/dist/functions/browser/createSharedKeyboardCenter.js +58 -0
  12. package/dist/functions/browser/createSharedKeyboardCenter.js.map +1 -0
  13. package/dist/functions/browser/createThrottledEventListener.d.ts +11 -0
  14. package/dist/functions/browser/createThrottledEventListener.js +51 -0
  15. package/dist/functions/browser/createThrottledEventListener.js.map +1 -0
  16. package/dist/functions/browser/demonstrateResourceLoading.d.ts +32 -0
  17. package/dist/functions/browser/demonstrateResourceLoading.js +169 -0
  18. package/dist/functions/browser/demonstrateResourceLoading.js.map +1 -0
  19. package/dist/functions/browser/detectOverflow.d.ts +12 -0
  20. package/dist/functions/browser/detectOverflow.js +17 -0
  21. package/dist/functions/browser/detectOverflow.js.map +1 -0
  22. package/dist/functions/browser/getAlignment.d.ts +2 -0
  23. package/dist/functions/browser/getAlignment.js +5 -0
  24. package/dist/functions/browser/getAlignment.js.map +1 -0
  25. package/dist/functions/browser/getBasePlacement.d.ts +2 -0
  26. package/dist/functions/browser/getBasePlacement.js +4 -0
  27. package/dist/functions/browser/getBasePlacement.js.map +1 -0
  28. package/dist/functions/browser/getCrossAxisFlip.d.ts +2 -0
  29. package/dist/functions/browser/getCrossAxisFlip.js +11 -0
  30. package/dist/functions/browser/getCrossAxisFlip.js.map +1 -0
  31. package/dist/functions/browser/getElementRect.d.ts +3 -0
  32. package/dist/functions/browser/getElementRect.js +14 -0
  33. package/dist/functions/browser/getElementRect.js.map +1 -0
  34. package/dist/functions/browser/getFlipPlacements.d.ts +2 -0
  35. package/dist/functions/browser/getFlipPlacements.js +13 -0
  36. package/dist/functions/browser/getFlipPlacements.js.map +1 -0
  37. package/dist/functions/browser/getMainAxisFlip.d.ts +2 -0
  38. package/dist/functions/browser/getMainAxisFlip.js +17 -0
  39. package/dist/functions/browser/getMainAxisFlip.js.map +1 -0
  40. package/dist/functions/browser/getRelativePosition.d.ts +3 -0
  41. package/dist/functions/browser/getRelativePosition.js +14 -0
  42. package/dist/functions/browser/getRelativePosition.js.map +1 -0
  43. package/dist/functions/browser/getViewportRect.d.ts +7 -0
  44. package/dist/functions/browser/getViewportRect.js +15 -0
  45. package/dist/functions/browser/getViewportRect.js.map +1 -0
  46. package/dist/functions/browser/isValidPlacement.d.ts +2 -0
  47. package/dist/functions/browser/isValidPlacement.js +16 -0
  48. package/dist/functions/browser/isValidPlacement.js.map +1 -0
  49. package/dist/functions/browser/pickFile.d.ts +15 -0
  50. package/dist/functions/browser/pickFile.js +48 -0
  51. package/dist/functions/browser/pickFile.js.map +1 -0
  52. package/dist/functions/build/generateExports.d.ts +26 -0
  53. package/dist/functions/build/generateExports.js +34 -0
  54. package/dist/functions/build/generateExports.js.map +1 -0
  55. package/dist/functions/core/diff/diff.d.ts +25 -0
  56. package/dist/functions/core/diff/diff.js +316 -0
  57. package/dist/functions/core/diff/diff.js.map +1 -0
  58. package/dist/functions/core/diff/vueDiff.d.ts +38 -0
  59. package/dist/functions/core/diff/vueDiff.js +333 -0
  60. package/dist/functions/core/diff/vueDiff.js.map +1 -0
  61. package/dist/functions/core/generator/generatorUtils.d.ts +16 -0
  62. package/dist/functions/core/generator/generatorUtils.js +139 -0
  63. package/dist/functions/core/generator/generatorUtils.js.map +1 -0
  64. package/dist/functions/core/type/isType.d.ts +11 -0
  65. package/dist/functions/core/type/isType.js +30 -0
  66. package/dist/functions/core/type/isType.js.map +1 -0
  67. package/dist/functions/data/array-object/chunk.d.ts +1 -0
  68. package/dist/functions/data/array-object/chunk.js +11 -0
  69. package/dist/functions/data/array-object/chunk.js.map +1 -0
  70. package/dist/functions/data/array-object/deepClone.d.ts +12 -0
  71. package/dist/functions/data/array-object/deepClone.js +131 -0
  72. package/dist/functions/data/array-object/deepClone.js.map +1 -0
  73. package/dist/functions/data/array-object/evolve.d.ts +3 -0
  74. package/dist/functions/data/array-object/evolve.js +15 -0
  75. package/dist/functions/data/array-object/evolve.js.map +1 -0
  76. package/dist/functions/data/array-object/flatten.d.ts +7 -0
  77. package/dist/functions/data/array-object/flatten.js +60 -0
  78. package/dist/functions/data/array-object/flatten.js.map +1 -0
  79. package/dist/functions/data/array-object/flattenObject.d.ts +5 -0
  80. package/dist/functions/data/array-object/flattenObject.js +102 -0
  81. package/dist/functions/data/array-object/flattenObject.js.map +1 -0
  82. package/dist/functions/data/array-object/groupBy.d.ts +1 -0
  83. package/dist/functions/data/array-object/groupBy.js +14 -0
  84. package/dist/functions/data/array-object/groupBy.js.map +1 -0
  85. package/dist/functions/data/array-object/omit.d.ts +1 -0
  86. package/dist/functions/data/array-object/omit.js +8 -0
  87. package/dist/functions/data/array-object/omit.js.map +1 -0
  88. package/dist/functions/data/array-object/pick.d.ts +1 -0
  89. package/dist/functions/data/array-object/pick.js +10 -0
  90. package/dist/functions/data/array-object/pick.js.map +1 -0
  91. package/dist/functions/data/array-object/shuffle.d.ts +1 -0
  92. package/dist/functions/data/array-object/shuffle.js +9 -0
  93. package/dist/functions/data/array-object/shuffle.js.map +1 -0
  94. package/dist/functions/data/array-object/sortBy.d.ts +1 -0
  95. package/dist/functions/data/array-object/sortBy.js +13 -0
  96. package/dist/functions/data/array-object/sortBy.js.map +1 -0
  97. package/dist/functions/data/array-object/unique.d.ts +10 -0
  98. package/dist/functions/data/array-object/unique.js +85 -0
  99. package/dist/functions/data/array-object/unique.js.map +1 -0
  100. package/dist/functions/data/date/dateRange.d.ts +1 -0
  101. package/dist/functions/data/date/dateRange.js +18 -0
  102. package/dist/functions/data/date/dateRange.js.map +1 -0
  103. package/dist/functions/data/date/formatDate.d.ts +1 -0
  104. package/dist/functions/data/date/formatDate.js +21 -0
  105. package/dist/functions/data/date/formatDate.js.map +1 -0
  106. package/dist/functions/data/date/timeAgo.d.ts +1 -0
  107. package/dist/functions/data/date/timeAgo.js +49 -0
  108. package/dist/functions/data/date/timeAgo.js.map +1 -0
  109. package/dist/functions/data/number/average.d.ts +1 -0
  110. package/dist/functions/data/number/average.js +8 -0
  111. package/dist/functions/data/number/average.js.map +1 -0
  112. package/dist/functions/data/number/clamp.d.ts +1 -0
  113. package/dist/functions/data/number/clamp.js +7 -0
  114. package/dist/functions/data/number/clamp.js.map +1 -0
  115. package/dist/functions/data/number/formatNumber.d.ts +8 -0
  116. package/dist/functions/data/number/formatNumber.js +16 -0
  117. package/dist/functions/data/number/formatNumber.js.map +1 -0
  118. package/dist/functions/data/number/median.d.ts +1 -0
  119. package/dist/functions/data/number/median.js +14 -0
  120. package/dist/functions/data/number/median.js.map +1 -0
  121. package/dist/functions/data/number/percentile.d.ts +1 -0
  122. package/dist/functions/data/number/percentile.js +18 -0
  123. package/dist/functions/data/number/percentile.js.map +1 -0
  124. package/dist/functions/data/number/random.d.ts +4 -0
  125. package/dist/functions/data/number/random.js +9 -0
  126. package/dist/functions/data/number/random.js.map +1 -0
  127. package/dist/functions/data/number/range.d.ts +1 -0
  128. package/dist/functions/data/number/range.js +18 -0
  129. package/dist/functions/data/number/range.js.map +1 -0
  130. package/dist/functions/data/number/sum.d.ts +1 -0
  131. package/dist/functions/data/number/sum.js +4 -0
  132. package/dist/functions/data/number/sum.js.map +1 -0
  133. package/dist/functions/data/randomRegion.d.ts +24 -0
  134. package/dist/functions/data/randomRegion.js +74 -0
  135. package/dist/functions/data/randomRegion.js.map +1 -0
  136. package/dist/functions/data/string/base64.d.ts +5 -0
  137. package/dist/functions/data/string/base64.js +6 -0
  138. package/dist/functions/data/string/base64.js.map +1 -0
  139. package/dist/functions/data/string/capitalize.d.ts +1 -0
  140. package/dist/functions/data/string/capitalize.js +6 -0
  141. package/dist/functions/data/string/capitalize.js.map +1 -0
  142. package/dist/functions/data/string/caseConverter.d.ts +19 -0
  143. package/dist/functions/data/string/caseConverter.js +94 -0
  144. package/dist/functions/data/string/caseConverter.js.map +1 -0
  145. package/dist/functions/data/string/desensitize.d.ts +13 -0
  146. package/dist/functions/data/string/desensitize.js +107 -0
  147. package/dist/functions/data/string/desensitize.js.map +1 -0
  148. package/dist/functions/data/string/htmlEscape.d.ts +20 -0
  149. package/dist/functions/data/string/htmlEscape.js +80 -0
  150. package/dist/functions/data/string/htmlEscape.js.map +1 -0
  151. package/dist/functions/data/string/levenshtein.d.ts +1 -0
  152. package/dist/functions/data/string/levenshtein.js +27 -0
  153. package/dist/functions/data/string/levenshtein.js.map +1 -0
  154. package/dist/functions/data/string/normalize.d.ts +8 -0
  155. package/dist/functions/data/string/normalize.js +37 -0
  156. package/dist/functions/data/string/normalize.js.map +1 -0
  157. package/dist/functions/data/string/pad.d.ts +13 -0
  158. package/dist/functions/data/string/pad.js +50 -0
  159. package/dist/functions/data/string/pad.js.map +1 -0
  160. package/dist/functions/data/string/palindrome.d.ts +3 -0
  161. package/dist/functions/data/string/palindrome.js +15 -0
  162. package/dist/functions/data/string/palindrome.js.map +1 -0
  163. package/dist/functions/data/string/similarity.d.ts +1 -0
  164. package/dist/functions/data/string/similarity.js +13 -0
  165. package/dist/functions/data/string/similarity.js.map +1 -0
  166. package/dist/functions/data/string/template.d.ts +4 -0
  167. package/dist/functions/data/string/template.js +21 -0
  168. package/dist/functions/data/string/template.js.map +1 -0
  169. package/dist/functions/data/string/testRegex.d.ts +20 -0
  170. package/dist/functions/data/string/testRegex.js +300 -0
  171. package/dist/functions/data/string/testRegex.js.map +1 -0
  172. package/dist/functions/data/string/wordCount.d.ts +5 -0
  173. package/dist/functions/data/string/wordCount.js +11 -0
  174. package/dist/functions/data/string/wordCount.js.map +1 -0
  175. package/dist/functions/data/tree/buildTree.d.ts +7 -0
  176. package/dist/functions/data/tree/buildTree.js +27 -0
  177. package/dist/functions/data/tree/buildTree.js.map +1 -0
  178. package/dist/functions/data/tree/filterTree.d.ts +4 -0
  179. package/dist/functions/data/tree/filterTree.js +21 -0
  180. package/dist/functions/data/tree/filterTree.js.map +1 -0
  181. package/dist/functions/data/tree/findNode.d.ts +4 -0
  182. package/dist/functions/data/tree/findNode.js +21 -0
  183. package/dist/functions/data/tree/findNode.js.map +1 -0
  184. package/dist/functions/data/tree/flattenTree.d.ts +6 -0
  185. package/dist/functions/data/tree/flattenTree.js +21 -0
  186. package/dist/functions/data/tree/flattenTree.js.map +1 -0
  187. package/dist/functions/file/walk.d.ts +18 -0
  188. package/dist/functions/file/walk.js +58 -0
  189. package/dist/functions/file/walk.js.map +1 -0
  190. package/dist/functions/integrations/ag-grid/generateLicense.d.ts +7 -0
  191. package/dist/functions/integrations/ag-grid/generateLicense.js +12 -0
  192. package/dist/functions/integrations/ag-grid/generateLicense.js.map +1 -0
  193. package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.d.ts +30 -0
  194. package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js +884 -0
  195. package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js.map +1 -0
  196. package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.d.ts +31 -0
  197. package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js +900 -0
  198. package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js.map +1 -0
  199. package/dist/functions/integrations/uniapp/build.d.ts +21 -0
  200. package/dist/functions/integrations/uniapp/build.js +83 -0
  201. package/dist/functions/integrations/uniapp/build.js.map +1 -0
  202. package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.d.ts +11 -0
  203. package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js +30 -0
  204. package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js.map +1 -0
  205. package/dist/functions/integrations/uniapp/detectProjectType.d.ts +20 -0
  206. package/dist/functions/integrations/uniapp/detectProjectType.js +68 -0
  207. package/dist/functions/integrations/uniapp/detectProjectType.js.map +1 -0
  208. package/dist/functions/integrations/uniapp/parseManifest.d.ts +20 -0
  209. package/dist/functions/integrations/uniapp/parseManifest.js +51 -0
  210. package/dist/functions/integrations/uniapp/parseManifest.js.map +1 -0
  211. package/dist/functions/integrations/uniapp/waitForPages.d.ts +7 -0
  212. package/dist/functions/integrations/uniapp/waitForPages.js +20 -0
  213. package/dist/functions/integrations/uniapp/waitForPages.js.map +1 -0
  214. package/dist/functions/integrations/vue/dynamicMount.d.ts +18 -0
  215. package/dist/functions/integrations/vue/dynamicMount.js +25 -0
  216. package/dist/functions/integrations/vue/dynamicMount.js.map +1 -0
  217. package/dist/functions/integrations/vue/extractColorsFromVueFile.d.ts +3 -0
  218. package/dist/functions/integrations/vue/extractColorsFromVueFile.js +18 -0
  219. package/dist/functions/integrations/vue/extractColorsFromVueFile.js.map +1 -0
  220. package/dist/functions/integrations/vue/extractColorsFromVueSection.d.ts +3 -0
  221. package/dist/functions/integrations/vue/extractColorsFromVueSection.js +53 -0
  222. package/dist/functions/integrations/vue/extractColorsFromVueSection.js.map +1 -0
  223. package/dist/functions/integrations/vue/filterSections.d.ts +2 -0
  224. package/dist/functions/integrations/vue/filterSections.js +11 -0
  225. package/dist/functions/integrations/vue/filterSections.js.map +1 -0
  226. package/dist/functions/integrations/vue/isVNode.d.ts +2 -0
  227. package/dist/functions/integrations/vue/isVNode.js +6 -0
  228. package/dist/functions/integrations/vue/isVNode.js.map +1 -0
  229. package/dist/functions/integrations/vue/isVueComponent.d.ts +2 -0
  230. package/dist/functions/integrations/vue/isVueComponent.js +6 -0
  231. package/dist/functions/integrations/vue/isVueComponent.js.map +1 -0
  232. package/dist/functions/integrations/vue/parseVueFile.d.ts +2 -0
  233. package/dist/functions/integrations/vue/parseVueFile.js +53 -0
  234. package/dist/functions/integrations/vue/parseVueFile.js.map +1 -0
  235. package/dist/functions/integrations/wechat/miniapp/downloadFile.d.ts +6 -0
  236. package/dist/functions/integrations/wechat/miniapp/downloadFile.js +39 -0
  237. package/dist/functions/integrations/wechat/miniapp/downloadFile.js.map +1 -0
  238. package/dist/functions/ios/integrateCameraGallery.d.ts +16 -0
  239. package/dist/functions/ios/integrateCameraGallery.js +95 -0
  240. package/dist/functions/ios/integrateCameraGallery.js.map +1 -0
  241. package/dist/functions/ios/integrateThirdPartyModule.d.ts +5 -0
  242. package/dist/functions/ios/integrateThirdPartyModule.js +99 -0
  243. package/dist/functions/ios/integrateThirdPartyModule.js.map +1 -1
  244. package/dist/functions/patterns/MyPromise.d.ts +32 -0
  245. package/dist/functions/patterns/MyPromise.js +254 -0
  246. package/dist/functions/patterns/MyPromise.js.map +1 -0
  247. package/dist/functions/patterns/functionBind.d.ts +4 -0
  248. package/dist/functions/patterns/functionBind.js +33 -0
  249. package/dist/functions/patterns/functionBind.js.map +1 -0
  250. package/dist/functions/patterns/myInstanceof.d.ts +5 -0
  251. package/dist/functions/patterns/myInstanceof.js +56 -0
  252. package/dist/functions/patterns/myInstanceof.js.map +1 -0
  253. package/dist/functions/patterns/myNew.d.ts +3 -0
  254. package/dist/functions/patterns/myNew.js +19 -0
  255. package/dist/functions/patterns/myNew.js.map +1 -0
  256. package/dist/functions/platform/android/buildProject.d.ts +13 -0
  257. package/dist/functions/platform/android/buildProject.js +122 -0
  258. package/dist/functions/platform/android/buildProject.js.map +1 -0
  259. package/dist/functions/platform/android/configureAppIcon.d.ts +17 -0
  260. package/dist/functions/platform/android/configureAppIcon.js +106 -0
  261. package/dist/functions/platform/android/configureAppIcon.js.map +1 -0
  262. package/dist/functions/platform/android/configureLaunchScreen.d.ts +21 -0
  263. package/dist/functions/platform/android/configureLaunchScreen.js +328 -0
  264. package/dist/functions/platform/android/configureLaunchScreen.js.map +1 -0
  265. package/dist/functions/platform/android/detectAndroidModules.d.ts +8 -0
  266. package/dist/functions/platform/android/detectAndroidModules.js +21 -0
  267. package/dist/functions/platform/android/detectAndroidModules.js.map +1 -0
  268. package/dist/functions/platform/android/integrateFacebookLogin.d.ts +12 -0
  269. package/dist/functions/platform/android/integrateFacebookLogin.js +91 -0
  270. package/dist/functions/platform/android/integrateFacebookLogin.js.map +1 -0
  271. package/dist/functions/platform/android/integrateGoogleLogin.d.ts +10 -0
  272. package/dist/functions/platform/android/integrateGoogleLogin.js +199 -0
  273. package/dist/functions/platform/android/integrateGoogleLogin.js.map +1 -0
  274. package/dist/functions/platform/android/integrateMiuiLogin.d.ts +13 -0
  275. package/dist/functions/platform/android/integrateMiuiLogin.js +115 -0
  276. package/dist/functions/platform/android/integrateMiuiLogin.js.map +1 -0
  277. package/dist/functions/platform/android/integrateQQLogin.d.ts +12 -0
  278. package/dist/functions/platform/android/integrateQQLogin.js +130 -0
  279. package/dist/functions/platform/android/integrateQQLogin.js.map +1 -0
  280. package/dist/functions/platform/android/integrateShareTrace.d.ts +10 -0
  281. package/dist/functions/platform/android/integrateShareTrace.js +181 -0
  282. package/dist/functions/platform/android/integrateShareTrace.js.map +1 -0
  283. package/dist/functions/platform/android/integrateSinaLogin.d.ts +13 -0
  284. package/dist/functions/platform/android/integrateSinaLogin.js +85 -0
  285. package/dist/functions/platform/android/integrateSinaLogin.js.map +1 -0
  286. package/dist/functions/platform/android/integrateThirdPartyModule.d.ts +46 -0
  287. package/dist/functions/platform/android/integrateThirdPartyModule.js +251 -0
  288. package/dist/functions/platform/android/integrateThirdPartyModule.js.map +1 -0
  289. package/dist/functions/platform/android/integrateUniAppNativePlugin.d.ts +22 -0
  290. package/dist/functions/platform/android/integrateUniAppNativePlugin.js +631 -0
  291. package/dist/functions/platform/android/integrateUniAppNativePlugin.js.map +1 -0
  292. package/dist/functions/platform/android/integrateUniverifyLogin.d.ts +11 -0
  293. package/dist/functions/platform/android/integrateUniverifyLogin.js +314 -0
  294. package/dist/functions/platform/android/integrateUniverifyLogin.js.map +1 -0
  295. package/dist/functions/platform/android/integrateWechatLogin.d.ts +13 -0
  296. package/dist/functions/platform/android/integrateWechatLogin.js +154 -0
  297. package/dist/functions/platform/android/integrateWechatLogin.js.map +1 -0
  298. package/dist/functions/platform/android/integrateWechatShare.d.ts +13 -0
  299. package/dist/functions/platform/android/integrateWechatShare.js +154 -0
  300. package/dist/functions/platform/android/integrateWechatShare.js.map +1 -0
  301. package/dist/functions/platform/android/modifyGradle.d.ts +28 -0
  302. package/dist/functions/platform/android/modifyGradle.js +119 -0
  303. package/dist/functions/platform/android/modifyGradle.js.map +1 -0
  304. package/dist/functions/platform/android/modifyManifest.d.ts +39 -0
  305. package/dist/functions/platform/android/modifyManifest.js +225 -0
  306. package/dist/functions/platform/android/modifyManifest.js.map +1 -0
  307. package/dist/functions/platform/android/permission.d.ts +54 -0
  308. package/dist/functions/platform/android/permission.js +85 -0
  309. package/dist/functions/platform/android/permission.js.map +1 -0
  310. package/dist/functions/platform/ios/configureAppIcon.d.ts +17 -0
  311. package/dist/functions/platform/ios/configureAppIcon.js +149 -0
  312. package/dist/functions/platform/ios/configureAppIcon.js.map +1 -0
  313. package/dist/functions/platform/ios/configureLaunchScreen.d.ts +17 -0
  314. package/dist/functions/platform/ios/configureLaunchScreen.js +150 -0
  315. package/dist/functions/platform/ios/configureLaunchScreen.js.map +1 -0
  316. package/dist/functions/platform/ios/configurePermissions.d.ts +19 -0
  317. package/dist/functions/platform/ios/configurePermissions.js +120 -0
  318. package/dist/functions/platform/ios/configurePermissions.js.map +1 -0
  319. package/dist/functions/platform/ios/integrateNativePlugin.d.ts +35 -0
  320. package/dist/functions/platform/ios/integrateNativePlugin.js +994 -0
  321. package/dist/functions/platform/ios/integrateNativePlugin.js.map +1 -0
  322. package/dist/functions/platform/ios/integrateQQShare.d.ts +14 -0
  323. package/dist/functions/platform/ios/integrateQQShare.js +132 -0
  324. package/dist/functions/platform/ios/integrateQQShare.js.map +1 -0
  325. package/dist/functions/platform/ios/integrateSinaShare.d.ts +16 -0
  326. package/dist/functions/platform/ios/integrateSinaShare.js +108 -0
  327. package/dist/functions/platform/ios/integrateSinaShare.js.map +1 -0
  328. package/dist/functions/platform/ios/integrateThirdPartyModule.d.ts +62 -0
  329. package/dist/functions/platform/ios/integrateThirdPartyModule.js +883 -0
  330. package/dist/functions/platform/ios/integrateThirdPartyModule.js.map +1 -0
  331. package/dist/functions/platform/ios/integrateWechatOauth.d.ts +14 -0
  332. package/dist/functions/platform/ios/integrateWechatOauth.js +107 -0
  333. package/dist/functions/platform/ios/integrateWechatOauth.js.map +1 -0
  334. package/dist/functions/platform/ios/integrateWechatShare.d.ts +14 -0
  335. package/dist/functions/platform/ios/integrateWechatShare.js +101 -0
  336. package/dist/functions/platform/ios/integrateWechatShare.js.map +1 -0
  337. package/dist/functions/platform/ios/modifyInfoPlistKeyValue.d.ts +2 -0
  338. package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js +45 -0
  339. package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js.map +1 -0
  340. package/dist/functions/platform/ios/safelyModifyProjectPbxproj.d.ts +16 -0
  341. package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js +136 -0
  342. package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js.map +1 -0
  343. package/dist/functions/platform/ios/useAltool.d.ts +39 -0
  344. package/dist/functions/platform/ios/useAltool.js +350 -0
  345. package/dist/functions/platform/ios/useAltool.js.map +1 -0
  346. package/dist/functions/style/buildTokens.d.ts +76 -0
  347. package/dist/functions/style/buildTokens.js +183 -0
  348. package/dist/functions/style/buildTokens.js.map +1 -0
  349. package/dist/functions/style/extractCssVariables.d.ts +16 -0
  350. package/dist/functions/style/extractCssVariables.js +256 -0
  351. package/dist/functions/style/extractCssVariables.js.map +1 -0
  352. package/dist/functions/style/generateVariables.d.ts +7 -0
  353. package/dist/functions/style/generateVariables.js +135 -0
  354. package/dist/functions/style/generateVariables.js.map +1 -0
  355. package/dist/functions/style/mixColors.d.ts +1 -0
  356. package/dist/functions/style/mixColors.js +38 -0
  357. package/dist/functions/style/mixColors.js.map +1 -0
  358. package/dist/functions/style/parseDesignTokens.d.ts +10 -0
  359. package/dist/functions/style/parseDesignTokens.js +216 -0
  360. package/dist/functions/style/parseDesignTokens.js.map +1 -0
  361. package/dist/functions/uniapp/app-plus/buildIOSApp.js +36 -0
  362. package/dist/functions/uniapp/app-plus/buildIOSApp.js.map +1 -1
  363. package/dist/functions/uniapp/camera/showCamera.d.ts +11 -0
  364. package/dist/functions/uniapp/camera/showCamera.js +22 -0
  365. package/dist/functions/uniapp/camera/showCamera.js.map +1 -0
  366. package/dist/functions/uniapp/customer-service/adapters/openCustomerServiceInMiniapp.d.ts +23 -0
  367. package/dist/functions/uniapp/customer-service/adapters/openCustomerServiceInMiniapp.js +69 -0
  368. package/dist/functions/uniapp/customer-service/adapters/openCustomerServiceInMiniapp.js.map +1 -0
  369. package/dist/functions/uniapp/customer-service/showWxCustomerService.d.ts +28 -0
  370. package/dist/functions/uniapp/customer-service/showWxCustomerService.js +25 -0
  371. package/dist/functions/uniapp/customer-service/showWxCustomerService.js.map +1 -0
  372. package/dist/functions/uniapp/file/adapters/readWriteFileInApp.d.ts +10 -0
  373. package/dist/functions/uniapp/file/adapters/readWriteFileInApp.js +97 -0
  374. package/dist/functions/uniapp/file/adapters/readWriteFileInApp.js.map +1 -0
  375. package/dist/functions/uniapp/file/adapters/readWriteFileInH5.d.ts +30 -0
  376. package/dist/functions/uniapp/file/adapters/readWriteFileInH5.js +83 -0
  377. package/dist/functions/uniapp/file/adapters/readWriteFileInH5.js.map +1 -0
  378. package/dist/functions/uniapp/file/adapters/readWriteFileInMiniapp.d.ts +10 -0
  379. package/dist/functions/uniapp/file/adapters/readWriteFileInMiniapp.js +97 -0
  380. package/dist/functions/uniapp/file/adapters/readWriteFileInMiniapp.js.map +1 -0
  381. package/dist/functions/uniapp/file/showFile.d.ts +35 -0
  382. package/dist/functions/uniapp/file/showFile.js +66 -0
  383. package/dist/functions/uniapp/file/showFile.js.map +1 -0
  384. package/dist/functions/uniapp/image/adapters/chooseImageInApp.d.ts +9 -0
  385. package/dist/functions/uniapp/image/adapters/chooseImageInApp.js +52 -0
  386. package/dist/functions/uniapp/image/adapters/chooseImageInApp.js.map +1 -0
  387. package/dist/functions/uniapp/image/adapters/chooseImageInH5.d.ts +9 -0
  388. package/dist/functions/uniapp/image/adapters/chooseImageInH5.js +52 -0
  389. package/dist/functions/uniapp/image/adapters/chooseImageInH5.js.map +1 -0
  390. package/dist/functions/uniapp/image/adapters/chooseImageInMiniapp.d.ts +9 -0
  391. package/dist/functions/uniapp/image/adapters/chooseImageInMiniapp.js +52 -0
  392. package/dist/functions/uniapp/image/adapters/chooseImageInMiniapp.js.map +1 -0
  393. package/dist/functions/uniapp/image/showImage.d.ts +11 -0
  394. package/dist/functions/uniapp/image/showImage.js +23 -0
  395. package/dist/functions/uniapp/image/showImage.js.map +1 -0
  396. package/dist/functions/uniapp/login/adapters/wechatLoginInApp.d.ts +10 -0
  397. package/dist/functions/uniapp/login/adapters/wechatLoginInApp.js +49 -0
  398. package/dist/functions/uniapp/login/adapters/wechatLoginInApp.js.map +1 -0
  399. package/dist/functions/uniapp/login/adapters/wechatLoginInMiniapp.d.ts +9 -0
  400. package/dist/functions/uniapp/login/adapters/wechatLoginInMiniapp.js +27 -0
  401. package/dist/functions/uniapp/login/adapters/wechatLoginInMiniapp.js.map +1 -0
  402. package/dist/functions/uniapp/login/showLogin.d.ts +13 -0
  403. package/dist/functions/uniapp/login/showLogin.js +43 -0
  404. package/dist/functions/uniapp/login/showLogin.js.map +1 -0
  405. package/dist/functions/uniapp/pay/adapters/wechatPayInApp.d.ts +8 -0
  406. package/dist/functions/uniapp/pay/adapters/wechatPayInApp.js +36 -0
  407. package/dist/functions/uniapp/pay/adapters/wechatPayInApp.js.map +1 -0
  408. package/dist/functions/uniapp/pay/adapters/wechatPayInH5.d.ts +13 -0
  409. package/dist/functions/uniapp/pay/adapters/wechatPayInH5.js +44 -0
  410. package/dist/functions/uniapp/pay/adapters/wechatPayInH5.js.map +1 -0
  411. package/dist/functions/uniapp/pay/adapters/wechatPayInMiniapp.d.ts +8 -0
  412. package/dist/functions/uniapp/pay/adapters/wechatPayInMiniapp.js +37 -0
  413. package/dist/functions/uniapp/pay/adapters/wechatPayInMiniapp.js.map +1 -0
  414. package/dist/functions/uniapp/pay/showPay.d.ts +18 -0
  415. package/dist/functions/uniapp/pay/showPay.js +60 -0
  416. package/dist/functions/uniapp/pay/showPay.js.map +1 -0
  417. package/dist/functions/uniapp/phone/adapters/getPhoneInMiniapp.d.ts +6 -0
  418. package/dist/functions/uniapp/phone/adapters/getPhoneInMiniapp.js +41 -0
  419. package/dist/functions/uniapp/phone/adapters/getPhoneInMiniapp.js.map +1 -0
  420. package/dist/functions/uniapp/phone/showWxPhone.d.ts +8 -0
  421. package/dist/functions/uniapp/phone/showWxPhone.js +25 -0
  422. package/dist/functions/uniapp/phone/showWxPhone.js.map +1 -0
  423. package/dist/functions/uniapp/record/adapters/recordInApp.d.ts +12 -0
  424. package/dist/functions/uniapp/record/adapters/recordInApp.js +64 -0
  425. package/dist/functions/uniapp/record/adapters/recordInApp.js.map +1 -0
  426. package/dist/functions/uniapp/record/adapters/recordInH5.d.ts +21 -0
  427. package/dist/functions/uniapp/record/adapters/recordInH5.js +82 -0
  428. package/dist/functions/uniapp/record/adapters/recordInH5.js.map +1 -0
  429. package/dist/functions/uniapp/record/adapters/recordInMiniapp.d.ts +12 -0
  430. package/dist/functions/uniapp/record/adapters/recordInMiniapp.js +64 -0
  431. package/dist/functions/uniapp/record/adapters/recordInMiniapp.js.map +1 -0
  432. package/dist/functions/uniapp/record/showRecord.d.ts +23 -0
  433. package/dist/functions/uniapp/record/showRecord.js +95 -0
  434. package/dist/functions/uniapp/record/showRecord.js.map +1 -0
  435. package/dist/functions/uniapp/scan-code/adapters/scanCodeInApp.d.ts +9 -0
  436. package/dist/functions/uniapp/scan-code/adapters/scanCodeInApp.js +30 -0
  437. package/dist/functions/uniapp/scan-code/adapters/scanCodeInApp.js.map +1 -0
  438. package/dist/functions/uniapp/scan-code/adapters/scanCodeInMiniapp.d.ts +9 -0
  439. package/dist/functions/uniapp/scan-code/adapters/scanCodeInMiniapp.js +30 -0
  440. package/dist/functions/uniapp/scan-code/adapters/scanCodeInMiniapp.js.map +1 -0
  441. package/dist/functions/uniapp/scan-code/showScanCode.d.ts +12 -0
  442. package/dist/functions/uniapp/scan-code/showScanCode.js +28 -0
  443. package/dist/functions/uniapp/scan-code/showScanCode.js.map +1 -0
  444. package/dist/functions/uniapp/subscribe-message/adapters/wechatSubscribeMessageInMiniapp.d.ts +9 -0
  445. package/dist/functions/uniapp/subscribe-message/adapters/wechatSubscribeMessageInMiniapp.js +41 -0
  446. package/dist/functions/uniapp/subscribe-message/adapters/wechatSubscribeMessageInMiniapp.js.map +1 -0
  447. package/dist/functions/uniapp/subscribe-message/showWxSubscribeMessage.d.ts +11 -0
  448. package/dist/functions/uniapp/subscribe-message/showWxSubscribeMessage.js +25 -0
  449. package/dist/functions/uniapp/subscribe-message/showWxSubscribeMessage.js.map +1 -0
  450. package/dist/functions/uniapp/user-info/wxGetUserInfo.d.ts +43 -0
  451. package/dist/functions/uniapp/user-info/wxGetUserInfo.js +55 -0
  452. package/dist/functions/uniapp/user-info/wxGetUserInfo.js.map +1 -0
  453. package/dist/functions/uniapp/video/adapters/chooseVideoInApp.d.ts +9 -0
  454. package/dist/functions/uniapp/video/adapters/chooseVideoInApp.js +31 -0
  455. package/dist/functions/uniapp/video/adapters/chooseVideoInApp.js.map +1 -0
  456. package/dist/functions/uniapp/video/adapters/chooseVideoInH5.d.ts +9 -0
  457. package/dist/functions/uniapp/video/adapters/chooseVideoInH5.js +30 -0
  458. package/dist/functions/uniapp/video/adapters/chooseVideoInH5.js.map +1 -0
  459. package/dist/functions/uniapp/video/adapters/chooseVideoInMiniapp.d.ts +9 -0
  460. package/dist/functions/uniapp/video/adapters/chooseVideoInMiniapp.js +31 -0
  461. package/dist/functions/uniapp/video/adapters/chooseVideoInMiniapp.js.map +1 -0
  462. package/dist/functions/uniapp/video/showVideo.d.ts +11 -0
  463. package/dist/functions/uniapp/video/showVideo.js +23 -0
  464. package/dist/functions/uniapp/video/showVideo.js.map +1 -0
  465. package/dist/functions/validation/parseJwtPayload.d.ts +7 -0
  466. package/dist/functions/validation/parseJwtPayload.js +33 -0
  467. package/dist/functions/validation/parseJwtPayload.js.map +1 -0
  468. package/dist/functions/validation/validate.d.ts +11 -0
  469. package/dist/functions/validation/validate.js +44 -0
  470. package/dist/functions/validation/validate.js.map +1 -0
  471. package/dist/vue-hooks/browser/useBridgeMessage.d.ts +2 -1
  472. package/dist/vue-hooks/browser/useBridgeMessage.js +13 -11
  473. package/dist/vue-hooks/browser/useBridgeMessage.js.map +1 -1
  474. package/package.json +37 -2
  475. package/references/blob.d.ts +2 -0
  476. package/references/device.d.ts +46 -0
  477. package/references/dom.d.ts +6 -0
  478. package/references/uniapp.d.ts +221 -8
  479. package/types/uniapp-ios-build.d.ts +22 -0
  480. package/types/uniapp.d.ts +298 -0
@@ -0,0 +1,884 @@
1
+ import { build } from '../build';
2
+ import { buildProject } from '../../android/buildProject';
3
+ import { modifyManifest } from '../../android/modifyManifest';
4
+ import { modifyGradle } from '../../android/modifyGradle';
5
+ import { modifyXml } from '../../xml/modifyXml';
6
+ import { detectUniAppAndroidProjectStructure } from '../detectAndroidProjectStructure';
7
+ import { detectAllAndroidModules } from '../../android/detectAndroidModules';
8
+ import { integrateWechatLogin } from '../../android/integrateWechatLogin';
9
+ import { integrateWechatShare } from '../../android/integrateWechatShare';
10
+ import { integrateUniverifyLogin } from '../../android/integrateUniverifyLogin';
11
+ import { integrateQQLogin } from '../../android/integrateQQLogin';
12
+ import { integrateSinaLogin } from '../../android/integrateSinaLogin';
13
+ import { integrateMiuiLogin } from '../../android/integrateMiuiLogin';
14
+ import { integrateGoogleLogin } from '../../android/integrateGoogleLogin';
15
+ import { integrateFacebookLogin } from '../../android/integrateFacebookLogin';
16
+ import { integrateShareTrace } from '../../android/integrateShareTrace';
17
+ import { integrateUniAppNativePlugin } from '../../android/integrateUniAppNativePlugin';
18
+ import { configureLaunchScreenAndroid } from '../../android/configureLaunchScreen';
19
+ import { configureAppIconAndroid } from '../../android/configureAppIcon';
20
+ import { configureManifestPermissions } from '../../android/permission';
21
+ export async function buildAndroidApp(options, deps) {
22
+ const logs = [];
23
+ if (!options.uniappProjectPath) {
24
+ return {
25
+ success: false,
26
+ error: 'uniappProjectPath 是必需的',
27
+ logs
28
+ };
29
+ }
30
+ if (!options.uniAppId) {
31
+ return {
32
+ success: false,
33
+ error: 'uniAppId 是必需的',
34
+ logs
35
+ };
36
+ }
37
+ if (!options.displayName) {
38
+ return {
39
+ success: false,
40
+ error: 'displayName 是必需的',
41
+ logs
42
+ };
43
+ }
44
+ try {
45
+ let sourcePath;
46
+ if (options.uniappBuildOutputPath) {
47
+ logs.push('步骤 2: 使用提供的 UniApp 编译结果路径');
48
+ sourcePath = options.uniappBuildOutputPath;
49
+ if (!deps.existsSync(sourcePath)) {
50
+ return {
51
+ success: false,
52
+ error: `提供的编译结果路径不存在: ${sourcePath}`,
53
+ logs
54
+ };
55
+ }
56
+ logs.push(`使用编译结果路径: ${sourcePath}`);
57
+ }
58
+ else {
59
+ logs.push('步骤 2: 构建 UniApp 项目');
60
+ const buildDeps = {
61
+ exec: deps.exec,
62
+ join: deps.join,
63
+ existsSync: deps.existsSync,
64
+ setTimeout: deps.setTimeout
65
+ };
66
+ const uniBuildResult = await build(options.uniappProjectPath, 'app-plus', buildDeps);
67
+ if (!uniBuildResult.success) {
68
+ return {
69
+ success: false,
70
+ error: `构建失败: ${uniBuildResult.error}`,
71
+ logs: [...logs, ...uniBuildResult.logs]
72
+ };
73
+ }
74
+ logs.push(...uniBuildResult.logs);
75
+ sourcePath = deps.join(options.uniappProjectPath, 'dist', 'build', 'app');
76
+ }
77
+ logs.push('步骤 3: 配置 Android 原生工程');
78
+ const projectStructure = detectUniAppAndroidProjectStructure(options.projectPath, {
79
+ existsSync: deps.existsSync,
80
+ join: deps.join
81
+ });
82
+ logs.push(`使用模块目录: ${projectStructure.moduleDir}`);
83
+ logs.push('复制应用资源');
84
+ const targetPath = deps.join(options.projectPath, projectStructure.moduleDir, 'src', 'main', 'assets', 'apps', options.uniAppId, 'www');
85
+ try {
86
+ const targetDir = deps.dirname(targetPath);
87
+ if (!deps.existsSync(targetDir)) {
88
+ deps.mkdirSync(targetDir, { recursive: true });
89
+ }
90
+ await deps.cp(sourcePath, targetPath, { recursive: true, force: true });
91
+ logs.push('应用资源复制完成');
92
+ }
93
+ catch (error) {
94
+ return {
95
+ success: false,
96
+ error: `复制应用资源失败: ${error instanceof Error ? error.message : String(error)}`,
97
+ logs
98
+ };
99
+ }
100
+ logs.push('配置 AndroidManifest.xml');
101
+ const checkElementExists = (manifestPath, xpath) => {
102
+ if (!deps.existsSync(manifestPath))
103
+ return false;
104
+ try {
105
+ const xmlContent = deps.readFileSync(manifestPath, 'utf8');
106
+ const parser = new deps.xmlParser();
107
+ const xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
108
+ const select = deps.xpath.useNamespaces({
109
+ 'android': 'http://schemas.android.com/apk/res/android',
110
+ 'tools': 'http://schemas.android.com/tools'
111
+ });
112
+ const result = select(xpath, xmlDoc);
113
+ return Array.isArray(result) ? result.length > 0 : result !== null && result !== undefined;
114
+ }
115
+ catch {
116
+ return false;
117
+ }
118
+ };
119
+ const checkAttributeExists = (manifestPath, xpath, attrName, attrValue) => {
120
+ if (!deps.existsSync(manifestPath))
121
+ return false;
122
+ try {
123
+ const xmlContent = deps.readFileSync(manifestPath, 'utf8');
124
+ const parser = new deps.xmlParser();
125
+ const xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
126
+ const select = deps.xpath.useNamespaces({
127
+ 'android': 'http://schemas.android.com/apk/res/android',
128
+ 'tools': 'http://schemas.android.com/tools'
129
+ });
130
+ const elements = select(xpath, xmlDoc);
131
+ if (Array.isArray(elements) && elements.length > 0) {
132
+ const element = elements[0];
133
+ const existingValue = element.getAttribute(attrName);
134
+ return existingValue === attrValue;
135
+ }
136
+ return false;
137
+ }
138
+ catch {
139
+ return false;
140
+ }
141
+ };
142
+ const allModules = detectAllAndroidModules(options.projectPath, {
143
+ readdirSync: deps.readdirSync,
144
+ statSync: deps.statSync,
145
+ existsSync: deps.existsSync,
146
+ join: deps.join
147
+ });
148
+ logs.push(`检测到 ${allModules.length} 个Android模块: ${allModules.join(', ')}`);
149
+ let manifestConfigured = false;
150
+ let modulesToProcess;
151
+ if (options.onlyModifyMainModule === true) {
152
+ modulesToProcess = [projectStructure.moduleDir];
153
+ logs.push(`仅修改主应用模块: ${projectStructure.moduleDir}`);
154
+ }
155
+ else {
156
+ modulesToProcess = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
157
+ logs.push(`将修改所有模块: ${modulesToProcess.join(', ')}`);
158
+ }
159
+ for (const moduleDir of modulesToProcess) {
160
+ const manifestPath = deps.join(options.projectPath, moduleDir, 'src', 'main', 'AndroidManifest.xml');
161
+ const moduleModifications = [];
162
+ const shouldFixAndroidNamespace = options.fixAndroidNamespace !== false;
163
+ if (shouldFixAndroidNamespace) {
164
+ if (!checkAttributeExists(manifestPath, "//manifest", 'xmlns:android', 'http://schemas.android.com/apk/res/android')) {
165
+ moduleModifications.push({
166
+ xpath: "//manifest",
167
+ action: 'setAttribute',
168
+ attributeName: 'xmlns:android',
169
+ value: 'http://schemas.android.com/apk/res/android'
170
+ });
171
+ }
172
+ }
173
+ const shouldResolveAllowBackupConflict = options.resolveAllowBackupConflict !== false;
174
+ if (shouldResolveAllowBackupConflict) {
175
+ if (!checkAttributeExists(manifestPath, "//manifest", 'xmlns:tools', 'http://schemas.android.com/tools')) {
176
+ moduleModifications.push({
177
+ xpath: "//manifest",
178
+ action: 'setAttribute',
179
+ attributeName: 'xmlns:tools',
180
+ value: 'http://schemas.android.com/tools'
181
+ });
182
+ }
183
+ if (!checkAttributeExists(manifestPath, "//application", 'tools:replace', 'android:allowBackup')) {
184
+ moduleModifications.push({
185
+ xpath: "//application",
186
+ action: 'setAttribute',
187
+ attributeName: 'tools:replace',
188
+ value: 'android:allowBackup'
189
+ });
190
+ }
191
+ if (!checkAttributeExists(manifestPath, "//application", 'android:allowBackup', 'true')) {
192
+ moduleModifications.push({
193
+ xpath: "//application",
194
+ action: 'setAttribute',
195
+ attributeName: 'android:allowBackup',
196
+ value: 'true'
197
+ });
198
+ }
199
+ }
200
+ if (!checkElementExists(manifestPath, "//meta-data[@android:name='DCLOUD_STREAMAPP_CHANNEL']")) {
201
+ moduleModifications.push({
202
+ xpath: "//application",
203
+ action: 'addElement',
204
+ elementName: 'meta-data',
205
+ attributes: {
206
+ 'android:name': 'DCLOUD_STREAMAPP_CHANNEL',
207
+ 'android:value': 'google'
208
+ }
209
+ });
210
+ }
211
+ if (options.appkey) {
212
+ if (checkElementExists(manifestPath, "//meta-data[@android:name='dcloud_appkey']")) {
213
+ moduleModifications.push({
214
+ xpath: "//meta-data[@android:name='dcloud_appkey']",
215
+ action: 'setAttribute',
216
+ attributeName: 'android:value',
217
+ value: options.appkey
218
+ });
219
+ }
220
+ else {
221
+ moduleModifications.push({
222
+ xpath: "//application",
223
+ action: 'addElement',
224
+ elementName: 'meta-data',
225
+ attributes: {
226
+ 'android:name': 'dcloud_appkey',
227
+ 'android:value': options.appkey
228
+ }
229
+ });
230
+ }
231
+ }
232
+ if (moduleModifications.length > 0) {
233
+ const manifestResult = await modifyManifest(manifestPath, moduleModifications, {
234
+ existsSync: deps.existsSync,
235
+ readFileSync: deps.readFileSync,
236
+ writeFileSync: deps.writeFileSync,
237
+ xmlParser: deps.xmlParser,
238
+ xmlSerializer: deps.xmlSerializer,
239
+ xpath: deps.xpath
240
+ });
241
+ if (manifestResult.success) {
242
+ logs.push(`${moduleDir} 模块的 AndroidManifest.xml 配置完成(应用了 ${moduleModifications.length} 个修改)`);
243
+ manifestConfigured = true;
244
+ }
245
+ else {
246
+ logs.push(`${moduleDir} 模块的 AndroidManifest.xml 配置失败: ${manifestResult.error}`);
247
+ }
248
+ }
249
+ else {
250
+ logs.push(`${moduleDir} 模块的 AndroidManifest.xml 无需修改(所有配置已存在)`);
251
+ manifestConfigured = true;
252
+ }
253
+ }
254
+ if (!manifestConfigured) {
255
+ return {
256
+ success: false,
257
+ error: '未能成功配置任何模块的 AndroidManifest.xml',
258
+ logs
259
+ };
260
+ }
261
+ logs.push('配置 build.gradle');
262
+ const buildGradlePath = deps.join(options.projectPath, projectStructure.moduleDir, 'build.gradle');
263
+ const gradleDependencies = [];
264
+ if (options.buildCustomBase) {
265
+ gradleDependencies.push('com.alibaba:fastjson:1.2.83');
266
+ gradleDependencies.push('com.squareup.okhttp3:okhttp:3.12.12');
267
+ gradleDependencies.push('net.lingala.zip4j:zip4j:2.11.5');
268
+ logs.push('自定义基座模式:将添加 fastjson、okhttp3 和 zip4j 依赖');
269
+ }
270
+ const gradleResult = await modifyGradle(buildGradlePath, {
271
+ applicationId: options.applicationId,
272
+ versionName: '1.0.0',
273
+ versionCode: 1,
274
+ targetSdkVersion: options.targetSdkVersion,
275
+ signing: options.signing ? {
276
+ keystore: options.signing.keystorePath,
277
+ keystorePassword: options.signing.keystorePassword,
278
+ keyAlias: options.signing.keyAlias,
279
+ keyPassword: options.signing.keyPassword
280
+ } : undefined,
281
+ dependencies: gradleDependencies.length > 0 ? gradleDependencies : undefined
282
+ }, {
283
+ existsSync: deps.existsSync,
284
+ readFileSync: deps.readFileSync,
285
+ writeFileSync: deps.writeFileSync,
286
+ copyFileSync: deps.copyFileSync,
287
+ join: deps.join,
288
+ dirname: deps.dirname,
289
+ basename: deps.basename
290
+ });
291
+ if (!gradleResult.success) {
292
+ return {
293
+ success: false,
294
+ error: `配置 build.gradle 失败: ${gradleResult.error}`,
295
+ logs
296
+ };
297
+ }
298
+ logs.push('build.gradle 配置完成');
299
+ if (options.displayName) {
300
+ logs.push('配置 strings.xml');
301
+ const stringsXmlPath = deps.join(options.projectPath, projectStructure.moduleDir, 'src', 'main', 'res', 'values', 'strings.xml');
302
+ const stringsResult = await modifyXml(stringsXmlPath, {
303
+ app_name: options.displayName
304
+ }, {
305
+ tagName: 'string',
306
+ matchAttribute: 'name',
307
+ modifyType: 'textContent'
308
+ }, {
309
+ existsSync: deps.existsSync,
310
+ readFileSync: deps.readFileSync,
311
+ writeFileSync: deps.writeFileSync,
312
+ xmlParser: deps.xmlParser,
313
+ xmlSerializer: deps.xmlSerializer
314
+ });
315
+ if (stringsResult.success) {
316
+ logs.push('strings.xml 配置完成');
317
+ }
318
+ else {
319
+ logs.push(`strings.xml 配置失败: ${stringsResult.error}`);
320
+ }
321
+ }
322
+ if (options.launchScreenPath) {
323
+ logs.push('配置 Android 启动屏');
324
+ if (!deps.sharp) {
325
+ logs.push('警告: 未提供 sharp 依赖,跳过启动屏配置。请安装 sharp 并在 deps 中传入。');
326
+ }
327
+ else {
328
+ const launchScreenResult = await configureLaunchScreenAndroid(options.launchScreenPath, options.projectPath, projectStructure.moduleDir, {
329
+ existsSync: deps.existsSync,
330
+ readFileSync: deps.readFileSync,
331
+ writeFileSync: deps.writeFileSync,
332
+ mkdirSync: deps.mkdirSync,
333
+ join: deps.join,
334
+ dirname: deps.dirname,
335
+ sharp: deps.sharp
336
+ }, {
337
+ splashBackgroundColor: options.splashBackgroundColor,
338
+ splashIconPath: options.splashIconPath
339
+ });
340
+ if (launchScreenResult.success) {
341
+ logs.push('Android 启动屏配置完成');
342
+ logs.push(...launchScreenResult.logs);
343
+ }
344
+ else {
345
+ logs.push(`Android 启动屏配置失败: ${launchScreenResult.error}`);
346
+ logs.push(...launchScreenResult.logs);
347
+ }
348
+ }
349
+ }
350
+ if (options.appIconPath) {
351
+ logs.push('配置 Android 应用图标');
352
+ if (!deps.sharp) {
353
+ logs.push('警告: 未提供 sharp 依赖,跳过应用图标配置。请安装 sharp 并在 deps 中传入。');
354
+ }
355
+ else if (!deps.Buffer) {
356
+ logs.push('警告: 未提供 Buffer 依赖,跳过应用图标配置');
357
+ }
358
+ else {
359
+ const appIconResult = await configureAppIconAndroid(options.appIconPath, options.projectPath, projectStructure.moduleDir, {
360
+ existsSync: deps.existsSync,
361
+ readFileSync: deps.readFileSync,
362
+ writeFileSync: deps.writeFileSync,
363
+ mkdirSync: deps.mkdirSync,
364
+ join: deps.join,
365
+ sharp: deps.sharp,
366
+ Buffer: deps.Buffer
367
+ });
368
+ if (appIconResult.success) {
369
+ logs.push('Android 应用图标配置完成');
370
+ logs.push(...appIconResult.logs);
371
+ }
372
+ else {
373
+ logs.push(`Android 应用图标配置失败: ${appIconResult.error}`);
374
+ logs.push(...appIconResult.logs);
375
+ }
376
+ }
377
+ }
378
+ if (options.permissions && options.permissions.length > 0) {
379
+ logs.push('配置 Android 权限');
380
+ const mainManifestPath = deps.join(options.projectPath, projectStructure.moduleDir, 'src', 'main', 'AndroidManifest.xml');
381
+ const permissionResult = await configureManifestPermissions(mainManifestPath, options.permissions, {
382
+ existsSync: deps.existsSync,
383
+ readFileSync: deps.readFileSync,
384
+ writeFileSync: deps.writeFileSync,
385
+ xmlParser: deps.xmlParser,
386
+ xmlSerializer: deps.xmlSerializer,
387
+ xpath: deps.xpath
388
+ });
389
+ if (permissionResult.success) {
390
+ const data = permissionResult.data;
391
+ if (data) {
392
+ logs.push(`权限配置完成: 新增 ${data.added} 个,跳过 ${data.skipped} 个已存在的`);
393
+ }
394
+ else {
395
+ logs.push('权限配置完成');
396
+ }
397
+ }
398
+ else {
399
+ logs.push(`权限配置失败: ${permissionResult.message || '未知错误'}`);
400
+ }
401
+ }
402
+ logs.push('配置 dcloud_control.xml');
403
+ const dcloudControlXmlPath = deps.join(options.projectPath, projectStructure.moduleDir, 'src', 'main', 'assets', 'data', 'dcloud_control.xml');
404
+ try {
405
+ if (deps.existsSync(dcloudControlXmlPath)) {
406
+ const xmlContent = deps.readFileSync(dcloudControlXmlPath, 'utf8');
407
+ const parser = new deps.xmlParser();
408
+ const xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
409
+ if (options.buildCustomBase) {
410
+ const hbuilderElements = xmlDoc.getElementsByTagName('hbuilder');
411
+ if (hbuilderElements.length > 0) {
412
+ const hbuilderElement = hbuilderElements[0];
413
+ let hasChanges = false;
414
+ if (hbuilderElement.getAttribute('debug') !== 'true') {
415
+ hbuilderElement.setAttribute('debug', 'true');
416
+ hasChanges = true;
417
+ }
418
+ if (hbuilderElement.getAttribute('syncDebug') !== 'true') {
419
+ hbuilderElement.setAttribute('syncDebug', 'true');
420
+ hasChanges = true;
421
+ }
422
+ if (hasChanges) {
423
+ logs.push('已添加自定义基座配置:debug="true" syncDebug="true"');
424
+ }
425
+ else {
426
+ logs.push('自定义基座配置已存在,无需修改');
427
+ }
428
+ }
429
+ else {
430
+ logs.push('警告:未找到 hbuilder 根节点,无法添加自定义基座配置');
431
+ }
432
+ }
433
+ const appsElements = xmlDoc.getElementsByTagName('apps');
434
+ if (appsElements.length > 0) {
435
+ const appsElement = appsElements[0];
436
+ const existingAppElements = appsElement.getElementsByTagName('app');
437
+ let appExists = false;
438
+ let hasChanges = false;
439
+ for (let i = 0; i < existingAppElements.length; i++) {
440
+ const appElement = existingAppElements[i];
441
+ if (appElement.getAttribute('appid') === options.uniAppId) {
442
+ appExists = true;
443
+ if (appElement.getAttribute('appver') !== '') {
444
+ appElement.setAttribute('appver', '');
445
+ hasChanges = true;
446
+ }
447
+ if (options.appkey && appElement.getAttribute('appkey') !== options.appkey) {
448
+ appElement.setAttribute('appkey', options.appkey);
449
+ hasChanges = true;
450
+ logs.push(`更新 appkey: ${options.appkey}`);
451
+ }
452
+ if (hasChanges) {
453
+ logs.push(`更新现有 app 元素,appid: ${options.uniAppId}`);
454
+ }
455
+ else {
456
+ logs.push(`app 元素已存在且配置正确,appid: ${options.uniAppId}`);
457
+ }
458
+ break;
459
+ }
460
+ }
461
+ if (!appExists) {
462
+ while (existingAppElements.length > 0) {
463
+ appsElement.removeChild(existingAppElements[0]);
464
+ }
465
+ logs.push('已删除所有现有的 app 元素');
466
+ const newAppElement = xmlDoc.createElement('app');
467
+ newAppElement.setAttribute('appid', options.uniAppId);
468
+ newAppElement.setAttribute('appver', '');
469
+ if (options.appkey) {
470
+ newAppElement.setAttribute('appkey', options.appkey);
471
+ logs.push(`设置 appkey: ${options.appkey}`);
472
+ }
473
+ appsElement.appendChild(newAppElement);
474
+ logs.push(`添加新的 app 元素,appid: ${options.uniAppId}`);
475
+ hasChanges = true;
476
+ }
477
+ if (hasChanges || !appExists) {
478
+ const serializer = new deps.xmlSerializer();
479
+ const newXmlContent = serializer.serializeToString(xmlDoc);
480
+ deps.writeFileSync(dcloudControlXmlPath, newXmlContent, 'utf8');
481
+ logs.push('dcloud_control.xml 配置完成');
482
+ }
483
+ else {
484
+ logs.push('dcloud_control.xml 无需修改');
485
+ }
486
+ }
487
+ else {
488
+ logs.push('dcloud_control.xml 中未找到 apps 元素');
489
+ }
490
+ }
491
+ else {
492
+ logs.push('dcloud_control.xml 文件不存在');
493
+ }
494
+ }
495
+ catch (error) {
496
+ logs.push(`配置 dcloud_control.xml 失败: ${error instanceof Error ? error.message : String(error)}`);
497
+ }
498
+ if (options.buildCustomBase) {
499
+ logs.push('复制 debug-server-release.aar 文件');
500
+ try {
501
+ let debugServerAarPath = options.debugServerAarPath;
502
+ if (!debugServerAarPath) {
503
+ const sdkBasePath = deps.dirname(options.projectPath);
504
+ const possiblePaths = [
505
+ deps.join(sdkBasePath, 'SDK', 'libs', 'debug-server-release.aar'),
506
+ deps.join(sdkBasePath, 'libs', 'debug-server-release.aar'),
507
+ deps.join(options.projectPath, 'libs', 'debug-server-release.aar')
508
+ ];
509
+ for (const path of possiblePaths) {
510
+ if (deps.existsSync(path)) {
511
+ debugServerAarPath = path;
512
+ logs.push(`自动找到 debug-server-release.aar: ${path}`);
513
+ break;
514
+ }
515
+ }
516
+ }
517
+ if (!debugServerAarPath) {
518
+ logs.push('警告: 未找到 debug-server-release.aar 文件,请手动指定 debugServerAarPath 配置项');
519
+ }
520
+ else if (!deps.existsSync(debugServerAarPath)) {
521
+ logs.push(`警告: debug-server-release.aar 文件不存在: ${debugServerAarPath}`);
522
+ }
523
+ else {
524
+ const libsDir = deps.join(options.projectPath, projectStructure.moduleDir, 'libs');
525
+ if (!deps.existsSync(libsDir)) {
526
+ deps.mkdirSync(libsDir, { recursive: true });
527
+ logs.push(`创建 libs 目录: ${libsDir}`);
528
+ }
529
+ const targetPath = deps.join(libsDir, 'debug-server-release.aar');
530
+ if (deps.existsSync(targetPath)) {
531
+ logs.push(`debug-server-release.aar 已存在,跳过复制: ${targetPath}`);
532
+ }
533
+ else {
534
+ deps.copyFileSync(debugServerAarPath, targetPath);
535
+ logs.push(`已复制 debug-server-release.aar: ${debugServerAarPath} -> ${targetPath}`);
536
+ }
537
+ }
538
+ }
539
+ catch (error) {
540
+ logs.push(`复制 debug-server-release.aar 失败: ${error instanceof Error ? error.message : String(error)}`);
541
+ }
542
+ }
543
+ if (options.wechatLogin && options.applicationId) {
544
+ logs.push('集成微信登录模块');
545
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
546
+ for (const moduleDir of modulesToIntegrate) {
547
+ const wechatResult = await integrateWechatLogin(options.projectPath, moduleDir, options.applicationId, {
548
+ appId: options.wechatLogin.appId,
549
+ appSecret: options.wechatLogin.appSecret,
550
+ oauthAarPath: options.wechatLogin.oauthAarPath,
551
+ wxEntryActivityPath: options.wechatLogin.wxEntryActivityPath
552
+ }, {
553
+ existsSync: deps.existsSync,
554
+ readFileSync: deps.readFileSync,
555
+ writeFileSync: deps.writeFileSync,
556
+ copyFileSync: deps.copyFileSync,
557
+ mkdirSync: deps.mkdirSync,
558
+ join: deps.join,
559
+ dirname: deps.dirname,
560
+ xmlParser: deps.xmlParser,
561
+ xmlSerializer: deps.xmlSerializer,
562
+ xpath: deps.xpath
563
+ });
564
+ if (wechatResult.success) {
565
+ logs.push(`${moduleDir} 模块的微信登录集成完成`);
566
+ logs.push(...wechatResult.logs);
567
+ }
568
+ else {
569
+ logs.push(`${moduleDir} 模块的微信登录集成失败: ${wechatResult.error}`);
570
+ logs.push(...wechatResult.logs);
571
+ }
572
+ }
573
+ }
574
+ if (options.wechatShare && options.applicationId) {
575
+ logs.push('集成微信分享模块');
576
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
577
+ for (const moduleDir of modulesToIntegrate) {
578
+ const wechatShareResult = await integrateWechatShare(options.projectPath, moduleDir, options.applicationId, {
579
+ appId: options.wechatShare.appId,
580
+ secret: options.wechatShare.secret,
581
+ shareAarPath: options.wechatShare.shareAarPath,
582
+ wxEntryActivityPath: options.wechatShare.wxEntryActivityPath
583
+ }, {
584
+ existsSync: deps.existsSync,
585
+ readFileSync: deps.readFileSync,
586
+ writeFileSync: deps.writeFileSync,
587
+ copyFileSync: deps.copyFileSync,
588
+ mkdirSync: deps.mkdirSync,
589
+ join: deps.join,
590
+ dirname: deps.dirname,
591
+ xmlParser: deps.xmlParser,
592
+ xmlSerializer: deps.xmlSerializer,
593
+ xpath: deps.xpath
594
+ });
595
+ if (wechatShareResult.success) {
596
+ logs.push(`${moduleDir} 模块的微信分享集成完成`);
597
+ logs.push(...wechatShareResult.logs);
598
+ }
599
+ else {
600
+ logs.push(`${moduleDir} 模块的微信分享集成失败: ${wechatShareResult.error}`);
601
+ logs.push(...wechatShareResult.logs);
602
+ }
603
+ }
604
+ }
605
+ if (options.univerifyLogin && options.applicationId) {
606
+ logs.push('集成一键登录模块');
607
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
608
+ for (const moduleDir of modulesToIntegrate) {
609
+ const univerifyResult = await integrateUniverifyLogin(options.projectPath, moduleDir, options.applicationId, {
610
+ getuiAppId: options.univerifyLogin.getuiAppId,
611
+ oauthAarPath: options.univerifyLogin.oauthAarPath
612
+ }, {
613
+ existsSync: deps.existsSync,
614
+ readFileSync: deps.readFileSync,
615
+ writeFileSync: deps.writeFileSync,
616
+ copyFileSync: deps.copyFileSync,
617
+ mkdirSync: deps.mkdirSync,
618
+ join: deps.join,
619
+ dirname: deps.dirname,
620
+ xmlParser: deps.xmlParser,
621
+ xmlSerializer: deps.xmlSerializer,
622
+ xpath: deps.xpath
623
+ });
624
+ if (univerifyResult.success) {
625
+ logs.push(`${moduleDir} 模块的一键登录集成完成`);
626
+ logs.push(...univerifyResult.logs);
627
+ }
628
+ else {
629
+ logs.push(`${moduleDir} 模块的一键登录集成失败: ${univerifyResult.error}`);
630
+ logs.push(...univerifyResult.logs);
631
+ }
632
+ }
633
+ }
634
+ if (options.qqLogin && options.applicationId) {
635
+ logs.push('集成QQ登录模块');
636
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
637
+ for (const moduleDir of modulesToIntegrate) {
638
+ const qqResult = await integrateQQLogin(options.projectPath, moduleDir, options.applicationId, {
639
+ appId: options.qqLogin.appId,
640
+ oauthAarPath: options.qqLogin.oauthAarPath,
641
+ openSdkJarPath: options.qqLogin.openSdkJarPath
642
+ }, {
643
+ existsSync: deps.existsSync,
644
+ readFileSync: deps.readFileSync,
645
+ writeFileSync: deps.writeFileSync,
646
+ copyFileSync: deps.copyFileSync,
647
+ mkdirSync: deps.mkdirSync,
648
+ join: deps.join,
649
+ dirname: deps.dirname,
650
+ xmlParser: deps.xmlParser,
651
+ xmlSerializer: deps.xmlSerializer,
652
+ xpath: deps.xpath
653
+ });
654
+ if (qqResult.success) {
655
+ logs.push(`${moduleDir} 模块的QQ登录集成完成`);
656
+ logs.push(...qqResult.logs);
657
+ }
658
+ else {
659
+ logs.push(`${moduleDir} 模块的QQ登录集成失败: ${qqResult.error}`);
660
+ logs.push(...qqResult.logs);
661
+ }
662
+ }
663
+ }
664
+ if (options.sinaLogin && options.applicationId) {
665
+ logs.push('集成新浪微博登录模块');
666
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
667
+ for (const moduleDir of modulesToIntegrate) {
668
+ const sinaResult = await integrateSinaLogin(options.projectPath, moduleDir, options.applicationId, {
669
+ appKey: options.sinaLogin.appKey,
670
+ redirectUri: options.sinaLogin.redirectUri,
671
+ openDefaultAarPath: options.sinaLogin.openDefaultAarPath,
672
+ oauthAarPath: options.sinaLogin.oauthAarPath
673
+ }, {
674
+ existsSync: deps.existsSync,
675
+ readFileSync: deps.readFileSync,
676
+ writeFileSync: deps.writeFileSync,
677
+ copyFileSync: deps.copyFileSync,
678
+ mkdirSync: deps.mkdirSync,
679
+ join: deps.join,
680
+ dirname: deps.dirname,
681
+ xmlParser: deps.xmlParser,
682
+ xmlSerializer: deps.xmlSerializer,
683
+ xpath: deps.xpath
684
+ });
685
+ if (sinaResult.success) {
686
+ logs.push(`${moduleDir} 模块的新浪微博登录集成完成`);
687
+ logs.push(...sinaResult.logs);
688
+ }
689
+ else {
690
+ logs.push(`${moduleDir} 模块的新浪微博登录集成失败: ${sinaResult.error}`);
691
+ logs.push(...sinaResult.logs);
692
+ }
693
+ }
694
+ }
695
+ if (options.miuiLogin && options.applicationId) {
696
+ logs.push('集成小米登录模块');
697
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
698
+ for (const moduleDir of modulesToIntegrate) {
699
+ const miuiResult = await integrateMiuiLogin(options.projectPath, moduleDir, options.applicationId, {
700
+ appId: options.miuiLogin.appId,
701
+ appSecret: options.miuiLogin.appSecret,
702
+ redirectUri: options.miuiLogin.redirectUri,
703
+ oauthAarPath: options.miuiLogin.oauthAarPath
704
+ }, {
705
+ existsSync: deps.existsSync,
706
+ readFileSync: deps.readFileSync,
707
+ writeFileSync: deps.writeFileSync,
708
+ copyFileSync: deps.copyFileSync,
709
+ mkdirSync: deps.mkdirSync,
710
+ join: deps.join,
711
+ dirname: deps.dirname,
712
+ xmlParser: deps.xmlParser,
713
+ xmlSerializer: deps.xmlSerializer,
714
+ xpath: deps.xpath
715
+ });
716
+ if (miuiResult.success) {
717
+ logs.push(`${moduleDir} 模块的小米登录集成完成`);
718
+ logs.push(...miuiResult.logs);
719
+ }
720
+ else {
721
+ logs.push(`${moduleDir} 模块的小米登录集成失败: ${miuiResult.error}`);
722
+ logs.push(...miuiResult.logs);
723
+ }
724
+ }
725
+ }
726
+ if (options.googleLogin && options.applicationId) {
727
+ logs.push('集成Google登录模块');
728
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
729
+ for (const moduleDir of modulesToIntegrate) {
730
+ const googleResult = await integrateGoogleLogin(options.projectPath, moduleDir, options.applicationId, {
731
+ oauthAarPath: options.googleLogin.oauthAarPath
732
+ }, {
733
+ existsSync: deps.existsSync,
734
+ readFileSync: deps.readFileSync,
735
+ writeFileSync: deps.writeFileSync,
736
+ copyFileSync: deps.copyFileSync,
737
+ mkdirSync: deps.mkdirSync,
738
+ join: deps.join,
739
+ dirname: deps.dirname,
740
+ xmlParser: deps.xmlParser,
741
+ xmlSerializer: deps.xmlSerializer,
742
+ xpath: deps.xpath
743
+ });
744
+ if (googleResult.success) {
745
+ logs.push(`${moduleDir} 模块的Google登录集成完成`);
746
+ logs.push(...googleResult.logs);
747
+ }
748
+ else {
749
+ logs.push(`${moduleDir} 模块的Google登录集成失败: ${googleResult.error}`);
750
+ logs.push(...googleResult.logs);
751
+ }
752
+ }
753
+ }
754
+ if (options.facebookLogin && options.applicationId) {
755
+ logs.push('集成Facebook登录模块');
756
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
757
+ for (const moduleDir of modulesToIntegrate) {
758
+ const facebookResult = await integrateFacebookLogin(options.projectPath, moduleDir, options.applicationId, {
759
+ appId: options.facebookLogin.appId,
760
+ clientToken: options.facebookLogin.clientToken,
761
+ oauthAarPath: options.facebookLogin.oauthAarPath
762
+ }, {
763
+ existsSync: deps.existsSync,
764
+ readFileSync: deps.readFileSync,
765
+ writeFileSync: deps.writeFileSync,
766
+ copyFileSync: deps.copyFileSync,
767
+ mkdirSync: deps.mkdirSync,
768
+ join: deps.join,
769
+ dirname: deps.dirname,
770
+ xmlParser: deps.xmlParser,
771
+ xmlSerializer: deps.xmlSerializer,
772
+ xpath: deps.xpath
773
+ });
774
+ if (facebookResult.success) {
775
+ logs.push(`${moduleDir} 模块的Facebook登录集成完成`);
776
+ logs.push(...facebookResult.logs);
777
+ }
778
+ else {
779
+ logs.push(`${moduleDir} 模块的Facebook登录集成失败: ${facebookResult.error}`);
780
+ logs.push(...facebookResult.logs);
781
+ }
782
+ }
783
+ }
784
+ if (options.shareTrace && options.applicationId) {
785
+ logs.push('集成ShareTrace模块');
786
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
787
+ for (const moduleDir of modulesToIntegrate) {
788
+ const shareTraceResult = await integrateShareTrace(options.projectPath, moduleDir, options.applicationId, {
789
+ appKey: options.shareTrace.appKey
790
+ }, {
791
+ existsSync: deps.existsSync,
792
+ readFileSync: deps.readFileSync,
793
+ writeFileSync: deps.writeFileSync,
794
+ copyFileSync: deps.copyFileSync,
795
+ mkdirSync: deps.mkdirSync,
796
+ join: deps.join,
797
+ dirname: deps.dirname,
798
+ xmlParser: deps.xmlParser,
799
+ xmlSerializer: deps.xmlSerializer,
800
+ xpath: deps.xpath
801
+ });
802
+ if (shareTraceResult.success) {
803
+ logs.push(`${moduleDir} 模块的ShareTrace集成完成`);
804
+ logs.push(...shareTraceResult.logs);
805
+ }
806
+ else {
807
+ logs.push(`${moduleDir} 模块的ShareTrace集成失败: ${shareTraceResult.error}`);
808
+ logs.push(...shareTraceResult.logs);
809
+ }
810
+ }
811
+ }
812
+ if (options.nativePlugins && options.nativePlugins.length > 0 && options.applicationId) {
813
+ logs.push('集成 UniApp 原生插件');
814
+ const modulesToIntegrate = allModules.length > 0 ? allModules : [projectStructure.moduleDir];
815
+ for (const pluginConfig of options.nativePlugins) {
816
+ for (const moduleDir of modulesToIntegrate) {
817
+ const pluginResult = await integrateUniAppNativePlugin(options.projectPath, moduleDir, options.applicationId, pluginConfig.pluginPath, {
818
+ existsSync: deps.existsSync,
819
+ readFileSync: deps.readFileSync,
820
+ writeFileSync: deps.writeFileSync,
821
+ copyFileSync: deps.copyFileSync,
822
+ mkdirSync: deps.mkdirSync,
823
+ join: deps.join,
824
+ dirname: deps.dirname,
825
+ xmlParser: deps.xmlParser,
826
+ xmlSerializer: deps.xmlSerializer,
827
+ xpath: deps.xpath,
828
+ parse: deps.parse,
829
+ readdirSync: deps.readdirSync,
830
+ statSync: deps.statSync,
831
+ exec: deps.exec,
832
+ basename: deps.basename
833
+ }, pluginConfig.parameters);
834
+ if (pluginResult.success) {
835
+ logs.push(`${moduleDir} 模块的插件集成完成: ${pluginConfig.pluginPath}`);
836
+ logs.push(...pluginResult.logs);
837
+ }
838
+ else {
839
+ logs.push(`${moduleDir} 模块的插件集成失败: ${pluginResult.error}`);
840
+ logs.push(...pluginResult.logs);
841
+ }
842
+ }
843
+ }
844
+ }
845
+ const buildVariant = options.buildVariant || 'debug';
846
+ logs.push(`步骤 4: 编译 Android 应用 (${buildVariant})`);
847
+ const androidBuildDeps = {
848
+ existsSync: deps.existsSync,
849
+ readdirSync: deps.readdirSync,
850
+ statSync: deps.statSync,
851
+ join: deps.join,
852
+ platform: deps.platform,
853
+ exec: deps.exec,
854
+ setTimeout: deps.setTimeout
855
+ };
856
+ const buildResult = await buildProject({
857
+ projectPath: options.projectPath,
858
+ buildVariant: buildVariant
859
+ }, androidBuildDeps);
860
+ if (!buildResult.success) {
861
+ return {
862
+ success: false,
863
+ error: `编译失败: ${buildResult.error}`,
864
+ logs: [...logs, ...buildResult.logs]
865
+ };
866
+ }
867
+ logs.push(...buildResult.logs);
868
+ logs.push('Android 离线打包完成');
869
+ return {
870
+ success: true,
871
+ outputPath: buildResult.outputPath,
872
+ logs
873
+ };
874
+ }
875
+ catch (error) {
876
+ const errorMessage = error instanceof Error ? error.message : String(error);
877
+ return {
878
+ success: false,
879
+ error: `打包过程中发生异常: ${errorMessage}`,
880
+ logs
881
+ };
882
+ }
883
+ }
884
+ //# sourceMappingURL=buildAndroidApp.js.map