@tarojs/taro 3.5.0-beta.2 → 3.5.0-beta.3

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.5.0-beta.2",
3
+ "version": "3.5.0-beta.3",
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.2",
28
- "@tarojs/runtime": "3.5.0-beta.2"
27
+ "@tarojs/api": "3.5.0-beta.3",
28
+ "@tarojs/runtime": "3.5.0-beta.3"
29
29
  },
30
30
  "peerDependenciesMeta": {
31
31
  "@types/react": {
@@ -41,5 +41,5 @@
41
41
  "optional": true
42
42
  }
43
43
  },
44
- "gitHead": "c85adaa45959e6cafc15e6531f4735a7dfa2aab0"
44
+ "gitHead": "bd1aa21707e51500eac9b16526e4ba4171fa8e5f"
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: string
47
+ appId?: string
42
48
  /** 来源小程序传过来的数据,scene=1037或1038时支持 */
43
- extraData: TaroGeneral.IAnyObject
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: string
29
+ appId?: string
30
30
  /** 来源小程序传过来的数据,scene=1037或1038时支持 */
31
- extraData: TaroGeneral.IAnyObject
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: string
94
+ appId?: string
95
95
  /** 来源小程序传过来的数据,scene=1037或1038时支持 */
96
- extraData: TaroGeneral.IAnyObject
96
+ extraData?: TaroGeneral.IAnyObject
97
97
  }
98
98
  /** ChatType 类型合法值 */
99
99
  interface ForwardMaterial {
@@ -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 = {
@@ -368,6 +371,7 @@ interface IPrebundle {
368
371
  include?: string[]
369
372
  exclude?: string[]
370
373
  esbuild?: Record<string, any>
374
+ swc?: swc.Config
371
375
  webpack?: {
372
376
  provide?: any[]
373
377
  }
package/types/global.d.ts CHANGED
@@ -215,7 +215,7 @@ declare namespace TaroGeneral {
215
215
  * @illustrate 正常
216
216
  */
217
217
  0
218
- /** unsupport
218
+ /** nonsupport
219
219
  * @illustrate 系统或设备不支持
220
220
  */
221
221
  11000
@@ -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
@@ -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
@@ -52,6 +52,30 @@ 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
+
55
79
  /**
56
80
  * 页面加载完成时的回调。
57
81
  */