zcw-shared 2.4.0 → 2.8.0

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 (428) hide show
  1. package/dist/functions/android/integrateThirdPartyModule.d.ts +5 -0
  2. package/dist/functions/android/integrateThirdPartyModule.js +70 -0
  3. package/dist/functions/android/integrateThirdPartyModule.js.map +1 -1
  4. package/dist/functions/android/integrateUniPushAndroid.d.ts +23 -0
  5. package/dist/functions/android/integrateUniPushAndroid.js +266 -0
  6. package/dist/functions/android/integrateUniPushAndroid.js.map +1 -0
  7. package/dist/functions/api/auth.d.ts +14 -0
  8. package/dist/functions/api/auth.js +109 -0
  9. package/dist/functions/api/auth.js.map +1 -0
  10. package/dist/functions/api/schemas/auth.schema.d.ts +363 -0
  11. package/dist/functions/api/schemas/auth.schema.js +39 -0
  12. package/dist/functions/api/schemas/auth.schema.js.map +1 -0
  13. package/dist/functions/api/schemas/video.schema.d.ts +391 -0
  14. package/dist/functions/api/schemas/video.schema.js +55 -0
  15. package/dist/functions/api/schemas/video.schema.js.map +1 -0
  16. package/dist/functions/api/video.d.ts +62 -0
  17. package/dist/functions/api/video.js +243 -0
  18. package/dist/functions/api/video.js.map +1 -0
  19. package/dist/functions/browser/isElectron.d.ts +5 -0
  20. package/dist/functions/browser/isElectron.js +4 -0
  21. package/dist/functions/browser/isElectron.js.map +1 -0
  22. package/dist/functions/dom/isTextTruncated.d.ts +4 -0
  23. package/dist/functions/dom/isTextTruncated.js +16 -0
  24. package/dist/functions/dom/isTextTruncated.js.map +1 -0
  25. package/dist/functions/dom/localFileInput.d.ts +14 -0
  26. package/dist/functions/dom/localFileInput.js +27 -0
  27. package/dist/functions/dom/localFileInput.js.map +1 -0
  28. package/dist/functions/file/getIconfontNameByExtension.js +53 -56
  29. package/dist/functions/file/getIconfontNameByExtension.js.map +1 -1
  30. package/dist/functions/im/parseImMentionSegments.d.ts +15 -0
  31. package/dist/functions/im/parseImMentionSegments.js +56 -0
  32. package/dist/functions/im/parseImMentionSegments.js.map +1 -0
  33. package/dist/functions/ios/integrateThirdPartyModule.d.ts +9 -1
  34. package/dist/functions/ios/integrateThirdPartyModule.js +112 -2
  35. package/dist/functions/ios/integrateThirdPartyModule.js.map +1 -1
  36. package/dist/functions/ios/integrateUniPushIOS.d.ts +18 -0
  37. package/dist/functions/ios/integrateUniPushIOS.js +200 -0
  38. package/dist/functions/ios/integrateUniPushIOS.js.map +1 -0
  39. package/dist/functions/oss/uploadViaSignedPut.d.ts +35 -0
  40. package/dist/functions/oss/uploadViaSignedPut.js +86 -0
  41. package/dist/functions/oss/uploadViaSignedPut.js.map +1 -0
  42. package/dist/functions/uniapp/app-plus/buildAndroidApp.js +38 -0
  43. package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +1 -1
  44. package/dist/functions/uniapp/app-plus/buildIOSApp.js +38 -0
  45. package/dist/functions/uniapp/app-plus/buildIOSApp.js.map +1 -1
  46. package/dist/vue-hooks/dom/useAppendToBody.d.ts +25 -0
  47. package/dist/vue-hooks/dom/useAppendToBody.js +31 -0
  48. package/dist/vue-hooks/dom/useAppendToBody.js.map +1 -0
  49. package/dist/vue-hooks/dom/useDraggable.d.ts +8 -3
  50. package/dist/vue-hooks/dom/useDraggable.js +57 -19
  51. package/dist/vue-hooks/dom/useDraggable.js.map +1 -1
  52. package/package.json +11 -1
  53. package/references/dom.d.ts +8 -3
  54. package/types/im-api.d.ts +26 -2
  55. package/types/im-chat.d.ts +42 -1
  56. package/types/im-message-display.d.ts +89 -0
  57. package/types/uniapp-android-build.d.ts +31 -0
  58. package/types/uniapp-ios-build.d.ts +26 -0
  59. package/types/user.d.ts +2 -1
  60. package/dist/functions/async/sleep.d.ts +0 -5
  61. package/dist/functions/async/sleep.js +0 -6
  62. package/dist/functions/async/sleep.js.map +0 -1
  63. package/dist/functions/async/timeout.d.ts +0 -6
  64. package/dist/functions/async/timeout.js +0 -12
  65. package/dist/functions/async/timeout.js.map +0 -1
  66. package/dist/functions/browser/computePosition.d.ts +0 -6
  67. package/dist/functions/browser/computePosition.js +0 -49
  68. package/dist/functions/browser/computePosition.js.map +0 -1
  69. package/dist/functions/browser/createSharedKeyboardCenter.d.ts +0 -18
  70. package/dist/functions/browser/createSharedKeyboardCenter.js +0 -58
  71. package/dist/functions/browser/createSharedKeyboardCenter.js.map +0 -1
  72. package/dist/functions/browser/createThrottledEventListener.d.ts +0 -11
  73. package/dist/functions/browser/createThrottledEventListener.js +0 -51
  74. package/dist/functions/browser/createThrottledEventListener.js.map +0 -1
  75. package/dist/functions/browser/demonstrateResourceLoading.d.ts +0 -32
  76. package/dist/functions/browser/demonstrateResourceLoading.js +0 -169
  77. package/dist/functions/browser/demonstrateResourceLoading.js.map +0 -1
  78. package/dist/functions/browser/detectOverflow.d.ts +0 -12
  79. package/dist/functions/browser/detectOverflow.js +0 -17
  80. package/dist/functions/browser/detectOverflow.js.map +0 -1
  81. package/dist/functions/browser/getAlignment.d.ts +0 -2
  82. package/dist/functions/browser/getAlignment.js +0 -5
  83. package/dist/functions/browser/getAlignment.js.map +0 -1
  84. package/dist/functions/browser/getBasePlacement.d.ts +0 -2
  85. package/dist/functions/browser/getBasePlacement.js +0 -4
  86. package/dist/functions/browser/getBasePlacement.js.map +0 -1
  87. package/dist/functions/browser/getCrossAxisFlip.d.ts +0 -2
  88. package/dist/functions/browser/getCrossAxisFlip.js +0 -11
  89. package/dist/functions/browser/getCrossAxisFlip.js.map +0 -1
  90. package/dist/functions/browser/getElementRect.d.ts +0 -3
  91. package/dist/functions/browser/getElementRect.js +0 -14
  92. package/dist/functions/browser/getElementRect.js.map +0 -1
  93. package/dist/functions/browser/getFlipPlacements.d.ts +0 -2
  94. package/dist/functions/browser/getFlipPlacements.js +0 -13
  95. package/dist/functions/browser/getFlipPlacements.js.map +0 -1
  96. package/dist/functions/browser/getMainAxisFlip.d.ts +0 -2
  97. package/dist/functions/browser/getMainAxisFlip.js +0 -17
  98. package/dist/functions/browser/getMainAxisFlip.js.map +0 -1
  99. package/dist/functions/browser/getRelativePosition.d.ts +0 -3
  100. package/dist/functions/browser/getRelativePosition.js +0 -14
  101. package/dist/functions/browser/getRelativePosition.js.map +0 -1
  102. package/dist/functions/browser/getViewportRect.d.ts +0 -7
  103. package/dist/functions/browser/getViewportRect.js +0 -15
  104. package/dist/functions/browser/getViewportRect.js.map +0 -1
  105. package/dist/functions/browser/isValidPlacement.d.ts +0 -2
  106. package/dist/functions/browser/isValidPlacement.js +0 -16
  107. package/dist/functions/browser/isValidPlacement.js.map +0 -1
  108. package/dist/functions/browser/pickFile.d.ts +0 -15
  109. package/dist/functions/browser/pickFile.js +0 -48
  110. package/dist/functions/browser/pickFile.js.map +0 -1
  111. package/dist/functions/build/generateExports.d.ts +0 -26
  112. package/dist/functions/build/generateExports.js +0 -34
  113. package/dist/functions/build/generateExports.js.map +0 -1
  114. package/dist/functions/core/diff/diff.d.ts +0 -25
  115. package/dist/functions/core/diff/diff.js +0 -316
  116. package/dist/functions/core/diff/diff.js.map +0 -1
  117. package/dist/functions/core/diff/vueDiff.d.ts +0 -38
  118. package/dist/functions/core/diff/vueDiff.js +0 -333
  119. package/dist/functions/core/diff/vueDiff.js.map +0 -1
  120. package/dist/functions/core/generator/generatorUtils.d.ts +0 -16
  121. package/dist/functions/core/generator/generatorUtils.js +0 -139
  122. package/dist/functions/core/generator/generatorUtils.js.map +0 -1
  123. package/dist/functions/core/type/isType.d.ts +0 -11
  124. package/dist/functions/core/type/isType.js +0 -30
  125. package/dist/functions/core/type/isType.js.map +0 -1
  126. package/dist/functions/data/array-object/chunk.d.ts +0 -1
  127. package/dist/functions/data/array-object/chunk.js +0 -11
  128. package/dist/functions/data/array-object/chunk.js.map +0 -1
  129. package/dist/functions/data/array-object/deepClone.d.ts +0 -12
  130. package/dist/functions/data/array-object/deepClone.js +0 -131
  131. package/dist/functions/data/array-object/deepClone.js.map +0 -1
  132. package/dist/functions/data/array-object/evolve.d.ts +0 -3
  133. package/dist/functions/data/array-object/evolve.js +0 -15
  134. package/dist/functions/data/array-object/evolve.js.map +0 -1
  135. package/dist/functions/data/array-object/flatten.d.ts +0 -7
  136. package/dist/functions/data/array-object/flatten.js +0 -60
  137. package/dist/functions/data/array-object/flatten.js.map +0 -1
  138. package/dist/functions/data/array-object/flattenObject.d.ts +0 -5
  139. package/dist/functions/data/array-object/flattenObject.js +0 -102
  140. package/dist/functions/data/array-object/flattenObject.js.map +0 -1
  141. package/dist/functions/data/array-object/groupBy.d.ts +0 -1
  142. package/dist/functions/data/array-object/groupBy.js +0 -14
  143. package/dist/functions/data/array-object/groupBy.js.map +0 -1
  144. package/dist/functions/data/array-object/omit.d.ts +0 -1
  145. package/dist/functions/data/array-object/omit.js +0 -8
  146. package/dist/functions/data/array-object/omit.js.map +0 -1
  147. package/dist/functions/data/array-object/pick.d.ts +0 -1
  148. package/dist/functions/data/array-object/pick.js +0 -10
  149. package/dist/functions/data/array-object/pick.js.map +0 -1
  150. package/dist/functions/data/array-object/shuffle.d.ts +0 -1
  151. package/dist/functions/data/array-object/shuffle.js +0 -9
  152. package/dist/functions/data/array-object/shuffle.js.map +0 -1
  153. package/dist/functions/data/array-object/sortBy.d.ts +0 -1
  154. package/dist/functions/data/array-object/sortBy.js +0 -13
  155. package/dist/functions/data/array-object/sortBy.js.map +0 -1
  156. package/dist/functions/data/array-object/unique.d.ts +0 -10
  157. package/dist/functions/data/array-object/unique.js +0 -85
  158. package/dist/functions/data/array-object/unique.js.map +0 -1
  159. package/dist/functions/data/date/dateRange.d.ts +0 -1
  160. package/dist/functions/data/date/dateRange.js +0 -18
  161. package/dist/functions/data/date/dateRange.js.map +0 -1
  162. package/dist/functions/data/date/formatDate.d.ts +0 -1
  163. package/dist/functions/data/date/formatDate.js +0 -21
  164. package/dist/functions/data/date/formatDate.js.map +0 -1
  165. package/dist/functions/data/date/timeAgo.d.ts +0 -1
  166. package/dist/functions/data/date/timeAgo.js +0 -49
  167. package/dist/functions/data/date/timeAgo.js.map +0 -1
  168. package/dist/functions/data/number/average.d.ts +0 -1
  169. package/dist/functions/data/number/average.js +0 -8
  170. package/dist/functions/data/number/average.js.map +0 -1
  171. package/dist/functions/data/number/clamp.d.ts +0 -1
  172. package/dist/functions/data/number/clamp.js +0 -7
  173. package/dist/functions/data/number/clamp.js.map +0 -1
  174. package/dist/functions/data/number/formatNumber.d.ts +0 -8
  175. package/dist/functions/data/number/formatNumber.js +0 -16
  176. package/dist/functions/data/number/formatNumber.js.map +0 -1
  177. package/dist/functions/data/number/median.d.ts +0 -1
  178. package/dist/functions/data/number/median.js +0 -14
  179. package/dist/functions/data/number/median.js.map +0 -1
  180. package/dist/functions/data/number/percentile.d.ts +0 -1
  181. package/dist/functions/data/number/percentile.js +0 -18
  182. package/dist/functions/data/number/percentile.js.map +0 -1
  183. package/dist/functions/data/number/random.d.ts +0 -4
  184. package/dist/functions/data/number/random.js +0 -9
  185. package/dist/functions/data/number/random.js.map +0 -1
  186. package/dist/functions/data/number/range.d.ts +0 -1
  187. package/dist/functions/data/number/range.js +0 -18
  188. package/dist/functions/data/number/range.js.map +0 -1
  189. package/dist/functions/data/number/sum.d.ts +0 -1
  190. package/dist/functions/data/number/sum.js +0 -4
  191. package/dist/functions/data/number/sum.js.map +0 -1
  192. package/dist/functions/data/randomRegion.d.ts +0 -24
  193. package/dist/functions/data/randomRegion.js +0 -74
  194. package/dist/functions/data/randomRegion.js.map +0 -1
  195. package/dist/functions/data/string/base64.d.ts +0 -5
  196. package/dist/functions/data/string/base64.js +0 -6
  197. package/dist/functions/data/string/base64.js.map +0 -1
  198. package/dist/functions/data/string/capitalize.d.ts +0 -1
  199. package/dist/functions/data/string/capitalize.js +0 -6
  200. package/dist/functions/data/string/capitalize.js.map +0 -1
  201. package/dist/functions/data/string/caseConverter.d.ts +0 -19
  202. package/dist/functions/data/string/caseConverter.js +0 -94
  203. package/dist/functions/data/string/caseConverter.js.map +0 -1
  204. package/dist/functions/data/string/desensitize.d.ts +0 -13
  205. package/dist/functions/data/string/desensitize.js +0 -107
  206. package/dist/functions/data/string/desensitize.js.map +0 -1
  207. package/dist/functions/data/string/htmlEscape.d.ts +0 -20
  208. package/dist/functions/data/string/htmlEscape.js +0 -80
  209. package/dist/functions/data/string/htmlEscape.js.map +0 -1
  210. package/dist/functions/data/string/levenshtein.d.ts +0 -1
  211. package/dist/functions/data/string/levenshtein.js +0 -27
  212. package/dist/functions/data/string/levenshtein.js.map +0 -1
  213. package/dist/functions/data/string/normalize.d.ts +0 -8
  214. package/dist/functions/data/string/normalize.js +0 -37
  215. package/dist/functions/data/string/normalize.js.map +0 -1
  216. package/dist/functions/data/string/pad.d.ts +0 -13
  217. package/dist/functions/data/string/pad.js +0 -50
  218. package/dist/functions/data/string/pad.js.map +0 -1
  219. package/dist/functions/data/string/palindrome.d.ts +0 -3
  220. package/dist/functions/data/string/palindrome.js +0 -15
  221. package/dist/functions/data/string/palindrome.js.map +0 -1
  222. package/dist/functions/data/string/similarity.d.ts +0 -1
  223. package/dist/functions/data/string/similarity.js +0 -13
  224. package/dist/functions/data/string/similarity.js.map +0 -1
  225. package/dist/functions/data/string/template.d.ts +0 -4
  226. package/dist/functions/data/string/template.js +0 -21
  227. package/dist/functions/data/string/template.js.map +0 -1
  228. package/dist/functions/data/string/testRegex.d.ts +0 -20
  229. package/dist/functions/data/string/testRegex.js +0 -300
  230. package/dist/functions/data/string/testRegex.js.map +0 -1
  231. package/dist/functions/data/string/wordCount.d.ts +0 -5
  232. package/dist/functions/data/string/wordCount.js +0 -11
  233. package/dist/functions/data/string/wordCount.js.map +0 -1
  234. package/dist/functions/data/tree/buildTree.d.ts +0 -7
  235. package/dist/functions/data/tree/buildTree.js +0 -27
  236. package/dist/functions/data/tree/buildTree.js.map +0 -1
  237. package/dist/functions/data/tree/filterTree.d.ts +0 -4
  238. package/dist/functions/data/tree/filterTree.js +0 -21
  239. package/dist/functions/data/tree/filterTree.js.map +0 -1
  240. package/dist/functions/data/tree/findNode.d.ts +0 -4
  241. package/dist/functions/data/tree/findNode.js +0 -21
  242. package/dist/functions/data/tree/findNode.js.map +0 -1
  243. package/dist/functions/data/tree/flattenTree.d.ts +0 -6
  244. package/dist/functions/data/tree/flattenTree.js +0 -21
  245. package/dist/functions/data/tree/flattenTree.js.map +0 -1
  246. package/dist/functions/file/walk.d.ts +0 -18
  247. package/dist/functions/file/walk.js +0 -58
  248. package/dist/functions/file/walk.js.map +0 -1
  249. package/dist/functions/hybrid/detectBridgeEnvironment.d.ts +0 -11
  250. package/dist/functions/hybrid/detectBridgeEnvironment.js +0 -26
  251. package/dist/functions/hybrid/detectBridgeEnvironment.js.map +0 -1
  252. package/dist/functions/integrations/ag-grid/generateLicense.d.ts +0 -7
  253. package/dist/functions/integrations/ag-grid/generateLicense.js +0 -12
  254. package/dist/functions/integrations/ag-grid/generateLicense.js.map +0 -1
  255. package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.d.ts +0 -30
  256. package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js +0 -884
  257. package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js.map +0 -1
  258. package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.d.ts +0 -31
  259. package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js +0 -900
  260. package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js.map +0 -1
  261. package/dist/functions/integrations/uniapp/build.d.ts +0 -21
  262. package/dist/functions/integrations/uniapp/build.js +0 -83
  263. package/dist/functions/integrations/uniapp/build.js.map +0 -1
  264. package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.d.ts +0 -11
  265. package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js +0 -30
  266. package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js.map +0 -1
  267. package/dist/functions/integrations/uniapp/detectProjectType.d.ts +0 -20
  268. package/dist/functions/integrations/uniapp/detectProjectType.js +0 -68
  269. package/dist/functions/integrations/uniapp/detectProjectType.js.map +0 -1
  270. package/dist/functions/integrations/uniapp/parseManifest.d.ts +0 -20
  271. package/dist/functions/integrations/uniapp/parseManifest.js +0 -51
  272. package/dist/functions/integrations/uniapp/parseManifest.js.map +0 -1
  273. package/dist/functions/integrations/uniapp/waitForPages.d.ts +0 -7
  274. package/dist/functions/integrations/uniapp/waitForPages.js +0 -20
  275. package/dist/functions/integrations/uniapp/waitForPages.js.map +0 -1
  276. package/dist/functions/integrations/vue/dynamicMount.d.ts +0 -18
  277. package/dist/functions/integrations/vue/dynamicMount.js +0 -25
  278. package/dist/functions/integrations/vue/dynamicMount.js.map +0 -1
  279. package/dist/functions/integrations/vue/extractColorsFromVueFile.d.ts +0 -3
  280. package/dist/functions/integrations/vue/extractColorsFromVueFile.js +0 -18
  281. package/dist/functions/integrations/vue/extractColorsFromVueFile.js.map +0 -1
  282. package/dist/functions/integrations/vue/extractColorsFromVueSection.d.ts +0 -3
  283. package/dist/functions/integrations/vue/extractColorsFromVueSection.js +0 -53
  284. package/dist/functions/integrations/vue/extractColorsFromVueSection.js.map +0 -1
  285. package/dist/functions/integrations/vue/filterSections.d.ts +0 -2
  286. package/dist/functions/integrations/vue/filterSections.js +0 -11
  287. package/dist/functions/integrations/vue/filterSections.js.map +0 -1
  288. package/dist/functions/integrations/vue/isVNode.d.ts +0 -2
  289. package/dist/functions/integrations/vue/isVNode.js +0 -6
  290. package/dist/functions/integrations/vue/isVNode.js.map +0 -1
  291. package/dist/functions/integrations/vue/isVueComponent.d.ts +0 -2
  292. package/dist/functions/integrations/vue/isVueComponent.js +0 -6
  293. package/dist/functions/integrations/vue/isVueComponent.js.map +0 -1
  294. package/dist/functions/integrations/vue/parseVueFile.d.ts +0 -2
  295. package/dist/functions/integrations/vue/parseVueFile.js +0 -53
  296. package/dist/functions/integrations/vue/parseVueFile.js.map +0 -1
  297. package/dist/functions/integrations/wechat/miniapp/downloadFile.d.ts +0 -6
  298. package/dist/functions/integrations/wechat/miniapp/downloadFile.js +0 -39
  299. package/dist/functions/integrations/wechat/miniapp/downloadFile.js.map +0 -1
  300. package/dist/functions/patterns/MyPromise.d.ts +0 -32
  301. package/dist/functions/patterns/MyPromise.js +0 -254
  302. package/dist/functions/patterns/MyPromise.js.map +0 -1
  303. package/dist/functions/patterns/functionBind.d.ts +0 -4
  304. package/dist/functions/patterns/functionBind.js +0 -33
  305. package/dist/functions/patterns/functionBind.js.map +0 -1
  306. package/dist/functions/patterns/myInstanceof.d.ts +0 -5
  307. package/dist/functions/patterns/myInstanceof.js +0 -56
  308. package/dist/functions/patterns/myInstanceof.js.map +0 -1
  309. package/dist/functions/patterns/myNew.d.ts +0 -3
  310. package/dist/functions/patterns/myNew.js +0 -19
  311. package/dist/functions/patterns/myNew.js.map +0 -1
  312. package/dist/functions/platform/android/buildProject.d.ts +0 -13
  313. package/dist/functions/platform/android/buildProject.js +0 -122
  314. package/dist/functions/platform/android/buildProject.js.map +0 -1
  315. package/dist/functions/platform/android/configureAppIcon.d.ts +0 -17
  316. package/dist/functions/platform/android/configureAppIcon.js +0 -106
  317. package/dist/functions/platform/android/configureAppIcon.js.map +0 -1
  318. package/dist/functions/platform/android/configureLaunchScreen.d.ts +0 -21
  319. package/dist/functions/platform/android/configureLaunchScreen.js +0 -328
  320. package/dist/functions/platform/android/configureLaunchScreen.js.map +0 -1
  321. package/dist/functions/platform/android/detectAndroidModules.d.ts +0 -8
  322. package/dist/functions/platform/android/detectAndroidModules.js +0 -21
  323. package/dist/functions/platform/android/detectAndroidModules.js.map +0 -1
  324. package/dist/functions/platform/android/integrateFacebookLogin.d.ts +0 -12
  325. package/dist/functions/platform/android/integrateFacebookLogin.js +0 -91
  326. package/dist/functions/platform/android/integrateFacebookLogin.js.map +0 -1
  327. package/dist/functions/platform/android/integrateGoogleLogin.d.ts +0 -10
  328. package/dist/functions/platform/android/integrateGoogleLogin.js +0 -199
  329. package/dist/functions/platform/android/integrateGoogleLogin.js.map +0 -1
  330. package/dist/functions/platform/android/integrateMiuiLogin.d.ts +0 -13
  331. package/dist/functions/platform/android/integrateMiuiLogin.js +0 -115
  332. package/dist/functions/platform/android/integrateMiuiLogin.js.map +0 -1
  333. package/dist/functions/platform/android/integrateQQLogin.d.ts +0 -12
  334. package/dist/functions/platform/android/integrateQQLogin.js +0 -130
  335. package/dist/functions/platform/android/integrateQQLogin.js.map +0 -1
  336. package/dist/functions/platform/android/integrateShareTrace.d.ts +0 -10
  337. package/dist/functions/platform/android/integrateShareTrace.js +0 -181
  338. package/dist/functions/platform/android/integrateShareTrace.js.map +0 -1
  339. package/dist/functions/platform/android/integrateSinaLogin.d.ts +0 -13
  340. package/dist/functions/platform/android/integrateSinaLogin.js +0 -85
  341. package/dist/functions/platform/android/integrateSinaLogin.js.map +0 -1
  342. package/dist/functions/platform/android/integrateThirdPartyModule.d.ts +0 -46
  343. package/dist/functions/platform/android/integrateThirdPartyModule.js +0 -251
  344. package/dist/functions/platform/android/integrateThirdPartyModule.js.map +0 -1
  345. package/dist/functions/platform/android/integrateUniAppNativePlugin.d.ts +0 -22
  346. package/dist/functions/platform/android/integrateUniAppNativePlugin.js +0 -631
  347. package/dist/functions/platform/android/integrateUniAppNativePlugin.js.map +0 -1
  348. package/dist/functions/platform/android/integrateUniverifyLogin.d.ts +0 -11
  349. package/dist/functions/platform/android/integrateUniverifyLogin.js +0 -314
  350. package/dist/functions/platform/android/integrateUniverifyLogin.js.map +0 -1
  351. package/dist/functions/platform/android/integrateWechatLogin.d.ts +0 -13
  352. package/dist/functions/platform/android/integrateWechatLogin.js +0 -154
  353. package/dist/functions/platform/android/integrateWechatLogin.js.map +0 -1
  354. package/dist/functions/platform/android/integrateWechatShare.d.ts +0 -13
  355. package/dist/functions/platform/android/integrateWechatShare.js +0 -154
  356. package/dist/functions/platform/android/integrateWechatShare.js.map +0 -1
  357. package/dist/functions/platform/android/modifyGradle.d.ts +0 -28
  358. package/dist/functions/platform/android/modifyGradle.js +0 -119
  359. package/dist/functions/platform/android/modifyGradle.js.map +0 -1
  360. package/dist/functions/platform/android/modifyManifest.d.ts +0 -39
  361. package/dist/functions/platform/android/modifyManifest.js +0 -225
  362. package/dist/functions/platform/android/modifyManifest.js.map +0 -1
  363. package/dist/functions/platform/android/permission.d.ts +0 -54
  364. package/dist/functions/platform/android/permission.js +0 -85
  365. package/dist/functions/platform/android/permission.js.map +0 -1
  366. package/dist/functions/platform/ios/configureAppIcon.d.ts +0 -17
  367. package/dist/functions/platform/ios/configureAppIcon.js +0 -149
  368. package/dist/functions/platform/ios/configureAppIcon.js.map +0 -1
  369. package/dist/functions/platform/ios/configureLaunchScreen.d.ts +0 -17
  370. package/dist/functions/platform/ios/configureLaunchScreen.js +0 -150
  371. package/dist/functions/platform/ios/configureLaunchScreen.js.map +0 -1
  372. package/dist/functions/platform/ios/configurePermissions.d.ts +0 -19
  373. package/dist/functions/platform/ios/configurePermissions.js +0 -120
  374. package/dist/functions/platform/ios/configurePermissions.js.map +0 -1
  375. package/dist/functions/platform/ios/integrateNativePlugin.d.ts +0 -35
  376. package/dist/functions/platform/ios/integrateNativePlugin.js +0 -994
  377. package/dist/functions/platform/ios/integrateNativePlugin.js.map +0 -1
  378. package/dist/functions/platform/ios/integrateQQShare.d.ts +0 -14
  379. package/dist/functions/platform/ios/integrateQQShare.js +0 -132
  380. package/dist/functions/platform/ios/integrateQQShare.js.map +0 -1
  381. package/dist/functions/platform/ios/integrateSinaShare.d.ts +0 -16
  382. package/dist/functions/platform/ios/integrateSinaShare.js +0 -108
  383. package/dist/functions/platform/ios/integrateSinaShare.js.map +0 -1
  384. package/dist/functions/platform/ios/integrateThirdPartyModule.d.ts +0 -62
  385. package/dist/functions/platform/ios/integrateThirdPartyModule.js +0 -883
  386. package/dist/functions/platform/ios/integrateThirdPartyModule.js.map +0 -1
  387. package/dist/functions/platform/ios/integrateWechatOauth.d.ts +0 -14
  388. package/dist/functions/platform/ios/integrateWechatOauth.js +0 -107
  389. package/dist/functions/platform/ios/integrateWechatOauth.js.map +0 -1
  390. package/dist/functions/platform/ios/integrateWechatShare.d.ts +0 -14
  391. package/dist/functions/platform/ios/integrateWechatShare.js +0 -101
  392. package/dist/functions/platform/ios/integrateWechatShare.js.map +0 -1
  393. package/dist/functions/platform/ios/modifyInfoPlistKeyValue.d.ts +0 -2
  394. package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js +0 -45
  395. package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js.map +0 -1
  396. package/dist/functions/platform/ios/safelyModifyProjectPbxproj.d.ts +0 -16
  397. package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js +0 -136
  398. package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js.map +0 -1
  399. package/dist/functions/platform/ios/useAltool.d.ts +0 -39
  400. package/dist/functions/platform/ios/useAltool.js +0 -350
  401. package/dist/functions/platform/ios/useAltool.js.map +0 -1
  402. package/dist/functions/style/buildTokens.d.ts +0 -76
  403. package/dist/functions/style/buildTokens.js +0 -183
  404. package/dist/functions/style/buildTokens.js.map +0 -1
  405. package/dist/functions/style/extractCssVariables.d.ts +0 -16
  406. package/dist/functions/style/extractCssVariables.js +0 -256
  407. package/dist/functions/style/extractCssVariables.js.map +0 -1
  408. package/dist/functions/style/generateVariables.d.ts +0 -7
  409. package/dist/functions/style/generateVariables.js +0 -135
  410. package/dist/functions/style/generateVariables.js.map +0 -1
  411. package/dist/functions/style/mixColors.d.ts +0 -1
  412. package/dist/functions/style/mixColors.js +0 -38
  413. package/dist/functions/style/mixColors.js.map +0 -1
  414. package/dist/functions/style/parseDesignTokens.d.ts +0 -10
  415. package/dist/functions/style/parseDesignTokens.js +0 -216
  416. package/dist/functions/style/parseDesignTokens.js.map +0 -1
  417. package/dist/functions/uniapp/app-plus/buildAndroidPlugin.d.ts +0 -3
  418. package/dist/functions/uniapp/app-plus/buildAndroidPlugin.js +0 -509
  419. package/dist/functions/uniapp/app-plus/buildAndroidPlugin.js.map +0 -1
  420. package/dist/functions/uniapp/app-plus/buildIOSPlugin.d.ts +0 -3
  421. package/dist/functions/uniapp/app-plus/buildIOSPlugin.js +0 -406
  422. package/dist/functions/uniapp/app-plus/buildIOSPlugin.js.map +0 -1
  423. package/dist/functions/validation/parseJwtPayload.d.ts +0 -7
  424. package/dist/functions/validation/parseJwtPayload.js +0 -33
  425. package/dist/functions/validation/parseJwtPayload.js.map +0 -1
  426. package/dist/functions/validation/validate.d.ts +0 -11
  427. package/dist/functions/validation/validate.js +0 -44
  428. package/dist/functions/validation/validate.js.map +0 -1
@@ -1,884 +0,0 @@
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