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,883 @@
1
+ import { modifyInfoPlistKeyValue } from './modifyInfoPlistKeyValue';
2
+ function addURLSchemeToInfoPlist(xmlDoc, urlScheme) {
3
+ const dictElement = xmlDoc.getElementsByTagName('dict')[0];
4
+ if (!dictElement)
5
+ return false;
6
+ let urlTypesKey = null;
7
+ let urlTypesArray = null;
8
+ const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
9
+ for (let i = 0; i < childNodes.length; i++) {
10
+ const node = childNodes[i];
11
+ if (node.nodeName === 'key' && node.textContent === 'CFBundleURLTypes') {
12
+ urlTypesKey = node;
13
+ if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === 'array') {
14
+ urlTypesArray = childNodes[i + 1];
15
+ break;
16
+ }
17
+ }
18
+ }
19
+ if (!urlTypesArray) {
20
+ if (!urlTypesKey) {
21
+ urlTypesKey = xmlDoc.createElement('key');
22
+ urlTypesKey.textContent = 'CFBundleURLTypes';
23
+ dictElement.appendChild(urlTypesKey);
24
+ }
25
+ urlTypesArray = xmlDoc.createElement('array');
26
+ dictElement.appendChild(urlTypesArray);
27
+ }
28
+ let targetIdentifier = 'weixin';
29
+ if (urlScheme.startsWith('wx')) {
30
+ targetIdentifier = 'weixin';
31
+ }
32
+ else if (urlScheme.startsWith('wb')) {
33
+ targetIdentifier = 'sinaweibo';
34
+ }
35
+ else if (urlScheme.startsWith('tencent')) {
36
+ targetIdentifier = 'qq';
37
+ }
38
+ else {
39
+ targetIdentifier = urlScheme;
40
+ }
41
+ const arrayChildNodes = Array.from(urlTypesArray.childNodes || []).filter((node) => node.nodeType === 1);
42
+ for (let i = 0; i < arrayChildNodes.length; i++) {
43
+ const dictNode = arrayChildNodes[i];
44
+ if (dictNode.nodeName === 'dict') {
45
+ const dictChildren = Array.from(dictNode.childNodes || []).filter((node) => node.nodeType === 1);
46
+ let urlNameValue = null;
47
+ let schemesArrayElement = null;
48
+ for (let j = 0; j < dictChildren.length; j++) {
49
+ if (dictChildren[j].nodeName === 'key' && dictChildren[j].textContent === 'CFBundleURLName') {
50
+ if (j + 1 < dictChildren.length && dictChildren[j + 1].nodeName === 'string') {
51
+ urlNameValue = dictChildren[j + 1].textContent;
52
+ }
53
+ }
54
+ if (dictChildren[j].nodeName === 'key' && dictChildren[j].textContent === 'CFBundleURLSchemes') {
55
+ if (j + 1 < dictChildren.length && dictChildren[j + 1].nodeName === 'array') {
56
+ schemesArrayElement = dictChildren[j + 1];
57
+ }
58
+ }
59
+ }
60
+ if (urlNameValue === targetIdentifier && schemesArrayElement) {
61
+ const schemes = Array.from(schemesArrayElement.childNodes || []).filter((node) => node.nodeType === 1);
62
+ for (const schemeNode of schemes) {
63
+ if (schemeNode.nodeName === 'string' && schemeNode.textContent === urlScheme) {
64
+ return true;
65
+ }
66
+ }
67
+ const existingSchemes = Array.from(schemesArrayElement.childNodes || []);
68
+ for (const child of existingSchemes) {
69
+ schemesArrayElement.removeChild(child);
70
+ }
71
+ const stringElement = xmlDoc.createElement('string');
72
+ stringElement.textContent = urlScheme;
73
+ schemesArrayElement.appendChild(stringElement);
74
+ return true;
75
+ }
76
+ }
77
+ }
78
+ const urlTypeDict = xmlDoc.createElement('dict');
79
+ let identifier = 'weixin';
80
+ if (urlScheme.startsWith('wx')) {
81
+ identifier = 'weixin';
82
+ }
83
+ else if (urlScheme.startsWith('wb')) {
84
+ identifier = 'sinaweibo';
85
+ }
86
+ else if (urlScheme.startsWith('tencent')) {
87
+ identifier = 'qq';
88
+ }
89
+ else {
90
+ identifier = urlScheme;
91
+ }
92
+ const identifierKey = xmlDoc.createElement('key');
93
+ identifierKey.textContent = 'CFBundleURLName';
94
+ const identifierValue = xmlDoc.createElement('string');
95
+ identifierValue.textContent = identifier;
96
+ urlTypeDict.appendChild(identifierKey);
97
+ urlTypeDict.appendChild(identifierValue);
98
+ const schemesKey = xmlDoc.createElement('key');
99
+ schemesKey.textContent = 'CFBundleURLSchemes';
100
+ const schemesArray = xmlDoc.createElement('array');
101
+ const schemeString = xmlDoc.createElement('string');
102
+ schemeString.textContent = urlScheme;
103
+ schemesArray.appendChild(schemeString);
104
+ urlTypeDict.appendChild(schemesKey);
105
+ urlTypeDict.appendChild(schemesArray);
106
+ urlTypesArray.appendChild(urlTypeDict);
107
+ return true;
108
+ }
109
+ function findEntitlementsFile(projectPath, projectName, deps) {
110
+ const possiblePaths = [
111
+ deps.join(projectPath, projectName, `${projectName}.entitlements`),
112
+ deps.join(projectPath, projectName, `${projectName}-Debug.entitlements`),
113
+ deps.join(projectPath, projectName, `${projectName}-Release.entitlements`),
114
+ deps.join(projectPath, `${projectName}.entitlements`),
115
+ deps.join(projectPath, `${projectName}-Debug.entitlements`),
116
+ deps.join(projectPath, `${projectName}-Release.entitlements`),
117
+ deps.join(projectPath, projectName, `${projectName.split('-')[0]}.entitlements`),
118
+ deps.join(projectPath, projectName, `${projectName.split('-')[0]}-Debug.entitlements`),
119
+ deps.join(projectPath, projectName, `${projectName.split('-')[0]}-Release.entitlements`),
120
+ deps.join(projectPath, `${projectName.split('-')[0]}.entitlements`),
121
+ deps.join(projectPath, `${projectName.split('-')[0]}-Debug.entitlements`),
122
+ deps.join(projectPath, `${projectName.split('-')[0]}-Release.entitlements`)
123
+ ];
124
+ for (const path of possiblePaths) {
125
+ if (deps.existsSync(path)) {
126
+ return path;
127
+ }
128
+ }
129
+ const searchInDirectory = (dir, depth = 0) => {
130
+ if (depth > 3) {
131
+ return null;
132
+ }
133
+ try {
134
+ if (!deps.existsSync(dir)) {
135
+ return null;
136
+ }
137
+ const files = deps.readdirSync(dir);
138
+ const entitlementsFile = files.find(f => f.endsWith('.entitlements'));
139
+ if (entitlementsFile) {
140
+ return deps.join(dir, entitlementsFile);
141
+ }
142
+ for (const file of files) {
143
+ const fullPath = deps.join(dir, file);
144
+ try {
145
+ const stat = deps.statSync(fullPath);
146
+ if (stat.isDirectory() && !file.startsWith('.') && file !== 'DerivedData' && file !== 'build') {
147
+ const found = searchInDirectory(fullPath, depth + 1);
148
+ if (found) {
149
+ return found;
150
+ }
151
+ }
152
+ }
153
+ catch {
154
+ continue;
155
+ }
156
+ }
157
+ }
158
+ catch {
159
+ }
160
+ return null;
161
+ };
162
+ const searchPaths = [
163
+ deps.join(projectPath, projectName),
164
+ projectPath
165
+ ];
166
+ for (const searchPath of searchPaths) {
167
+ if (deps.existsSync(searchPath)) {
168
+ const found = searchInDirectory(searchPath);
169
+ if (found) {
170
+ return found;
171
+ }
172
+ }
173
+ }
174
+ return null;
175
+ }
176
+ function addAssociatedDomainToEntitlements(entitlementsPath, domain, deps) {
177
+ try {
178
+ let xmlContent;
179
+ let xmlDoc;
180
+ if (deps.existsSync(entitlementsPath)) {
181
+ xmlContent = deps.readFileSync(entitlementsPath, 'utf8');
182
+ const parser = new deps.xmlParser();
183
+ xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
184
+ }
185
+ else {
186
+ const parser = new deps.xmlParser();
187
+ xmlContent = '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n</dict>\n</plist>';
188
+ xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
189
+ }
190
+ const dictElement = xmlDoc.getElementsByTagName('dict')[0];
191
+ if (!dictElement)
192
+ return false;
193
+ let found = false;
194
+ const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
195
+ for (let i = 0; i < childNodes.length; i++) {
196
+ const node = childNodes[i];
197
+ if (node.nodeName === 'key' && node.textContent === 'com.apple.developer.associated-domains') {
198
+ if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === 'array') {
199
+ const arrayElement = childNodes[i + 1];
200
+ const arrayChildren = Array.from(arrayElement.childNodes || []).filter((node) => node.nodeType === 1);
201
+ for (const child of arrayChildren) {
202
+ if (child.nodeName === 'string' && child.textContent === domain) {
203
+ return true;
204
+ }
205
+ }
206
+ const stringElement = xmlDoc.createElement('string');
207
+ stringElement.textContent = domain;
208
+ arrayElement.appendChild(stringElement);
209
+ found = true;
210
+ break;
211
+ }
212
+ }
213
+ }
214
+ if (!found) {
215
+ const keyElement = xmlDoc.createElement('key');
216
+ keyElement.textContent = 'com.apple.developer.associated-domains';
217
+ const arrayElement = xmlDoc.createElement('array');
218
+ const stringElement = xmlDoc.createElement('string');
219
+ stringElement.textContent = domain;
220
+ arrayElement.appendChild(stringElement);
221
+ dictElement.appendChild(keyElement);
222
+ dictElement.appendChild(arrayElement);
223
+ }
224
+ const serializer = new deps.xmlSerializer();
225
+ const newXmlContent = serializer.serializeToString(xmlDoc);
226
+ deps.writeFileSync(entitlementsPath, newXmlContent, 'utf8');
227
+ return true;
228
+ }
229
+ catch (error) {
230
+ return false;
231
+ }
232
+ }
233
+ function addDictKeyValueToInfoPlist(xmlDoc, keyName, dictValue) {
234
+ const dictElement = xmlDoc.getElementsByTagName('dict')[0];
235
+ if (!dictElement)
236
+ return false;
237
+ const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
238
+ let found = false;
239
+ for (let i = 0; i < childNodes.length; i++) {
240
+ const node = childNodes[i];
241
+ if (node.nodeName === 'key' && node.textContent === keyName) {
242
+ if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === 'dict') {
243
+ const existingDict = childNodes[i + 1];
244
+ const dictChildren = Array.from(existingDict.childNodes || []);
245
+ for (const child of dictChildren) {
246
+ existingDict.removeChild(child);
247
+ }
248
+ for (const [k, v] of Object.entries(dictValue)) {
249
+ const keyElement = xmlDoc.createElement('key');
250
+ keyElement.textContent = k;
251
+ const valueElement = xmlDoc.createElement('string');
252
+ valueElement.textContent = v;
253
+ existingDict.appendChild(keyElement);
254
+ existingDict.appendChild(valueElement);
255
+ }
256
+ found = true;
257
+ }
258
+ break;
259
+ }
260
+ }
261
+ if (!found) {
262
+ const keyElement = xmlDoc.createElement('key');
263
+ keyElement.textContent = keyName;
264
+ const dictValueElement = xmlDoc.createElement('dict');
265
+ for (const [k, v] of Object.entries(dictValue)) {
266
+ const subKeyElement = xmlDoc.createElement('key');
267
+ subKeyElement.textContent = k;
268
+ const subValueElement = xmlDoc.createElement('string');
269
+ subValueElement.textContent = v;
270
+ dictValueElement.appendChild(subKeyElement);
271
+ dictValueElement.appendChild(subValueElement);
272
+ }
273
+ dictElement.appendChild(keyElement);
274
+ dictElement.appendChild(dictValueElement);
275
+ found = true;
276
+ }
277
+ return found;
278
+ }
279
+ function addLSApplicationQueriesSchemesToInfoPlist(xmlDoc, scheme) {
280
+ const dictElement = xmlDoc.getElementsByTagName('dict')[0];
281
+ if (!dictElement)
282
+ return false;
283
+ let queriesSchemesKey = null;
284
+ let queriesSchemesArray = null;
285
+ const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
286
+ for (let i = 0; i < childNodes.length; i++) {
287
+ const node = childNodes[i];
288
+ if (node.nodeName === 'key' && node.textContent === 'LSApplicationQueriesSchemes') {
289
+ queriesSchemesKey = node;
290
+ if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === 'array') {
291
+ queriesSchemesArray = childNodes[i + 1];
292
+ break;
293
+ }
294
+ }
295
+ }
296
+ if (!queriesSchemesArray) {
297
+ if (!queriesSchemesKey) {
298
+ queriesSchemesKey = xmlDoc.createElement('key');
299
+ queriesSchemesKey.textContent = 'LSApplicationQueriesSchemes';
300
+ dictElement.appendChild(queriesSchemesKey);
301
+ }
302
+ queriesSchemesArray = xmlDoc.createElement('array');
303
+ dictElement.appendChild(queriesSchemesArray);
304
+ }
305
+ const arrayChildNodes = Array.from(queriesSchemesArray.childNodes || []).filter((node) => node.nodeType === 1);
306
+ for (const child of arrayChildNodes) {
307
+ if (child.nodeName === 'string' && child.textContent === scheme) {
308
+ return true;
309
+ }
310
+ }
311
+ const stringElement = xmlDoc.createElement('string');
312
+ stringElement.textContent = scheme;
313
+ queriesSchemesArray.appendChild(stringElement);
314
+ return true;
315
+ }
316
+ function generateXcodeUUID() {
317
+ const chars = '0123456789ABCDEF';
318
+ let uuid = '';
319
+ for (let i = 0; i < 24; i++) {
320
+ uuid += chars[Math.floor(Math.random() * chars.length)];
321
+ }
322
+ return uuid;
323
+ }
324
+ function getLastKnownFileType(filePath) {
325
+ const ext = filePath.toLowerCase();
326
+ if (ext.endsWith('.framework'))
327
+ return 'wrapper.framework';
328
+ if (ext.endsWith('.xcframework'))
329
+ return 'wrapper.xcframework';
330
+ if (ext.endsWith('.a'))
331
+ return 'archive.ar';
332
+ if (ext.endsWith('.bundle'))
333
+ return 'wrapper.plug-in';
334
+ if (ext.endsWith('.tbd'))
335
+ return 'sourcecode.text-based-dylib-definition';
336
+ return 'file';
337
+ }
338
+ export function addFileToEmbedFrameworks(projectPbxprojPath, filePath, deps) {
339
+ try {
340
+ if (!deps.existsSync(projectPbxprojPath)) {
341
+ return { success: false, error: `project.pbxproj 文件不存在: ${projectPbxprojPath}` };
342
+ }
343
+ let content = deps.readFileSync(projectPbxprojPath, 'utf8');
344
+ const fileName = filePath.split('/').pop() || filePath;
345
+ const relativePath = filePath;
346
+ const lastKnownFileType = getLastKnownFileType(fileName);
347
+ const existingFileRefRegex = new RegExp(`PBXFileReference.*name\\s*=\\s*${fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*path\\s*=\\s*${relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`, 'i');
348
+ let fileRefUUID = '';
349
+ let fileRefExists = false;
350
+ if (existingFileRefRegex.test(content)) {
351
+ const embedFrameworkRefRegex = new RegExp(`${fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*in Embed Frameworks`, 'i');
352
+ if (embedFrameworkRefRegex.test(content)) {
353
+ return { success: true };
354
+ }
355
+ const escapedFileName = fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
356
+ const escapedPath = relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
357
+ const lines = content.split('\n');
358
+ for (const line of lines) {
359
+ if (line.includes('PBXFileReference') &&
360
+ line.includes(fileName) &&
361
+ line.includes(relativePath)) {
362
+ const uuidMatch = line.match(/^\s*([0-9A-F]{24})\s+/i);
363
+ if (uuidMatch && uuidMatch[1]) {
364
+ fileRefUUID = uuidMatch[1];
365
+ fileRefExists = true;
366
+ break;
367
+ }
368
+ }
369
+ }
370
+ }
371
+ if (!fileRefExists) {
372
+ fileRefUUID = generateXcodeUUID();
373
+ }
374
+ const buildFileUUID = generateXcodeUUID();
375
+ if (!fileRefExists) {
376
+ const fileRefSectionEndRegex = /(\/\* End PBXFileReference section \*\/)/;
377
+ if (fileRefSectionEndRegex.test(content)) {
378
+ const fileRefEntry = `\t\t${fileRefUUID} /* ${fileName} */ = {isa = PBXFileReference; lastKnownFileType = ${lastKnownFileType}; name = ${fileName}; path = ${relativePath}; sourceTree = "<group>"; };\n`;
379
+ content = content.replace(fileRefSectionEndRegex, `${fileRefEntry}$1`);
380
+ }
381
+ }
382
+ const buildFileSectionEndRegex = /(\/\* End PBXBuildFile section \*\/)/;
383
+ if (buildFileSectionEndRegex.test(content)) {
384
+ const buildFileEntry = `\t\t${buildFileUUID} /* ${fileName} in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = ${fileRefUUID} /* ${fileName} */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n`;
385
+ content = content.replace(buildFileSectionEndRegex, `${buildFileEntry}$1`);
386
+ }
387
+ const embedFrameworksPhaseRegex = /(\t\t[0-9A-F]{24}\s+\/\* Embed Frameworks \*\/\s*=\s*\{\s*isa\s*=\s*PBXCopyFilesBuildPhase;[^}]*?files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*name\s*=\s*"Embed Frameworks";)/m;
388
+ let match = content.match(embedFrameworksPhaseRegex);
389
+ if (!match) {
390
+ const altRegex = /(PBXCopyFilesBuildPhase[^}]*?Embed Frameworks[^}]*?files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*name\s*=\s*"Embed Frameworks";)/m;
391
+ match = content.match(altRegex);
392
+ }
393
+ if (match) {
394
+ const filesContent = match[2];
395
+ const newFileEntry = `\t\t\t\t${buildFileUUID} /* ${fileName} in Embed Frameworks */,\n`;
396
+ const alreadyExists = filesContent.includes(buildFileUUID) ||
397
+ filesContent.includes(`${fileName} in Embed Frameworks`);
398
+ if (!alreadyExists) {
399
+ const newContent = match[0].replace(/(\s*\);\s*name\s*=\s*"Embed Frameworks";)/, `${newFileEntry}$1`);
400
+ content = content.replace(match[0], newContent);
401
+ }
402
+ }
403
+ const frameworksGroupRegex = new RegExp(`(\\t+[0-9A-F]{24}\\s+\\/\\*\\s+Frameworks\\s+\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*PBXGroup[^}]*children\\s*=\\s*\\(\\s*)([\\s\\S]*?)(\\s*\\);[^}]*name\\s*=\\s*Frameworks[^}]*\\};)`, 'i');
404
+ const groupMatch = content.match(frameworksGroupRegex);
405
+ if (groupMatch) {
406
+ const childrenContent = groupMatch[2];
407
+ const newGroupEntry = `\t\t\t\t${fileRefUUID} /* ${fileName} */,\n`;
408
+ if (!childrenContent.includes(fileRefUUID)) {
409
+ content = content.replace(frameworksGroupRegex, `$1${childrenContent}${newGroupEntry}$3`);
410
+ }
411
+ }
412
+ else {
413
+ return {
414
+ success: false,
415
+ error: `未找到 Frameworks group,无法将文件引用添加到项目文件树中。这可能导致文件引用出现在 Recovered References 中。`
416
+ };
417
+ }
418
+ deps.writeFileSync(projectPbxprojPath, content, 'utf8');
419
+ return { success: true };
420
+ }
421
+ catch (error) {
422
+ return {
423
+ success: false,
424
+ error: `添加文件到 Embed Frameworks 失败: ${error instanceof Error ? error.message : String(error)}`
425
+ };
426
+ }
427
+ }
428
+ export function addFileToXcodeProject(projectPbxprojPath, filePath, fileType, deps) {
429
+ try {
430
+ if (!deps.existsSync(projectPbxprojPath)) {
431
+ return { success: false, error: `project.pbxproj 文件不存在: ${projectPbxprojPath}` };
432
+ }
433
+ let content = deps.readFileSync(projectPbxprojPath, 'utf8');
434
+ const fileName = filePath.split('/').pop() || filePath;
435
+ const relativePath = filePath;
436
+ const lastKnownFileType = getLastKnownFileType(fileName);
437
+ const existingFileRefRegex = new RegExp(`PBXFileReference.*name\\s*=\\s*${fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*path\\s*=\\s*${relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`, 'i');
438
+ let fileRefUUID = '';
439
+ let fileRefExists = false;
440
+ if (existingFileRefRegex.test(content)) {
441
+ const buildFileRefRegex = new RegExp(`${fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*in Frameworks`, 'i');
442
+ if (buildFileRefRegex.test(content)) {
443
+ return { success: true };
444
+ }
445
+ const escapedFileName = fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
446
+ const escapedPath = relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
447
+ const lines = content.split('\n');
448
+ for (const line of lines) {
449
+ if (line.includes('PBXFileReference') &&
450
+ line.includes(fileName) &&
451
+ line.includes(relativePath)) {
452
+ const uuidMatch = line.match(/^\s*([0-9A-F]{24})\s+/i);
453
+ if (uuidMatch && uuidMatch[1]) {
454
+ fileRefUUID = uuidMatch[1];
455
+ fileRefExists = true;
456
+ break;
457
+ }
458
+ }
459
+ }
460
+ }
461
+ if (!fileRefExists) {
462
+ fileRefUUID = generateXcodeUUID();
463
+ }
464
+ const buildFileUUID = generateXcodeUUID();
465
+ if (!fileRefExists) {
466
+ const fileRefSectionEndRegex = /(\/\* End PBXFileReference section \*\/)/;
467
+ if (fileRefSectionEndRegex.test(content)) {
468
+ const fileRefEntry = `\t\t${fileRefUUID} /* ${fileName} */ = {isa = PBXFileReference; lastKnownFileType = ${lastKnownFileType}; name = ${fileName}; path = ${relativePath}; sourceTree = "<group>"; };\n`;
469
+ content = content.replace(fileRefSectionEndRegex, `${fileRefEntry}$1`);
470
+ }
471
+ }
472
+ const buildFileSectionEndRegex = /(\/\* End PBXBuildFile section \*\/)/;
473
+ if (buildFileSectionEndRegex.test(content)) {
474
+ const phaseName = fileType === 'framework' || fileType === 'staticLibrary' ? 'Frameworks' : 'Resources';
475
+ const buildFileEntry = `\t\t${buildFileUUID} /* ${fileName} in ${phaseName} */ = {isa = PBXBuildFile; fileRef = ${fileRefUUID} /* ${fileName} */; };\n`;
476
+ content = content.replace(buildFileSectionEndRegex, `${buildFileEntry}$1`);
477
+ }
478
+ if (fileType === 'framework' || fileType === 'staticLibrary') {
479
+ const frameworksPhaseRegex = /(\t\t[0-9A-F]{24}\s+\/\* Frameworks \*\/\s*=\s*\{\s*isa\s*=\s*PBXFrameworksBuildPhase;\s*buildActionMask\s*=\s*\d+;\s*files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*runOnlyForDeploymentPostprocessing\s*=\s*\d+;\s*\};)/m;
480
+ let match = content.match(frameworksPhaseRegex);
481
+ if (!match) {
482
+ const altRegex = /(PBXFrameworksBuildPhase[^}]*?files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*runOnlyForDeploymentPostprocessing\s*=\s*\d+;)/m;
483
+ match = content.match(altRegex);
484
+ }
485
+ if (match) {
486
+ const filesContent = match[2];
487
+ const newFileEntry = `\t\t\t\t${buildFileUUID} /* ${fileName} in Frameworks */,\n`;
488
+ const alreadyExists = filesContent.includes(buildFileUUID) ||
489
+ filesContent.includes(`${fileName} in Frameworks`);
490
+ if (!alreadyExists) {
491
+ const newContent = match[0].replace(/(\s*\);\s*runOnlyForDeploymentPostprocessing)/, `${newFileEntry}$1`);
492
+ content = content.replace(match[0], newContent);
493
+ }
494
+ }
495
+ }
496
+ else if (fileType === 'bundle') {
497
+ const resourcesPhaseRegex = /(\t\t[0-9A-F]{24}\s+\/\* Resources \*\/\s*=\s*\{\s*isa\s*=\s*PBXResourcesBuildPhase;\s*buildActionMask\s*=\s*\d+;\s*files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*runOnlyForDeploymentPostprocessing\s*=\s*\d+;\s*\};)/m;
498
+ let match = content.match(resourcesPhaseRegex);
499
+ if (!match) {
500
+ const altRegex = /(PBXResourcesBuildPhase[^}]*?files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*runOnlyForDeploymentPostprocessing\s*=\s*\d+;)/m;
501
+ match = content.match(altRegex);
502
+ }
503
+ if (match) {
504
+ const filesContent = match[2];
505
+ const newFileEntry = `\t\t\t\t${buildFileUUID} /* ${fileName} in Resources */,\n`;
506
+ const alreadyExists = filesContent.includes(buildFileUUID) ||
507
+ filesContent.includes(`${fileName} in Resources`);
508
+ if (!alreadyExists) {
509
+ const newContent = match[0].replace(/(\s*\);\s*runOnlyForDeploymentPostprocessing)/, `${newFileEntry}$1`);
510
+ content = content.replace(match[0], newContent);
511
+ }
512
+ }
513
+ }
514
+ let groupName = 'Frameworks';
515
+ if (fileType === 'bundle') {
516
+ groupName = 'Resources';
517
+ }
518
+ const frameworksGroupRegex = new RegExp(`(\\t+[0-9A-F]{24}\\s+\\/\\*\\s+${groupName}\\s+\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*PBXGroup[^}]*children\\s*=\\s*\\(\\s*)([\\s\\S]*?)(\\s*\\);[^}]*name\\s*=\\s*${groupName}[^}]*\\};)`, 'i');
519
+ const groupMatch = content.match(frameworksGroupRegex);
520
+ if (groupMatch) {
521
+ const childrenContent = groupMatch[2];
522
+ const newGroupEntry = `\t\t\t\t${fileRefUUID} /* ${fileName} */,\n`;
523
+ if (!childrenContent.includes(fileRefUUID)) {
524
+ content = content.replace(frameworksGroupRegex, `$1${childrenContent}${newGroupEntry}$3`);
525
+ }
526
+ }
527
+ else {
528
+ return {
529
+ success: false,
530
+ error: `未找到 ${groupName} group,无法将文件引用添加到项目文件树中。这可能导致文件引用出现在 Recovered References 中。`
531
+ };
532
+ }
533
+ deps.writeFileSync(projectPbxprojPath, content, 'utf8');
534
+ return { success: true };
535
+ }
536
+ catch (error) {
537
+ return {
538
+ success: false,
539
+ error: `添加文件到 Xcode 项目失败: ${error instanceof Error ? error.message : String(error)}`
540
+ };
541
+ }
542
+ }
543
+ export async function integrateIOSThirdPartyModule(projectPath, projectName, bundleId, config, deps) {
544
+ const logs = [];
545
+ try {
546
+ logs.push(`开始集成第三方模块: ${config.name}`);
547
+ const projectFiles = deps.readdirSync(projectPath).filter(file => file.endsWith('.xcodeproj'));
548
+ if (projectFiles.length === 0) {
549
+ return {
550
+ success: false,
551
+ error: `在 ${projectPath} 中未找到 Xcode 项目文件(.xcodeproj)`,
552
+ logs
553
+ };
554
+ }
555
+ const projectFile = projectFiles[0];
556
+ const projectPbxprojPath = deps.join(projectPath, projectFile, 'project.pbxproj');
557
+ if (!deps.existsSync(projectPbxprojPath)) {
558
+ return {
559
+ success: false,
560
+ error: `project.pbxproj 文件不存在: ${projectPbxprojPath}`,
561
+ logs
562
+ };
563
+ }
564
+ if (config.frameworks && config.frameworks.length > 0) {
565
+ logs.push('步骤 1: 拷贝框架文件并添加到 Xcode 项目');
566
+ const frameworksDir = deps.join(projectPath, 'Frameworks');
567
+ if (!deps.existsSync(frameworksDir)) {
568
+ deps.mkdirSync(frameworksDir, { recursive: true });
569
+ logs.push(`创建 Frameworks 目录: ${frameworksDir}`);
570
+ }
571
+ for (const framework of config.frameworks) {
572
+ const sourcePath = framework.source;
573
+ const targetFileName = framework.targetName || deps.basename(sourcePath);
574
+ const targetPath = deps.join(frameworksDir, targetFileName);
575
+ if (!deps.existsSync(sourcePath)) {
576
+ logs.push(`警告: 源文件不存在,跳过: ${sourcePath}`);
577
+ continue;
578
+ }
579
+ const stat = deps.statSync(sourcePath);
580
+ if (stat.isDirectory()) {
581
+ await deps.cp(sourcePath, targetPath, { recursive: true, force: true });
582
+ }
583
+ else {
584
+ deps.copyFileSync(sourcePath, targetPath);
585
+ }
586
+ logs.push(`已拷贝: ${sourcePath} -> ${targetPath}`);
587
+ const relativePath = `Frameworks/${targetFileName}`;
588
+ const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, 'framework', {
589
+ existsSync: deps.existsSync,
590
+ readFileSync: deps.readFileSync,
591
+ writeFileSync: deps.writeFileSync
592
+ });
593
+ if (addResult.success) {
594
+ logs.push(`已添加到 Xcode 项目: ${targetFileName} (路径: ${relativePath})`);
595
+ }
596
+ else {
597
+ logs.push(`警告: 添加到 Xcode 项目失败: ${addResult.error || '未知错误'}`);
598
+ }
599
+ }
600
+ }
601
+ if (config.staticLibraries && config.staticLibraries.length > 0) {
602
+ logs.push('步骤 2: 拷贝静态库文件并添加到 Xcode 项目');
603
+ const libsDir = deps.join(projectPath, 'libs');
604
+ if (!deps.existsSync(libsDir)) {
605
+ deps.mkdirSync(libsDir, { recursive: true });
606
+ logs.push(`创建 libs 目录: ${libsDir}`);
607
+ }
608
+ for (const lib of config.staticLibraries) {
609
+ const sourcePath = lib.source;
610
+ const targetFileName = lib.targetName || deps.basename(sourcePath);
611
+ const targetPath = deps.join(libsDir, targetFileName);
612
+ if (!deps.existsSync(sourcePath)) {
613
+ logs.push(`警告: 源文件不存在,跳过: ${sourcePath}`);
614
+ continue;
615
+ }
616
+ deps.copyFileSync(sourcePath, targetPath);
617
+ logs.push(`已拷贝: ${sourcePath} -> ${targetPath}`);
618
+ const relativePath = `libs/${targetFileName}`;
619
+ const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, 'staticLibrary', {
620
+ existsSync: deps.existsSync,
621
+ readFileSync: deps.readFileSync,
622
+ writeFileSync: deps.writeFileSync
623
+ });
624
+ if (addResult.success) {
625
+ logs.push(`已添加到 Xcode 项目: ${targetFileName} (路径: ${relativePath})`);
626
+ }
627
+ else {
628
+ logs.push(`警告: 添加到 Xcode 项目失败: ${addResult.error || '未知错误'}`);
629
+ }
630
+ }
631
+ }
632
+ if (config.bundles && config.bundles.length > 0) {
633
+ logs.push('步骤 3: 拷贝资源文件并添加到 Xcode 项目');
634
+ const resourcesDir = deps.join(projectPath, projectName, 'Resources');
635
+ if (!deps.existsSync(resourcesDir)) {
636
+ deps.mkdirSync(resourcesDir, { recursive: true });
637
+ logs.push(`创建 Resources 目录: ${resourcesDir}`);
638
+ }
639
+ for (const bundle of config.bundles) {
640
+ const sourcePath = bundle.source;
641
+ const targetFileName = bundle.targetName || deps.basename(sourcePath);
642
+ const targetPath = deps.join(resourcesDir, targetFileName);
643
+ if (!deps.existsSync(sourcePath)) {
644
+ logs.push(`警告: 源文件不存在,跳过: ${sourcePath}`);
645
+ continue;
646
+ }
647
+ const stat = deps.statSync(sourcePath);
648
+ if (stat.isDirectory()) {
649
+ await deps.cp(sourcePath, targetPath, { recursive: true, force: true });
650
+ }
651
+ else {
652
+ deps.copyFileSync(sourcePath, targetPath);
653
+ }
654
+ logs.push(`已拷贝: ${sourcePath} -> ${targetPath}`);
655
+ const relativePath = `${projectName}/Resources/${targetFileName}`;
656
+ const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, 'bundle', {
657
+ existsSync: deps.existsSync,
658
+ readFileSync: deps.readFileSync,
659
+ writeFileSync: deps.writeFileSync
660
+ });
661
+ if (addResult.success) {
662
+ logs.push(`已添加到 Xcode 项目: ${targetFileName}`);
663
+ }
664
+ else {
665
+ logs.push(`警告: 添加到 Xcode 项目失败: ${addResult.error}`);
666
+ }
667
+ }
668
+ }
669
+ if (config.infoPlistModifications && config.infoPlistModifications.length > 0) {
670
+ logs.push('步骤 4: 修改 Info.plist');
671
+ const infoPlistPath = deps.join(projectPath, projectName, `${projectName}-Info.plist`);
672
+ if (deps.existsSync(infoPlistPath)) {
673
+ try {
674
+ const xmlContent = deps.readFileSync(infoPlistPath, 'utf8');
675
+ const parser = new deps.xmlParser();
676
+ const xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
677
+ for (const modification of config.infoPlistModifications) {
678
+ switch (modification.action) {
679
+ case 'addKeyValue':
680
+ case 'modifyKeyValue':
681
+ if (modification.key && modification.value !== undefined) {
682
+ const valueType = typeof modification.value === 'boolean'
683
+ ? (modification.value ? 'true' : 'false')
684
+ : 'string';
685
+ modifyInfoPlistKeyValue(xmlDoc, modification.key, modification.value, valueType);
686
+ logs.push(`已${modification.action === 'addKeyValue' ? '添加' : '修改'} Info.plist 键值: ${modification.key}`);
687
+ }
688
+ break;
689
+ case 'addURLScheme':
690
+ if (modification.urlScheme) {
691
+ addURLSchemeToInfoPlist(xmlDoc, modification.urlScheme);
692
+ logs.push(`已添加 URL Scheme: ${modification.urlScheme}`);
693
+ }
694
+ break;
695
+ case 'addAssociatedDomain':
696
+ if (modification.associatedDomain) {
697
+ const entitlementsPath = findEntitlementsFile(projectPath, projectName, {
698
+ existsSync: deps.existsSync,
699
+ join: deps.join,
700
+ readdirSync: deps.readdirSync,
701
+ basename: deps.basename,
702
+ statSync: deps.statSync
703
+ });
704
+ if (entitlementsPath) {
705
+ const success = addAssociatedDomainToEntitlements(entitlementsPath, modification.associatedDomain, {
706
+ existsSync: deps.existsSync,
707
+ readFileSync: deps.readFileSync,
708
+ writeFileSync: deps.writeFileSync,
709
+ xmlParser: deps.xmlParser,
710
+ xmlSerializer: deps.xmlSerializer
711
+ });
712
+ if (success) {
713
+ logs.push(`已添加 Associated Domain 到 entitlements 文件: ${modification.associatedDomain}`);
714
+ }
715
+ else {
716
+ logs.push(`警告: 添加 Associated Domain 到 entitlements 文件失败: ${entitlementsPath}`);
717
+ }
718
+ }
719
+ else {
720
+ const defaultEntitlementsPath = deps.join(projectPath, projectName, `${projectName}.entitlements`);
721
+ const success = addAssociatedDomainToEntitlements(defaultEntitlementsPath, modification.associatedDomain, {
722
+ existsSync: deps.existsSync,
723
+ readFileSync: deps.readFileSync,
724
+ writeFileSync: deps.writeFileSync,
725
+ xmlParser: deps.xmlParser,
726
+ xmlSerializer: deps.xmlSerializer
727
+ });
728
+ if (success) {
729
+ logs.push(`已创建 entitlements 文件并添加 Associated Domain: ${defaultEntitlementsPath}`);
730
+ logs.push(`注意: 需要在 Xcode 中将 ${deps.basename(defaultEntitlementsPath)} 添加到项目的 Code Signing Entitlements 中`);
731
+ }
732
+ else {
733
+ logs.push(`警告: 创建 entitlements 文件失败: ${defaultEntitlementsPath}`);
734
+ }
735
+ }
736
+ logs.push(`已添加 Associated Domain 到 Info.plist: ${modification.associatedDomain}`);
737
+ }
738
+ break;
739
+ case 'addLSApplicationQueriesSchemes':
740
+ if (modification.queriesScheme) {
741
+ addLSApplicationQueriesSchemesToInfoPlist(xmlDoc, modification.queriesScheme);
742
+ logs.push(`已添加 LSApplicationQueriesSchemes: ${modification.queriesScheme}`);
743
+ }
744
+ break;
745
+ case 'addDictKeyValue':
746
+ if (modification.key && modification.dictValue) {
747
+ addDictKeyValueToInfoPlist(xmlDoc, modification.key, modification.dictValue);
748
+ logs.push(`已添加 Info.plist 字典键值: ${modification.key}`);
749
+ }
750
+ break;
751
+ }
752
+ }
753
+ const serializer = new deps.xmlSerializer();
754
+ const newXmlContent = serializer.serializeToString(xmlDoc);
755
+ deps.writeFileSync(infoPlistPath, newXmlContent, 'utf8');
756
+ logs.push('Info.plist 修改完成');
757
+ }
758
+ catch (error) {
759
+ logs.push(`修改 Info.plist 失败: ${error instanceof Error ? error.message : String(error)}`);
760
+ }
761
+ }
762
+ else {
763
+ logs.push(`警告: Info.plist 文件不存在: ${infoPlistPath}`);
764
+ }
765
+ }
766
+ if (config.appDelegateMethods && config.appDelegateMethods.length > 0) {
767
+ logs.push('步骤 5: 修改 AppDelegate.m');
768
+ const appDelegatePath = deps.join(projectPath, projectName, 'AppDelegate.m');
769
+ if (deps.existsSync(appDelegatePath)) {
770
+ try {
771
+ let appDelegateContent = deps.readFileSync(appDelegatePath, 'utf8');
772
+ for (const method of config.appDelegateMethods) {
773
+ const methodCodeTrimmed = method.code.trim();
774
+ if (appDelegateContent.includes(methodCodeTrimmed)) {
775
+ logs.push(`方法已存在(完整匹配),跳过: ${method.code.substring(0, 50)}...`);
776
+ continue;
777
+ }
778
+ const methodLines = methodCodeTrimmed.split('\n');
779
+ const implementationIndex = appDelegateContent.indexOf('@implementation');
780
+ if (implementationIndex !== -1) {
781
+ const implementationBlock = appDelegateContent.substring(implementationIndex);
782
+ let allMethodsExist = true;
783
+ const foundMethods = [];
784
+ for (const line of methodLines) {
785
+ const trimmedLine = line.trim();
786
+ const methodDefMatch = trimmedLine.match(/^[-+]\s*\([^)]+\)\s*(\w+):/);
787
+ if (methodDefMatch) {
788
+ const methodName = methodDefMatch[1];
789
+ const escapedLine = trimmedLine.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
790
+ const methodPattern = new RegExp(escapedLine.replace(/\s+/g, '\\s+'), 'm');
791
+ if (methodPattern.test(implementationBlock)) {
792
+ foundMethods.push(methodName);
793
+ }
794
+ else {
795
+ allMethodsExist = false;
796
+ break;
797
+ }
798
+ }
799
+ }
800
+ if (allMethodsExist && foundMethods.length > 0) {
801
+ logs.push(`方法已存在(${foundMethods.join(', ')}),跳过`);
802
+ continue;
803
+ }
804
+ }
805
+ if (method.position && method.referenceMethod) {
806
+ let referenceIndex = -1;
807
+ if (method.referenceMethod === '@end') {
808
+ const implementationIndex = appDelegateContent.indexOf('@implementation');
809
+ if (implementationIndex !== -1) {
810
+ const endAfterImplementation = appDelegateContent.indexOf('@end', implementationIndex);
811
+ if (endAfterImplementation !== -1) {
812
+ referenceIndex = endAfterImplementation;
813
+ }
814
+ }
815
+ if (referenceIndex === -1) {
816
+ referenceIndex = appDelegateContent.lastIndexOf('@end');
817
+ }
818
+ }
819
+ else {
820
+ referenceIndex = appDelegateContent.indexOf(method.referenceMethod);
821
+ }
822
+ if (referenceIndex !== -1) {
823
+ if (method.position === 'before') {
824
+ appDelegateContent = appDelegateContent.slice(0, referenceIndex) +
825
+ method.code + '\n\n' +
826
+ appDelegateContent.slice(referenceIndex);
827
+ }
828
+ else {
829
+ if (method.referenceMethod === '@end') {
830
+ appDelegateContent = appDelegateContent.slice(0, referenceIndex) +
831
+ '\n' + method.code + '\n' +
832
+ appDelegateContent.slice(referenceIndex);
833
+ }
834
+ else {
835
+ const methodEnd = appDelegateContent.indexOf('}', referenceIndex);
836
+ if (methodEnd !== -1) {
837
+ appDelegateContent = appDelegateContent.slice(0, methodEnd + 1) +
838
+ '\n\n' + method.code + '\n' +
839
+ appDelegateContent.slice(methodEnd + 1);
840
+ }
841
+ else {
842
+ appDelegateContent += '\n\n' + method.code;
843
+ }
844
+ }
845
+ }
846
+ }
847
+ else {
848
+ appDelegateContent += '\n\n' + method.code;
849
+ }
850
+ }
851
+ else {
852
+ appDelegateContent += '\n\n' + method.code;
853
+ }
854
+ logs.push(`已添加 AppDelegate 方法`);
855
+ }
856
+ deps.writeFileSync(appDelegatePath, appDelegateContent, 'utf8');
857
+ logs.push('AppDelegate.m 修改完成');
858
+ }
859
+ catch (error) {
860
+ logs.push(`修改 AppDelegate.m 失败: ${error instanceof Error ? error.message : String(error)}`);
861
+ }
862
+ }
863
+ else {
864
+ logs.push(`警告: AppDelegate.m 文件不存在: ${appDelegatePath}`);
865
+ }
866
+ }
867
+ logs.push(`第三方模块集成完成: ${config.name}`);
868
+ logs.push('注意: 部分配置(如添加框架到 Xcode 项目)需要手动完成');
869
+ return {
870
+ success: true,
871
+ message: `成功集成第三方模块: ${config.name}`,
872
+ logs
873
+ };
874
+ }
875
+ catch (error) {
876
+ return {
877
+ success: false,
878
+ error: `集成第三方模块失败: ${error instanceof Error ? error.message : String(error)}`,
879
+ logs
880
+ };
881
+ }
882
+ }
883
+ //# sourceMappingURL=integrateThirdPartyModule.js.map