@tarojs/taro 3.7.0-canary.0 → 3.8.0-canary.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.7.0-canary.0",
3
+ "version": "3.8.0-canary.0",
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.7.0-canary.0",
25
- "@tarojs/runtime": "3.7.0-canary.0"
24
+ "@tarojs/api": "3.8.0-canary.0",
25
+ "@tarojs/runtime": "3.8.0-canary.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@tarojs/helper": "3.7.0-canary.0"
28
+ "@tarojs/helper": "3.8.0-canary.0"
29
29
  },
30
30
  "peerDependenciesMeta": {
31
31
  "@types/react": {
@@ -15,6 +15,42 @@ declare module '../../index' {
15
15
  response: string
16
16
  }
17
17
  }
18
+ namespace tradePay {
19
+ interface Option {
20
+ /** 接入小程序支付时传入此参数。此参数为支付宝交易号,注意参数有大小写区分(调用 小程序支付 时必填) */
21
+ tradeNO?: string
22
+ /** 完整的支付参数拼接成的字符串,从服务端获取(调用 支付宝预授权 时必填) */
23
+ orderStr?: string
24
+ /** 接口调用成功的回调函数 */
25
+ success?: (res: SuccessCallbackResult) => void
26
+ /** 接口调用失败的回调函数 */
27
+ fail?: (res: TaroGeneral.CallbackResult) => void
28
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
29
+ complete?:(res: TaroGeneral.CallbackResult) => void
30
+ }
31
+ interface ResultCode {
32
+ /** 无权限调用(N22104) */
33
+ 4
34
+ /** 订单处理成功 */
35
+ 9000
36
+ /** 正在处理中。支付结果未知(有可能已经支付成功) */
37
+ 8000
38
+ /** 订单处理失败 */
39
+ 4000
40
+ /** 用户中途取消 */
41
+ 6001
42
+ /** 网络连接出错 */
43
+ 6002
44
+ /** 处理结果未知(有可能已经成功) */
45
+ 6004
46
+ }
47
+ interface SuccessCallbackResult {
48
+ /** success 回调函数会携带一个 Object 类型的对象,其属性如下: */
49
+ response: {
50
+ resultCode: ResultCode
51
+ }
52
+ }
53
+ }
18
54
  interface TaroStatic {
19
55
  /**
20
56
  * 此接口可获取支付宝会员的基础信息(头像图片地址、昵称、性别、国家码、省份、所在市区),接入方法请参考 获取会员基础信息介绍。如需获取支付宝会员标识(user_id),请调用 my.getAuthCode 和 alipay.system.oauth.token 接口。
@@ -22,5 +58,12 @@ declare module '../../index' {
22
58
  * @see https://docs.alipay.com/mini/api/ch8chh
23
59
  */
24
60
  getOpenUserInfo(Option: getOpenUserInfo.Option): Promise<getOpenUserInfo.SuccessCallbackResult>
61
+
62
+ /**
63
+ * 此接口是用于发起支付的 API,此 API 暂仅支持企业支付宝小程序使用
64
+ * @supported alipay
65
+ * @see https://opendocs.alipay.com/mini/api/openapi-pay
66
+ */
67
+ tradePay(Option: tradePay.Option): Promise<tradePay.SuccessCallbackResult>
25
68
  }
26
69
  }
@@ -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
  /** 接口调用失败的回调函数 */
@@ -87,10 +106,12 @@ declare module '../../index' {
87
106
  /** 设置请求重试次数
88
107
  * @default 2
89
108
  * @supported h5
109
+ * @h5 仅在 jsonp 模式下生效
90
110
  */
91
111
  retryTimes?: number
92
112
  /** 设置请求的兜底接口
93
113
  * @supported h5
114
+ * @h5 仅在 jsonp 模式下生效
94
115
  */
95
116
  backup?: string | string[]
96
117
  /** 设置请求中止信号
@@ -99,19 +120,23 @@ declare module '../../index' {
99
120
  signal?: AbortSignal
100
121
  /** 设置请求响应的数据校验函数,若返回 false,则请求兜底接口,若无兜底接口,则报请求失败
101
122
  * @supported h5
123
+ * @h5 仅在 jsonp 模式下生效
102
124
  */
103
125
  dataCheck?(): boolean
104
126
  /** 设置请求是否使用缓存
105
127
  * @default false
106
128
  * @supported h5
129
+ * @h5 仅在 jsonp 模式下生效
107
130
  */
108
131
  useStore?: boolean
109
132
  /** 设置请求缓存校验的 key
110
133
  * @supported h5
134
+ * @h5 仅在 jsonp 模式下生效
111
135
  */
112
136
  storeCheckKey?: string
113
137
  /** 设置请求缓存签名
114
138
  * @supported h5
139
+ * @h5 仅在 jsonp 模式下生效
115
140
  */
116
141
  storeSign?: string
117
142
  /** 设置请求校验函数,一般不需要设置
@@ -120,7 +145,8 @@ declare module '../../index' {
120
145
  storeCheck?(): boolean
121
146
  }
122
147
 
123
- interface SuccessCallbackResult < T extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > extends TaroGeneral.CallbackResult {
148
+ interface SuccessCallbackResult<T extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any>
149
+ extends TaroGeneral.CallbackResult {
124
150
  /** 开发者服务器返回的数据 */
125
151
  data: T
126
152
  /** 开发者服务器返回的 HTTP Response Header */
@@ -135,10 +161,26 @@ declare module '../../index' {
135
161
 
136
162
  /** 返回的数据格式 */
137
163
  interface DataType {
138
- /** 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse
164
+ /**
165
+ * 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse
139
166
  * 其他: 不对返回的内容进行 JSON.parse
140
167
  */
141
168
  json
169
+ /**
170
+ * 返回的数据为文本字符串
171
+ * @supported alipay
172
+ */
173
+ text
174
+ /**
175
+ * 返回的数据将转换为 base64 格式字符串
176
+ * @supported alipay
177
+ */
178
+ base64
179
+ /**
180
+ * 返回的数据将保持 ArrayBuffer 数据
181
+ * @supported alipay 支付宝: 10.1.70+
182
+ */
183
+ arraybuffer
142
184
  }
143
185
 
144
186
  /** HTTP 请求方法 */
@@ -202,6 +244,21 @@ declare module '../../index' {
202
244
  /** 浏览器在其HTTP缓存中寻找匹配的请求 */
203
245
  'only-if-cached'
204
246
  }
247
+ /** referer 策略 */
248
+ interface ReferrerStrategy {
249
+ /**
250
+ * referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html
251
+ */
252
+ index
253
+ /**
254
+ * 保留 page(pages/xxx/yyy),referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html#{page}
255
+ */
256
+ page
257
+ /**
258
+ * 默认值。会将发起请求时所在页面的 URL 作为 referer 值,会保留 page(pages/xxx/yyy)和 querystring(x=1&y=2)并可能有框架添加的其他参数,referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html#{page}?{querysrtring}{框架其他参数}
259
+ */
260
+ querystring
261
+ }
205
262
  }
206
263
 
207
264
  /** 网络请求任务对象
@@ -269,7 +326,7 @@ declare module '../../index' {
269
326
  */
270
327
  onHeadersReceived(
271
328
  /** HTTP Response Header 事件的回调函数 */
272
- callback: RequestTask.onHeadersReceived.Callback,
329
+ callback: RequestTask.onHeadersReceived.Callback
273
330
  ): void
274
331
  /** 取消监听 HTTP Response Header 事件
275
332
  * @supported weapp
@@ -277,7 +334,7 @@ declare module '../../index' {
277
334
  */
278
335
  offHeadersReceived(
279
336
  /** HTTP Response Header 事件的回调函数 */
280
- callback: RequestTask.onHeadersReceived.Callback,
337
+ callback: RequestTask.onHeadersReceived.Callback
281
338
  ): void
282
339
  /** 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。
283
340
  * @supported weapp
@@ -285,7 +342,7 @@ declare module '../../index' {
285
342
  */
286
343
  onChunkReceived(
287
344
  /** Transfer-Encoding Chunk Received 事件的回调函数 */
288
- callback: RequestTask.onChunkReceived.Callback,
345
+ callback: RequestTask.onChunkReceived.Callback
289
346
  ): void
290
347
  /** 移除 Transfer-Encoding Chunk Received 事件的监听函数
291
348
  * @supported weapp
@@ -293,7 +350,7 @@ declare module '../../index' {
293
350
  */
294
351
  offChunkReceived(
295
352
  /** Transfer-Encoding Chunk Received 事件的回调函数 */
296
- callback: RequestTask.onChunkReceived.Callback,
353
+ callback: RequestTask.onChunkReceived.Callback
297
354
  ): void
298
355
  }
299
356
 
@@ -4,32 +4,34 @@ declare module '../../index' {
4
4
  namespace chooseAddress {
5
5
  interface Option {
6
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
- complete?: (res: TaroGeneral.CallbackResult) => void
7
+ complete?: (res: SuccessCallbackResult) => void
8
8
  /** 接口调用失败的回调函数 */
9
9
  fail?: (res: TaroGeneral.CallbackResult) => void
10
10
  /** 接口调用成功的回调函数 */
11
11
  success?: (result: SuccessCallbackResult) => void
12
12
  }
13
13
 
14
- interface SuccessCallbackResult {
14
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
15
+ /** 收货人姓名 */
16
+ userName: string
17
+ /** 邮编 */
18
+ postalCode: string
19
+ /** 国标收货地址第一级地址 */
20
+ provinceName: string
15
21
  /** 国标收货地址第二级地址 */
16
22
  cityName: string
17
23
  /** 国标收货地址第三级地址 */
18
24
  countyName: string
25
+ /** 国标收货地址第四级地址 */
26
+ streetName: string
19
27
  /** 详细收货地址信息 */
20
28
  detailInfo: string
21
- /** 错误信息 */
22
- errMsg: string
29
+ /** 新选择器详细收货地址信息 */
30
+ detailInfoNew: string
23
31
  /** 收货地址国家码 */
24
32
  nationalCode: string
25
- /** 邮编 */
26
- postalCode: string
27
- /** 国标收货地址第一级地址 */
28
- provinceName: string
29
33
  /** 收货人手机号码 */
30
34
  telNumber: string
31
- /** 收货人姓名 */
32
- userName: string
33
35
  }
34
36
  }
35
37
 
@@ -200,7 +200,7 @@ declare module '../../index' {
200
200
  * Taro.downloadFile({
201
201
  * url: 'https://res.wx.qq.com/wxdoc/dist/assets/img/demo.ef5c5bef.jpg',
202
202
  * success: (res) => {
203
- * wx.showShareImageMenu({
203
+ * Taro.showShareImageMenu({
204
204
  * path: res.tempFilePath
205
205
  * })
206
206
  * }
@@ -31,11 +31,11 @@ declare module '../index' {
31
31
  namespace setGlobalDataPlugin {
32
32
  /** Vue3 插件,用于设置 `getApp()` 中的全局变量 */
33
33
  interface Plugin {
34
- install (app: any, data: any): void
34
+ install(app: any, data: any): void
35
35
  }
36
36
  }
37
37
 
38
- /** @ignore */
38
+ /** @ignore */
39
39
  interface TARO_ENV_TYPE {
40
40
  [TaroGeneral.ENV_TYPE.WEAPP]: TaroGeneral.ENV_TYPE.WEAPP
41
41
  [TaroGeneral.ENV_TYPE.WEB]: TaroGeneral.ENV_TYPE.WEB
@@ -56,7 +56,7 @@ declare module '../index' {
56
56
  type InterceptorifyInterceptor<T, R> = (chain: InterceptorifyChain<T, R>) => Promise<R>
57
57
  interface Interceptorify<T, R> {
58
58
  request(requestParams: T): Promise<R>
59
- addInterceptor( interceptor: InterceptorifyInterceptor<T, R>): void
59
+ addInterceptor(interceptor: InterceptorifyInterceptor<T, R>): void
60
60
  cleanInterceptors(): void
61
61
  }
62
62
  }
@@ -101,6 +101,29 @@ declare module '../index' {
101
101
  */
102
102
  getAppInfo(): getAppInfo.AppInfo
103
103
 
104
+ getEnvInfoSync(): {
105
+ /** 小程序信息 */
106
+ microapp: {
107
+ /** 小程序版本号 */
108
+ mpVersion: string
109
+ /** 小程序环境 */
110
+ envType: string
111
+ /** 小程序appId */
112
+ appId: string
113
+ }
114
+ /** 插件信息 */
115
+ plugin: Record<string, unknown>
116
+ /** 通用参数 */
117
+ common: {
118
+ /** 用户数据存储的路径 */
119
+ USER_DATA_PATH: string
120
+ /** 校验白名单属性中的appInfoLaunchFrom后返回额外信息 */
121
+ location: string | undefined
122
+ launchFrom: string | undefined
123
+ schema: string | undefined
124
+ }
125
+ }
126
+
104
127
  /** 小程序引用插件 JS 接口
105
128
  * @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
106
129
  */
@@ -130,7 +153,7 @@ declare module '../index' {
130
153
  setGlobalDataPlugin: setGlobalDataPlugin.Plugin
131
154
 
132
155
  /** 获取自定义 TabBar 对应的 React 或 Vue 组件实例
133
- * @supported weapp
156
+ * @supported weapp, jd
134
157
  * @param page 小程序页面对象,可以通过 Taro.getCurrentInstance().page 获取
135
158
  */
136
159
  getTabBar<T>(page: getCurrentInstance.Current['page']): T | undefined
@@ -85,7 +85,7 @@ declare module '../../index' {
85
85
  showNavigationBarLoading(option?: showNavigationBarLoading.Option): void
86
86
 
87
87
  /** 动态设置当前页面的标题
88
- * @supported weapp, h5, rn, tt
88
+ * @supported weapp, alipay, h5, rn, tt
89
89
  * @example
90
90
  * ```tsx
91
91
  * Taro.setNavigationBarTitle({
@@ -1,7 +1,7 @@
1
1
  import type { swc } from '@tarojs/helper'
2
2
  import type Webpack from 'webpack'
3
3
 
4
- type CompilerTypes = 'webpack4' | 'webpack5' | 'vite'
4
+ type CompilerTypes = 'webpack4' | 'webpack5'
5
5
 
6
6
  interface IPrebundle {
7
7
  enable?: boolean
@@ -20,7 +20,6 @@ interface IPrebundle {
20
20
  interface ICompiler {
21
21
  type: CompilerTypes
22
22
  prebundle?: IPrebundle
23
- vitePlugins?: any[]
24
23
  }
25
24
 
26
25
  export type Compiler = CompilerTypes | ICompiler
@@ -19,6 +19,9 @@ export interface IMiniAppConfig {
19
19
  /** 指定 React 框架相关的代码是否使用开发环境(未压缩)代码,默认使用生产环境(压缩后)代码 */
20
20
  debugReact?: boolean
21
21
 
22
+ /** 是否跳过第三方依赖 usingComponent 的处理,默认为自动处理第三方依赖的自定义组件 */
23
+ skipProcessUsingComponents?: boolean
24
+
22
25
  /** 压缩小程序 xml 文件的相关配置 */
23
26
  minifyXML?: {
24
27
  /** 是否合并 xml 文件中的空格 (默认false) */
@@ -35,7 +38,20 @@ export interface IMiniAppConfig {
35
38
  webpackChain?: (chain: Chain, webpack: typeof Webpack, PARSE_AST_TYPE: any) => void
36
39
 
37
40
  /** 可用于修改、拓展 Webpack 的 [output](https://webpack.js.org/configuration/output/) 选项 */
38
- output?: Webpack.Configuration['output']
41
+ output?: Webpack.Configuration['output'] & {
42
+ /**
43
+ * 编译前清空输出目录
44
+ * @since Taro v3.6.9
45
+ * @description
46
+ * - 默认清空输出目录,可设置 clean: false 不清空
47
+ * - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件
48
+ * - 注意 clean.keep 不支持函数
49
+ */
50
+ clean?: boolean | {
51
+ /** 保留指定文件不删除 */
52
+ keep?: Array<string | RegExp> | string | RegExp
53
+ }
54
+ }
39
55
 
40
56
  /** 配置 postcss 相关插件 */
41
57
  postcss?: IPostcssOption
@@ -2,13 +2,13 @@ import type Webpack from 'webpack'
2
2
  import type Chain from 'webpack-chain'
3
3
  import { type Input } from 'postcss'
4
4
  import type { Compiler } from '../compiler'
5
- import type { IModifyWebpackChain } from '../hooks'
5
+ import type { IModifyChainData } from '../hooks'
6
6
  import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from './util'
7
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
  /**
@@ -179,12 +179,8 @@ export interface IProjectBaseConfig {
179
179
  /**
180
180
  * 编译中修改 webpack 配置,在这个钩子中,你可以对 webpackChain 作出想要的调整,等同于配置 [`webpackChain`](./config-detail#miniwebpackchain)
181
181
  */
182
- modifyWebpackChain?: (chain: Chain, webpack: typeof Webpack, data: IModifyWebpackChain) => Promise<any>
182
+ modifyWebpackChain?: (chain: Chain, webpack: typeof Webpack, data: IModifyChainData) => Promise<any>
183
183
 
184
- /**
185
- * 编译中修改 vite 配置
186
- */
187
- modifyViteConfig?: (viteConfig: any, componentConfig: IModifyWebpackChain['componentConfig']) => void
188
184
  /**
189
185
  * 修改编译过程中的页面组件配置
190
186
  */
@@ -6,7 +6,7 @@ import type { IOption, IPostcssOption } from './util'
6
6
 
7
7
  export interface IRNConfig {
8
8
  /** 设置 RN bundle 中注册应用的名称 */
9
- appName: string
9
+ appName?: string
10
10
 
11
11
  /** entry 利用模块查找规则{name}.{platform}.{ext}自动区分平台 */
12
12
  entry?: string
@@ -53,4 +53,12 @@ export interface IRNConfig {
53
53
 
54
54
  /** 将 svg 文件转换为组件引入。默认值 false,不开启 */
55
55
  enableSvgTransform?: boolean
56
+
57
+ alias?: IOption
58
+
59
+ /** 设计稿尺寸 */
60
+ designWidth?: number | ((size?: string | number | Input) => number)
61
+
62
+ /** 设计稿尺寸换算规则 */
63
+ deviceRatio?: TaroGeneral.TDeviceRatio
56
64
  }
@@ -8,6 +8,6 @@ export interface IComponentConfig {
8
8
  includeAll: boolean
9
9
  }
10
10
 
11
- export interface IModifyWebpackChain {
11
+ export interface IModifyChainData {
12
12
  componentConfig?: IComponentConfig
13
13
  }
@@ -51,7 +51,6 @@ declare module './index' {
51
51
  onReachBottom?(): void
52
52
  onResize?(opt: PageResizeObject): void
53
53
  onShareAppMessage?(opt: ShareAppMessageObject): ShareAppMessageReturn
54
- onShareTimeline?(): ShareTimelineReturnObject
55
54
  onTabItemTap?(opt: TabItemTapObject): void
56
55
  onTitleClick?(): void
57
56
  onUnload(): void
@@ -215,6 +215,22 @@ declare module './index' {
215
215
  * @default "webview"
216
216
  */
217
217
  renderer?: 'webview' | 'skyline'
218
+ /**
219
+ * 组件框架
220
+ * @default "exparser"
221
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/glass-easel/migration.html
222
+ */
223
+ componentFramework?: 'exparser' | 'glass-easel'
224
+ /**
225
+ * 指定特殊的样式隔离选项
226
+ *
227
+ * isolated 表示启用样式隔离,在自定义组件内外,使用 class 指定的样式将不会相互影响(一般情况下的默认值)
228
+ *
229
+ * apply-shared 表示页面 wxss 样式将影响到自定义组件,但自定义组件 wxss 中指定的样式不会影响页面
230
+ *
231
+ * shared 表示页面 wxss 样式将影响到自定义组件,自定义组件 wxss 中指定的样式也会影响页面和其他设置了 apply-shared 或 shared 的自定义组件。(这个选项在插件中不可用。)
232
+ */
233
+ styleIsolation?: 'isolated' | 'apply-shared' | 'shared'
218
234
  /**
219
235
  * 设置导航栏额外图标,目前支持设置属性 icon,值为图标 url(以 https/http 开头)或 base64 字符串,大小建议 30*30 px
220
236
  *
@@ -345,6 +361,34 @@ declare module './index' {
345
361
  delay?: number
346
362
  }
347
363
 
364
+ interface RenderOptions {
365
+ skyline: {
366
+ /**
367
+ * 开启默认Block布局
368
+ * @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
369
+ */
370
+ defaultDisplayBlock?: boolean
371
+ /**
372
+ * 关闭 Skyline AB 实验
373
+ * @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
374
+ */
375
+ disableABTest?: boolean
376
+ }
377
+ }
378
+
379
+ interface Behavior {
380
+ /**
381
+ * 使用小程序默认分享功能时(即不显式设置 Page.onShareAppMessage),当设置此字段后,会使客户端生成的用于分享的 scheme 带上当前用户打开的页面所携带的 query 参数。
382
+ * @supported alipay 基础库 2.7.10 及以上开始支持,同时需使用 IDE 2.7.0 及以上版本进行构建。
383
+ */
384
+ shareAppMessage?: 'appendQuery'
385
+ /**
386
+ * 小程序在解析全局参数、页面参数时默认会对键/值做 encodeURIComponent。当设置为 disable 后,则不再对键/值做encodeURIComponent
387
+ * @supported alipay 基础库 2.7.19 及以上开始支持,同时需使用 IDE 3.0.0 及以上版本进行构建。
388
+ */
389
+ decodeQuery?: 'disable'
390
+ }
391
+
348
392
  interface AppConfig {
349
393
  /** 小程序默认启动首页,未指定 entryPagePath 时,数组的第一项代表小程序的初始页面(首页)。 */
350
394
  entryPagePath?: string
@@ -365,9 +409,11 @@ declare module './index' {
365
409
  * @default false
366
410
  * @since 2.1.0
367
411
  */
368
- functionalPages?: boolean | {
369
- independent?: boolean
370
- }
412
+ functionalPages?:
413
+ | boolean
414
+ | {
415
+ independent?: boolean
416
+ }
371
417
  /** 分包结构配置
372
418
  * @example
373
419
  * ```json
@@ -388,7 +434,7 @@ declare module './index' {
388
434
  * 使用 Worker 处理多线程任务时,设置 Worker 代码放置的目录
389
435
  * @since 1.9.90
390
436
  */
391
- workers?: string
437
+ workers?: string | string[]
392
438
  /** 申明需要后台运行的能力,类型为数组。目前支持以下项目:
393
439
  * - audio: 后台音乐播放
394
440
  * - location: 后台定位
@@ -555,6 +601,42 @@ declare module './index' {
555
601
  * @default "webview"
556
602
  */
557
603
  renderer?: 'webview' | 'skyline'
604
+ /**
605
+ * 渲染后端选项
606
+ * @see https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#rendererOptions
607
+ */
608
+ rendererOptions?: RenderOptions
609
+ /**
610
+ * 指定小程序使用的组件框架
611
+ * @default "exparser"
612
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/glass-easel/migration.html
613
+ */
614
+ componentFramework?: 'exparser' | 'glass-easel'
615
+ /**
616
+ * 多端模式场景接入身份管理服务时开启小程序授权页相关配置
617
+ * @see https://dev.weixin.qq.com/docs/framework/getting_started/auth.html#%E6%96%B0%E6%89%8B%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B
618
+ */
619
+ miniApp?: {
620
+ /**
621
+ * 用于 wx.weixinMinProgramLogin 在小程序中插入「小程序授权 Page」
622
+ */
623
+ useAuthorizePage: boolean
624
+ }
625
+ /**
626
+ * 正常情况下默认所有资源文件都被打包发布到所有平台,可以通过 static 字段配置特定每个目录/文件只能发布到特定的平台(多端场景)
627
+ * @see https://dev.weixin.qq.com/docs/framework/guideline/devtools/condition-compile.html#%E8%B5%84%E6%BA%90
628
+ */
629
+ static?: { pattern: string; platforms: string[] }[]
630
+ /**
631
+ * 动态插件配置规则,声明小程序需要使用动态插件
632
+ * @supported alipay
633
+ */
634
+ useDynamicPlugins?: boolean
635
+ /**
636
+ * 用于改变小程序若干运行行为
637
+ * @supported alipay
638
+ */
639
+ behavior?: Behavior
558
640
  }
559
641
 
560
642
  interface Config extends PageConfig, AppConfig {