zcw-shared 1.5.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/README.md +93 -363
  2. package/dist/constants/colorPatterns.d.ts +8 -2
  3. package/dist/constants/colorPatterns.js.map +1 -1
  4. package/dist/constants/namedColors.d.ts +16 -2
  5. package/dist/constants/namedColors.js.map +1 -1
  6. package/dist/constants/softwareConfigs.d.ts +0 -1
  7. package/dist/constants/softwareConfigs.js +0 -1
  8. package/dist/constants/softwareConfigs.js.map +1 -1
  9. package/dist/functions/ag-grid/generateLicense.d.ts +2 -2
  10. package/dist/functions/android/buildProject.d.ts +12 -0
  11. package/dist/functions/android/buildProject.js +123 -0
  12. package/dist/functions/android/buildProject.js.map +1 -0
  13. package/dist/functions/android/modifyGradle.d.ts +17 -0
  14. package/dist/functions/android/modifyGradle.js +69 -0
  15. package/dist/functions/android/modifyGradle.js.map +1 -0
  16. package/dist/functions/android/modifyManifest.d.ts +23 -0
  17. package/dist/functions/android/modifyManifest.js +198 -0
  18. package/dist/functions/android/modifyManifest.js.map +1 -0
  19. package/dist/functions/android/permission.d.ts +30 -0
  20. package/dist/functions/android/permission.js +65 -0
  21. package/dist/functions/android/permission.js.map +1 -0
  22. package/dist/functions/color/colorValidation.d.ts +11 -0
  23. package/dist/functions/color/colorValidation.js +35 -0
  24. package/dist/functions/color/colorValidation.js.map +1 -0
  25. package/dist/functions/color/convertColor.d.ts +0 -1
  26. package/dist/functions/color/convertColor.js +135 -166
  27. package/dist/functions/color/convertColor.js.map +1 -1
  28. package/dist/functions/color/deduplicateColors.js +23 -38
  29. package/dist/functions/color/deduplicateColors.js.map +1 -1
  30. package/dist/functions/color/detectColorFormat.d.ts +8 -2
  31. package/dist/functions/color/detectColorFormat.js +49 -51
  32. package/dist/functions/color/detectColorFormat.js.map +1 -1
  33. package/dist/functions/color/extractColors.js +48 -18
  34. package/dist/functions/color/extractColors.js.map +1 -1
  35. package/dist/functions/css/extractCssVariables.d.ts +1 -1
  36. package/dist/functions/css/extractCssVariables.js +1 -1
  37. package/dist/functions/css/extractCssVariables.js.map +1 -1
  38. package/dist/functions/debug/createDebugger.d.ts +8 -7
  39. package/dist/functions/debug/createDebugger.js +49 -39
  40. package/dist/functions/debug/createDebugger.js.map +1 -1
  41. package/dist/functions/dom/detectOverflow.d.ts +3 -3
  42. package/dist/functions/dom/detectOverflow.js +3 -3
  43. package/dist/functions/dom/detectOverflow.js.map +1 -1
  44. package/dist/functions/dom/getElementRect.d.ts +1 -1
  45. package/dist/functions/dom/getElementRect.js.map +1 -1
  46. package/dist/functions/dom/getRelativePosition.d.ts +1 -1
  47. package/dist/functions/dom/getRelativePosition.js.map +1 -1
  48. package/dist/functions/dom/getViewportRect.d.ts +2 -2
  49. package/dist/functions/dom/getViewportRect.js +2 -2
  50. package/dist/functions/dom/getViewportRect.js.map +1 -1
  51. package/dist/functions/dom/getViewportSize.d.ts +2 -2
  52. package/dist/functions/dom/getViewportSize.js.map +1 -1
  53. package/dist/functions/image/generateMacIcons.d.ts +3 -3
  54. package/dist/functions/image/generateMacIcons.js.map +1 -1
  55. package/dist/functions/image/generateMacTrayIcon.d.ts +3 -3
  56. package/dist/functions/image/generateMacTrayIcon.js.map +1 -1
  57. package/dist/functions/image/generatePaddedImage.d.ts +2 -2
  58. package/dist/functions/image/generatePaddedImage.js.map +1 -1
  59. package/dist/functions/image/generatePwaIcons.d.ts +3 -3
  60. package/dist/functions/image/generatePwaIcons.js.map +1 -1
  61. package/dist/functions/image/generateRoundedImage.d.ts +2 -2
  62. package/dist/functions/image/generateRoundedImage.js.map +1 -1
  63. package/dist/functions/ipc/dispatchIpcRequest.d.ts +2 -2
  64. package/dist/functions/ipc/dispatchIpcRequest.js +1 -1
  65. package/dist/functions/ipc/dispatchIpcRequest.js.map +1 -1
  66. package/dist/functions/software/findSoftware.d.ts +3 -3
  67. package/dist/functions/software/findSoftware.js +7 -9
  68. package/dist/functions/software/findSoftware.js.map +1 -1
  69. package/dist/functions/string/base64.d.ts +1 -1
  70. package/dist/functions/string/capitalize.js.map +1 -1
  71. package/dist/functions/string/caseConverter.d.ts +0 -1
  72. package/dist/functions/string/caseConverter.js +1 -8
  73. package/dist/functions/string/caseConverter.js.map +1 -1
  74. package/dist/functions/string/desensitize.js.map +1 -1
  75. package/dist/functions/string/htmlEscape.d.ts +4 -1
  76. package/dist/functions/string/htmlEscape.js +37 -25
  77. package/dist/functions/string/htmlEscape.js.map +1 -1
  78. package/dist/functions/string/levenshtein.js.map +1 -1
  79. package/dist/functions/string/normalize.js.map +1 -1
  80. package/dist/functions/string/pad.d.ts +0 -1
  81. package/dist/functions/string/pad.js +0 -3
  82. package/dist/functions/string/pad.js.map +1 -1
  83. package/dist/functions/string/palindrome.js.map +1 -1
  84. package/dist/functions/string/similarity.js.map +1 -1
  85. package/dist/functions/string/template.js.map +1 -1
  86. package/dist/functions/string/wordCount.js.map +1 -1
  87. package/dist/functions/tencent-cloud/getSecret.js.map +1 -1
  88. package/dist/functions/uniapp/app-plus/androidProjectStrategy.d.ts +7 -7
  89. package/dist/functions/uniapp/app-plus/androidProjectStrategy.js.map +1 -1
  90. package/dist/functions/uniapp/app-plus/buildAndroidApp.d.ts +2 -2
  91. package/dist/functions/uniapp/app-plus/buildAndroidApp.js +98 -24
  92. package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +1 -1
  93. package/dist/functions/uniapp/app-plus/configureAndroidManifest.d.ts +2 -2
  94. package/dist/functions/uniapp/app-plus/configureAndroidManifest.js.map +1 -1
  95. package/dist/functions/uniapp/app-plus/configureBuildGradle.d.ts +3 -3
  96. package/dist/functions/uniapp/app-plus/configureBuildGradle.js.map +1 -1
  97. package/dist/functions/uniapp/app-plus/configureDcloudControl.d.ts +2 -2
  98. package/dist/functions/uniapp/app-plus/configureDcloudControl.js.map +1 -1
  99. package/dist/functions/uniapp/app-plus/configureStrings.d.ts +2 -2
  100. package/dist/functions/uniapp/app-plus/configureStrings.js.map +1 -1
  101. package/dist/functions/uniapp/app-plus/copyAppResources.d.ts +2 -2
  102. package/dist/functions/uniapp/app-plus/copyAppResources.js.map +1 -1
  103. package/dist/functions/uniapp/app-plus/parseManifest.d.ts +2 -2
  104. package/dist/functions/uniapp/app-plus/parseManifest.js.map +1 -1
  105. package/dist/functions/uniapp/app-plus/validateOptions.d.ts +2 -2
  106. package/dist/functions/uniapp/app-plus/validateOptions.js.map +1 -1
  107. package/dist/functions/uniapp/build.d.ts +20 -0
  108. package/dist/functions/uniapp/build.js +84 -0
  109. package/dist/functions/uniapp/build.js.map +1 -0
  110. package/dist/functions/uniapp/detectAndroidProjectStructure.d.ts +7 -0
  111. package/dist/functions/uniapp/detectAndroidProjectStructure.js +30 -0
  112. package/dist/functions/uniapp/detectAndroidProjectStructure.js.map +1 -0
  113. package/dist/functions/uniapp/detectProjectType.d.ts +16 -0
  114. package/dist/functions/uniapp/detectProjectType.js +68 -0
  115. package/dist/functions/uniapp/detectProjectType.js.map +1 -0
  116. package/dist/functions/uniapp/parseManifest.d.ts +12 -0
  117. package/dist/functions/uniapp/parseManifest.js +46 -0
  118. package/dist/functions/uniapp/parseManifest.js.map +1 -0
  119. package/dist/functions/uniapp/waitForPages.d.ts +3 -2
  120. package/dist/functions/uniapp/waitForPages.js.map +1 -1
  121. package/dist/functions/utils/compose.js.map +1 -1
  122. package/dist/functions/utils/cond.js.map +1 -1
  123. package/dist/functions/utils/curry.js.map +1 -1
  124. package/dist/functions/utils/debounce.js.map +1 -1
  125. package/dist/functions/utils/evolve.js.map +1 -1
  126. package/dist/functions/utils/flow.js.map +1 -1
  127. package/dist/functions/utils/generateExports.d.ts +16 -0
  128. package/dist/functions/utils/generateExports.js +34 -0
  129. package/dist/functions/utils/generateExports.js.map +1 -0
  130. package/dist/functions/utils/isType.js.map +1 -1
  131. package/dist/functions/utils/memoize.js.map +1 -1
  132. package/dist/functions/utils/once.js.map +1 -1
  133. package/dist/functions/utils/partial.js.map +1 -1
  134. package/dist/functions/utils/pipe.js.map +1 -1
  135. package/dist/functions/utils/retryWithBackoff.js.map +1 -1
  136. package/dist/functions/utils/tap.js.map +1 -1
  137. package/dist/functions/utils/throttle.js.map +1 -1
  138. package/dist/functions/utils/until.js.map +1 -1
  139. package/dist/functions/utils/validate.js.map +1 -1
  140. package/dist/functions/utils/walk.d.ts +11 -0
  141. package/dist/functions/utils/walk.js +27 -0
  142. package/dist/functions/utils/walk.js.map +1 -0
  143. package/dist/functions/vue/dynamicMount.d.ts +5 -5
  144. package/dist/functions/vue/dynamicMount.js +3 -1
  145. package/dist/functions/vue/dynamicMount.js.map +1 -1
  146. package/dist/functions/vue/extractColorsFromVueFile.js +2 -11
  147. package/dist/functions/vue/extractColorsFromVueFile.js.map +1 -1
  148. package/dist/functions/vue/extractColorsFromVueSection.js.map +1 -1
  149. package/dist/functions/vue/filterSections.js.map +1 -1
  150. package/dist/functions/vue/isVNode.js +3 -1
  151. package/dist/functions/vue/isVNode.js.map +1 -1
  152. package/dist/functions/vue/isVueComponent.js.map +1 -1
  153. package/dist/functions/vue/parseVueFile.js.map +1 -1
  154. package/dist/functions/wechat/miniapp/downloadFile.d.ts +2 -2
  155. package/dist/functions/wechat/miniapp/downloadFile.js +8 -8
  156. package/dist/functions/wechat/miniapp/downloadFile.js.map +1 -1
  157. package/dist/functions/xml/modifyXml.d.ts +11 -0
  158. package/dist/functions/xml/modifyXml.js +46 -0
  159. package/dist/functions/xml/modifyXml.js.map +1 -0
  160. package/dist/hooks/useAi.d.ts +3 -3
  161. package/dist/hooks/useAi.js.map +1 -1
  162. package/dist/hooks/useAltool.d.ts +3 -32
  163. package/dist/hooks/useAltool.js.map +1 -1
  164. package/dist/hooks/useFetch.d.ts +2 -2
  165. package/dist/hooks/useFetch.js.map +1 -1
  166. package/dist/hooks/useLocalStorage.d.ts +4 -4
  167. package/dist/hooks/useLocalStorage.js +51 -18
  168. package/dist/hooks/useLocalStorage.js.map +1 -1
  169. package/dist/hooks/useSessionStorage.d.ts +4 -4
  170. package/dist/hooks/useSessionStorage.js +51 -18
  171. package/dist/hooks/useSessionStorage.js.map +1 -1
  172. package/dist/hooks/useStorage.d.ts +10 -3
  173. package/dist/hooks/useStorage.js +33 -35
  174. package/dist/hooks/useStorage.js.map +1 -1
  175. package/dist/hooks/useStorageWithIndexedDB.d.ts +4 -4
  176. package/dist/hooks/useStorageWithIndexedDB.js +39 -29
  177. package/dist/hooks/useStorageWithIndexedDB.js.map +1 -1
  178. package/dist/hooks/useWASM.d.ts +2 -2
  179. package/dist/hooks/useWASM.js +6 -10
  180. package/dist/hooks/useWASM.js.map +1 -1
  181. package/dist/hooks/useWebWorker.d.ts +25 -4
  182. package/dist/hooks/useWebWorker.js.map +1 -1
  183. package/dist/hooks/useWorkerFunction.d.ts +22 -4
  184. package/dist/hooks/useWorkerFunction.js +1 -1
  185. package/dist/hooks/useWorkerFunction.js.map +1 -1
  186. package/dist/hooks/useWorkerPool.d.ts +30 -4
  187. package/dist/hooks/useWorkerPool.js.map +1 -1
  188. package/package.json +17 -22
  189. package/references/arraybuffer.d.ts +109 -0
  190. package/references/blob.d.ts +37 -0
  191. package/references/browser.d.ts +55 -160
  192. package/references/chrome.extension.d.ts +83 -0
  193. package/references/console.d.ts +3 -142
  194. package/references/{crypto.d.ts → crypto-js.d.ts} +1 -1
  195. package/references/dom.d.ts +41 -0
  196. package/references/encoding.d.ts +24 -0
  197. package/references/fetch.d.ts +6 -151
  198. package/references/indexeddb.d.ts +49 -0
  199. package/references/json5.d.ts +0 -7
  200. package/references/location.d.ts +16 -0
  201. package/references/node.d.ts +105 -94
  202. package/references/storage.d.ts +6 -100
  203. package/references/timer.d.ts +4 -5
  204. package/references/uniapp.d.ts +47 -5
  205. package/references/url.d.ts +9 -114
  206. package/references/vue.d.ts +71 -98
  207. package/references/webassembly.d.ts +96 -122
  208. package/references/wechat.d.ts +1 -1
  209. package/references/worker.d.ts +78 -132
  210. package/references/xml.d.ts +71 -39
  211. package/types/altool.d.ts +49 -17
  212. package/types/android-build.d.ts +31 -56
  213. package/types/color.d.ts +0 -90
  214. package/types/geometry.d.ts +1 -38
  215. package/types/platform.d.ts +4 -0
  216. package/types/software.d.ts +0 -12
  217. package/types/storage.d.ts +3 -1
  218. package/types/uniapp-android-build.d.ts +49 -0
  219. package/types/worker.d.ts +3 -189
  220. package/references/browser.extension.d.ts +0 -14
  221. package/types/network.d.ts +0 -184
  222. package/types/util.d.ts +0 -27
  223. package/types/wasm.d.ts +0 -217
@@ -1,42 +1,24 @@
1
1
  /**
2
2
  * Web Worker 环境类型定义
3
- * 包含浏览器和其他环境的 Worker API 类型支持
3
+ * 提供核心 Worker API 的类型支持
4
4
  */
5
5
 
6
- /**
7
- * Worker 构造函数选项
8
- */
9
- export interface WorkerOptions {
10
- type?: 'classic' | 'module'
11
- credentials?: 'omit' | 'same-origin' | 'include'
6
+ // 核心类型定义
7
+ export type WorkerType = 'classic' | 'module'
8
+ export type WorkerCredentials = 'omit' | 'same-origin' | 'include'
9
+ export type ServiceWorkerState = 'installing' | 'installed' | 'activating' | 'activated' | 'redundant'
10
+
11
+ // 配置接口
12
+ export interface WorkerConfig {
13
+ type?: WorkerType
14
+ credentials?: WorkerCredentials
12
15
  name?: string
13
16
  }
14
17
 
15
- /**
16
- * Transferable 对象接口
17
- */
18
- export interface Transferable {
19
- // 标记接口,用于类型检查
20
- }
18
+ // 标记接口
19
+ export interface Transferable {}
21
20
 
22
- /**
23
- * Worker 全局作用域接口
24
- */
25
- export interface WorkerGlobalScope extends EventTarget {
26
- self: WorkerGlobalScope
27
- location: WorkerLocation
28
- navigator: WorkerNavigator
29
- importScripts(...urls: string[]): void
30
- close(): void
31
- postMessage(message: any, transfer?: Transferable[]): void
32
- onmessage: ((event: MessageEvent) => void) | null
33
- onmessageerror: ((event: MessageEvent) => void) | null
34
- onerror: ((event: ErrorEvent) => void) | null
35
- }
36
-
37
- /**
38
- * Worker 位置接口
39
- */
21
+ // 位置信息
40
22
  export interface WorkerLocation {
41
23
  href: string
42
24
  protocol: string
@@ -49,9 +31,7 @@ export interface WorkerLocation {
49
31
  origin: string
50
32
  }
51
33
 
52
- /**
53
- * Worker 导航器接口
54
- */
34
+ // 导航器信息
55
35
  export interface WorkerNavigator {
56
36
  userAgent: string
57
37
  platform: string
@@ -61,21 +41,16 @@ export interface WorkerNavigator {
61
41
  hardwareConcurrency: number
62
42
  }
63
43
 
64
- /**
65
- * 消息事件接口
66
- */
67
- export interface MessageEvent<T = any> extends Event {
44
+ // 事件接口
45
+ export interface WorkerMessageEvent<T = any> extends Event {
68
46
  data: T
69
47
  origin: string
70
48
  lastEventId: string
71
- source: MessageEventSource | null
72
- ports: readonly MessagePort[]
49
+ source: WorkerMessageSource | null
50
+ ports: readonly WorkerMessagePort[]
73
51
  }
74
52
 
75
- /**
76
- * 错误事件接口
77
- */
78
- export interface ErrorEvent extends Event {
53
+ export interface WorkerErrorEvent extends Event {
79
54
  message: string
80
55
  filename: string
81
56
  lineno: number
@@ -83,125 +58,96 @@ export interface ErrorEvent extends Event {
83
58
  error: any
84
59
  }
85
60
 
86
- /**
87
- * 消息端口接口
88
- */
89
- export interface MessagePort extends EventTarget {
61
+ // 消息通信
62
+ export interface WorkerMessagePort extends EventTarget {
90
63
  postMessage(message: any, transfer?: Transferable[]): void
91
64
  start(): void
92
65
  close(): void
93
- onmessage: ((event: MessageEvent) => void) | null
94
- onmessageerror: ((event: MessageEvent) => void) | null
66
+ onmessage: ((event: WorkerMessageEvent) => void) | null
67
+ onmessageerror: ((event: WorkerMessageEvent) => void) | null
95
68
  }
96
69
 
97
- /**
98
- * 消息事件源类型
99
- */
100
- export type MessageEventSource = WindowProxy | MessagePort | ServiceWorker
70
+ export type WorkerMessageSource = WorkerWindowProxy | WorkerMessagePort | WorkerServiceWorker
101
71
 
102
- /**
103
- * Window 代理接口
104
- */
105
- export interface WindowProxy {
106
- // 标记接口,用于类型检查
107
- }
72
+ // 代理和服务
73
+ export interface WorkerWindowProxy {}
108
74
 
109
- /**
110
- * Service Worker 接口
111
- */
112
- export interface ServiceWorker extends EventTarget {
75
+ export interface WorkerServiceWorker extends EventTarget {
113
76
  scriptURL: string
114
77
  state: ServiceWorkerState
115
78
  postMessage(message: any, transfer?: Transferable[]): void
116
79
  onstatechange: ((event: Event) => void) | null
117
80
  }
118
81
 
119
- /**
120
- * Service Worker 状态类型
121
- */
122
- export type ServiceWorkerState = 'installing' | 'installed' | 'activating' | 'activated' | 'redundant'
123
-
124
- /**
125
- * Worker 构造函数接口
126
- */
127
- export interface WorkerConstructor {
128
- new (scriptURL: string | URL, options?: WorkerOptions): Worker
82
+ // Worker 全局作用域
83
+ export interface WorkerGlobalScope extends EventTarget {
84
+ self: WorkerGlobalScope
85
+ location: WorkerLocation
86
+ navigator: WorkerNavigator
87
+ importScripts(...urls: string[]): void
88
+ close(): void
89
+ postMessage(message: any, transfer?: Transferable[]): void
90
+ onmessage: ((event: WorkerMessageEvent) => void) | null
91
+ onmessageerror: ((event: WorkerMessageEvent) => void) | null
92
+ onerror: ((event: WorkerErrorEvent) => void) | null
129
93
  }
130
94
 
131
- /**
132
- * Worker 接口
133
- */
134
- export interface Worker extends EventTarget {
95
+ // Worker 实例
96
+ export interface WorkerInstance extends EventTarget {
135
97
  postMessage(message: any, transfer?: Transferable[]): void
136
98
  terminate(): void
137
- onmessage: ((event: MessageEvent) => void) | null
138
- onmessageerror: ((event: MessageEvent) => void) | null
139
- onerror: ((event: ErrorEvent) => void) | null
99
+ onmessage: ((event: WorkerMessageEvent) => void) | null
100
+ onmessageerror: ((event: WorkerMessageEvent) => void) | null
101
+ onerror: ((event: WorkerErrorEvent) => void) | null
140
102
  }
141
103
 
142
- /**
143
- * Worker 环境接口
144
- * 包含所有 Worker 相关的环境 API
145
- */
146
- export interface WorkerEnvironment {
147
- Worker?: WorkerConstructor
148
- SharedWorker?: SharedWorkerConstructor
149
- ServiceWorker?: ServiceWorkerConstructor
150
- MessageChannel?: MessageChannelConstructor
151
- BroadcastChannel?: BroadcastChannelConstructor
104
+ // 共享 Worker
105
+ export interface WorkerShared extends EventTarget {
106
+ port: WorkerMessagePort
107
+ onerror: ((event: WorkerErrorEvent) => void) | null
152
108
  }
153
109
 
154
- /**
155
- * Shared Worker 构造函数接口
156
- */
157
- export interface SharedWorkerConstructor {
158
- new (scriptURL: string | URL, options?: string | WorkerOptions): SharedWorker
110
+ // 消息通道
111
+ export interface WorkerMessageChannel {
112
+ port1: WorkerMessagePort
113
+ port2: WorkerMessagePort
159
114
  }
160
115
 
161
- /**
162
- * Shared Worker 接口
163
- */
164
- export interface SharedWorker extends EventTarget {
165
- port: MessagePort
166
- onerror: ((event: ErrorEvent) => void) | null
116
+ // 广播通道
117
+ export interface WorkerBroadcastChannel extends EventTarget {
118
+ name: string
119
+ postMessage(message: any): void
120
+ close(): void
121
+ onmessage: ((event: WorkerMessageEvent) => void) | null
122
+ onmessageerror: ((event: WorkerMessageEvent) => void) | null
167
123
  }
168
124
 
169
- /**
170
- * Service Worker 构造函数接口
171
- */
172
- export interface ServiceWorkerConstructor {
173
- new (): ServiceWorker
125
+ // 构造函数类型
126
+ export interface WorkerConstructor {
127
+ new (scriptURL: string | URL, options?: WorkerConfig): WorkerInstance
174
128
  }
175
129
 
176
- /**
177
- * Message Channel 构造函数接口
178
- */
179
- export interface MessageChannelConstructor {
180
- new (): MessageChannel
130
+ export interface WorkerSharedConstructor {
131
+ new (scriptURL: string | URL, options?: string | WorkerConfig): WorkerShared
181
132
  }
182
133
 
183
- /**
184
- * Message Channel 接口
185
- */
186
- export interface MessageChannel {
187
- port1: MessagePort
188
- port2: MessagePort
134
+ export interface WorkerServiceConstructor {
135
+ new (): WorkerServiceWorker
189
136
  }
190
137
 
191
- /**
192
- * Broadcast Channel 构造函数接口
193
- */
194
- export interface BroadcastChannelConstructor {
195
- new (name: string): BroadcastChannel
138
+ export interface WorkerMessageChannelConstructor {
139
+ new (): WorkerMessageChannel
196
140
  }
197
141
 
198
- /**
199
- * Broadcast Channel 接口
200
- */
201
- export interface BroadcastChannel extends EventTarget {
202
- name: string
203
- postMessage(message: any): void
204
- close(): void
205
- onmessage: ((event: MessageEvent) => void) | null
206
- onmessageerror: ((event: MessageEvent) => void) | null
142
+ export interface WorkerBroadcastChannelConstructor {
143
+ new (name: string): WorkerBroadcastChannel
144
+ }
145
+
146
+ // 运行时接口
147
+ export interface WorkerRuntime {
148
+ Worker: WorkerConstructor
149
+ SharedWorker: WorkerSharedConstructor
150
+ ServiceWorker: WorkerServiceConstructor
151
+ MessageChannel: WorkerMessageChannelConstructor
152
+ BroadcastChannel: WorkerBroadcastChannelConstructor
207
153
  }
@@ -1,56 +1,88 @@
1
1
  /**
2
- * XML 解析器和序列化器类型定义
3
- * 用于支持不同环境下的 XML 处理功能
2
+ * XML 处理类型定义
3
+ * 提供核心 XML 处理功能的类型支持
4
4
  */
5
5
 
6
- /**
7
- * XML 解析器接口
8
- */
9
- export interface XMLParser {
10
- parseFromString(xmlString: string, mimeType: string): XMLDocument
11
- }
12
-
13
- /**
14
- * XML 序列化器接口
15
- */
16
- export interface XMLSerializer {
17
- serializeToString(node: Node): string
18
- }
6
+ // 核心类型定义
7
+ export type XMLMimeType = 'text/xml' | 'application/xml' | 'application/xhtml+xml' | 'image/svg+xml'
8
+ export type XMLNodeType = 'element' | 'text' | 'comment' | 'document'
19
9
 
20
- /**
21
- * XML 文档接口
22
- */
23
- export interface XMLDocument {
24
- documentElement: XMLElement
25
- getElementsByTagName(tagName: string): XMLNodeList
26
- createElement(tagName: string): XMLElement
10
+ // 节点接口
11
+ export interface XMLNode {
12
+ nodeType: XMLNodeType
13
+ nodeName: string
14
+ nodeValue: string | null
15
+ textContent: string | null
16
+ parentNode: XMLNode | null
17
+ childNodes: XMLNodeList
27
18
  }
28
19
 
29
- /**
30
- * XML 元素接口
31
- */
32
- export interface XMLElement {
20
+ // 元素接口
21
+ export interface XMLElement extends XMLNode {
33
22
  tagName: string
23
+ attributes: XMLAttributeMap
34
24
  getAttribute(name: string): string | null
35
25
  setAttribute(name: string, value: string): void
26
+ removeAttribute(name: string): void
27
+ hasAttribute(name: string): boolean
36
28
  getElementsByTagName(tagName: string): XMLNodeList
37
- appendChild(child: XMLElement): XMLElement
38
- textContent: string | null
29
+ appendChild(child: XMLNode): XMLNode
30
+ removeChild(child: XMLNode): XMLNode
39
31
  }
40
32
 
41
- /**
42
- * XML 节点列表接口
43
- */
33
+ // 属性映射
34
+ export interface XMLAttributeMap {
35
+ length: number
36
+ getNamedItem(name: string): XMLAttribute | null
37
+ setNamedItem(attr: XMLAttribute): XMLAttribute | null
38
+ removeNamedItem(name: string): XMLAttribute
39
+ item(index: number): XMLAttribute | null
40
+ [index: number]: XMLAttribute
41
+ }
42
+
43
+ // 属性接口
44
+ export interface XMLAttribute {
45
+ name: string
46
+ value: string
47
+ ownerElement: XMLElement | null
48
+ }
49
+
50
+ // 节点列表
44
51
  export interface XMLNodeList {
45
52
  length: number
46
- item(index: number): XMLElement | null
47
- [index: number]: XMLElement
53
+ item(index: number): XMLNode | null
54
+ [index: number]: XMLNode
48
55
  }
49
56
 
50
- /**
51
- * XML 环境依赖接口
52
- */
53
- export interface XMLEnvironment {
54
- xmlParser: XMLParser
55
- xmlSerializer: XMLSerializer
57
+ // 文档接口
58
+ export interface XMLDocument extends XMLNode {
59
+ documentElement: XMLElement | null
60
+ createElement(tagName: string): XMLElement
61
+ createTextNode(data: string): XMLNode
62
+ createComment(data: string): XMLNode
63
+ getElementsByTagName(tagName: string): XMLNodeList
64
+ getElementById(id: string): XMLElement | null
65
+ }
66
+
67
+ // 解析器和序列化器
68
+ export interface XMLParser {
69
+ parseFromString(xmlString: string, mimeType?: string): any
70
+ }
71
+
72
+ export interface XMLSerializer {
73
+ serializeToString(node: any): string
74
+ }
75
+
76
+ export interface XMLParserConstructor {
77
+ new (options?: any): XMLParser
78
+ }
79
+
80
+ export interface XMLSerializerConstructor {
81
+ new (): XMLSerializer
82
+ }
83
+
84
+ // 运行时接口
85
+ export interface XMLRuntime {
86
+ DOMParser: XMLParserConstructor
87
+ XMLSerializer: XMLSerializerConstructor
56
88
  }
package/types/altool.d.ts CHANGED
@@ -31,23 +31,6 @@ export interface AltoolAuthApiKey {
31
31
 
32
32
  export type AltoolAuth = AltoolAuthCredentials | AltoolAuthApiKey
33
33
 
34
- /**
35
- * altool基础选项
36
- */
37
- export interface AltoolBaseOptions {
38
- /** 应用类型 */
39
- type: AltoolAppType
40
- /** 输出格式 */
41
- outputFormat?: AltoolOutputFormat
42
- /** 认证信息 */
43
- auth: AltoolAuth
44
- }
45
-
46
- /**
47
- * altool命令类型
48
- */
49
- export type AltoolCommand = 'upload-app' | 'validate-app' | 'list-apps'
50
-
51
34
  /**
52
35
  * altool执行结果基础接口
53
36
  */
@@ -62,4 +45,53 @@ export interface AltoolBaseResult {
62
45
  exitCode: number
63
46
  /** 执行的命令 */
64
47
  command: string
48
+ }
49
+
50
+ /**
51
+ * altool上传选项
52
+ */
53
+ export interface AltoolUploadOptions {
54
+ file: string
55
+ type: AltoolAppType
56
+ auth: AltoolAuth
57
+ outputFormat?: AltoolOutputFormat
58
+ }
59
+
60
+ /**
61
+ * altool验证选项
62
+ */
63
+ export interface AltoolValidateOptions {
64
+ file: string
65
+ type: AltoolAppType
66
+ auth: AltoolAuth
67
+ outputFormat?: AltoolOutputFormat
68
+ }
69
+
70
+ /**
71
+ * altool验证结果
72
+ */
73
+ export interface AltoolValidateResult {
74
+ hasWarnings: boolean
75
+ hasErrors: boolean
76
+ warnings: string[]
77
+ errors: string[]
78
+ }
79
+
80
+ /**
81
+ * altool应用信息选项
82
+ */
83
+ export interface AltoolAppInfoOptions {
84
+ type: AltoolAppType
85
+ auth: AltoolAuth
86
+ outputFormat?: AltoolOutputFormat
87
+ }
88
+
89
+ /**
90
+ * 应用信息
91
+ */
92
+ export interface AppInfo {
93
+ bundleId: string
94
+ name: string
95
+ version: string
96
+ build: string
65
97
  }
@@ -1,30 +1,32 @@
1
- import type { NodeChildProcess, NodeFileSystem, NodePath, NodeProcess } from '../../references/node.d'
2
- import type { XMLParser, XMLSerializer } from '../../references/xml.d'
3
- import type { JSON5Parser } from '../../references/json5.d'
1
+ /**
2
+ * Android 离线打包相关类型定义
3
+ *
4
+ * @description
5
+ * 定义通用 Android 离线打包功能使用的接口和类型
6
+ *
7
+ * @since 1.0.0
8
+ * @author Assistant
9
+ */
10
+
11
+ import type { ChildProcess, FileSystem, Path, Process } from '../references/node.d'
12
+ import type { XMLParser, XMLSerializer, XMLParserConstructor, XMLSerializerConstructor } from '../references/xml.d'
13
+ import type { JSON5Parser } from '../references/json5.d'
4
14
 
5
15
  /**
6
- * Android 离线打包选项
16
+ * Android 工程编译选项(通用)
7
17
  */
8
18
  export interface AndroidBuildOptions {
9
- /** UniApp 项目路径 */
19
+ /** 工程路径 */
10
20
  projectPath: string
11
- /** Android 离线 SDK 路径 */
12
- sdkPath: string
13
- /** 输出目录 */
14
- outputDir: string
15
- /** DCloud AppKey(必传) */
16
- appkey: string
17
- /** Android 应用包名(必传) */
18
- applicationId: string
19
- /** 是否为调试版本 */
20
- debug?: boolean
21
- /** UniApp 构建脚本名称,如果不指定则直接使用 uni 命令 */
22
- buildScript?: string
23
- /** Android 示例工程路径 */
24
- androidProjectPath: string
25
- /** 签名配置(可选) */
21
+ /** 输出路径 */
22
+ outputPath?: string
23
+ /** 是否清理构建 */
24
+ clean?: boolean
25
+ /** 构建变体 */
26
+ buildVariant?: 'debug' | 'release'
27
+ /** 签名配置 */
26
28
  signing?: {
27
- keystore: string
29
+ keystorePath: string
28
30
  keystorePassword: string
29
31
  keyAlias: string
30
32
  keyPassword: string
@@ -32,54 +34,27 @@ export interface AndroidBuildOptions {
32
34
  }
33
35
 
34
36
  /**
35
- * Android 打包结果
37
+ * Android 工程编译结果(通用)
36
38
  */
37
39
  export interface AndroidBuildResult {
38
- /** 是否成功 */
39
40
  success: boolean
40
- /** 输出文件路径 */
41
41
  outputPath?: string
42
- /** 错误信息 */
43
42
  error?: string
44
- /** 构建日志 */
45
43
  logs: string[]
46
44
  }
47
45
 
48
46
  /**
49
47
  * 系统依赖接口
48
+ * 用于依赖注入,确保函数的环境无关性
50
49
  */
51
50
  export interface SystemDependencies {
52
- childProcess: NodeChildProcess
53
- fs: NodeFileSystem
54
- path: NodePath
55
- process: NodeProcess
51
+ childProcess: ChildProcess
52
+ fs: FileSystem
53
+ path: Path
54
+ process: Process
56
55
  setTimeout: (callback: () => void, delay: number) => any
57
56
  require: (id: string) => any
58
57
  json5: JSON5Parser
59
- xmlParser: XMLParser
60
- xmlSerializer: XMLSerializer
61
- }
62
-
63
- /**
64
- * 验证结果接口
65
- */
66
- export interface ValidationResult {
67
- valid: boolean
68
- error?: string
69
- }
70
-
71
- /**
72
- * 操作结果接口
73
- */
74
- export interface OperationResult {
75
- success: boolean
76
- error?: string
77
- logs: string[]
58
+ xmlParser: XMLParserConstructor
59
+ xmlSerializer: XMLSerializerConstructor
78
60
  }
79
-
80
- /**
81
- * 构建结果接口
82
- */
83
- export interface BuildResult extends OperationResult {
84
- outputPath?: string
85
- }