@tarojs/taro 3.7.0-alpha.2 → 3.7.0-alpha.22

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 (49) hide show
  1. package/package.json +16 -3
  2. package/types/api/ad/index.d.ts +6 -18
  3. package/types/api/ai/inference.d.ts +129 -0
  4. package/types/api/ai/visionkit.d.ts +625 -54
  5. package/types/api/alipay/index.d.ts +43 -0
  6. package/types/api/base/crypto.d.ts +18 -4
  7. package/types/api/base/index.d.ts +2 -2
  8. package/types/api/base/performance.d.ts +65 -2
  9. package/types/api/base/system.d.ts +65 -0
  10. package/types/api/base/weapp/app-event.d.ts +18 -18
  11. package/types/api/canvas/index.d.ts +67 -54
  12. package/types/api/device/calendar.d.ts +2 -2
  13. package/types/api/device/screen.d.ts +61 -0
  14. package/types/api/device/sms.d.ts +26 -0
  15. package/types/api/media/audio.d.ts +50 -30
  16. package/types/api/media/image.d.ts +40 -17
  17. package/types/api/media/live.d.ts +52 -0
  18. package/types/api/media/video.d.ts +64 -23
  19. package/types/api/media/voip.d.ts +103 -0
  20. package/types/api/network/download.d.ts +2 -10
  21. package/types/api/network/request.d.ts +84 -24
  22. package/types/api/network/upload.d.ts +2 -10
  23. package/types/api/open-api/address.d.ts +12 -10
  24. package/types/api/open-api/channels.d.ts +31 -0
  25. package/types/api/open-api/device-voip.d.ts +63 -0
  26. package/types/api/open-api/login.d.ts +1 -1
  27. package/types/api/open-api/my-miniprogram.d.ts +2 -2
  28. package/types/api/open-api/privacy.d.ts +99 -0
  29. package/types/api/route/index.d.ts +3 -0
  30. package/types/api/share/index.d.ts +1 -1
  31. package/types/api/skyline/index.d.ts +59 -0
  32. package/types/api/storage/cache-manager.d.ts +198 -0
  33. package/types/api/taro.extend.d.ts +223 -0
  34. package/types/{taro.hooks.d.ts → api/taro.hooks.d.ts} +4 -4
  35. package/types/api/ui/navigation-bar.d.ts +1 -1
  36. package/types/compile/compiler.d.ts +8 -6
  37. package/types/compile/config/h5.d.ts +79 -11
  38. package/types/compile/config/mini.d.ts +83 -12
  39. package/types/compile/config/project.d.ts +242 -20
  40. package/types/compile/config/rn.d.ts +64 -0
  41. package/types/compile/config/util.d.ts +83 -11
  42. package/types/compile/hooks.d.ts +1 -1
  43. package/types/compile/viteCompilerContext.d.ts +128 -0
  44. package/types/global.d.ts +9 -8
  45. package/types/index.d.ts +9 -7
  46. package/types/taro.api.d.ts +11 -1
  47. package/types/taro.component.d.ts +3 -2
  48. package/types/taro.config.d.ts +122 -2
  49. package/types/taro.extend.d.ts +0 -112
@@ -0,0 +1,128 @@
1
+ import type { AppConfig, PageConfig } from "../index"
2
+ import type { IMiniFilesConfig, IH5Config, IMiniAppConfig } from "./config"
3
+ import type { IProjectConfig } from './config/project'
4
+ import type { PluginContext } from "rollup"
5
+ import { IComponentConfig } from "./hooks"
6
+
7
+ import type { RecursiveTemplate, UnRecursiveTemplate } from '@tarojs/shared/dist/template'
8
+
9
+ export interface ViteNativeCompMeta {
10
+ name: string
11
+ scriptPath: string
12
+ configPath: string
13
+ config: PageConfig
14
+ isNative: true
15
+ templatePath: string
16
+ cssPath?: string
17
+ }
18
+
19
+ export interface ViteFileType {
20
+ config: string
21
+ script: string
22
+ templ: string
23
+ style: string
24
+ xs?: string
25
+ }
26
+
27
+ export interface ViteAppMeta {
28
+ name: string
29
+ scriptPath: string
30
+ configPath: string
31
+ config: AppConfig
32
+ isNative: false
33
+ }
34
+
35
+ export interface VitePageMeta {
36
+ name: string
37
+ scriptPath: string
38
+ configPath: string
39
+ config: PageConfig
40
+ isNative: boolean
41
+ templatePath?: string
42
+ cssPath?: string
43
+ }
44
+
45
+
46
+ export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'> {
47
+ entryFileName?: string
48
+ runtimePath?: string | string[]
49
+ }
50
+
51
+ export interface CommonBuildConfig extends IProjectConfig<'vite'> {
52
+ entry: {
53
+ app: string | string[]
54
+ }
55
+ mode: 'production' | 'development' | 'none'
56
+ buildAdapter: string // weapp | swan | alipay | tt | qq | jd | h5
57
+ platformType: string // mini | web
58
+ /** special mode */
59
+ isBuildNativeComp?: boolean
60
+ /** hooks */
61
+ onCompilerMake: (compilation) => Promise<any>
62
+ onParseCreateElement: (nodeName, componentConfig) => Promise<any>
63
+ }
64
+
65
+
66
+ export interface ViteMiniBuildConfig extends CommonBuildConfig, IMiniAppConfig<'vite'> {
67
+ isBuildPlugin: boolean
68
+ isSupportRecursive: boolean
69
+ isSupportXS: boolean
70
+ nodeModulesPath: string
71
+ fileType: ViteFileType
72
+ globalObject: string
73
+ template: RecursiveTemplate | UnRecursiveTemplate
74
+ runtimePath?: string | string[]
75
+ taroComponentsPath?: string
76
+ blended?: boolean
77
+ hot?: boolean
78
+ injectOptions?: {
79
+ include?: Record<string, string | string[]>
80
+ exclude?: string[]
81
+ }
82
+ /** hooks */
83
+ modifyComponentConfig: (componentConfig: IComponentConfig, config: Partial<ViteMiniBuildConfig>) => Promise<any>
84
+ }
85
+
86
+ export interface ViteCompilerContext<T> {
87
+ cwd: string
88
+ sourceDir: string
89
+ taroConfig: T
90
+ rawTaroConfig: T
91
+ frameworkExts: string[]
92
+ app: ViteAppMeta
93
+ pages: VitePageMeta[]
94
+ loaderMeta: any
95
+ logger
96
+ filesConfig: IMiniFilesConfig
97
+ configFileList: string[]
98
+ compilePage: (pageName: string) => VitePageMeta
99
+ watchConfigFile: (rollupCtx: PluginContext) => void
100
+ getAppScriptPath: () => string
101
+ getApp: () => ViteAppMeta
102
+ getPages: () => VitePageMeta[]
103
+ isApp: (id: string) => boolean
104
+ isPage: (id: string) => boolean
105
+ isNativePageORComponent: (templatePath: string) => boolean
106
+ getPageById: (id: string) => VitePageMeta| undefined
107
+ getConfigFilePath: (filePath: string) => string
108
+ getTargetFilePath: (filePath: string, targetExtName: string) => string
109
+ }
110
+
111
+ export interface ViteH5CompilerContext extends ViteCompilerContext<ViteH5BuildConfig> {
112
+ routerMeta: {
113
+ routerCreator: string
114
+ getRoutesConfig: (pageName?: string) => string
115
+ }
116
+ }
117
+
118
+ export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBuildConfig> {
119
+ fileType: ViteFileType
120
+ commonChunks: string[]
121
+ nativeComponents : Map<string, ViteNativeCompMeta>
122
+ getCommonChunks: () => string[]
123
+ collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
124
+ getScriptPath: (filePath: string) => string
125
+ getTemplatePath: (filePath: string) => string
126
+ getStylePath: (filePath: string) => string
127
+ getConfigPath: (filePath: string) => string
128
+ }
package/types/global.d.ts CHANGED
@@ -2,11 +2,12 @@ declare namespace TaroGeneral {
2
2
  type IAnyObject = Record<string, any>
3
3
  type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
4
4
  type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
5
+ type TFunc = (...args: any[]) => any
5
6
  /** 事件监听函数 */
6
7
  type EventCallback = (
7
8
  /** 触发事件参数 */
8
9
  ...args: any
9
- ) => void
10
+ ) => void
10
11
  /** 通用错误 */
11
12
  interface CallbackResult {
12
13
  /** 错误信息 */
@@ -35,7 +36,7 @@ declare namespace TaroGeneral {
35
36
  /** 阻止事件冒泡到父元素,阻止任何父事件处理程序被执行 */
36
37
  stopPropagation: () => void
37
38
  }
38
- interface currentTarget extends Target {}
39
+ interface currentTarget extends Target { }
39
40
  interface Target {
40
41
  /** 事件源组件的id */
41
42
  id: string
@@ -378,33 +379,33 @@ declare namespace TaroGeneral {
378
379
  */
379
380
  13024
380
381
  }
381
-
382
+ type EventName = string | symbol
382
383
  // Events
383
384
  class Events {
384
385
  /**
385
386
  * 监听一个事件,接受参数
386
387
  */
387
- on(eventName: string, listener: (...args: any[]) => void): this
388
+ on (eventName: EventName, listener: (...args: any[]) => void): this
388
389
 
389
390
  /**
390
391
  * 添加一个事件监听,并在事件触发完成之后移除Callbacks链
391
392
  */
392
- once(eventName: string, listener: (...args: any[]) => void): this
393
+ once (eventName: EventName, listener: (...args: any[]) => void): this
393
394
 
394
395
  /**
395
396
  * 取消监听一个事件
396
397
  */
397
- off(eventName: string, listener?: (...args: any[]) => void): this
398
+ off (eventName: EventName, listener?: (...args: any[]) => void): this
398
399
 
399
400
  /**
400
401
  * 取消监听的所有事件
401
402
  */
402
- off(): this
403
+ off (): this
403
404
 
404
405
  /**
405
406
  * 触发一个事件,传参
406
407
  */
407
- trigger(eventName: string, ...args: any[]): boolean
408
+ trigger (eventName: EventName, ...args: any[]): this
408
409
  }
409
410
 
410
411
  // ENV_TYPE
package/types/index.d.ts CHANGED
@@ -87,6 +87,8 @@
87
87
  * │ │ └── index.d.ts 路由 API
88
88
  * │ ├── share
89
89
  * │ │ └── index.d.ts 转发 API
90
+ * │ ├── skyline
91
+ * │ │ └── index.d.ts 微信 Skyline API
90
92
  * │ ├── storage
91
93
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
92
94
  * │ │ └── index.d.ts 数据缓存 API
@@ -108,13 +110,13 @@
108
110
  * │ │ └── interaction.d.ts 界面 -> 交互 API
109
111
  * │ ├── worker
110
112
  * │ │ └── index.d.ts Worker API
111
- * │ └── wxml
112
- * │ └── index.d.ts WXML API
113
+ * │ ├── wxml
114
+ * │└── index.d.ts WXML API
115
+ * │ ├── taro.extend.d.ts Taro 扩展 API 类型定义
116
+ * │ └── taro.hooks.d.ts Taro Hooks 类型定义
113
117
  * ├── index.d.ts 此文件
114
118
  * ├── taro.component.d.ts Taro Component 类型定义
115
- * ├── taro.config.d.ts Taro 小程序 App 与 Window 设置类型定义
116
- * ├── taro.extend.d.ts Taro 扩展 API 类型定义
117
- * ├── taro.hooks.d.ts Taro Hooks 类型定义
119
+ * ├── taro.config.d.ts Taro 小程序 App 与 Window 设置类型定义
118
120
  * └── taro.lifecycle.d.ts Taro 生命周期类型定义
119
121
  */
120
122
 
@@ -123,8 +125,6 @@
123
125
  /// <reference path="taro.api.d.ts" />
124
126
  /// <reference path="taro.component.d.ts" />
125
127
  /// <reference path="taro.config.d.ts" />
126
- /// <reference path="taro.extend.d.ts" />
127
- /// <reference path="taro.hooks.d.ts" />
128
128
  /// <reference path="taro.lifecycle.d.ts" />
129
129
 
130
130
  /// <reference types="@tarojs/plugin-platform-alipay/types/shims-alipay" />
@@ -132,6 +132,8 @@
132
132
  /// <reference types="@tarojs/plugin-platform-swan/types/shims-swan" />
133
133
  /// <reference types="@tarojs/plugin-platform-tt/types/shims-tt" />
134
134
  /// <reference types="@tarojs/plugin-platform-weapp/types/shims-weapp" />
135
+ /// <reference types="@tarojs/taro-h5/types/overlay" />
136
+ /// <reference types="@tarojs/taro-rn/types/overlay" />
135
137
 
136
138
  export = Taro
137
139
  export as namespace Taro
@@ -2,7 +2,7 @@
2
2
  *
3
3
  * 微信端能力
4
4
  * original code from: https://github.com/wx-minapp/minapp-wx/blob/master/typing/wx.d.ts
5
- * Lincenced under MIT license: https://github.com/qiu8310/minapp/issues/69
5
+ * Licensed under MIT license: https://github.com/qiu8310/minapp/issues/69
6
6
  * thanks for the great work by @qiu8310 👍👍👍
7
7
  *
8
8
  */
@@ -41,6 +41,7 @@
41
41
  /// <reference path="api/payment/index.d.ts" />
42
42
  /// <reference path="api/storage/index.d.ts" />
43
43
  /// <reference path="api/storage/background-fetch.d.ts" />
44
+ /// <reference path="api/storage/cache-manager.d.ts" />
44
45
  /// <reference path="api/data-analysis/index.d.ts" />
45
46
  /// <reference path="api/canvas/index.d.ts" />
46
47
  /// <reference path="api/media/map.d.ts" />
@@ -71,9 +72,12 @@
71
72
  /// <reference path="api/open-api/subscribe-message.d.ts" />
72
73
  /// <reference path="api/open-api/redpackage.d.ts" />
73
74
  /// <reference path="api/open-api/favorites.d.ts" />
75
+ /// <reference path="api/open-api/my-miniprogram.d.ts" />
74
76
  /// <reference path="api/open-api/license-plate.d.ts" />
75
77
  /// <reference path="api/open-api/channels.d.ts" />
78
+ /// <reference path="api/open-api/device-voip.d.ts" />
76
79
  /// <reference path="api/open-api/group.d.ts" />
80
+ /// <reference path="api/open-api/privacy.d.ts" />
77
81
  /// <reference path="api/open-api/customer-service.d.ts" />
78
82
  /// <reference path="api/device/bluetooth.d.ts" />
79
83
  /// <reference path="api/device/bluetooth-ble.d.ts" />
@@ -88,6 +92,7 @@
88
92
  /// <reference path="api/device/clipboard.d.ts" />
89
93
  /// <reference path="api/device/network.d.ts" />
90
94
  /// <reference path="api/device/screen.d.ts" />
95
+ /// <reference path="api/device/sms.d.ts" />
91
96
  /// <reference path="api/device/keyboard.d.ts" />
92
97
  /// <reference path="api/device/phone.d.ts" />
93
98
  /// <reference path="api/device/accelerometer.d.ts" />
@@ -99,10 +104,12 @@
99
104
  /// <reference path="api/device/vibrate.d.ts" />
100
105
  /// <reference path="api/ai/visionkit.d.ts" />
101
106
  /// <reference path="api/ai/face.d.ts" />
107
+ /// <reference path="api/ai/inference.d.ts" />
102
108
  /// <reference path="api/worker/index.d.ts" />
103
109
  /// <reference path="api/wxml/index.d.ts" />
104
110
  /// <reference path="api/ext/index.d.ts" />
105
111
  /// <reference path="api/ad/index.d.ts" />
112
+ /// <reference path="api/skyline/index.d.ts" />
106
113
 
107
114
  /// <reference path="api/cloud/index.d.ts" />
108
115
  /// <reference path="api/open-api/facial.d.ts" />
@@ -110,3 +117,6 @@
110
117
  /// <reference path="api/alipay/index.d.ts" />
111
118
  /// <reference path="api/qq/index.d.ts" />
112
119
  /// <reference path="api/swan/index.d.ts" />
120
+
121
+ /// <reference path="api/taro.extend.d.ts" />
122
+ /// <reference path="api/taro.hooks.d.ts" />
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import Vue from 'vue'
3
3
 
4
- import Taro, { Config } from './index'
4
+ import Taro from './index'
5
5
 
6
6
  declare module './index' {
7
7
  // ref: packages/taro-runtime/src/current.ts
@@ -51,6 +51,7 @@ declare module './index' {
51
51
  onReachBottom?(): void
52
52
  onResize?(opt: PageResizeObject): void
53
53
  onShareAppMessage?(opt: ShareAppMessageObject): ShareAppMessageReturn
54
+ onShareTimeline?(): ShareTimelineReturnObject
54
55
  onTabItemTap?(opt: TabItemTapObject): void
55
56
  onTitleClick?(): void
56
57
  onUnload(): void
@@ -89,7 +90,7 @@ declare module './index' {
89
90
  /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
90
91
  createSelectorQuery?(): SelectorQuery
91
92
  /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
92
- createIntersectionObserver?(): IntersectionObserver
93
+ createIntersectionObserver?(options?: createIntersectionObserver.Option): IntersectionObserver
93
94
  /** 创建一个 MediaQueryObserver 对象 */
94
95
  createMediaQueryObserver?(): MediaQueryObserver
95
96
  /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 wx://component-export 影响) */
@@ -154,6 +154,11 @@ declare module './index' {
154
154
  * @default: false
155
155
  */
156
156
  disableScroll?: boolean
157
+ /** 是否使用页面全局滚动,MPA下默认为全局滚动,SPA默认为局部滚动
158
+ * 只在H5生效
159
+ * @default: MPA:true SPA:false
160
+ */
161
+ usingWindowScroll?: boolean
157
162
  /** 禁止页面右滑手势返回
158
163
  *
159
164
  * **注意** 自微信客户端 7.0.5 开始,页面配置中的 disableSwipeBack 属性将不再生效,
@@ -210,6 +215,22 @@ declare module './index' {
210
215
  * @default "webview"
211
216
  */
212
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'
213
234
  /**
214
235
  * 设置导航栏额外图标,目前支持设置属性 icon,值为图标 url(以 https/http 开头)或 base64 字符串,大小建议 30*30 px
215
236
  *
@@ -340,6 +361,59 @@ declare module './index' {
340
361
  delay?: number
341
362
  }
342
363
 
364
+ interface RenderOptions {
365
+ skyline: {
366
+ /** 开启默认Block布局
367
+ * @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
368
+ * @supported weapp
369
+ */
370
+ defaultDisplayBlock?: boolean
371
+ /** 关闭 Skyline AB 实验
372
+ * @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
373
+ * @supported weapp
374
+ */
375
+ disableABTest?: boolean
376
+ /** 基础库最低版本
377
+ * @supported weapp
378
+ */
379
+ sdkVersionBegin?: string
380
+ /** 基础库最高版本
381
+ * @supported weapp
382
+ */
383
+ sdkVersionEnd?: string
384
+ /** iOS 微信最低版本
385
+ * @supported weapp
386
+ */
387
+ iosVersionBegin?: string
388
+ /** iOS 微信最高版本
389
+ * @supported weapp
390
+ */
391
+ iosVersionEnd?: string
392
+ /** 安卓微信最低版本
393
+ * @supported weapp
394
+ */
395
+ androidVersionBegin?: string
396
+ /** 安卓微信最高版本
397
+ * @supported weapp
398
+ */
399
+ androidVersionEnd?: string
400
+ [key: string]: unknown
401
+ }
402
+ }
403
+
404
+ interface Behavior {
405
+ /**
406
+ * 使用小程序默认分享功能时(即不显式设置 Page.onShareAppMessage),当设置此字段后,会使客户端生成的用于分享的 scheme 带上当前用户打开的页面所携带的 query 参数。
407
+ * @supported alipay 基础库 2.7.10 及以上开始支持,同时需使用 IDE 2.7.0 及以上版本进行构建。
408
+ */
409
+ shareAppMessage?: 'appendQuery'
410
+ /**
411
+ * 小程序在解析全局参数、页面参数时默认会对键/值做 encodeURIComponent。当设置为 disable 后,则不再对键/值做encodeURIComponent
412
+ * @supported alipay 基础库 2.7.19 及以上开始支持,同时需使用 IDE 3.0.0 及以上版本进行构建。
413
+ */
414
+ decodeQuery?: 'disable'
415
+ }
416
+
343
417
  interface AppConfig {
344
418
  /** 小程序默认启动首页,未指定 entryPagePath 时,数组的第一项代表小程序的初始页面(首页)。 */
345
419
  entryPagePath?: string
@@ -360,7 +434,11 @@ declare module './index' {
360
434
  * @default false
361
435
  * @since 2.1.0
362
436
  */
363
- functionalPages?: boolean
437
+ functionalPages?:
438
+ | boolean
439
+ | {
440
+ independent?: boolean
441
+ }
364
442
  /** 分包结构配置
365
443
  * @example
366
444
  * ```json
@@ -381,7 +459,7 @@ declare module './index' {
381
459
  * 使用 Worker 处理多线程任务时,设置 Worker 代码放置的目录
382
460
  * @since 1.9.90
383
461
  */
384
- workers?: string
462
+ workers?: string | string[]
385
463
  /** 申明需要后台运行的能力,类型为数组。目前支持以下项目:
386
464
  * - audio: 后台音乐播放
387
465
  * - location: 后台定位
@@ -548,6 +626,48 @@ declare module './index' {
548
626
  * @default "webview"
549
627
  */
550
628
  renderer?: 'webview' | 'skyline'
629
+ /**
630
+ * 渲染后端选项
631
+ * @see https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#rendererOptions
632
+ */
633
+ rendererOptions?: RenderOptions
634
+ /**
635
+ * 指定小程序使用的组件框架
636
+ * @default "exparser"
637
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/glass-easel/migration.html
638
+ */
639
+ componentFramework?: 'exparser' | 'glass-easel'
640
+ /**
641
+ * 多端模式场景接入身份管理服务时开启小程序授权页相关配置
642
+ * @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
643
+ */
644
+ miniApp?: {
645
+ /**
646
+ * 用于 wx.weixinMinProgramLogin 在小程序中插入「小程序授权 Page」
647
+ */
648
+ useAuthorizePage: boolean
649
+ }
650
+ /**
651
+ * 在 2023年9月15号之前,在 app.json 中配置 __usePrivacyCheck__: true 后,会启用隐私相关功能,如果不配置或者配置为 false 则不会启用。
652
+ * 在 2023年9月15号之后,不论 app.json 中是否有配置 __usePrivacyCheck__,隐私相关功能都会启用
653
+ * @supported weapp
654
+ */
655
+ __usePrivacyCheck__?: boolean
656
+ /**
657
+ * 正常情况下默认所有资源文件都被打包发布到所有平台,可以通过 static 字段配置特定每个目录/文件只能发布到特定的平台(多端场景)
658
+ * @see https://dev.weixin.qq.com/docs/framework/guideline/devtools/condition-compile.html#%E8%B5%84%E6%BA%90
659
+ */
660
+ static?: { pattern: string; platforms: string[] }[]
661
+ /**
662
+ * 动态插件配置规则,声明小程序需要使用动态插件
663
+ * @supported alipay
664
+ */
665
+ useDynamicPlugins?: boolean
666
+ /**
667
+ * 用于改变小程序若干运行行为
668
+ * @supported alipay
669
+ */
670
+ behavior?: Behavior
551
671
  }
552
672
 
553
673
  interface Config extends PageConfig, AppConfig {
@@ -1,112 +0,0 @@
1
- import React from 'react'
2
-
3
- import Taro from './index'
4
-
5
- declare module './index' {
6
- type MessageType = 'info' | 'success' | 'error' | 'warning'
7
-
8
- interface AtMessageOptions {
9
- message: string
10
- type?: MessageType
11
- duration?: number
12
- }
13
-
14
- interface RequestParams<T=any> extends request.Option<T, any> {
15
- [propName: string]: any
16
- }
17
-
18
- interface Current {
19
- app: AppInstance | null
20
- router: RouterInfo | null
21
- page: PageInstance | null
22
- onReady: string
23
- onHide: string
24
- onShow: string
25
- preloadData?: Record<any, any>
26
- /**
27
- * RN 私有对象navigationRef,用于使用底层接口控制路由
28
- */
29
- rnNavigationRef?: React.RefObject<any>
30
- }
31
-
32
- interface SetGlobalDataPlugin {
33
- install (app: any, data: any): void
34
- }
35
-
36
- interface TARO_ENV_TYPE {
37
- [TaroGeneral.ENV_TYPE.WEAPP]: TaroGeneral.ENV_TYPE.WEAPP
38
- [TaroGeneral.ENV_TYPE.WEB]: TaroGeneral.ENV_TYPE.WEB
39
- [TaroGeneral.ENV_TYPE.RN]: TaroGeneral.ENV_TYPE.RN
40
- [TaroGeneral.ENV_TYPE.SWAN]: TaroGeneral.ENV_TYPE.SWAN
41
- [TaroGeneral.ENV_TYPE.ALIPAY]: TaroGeneral.ENV_TYPE.ALIPAY
42
- [TaroGeneral.ENV_TYPE.TT]: TaroGeneral.ENV_TYPE.TT
43
- [TaroGeneral.ENV_TYPE.QQ]: TaroGeneral.ENV_TYPE.QQ
44
- [TaroGeneral.ENV_TYPE.JD]: TaroGeneral.ENV_TYPE.JD
45
- }
46
-
47
- interface TaroStatic {
48
- Events: {
49
- new (): TaroGeneral.Events
50
- }
51
-
52
- /** 事件中心
53
- * @supported global
54
- */
55
- eventCenter: TaroGeneral.Events
56
-
57
- ENV_TYPE: TARO_ENV_TYPE
58
-
59
- /** 获取环境变量
60
- * @supported global
61
- */
62
- getEnv(): TaroGeneral.ENV_TYPE
63
-
64
- /** 尺寸转换
65
- * @supported global
66
- */
67
- pxTransform(size: number, designWidth?: number): string
68
-
69
- /** 尺寸转换初始化
70
- * @supported global
71
- */
72
- initPxTransform(config: {
73
- baseFontSize?: number
74
- deviceRatio?: TaroGeneral.TDeviceRatio
75
- designWidth?: number
76
- targetUnit?: string
77
- unitPrecision?: number
78
- }): void
79
-
80
- /** 小程序引用插件 JS 接口
81
- * @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
82
- */
83
- requirePlugin(pluginName: string): any
84
-
85
- /** 获取当前页面实例
86
- * @supported global
87
- */
88
- getCurrentInstance(): Current
89
- Current: Current
90
-
91
- /** Vue3 插件,用于设置 `getApp()` 中的全局变量
92
- * @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
93
- * @example
94
- * ```js
95
- * // 使用插件
96
- * const App = createApp(...)
97
- * App.use(setGlobalDataPlugin, {
98
- * xxx: 999
99
- * })
100
- * // 获取全局变量
101
- * Taro.getApp().xxx
102
- * ```
103
- */
104
- setGlobalDataPlugin: SetGlobalDataPlugin
105
-
106
- /** 获取自定义 TabBar 对应的 React 或 Vue 组件实例
107
- * @supported weapp
108
- * @param page 小程序页面对象,可以通过 Taro.getCurrentInstance().page 获取
109
- */
110
- getTabBar<T>(page: Current['page']): T | undefined
111
- }
112
- }