@tarojs/taro 3.6.17 → 3.6.19

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 (35) hide show
  1. package/package.json +4 -4
  2. package/types/api/data-analysis/index.d.ts +51 -1
  3. package/types/api/device/accelerometer.d.ts +8 -6
  4. package/types/api/device/accessibility.d.ts +1 -1
  5. package/types/api/device/battery.d.ts +2 -2
  6. package/types/api/device/bluetooth-ble.d.ts +40 -17
  7. package/types/api/device/bluetooth-peripheral.d.ts +26 -26
  8. package/types/api/device/bluetooth.d.ts +37 -13
  9. package/types/api/device/calendar.d.ts +11 -1
  10. package/types/api/device/clipboard.d.ts +2 -2
  11. package/types/api/device/compass.d.ts +5 -5
  12. package/types/api/device/gyroscope.d.ts +4 -4
  13. package/types/api/device/iBeacon.d.ts +10 -8
  14. package/types/api/device/keyboard.d.ts +7 -5
  15. package/types/api/device/memory.d.ts +3 -4
  16. package/types/api/device/motion.d.ts +8 -6
  17. package/types/api/device/network.d.ts +12 -6
  18. package/types/api/device/nfc.d.ts +13 -13
  19. package/types/api/device/phone.d.ts +1 -1
  20. package/types/api/device/scan.d.ts +5 -3
  21. package/types/api/device/screen.d.ts +27 -11
  22. package/types/api/device/sms.d.ts +1 -1
  23. package/types/api/device/vibrate.d.ts +5 -5
  24. package/types/api/device/wifi.d.ts +25 -13
  25. package/types/api/files/index.d.ts +71 -41
  26. package/types/api/location/index.d.ts +166 -18
  27. package/types/api/media/camera.d.ts +6 -3
  28. package/types/api/open-api/login.d.ts +1 -1
  29. package/types/api/storage/background-fetch.d.ts +63 -11
  30. package/types/api/storage/cache-manager.d.ts +52 -1
  31. package/types/api/storage/index.d.ts +125 -10
  32. package/types/api/ui/fonts.d.ts +4 -3
  33. package/types/compile/config/h5.d.ts +3 -0
  34. package/types/compile/config/mini.d.ts +11 -8
  35. package/types/taro.config.d.ts +35 -4
@@ -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, h5, tt
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, tt
180
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn
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, h5, tt
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, tt
224
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn
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, h5, tt
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, h5, rn, tt
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, h5, rn, tt
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, tt
292
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn
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, h5, tt
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, tt
330
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn
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
  }
@@ -54,13 +54,14 @@ declare module '../../index' {
54
54
  /** 动态加载网络字体。文件地址需为下载类型。iOS 仅支持 https 格式文件地址。
55
55
  *
56
56
  * 注意:
57
- * 1. 字体文件返回的 contet-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
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. 工具里提示 Faild to load font可以忽略
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({
@@ -44,6 +44,9 @@ export interface IH5Config {
44
44
  /** 预览服务的配置,可以更改端口等参数。具体配置参考 [webpack-dev-server](https://webpack.js.org/configuration/dev-server) */
45
45
  devServer?: webpackDevServer.Configuration
46
46
 
47
+ /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
48
+ enableSourceMap?: boolean
49
+
47
50
  /** 具体配置请参考 [Webpack devtool](https://webpack.js.org/configuration/devtool/#devtool) 配置 (默认值:'cheap-module-eval-source-map')*/
48
51
  sourceMapType?:
49
52
  | 'none'
@@ -3,16 +3,19 @@ import type Chain from 'webpack-chain'
3
3
  import type { IOption, IPostcssOption } from './util'
4
4
 
5
5
  interface Runtime {
6
- enableInnerHTML: boolean
7
- enableSizeAPIs: boolean
8
- enableAdjacentHTML: boolean
9
- enableTemplateContent: boolean
10
- enableCloneNode: boolean
11
- enableContains: boolean
12
- enableMutationObserver: boolean
6
+ enableInnerHTML?: boolean
7
+ enableSizeAPIs?: boolean
8
+ enableAdjacentHTML?: boolean
9
+ enableTemplateContent?: boolean
10
+ enableCloneNode?: boolean
11
+ enableContains?: boolean
12
+ enableMutationObserver?: boolean
13
13
  }
14
14
 
15
15
  export interface IMiniAppConfig {
16
+ /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
17
+ enableSourceMap?: boolean
18
+
16
19
  /** 默认值:'cheap-module-source-map', 具体参考[Webpack devtool 配置](https://webpack.js.org/configuration/devtool/#devtool) */
17
20
  sourceMapType?: string
18
21
 
@@ -42,7 +45,7 @@ export interface IMiniAppConfig {
42
45
  /**
43
46
  * 编译前清空输出目录
44
47
  * @since Taro v3.6.9
45
- * @description
48
+ * @description
46
49
  * - 默认清空输出目录,可设置 clean: false 不清空
47
50
  * - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件
48
51
  * - 注意 clean.keep 不支持函数
@@ -175,6 +175,12 @@ declare module './index' {
175
175
  * @default false
176
176
  */
177
177
  enableShareTimeline?: boolean
178
+ /**
179
+ * 页面是否需要使用 \<page-meta\> 和 \<navigation-bar\> 组件
180
+ * @default false
181
+ * @support weapp, alipay
182
+ */
183
+ enablePageMeta?: boolean
178
184
  /** 页面自定义组件配置
179
185
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
180
186
  */
@@ -363,16 +369,41 @@ declare module './index' {
363
369
 
364
370
  interface RenderOptions {
365
371
  skyline: {
366
- /**
367
- * 开启默认Block布局
372
+ /** 开启默认Block布局
368
373
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/wxss.html#%E5%BC%80%E5%90%AF%E9%BB%98%E8%AE%A4Block%E5%B8%83%E5%B1%80
374
+ * @supported weapp
369
375
  */
370
376
  defaultDisplayBlock?: boolean
371
- /**
372
- * 关闭 Skyline AB 实验
377
+ /** 关闭 Skyline AB 实验
373
378
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/migration/release.html#%E5%8F%91%E5%B8%83%E4%B8%8A%E7%BA%BF
379
+ * @supported weapp
374
380
  */
375
381
  disableABTest?: boolean
382
+ /** 基础库最低版本
383
+ * @supported weapp
384
+ */
385
+ sdkVersionBegin?: string
386
+ /** 基础库最高版本
387
+ * @supported weapp
388
+ */
389
+ sdkVersionEnd?: string
390
+ /** iOS 微信最低版本
391
+ * @supported weapp
392
+ */
393
+ iosVersionBegin?: string
394
+ /** iOS 微信最高版本
395
+ * @supported weapp
396
+ */
397
+ iosVersionEnd?: string
398
+ /** 安卓微信最低版本
399
+ * @supported weapp
400
+ */
401
+ androidVersionBegin?: string
402
+ /** 安卓微信最高版本
403
+ * @supported weapp
404
+ */
405
+ androidVersionEnd?: string
406
+ [key: string]: unknown
376
407
  }
377
408
  }
378
409