@tarojs/taro 3.4.0-beta.0 → 3.4.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 +5 -7
- package/types/api/base/weapp/app-event.d.ts +4 -4
- package/types/api/canvas/index.d.ts +22 -1
- package/types/api/device/compass.d.ts +1 -1
- package/types/api/media/image.d.ts +2 -80
- package/types/api/media/video.d.ts +291 -32
- package/types/api/network/download.d.ts +7 -1
- package/types/api/network/request.d.ts +18 -1
- package/types/api/network/upload.d.ts +7 -1
- package/types/api/ui/animation.d.ts +37 -32
- package/types/api/ui/interaction.d.ts +7 -2
- package/types/compile.d.ts +106 -110
- package/types/global.d.ts +2 -0
- package/types/index.d.ts +4 -0
- package/types/taro.component.d.ts +8 -6
- package/types/taro.config.d.ts +33 -3
- package/types/taro.extend.d.ts +18 -18
- package/types/taro.hooks.d.ts +12 -12
- package/types/taro.lifecycle.d.ts +7 -0
- package/h5.js +0 -4
|
@@ -10,6 +10,11 @@ declare module '../../index' {
|
|
|
10
10
|
/** 动画的效果 */
|
|
11
11
|
timingFunction?: keyof timingFunction
|
|
12
12
|
transformOrigin?: string
|
|
13
|
+
/**
|
|
14
|
+
* 单位
|
|
15
|
+
* @supported h5
|
|
16
|
+
*/
|
|
17
|
+
unit?: string
|
|
13
18
|
}
|
|
14
19
|
interface timingFunction {
|
|
15
20
|
/** 动画从头到尾的速度是相同的 */
|
|
@@ -31,14 +36,14 @@ declare module '../../index' {
|
|
|
31
36
|
|
|
32
37
|
interface Animation {
|
|
33
38
|
/** 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。**
|
|
34
|
-
* @supported weapp
|
|
39
|
+
* @supported weapp, h5
|
|
35
40
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html
|
|
36
41
|
*/
|
|
37
42
|
export(): {
|
|
38
43
|
actions: TaroGeneral.IAnyObject[]
|
|
39
44
|
}
|
|
40
45
|
/** 设置背景色
|
|
41
|
-
* @supported weapp
|
|
46
|
+
* @supported weapp, h5
|
|
42
47
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html
|
|
43
48
|
*/
|
|
44
49
|
backgroundColor(
|
|
@@ -46,7 +51,7 @@ declare module '../../index' {
|
|
|
46
51
|
value: string,
|
|
47
52
|
): Animation
|
|
48
53
|
/** 设置 bottom 值
|
|
49
|
-
* @supported weapp
|
|
54
|
+
* @supported weapp, h5
|
|
50
55
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.bottom.html
|
|
51
56
|
*/
|
|
52
57
|
bottom(
|
|
@@ -54,7 +59,7 @@ declare module '../../index' {
|
|
|
54
59
|
value: number | string,
|
|
55
60
|
): Animation
|
|
56
61
|
/** 设置高度
|
|
57
|
-
* @supported weapp
|
|
62
|
+
* @supported weapp, h5
|
|
58
63
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.height.html
|
|
59
64
|
*/
|
|
60
65
|
height(
|
|
@@ -62,7 +67,7 @@ declare module '../../index' {
|
|
|
62
67
|
value: number | string,
|
|
63
68
|
): Animation
|
|
64
69
|
/** 设置 left 值
|
|
65
|
-
* @supported weapp
|
|
70
|
+
* @supported weapp, h5
|
|
66
71
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.left.html
|
|
67
72
|
*/
|
|
68
73
|
left(
|
|
@@ -70,17 +75,17 @@ declare module '../../index' {
|
|
|
70
75
|
value: number | string,
|
|
71
76
|
): Animation
|
|
72
77
|
/** 同 [transform-function matrix](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix)
|
|
73
|
-
* @supported weapp
|
|
78
|
+
* @supported weapp, h5
|
|
74
79
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix.html
|
|
75
80
|
*/
|
|
76
|
-
matrix(): Animation
|
|
81
|
+
matrix(a: number, b: number, c: number, d: number, tx: number, ty: number): Animation
|
|
77
82
|
/** 同 [transform-function matrix3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d)
|
|
78
83
|
* @supported weapp
|
|
79
84
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix3d.html
|
|
80
85
|
*/
|
|
81
|
-
matrix3d(): Animation
|
|
86
|
+
matrix3d(a1: number, b1: number, c1: number, d1: number, a2: number, b2: number, c2: number, d2: number, a3: number, b3: number, c3: number, d3: number, a4: number, b4: number, c4: number, d4: number): Animation
|
|
82
87
|
/** 设置透明度
|
|
83
|
-
* @supported weapp
|
|
88
|
+
* @supported weapp, h5
|
|
84
89
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.opacity.html
|
|
85
90
|
*/
|
|
86
91
|
opacity(
|
|
@@ -88,7 +93,7 @@ declare module '../../index' {
|
|
|
88
93
|
value: number,
|
|
89
94
|
): Animation
|
|
90
95
|
/** 设置 right 值
|
|
91
|
-
* @supported weapp
|
|
96
|
+
* @supported weapp, h5
|
|
92
97
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.right.html
|
|
93
98
|
*/
|
|
94
99
|
right(
|
|
@@ -96,7 +101,7 @@ declare module '../../index' {
|
|
|
96
101
|
value: number | string,
|
|
97
102
|
): Animation
|
|
98
103
|
/** 从原点顺时针旋转一个角度
|
|
99
|
-
* @supported weapp
|
|
104
|
+
* @supported weapp, h5
|
|
100
105
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate.html
|
|
101
106
|
*/
|
|
102
107
|
rotate(
|
|
@@ -104,21 +109,21 @@ declare module '../../index' {
|
|
|
104
109
|
angle: number,
|
|
105
110
|
): Animation
|
|
106
111
|
/** 从 固定 轴顺时针旋转一个角度
|
|
107
|
-
* @supported weapp
|
|
112
|
+
* @supported weapp, h5
|
|
108
113
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate3d.html
|
|
109
114
|
*/
|
|
110
115
|
rotate3d(
|
|
111
116
|
/** 旋转轴的 x 坐标 */
|
|
112
117
|
x: number,
|
|
113
118
|
/** 旋转轴的 y 坐标 */
|
|
114
|
-
y
|
|
119
|
+
y?: number,
|
|
115
120
|
/** 旋转轴的 z 坐标 */
|
|
116
|
-
z
|
|
121
|
+
z?: number,
|
|
117
122
|
/** 旋转的角度。范围 [-180, 180] */
|
|
118
|
-
|
|
123
|
+
angle?: number,
|
|
119
124
|
): Animation
|
|
120
125
|
/** 从 X 轴顺时针旋转一个角度
|
|
121
|
-
* @supported weapp
|
|
126
|
+
* @supported weapp, h5
|
|
122
127
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateX.html
|
|
123
128
|
*/
|
|
124
129
|
rotateX(
|
|
@@ -126,7 +131,7 @@ declare module '../../index' {
|
|
|
126
131
|
angle: number,
|
|
127
132
|
): Animation
|
|
128
133
|
/** 从 Y 轴顺时针旋转一个角度
|
|
129
|
-
* @supported weapp
|
|
134
|
+
* @supported weapp, h5
|
|
130
135
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateY.html
|
|
131
136
|
*/
|
|
132
137
|
rotateY(
|
|
@@ -134,7 +139,7 @@ declare module '../../index' {
|
|
|
134
139
|
angle: number,
|
|
135
140
|
): Animation
|
|
136
141
|
/** 从 Z 轴顺时针旋转一个角度
|
|
137
|
-
* @supported weapp
|
|
142
|
+
* @supported weapp, h5
|
|
138
143
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateZ.html
|
|
139
144
|
*/
|
|
140
145
|
rotateZ(
|
|
@@ -142,7 +147,7 @@ declare module '../../index' {
|
|
|
142
147
|
angle: number,
|
|
143
148
|
): Animation
|
|
144
149
|
/** 缩放
|
|
145
|
-
* @supported weapp
|
|
150
|
+
* @supported weapp, h5
|
|
146
151
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale.html
|
|
147
152
|
*/
|
|
148
153
|
scale(
|
|
@@ -152,7 +157,7 @@ declare module '../../index' {
|
|
|
152
157
|
sy?: number,
|
|
153
158
|
): Animation
|
|
154
159
|
/** 缩放
|
|
155
|
-
* @supported weapp
|
|
160
|
+
* @supported weapp, h5
|
|
156
161
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale3d.html
|
|
157
162
|
*/
|
|
158
163
|
scale3d(
|
|
@@ -164,7 +169,7 @@ declare module '../../index' {
|
|
|
164
169
|
sz: number,
|
|
165
170
|
): Animation
|
|
166
171
|
/** 缩放 X 轴
|
|
167
|
-
* @supported weapp
|
|
172
|
+
* @supported weapp, h5
|
|
168
173
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleX.html
|
|
169
174
|
*/
|
|
170
175
|
scaleX(
|
|
@@ -172,7 +177,7 @@ declare module '../../index' {
|
|
|
172
177
|
scale: number,
|
|
173
178
|
): Animation
|
|
174
179
|
/** 缩放 Y 轴
|
|
175
|
-
* @supported weapp
|
|
180
|
+
* @supported weapp, h5
|
|
176
181
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleY.html
|
|
177
182
|
*/
|
|
178
183
|
scaleY(
|
|
@@ -180,7 +185,7 @@ declare module '../../index' {
|
|
|
180
185
|
scale: number,
|
|
181
186
|
): Animation
|
|
182
187
|
/** 缩放 Z 轴
|
|
183
|
-
* @supported weapp
|
|
188
|
+
* @supported weapp, h5
|
|
184
189
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleZ.html
|
|
185
190
|
*/
|
|
186
191
|
scaleZ(
|
|
@@ -198,7 +203,7 @@ declare module '../../index' {
|
|
|
198
203
|
ay: number,
|
|
199
204
|
): Animation
|
|
200
205
|
/** 对 X 轴坐标进行倾斜
|
|
201
|
-
* @supported weapp
|
|
206
|
+
* @supported weapp, h5
|
|
202
207
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewX.html
|
|
203
208
|
*/
|
|
204
209
|
skewX(
|
|
@@ -214,12 +219,12 @@ declare module '../../index' {
|
|
|
214
219
|
angle: number,
|
|
215
220
|
): Animation
|
|
216
221
|
/** 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。
|
|
217
|
-
* @supported weapp
|
|
222
|
+
* @supported weapp, h5
|
|
218
223
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.step.html
|
|
219
224
|
*/
|
|
220
225
|
step(option?: Animation.StepOption): Animation
|
|
221
226
|
/** 设置 top 值
|
|
222
|
-
* @supported weapp
|
|
227
|
+
* @supported weapp, h5
|
|
223
228
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.top.html
|
|
224
229
|
*/
|
|
225
230
|
top(
|
|
@@ -227,7 +232,7 @@ declare module '../../index' {
|
|
|
227
232
|
value: number | string,
|
|
228
233
|
): Animation
|
|
229
234
|
/** 平移变换
|
|
230
|
-
* @supported weapp
|
|
235
|
+
* @supported weapp, h5
|
|
231
236
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate.html
|
|
232
237
|
*/
|
|
233
238
|
translate(
|
|
@@ -237,7 +242,7 @@ declare module '../../index' {
|
|
|
237
242
|
ty?: number,
|
|
238
243
|
): Animation
|
|
239
244
|
/** 对 xyz 坐标进行平移变换
|
|
240
|
-
* @supported weapp
|
|
245
|
+
* @supported weapp, h5
|
|
241
246
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate3d.html
|
|
242
247
|
*/
|
|
243
248
|
translate3d(
|
|
@@ -249,7 +254,7 @@ declare module '../../index' {
|
|
|
249
254
|
tz?: number,
|
|
250
255
|
): Animation
|
|
251
256
|
/** 对 X 轴平移
|
|
252
|
-
* @supported weapp
|
|
257
|
+
* @supported weapp, h5
|
|
253
258
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateX.html
|
|
254
259
|
*/
|
|
255
260
|
translateX(
|
|
@@ -257,7 +262,7 @@ declare module '../../index' {
|
|
|
257
262
|
translation: number,
|
|
258
263
|
): Animation
|
|
259
264
|
/** 对 Y 轴平移
|
|
260
|
-
* @supported weapp
|
|
265
|
+
* @supported weapp, h5
|
|
261
266
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateY.html
|
|
262
267
|
*/
|
|
263
268
|
translateY(
|
|
@@ -265,7 +270,7 @@ declare module '../../index' {
|
|
|
265
270
|
translation: number,
|
|
266
271
|
): Animation
|
|
267
272
|
/** 对 Z 轴平移
|
|
268
|
-
* @supported weapp
|
|
273
|
+
* @supported weapp, h5
|
|
269
274
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateZ.html
|
|
270
275
|
*/
|
|
271
276
|
translateZ(
|
|
@@ -273,7 +278,7 @@ declare module '../../index' {
|
|
|
273
278
|
translation: number,
|
|
274
279
|
): Animation
|
|
275
280
|
/** 设置宽度
|
|
276
|
-
* @supported weapp
|
|
281
|
+
* @supported weapp, h5
|
|
277
282
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.width.html
|
|
278
283
|
*/
|
|
279
284
|
width(
|
|
@@ -15,9 +15,10 @@ declare module '../../index' {
|
|
|
15
15
|
*
|
|
16
16
|
* 可选值:
|
|
17
17
|
* - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;
|
|
18
|
+
* - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;
|
|
18
19
|
* - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;
|
|
19
20
|
* - 'none': 不显示图标,此时 title 文本最多可显示两行 */
|
|
20
|
-
icon?: 'success' | 'loading' | 'none'
|
|
21
|
+
icon?: 'success' | 'error' | 'loading' | 'none'
|
|
21
22
|
/** 自定义图标的本地路径,image 的优先级高于 icon */
|
|
22
23
|
image?: string
|
|
23
24
|
/** 是否显示透明蒙层,防止触摸穿透 */
|
|
@@ -78,6 +79,8 @@ declare module '../../index' {
|
|
|
78
79
|
|
|
79
80
|
namespace showActionSheet {
|
|
80
81
|
interface Option {
|
|
82
|
+
/** 警示文案 */
|
|
83
|
+
alertText?: string
|
|
81
84
|
/** 按钮的文字数组,数组长度最大为 6 */
|
|
82
85
|
itemList: string[]
|
|
83
86
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -121,6 +124,8 @@ declare module '../../index' {
|
|
|
121
124
|
|
|
122
125
|
namespace enableAlertBeforeUnload {
|
|
123
126
|
interface Option {
|
|
127
|
+
/** 询问对话框内容 */
|
|
128
|
+
message: string
|
|
124
129
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
125
130
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
126
131
|
/** 接口调用失败的回调函数 */
|
|
@@ -257,7 +262,7 @@ declare module '../../index' {
|
|
|
257
262
|
* ```
|
|
258
263
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.enableAlertBeforeUnload.html
|
|
259
264
|
*/
|
|
260
|
-
enableAlertBeforeUnload(option
|
|
265
|
+
enableAlertBeforeUnload(option: enableAlertBeforeUnload.Option): void
|
|
261
266
|
|
|
262
267
|
/** 关闭小程序页面返回询问对话框
|
|
263
268
|
* @supported weapp
|
package/types/compile.d.ts
CHANGED
|
@@ -53,12 +53,12 @@ export type IOption = Record<string, any>
|
|
|
53
53
|
|
|
54
54
|
export interface ICopyOptions {
|
|
55
55
|
patterns: {
|
|
56
|
-
from: string
|
|
57
|
-
to: string
|
|
58
|
-
ignore?: string[]
|
|
59
|
-
transform?: Function
|
|
56
|
+
from: string
|
|
57
|
+
to: string
|
|
58
|
+
ignore?: string[]
|
|
59
|
+
transform?: Function
|
|
60
60
|
watch?: boolean
|
|
61
|
-
}[]
|
|
61
|
+
}[]
|
|
62
62
|
options: {
|
|
63
63
|
ignore?: string[]
|
|
64
64
|
}
|
|
@@ -68,11 +68,11 @@ export interface ISassOptions {
|
|
|
68
68
|
/**
|
|
69
69
|
* 引入的全局 sass 文件,如果要引入多个文件,支持数组形式传入
|
|
70
70
|
*/
|
|
71
|
-
resource?: string | string[]
|
|
71
|
+
resource?: string | string[]
|
|
72
72
|
/**
|
|
73
73
|
* 项目根目录的绝对地址(若为小程序云开发模板,则应该是client目录)
|
|
74
74
|
*/
|
|
75
|
-
projectDirectory?: string
|
|
75
|
+
projectDirectory?: string
|
|
76
76
|
/**
|
|
77
77
|
* 全局 scss 变量,若 data 与 resource 中设置了同样的变量,则 data 的优先级高于 resource
|
|
78
78
|
*/
|
|
@@ -89,21 +89,21 @@ export namespace PostcssOption {
|
|
|
89
89
|
generateScopedName: string | ((localName: string, absoluteFilePath: string) => string)
|
|
90
90
|
}>
|
|
91
91
|
export type url = TogglableOptions<{
|
|
92
|
-
limit: number
|
|
92
|
+
limit: number
|
|
93
93
|
basePath?: string | string[]
|
|
94
94
|
}>
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export interface IPostcssOption {
|
|
98
|
-
autoprefixer?: TogglableOptions
|
|
99
|
-
pxtransform?: TogglableOptions
|
|
100
|
-
cssModules?: PostcssOption.cssModules
|
|
101
|
-
url?: PostcssOption.url
|
|
98
|
+
autoprefixer?: TogglableOptions
|
|
99
|
+
pxtransform?: TogglableOptions
|
|
100
|
+
cssModules?: PostcssOption.cssModules
|
|
101
|
+
url?: PostcssOption.url
|
|
102
102
|
[key: string]: any
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export interface ICompileOption {
|
|
106
|
-
exclude?: string[]
|
|
106
|
+
exclude?: string[]
|
|
107
107
|
include?: string[]
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -113,85 +113,85 @@ interface Runtime {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export interface IMiniAppConfig {
|
|
116
|
-
appOutput?: boolean
|
|
117
|
-
enableSourceMap?: boolean
|
|
118
|
-
sourceMapType?: string
|
|
119
|
-
debugReact?: boolean
|
|
116
|
+
appOutput?: boolean
|
|
117
|
+
enableSourceMap?: boolean
|
|
118
|
+
sourceMapType?: string
|
|
119
|
+
debugReact?: boolean
|
|
120
120
|
minifyXML?: {
|
|
121
121
|
collapseWhitespace?: boolean
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
webpackChain?: (chain: any, webpack: any, PARSE_AST_TYPE: any) => void
|
|
125
|
-
entry?: webpack.Entry
|
|
126
|
-
output?: webpack.Output
|
|
127
|
-
postcss?: IPostcssOption
|
|
128
|
-
cssLoaderOption?: IOption
|
|
129
|
-
sassLoaderOption?: IOption
|
|
130
|
-
lessLoaderOption?: IOption
|
|
131
|
-
stylusLoaderOption?: IOption
|
|
132
|
-
mediaUrlLoaderOption?: IOption
|
|
133
|
-
fontUrlLoaderOption?: IOption
|
|
134
|
-
imageUrlLoaderOption?: IOption
|
|
135
|
-
miniCssExtractPluginOption?: IOption
|
|
136
|
-
|
|
137
|
-
customFilesTypes?: IMINI_APP_FILE_TYPE
|
|
138
|
-
commonChunks?: string[] | ((commonChunks: string[]) => string[])
|
|
139
|
-
addChunkPages?: ((pages: Map<string, string[]>, pagesNames?: string[]) => void)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
webpackChain?: (chain: any, webpack: any, PARSE_AST_TYPE: any) => void
|
|
125
|
+
entry?: webpack.Entry
|
|
126
|
+
output?: webpack.Output
|
|
127
|
+
postcss?: IPostcssOption
|
|
128
|
+
cssLoaderOption?: IOption
|
|
129
|
+
sassLoaderOption?: IOption
|
|
130
|
+
lessLoaderOption?: IOption
|
|
131
|
+
stylusLoaderOption?: IOption
|
|
132
|
+
mediaUrlLoaderOption?: IOption
|
|
133
|
+
fontUrlLoaderOption?: IOption
|
|
134
|
+
imageUrlLoaderOption?: IOption
|
|
135
|
+
miniCssExtractPluginOption?: IOption
|
|
136
|
+
|
|
137
|
+
customFilesTypes?: IMINI_APP_FILE_TYPE
|
|
138
|
+
commonChunks?: string[] | ((commonChunks: string[]) => string[])
|
|
139
|
+
addChunkPages?: ((pages: Map<string, string[]>, pagesNames?: string[]) => void)
|
|
140
140
|
optimizeMainPackage?: {
|
|
141
|
-
enable?: boolean
|
|
141
|
+
enable?: boolean
|
|
142
142
|
exclude?: any[]
|
|
143
|
-
}
|
|
143
|
+
}
|
|
144
144
|
|
|
145
145
|
compile?: {
|
|
146
|
-
exclude?: any[]
|
|
146
|
+
exclude?: any[]
|
|
147
147
|
include?: any[]
|
|
148
148
|
}
|
|
149
149
|
runtime?: Runtime
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
export type TogglableOptions<T = IOption> = {
|
|
153
|
-
enable?: boolean
|
|
153
|
+
enable?: boolean
|
|
154
154
|
config?: T
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
export interface IH5RouterConfig {
|
|
158
|
-
mode?: 'hash' | 'browser' | 'multi'
|
|
159
|
-
customRoutes?: IOption
|
|
160
|
-
basename?: string
|
|
161
|
-
lazyload?: boolean | ((pagename: string) => boolean)
|
|
158
|
+
mode?: 'hash' | 'browser' | 'multi'
|
|
159
|
+
customRoutes?: IOption
|
|
160
|
+
basename?: string
|
|
161
|
+
lazyload?: boolean | ((pagename: string) => boolean)
|
|
162
162
|
renamePagename?: (pagename: string) => string
|
|
163
163
|
forcePath?: string
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
export interface IH5Config {
|
|
167
|
-
publicPath?: string
|
|
168
|
-
staticDirectory?: string
|
|
169
|
-
chunkDirectory?: string
|
|
167
|
+
publicPath?: string
|
|
168
|
+
staticDirectory?: string
|
|
169
|
+
chunkDirectory?: string
|
|
170
170
|
|
|
171
171
|
webpack?: ((webpackConfig: webpack.Configuration, webpack) => webpack.Configuration) | webpack.Configuration
|
|
172
172
|
|
|
173
|
-
webpackChain?: (chain: any, webpack: any) => void
|
|
174
|
-
|
|
175
|
-
entry?: webpack.Entry
|
|
176
|
-
output?: webpack.Output
|
|
177
|
-
router?: IH5RouterConfig
|
|
178
|
-
devServer?: webpackDevServer.Configuration
|
|
179
|
-
enableSourceMap?: boolean
|
|
180
|
-
sourceMapType?: 'none' | 'eval' | 'cheap-eval-source-map' | 'cheap-module-eval-source-map' | 'eval-source-map' | 'cheap-source-map' | 'cheap-module-source-map' | 'inline-cheap-source-map' | 'inline-cheap-module-source-map' | 'source-map' | 'inline-source-map' | 'hidden-source-map' | 'nosources-source-map'
|
|
181
|
-
enableExtract?: boolean
|
|
182
|
-
transformOnly?: boolean
|
|
183
|
-
|
|
184
|
-
cssLoaderOption?: IOption
|
|
185
|
-
styleLoaderOption?: IOption
|
|
186
|
-
sassLoaderOption?: IOption
|
|
187
|
-
lessLoaderOption?: IOption
|
|
188
|
-
stylusLoaderOption?: IOption
|
|
189
|
-
mediaUrlLoaderOption?: IOption
|
|
190
|
-
fontUrlLoaderOption?: IOption
|
|
191
|
-
imageUrlLoaderOption?: IOption
|
|
192
|
-
miniCssExtractPluginOption?: IOption
|
|
193
|
-
esnextModules?: string[]
|
|
194
|
-
useHtmlComponents?: boolean
|
|
173
|
+
webpackChain?: (chain: any, webpack: any) => void
|
|
174
|
+
|
|
175
|
+
entry?: webpack.Entry
|
|
176
|
+
output?: webpack.Output
|
|
177
|
+
router?: IH5RouterConfig
|
|
178
|
+
devServer?: webpackDevServer.Configuration
|
|
179
|
+
enableSourceMap?: boolean
|
|
180
|
+
sourceMapType?: 'none' | 'eval' | 'cheap-eval-source-map' | 'cheap-module-eval-source-map' | 'eval-source-map' | 'cheap-source-map' | 'cheap-module-source-map' | 'inline-cheap-source-map' | 'inline-cheap-module-source-map' | 'source-map' | 'inline-source-map' | 'hidden-source-map' | 'nosources-source-map'
|
|
181
|
+
enableExtract?: boolean
|
|
182
|
+
transformOnly?: boolean
|
|
183
|
+
|
|
184
|
+
cssLoaderOption?: IOption
|
|
185
|
+
styleLoaderOption?: IOption
|
|
186
|
+
sassLoaderOption?: IOption
|
|
187
|
+
lessLoaderOption?: IOption
|
|
188
|
+
stylusLoaderOption?: IOption
|
|
189
|
+
mediaUrlLoaderOption?: IOption
|
|
190
|
+
fontUrlLoaderOption?: IOption
|
|
191
|
+
imageUrlLoaderOption?: IOption
|
|
192
|
+
miniCssExtractPluginOption?: IOption
|
|
193
|
+
esnextModules?: string[]
|
|
194
|
+
useHtmlComponents?: boolean
|
|
195
195
|
|
|
196
196
|
postcss?: IPostcssOption
|
|
197
197
|
}
|
|
@@ -209,19 +209,15 @@ declare enum LogLevel {
|
|
|
209
209
|
DEBUG = 'debug'
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
export interface IDeviceRatio {
|
|
213
|
-
[key: string]: number
|
|
214
|
-
}
|
|
215
|
-
|
|
216
212
|
export type SystemConfig = {
|
|
217
213
|
/**
|
|
218
214
|
* 打印日志等级,分为 off,error,warn,info,log,debug
|
|
219
215
|
*/
|
|
220
|
-
logLevel?: LogLevel
|
|
216
|
+
logLevel?: LogLevel
|
|
221
217
|
/**
|
|
222
218
|
* 页面设计基准宽度,根据实际设备宽度来缩放元素大小
|
|
223
219
|
*/
|
|
224
|
-
designWidth?: number
|
|
220
|
+
designWidth?: number
|
|
225
221
|
/**
|
|
226
222
|
* 全局数据对象,属性名不能以$或_开头,在页面中可通过 this 进行访问;如果全局数据属性与页面的数据属性重名,则页面初始化时,全局数据会覆盖页面中对应的属性值
|
|
227
223
|
*/
|
|
@@ -232,7 +228,7 @@ type RouterConfig = {
|
|
|
232
228
|
/**
|
|
233
229
|
* 首页名称
|
|
234
230
|
*/
|
|
235
|
-
entry: string
|
|
231
|
+
entry: string
|
|
236
232
|
/**
|
|
237
233
|
* 页面配置列表,key 值为页面名称(对应页面目录名,例如 Hello 对应'Hello'目录),value 为页面详细配置 page
|
|
238
234
|
*/
|
|
@@ -242,14 +238,14 @@ type RouterPage = {
|
|
|
242
238
|
/**
|
|
243
239
|
* 页面对应的组件名,与 ux 文件名保持一致,例如'hello' 对应 'hello.ux'
|
|
244
240
|
*/
|
|
245
|
-
component: string
|
|
241
|
+
component: string
|
|
246
242
|
/**
|
|
247
243
|
* 页面路径,例如“/user”,不填则默认为/<页面名称>。
|
|
248
244
|
* path 必须唯一,不能和其他 page 的 path 相同。
|
|
249
245
|
* 下面 page 的 path 因为缺失,会被设置为“/Index”:
|
|
250
246
|
* "Index": {"component": "index"}
|
|
251
247
|
*/
|
|
252
|
-
path?: string
|
|
248
|
+
path?: string
|
|
253
249
|
/**
|
|
254
250
|
* 声明页面可以处理某种请求
|
|
255
251
|
*/
|
|
@@ -264,31 +260,31 @@ interface IDefaultDisplayConfig {
|
|
|
264
260
|
/**
|
|
265
261
|
* 窗口背景颜色
|
|
266
262
|
*/
|
|
267
|
-
backgroundColor?: string
|
|
263
|
+
backgroundColor?: string
|
|
268
264
|
/**
|
|
269
265
|
* 是否是全屏模式,默认不会同时作用于 titleBar,titleBar 需要继续通过 titleBar 控制
|
|
270
266
|
*/
|
|
271
|
-
fullScreen?: boolean
|
|
267
|
+
fullScreen?: boolean
|
|
272
268
|
/**
|
|
273
269
|
* 是否显示 titleBar
|
|
274
270
|
*/
|
|
275
|
-
titleBar?: boolean
|
|
271
|
+
titleBar?: boolean
|
|
276
272
|
/**
|
|
277
273
|
* 标题栏背景色
|
|
278
274
|
*/
|
|
279
|
-
titleBarBackgroundColor?: string
|
|
275
|
+
titleBarBackgroundColor?: string
|
|
280
276
|
/**
|
|
281
277
|
* 标题栏文字颜色
|
|
282
278
|
*/
|
|
283
|
-
titleBarTextColor?: string
|
|
279
|
+
titleBarTextColor?: string
|
|
284
280
|
/**
|
|
285
281
|
* 标题栏文字(也可通过页面跳转传递参数(titleBarText)设置)
|
|
286
282
|
*/
|
|
287
|
-
titleBarText?: string
|
|
283
|
+
titleBarText?: string
|
|
288
284
|
/**
|
|
289
285
|
* 是否显示标题栏右上角菜单按钮,点击菜单按钮调用页面生命周期 onMenuPress 方法,如果该方法未实现则显示系统默认菜单
|
|
290
286
|
*/
|
|
291
|
-
menu?: boolean
|
|
287
|
+
menu?: boolean
|
|
292
288
|
/**
|
|
293
289
|
* 软键盘弹出时为保证输入框可见,页面的调整方式。 adjustPan:上移页面; adjustResize:压缩页面显示区域,当页面全屏时,此设置不生效
|
|
294
290
|
*/
|
|
@@ -308,31 +304,31 @@ export interface ITaroManifestConfig {
|
|
|
308
304
|
/**
|
|
309
305
|
* 应用包名,确认与原生应用的包名不一致,推荐采用 com.company.module 的格式,如:com.example.demo
|
|
310
306
|
*/
|
|
311
|
-
package: string
|
|
307
|
+
package: string
|
|
312
308
|
/**
|
|
313
309
|
* 应用名称,6 个汉字以内,与应用商店保存的名称一致,用于在桌面图标、弹窗等处显示应用名称
|
|
314
310
|
*/
|
|
315
|
-
name: string
|
|
311
|
+
name: string
|
|
316
312
|
/**
|
|
317
313
|
* 应用图标,提供 192x192 大小的即可
|
|
318
314
|
*/
|
|
319
|
-
icon: string
|
|
315
|
+
icon: string
|
|
320
316
|
/**
|
|
321
317
|
* 应用版本名称,如:"1.0"
|
|
322
318
|
*/
|
|
323
|
-
versionName?: string
|
|
319
|
+
versionName?: string
|
|
324
320
|
/**
|
|
325
321
|
* 应用版本号,从1自增,推荐每次重新上传包时versionCode+1
|
|
326
322
|
*/
|
|
327
|
-
versionCode: number
|
|
323
|
+
versionCode: number
|
|
328
324
|
/**
|
|
329
325
|
* 支持的最小平台版本号,兼容性检查,避免上线后在低版本平台运行并导致不兼容;如果不填按照内测版本处理
|
|
330
326
|
*/
|
|
331
|
-
minPlatformVersion?: string
|
|
327
|
+
minPlatformVersion?: string
|
|
332
328
|
/**
|
|
333
329
|
* 接口列表,绝大部分接口都需要在这里声明,否则不能调用,详见每个接口的文档说明
|
|
334
330
|
*/
|
|
335
|
-
features?: FeatureItem[]
|
|
331
|
+
features?: FeatureItem[]
|
|
336
332
|
/**
|
|
337
333
|
*
|
|
338
334
|
*/
|
|
@@ -343,11 +339,11 @@ export interface IManifestConfig extends ITaroManifestConfig {
|
|
|
343
339
|
/**
|
|
344
340
|
* 系统配置信息
|
|
345
341
|
*/
|
|
346
|
-
config: SystemConfig
|
|
342
|
+
config: SystemConfig
|
|
347
343
|
/**
|
|
348
344
|
* 路由信息
|
|
349
345
|
*/
|
|
350
|
-
router: RouterConfig
|
|
346
|
+
router: RouterConfig
|
|
351
347
|
/**
|
|
352
348
|
* UI 显示相关配置
|
|
353
349
|
*/
|
|
@@ -357,24 +353,24 @@ export interface IManifestConfig extends ITaroManifestConfig {
|
|
|
357
353
|
export type PluginItem = string | [string, object]
|
|
358
354
|
|
|
359
355
|
export interface IProjectBaseConfig {
|
|
360
|
-
projectName?: string
|
|
361
|
-
date?: string
|
|
362
|
-
designWidth?: number
|
|
363
|
-
watcher?: any[]
|
|
364
|
-
deviceRatio?:
|
|
365
|
-
sourceRoot?: string
|
|
366
|
-
outputRoot?: string
|
|
367
|
-
env?: IOption
|
|
368
|
-
alias?: IOption
|
|
369
|
-
defineConstants?: IOption
|
|
370
|
-
copy?: ICopyOptions
|
|
371
|
-
csso?: TogglableOptions
|
|
372
|
-
terser?: TogglableOptions
|
|
373
|
-
uglify?: TogglableOptions
|
|
374
|
-
sass?: ISassOptions
|
|
375
|
-
plugins?: PluginItem[]
|
|
356
|
+
projectName?: string
|
|
357
|
+
date?: string
|
|
358
|
+
designWidth?: number
|
|
359
|
+
watcher?: any[]
|
|
360
|
+
deviceRatio?: TaroGeneral.TDeviceRatio
|
|
361
|
+
sourceRoot?: string
|
|
362
|
+
outputRoot?: string
|
|
363
|
+
env?: IOption
|
|
364
|
+
alias?: IOption
|
|
365
|
+
defineConstants?: IOption
|
|
366
|
+
copy?: ICopyOptions
|
|
367
|
+
csso?: TogglableOptions
|
|
368
|
+
terser?: TogglableOptions
|
|
369
|
+
uglify?: TogglableOptions
|
|
370
|
+
sass?: ISassOptions
|
|
371
|
+
plugins?: PluginItem[]
|
|
376
372
|
presets?: PluginItem[]
|
|
377
|
-
baseLevel?: number
|
|
373
|
+
baseLevel?: number
|
|
378
374
|
framework?: string
|
|
379
375
|
}
|
|
380
376
|
|