@tarojs/taro 3.7.0-alpha.26 → 3.7.0-alpha.27
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.
- package/html.css +9 -0
- package/package.json +5 -5
- package/types/api/base/system.d.ts +2 -2
- package/types/api/data-analysis/index.d.ts +51 -1
- package/types/api/device/accelerometer.d.ts +8 -6
- package/types/api/device/accessibility.d.ts +1 -1
- package/types/api/device/battery.d.ts +3 -3
- package/types/api/device/bluetooth-ble.d.ts +40 -17
- package/types/api/device/bluetooth-peripheral.d.ts +26 -26
- package/types/api/device/bluetooth.d.ts +37 -13
- package/types/api/device/calendar.d.ts +11 -1
- package/types/api/device/clipboard.d.ts +17 -17
- package/types/api/device/compass.d.ts +5 -5
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/iBeacon.d.ts +10 -8
- package/types/api/device/keyboard.d.ts +7 -5
- package/types/api/device/memory.d.ts +3 -4
- package/types/api/device/motion.d.ts +8 -6
- package/types/api/device/network.d.ts +12 -6
- package/types/api/device/nfc.d.ts +13 -13
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +5 -3
- package/types/api/device/screen.d.ts +28 -12
- package/types/api/device/sms.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +5 -5
- package/types/api/device/wifi.d.ts +25 -13
- package/types/api/files/index.d.ts +71 -41
- package/types/api/location/index.d.ts +166 -18
- package/types/api/media/camera.d.ts +6 -3
- package/types/api/media/image.d.ts +1 -1
- package/types/api/navigate/index.d.ts +2 -0
- package/types/api/network/request.d.ts +1 -1
- package/types/api/route/index.d.ts +5 -5
- package/types/api/storage/background-fetch.d.ts +63 -11
- package/types/api/storage/cache-manager.d.ts +51 -0
- package/types/api/storage/index.d.ts +125 -10
- package/types/api/taro.extend.d.ts +1 -1
- package/types/api/ui/animation.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +4 -3
- package/types/api/ui/interaction.d.ts +4 -4
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +1 -1
- package/types/api/ui/tab-bar.d.ts +7 -7
- package/types/api/wxml/index.d.ts +4 -4
- package/types/compile/config/h5.d.ts +7 -1
- package/types/compile/config/harmony.d.ts +77 -0
- package/types/compile/config/index.d.ts +1 -0
- package/types/compile/config/mini.d.ts +14 -8
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +3 -0
- package/types/compile/config/util.d.ts +3 -1
- package/types/compile/viteCompilerContext.d.ts +24 -5
- package/types/taro.config.d.ts +6 -0
|
@@ -49,6 +49,10 @@ declare module '../../index' {
|
|
|
49
49
|
keys: string[]
|
|
50
50
|
/** 限制的空间大小,单位 KB */
|
|
51
51
|
limitSize: number
|
|
52
|
+
/** 是否执行成功
|
|
53
|
+
* @supported alipay
|
|
54
|
+
*/
|
|
55
|
+
success?: boolean
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -102,9 +106,54 @@ declare module '../../index' {
|
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
|
|
109
|
+
namespace batchSetStorageSync {
|
|
110
|
+
interface Option {
|
|
111
|
+
/** [{ key, value }] */
|
|
112
|
+
kvList: kv[]
|
|
113
|
+
}
|
|
114
|
+
interface kv {
|
|
115
|
+
/** key 本地缓存中指定的 key */
|
|
116
|
+
key: string
|
|
117
|
+
/** data 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象。*/
|
|
118
|
+
value: any
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
namespace batchSetStorage {
|
|
123
|
+
interface Option {
|
|
124
|
+
/** [{ key, value }] */
|
|
125
|
+
kvList: kv[]
|
|
126
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
127
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
128
|
+
/** 接口调用失败的回调函数 */
|
|
129
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
130
|
+
/** 接口调用成功的回调函数 */
|
|
131
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
132
|
+
}
|
|
133
|
+
interface kv {
|
|
134
|
+
/** key 本地缓存中指定的 key */
|
|
135
|
+
key: string
|
|
136
|
+
/** data 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象。*/
|
|
137
|
+
value: any
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
namespace batchGetStorage {
|
|
142
|
+
interface Option {
|
|
143
|
+
/** 本地缓存中指定的 keyList */
|
|
144
|
+
keyList: string[]
|
|
145
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
146
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
147
|
+
/** 接口调用失败的回调函数 */
|
|
148
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
149
|
+
/** 接口调用成功的回调函数 */
|
|
150
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
105
154
|
interface TaroStatic {
|
|
106
155
|
/** Taro.setStorage 的同步版本
|
|
107
|
-
* @supported weapp,
|
|
156
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
108
157
|
* @example
|
|
109
158
|
* ```tsx
|
|
110
159
|
* Taro.setStorage({
|
|
@@ -128,7 +177,7 @@ declare module '../../index' {
|
|
|
128
177
|
): void
|
|
129
178
|
|
|
130
179
|
/** 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
|
|
131
|
-
* @supported weapp, h5, rn,
|
|
180
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
|
|
132
181
|
* @example
|
|
133
182
|
* ```tsx
|
|
134
183
|
* Taro.setStorage({
|
|
@@ -155,7 +204,7 @@ declare module '../../index' {
|
|
|
155
204
|
): void
|
|
156
205
|
|
|
157
206
|
/** Taro.removeStorage 的同步版本
|
|
158
|
-
* @supported weapp,
|
|
207
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
159
208
|
* @example
|
|
160
209
|
* ```tsx
|
|
161
210
|
* try {
|
|
@@ -172,7 +221,7 @@ declare module '../../index' {
|
|
|
172
221
|
): void
|
|
173
222
|
|
|
174
223
|
/** 从本地缓存中移除指定 key
|
|
175
|
-
* @supported weapp, h5, rn,
|
|
224
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
|
|
176
225
|
* @example
|
|
177
226
|
* ```tsx
|
|
178
227
|
* Taro.removeStorage({
|
|
@@ -187,7 +236,7 @@ declare module '../../index' {
|
|
|
187
236
|
removeStorage(option: removeStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
188
237
|
|
|
189
238
|
/** Taro.getStorage 的同步版本
|
|
190
|
-
* @supported weapp,
|
|
239
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
191
240
|
* @example
|
|
192
241
|
* ```tsx
|
|
193
242
|
* try {
|
|
@@ -207,7 +256,7 @@ declare module '../../index' {
|
|
|
207
256
|
): T
|
|
208
257
|
|
|
209
258
|
/** Taro.getStorageInfo 的同步版本
|
|
210
|
-
* @supported weapp,
|
|
259
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
211
260
|
* @example
|
|
212
261
|
* ```tsx
|
|
213
262
|
* try {
|
|
@@ -224,7 +273,7 @@ declare module '../../index' {
|
|
|
224
273
|
getStorageInfoSync(): getStorageInfoSync.Option
|
|
225
274
|
|
|
226
275
|
/** 异步获取当前storage的相关信息
|
|
227
|
-
* @supported weapp,
|
|
276
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
228
277
|
* @example
|
|
229
278
|
* ```tsx
|
|
230
279
|
* Taro.getStorageInfo({
|
|
@@ -240,7 +289,7 @@ declare module '../../index' {
|
|
|
240
289
|
getStorageInfo(option?: getStorageInfo.Option): Promise<TaroGeneral.CallbackResult>
|
|
241
290
|
|
|
242
291
|
/** 从本地缓存中异步获取指定 key 的内容
|
|
243
|
-
* @supported weapp, h5, rn,
|
|
292
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
|
|
244
293
|
* @example
|
|
245
294
|
* ```tsx
|
|
246
295
|
* Taro.getStorage({
|
|
@@ -264,7 +313,7 @@ declare module '../../index' {
|
|
|
264
313
|
): void
|
|
265
314
|
|
|
266
315
|
/** Taro.clearStorage 的同步版本
|
|
267
|
-
* @supported weapp,
|
|
316
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
268
317
|
* @example
|
|
269
318
|
* ```tsx
|
|
270
319
|
* try {
|
|
@@ -278,7 +327,7 @@ declare module '../../index' {
|
|
|
278
327
|
clearStorageSync(): void
|
|
279
328
|
|
|
280
329
|
/** 清理本地数据缓存
|
|
281
|
-
* @supported weapp, h5, rn,
|
|
330
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
|
|
282
331
|
* @example
|
|
283
332
|
* ```tsx
|
|
284
333
|
* Taro.clearStorage()
|
|
@@ -286,5 +335,71 @@ declare module '../../index' {
|
|
|
286
335
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html
|
|
287
336
|
*/
|
|
288
337
|
clearStorage(option?: clearStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
338
|
+
|
|
339
|
+
/** 将数据批量存储在本地缓存中指定的 key 中。
|
|
340
|
+
* 会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。
|
|
341
|
+
* 单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
|
|
342
|
+
* @supported weapp
|
|
343
|
+
* @example
|
|
344
|
+
* ```tsx
|
|
345
|
+
* try {
|
|
346
|
+
* Taro.batchSetStorageSync([{key: 'key', value: 'value'}])
|
|
347
|
+
* } catch (e) { }
|
|
348
|
+
* ```
|
|
349
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html
|
|
350
|
+
*/
|
|
351
|
+
batchSetStorageSync(option: batchSetStorageSync.Option): void
|
|
352
|
+
|
|
353
|
+
/** 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。
|
|
354
|
+
* 除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。
|
|
355
|
+
* 单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
|
|
356
|
+
* @supported weapp
|
|
357
|
+
* @example
|
|
358
|
+
* ```tsx
|
|
359
|
+
* Taro.batchGetStorage({
|
|
360
|
+
* keyList: ['key']
|
|
361
|
+
* success(res) {
|
|
362
|
+
* console.log(res)
|
|
363
|
+
* }
|
|
364
|
+
* })
|
|
365
|
+
* ```
|
|
366
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html
|
|
367
|
+
*/
|
|
368
|
+
batchSetStorage(option: batchSetStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
369
|
+
|
|
370
|
+
/** 从本地缓存中同步批量获取指定 key 的内容。
|
|
371
|
+
* @supported weapp
|
|
372
|
+
* @example
|
|
373
|
+
* ```tsx
|
|
374
|
+
* try {
|
|
375
|
+
* var valueList = Taro.batchGetStorageSync(['key'])
|
|
376
|
+
* if (valueList) {
|
|
377
|
+
* // Do something with return value
|
|
378
|
+
* }
|
|
379
|
+
* } catch (e) {
|
|
380
|
+
* // Do something when catch error
|
|
381
|
+
* }
|
|
382
|
+
* ```
|
|
383
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html
|
|
384
|
+
*/
|
|
385
|
+
batchGetStorageSync<T = any>(
|
|
386
|
+
/** 本地缓存中指定的 key 数组 */
|
|
387
|
+
keyList: string[]
|
|
388
|
+
): T[]
|
|
389
|
+
|
|
390
|
+
/** 从本地缓存中异步批量获取指定 key 的内容。
|
|
391
|
+
* @supported weapp
|
|
392
|
+
* @example
|
|
393
|
+
* ```tsx
|
|
394
|
+
* Taro.batchGetStorage({
|
|
395
|
+
* keyList: ['key'],
|
|
396
|
+
* success(res) {
|
|
397
|
+
* console.log(res)
|
|
398
|
+
* }
|
|
399
|
+
* })
|
|
400
|
+
* ```
|
|
401
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html
|
|
402
|
+
*/
|
|
403
|
+
batchGetStorage(option: batchGetStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
289
404
|
}
|
|
290
405
|
}
|
|
@@ -410,7 +410,7 @@ declare module '../../index' {
|
|
|
410
410
|
|
|
411
411
|
interface TaroStatic {
|
|
412
412
|
/** 创建一个动画实例 [animation](../Animation)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。
|
|
413
|
-
* @supported weapp, h5,
|
|
413
|
+
* @supported weapp, tt, h5, harmony
|
|
414
414
|
* @example
|
|
415
415
|
* ```tsx
|
|
416
416
|
* var animation = Taro.createAnimation({
|
package/types/api/ui/fonts.d.ts
CHANGED
|
@@ -54,13 +54,14 @@ declare module '../../index' {
|
|
|
54
54
|
/** 动态加载网络字体。文件地址需为下载类型。iOS 仅支持 https 格式文件地址。
|
|
55
55
|
*
|
|
56
56
|
* 注意:
|
|
57
|
-
* 1. 字体文件返回的
|
|
57
|
+
* 1. 字体文件返回的 context-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
|
|
58
58
|
* 2. 字体链接必须是https(ios不支持http)
|
|
59
59
|
* 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
|
|
60
60
|
* 4. canvas等原生组件不支持使用接口添加的字体
|
|
61
|
-
* 5. 工具里提示
|
|
62
|
-
* @supported weapp, h5
|
|
61
|
+
* 5. 工具里提示 Failed to load font 可以忽略
|
|
62
|
+
* @supported weapp, alipay, h5
|
|
63
63
|
* @h5 不支持 global (默认全局加载)
|
|
64
|
+
* @alipay source 地址格式为 `url('https://...')`,而不是单纯 URL 地址
|
|
64
65
|
* @example
|
|
65
66
|
* ```tsx
|
|
66
67
|
* Taro.loadFontFace({
|
|
@@ -160,7 +160,7 @@ declare module '../../index' {
|
|
|
160
160
|
* **注意**
|
|
161
161
|
* - Taro.showLoading 和 Taro.showToast 同时只能显示一个
|
|
162
162
|
* - Taro.showToast 应与 Taro.hideToast 配对使用
|
|
163
|
-
* @supported weapp, h5, rn, tt
|
|
163
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
164
164
|
* @example
|
|
165
165
|
* ```tsx
|
|
166
166
|
* Taro.showToast({
|
|
@@ -177,7 +177,7 @@ declare module '../../index' {
|
|
|
177
177
|
* **注意**
|
|
178
178
|
* - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
|
|
179
179
|
* - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑
|
|
180
|
-
* @supported weapp, h5, rn, tt
|
|
180
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
181
181
|
* @example
|
|
182
182
|
* ```tsx
|
|
183
183
|
* Taro.showModal({
|
|
@@ -220,7 +220,7 @@ declare module '../../index' {
|
|
|
220
220
|
* **注意**
|
|
221
221
|
* - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
|
|
222
222
|
* - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑
|
|
223
|
-
* @supported weapp, h5, rn, tt
|
|
223
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
224
224
|
* @example
|
|
225
225
|
* ```tsx
|
|
226
226
|
* Taro.showActionSheet({
|
|
@@ -238,7 +238,7 @@ declare module '../../index' {
|
|
|
238
238
|
showActionSheet(option: showActionSheet.Option): Promise<showActionSheet.SuccessCallbackResult>
|
|
239
239
|
|
|
240
240
|
/** 隐藏消息提示框
|
|
241
|
-
* @supported weapp, h5, rn, tt
|
|
241
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
242
242
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html
|
|
243
243
|
*/
|
|
244
244
|
hideToast(option?: hideToast.Option): void
|
|
@@ -25,7 +25,7 @@ declare module '../../index' {
|
|
|
25
25
|
|
|
26
26
|
interface TaroStatic {
|
|
27
27
|
/** 停止当前页面下拉刷新。
|
|
28
|
-
* @supported weapp, h5, rn, tt
|
|
28
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
29
29
|
* @example
|
|
30
30
|
* ```tsx
|
|
31
31
|
* onPullDownRefresh: function (){
|
|
@@ -37,7 +37,7 @@ declare module '../../index' {
|
|
|
37
37
|
stopPullDownRefresh(option?: stopPullDownRefresh.Option): void
|
|
38
38
|
|
|
39
39
|
/** 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
|
|
40
|
-
* @supported weapp, h5, rn, tt
|
|
40
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
41
41
|
* @rn 无动画效果
|
|
42
42
|
* @example
|
|
43
43
|
* ```tsx
|
package/types/api/ui/scroll.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ declare module '../../index' {
|
|
|
99
99
|
* - 后代选择器:.the-ancestor .the-descendant
|
|
100
100
|
* - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
|
|
101
101
|
* - 多选择器的并集:#a-node, .some-other-nodes
|
|
102
|
-
* @supported weapp, h5, rn, tt
|
|
102
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
103
103
|
* @example
|
|
104
104
|
* ```tsx
|
|
105
105
|
* Taro.pageScrollTo({
|
|
@@ -121,13 +121,13 @@ declare module '../../index' {
|
|
|
121
121
|
|
|
122
122
|
interface TaroStatic {
|
|
123
123
|
/** 显示 tabBar 某一项的右上角的红点
|
|
124
|
-
* @supported weapp, h5, rn, tt
|
|
124
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
125
125
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html
|
|
126
126
|
*/
|
|
127
127
|
showTabBarRedDot(option: showTabBarRedDot.Option): Promise<TaroGeneral.CallbackResult>
|
|
128
128
|
|
|
129
129
|
/** 显示 tabBar
|
|
130
|
-
* @supported weapp, h5, rn, tt
|
|
130
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
131
131
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html
|
|
132
132
|
*/
|
|
133
133
|
showTabBar(option?: showTabBar.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -148,7 +148,7 @@ declare module '../../index' {
|
|
|
148
148
|
setTabBarStyle(option?: setTabBarStyle.Option): Promise<TaroGeneral.CallbackResult>
|
|
149
149
|
|
|
150
150
|
/** 动态设置 tabBar 某一项的内容,`2.7.0` 起图片支持临时文件和网络文件。
|
|
151
|
-
* @supported weapp, h5, rn, tt
|
|
151
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
152
152
|
* @example
|
|
153
153
|
* ```tsx
|
|
154
154
|
* Taro.setTabBarItem({
|
|
@@ -163,7 +163,7 @@ declare module '../../index' {
|
|
|
163
163
|
setTabBarItem(option: setTabBarItem.Option): Promise<TaroGeneral.CallbackResult>
|
|
164
164
|
|
|
165
165
|
/** 为 tabBar 某一项的右上角添加文本
|
|
166
|
-
* @supported weapp, h5, rn, tt
|
|
166
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
167
167
|
* @example
|
|
168
168
|
* ```tsx
|
|
169
169
|
* Taro.setTabBarBadge({
|
|
@@ -176,19 +176,19 @@ declare module '../../index' {
|
|
|
176
176
|
setTabBarBadge(option: setTabBarBadge.Option): Promise<TaroGeneral.CallbackResult>
|
|
177
177
|
|
|
178
178
|
/** 移除 tabBar 某一项右上角的文本
|
|
179
|
-
* @supported weapp, h5, rn, tt
|
|
179
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
180
180
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html
|
|
181
181
|
*/
|
|
182
182
|
removeTabBarBadge(option: removeTabBarBadge.Option): Promise<TaroGeneral.CallbackResult>
|
|
183
183
|
|
|
184
184
|
/** 隐藏 tabBar 某一项的右上角的红点
|
|
185
|
-
* @supported weapp, h5, rn, tt
|
|
185
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
186
186
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html
|
|
187
187
|
*/
|
|
188
188
|
hideTabBarRedDot(option: hideTabBarRedDot.Option): Promise<TaroGeneral.CallbackResult>
|
|
189
189
|
|
|
190
190
|
/** 隐藏 tabBar
|
|
191
|
-
* @supported weapp, h5, rn, tt
|
|
191
|
+
* @supported weapp, h5, rn, tt, harmony
|
|
192
192
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html
|
|
193
193
|
*/
|
|
194
194
|
hideTabBar(option?: hideTabBar.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -484,7 +484,7 @@ declare module '../../index' {
|
|
|
484
484
|
|
|
485
485
|
interface TaroStatic {
|
|
486
486
|
/** 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
|
|
487
|
-
* @supported weapp, h5, tt
|
|
487
|
+
* @supported weapp, h5, tt, harmony
|
|
488
488
|
* @example
|
|
489
489
|
* ```tsx
|
|
490
490
|
* const query = Taro.createSelectorQuery()
|
|
@@ -500,10 +500,10 @@ declare module '../../index' {
|
|
|
500
500
|
createSelectorQuery(): SelectorQuery
|
|
501
501
|
|
|
502
502
|
/** 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。
|
|
503
|
-
* @supported weapp, h5, tt
|
|
503
|
+
* @supported weapp, h5, tt, harmony
|
|
504
504
|
* @example
|
|
505
505
|
* ```tsx
|
|
506
|
-
* const
|
|
506
|
+
* const observer = Taro.createIntersectionObserver(this, { thresholds: [0], observeAll: true })
|
|
507
507
|
* ```
|
|
508
508
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createIntersectionObserver.html
|
|
509
509
|
*/
|
|
@@ -525,7 +525,7 @@ declare module '../../index' {
|
|
|
525
525
|
* } else if (process.env.TARO_ENV === 'h5') {
|
|
526
526
|
* createMediaQueryObserver= Taro.createMediaQueryObserver
|
|
527
527
|
* }
|
|
528
|
-
* const mediaQueryObserver = createMediaQueryObserver()
|
|
528
|
+
* const mediaQueryObserver = createMediaQueryObserver()
|
|
529
529
|
* ```
|
|
530
530
|
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/view/resizable.html#Media%20Query
|
|
531
531
|
*/
|
|
@@ -4,7 +4,7 @@ import type webpackDevServer from 'webpack-dev-server'
|
|
|
4
4
|
import type HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
5
5
|
import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
|
|
6
6
|
import type { OutputOptions as RollupOutputOptions } from 'rollup'
|
|
7
|
-
import type { CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
7
|
+
import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
8
8
|
|
|
9
9
|
export interface IH5RouterConfig {
|
|
10
10
|
/** 配置路由模式 */
|
|
@@ -48,6 +48,9 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
|
|
|
48
48
|
/** 预览服务的配置,可以更改端口等参数。具体配置参考 [webpack-dev-server](https://webpack.js.org/configuration/dev-server) */
|
|
49
49
|
devServer?: webpackDevServer.Configuration
|
|
50
50
|
|
|
51
|
+
/** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
|
|
52
|
+
enableSourceMap?: boolean
|
|
53
|
+
|
|
51
54
|
/** 具体配置请参考 [Webpack devtool](https://webpack.js.org/configuration/devtool/#devtool) 配置 (默认值:'cheap-module-eval-source-map')*/
|
|
52
55
|
sourceMapType?:
|
|
53
56
|
| 'none'
|
|
@@ -117,4 +120,7 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
|
|
|
117
120
|
}
|
|
118
121
|
/** 生成的代码是否要兼容旧版浏览器,值为 true 时,会去读取 package.json 的 browserslist 字段。只在 vite 编译模式下有效 */
|
|
119
122
|
legacy?: T extends 'vite' ? boolean : undefined
|
|
123
|
+
|
|
124
|
+
/** 使用的编译工具。可选值:webpack4、webpack5、vite */
|
|
125
|
+
compiler?: Compiler<T>
|
|
120
126
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type Chain from 'webpack-chain'
|
|
2
|
+
import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
|
|
3
|
+
|
|
4
|
+
export interface IHarmonyConfig<T extends CompilerTypes = CompilerWebpackTypes> {
|
|
5
|
+
/** Harmony 项目地址 */
|
|
6
|
+
projectPath: string
|
|
7
|
+
|
|
8
|
+
/** hap 名
|
|
9
|
+
* @default "entry"
|
|
10
|
+
*/
|
|
11
|
+
hapName?: string
|
|
12
|
+
|
|
13
|
+
/** 应用名称
|
|
14
|
+
* @default "default"
|
|
15
|
+
*/
|
|
16
|
+
name?: string
|
|
17
|
+
|
|
18
|
+
/** 用于告诉 Taro 编译器需要抽取的公共文件 */
|
|
19
|
+
commonChunks?: string[] | ((commonChunks: string[]) => string[])
|
|
20
|
+
|
|
21
|
+
/** Harmony 编译过程的相关配置 */
|
|
22
|
+
compile?: {
|
|
23
|
+
exclude?: any[]
|
|
24
|
+
include?: any[]
|
|
25
|
+
filter?: (filename: string) => boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
|
|
29
|
+
enableSourceMap?: boolean
|
|
30
|
+
|
|
31
|
+
/** 默认值:'cheap-module-source-map', 具体参考[Webpack devtool 配置](https://webpack.js.org/configuration/devtool/#devtool) */
|
|
32
|
+
sourceMapType?: string
|
|
33
|
+
|
|
34
|
+
/** 指定 React 框架相关的代码是否使用开发环境(未压缩)代码,默认使用生产环境(压缩后)代码 */
|
|
35
|
+
debugReact?: boolean
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 自定义 Webpack 配置
|
|
39
|
+
* @param chain [webpackChain](https://github.com/neutrinojs/webpack-chain) 对象
|
|
40
|
+
* @param webpack webpack 实例
|
|
41
|
+
*/
|
|
42
|
+
webpackChain?: (chain: Chain, webpack: typeof Webpack) => void
|
|
43
|
+
|
|
44
|
+
/** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
|
|
45
|
+
* vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
|
|
46
|
+
*/
|
|
47
|
+
output?: T extends 'vite'
|
|
48
|
+
? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
|
|
49
|
+
: Webpack.Configuration['output'] & OutputExt
|
|
50
|
+
|
|
51
|
+
/** 配置 postcss 相关插件 */
|
|
52
|
+
postcss?: IPostcssOption<'harmony'>
|
|
53
|
+
|
|
54
|
+
/** [css-loader](https://github.com/webpack-contrib/css-loader) 的附加配置 */
|
|
55
|
+
cssLoaderOption?: IOption
|
|
56
|
+
|
|
57
|
+
/** [sass-loader](https://github.com/webpack-contrib/sass-loader) 的附加配置 */
|
|
58
|
+
sassLoaderOption?: IOption
|
|
59
|
+
|
|
60
|
+
/** [less-loader](https://github.com/webpack-contrib/less-loader) 的附加配置 */
|
|
61
|
+
lessLoaderOption?: IOption
|
|
62
|
+
|
|
63
|
+
/** [stylus-loader](https://github.com/shama/stylus-loader) 的附加配置 */
|
|
64
|
+
stylusLoaderOption?: IOption
|
|
65
|
+
|
|
66
|
+
/** 针对 mp4 | webm | ogg | mp3 | wav | flac | aac 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
|
|
67
|
+
mediaUrlLoaderOption?: IUrlLoaderOption
|
|
68
|
+
|
|
69
|
+
/** 针对 woff | woff2 | eot | ttf | otf 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
|
|
70
|
+
fontUrlLoaderOption?: IUrlLoaderOption
|
|
71
|
+
|
|
72
|
+
/** 针对 png | jpg | jpeg | gif | bpm | svg 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
|
|
73
|
+
imageUrlLoaderOption?: IUrlLoaderOption
|
|
74
|
+
|
|
75
|
+
/** [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) 的附加配置 */
|
|
76
|
+
miniCssExtractPluginOption?: IOption
|
|
77
|
+
}
|
|
@@ -2,16 +2,16 @@ import type Webpack from 'webpack'
|
|
|
2
2
|
import type Chain from 'webpack-chain'
|
|
3
3
|
import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
|
|
4
4
|
import type { OutputOptions as RollupOutputOptions } from 'rollup'
|
|
5
|
-
import type { CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
5
|
+
import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
6
6
|
|
|
7
7
|
interface Runtime {
|
|
8
|
-
enableInnerHTML
|
|
9
|
-
enableSizeAPIs
|
|
10
|
-
enableAdjacentHTML
|
|
11
|
-
enableTemplateContent
|
|
12
|
-
enableCloneNode
|
|
13
|
-
enableContains
|
|
14
|
-
enableMutationObserver
|
|
8
|
+
enableInnerHTML?: boolean
|
|
9
|
+
enableSizeAPIs?: boolean
|
|
10
|
+
enableAdjacentHTML?: boolean
|
|
11
|
+
enableTemplateContent?: boolean
|
|
12
|
+
enableCloneNode?: boolean
|
|
13
|
+
enableContains?: boolean
|
|
14
|
+
enableMutationObserver?: boolean
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
interface OutputExt {
|
|
@@ -30,6 +30,9 @@ interface OutputExt {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes> {
|
|
33
|
+
/** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
|
|
34
|
+
enableSourceMap?: boolean
|
|
35
|
+
|
|
33
36
|
/** 默认值:'cheap-module-source-map', 具体参考[Webpack devtool 配置](https://webpack.js.org/configuration/devtool/#devtool) */
|
|
34
37
|
sourceMapType?: string
|
|
35
38
|
|
|
@@ -109,6 +112,9 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
|
|
|
109
112
|
|
|
110
113
|
/** 插件内部使用 */
|
|
111
114
|
runtime?: Runtime
|
|
115
|
+
|
|
116
|
+
/** 使用的编译工具。可选值:webpack4、webpack5、vite */
|
|
117
|
+
compiler?: Compiler<T>
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
export interface IMiniFilesConfig {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CustomPluginOptions, ResolvedId, ResolveIdResult } from 'rollup'
|
|
2
|
+
|
|
3
|
+
interface IRollupPluginResolveIdOptions {
|
|
4
|
+
assertions?: Record<string, string>
|
|
5
|
+
custom?: CustomPluginOptions
|
|
6
|
+
isEntry?: boolean
|
|
7
|
+
skipSelf?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type TRollupResolveMethod = (
|
|
11
|
+
source: string,
|
|
12
|
+
importer?: string,
|
|
13
|
+
options?: IRollupPluginResolveIdOptions
|
|
14
|
+
) => Promise<ResolvedId | null>
|
|
15
|
+
|
|
16
|
+
export interface ILoaderMeta {
|
|
17
|
+
importFrameworkStatement: string
|
|
18
|
+
importFrameworkName: string
|
|
19
|
+
creator: string
|
|
20
|
+
creatorLocation: string
|
|
21
|
+
extraImportForWeb: string
|
|
22
|
+
execBeforeCreateWebApp: string
|
|
23
|
+
frameworkArgs: string
|
|
24
|
+
isNeedRawLoader?: boolean
|
|
25
|
+
mockAppStatement: string
|
|
26
|
+
modifyConfig?: (config: Record<string, any>, source: string) => void
|
|
27
|
+
modifyResolveId?: (res: {
|
|
28
|
+
source?: string
|
|
29
|
+
importer?: string
|
|
30
|
+
options?: IRollupPluginResolveIdOptions
|
|
31
|
+
name?: string
|
|
32
|
+
resolve: TRollupResolveMethod
|
|
33
|
+
}) => Promise<ResolveIdResult> | ResolveIdResult
|
|
34
|
+
}
|
|
@@ -5,6 +5,7 @@ import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
|
5
5
|
import type { IModifyChainData } from '../hooks'
|
|
6
6
|
import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from './util'
|
|
7
7
|
import type { IH5Config } from './h5'
|
|
8
|
+
import type { IHarmonyConfig } from './harmony'
|
|
8
9
|
import type { IMiniAppConfig, IMiniFilesConfig } from './mini'
|
|
9
10
|
import type { IRNConfig } from './rn'
|
|
10
11
|
|
|
@@ -313,5 +314,7 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
|
|
|
313
314
|
/** 专属于 RN 的配置 */
|
|
314
315
|
rn?: IRNConfig
|
|
315
316
|
|
|
317
|
+
harmony?: IHarmonyConfig<T>
|
|
318
|
+
|
|
316
319
|
[key: string]: any
|
|
317
320
|
}
|
|
@@ -90,10 +90,12 @@ interface IBasePostcssOption {
|
|
|
90
90
|
[key: string]: any
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
export type IPostcssOption<T = 'h5' | 'mini'> = T extends 'h5'
|
|
93
|
+
export type IPostcssOption<T = 'h5' | 'harmony' | 'mini'> = T extends 'h5'
|
|
94
94
|
? IBasePostcssOption & { url?: PostcssOption.url }
|
|
95
95
|
: IBasePostcssOption
|
|
96
96
|
|
|
97
|
+
export type Config = ViteConfig | WebpackConfig
|
|
98
|
+
|
|
97
99
|
export interface ICopyOptions {
|
|
98
100
|
patterns: {
|
|
99
101
|
from: string
|