@tarojs/taro 3.5.0-beta.1 → 3.5.0-beta.4
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 +4 -4
- package/types/api/base/weapp/app-event.d.ts +50 -11
- package/types/api/base/weapp/life-cycle.d.ts +6 -6
- package/types/compile.d.ts +9 -0
- package/types/global.d.ts +1 -1
- package/types/taro.component.d.ts +1 -6
- package/types/taro.config.d.ts +16 -0
- package/types/taro.hooks.d.ts +34 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.5.0-beta.
|
|
3
|
+
"version": "3.5.0-beta.4",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"author": "O2Team",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tarojs/api": "3.5.0-beta.
|
|
28
|
-
"@tarojs/runtime": "3.5.0-beta.
|
|
27
|
+
"@tarojs/api": "3.5.0-beta.4",
|
|
28
|
+
"@tarojs/runtime": "3.5.0-beta.4"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"@types/react": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"optional": true
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "7aca7841ed7e2af1b182ff5d24e91f44730ce783"
|
|
45
45
|
}
|
|
@@ -28,19 +28,58 @@ declare module '../../../index' {
|
|
|
28
28
|
path: string
|
|
29
29
|
/** 小程序切前台的 query 参数 */
|
|
30
30
|
query: TaroGeneral.IAnyObject
|
|
31
|
-
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
32
|
-
referrerInfo: ResultReferrerInfo
|
|
33
|
-
/** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
|
|
34
|
-
scene: number
|
|
35
31
|
/** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
|
|
36
32
|
shareTicket: string
|
|
33
|
+
/** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
|
|
34
|
+
scene: number
|
|
35
|
+
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
36
|
+
referrerInfo: ResultReferrerInfo
|
|
37
|
+
/** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
|
|
38
|
+
forwardMaterials?: ForwardMaterial[]
|
|
39
|
+
/** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型 */
|
|
40
|
+
chatType?: keyof ChatType
|
|
41
|
+
/** API 类别 */
|
|
42
|
+
apiCategory?: keyof ApiCategory
|
|
37
43
|
}
|
|
38
44
|
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
39
45
|
interface ResultReferrerInfo {
|
|
40
46
|
/** 来源小程序、公众号或 App 的 appId */
|
|
41
|
-
appId
|
|
47
|
+
appId?: string
|
|
42
48
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
43
|
-
extraData
|
|
49
|
+
extraData?: TaroGeneral.IAnyObject
|
|
50
|
+
}
|
|
51
|
+
/** ChatType 类型合法值 */
|
|
52
|
+
interface ForwardMaterial {
|
|
53
|
+
/** 文件的mimetype类型 */
|
|
54
|
+
type: string
|
|
55
|
+
/** 文件名 */
|
|
56
|
+
name: string
|
|
57
|
+
/** 文件路径(如果是webview则是url) */
|
|
58
|
+
path: string
|
|
59
|
+
/** 文件大小 */
|
|
60
|
+
size: number
|
|
61
|
+
}
|
|
62
|
+
/** ChatType 类型合法值 */
|
|
63
|
+
interface ChatType {
|
|
64
|
+
/** 微信联系人单聊 */
|
|
65
|
+
1
|
|
66
|
+
/** 企业微信联系人单聊 */
|
|
67
|
+
2
|
|
68
|
+
/** 普通微信群聊 */
|
|
69
|
+
3
|
|
70
|
+
/** 企业微信互通群聊 */
|
|
71
|
+
4
|
|
72
|
+
}
|
|
73
|
+
/** API 类别合法值 */
|
|
74
|
+
interface ApiCategory {
|
|
75
|
+
/** 默认类别 */
|
|
76
|
+
default
|
|
77
|
+
/** 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序 */
|
|
78
|
+
nativeFunctionalized
|
|
79
|
+
/** 仅浏览,朋友圈快照页等场景打开的小程序 */
|
|
80
|
+
browseOnly
|
|
81
|
+
/** 内嵌,通过打开半屏小程序能力打开的小程序 */
|
|
82
|
+
embedded
|
|
44
83
|
}
|
|
45
84
|
}
|
|
46
85
|
|
|
@@ -71,7 +110,7 @@ declare module '../../../index' {
|
|
|
71
110
|
|
|
72
111
|
interface TaroStatic {
|
|
73
112
|
/** 监听未处理的 Promise 拒绝事件。该事件与 [`App.onUnhandledRejection`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onUnhandledRejection-Object-object) 的回调时机与参数一致。
|
|
74
|
-
*
|
|
113
|
+
*
|
|
75
114
|
* **注意**
|
|
76
115
|
* - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。
|
|
77
116
|
* @supported weapp, tt
|
|
@@ -139,7 +178,7 @@ declare module '../../../index' {
|
|
|
139
178
|
* **注意**
|
|
140
179
|
*
|
|
141
180
|
* 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
|
|
142
|
-
* @supported weapp, tt
|
|
181
|
+
* @supported weapp, h5, tt
|
|
143
182
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html
|
|
144
183
|
*/
|
|
145
184
|
onAppShow(
|
|
@@ -148,7 +187,7 @@ declare module '../../../index' {
|
|
|
148
187
|
): void
|
|
149
188
|
|
|
150
189
|
/** 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。
|
|
151
|
-
* @supported weapp, tt
|
|
190
|
+
* @supported weapp, h5, tt
|
|
152
191
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html
|
|
153
192
|
*/
|
|
154
193
|
onAppHide(
|
|
@@ -206,7 +245,7 @@ declare module '../../../index' {
|
|
|
206
245
|
): void
|
|
207
246
|
|
|
208
247
|
/** 取消监听小程序切前台事件
|
|
209
|
-
* @supported weapp, tt
|
|
248
|
+
* @supported weapp, h5, tt
|
|
210
249
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html
|
|
211
250
|
*/
|
|
212
251
|
offAppShow(
|
|
@@ -215,7 +254,7 @@ declare module '../../../index' {
|
|
|
215
254
|
): void
|
|
216
255
|
|
|
217
256
|
/** 取消监听小程序切后台事件
|
|
218
|
-
* @supported weapp, tt
|
|
257
|
+
* @supported weapp, h5, tt
|
|
219
258
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html
|
|
220
259
|
*/
|
|
221
260
|
offAppHide(
|
|
@@ -21,14 +21,14 @@ declare module '../../../index' {
|
|
|
21
21
|
/** API 类别 */
|
|
22
22
|
apiCategory?: keyof LaunchOptions.ApiCategory
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
namespace LaunchOptions {
|
|
26
26
|
/** 来源信息 */
|
|
27
27
|
interface ReferrerInfo {
|
|
28
28
|
/** 来源小程序、公众号或 App 的 appId */
|
|
29
|
-
appId
|
|
29
|
+
appId?: string
|
|
30
30
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
31
|
-
extraData
|
|
31
|
+
extraData?: TaroGeneral.IAnyObject
|
|
32
32
|
}
|
|
33
33
|
/** ChatType 类型合法值 */
|
|
34
34
|
interface ForwardMaterial {
|
|
@@ -86,14 +86,14 @@ declare module '../../../index' {
|
|
|
86
86
|
/** API 类别 */
|
|
87
87
|
apiCategory?: keyof EnterOptions.ApiCategory
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
namespace EnterOptions {
|
|
91
91
|
/** 来源信息 */
|
|
92
92
|
interface ReferrerInfo {
|
|
93
93
|
/** 来源小程序、公众号或 App 的 appId */
|
|
94
|
-
appId
|
|
94
|
+
appId?: string
|
|
95
95
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
96
|
-
extraData
|
|
96
|
+
extraData?: TaroGeneral.IAnyObject
|
|
97
97
|
}
|
|
98
98
|
/** ChatType 类型合法值 */
|
|
99
99
|
interface ForwardMaterial {
|
package/types/compile.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import swc from '@swc/core'
|
|
1
2
|
export { Current } from '@tarojs/runtime'
|
|
2
3
|
import webpack from 'webpack'
|
|
3
4
|
import webpackDevServer from 'webpack-dev-server'
|
|
5
|
+
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
4
6
|
|
|
5
7
|
export const enum TEMPLATE_TYPES {
|
|
6
8
|
WEAPP = '.wxml',
|
|
@@ -195,6 +197,7 @@ export interface IH5Config {
|
|
|
195
197
|
useHtmlComponents?: boolean
|
|
196
198
|
|
|
197
199
|
postcss?: IPostcssOption
|
|
200
|
+
htmlPluginOption?: HtmlWebpackPlugin.Options
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
type FeatureItem = {
|
|
@@ -367,6 +370,11 @@ interface IPrebundle {
|
|
|
367
370
|
force?: boolean
|
|
368
371
|
include?: string[]
|
|
369
372
|
exclude?: string[]
|
|
373
|
+
esbuild?: Record<string, any>
|
|
374
|
+
swc?: swc.Config
|
|
375
|
+
webpack?: {
|
|
376
|
+
provide?: any[]
|
|
377
|
+
}
|
|
370
378
|
}
|
|
371
379
|
interface ICompiler {
|
|
372
380
|
type: CompilerTypes
|
|
@@ -402,6 +410,7 @@ export interface IProjectBaseConfig {
|
|
|
402
410
|
presets?: PluginItem[]
|
|
403
411
|
baseLevel?: number
|
|
404
412
|
framework?: string
|
|
413
|
+
frameworkExts?: string[]
|
|
405
414
|
compiler?: Compiler
|
|
406
415
|
cache?: ICache
|
|
407
416
|
logger?: ILogger
|
package/types/global.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare module './index' {
|
|
|
47
47
|
|
|
48
48
|
shareTicket: string | undefined
|
|
49
49
|
scene: number | undefined
|
|
50
|
+
exitState?: any
|
|
50
51
|
}
|
|
51
52
|
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {
|
|
52
53
|
$scope?: any
|
|
@@ -184,10 +185,4 @@ declare module './index' {
|
|
|
184
185
|
/** 页面的组件选项 */
|
|
185
186
|
options?: Record<string, unknown>
|
|
186
187
|
}
|
|
187
|
-
interface TaroStatic {
|
|
188
|
-
memo<P = {}>(
|
|
189
|
-
FunctionComponent: FunctionComponent<P>,
|
|
190
|
-
compare?: (oldProps: P, newProps: P) => boolean
|
|
191
|
-
): FunctionComponent<P>
|
|
192
|
-
}
|
|
193
188
|
}
|
package/types/taro.config.d.ts
CHANGED
|
@@ -359,6 +359,22 @@ declare module './index' {
|
|
|
359
359
|
/** 视频号直播打开的第一个页面的全屏状态使用自定义顶部,支持 */
|
|
360
360
|
firstPageNavigationStyle?: 'default' | 'custom'
|
|
361
361
|
}
|
|
362
|
+
/** 小程序调试相关配置项 */
|
|
363
|
+
debugOptions?: {
|
|
364
|
+
/** 是否开启 FPS 面板,默认false */
|
|
365
|
+
enableFPSPanel?: boolean
|
|
366
|
+
}
|
|
367
|
+
/** touch 事件监听是否为 passive,默认false */
|
|
368
|
+
enablePassiveEvent?: boolean | {
|
|
369
|
+
/** 是否设置 touchstart 事件为 passive,默认false */
|
|
370
|
+
touchstart?: boolean
|
|
371
|
+
/** 是否设置 touchmove 事件为 passive,默认false */
|
|
372
|
+
touchmove?: boolean
|
|
373
|
+
/** 是否设置 wheel 事件为 passive,默认false */
|
|
374
|
+
wheel?: boolean
|
|
375
|
+
}
|
|
376
|
+
/** 自定义模块映射规则 */
|
|
377
|
+
resolveAlias?: Record<string, string>
|
|
362
378
|
/** 接受一个数组,每一项都是字符串,来指定编译为原生小程序组件的组件入口 */
|
|
363
379
|
components?: string[]
|
|
364
380
|
/** 渲染页面的容器 id
|
package/types/taro.hooks.d.ts
CHANGED
|
@@ -52,6 +52,40 @@ declare module './index' {
|
|
|
52
52
|
*/
|
|
53
53
|
useShareTimeline(callback: () => ShareTimelineReturnObject): void
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* 页面销毁前保留状态回调
|
|
57
|
+
* **仅微信小程序支持。**
|
|
58
|
+
*/
|
|
59
|
+
useSaveExitState(callback: () => {
|
|
60
|
+
data: Record<any, any>
|
|
61
|
+
expireTimeStamp?: number
|
|
62
|
+
}): void
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 小程序初始化完成时的回调。
|
|
66
|
+
*/
|
|
67
|
+
useLaunch(callback: (options: getLaunchOptionsSync.LaunchOptions) => void): void
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 小程序发生脚本错误或 API 调用报错时触发的回调。
|
|
71
|
+
*/
|
|
72
|
+
useError(callback: (error: string) => void): void
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 小程序要打开的页面不存在时触发的回调。
|
|
76
|
+
*/
|
|
77
|
+
usePageNotFound(callback: (res: { path: string, query: Record<any, any>, isEntryPage: boolean, [key: string]: any }) => void): void
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 页面加载完成时的回调。
|
|
81
|
+
*/
|
|
82
|
+
useLoad(callback: () => void): void
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 页面卸载时的回调。
|
|
86
|
+
*/
|
|
87
|
+
useUnload(callback: () => void): void
|
|
88
|
+
|
|
55
89
|
/**
|
|
56
90
|
* 页面初次渲染完成的回调。
|
|
57
91
|
* 此时页面已经准备妥当,可以和视图层进行交互。
|