@tarojs/taro 3.6.9-alpha.11 → 3.6.9-alpha.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.6.9-alpha.11",
3
+ "version": "3.6.9-alpha.13",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,11 +21,11 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.6.9-alpha.11",
25
- "@tarojs/runtime": "3.6.9-alpha.11"
24
+ "@tarojs/api": "3.6.9-alpha.13",
25
+ "@tarojs/runtime": "3.6.9-alpha.13"
26
26
  },
27
27
  "devDependencies": {
28
- "@tarojs/helper": "3.6.9-alpha.11"
28
+ "@tarojs/helper": "3.6.9-alpha.13"
29
29
  },
30
30
  "peerDependenciesMeta": {
31
31
  "@types/react": {
@@ -42,7 +42,7 @@ declare module '../../index' {
42
42
  namespace getLatestUserKey {
43
43
  interface Option {
44
44
  /** 接口调用成功的回调函数 */
45
- success?: (res: TaroGeneral.CallbackResult) => void
45
+ success?: (res: SuccessCallbackResult) => void
46
46
  /** 接口调用失败的回调函数 */
47
47
  fail?: (res: TaroGeneral.CallbackResult) => void
48
48
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -2,7 +2,7 @@ import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
4
  namespace request {
5
- interface Option <T = any, U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > {
5
+ interface Option<T = any, U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any> {
6
6
  /** 开发者服务器接口地址 */
7
7
  url: string
8
8
  /** 请求的参数 */
@@ -14,11 +14,11 @@ declare module '../../index' {
14
14
  header?: TaroGeneral.IAnyObject
15
15
  /** 超时时间,单位为毫秒
16
16
  * @default 2000
17
- * @supported weapp, h5, tt
17
+ * @supported weapp, h5, tt, alipay
18
18
  */
19
19
  timeout?: number
20
20
  /** HTTP 请求方法
21
- * @default GET
21
+ * @default "GET"
22
22
  */
23
23
  method?: keyof Method
24
24
  /** 返回的数据格式 */
@@ -54,6 +54,25 @@ declare module '../../index' {
54
54
  * @supported weapp
55
55
  */
56
56
  enableChunked?: boolean
57
+ /**
58
+ * wifi下使用移动网络发送请求
59
+ * @default false
60
+ * @supported weapp
61
+ */
62
+ forceCellularNetwork?: boolean
63
+ /**
64
+ * headers 中设置 cookie 字段是否生效。如果为 false,则 headers 中的 cookie 字段将被忽略,请求头中将包含服务端上一次返回的 cookie(如果有)。
65
+ * @default false
66
+ * @supported alipay 支付宝: 10.2.33+
67
+ */
68
+ enableCookie?: boolean
69
+ /**
70
+ * referer 策略,用于控制当前请求 header 对象中 referer 字段格式。该参数默认值可通过 app.json 中的配置进行修改。
71
+ * @default "querystring"
72
+ * @supported alipay 支付宝: 10.3.50+ APPX: 2.8.7 开发者工具: 3.5.1
73
+ * @see https://opendocs.alipay.com/mini/api/owycmh#referrerStrategy%20%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E
74
+ */
75
+ referrerStrategy?: keyof ReferrerStrategy
57
76
  /** 接口调用成功的回调函数 */
58
77
  success?: (result: SuccessCallbackResult<T>) => void
59
78
  /** 接口调用失败的回调函数 */
@@ -120,7 +139,8 @@ declare module '../../index' {
120
139
  storeCheck?(): boolean
121
140
  }
122
141
 
123
- interface SuccessCallbackResult < T extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > extends TaroGeneral.CallbackResult {
142
+ interface SuccessCallbackResult<T extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any>
143
+ extends TaroGeneral.CallbackResult {
124
144
  /** 开发者服务器返回的数据 */
125
145
  data: T
126
146
  /** 开发者服务器返回的 HTTP Response Header */
@@ -135,10 +155,26 @@ declare module '../../index' {
135
155
 
136
156
  /** 返回的数据格式 */
137
157
  interface DataType {
138
- /** 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse
158
+ /**
159
+ * 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse
139
160
  * 其他: 不对返回的内容进行 JSON.parse
140
161
  */
141
162
  json
163
+ /**
164
+ * 返回的数据为文本字符串
165
+ * @supported alipay
166
+ */
167
+ text
168
+ /**
169
+ * 返回的数据将转换为 base64 格式字符串
170
+ * @supported alipay
171
+ */
172
+ base64
173
+ /**
174
+ * 返回的数据将保持 ArrayBuffer 数据
175
+ * @supported alipay 支付宝: 10.1.70+
176
+ */
177
+ arraybuffer
142
178
  }
143
179
 
144
180
  /** HTTP 请求方法 */
@@ -202,6 +238,21 @@ declare module '../../index' {
202
238
  /** 浏览器在其HTTP缓存中寻找匹配的请求 */
203
239
  'only-if-cached'
204
240
  }
241
+ /** referer 策略 */
242
+ interface ReferrerStrategy {
243
+ /**
244
+ * referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html
245
+ */
246
+ index
247
+ /**
248
+ * 保留 page(pages/xxx/yyy),referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html#{page}
249
+ */
250
+ page
251
+ /**
252
+ * 默认值。会将发起请求时所在页面的 URL 作为 referer 值,会保留 page(pages/xxx/yyy)和 querystring(x=1&y=2)并可能有框架添加的其他参数,referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html#{page}?{querysrtring}{框架其他参数}
253
+ */
254
+ querystring
255
+ }
205
256
  }
206
257
 
207
258
  /** 网络请求任务对象
@@ -269,7 +320,7 @@ declare module '../../index' {
269
320
  */
270
321
  onHeadersReceived(
271
322
  /** HTTP Response Header 事件的回调函数 */
272
- callback: RequestTask.onHeadersReceived.Callback,
323
+ callback: RequestTask.onHeadersReceived.Callback
273
324
  ): void
274
325
  /** 取消监听 HTTP Response Header 事件
275
326
  * @supported weapp
@@ -277,7 +328,7 @@ declare module '../../index' {
277
328
  */
278
329
  offHeadersReceived(
279
330
  /** HTTP Response Header 事件的回调函数 */
280
- callback: RequestTask.onHeadersReceived.Callback,
331
+ callback: RequestTask.onHeadersReceived.Callback
281
332
  ): void
282
333
  /** 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。
283
334
  * @supported weapp
@@ -285,7 +336,7 @@ declare module '../../index' {
285
336
  */
286
337
  onChunkReceived(
287
338
  /** Transfer-Encoding Chunk Received 事件的回调函数 */
288
- callback: RequestTask.onChunkReceived.Callback,
339
+ callback: RequestTask.onChunkReceived.Callback
289
340
  ): void
290
341
  /** 移除 Transfer-Encoding Chunk Received 事件的监听函数
291
342
  * @supported weapp
@@ -293,7 +344,7 @@ declare module '../../index' {
293
344
  */
294
345
  offChunkReceived(
295
346
  /** Transfer-Encoding Chunk Received 事件的回调函数 */
296
- callback: RequestTask.onChunkReceived.Callback,
347
+ callback: RequestTask.onChunkReceived.Callback
297
348
  ): void
298
349
  }
299
350
 
@@ -8,7 +8,7 @@ import type { IH5Config } from './h5'
8
8
  import type { IMiniAppConfig } from './mini'
9
9
  import { IRNConfig } from './rn'
10
10
 
11
- export type PluginItem = string | [string, object] | [string, () => object | Promise<object>]
11
+ export type PluginItem<T = object> = string | [string, T] | [string, () => T | Promise<T>]
12
12
 
13
13
  interface ICache {
14
14
  /**