zcw-shared 1.4.0 → 1.7.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 (453) hide show
  1. package/README.md +513 -610
  2. package/assets/logo-colorful.svg +18 -18
  3. package/assets/logo-name.svg +7 -7
  4. package/assets/logo-transparent.svg +14 -14
  5. package/assets/logo.svg +8 -8
  6. package/dist/constants/colorPatterns.d.ts +8 -0
  7. package/dist/{functions/color-converter/COLOR_PATTERNS.js → constants/colorPatterns.js} +1 -1
  8. package/dist/constants/colorPatterns.js.map +1 -0
  9. package/dist/constants/namedColors.d.ts +16 -0
  10. package/dist/constants/namedColors.js +17 -0
  11. package/dist/constants/namedColors.js.map +1 -0
  12. package/dist/functions/android/buildProject.d.ts +11 -0
  13. package/dist/functions/android/buildProject.js +97 -0
  14. package/dist/functions/android/buildProject.js.map +1 -0
  15. package/dist/functions/android/modifyGradle.d.ts +17 -0
  16. package/dist/functions/android/modifyGradle.js +69 -0
  17. package/dist/functions/android/modifyGradle.js.map +1 -0
  18. package/dist/functions/android/modifyManifest.d.ts +23 -0
  19. package/dist/functions/android/modifyManifest.js +198 -0
  20. package/dist/functions/android/modifyManifest.js.map +1 -0
  21. package/dist/functions/android/permission.d.ts +30 -0
  22. package/dist/functions/android/permission.js +65 -0
  23. package/dist/functions/android/permission.js.map +1 -0
  24. package/dist/functions/color/colorValidation.d.ts +11 -0
  25. package/dist/functions/color/colorValidation.js +35 -0
  26. package/dist/functions/color/colorValidation.js.map +1 -0
  27. package/dist/functions/{color-converter → color}/convertColor.d.ts +0 -1
  28. package/dist/functions/color/convertColor.js +277 -0
  29. package/dist/functions/color/convertColor.js.map +1 -0
  30. package/dist/functions/color/deduplicateColors.d.ts +4 -0
  31. package/dist/functions/color/deduplicateColors.js +40 -0
  32. package/dist/functions/color/deduplicateColors.js.map +1 -0
  33. package/dist/functions/color/detectColorFormat.d.ts +8 -0
  34. package/dist/functions/color/detectColorFormat.js +110 -0
  35. package/dist/functions/color/detectColorFormat.js.map +1 -0
  36. package/dist/functions/color/extractColors.d.ts +4 -0
  37. package/dist/functions/color/extractColors.js +128 -0
  38. package/dist/functions/color/extractColors.js.map +1 -0
  39. package/dist/functions/css/extractCssVariables.d.ts +12 -0
  40. package/dist/functions/css/extractCssVariables.js +53 -0
  41. package/dist/functions/css/extractCssVariables.js.map +1 -0
  42. package/dist/functions/debug/createDebugger.d.ts +8 -7
  43. package/dist/functions/debug/createDebugger.js +49 -39
  44. package/dist/functions/debug/createDebugger.js.map +1 -1
  45. package/dist/functions/dom/detectOverflow.d.ts +3 -3
  46. package/dist/functions/dom/detectOverflow.js +3 -3
  47. package/dist/functions/dom/detectOverflow.js.map +1 -1
  48. package/dist/functions/dom/getElementRect.d.ts +1 -1
  49. package/dist/functions/dom/getElementRect.js.map +1 -1
  50. package/dist/functions/dom/getRelativePosition.d.ts +1 -1
  51. package/dist/functions/dom/getRelativePosition.js.map +1 -1
  52. package/dist/functions/dom/getViewportRect.d.ts +2 -2
  53. package/dist/functions/dom/getViewportRect.js +2 -2
  54. package/dist/functions/dom/getViewportRect.js.map +1 -1
  55. package/dist/functions/image/generateMacIcons.d.ts +3 -3
  56. package/dist/functions/image/generateMacIcons.js.map +1 -1
  57. package/dist/functions/image/generateMacTrayIcon.d.ts +3 -3
  58. package/dist/functions/image/generateMacTrayIcon.js.map +1 -1
  59. package/dist/functions/image/generatePaddedImage.d.ts +2 -2
  60. package/dist/functions/image/generatePaddedImage.js.map +1 -1
  61. package/dist/functions/image/generatePwaIcons.d.ts +3 -3
  62. package/dist/functions/image/generatePwaIcons.js.map +1 -1
  63. package/dist/functions/image/generateRoundedImage.d.ts +2 -2
  64. package/dist/functions/image/generateRoundedImage.js.map +1 -1
  65. package/dist/functions/ipc/dispatchIpcRequest.d.ts +2 -2
  66. package/dist/functions/ipc/dispatchIpcRequest.js +1 -1
  67. package/dist/functions/ipc/dispatchIpcRequest.js.map +1 -1
  68. package/dist/functions/software/findSoftware.d.ts +4 -5
  69. package/dist/functions/software/findSoftware.js +32 -20
  70. package/dist/functions/software/findSoftware.js.map +1 -1
  71. package/dist/functions/uniapp/app-plus/buildAndroidApp.d.ts +2 -2
  72. package/dist/functions/uniapp/app-plus/buildAndroidApp.js +97 -24
  73. package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +1 -1
  74. package/dist/functions/uniapp/build.d.ts +20 -0
  75. package/dist/functions/uniapp/build.js +84 -0
  76. package/dist/functions/uniapp/build.js.map +1 -0
  77. package/dist/functions/uniapp/detectAndroidProjectStructure.d.ts +7 -0
  78. package/dist/functions/uniapp/detectAndroidProjectStructure.js +30 -0
  79. package/dist/functions/uniapp/detectAndroidProjectStructure.js.map +1 -0
  80. package/dist/functions/uniapp/detectProjectType.d.ts +16 -0
  81. package/dist/functions/uniapp/detectProjectType.js +68 -0
  82. package/dist/functions/uniapp/detectProjectType.js.map +1 -0
  83. package/dist/functions/uniapp/parseManifest.d.ts +12 -0
  84. package/dist/functions/uniapp/{app-plus/parseManifest.js → parseManifest.js} +9 -7
  85. package/dist/functions/uniapp/parseManifest.js.map +1 -0
  86. package/dist/functions/utils/generateExports.d.ts +16 -0
  87. package/dist/functions/utils/generateExports.js +34 -0
  88. package/dist/functions/utils/generateExports.js.map +1 -0
  89. package/dist/functions/vue/extractColorsFromVueFile.d.ts +3 -0
  90. package/dist/functions/vue/extractColorsFromVueFile.js +18 -0
  91. package/dist/functions/vue/extractColorsFromVueFile.js.map +1 -0
  92. package/dist/functions/vue/extractColorsFromVueSection.d.ts +3 -0
  93. package/dist/functions/vue/extractColorsFromVueSection.js +53 -0
  94. package/dist/functions/vue/extractColorsFromVueSection.js.map +1 -0
  95. package/dist/functions/vue/filterSections.d.ts +2 -0
  96. package/dist/functions/vue/parseVueFile.d.ts +2 -0
  97. package/dist/functions/xml/modifyXml.d.ts +11 -0
  98. package/dist/functions/xml/modifyXml.js +46 -0
  99. package/dist/functions/xml/modifyXml.js.map +1 -0
  100. package/dist/hooks/useAltool.d.ts +39 -0
  101. package/dist/hooks/useAltool.js +350 -0
  102. package/dist/hooks/useAltool.js.map +1 -0
  103. package/dist/hooks/useLocalStorage.d.ts +4 -4
  104. package/dist/hooks/useLocalStorage.js +51 -18
  105. package/dist/hooks/useLocalStorage.js.map +1 -1
  106. package/dist/hooks/useSessionStorage.d.ts +4 -4
  107. package/dist/hooks/useSessionStorage.js +51 -18
  108. package/dist/hooks/useSessionStorage.js.map +1 -1
  109. package/dist/hooks/useStorage.d.ts +10 -3
  110. package/dist/hooks/useStorage.js +33 -35
  111. package/dist/hooks/useStorage.js.map +1 -1
  112. package/dist/hooks/useStorageWithIndexedDB.d.ts +3 -4
  113. package/dist/hooks/useStorageWithIndexedDB.js +39 -29
  114. package/dist/hooks/useStorageWithIndexedDB.js.map +1 -1
  115. package/dist/hooks/useWebWorker.d.ts +25 -4
  116. package/dist/hooks/useWebWorker.js.map +1 -1
  117. package/dist/hooks/useWorkerFunction.d.ts +22 -4
  118. package/dist/hooks/useWorkerFunction.js +28 -28
  119. package/dist/hooks/useWorkerFunction.js.map +1 -1
  120. package/dist/hooks/useWorkerPool.d.ts +30 -4
  121. package/dist/hooks/useWorkerPool.js.map +1 -1
  122. package/package.json +39 -63
  123. package/references/arraybuffer.d.ts +109 -0
  124. package/references/blob.d.ts +37 -0
  125. package/references/browser.d.ts +69 -174
  126. package/references/chrome.extension.d.ts +83 -0
  127. package/references/console.d.ts +25 -164
  128. package/references/{crypto.d.ts → crypto-js.d.ts} +57 -57
  129. package/references/dom.d.ts +41 -0
  130. package/references/encoding.d.ts +24 -0
  131. package/references/fetch.d.ts +124 -269
  132. package/references/indexeddb.d.ts +49 -0
  133. package/references/json5.d.ts +21 -28
  134. package/references/location.d.ts +16 -0
  135. package/references/node.d.ts +116 -111
  136. package/references/sharp.d.ts +18 -18
  137. package/references/storage.d.ts +17 -111
  138. package/references/timer.d.ts +45 -46
  139. package/references/uniapp.d.ts +51 -9
  140. package/references/url.d.ts +55 -160
  141. package/references/vue.d.ts +86 -113
  142. package/references/webassembly.d.ts +101 -127
  143. package/references/wechat.d.ts +48 -48
  144. package/references/worker.d.ts +152 -206
  145. package/references/xml.d.ts +88 -55
  146. package/types/altool.d.ts +49 -17
  147. package/types/android-build.d.ts +60 -85
  148. package/types/color.d.ts +72 -135
  149. package/types/geometry.d.ts +28 -63
  150. package/types/platform.d.ts +4 -0
  151. package/types/software.d.ts +15 -0
  152. package/types/storage.d.ts +50 -48
  153. package/types/uniapp-android-build.d.ts +49 -0
  154. package/types/vue.d.ts +30 -0
  155. package/types/worker.d.ts +178 -364
  156. package/dist/functions/ag-grid/generateLicense.d.ts +0 -4
  157. package/dist/functions/ag-grid/generateLicense.js +0 -12
  158. package/dist/functions/ag-grid/generateLicense.js.map +0 -1
  159. package/dist/functions/altool/createAltoolClient.d.ts +0 -21
  160. package/dist/functions/altool/createAltoolClient.js +0 -59
  161. package/dist/functions/altool/createAltoolClient.js.map +0 -1
  162. package/dist/functions/altool/getAppInfo.d.ts +0 -13
  163. package/dist/functions/altool/getAppInfo.js +0 -92
  164. package/dist/functions/altool/getAppInfo.js.map +0 -1
  165. package/dist/functions/altool/index.d.ts +0 -10
  166. package/dist/functions/altool/index.js +0 -6
  167. package/dist/functions/altool/index.js.map +0 -1
  168. package/dist/functions/altool/isApiKeyAuth.d.ts +0 -2
  169. package/dist/functions/altool/isApiKeyAuth.js +0 -4
  170. package/dist/functions/altool/isApiKeyAuth.js.map +0 -1
  171. package/dist/functions/altool/isCredentialsAuth.d.ts +0 -2
  172. package/dist/functions/altool/isCredentialsAuth.js +0 -4
  173. package/dist/functions/altool/isCredentialsAuth.js.map +0 -1
  174. package/dist/functions/altool/types.d.ts +0 -26
  175. package/dist/functions/altool/types.js +0 -7
  176. package/dist/functions/altool/types.js.map +0 -1
  177. package/dist/functions/altool/uploadApp.d.ts +0 -6
  178. package/dist/functions/altool/uploadApp.js +0 -36
  179. package/dist/functions/altool/uploadApp.js.map +0 -1
  180. package/dist/functions/altool/validateApp.d.ts +0 -17
  181. package/dist/functions/altool/validateApp.js +0 -59
  182. package/dist/functions/altool/validateApp.js.map +0 -1
  183. package/dist/functions/base64/strToBase64.d.ts +0 -2
  184. package/dist/functions/base64/strToBase64.js +0 -6
  185. package/dist/functions/base64/strToBase64.js.map +0 -1
  186. package/dist/functions/color-converter/COLOR_PATTERNS.d.ts +0 -2
  187. package/dist/functions/color-converter/COLOR_PATTERNS.js.map +0 -1
  188. package/dist/functions/color-converter/colorPatterns.d.ts +0 -4
  189. package/dist/functions/color-converter/colorPatterns.js +0 -41
  190. package/dist/functions/color-converter/colorPatterns.js.map +0 -1
  191. package/dist/functions/color-converter/convertColor.js +0 -238
  192. package/dist/functions/color-converter/convertColor.js.map +0 -1
  193. package/dist/functions/color-converter/detectColorFormat.d.ts +0 -2
  194. package/dist/functions/color-converter/detectColorFormat.js +0 -19
  195. package/dist/functions/color-converter/detectColorFormat.js.map +0 -1
  196. package/dist/functions/color-converter/extractColors.d.ts +0 -16
  197. package/dist/functions/color-converter/extractColors.js +0 -111
  198. package/dist/functions/color-converter/extractColors.js.map +0 -1
  199. package/dist/functions/color-converter/getColorPatterns.d.ts +0 -2
  200. package/dist/functions/color-converter/getColorPatterns.js +0 -11
  201. package/dist/functions/color-converter/getColorPatterns.js.map +0 -1
  202. package/dist/functions/color-converter/getNamedColorMap.d.ts +0 -2
  203. package/dist/functions/color-converter/getNamedColorMap.js +0 -19
  204. package/dist/functions/color-converter/getNamedColorMap.js.map +0 -1
  205. package/dist/functions/color-converter/hexToRgb.d.ts +0 -2
  206. package/dist/functions/color-converter/hexToRgb.js +0 -42
  207. package/dist/functions/color-converter/hexToRgb.js.map +0 -1
  208. package/dist/functions/color-converter/hslToRgb.d.ts +0 -2
  209. package/dist/functions/color-converter/hslToRgb.js +0 -78
  210. package/dist/functions/color-converter/hslToRgb.js.map +0 -1
  211. package/dist/functions/color-converter/hueToRgb.d.ts +0 -1
  212. package/dist/functions/color-converter/hueToRgb.js +0 -14
  213. package/dist/functions/color-converter/hueToRgb.js.map +0 -1
  214. package/dist/functions/color-converter/isColorValue.d.ts +0 -2
  215. package/dist/functions/color-converter/isColorValue.js +0 -79
  216. package/dist/functions/color-converter/isColorValue.js.map +0 -1
  217. package/dist/functions/color-converter/normalizeColor.d.ts +0 -1
  218. package/dist/functions/color-converter/normalizeColor.js +0 -49
  219. package/dist/functions/color-converter/normalizeColor.js.map +0 -1
  220. package/dist/functions/color-converter/parseColorString.d.ts +0 -15
  221. package/dist/functions/color-converter/parseColorString.js +0 -116
  222. package/dist/functions/color-converter/parseColorString.js.map +0 -1
  223. package/dist/functions/color-converter/rgbToHex.d.ts +0 -2
  224. package/dist/functions/color-converter/rgbToHex.js +0 -65
  225. package/dist/functions/color-converter/rgbToHex.js.map +0 -1
  226. package/dist/functions/color-converter/standardizeColor.d.ts +0 -1
  227. package/dist/functions/color-converter/standardizeColor.js +0 -147
  228. package/dist/functions/color-converter/standardizeColor.js.map +0 -1
  229. package/dist/functions/desensitize/desensitizeName.d.ts +0 -1
  230. package/dist/functions/desensitize/desensitizeName.js +0 -8
  231. package/dist/functions/desensitize/desensitizeName.js.map +0 -1
  232. package/dist/functions/desensitize/desensitizePhone.d.ts +0 -1
  233. package/dist/functions/desensitize/desensitizePhone.js +0 -8
  234. package/dist/functions/desensitize/desensitizePhone.js.map +0 -1
  235. package/dist/functions/dom/getViewportSize.d.ts +0 -5
  236. package/dist/functions/dom/getViewportSize.js +0 -7
  237. package/dist/functions/dom/getViewportSize.js.map +0 -1
  238. package/dist/functions/software/buildPathExecutables.d.ts +0 -1
  239. package/dist/functions/software/buildPathExecutables.js +0 -4
  240. package/dist/functions/software/buildPathExecutables.js.map +0 -1
  241. package/dist/functions/software/buildSoftwarePaths.d.ts +0 -2
  242. package/dist/functions/software/buildSoftwarePaths.js +0 -22
  243. package/dist/functions/software/buildSoftwarePaths.js.map +0 -1
  244. package/dist/functions/software/createConfigGenerator.d.ts +0 -8
  245. package/dist/functions/software/createConfigGenerator.js +0 -13
  246. package/dist/functions/software/createConfigGenerator.js.map +0 -1
  247. package/dist/functions/software/detectPlatform.d.ts +0 -2
  248. package/dist/functions/software/detectPlatform.js +0 -4
  249. package/dist/functions/software/detectPlatform.js.map +0 -1
  250. package/dist/functions/software/find.d.ts +0 -2
  251. package/dist/functions/software/find.js +0 -12
  252. package/dist/functions/software/find.js.map +0 -1
  253. package/dist/functions/software/findSoftwareWithGenerator.d.ts +0 -3
  254. package/dist/functions/software/findSoftwareWithGenerator.js +0 -8
  255. package/dist/functions/software/findSoftwareWithGenerator.js.map +0 -1
  256. package/dist/functions/software/getConfigGenerator.d.ts +0 -2
  257. package/dist/functions/software/getConfigGenerator.js +0 -10
  258. package/dist/functions/software/getConfigGenerator.js.map +0 -1
  259. package/dist/functions/software/getEnvironmentSoftwarePath.d.ts +0 -1
  260. package/dist/functions/software/getEnvironmentSoftwarePath.js +0 -4
  261. package/dist/functions/software/getEnvironmentSoftwarePath.js.map +0 -1
  262. package/dist/functions/software/getSupportedSoftware.d.ts +0 -1
  263. package/dist/functions/software/getSupportedSoftware.js +0 -5
  264. package/dist/functions/software/getSupportedSoftware.js.map +0 -1
  265. package/dist/functions/software/parseEnvironmentPaths.d.ts +0 -1
  266. package/dist/functions/software/parseEnvironmentPaths.js +0 -7
  267. package/dist/functions/software/parseEnvironmentPaths.js.map +0 -1
  268. package/dist/functions/software/softwareConfigs.d.ts +0 -2
  269. package/dist/functions/software/softwareConfigs.js +0 -148
  270. package/dist/functions/software/softwareConfigs.js.map +0 -1
  271. package/dist/functions/software/softwareNameMap.d.ts +0 -1
  272. package/dist/functions/software/softwareNameMap.js +0 -9
  273. package/dist/functions/software/softwareNameMap.js.map +0 -1
  274. package/dist/functions/software/types.d.ts +0 -11
  275. package/dist/functions/software/types.js +0 -2
  276. package/dist/functions/software/types.js.map +0 -1
  277. package/dist/functions/string/camelCase.d.ts +0 -1
  278. package/dist/functions/string/camelCase.js +0 -8
  279. package/dist/functions/string/camelCase.js.map +0 -1
  280. package/dist/functions/string/capitalize.d.ts +0 -1
  281. package/dist/functions/string/capitalize.js +0 -6
  282. package/dist/functions/string/capitalize.js.map +0 -1
  283. package/dist/functions/string/escape.d.ts +0 -1
  284. package/dist/functions/string/escape.js +0 -13
  285. package/dist/functions/string/escape.js.map +0 -1
  286. package/dist/functions/string/kebabCase.d.ts +0 -1
  287. package/dist/functions/string/kebabCase.js +0 -10
  288. package/dist/functions/string/kebabCase.js.map +0 -1
  289. package/dist/functions/string/levenshtein.d.ts +0 -1
  290. package/dist/functions/string/levenshtein.js +0 -27
  291. package/dist/functions/string/levenshtein.js.map +0 -1
  292. package/dist/functions/string/mask.d.ts +0 -1
  293. package/dist/functions/string/mask.js +0 -40
  294. package/dist/functions/string/mask.js.map +0 -1
  295. package/dist/functions/string/normalize.d.ts +0 -8
  296. package/dist/functions/string/normalize.js +0 -37
  297. package/dist/functions/string/normalize.js.map +0 -1
  298. package/dist/functions/string/padEnd.d.ts +0 -1
  299. package/dist/functions/string/padEnd.js +0 -8
  300. package/dist/functions/string/padEnd.js.map +0 -1
  301. package/dist/functions/string/padStart.d.ts +0 -1
  302. package/dist/functions/string/padStart.js +0 -8
  303. package/dist/functions/string/padStart.js.map +0 -1
  304. package/dist/functions/string/palindrome.d.ts +0 -3
  305. package/dist/functions/string/palindrome.js +0 -15
  306. package/dist/functions/string/palindrome.js.map +0 -1
  307. package/dist/functions/string/pascalCase.d.ts +0 -1
  308. package/dist/functions/string/pascalCase.js +0 -8
  309. package/dist/functions/string/pascalCase.js.map +0 -1
  310. package/dist/functions/string/similarity.d.ts +0 -1
  311. package/dist/functions/string/similarity.js +0 -38
  312. package/dist/functions/string/similarity.js.map +0 -1
  313. package/dist/functions/string/snakeCase.d.ts +0 -1
  314. package/dist/functions/string/snakeCase.js +0 -10
  315. package/dist/functions/string/snakeCase.js.map +0 -1
  316. package/dist/functions/string/template.d.ts +0 -4
  317. package/dist/functions/string/template.js +0 -21
  318. package/dist/functions/string/template.js.map +0 -1
  319. package/dist/functions/string/unescape.d.ts +0 -1
  320. package/dist/functions/string/unescape.js +0 -13
  321. package/dist/functions/string/unescape.js.map +0 -1
  322. package/dist/functions/string/wordCount.d.ts +0 -5
  323. package/dist/functions/string/wordCount.js +0 -11
  324. package/dist/functions/string/wordCount.js.map +0 -1
  325. package/dist/functions/tencent-cloud/getSecret.d.ts +0 -7
  326. package/dist/functions/tencent-cloud/getSecret.js +0 -19
  327. package/dist/functions/tencent-cloud/getSecret.js.map +0 -1
  328. package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.d.ts +0 -13
  329. package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.js +0 -175
  330. package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.js.map +0 -1
  331. package/dist/functions/uniapp/app-plus/androidProjectStrategy.d.ts +0 -33
  332. package/dist/functions/uniapp/app-plus/androidProjectStrategy.js +0 -60
  333. package/dist/functions/uniapp/app-plus/androidProjectStrategy.js.map +0 -1
  334. package/dist/functions/uniapp/app-plus/buildAndroidProject.d.ts +0 -3
  335. package/dist/functions/uniapp/app-plus/buildAndroidProject.js +0 -60
  336. package/dist/functions/uniapp/app-plus/buildAndroidProject.js.map +0 -1
  337. package/dist/functions/uniapp/app-plus/configureAndroidManifest.d.ts +0 -5
  338. package/dist/functions/uniapp/app-plus/configureAndroidManifest.js +0 -51
  339. package/dist/functions/uniapp/app-plus/configureAndroidManifest.js.map +0 -1
  340. package/dist/functions/uniapp/app-plus/configureAndroidProject.d.ts +0 -3
  341. package/dist/functions/uniapp/app-plus/configureAndroidProject.js +0 -63
  342. package/dist/functions/uniapp/app-plus/configureAndroidProject.js.map +0 -1
  343. package/dist/functions/uniapp/app-plus/configureBuildGradle.d.ts +0 -9
  344. package/dist/functions/uniapp/app-plus/configureBuildGradle.js +0 -57
  345. package/dist/functions/uniapp/app-plus/configureBuildGradle.js.map +0 -1
  346. package/dist/functions/uniapp/app-plus/configureDcloudControl.d.ts +0 -5
  347. package/dist/functions/uniapp/app-plus/configureDcloudControl.js +0 -34
  348. package/dist/functions/uniapp/app-plus/configureDcloudControl.js.map +0 -1
  349. package/dist/functions/uniapp/app-plus/configureStrings.d.ts +0 -5
  350. package/dist/functions/uniapp/app-plus/configureStrings.js +0 -42
  351. package/dist/functions/uniapp/app-plus/configureStrings.js.map +0 -1
  352. package/dist/functions/uniapp/app-plus/copyAppResources.d.ts +0 -8
  353. package/dist/functions/uniapp/app-plus/copyAppResources.js +0 -25
  354. package/dist/functions/uniapp/app-plus/copyAppResources.js.map +0 -1
  355. package/dist/functions/uniapp/app-plus/copyDirectory.d.ts +0 -2
  356. package/dist/functions/uniapp/app-plus/copyDirectory.js +0 -18
  357. package/dist/functions/uniapp/app-plus/copyDirectory.js.map +0 -1
  358. package/dist/functions/uniapp/app-plus/generateUniAppResources.d.ts +0 -2
  359. package/dist/functions/uniapp/app-plus/generateUniAppResources.js +0 -35
  360. package/dist/functions/uniapp/app-plus/generateUniAppResources.js.map +0 -1
  361. package/dist/functions/uniapp/app-plus/parseManifest.d.ts +0 -14
  362. package/dist/functions/uniapp/app-plus/parseManifest.js.map +0 -1
  363. package/dist/functions/uniapp/app-plus/validateOptions.d.ts +0 -3
  364. package/dist/functions/uniapp/app-plus/validateOptions.js +0 -10
  365. package/dist/functions/uniapp/app-plus/validateOptions.js.map +0 -1
  366. package/dist/functions/uniapp/waitForPages.d.ts +0 -2
  367. package/dist/functions/uniapp/waitForPages.js +0 -19
  368. package/dist/functions/uniapp/waitForPages.js.map +0 -1
  369. package/dist/functions/utils/compose.d.ts +0 -1
  370. package/dist/functions/utils/compose.js +0 -10
  371. package/dist/functions/utils/compose.js.map +0 -1
  372. package/dist/functions/utils/cond.d.ts +0 -1
  373. package/dist/functions/utils/cond.js +0 -15
  374. package/dist/functions/utils/cond.js.map +0 -1
  375. package/dist/functions/utils/curry.d.ts +0 -1
  376. package/dist/functions/utils/curry.js +0 -13
  377. package/dist/functions/utils/curry.js.map +0 -1
  378. package/dist/functions/utils/debounce.d.ts +0 -1
  379. package/dist/functions/utils/debounce.js +0 -13
  380. package/dist/functions/utils/debounce.js.map +0 -1
  381. package/dist/functions/utils/evolve.d.ts +0 -3
  382. package/dist/functions/utils/evolve.js +0 -15
  383. package/dist/functions/utils/evolve.js.map +0 -1
  384. package/dist/functions/utils/flow.d.ts +0 -1
  385. package/dist/functions/utils/flow.js +0 -10
  386. package/dist/functions/utils/flow.js.map +0 -1
  387. package/dist/functions/utils/isType.d.ts +0 -11
  388. package/dist/functions/utils/isType.js +0 -30
  389. package/dist/functions/utils/isType.js.map +0 -1
  390. package/dist/functions/utils/memoize.d.ts +0 -1
  391. package/dist/functions/utils/memoize.js +0 -13
  392. package/dist/functions/utils/memoize.js.map +0 -1
  393. package/dist/functions/utils/once.d.ts +0 -1
  394. package/dist/functions/utils/once.js +0 -13
  395. package/dist/functions/utils/once.js.map +0 -1
  396. package/dist/functions/utils/partial.d.ts +0 -1
  397. package/dist/functions/utils/partial.js +0 -13
  398. package/dist/functions/utils/partial.js.map +0 -1
  399. package/dist/functions/utils/pipe.d.ts +0 -1
  400. package/dist/functions/utils/pipe.js +0 -10
  401. package/dist/functions/utils/pipe.js.map +0 -1
  402. package/dist/functions/utils/retryWithBackoff.d.ts +0 -9
  403. package/dist/functions/utils/retryWithBackoff.js +0 -30
  404. package/dist/functions/utils/retryWithBackoff.js.map +0 -1
  405. package/dist/functions/utils/tap.d.ts +0 -1
  406. package/dist/functions/utils/tap.js +0 -14
  407. package/dist/functions/utils/tap.js.map +0 -1
  408. package/dist/functions/utils/throttle.d.ts +0 -1
  409. package/dist/functions/utils/throttle.js +0 -11
  410. package/dist/functions/utils/throttle.js.map +0 -1
  411. package/dist/functions/utils/until.d.ts +0 -1
  412. package/dist/functions/utils/until.js +0 -10
  413. package/dist/functions/utils/until.js.map +0 -1
  414. package/dist/functions/utils/validate.d.ts +0 -8
  415. package/dist/functions/utils/validate.js +0 -45
  416. package/dist/functions/utils/validate.js.map +0 -1
  417. package/dist/functions/vue/dynamicMount.d.ts +0 -15
  418. package/dist/functions/vue/dynamicMount.js +0 -23
  419. package/dist/functions/vue/dynamicMount.js.map +0 -1
  420. package/dist/functions/vue/isVNode.d.ts +0 -2
  421. package/dist/functions/vue/isVNode.js +0 -4
  422. package/dist/functions/vue/isVNode.js.map +0 -1
  423. package/dist/functions/vue/isVueComponent.d.ts +0 -2
  424. package/dist/functions/vue/isVueComponent.js +0 -6
  425. package/dist/functions/vue/isVueComponent.js.map +0 -1
  426. package/dist/functions/vue/processVueFile.d.ts +0 -20
  427. package/dist/functions/vue/processVueFile.js +0 -98
  428. package/dist/functions/vue/processVueFile.js.map +0 -1
  429. package/dist/functions/wechat/miniapp/downloadFile.d.ts +0 -2
  430. package/dist/functions/wechat/miniapp/downloadFile.js +0 -39
  431. package/dist/functions/wechat/miniapp/downloadFile.js.map +0 -1
  432. package/dist/hooks/useAi.d.ts +0 -27
  433. package/dist/hooks/useAi.js +0 -163
  434. package/dist/hooks/useAi.js.map +0 -1
  435. package/dist/hooks/useCache.d.ts +0 -18
  436. package/dist/hooks/useCache.js +0 -82
  437. package/dist/hooks/useCache.js.map +0 -1
  438. package/dist/hooks/useFetch.d.ts +0 -3
  439. package/dist/hooks/useFetch.js +0 -154
  440. package/dist/hooks/useFetch.js.map +0 -1
  441. package/dist/hooks/usePluginSystem.d.ts +0 -11
  442. package/dist/hooks/usePluginSystem.js +0 -34
  443. package/dist/hooks/usePluginSystem.js.map +0 -1
  444. package/dist/hooks/useRequest.d.ts +0 -3
  445. package/dist/hooks/useRequest.js +0 -139
  446. package/dist/hooks/useRequest.js.map +0 -1
  447. package/dist/hooks/useWASM.d.ts +0 -4
  448. package/dist/hooks/useWASM.js +0 -267
  449. package/dist/hooks/useWASM.js.map +0 -1
  450. package/references/browser.extension.d.ts +0 -14
  451. package/types/network.d.ts +0 -184
  452. package/types/util.d.ts +0 -27
  453. package/types/wasm.d.ts +0 -217
@@ -1,92 +0,0 @@
1
- import { isApiKeyAuth } from './isApiKeyAuth';
2
- function parseAppInfoOutput(output, outputFormat) {
3
- const apps = [];
4
- if (outputFormat === 'xml') {
5
- const appMatches = output.match(/<dict[^>]*>[\s\S]*?<\/dict>/g) || [];
6
- for (const appMatch of appMatches) {
7
- const bundleIdMatch = appMatch.match(/<key>CFBundleIdentifier<\/key>\s*<string>([^<]+)<\/string>/);
8
- const nameMatch = appMatch.match(/<key>CFBundleDisplayName<\/key>\s*<string>([^<]+)<\/string>/);
9
- const versionMatch = appMatch.match(/<key>CFBundleShortVersionString<\/key>\s*<string>([^<]+)<\/string>/);
10
- const buildMatch = appMatch.match(/<key>CFBundleVersion<\/key>\s*<string>([^<]+)<\/string>/);
11
- if (bundleIdMatch) {
12
- apps.push({
13
- bundleId: bundleIdMatch[1],
14
- name: nameMatch?.[1] || '',
15
- version: versionMatch?.[1] || '',
16
- buildNumber: buildMatch?.[1] || '',
17
- status: 'Unknown'
18
- });
19
- }
20
- }
21
- }
22
- else {
23
- const lines = output.split('\n');
24
- let currentApp = {};
25
- for (const line of lines) {
26
- const trimmedLine = line.trim();
27
- if (trimmedLine.includes('Bundle ID:')) {
28
- currentApp.bundleId = trimmedLine.split('Bundle ID:')[1]?.trim();
29
- }
30
- else if (trimmedLine.includes('Name:')) {
31
- currentApp.name = trimmedLine.split('Name:')[1]?.trim();
32
- }
33
- else if (trimmedLine.includes('Version:')) {
34
- currentApp.version = trimmedLine.split('Version:')[1]?.trim();
35
- }
36
- else if (trimmedLine.includes('Build:')) {
37
- currentApp.buildNumber = trimmedLine.split('Build:')[1]?.trim();
38
- }
39
- else if (trimmedLine.includes('Status:')) {
40
- currentApp.status = trimmedLine.split('Status:')[1]?.trim();
41
- if (currentApp.bundleId) {
42
- apps.push({
43
- bundleId: currentApp.bundleId,
44
- name: currentApp.name || '',
45
- version: currentApp.version || '',
46
- buildNumber: currentApp.buildNumber || '',
47
- status: currentApp.status || 'Unknown'
48
- });
49
- }
50
- currentApp = {};
51
- }
52
- }
53
- }
54
- return apps;
55
- }
56
- export async function getAppInfo(altoolPath, options, childProcess) {
57
- const { type, auth, outputFormat = 'normal' } = options;
58
- const args = [
59
- '--list-apps',
60
- '--type', type,
61
- '--output-format', outputFormat
62
- ];
63
- if (isApiKeyAuth(auth)) {
64
- args.push('--apiKey', auth.apiKey);
65
- args.push('--apiIssuer', auth.apiIssuer);
66
- }
67
- else {
68
- args.push('--username', auth.username);
69
- args.push('--password', auth.password);
70
- }
71
- const command = `"${altoolPath}" ${args.map(arg => `"${arg}"`).join(' ')}`;
72
- return new Promise((resolve, reject) => {
73
- childProcess.exec(command, (error, stdout, stderr) => {
74
- const output = stdout || '';
75
- const errorOutput = stderr || '';
76
- if (error) {
77
- const errorMessage = errorOutput || error.message;
78
- reject(new Error(errorMessage));
79
- }
80
- else {
81
- try {
82
- const apps = parseAppInfoOutput(output, outputFormat);
83
- resolve(apps);
84
- }
85
- catch (parseError) {
86
- reject(new Error(`Failed to parse app info: ${parseError}`));
87
- }
88
- }
89
- });
90
- });
91
- }
92
- //# sourceMappingURL=getAppInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getAppInfo.js","sourceRoot":"","sources":["../../../src/functions/altool/getAppInfo.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAmC7C,SAAS,kBAAkB,CAAC,MAAc,EAAE,YAAoB;IAC9D,MAAM,IAAI,GAAc,EAAE,CAAA;IAE1B,IAAI,YAAY,KAAK,KAAK,EAAE,CAAC;QAE3B,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,IAAI,EAAE,CAAA;QAErE,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAClC,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAA;YAClG,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAC/F,MAAM,YAAY,GAAG,QAAQ,CAAC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, AltoolBaseOptions, AltoolCommand, AltoolBaseResult } from './types';
2
- export { isApiKeyAuth, isCredentialsAuth } from './types';
3
- export type { AltoolUploadOptions, AltoolUploadResult } from './uploadApp';
4
- export { uploadApp } from './uploadApp';
5
- export type { AltoolValidateOptions, AltoolValidateResult } from './validateApp';
6
- export { validateApp } from './validateApp';
7
- export type { AltoolAppInfoOptions, AppInfo, AltoolAppInfoResult } from './getAppInfo';
8
- export { getAppInfo } from './getAppInfo';
9
- export type { AltoolClientConfig, AltoolClient } from './createAltoolClient';
10
- export { createAltoolClient } from './createAltoolClient';
@@ -1,6 +0,0 @@
1
- export { isApiKeyAuth, isCredentialsAuth } from './types';
2
- export { uploadApp } from './uploadApp';
3
- export { validateApp } from './validateApp';
4
- export { getAppInfo } from './getAppInfo';
5
- export { createAltoolClient } from './createAltoolClient';
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/altool/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,YAAY,EACZ,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAQhB,OAAO,EACL,SAAS,EACV,MAAM,aAAa,CAAA;AAQpB,OAAO,EACL,WAAW,EACZ,MAAM,eAAe,CAAA;AAStB,OAAO,EACL,UAAU,EACX,MAAM,cAAc,CAAA;AAQrB,OAAO,EACL,kBAAkB,EACnB,MAAM,sBAAsB,CAAA"}
@@ -1,2 +0,0 @@
1
- import type { AltoolAuth, AltoolAuthApiKey } from '../../../types/altool.d';
2
- export declare function isApiKeyAuth(auth: AltoolAuth): auth is AltoolAuthApiKey;
@@ -1,4 +0,0 @@
1
- export function isApiKeyAuth(auth) {
2
- return 'apiKey' in auth && 'apiIssuer' in auth;
3
- }
4
- //# sourceMappingURL=isApiKeyAuth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isApiKeyAuth.js","sourceRoot":"","sources":["../../../src/functions/altool/isApiKeyAuth.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,QAAQ,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,CAAA;AAChD,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { AltoolAuth, AltoolAuthCredentials } from '../../../types/altool.d';
2
- export declare function isCredentialsAuth(auth: AltoolAuth): auth is AltoolAuthCredentials;
@@ -1,4 +0,0 @@
1
- export function isCredentialsAuth(auth) {
2
- return 'username' in auth && 'password' in auth;
3
- }
4
- //# sourceMappingURL=isCredentialsAuth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isCredentialsAuth.js","sourceRoot":"","sources":["../../../src/functions/altool/isCredentialsAuth.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,OAAO,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAA;AACjD,CAAC"}
@@ -1,26 +0,0 @@
1
- export type AltoolAppType = 'ios-app' | 'osx-app' | 'appletvos-app';
2
- export type AltoolOutputFormat = 'xml' | 'normal';
3
- export interface AltoolAuthCredentials {
4
- username: string;
5
- password: string;
6
- }
7
- export interface AltoolAuthApiKey {
8
- apiKey: string;
9
- apiIssuer: string;
10
- }
11
- export type AltoolAuth = AltoolAuthCredentials | AltoolAuthApiKey;
12
- export interface AltoolBaseOptions {
13
- type: AltoolAppType;
14
- outputFormat?: AltoolOutputFormat;
15
- auth: AltoolAuth;
16
- }
17
- export type AltoolCommand = 'upload-app' | 'validate-app' | 'list-apps';
18
- export interface AltoolBaseResult {
19
- success: boolean;
20
- output: string;
21
- error?: string;
22
- exitCode: number;
23
- command: string;
24
- }
25
- export declare function isApiKeyAuth(auth: AltoolAuth): auth is AltoolAuthApiKey;
26
- export declare function isCredentialsAuth(auth: AltoolAuth): auth is AltoolAuthCredentials;
@@ -1,7 +0,0 @@
1
- export function isApiKeyAuth(auth) {
2
- return 'apiKey' in auth && 'apiIssuer' in auth;
3
- }
4
- export function isCredentialsAuth(auth) {
5
- return 'username' in auth && 'password' in auth;
6
- }
7
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/functions/altool/types.ts"],"names":[],"mappings":"AAuEA,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,QAAQ,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,CAAA;AAChD,CAAC;AAOD,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,OAAO,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAA;AACjD,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { NodeChildProcess } from '../../../references/node.d';
2
- import type { AltoolBaseOptions } from '../../../types/altool.d';
3
- export interface AltoolUploadOptions extends AltoolBaseOptions {
4
- file: string;
5
- }
6
- export declare function uploadApp(altoolPath: string, options: AltoolUploadOptions, childProcess: NodeChildProcess): Promise<string>;
@@ -1,36 +0,0 @@
1
- import { isApiKeyAuth } from './isApiKeyAuth';
2
- export async function uploadApp(altoolPath, options, childProcess) {
3
- const { file, type, auth, outputFormat = 'normal' } = options;
4
- const args = [
5
- '--upload-app',
6
- '--file', file,
7
- '--type', type,
8
- '--output-format', outputFormat
9
- ];
10
- if (isApiKeyAuth(auth)) {
11
- args.push('--apiKey', auth.apiKey);
12
- args.push('--apiIssuer', auth.apiIssuer);
13
- }
14
- else {
15
- args.push('--username', auth.username);
16
- args.push('--password', auth.password);
17
- }
18
- const command = `"${altoolPath}" ${args.map(arg => `"${arg}"`).join(' ')}`;
19
- return new Promise((resolve, reject) => {
20
- childProcess.exec(command, (error, stdout, stderr) => {
21
- const output = stdout || '';
22
- const errorOutput = stderr || '';
23
- if (error) {
24
- const errorMessage = errorOutput || error.message;
25
- reject(new Error(`altool上传失败: ${errorMessage}`));
26
- }
27
- else if (errorOutput && errorOutput.includes('error')) {
28
- reject(new Error(`altool上传过程中出现错误: ${errorOutput}`));
29
- }
30
- else {
31
- resolve(output);
32
- }
33
- });
34
- });
35
- }
36
- //# sourceMappingURL=uploadApp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uploadApp.js","sourceRoot":"","sources":["../../../src/functions/altool/uploadApp.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAmB7C,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,UAAkB,EAClB,OAA4B,EAC5B,YAA8B;IAE9B,MAAM,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,YAAY,GAAG,QAAQ,EACxB,GAAG,OAAO,CAAA;IAGX,MAAM,IAAI,GAAG;QACX,cAAc;QACd,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;QACd,iBAAiB,EAAE,YAAY;KAChC,CAAA;IAGD,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QAEvB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAClC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAC1C,CAAC;SAAM,CAAC;QAEN,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACxC,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,UAAU,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IAE1E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACnD,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAA;YAC3B,MAAM,WAAW,GAAG,MAAM,IAAI,EAAE,CAAA;YAEhC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,YAAY,GAAG,WAAW,IAAI,KAAK,CAAC,OAAO,CAAA;gBACjD,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,YAAY,EAAE,CAAC,CAAC,CAAA;YAClD,CAAC;iBAAM,IAAI,WAAW,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACxD,MAAM,CAAC,IAAI,KAAK,CAAC,oBAAoB,WAAW,EAAE,CAAC,CAAC,CAAA;YACtD,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,CAAA;YACjB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { NodeChildProcess } from '../../../references/node.d';
2
- import type { AltoolBaseOptions } from '../../../types/altool.d';
3
- export interface AltoolValidateOptions extends AltoolBaseOptions {
4
- file: string;
5
- }
6
- export interface AltoolValidateResult {
7
- hasWarnings: boolean;
8
- hasErrors: boolean;
9
- warnings: string[];
10
- errors: string[];
11
- }
12
- export declare function validateApp(altoolPath: string, options: AltoolValidateOptions, childProcess: NodeChildProcess): Promise<{
13
- hasWarnings: boolean;
14
- hasErrors: boolean;
15
- warnings: string[];
16
- errors: string[];
17
- }>;
@@ -1,59 +0,0 @@
1
- import { isApiKeyAuth } from './isApiKeyAuth';
2
- function parseValidationOutput(output) {
3
- const warnings = [];
4
- const errors = [];
5
- const lines = output.split('\n');
6
- for (const line of lines) {
7
- const trimmedLine = line.trim();
8
- if (trimmedLine.includes('WARNING:') || trimmedLine.includes('Warning:')) {
9
- warnings.push(trimmedLine);
10
- }
11
- else if (trimmedLine.includes('ERROR:') || trimmedLine.includes('Error:')) {
12
- errors.push(trimmedLine);
13
- }
14
- }
15
- return {
16
- hasWarnings: warnings.length > 0,
17
- hasErrors: errors.length > 0,
18
- warnings,
19
- errors
20
- };
21
- }
22
- export async function validateApp(altoolPath, options, childProcess) {
23
- const { file, type, auth, outputFormat = 'normal' } = options;
24
- const args = [
25
- '--validate-app',
26
- '--file', file,
27
- '--type', type,
28
- '--output-format', outputFormat
29
- ];
30
- if (isApiKeyAuth(auth)) {
31
- args.push('--apiKey', auth.apiKey);
32
- args.push('--apiIssuer', auth.apiIssuer);
33
- }
34
- else {
35
- args.push('--username', auth.username);
36
- args.push('--password', auth.password);
37
- }
38
- const command = `"${altoolPath}" ${args.map(arg => `"${arg}"`).join(' ')}`;
39
- return new Promise((resolve, reject) => {
40
- childProcess.exec(command, (error, stdout, stderr) => {
41
- const output = stdout || '';
42
- const errorOutput = stderr || '';
43
- const validationDetails = parseValidationOutput(output + errorOutput);
44
- if (error) {
45
- const errorMessage = errorOutput || error.message;
46
- reject(new Error(errorMessage));
47
- }
48
- else {
49
- if (validationDetails.hasErrors) {
50
- reject(new Error('Validation failed with errors: ' + validationDetails.errors.join(', ')));
51
- }
52
- else {
53
- resolve(validationDetails);
54
- }
55
- }
56
- });
57
- });
58
- }
59
- //# sourceMappingURL=validateApp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateApp.js","sourceRoot":"","sources":["../../../src/functions/altool/validateApp.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AA6B7C,SAAS,qBAAqB,CAAC,MAAc;IAC3C,MAAM,QAAQ,GAAa,EAAE,CAAA;IAC7B,MAAM,MAAM,GAAa,EAAE,CAAA;IAE3B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QAC/B,IAAI,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,UAAU,C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C,EAAE,CAAA;IAE1E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACnD,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAA;YAC3B,MAAM,WAAW,GAAG,MAAM,IAAI,EAAE,CAAA;YAGhC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,MAAM,GAAG,WAAW,CAAC,CAAA;YAErE,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,YAAY,GAAG,WAAW,IAAI,KAAK,CAAC,OAAO,CAAA;gBACjD,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;YACjC,CAAC;iBAAM,CAAC;gBAEN,IAAI,iBAAiB,CAAC,SAAS,EAAE,CAAC;oBAChC,MAAM,CAAC,IAAI,KAAK,CAAC,iCAAiC,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBAC5F,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,iBAAiB,CAAC,CAAA;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { Base64Encoder } from '../../../references/browser.d';
2
- export declare const strToBase64: (str: string, base64Encoder: Base64Encoder) => string;
@@ -1,6 +0,0 @@
1
- export const strToBase64 = (str, base64Encoder) => {
2
- return base64Encoder.btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
3
- return String.fromCharCode(parseInt(p1, 16));
4
- }));
5
- };
6
- //# sourceMappingURL=strToBase64.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strToBase64.js","sourceRoot":"","sources":["../../../src/functions/base64/strToBase64.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,aAA4B,EAAU,EAAE;IAC/E,OAAO,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QACzF,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { ColorPatterns } from '../../../types/color.d';
2
- export declare const COLOR_PATTERNS: ColorPatterns;
@@ -1 +0,0 @@
1
- {"version":3,"file":"COLOR_PATTERNS.js","sourceRoot":"","sources":["../../../src/functions/color-converter/COLOR_PATTERNS.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAC,MAAM,cAAc,GAAkB;IAE3C,GAAG,EAAE,kEAAkE;IAGvE,GAAG,EAAE,8CAA8C;IAGnD,IAAI,EAAE,8DAA8D;IAGpE,GAAG,EAAE,gDAAgD;IAGrD,IAAI,EAAE,gEAAgE;IAGtE,WAAW,EAAE,wFAAwF;CACtG,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { ColorPatterns, NamedColorMap } from '../../../types/color.d';
2
- export declare const COLOR_PATTERNS: ColorPatterns;
3
- export declare const NAMED_COLOR_MAP: NamedColorMap;
4
- export declare function detectColorFormat(color: string): keyof ColorPatterns | undefined;
@@ -1,41 +0,0 @@
1
- export const COLOR_PATTERNS = {
2
- hex: /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,
3
- rgb: /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,
4
- rgba: /^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/,
5
- hsl: /^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$/,
6
- hsla: /^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d.]+)\s*\)$/,
7
- namedColors: /^(red|green|blue|yellow|orange|purple|pink|brown|black|white|gray|grey|cyan|magenta)$/i
8
- };
9
- export const NAMED_COLOR_MAP = {
10
- 'red': '#ff0000',
11
- 'green': '#00ff00',
12
- 'blue': '#0000ff',
13
- 'yellow': '#ffff00',
14
- 'orange': '#ffa500',
15
- 'purple': '#800080',
16
- 'pink': '#ffc0cb',
17
- 'brown': '#a52a2a',
18
- 'black': '#000000',
19
- 'white': '#ffffff',
20
- 'gray': '#808080',
21
- 'grey': '#808080',
22
- 'cyan': '#00ffff',
23
- 'magenta': '#ff00ff'
24
- };
25
- export function detectColorFormat(color) {
26
- const trimmedColor = color.trim();
27
- if (COLOR_PATTERNS.hex.test(trimmedColor))
28
- return 'hex';
29
- if (COLOR_PATTERNS.rgba.test(trimmedColor))
30
- return 'rgba';
31
- if (COLOR_PATTERNS.rgb.test(trimmedColor))
32
- return 'rgb';
33
- if (COLOR_PATTERNS.hsla.test(trimmedColor))
34
- return 'hsla';
35
- if (COLOR_PATTERNS.hsl.test(trimmedColor))
36
- return 'hsl';
37
- if (COLOR_PATTERNS.namedColors.test(trimmedColor))
38
- return 'namedColors';
39
- return undefined;
40
- }
41
- //# sourceMappingURL=colorPatterns.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"colorPatterns.js","sourceRoot":"","sources":["../../../src/functions/color-converter/colorPatterns.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,cAAc,GAAkB;IAE3C,GAAG,EAAE,kEAAkE;IAGvE,GAAG,EAAE,8CAA8C;IAGnD,IAAI,EAAE,8DAA8D;IAGpE,GAAG,EAAE,gDAAgD;IAGrD,IAAI,EAAE,gEAAgE;IAGtE,WAAW,EAAE,wFAAwF;CACtG,CAAA;AAKD,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,SAAS;CACrB,CAAA;AAOD,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAEjC,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,MAAM,CAAA;IACzD,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,MAAM,CAAA;IACzD,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,aAAa,CAAA;IAEvE,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -1,238 +0,0 @@
1
- import { parseColorString, isValidRgbColor, isValidHslColor } from './parseColorString';
2
- import { hueToRgb } from './hueToRgb';
3
- import { getNamedColorMap } from './getNamedColorMap';
4
- import { detectColorFormat } from './detectColorFormat';
5
- export function convertColor(input, targetFormat, options = {}) {
6
- const { includeAlpha = false, precision = 0 } = options;
7
- function normalizeInput(input) {
8
- if (Array.isArray(input)) {
9
- if (input.length >= 3) {
10
- const [r, g, b, a = 1] = input;
11
- if (typeof r === 'number' && typeof g === 'number' && typeof b === 'number') {
12
- const rgb = { r: Math.round(r), g: Math.round(g), b: Math.round(b) };
13
- if (isValidRgbColor(rgb)) {
14
- return { rgb, alpha: typeof a === 'number' ? a : 1, originalFormat: 'rgb' };
15
- }
16
- }
17
- }
18
- return null;
19
- }
20
- if (typeof input === 'object' && input !== null) {
21
- if ('r' in input && 'g' in input && 'b' in input) {
22
- const rgb = input;
23
- if (isValidRgbColor(rgb)) {
24
- const alpha = 'a' in input ? input.a : 1;
25
- return { rgb, alpha, originalFormat: 'a' in input ? 'rgba' : 'rgb' };
26
- }
27
- }
28
- if ('h' in input && 's' in input && 'l' in input) {
29
- const hsl = input;
30
- if (isValidHslColor(hsl)) {
31
- const rgb = hslToRgbInternal(hsl);
32
- if (rgb) {
33
- const alpha = 'a' in input ? input.a : 1;
34
- return { rgb, alpha, originalFormat: 'a' in input ? 'hsla' : 'hsl' };
35
- }
36
- }
37
- }
38
- return null;
39
- }
40
- if (typeof input === 'string') {
41
- const trimmed = input.trim();
42
- const format = detectColorFormat(trimmed);
43
- if (!format) {
44
- return null;
45
- }
46
- switch (format) {
47
- case 'hex':
48
- return parseHexColor(trimmed);
49
- case 'rgb':
50
- case 'rgba': {
51
- const parseResult = parseColorString(trimmed);
52
- if (parseResult.isValid && (parseResult.type === 'rgb' || parseResult.type === 'rgba')) {
53
- const value = parseResult.value;
54
- return {
55
- rgb: { r: value.r, g: value.g, b: value.b },
56
- alpha: value.a ?? 1,
57
- originalFormat: parseResult.type
58
- };
59
- }
60
- break;
61
- }
62
- case 'hsl':
63
- case 'hsla': {
64
- const parseResult = parseColorString(trimmed);
65
- if (parseResult.isValid && (parseResult.type === 'hsl' || parseResult.type === 'hsla')) {
66
- const value = parseResult.value;
67
- const rgb = hslToRgbInternal(value);
68
- if (rgb) {
69
- return {
70
- rgb,
71
- alpha: value.a ?? 1,
72
- originalFormat: parseResult.type
73
- };
74
- }
75
- }
76
- break;
77
- }
78
- case 'named': {
79
- const namedColorMap = getNamedColorMap();
80
- const hexValue = namedColorMap[trimmed.toLowerCase()];
81
- if (hexValue) {
82
- const result = parseHexColor(hexValue);
83
- if (result) {
84
- return { ...result, originalFormat: 'named' };
85
- }
86
- }
87
- break;
88
- }
89
- }
90
- }
91
- return null;
92
- }
93
- function parseHexColor(hex) {
94
- const cleanHex = hex.replace(/^#/, '');
95
- if (!/^[0-9a-fA-F]+$/.test(cleanHex)) {
96
- return null;
97
- }
98
- let r, g, b, alpha = 1;
99
- switch (cleanHex.length) {
100
- case 3:
101
- r = parseInt(cleanHex[0] + cleanHex[0], 16);
102
- g = parseInt(cleanHex[1] + cleanHex[1], 16);
103
- b = parseInt(cleanHex[2] + cleanHex[2], 16);
104
- break;
105
- case 4:
106
- r = parseInt(cleanHex[0] + cleanHex[0], 16);
107
- g = parseInt(cleanHex[1] + cleanHex[1], 16);
108
- b = parseInt(cleanHex[2] + cleanHex[2], 16);
109
- alpha = parseInt(cleanHex[3] + cleanHex[3], 16) / 255;
110
- break;
111
- case 6:
112
- r = parseInt(cleanHex.substring(0, 2), 16);
113
- g = parseInt(cleanHex.substring(2, 4), 16);
114
- b = parseInt(cleanHex.substring(4, 6), 16);
115
- break;
116
- case 8:
117
- r = parseInt(cleanHex.substring(0, 2), 16);
118
- g = parseInt(cleanHex.substring(2, 4), 16);
119
- b = parseInt(cleanHex.substring(4, 6), 16);
120
- alpha = parseInt(cleanHex.substring(6, 8), 16) / 255;
121
- break;
122
- default:
123
- return null;
124
- }
125
- if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(alpha)) {
126
- return null;
127
- }
128
- return {
129
- rgb: { r, g, b },
130
- alpha,
131
- originalFormat: 'hex'
132
- };
133
- }
134
- function hslToRgbInternal(hsl) {
135
- let h = hsl.h % 360;
136
- if (h < 0)
137
- h += 360;
138
- const s = Math.max(0, Math.min(100, hsl.s)) / 100;
139
- const l = Math.max(0, Math.min(100, hsl.l)) / 100;
140
- if (s === 0) {
141
- const gray = Math.round(l * 255);
142
- return { r: gray, g: gray, b: gray };
143
- }
144
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
145
- const p = 2 * l - q;
146
- const hNormalized = h / 360;
147
- const r = hueToRgb(p, q, hNormalized + 1 / 3);
148
- const g = hueToRgb(p, q, hNormalized);
149
- const b = hueToRgb(p, q, hNormalized - 1 / 3);
150
- return {
151
- r: Math.round(r * 255),
152
- g: Math.round(g * 255),
153
- b: Math.round(b * 255)
154
- };
155
- }
156
- function rgbToHslInternal(rgb) {
157
- const r = rgb.r / 255;
158
- const g = rgb.g / 255;
159
- const b = rgb.b / 255;
160
- const max = Math.max(r, g, b);
161
- const min = Math.min(r, g, b);
162
- const diff = max - min;
163
- let h = 0;
164
- let s = 0;
165
- const l = (max + min) / 2;
166
- if (diff !== 0) {
167
- s = l > 0.5 ? diff / (2 - max - min) : diff / (max + min);
168
- switch (max) {
169
- case r:
170
- h = ((g - b) / diff + (g < b ? 6 : 0)) / 6;
171
- break;
172
- case g:
173
- h = ((b - r) / diff + 2) / 6;
174
- break;
175
- case b:
176
- h = ((r - g) / diff + 4) / 6;
177
- break;
178
- }
179
- }
180
- return {
181
- h: Math.round(h * 360),
182
- s: Math.round(s * 100),
183
- l: Math.round(l * 100)
184
- };
185
- }
186
- function formatOutput(rgb, alpha, targetFormat, options) {
187
- const { includeAlpha = false, precision = 0 } = options;
188
- const r = Math.max(0, Math.min(255, Math.round(rgb.r)));
189
- const g = Math.max(0, Math.min(255, Math.round(rgb.g)));
190
- const b = Math.max(0, Math.min(255, Math.round(rgb.b)));
191
- const a = Math.max(0, Math.min(1, alpha));
192
- switch (targetFormat) {
193
- case 'hex': {
194
- const toHex = (value) => {
195
- const hex = value.toString(16);
196
- return hex.length === 1 ? '0' + hex : hex;
197
- };
198
- let result = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
199
- if (includeAlpha || a < 1) {
200
- const alphaHex = Math.round(a * 255);
201
- result += toHex(alphaHex);
202
- }
203
- return result;
204
- }
205
- case 'rgb':
206
- return `rgb(${r}, ${g}, ${b})`;
207
- case 'rgba':
208
- return `rgba(${r}, ${g}, ${b}, ${a.toFixed(precision)})`;
209
- case 'hsl': {
210
- const hsl = rgbToHslInternal({ r, g, b });
211
- return `hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)`;
212
- }
213
- case 'hsla': {
214
- const hsl = rgbToHslInternal({ r, g, b });
215
- return `hsla(${hsl.h}, ${hsl.s}%, ${hsl.l}%, ${a.toFixed(precision)})`;
216
- }
217
- case 'named': {
218
- const namedColorMap = getNamedColorMap();
219
- const targetHex = `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
220
- for (const [name, hex] of Object.entries(namedColorMap)) {
221
- if (hex.toLowerCase() === targetHex.toLowerCase()) {
222
- return name;
223
- }
224
- }
225
- return targetHex;
226
- }
227
- default:
228
- return null;
229
- }
230
- }
231
- const normalizedInput = normalizeInput(input);
232
- if (!normalizedInput) {
233
- return null;
234
- }
235
- const { rgb, alpha } = normalizedInput;
236
- return formatOutput(rgb, alpha, targetFormat, { includeAlpha, precision });
237
- }
238
- //# sourceMappingURL=convertColor.js.map