@tarojs/taro 3.4.0-beta.2 → 3.4.2
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/ai/face.d.ts +133 -0
- package/types/api/ai/visionkit.d.ts +303 -0
- package/types/api/base/crypto.d.ts +90 -0
- package/types/api/base/debug.d.ts +152 -13
- package/types/api/base/env.d.ts +2 -1
- package/types/api/base/index.d.ts +10 -2
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +539 -101
- package/types/api/base/update.d.ts +59 -7
- package/types/api/base/weapp/app-event.d.ts +49 -26
- package/types/api/base/weapp/life-cycle.d.ts +141 -1
- package/types/api/canvas/index.d.ts +171 -136
- package/types/api/cloud/index.d.ts +2 -2
- package/types/api/device/accelerometer.d.ts +3 -3
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +67 -2
- package/types/api/device/calendar.d.ts +88 -0
- package/types/api/device/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +5 -5
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +0 -0
- package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +53 -12
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +40 -12
- package/types/api/device/wifi.d.ts +41 -6
- package/types/api/files/index.d.ts +371 -184
- package/types/api/location/index.d.ts +116 -55
- package/types/api/media/audio.d.ts +653 -60
- package/types/api/media/background-audio.d.ts +47 -41
- package/types/api/media/camera.d.ts +38 -19
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +54 -105
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +469 -49
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +20 -20
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +11 -7
- package/types/api/media/video.d.ts +327 -39
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -27
- package/types/api/network/download.d.ts +39 -16
- package/types/api/network/request.d.ts +143 -38
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +154 -83
- package/types/api/network/upload.d.ts +41 -25
- package/types/api/network/websocket.d.ts +16 -15
- package/types/api/open-api/authorize.d.ts +41 -2
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/customer-service.d.ts +1 -1
- package/types/api/open-api/facial.d.ts +3 -0
- package/types/api/open-api/favorites.d.ts +100 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +2 -2
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +21 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +76 -14
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +88 -3
- package/types/api/open-api/user-info.d.ts +55 -18
- package/types/api/open-api/werun.d.ts +33 -6
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/route/index.d.ts +13 -9
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +29 -83
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +84 -70
- package/types/api/ui/background.d.ts +4 -2
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +27 -31
- package/types/api/ui/navigation-bar.d.ts +1 -0
- package/types/api/ui/scroll.d.ts +73 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +7 -7
- package/types/api/ui/window.d.ts +22 -2
- package/types/api/worker/index.d.ts +9 -1
- package/types/api/wxml/index.d.ts +143 -105
- package/types/compile.d.ts +111 -106
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/taro.component.d.ts +82 -60
- package/types/taro.config.d.ts +174 -170
- package/types/taro.extend.d.ts +0 -17
- package/types/taro.hooks.d.ts +12 -12
- package/types/taro.lifecycle.d.ts +7 -0
- package/h5.js +0 -4
- package/types/api/open-api/payment.d.ts +0 -61
|
@@ -18,10 +18,12 @@ declare module '../../index' {
|
|
|
18
18
|
*/
|
|
19
19
|
interface IntersectionObserver {
|
|
20
20
|
/** 停止监听。回调函数将不再触发
|
|
21
|
+
* @supported weapp
|
|
21
22
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html
|
|
22
23
|
*/
|
|
23
24
|
disconnect(): void
|
|
24
25
|
/** 指定目标节点并开始监听相交状态变化情况
|
|
26
|
+
* @supported weapp
|
|
25
27
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html
|
|
26
28
|
*/
|
|
27
29
|
observe(
|
|
@@ -31,6 +33,7 @@ declare module '../../index' {
|
|
|
31
33
|
callback: IntersectionObserver.ObserveCallback,
|
|
32
34
|
): void
|
|
33
35
|
/** 使用选择器指定一个节点,作为参照区域之一。
|
|
36
|
+
* @supported weapp
|
|
34
37
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html
|
|
35
38
|
*/
|
|
36
39
|
relativeTo(
|
|
@@ -40,6 +43,7 @@ declare module '../../index' {
|
|
|
40
43
|
margins?: IntersectionObserver.RelativeToMargins,
|
|
41
44
|
): IntersectionObserver
|
|
42
45
|
/** 指定页面显示区域作为参照区域之一
|
|
46
|
+
* @supported weapp
|
|
43
47
|
* @example
|
|
44
48
|
* 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。
|
|
45
49
|
*
|
|
@@ -141,107 +145,38 @@ declare module '../../index' {
|
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
* properties: ['scrollX', 'scrollY']
|
|
177
|
-
* }, function (res){
|
|
178
|
-
* res.dataset // 节点的dataset
|
|
179
|
-
* res.width // 节点的宽度
|
|
180
|
-
* res.height // 节点的高度
|
|
181
|
-
* res.scrollLeft // 节点的水平滚动位置
|
|
182
|
-
* res.scrollTop // 节点的竖直滚动位置
|
|
183
|
-
* res.scrollX // 节点 scroll-x 属性的当前值
|
|
184
|
-
* res.scrollY // 节点 scroll-x 属性的当前值
|
|
185
|
-
* }).exec()
|
|
186
|
-
* ```
|
|
187
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html
|
|
188
|
-
*/
|
|
189
|
-
select(
|
|
190
|
-
/** 选择器 */
|
|
191
|
-
selector: string,
|
|
192
|
-
): NodesRef
|
|
193
|
-
/** 在当前页面下选择匹配选择器 selector 的所有节点。
|
|
194
|
-
*
|
|
195
|
-
* **selector 语法**
|
|
196
|
-
*
|
|
197
|
-
* selector类似于 CSS 的选择器,但仅支持下列语法。
|
|
198
|
-
*
|
|
199
|
-
* - ID选择器:#the-id
|
|
200
|
-
* - class选择器(可以连续指定多个):.a-class.another-class
|
|
201
|
-
* - 子元素选择器:.the-parent > .the-child
|
|
202
|
-
* - 后代选择器:.the-ancestor .the-descendant
|
|
203
|
-
* - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
|
|
204
|
-
* - 多选择器的并集:#a-node, .some-other-nodes
|
|
205
|
-
* @supported weapp, h5
|
|
206
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html
|
|
207
|
-
*/
|
|
208
|
-
selectAll(
|
|
209
|
-
/** 选择器 */
|
|
210
|
-
selector: string,
|
|
211
|
-
): NodesRef
|
|
212
|
-
/** 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。
|
|
213
|
-
* @supported weapp, h5
|
|
214
|
-
* @example
|
|
215
|
-
* ```tsx
|
|
216
|
-
* Taro.createSelectorQuery().selectViewport().scrollOffset(function (res) {
|
|
217
|
-
* res.id // 节点的ID
|
|
218
|
-
* res.dataset // 节点的dataset
|
|
219
|
-
* res.scrollLeft // 节点的水平滚动位置
|
|
220
|
-
* res.scrollTop // 节点的竖直滚动位置
|
|
221
|
-
* }).exec()
|
|
222
|
-
* ```
|
|
223
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectViewport.html
|
|
224
|
-
*/
|
|
225
|
-
selectViewport(): NodesRef
|
|
226
|
-
/** 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
|
|
227
|
-
* @supported weapp, h5
|
|
228
|
-
* @example
|
|
229
|
-
* ```tsx
|
|
230
|
-
* Component({
|
|
231
|
-
* queryMultipleNodes () {
|
|
232
|
-
* const query = Taro.createSelectorQuery().in(this)
|
|
233
|
-
* query.select('#the-id').boundingClientRect(function(res){
|
|
234
|
-
* res.top // 这个组件内 #the-id 节点的上边界坐标
|
|
235
|
-
* }).exec()
|
|
236
|
-
* }
|
|
237
|
-
* })
|
|
238
|
-
* ```
|
|
239
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.in.html
|
|
240
|
-
*/
|
|
241
|
-
in(
|
|
242
|
-
/** 自定义组件实例 */
|
|
243
|
-
component: TaroGeneral.IAnyObject,
|
|
244
|
-
): SelectorQuery
|
|
148
|
+
/** `MediaQueryObserver` 对象,用于监听页面 media query 状态的变化,如界面的长宽是不是在某个指定的范围内。 */
|
|
149
|
+
interface MediaQueryObserver {
|
|
150
|
+
/** 开始监听页面 media query 变化情况 */
|
|
151
|
+
observe(descriptor: MediaQueryObserver.descriptor, callback: MediaQueryObserver.observeCallback): void
|
|
152
|
+
/** 停止监听。回调函数将不再触发 */
|
|
153
|
+
disconnect(): void
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
namespace MediaQueryObserver {
|
|
157
|
+
/** media query 描述符 */
|
|
158
|
+
interface descriptor {
|
|
159
|
+
/** 页面最小宽度 (单位: px) */
|
|
160
|
+
minWidth: number
|
|
161
|
+
/** 页面最大宽度 (单位: px) */
|
|
162
|
+
maxWidth: number
|
|
163
|
+
/** 页面宽度 (单位: px) */
|
|
164
|
+
width: number
|
|
165
|
+
/** 页面最小高度 (单位: px) */
|
|
166
|
+
minHeight: number
|
|
167
|
+
/** 页面最大高度(px 为单位) */
|
|
168
|
+
maxHeight: number
|
|
169
|
+
/** 页面高度(px 为单位) */
|
|
170
|
+
height: number
|
|
171
|
+
/** 屏幕方向 */
|
|
172
|
+
orientation: 'landscape' | 'portrait'
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** 监听 media query 状态变化的回调函数 */
|
|
176
|
+
type observeCallback = (res: {
|
|
177
|
+
/** 页面的当前状态是否满足所指定的 media query */
|
|
178
|
+
matches: boolean
|
|
179
|
+
}) => void
|
|
245
180
|
}
|
|
246
181
|
|
|
247
182
|
/** 用于获取 `WXML` 节点信息的对象
|
|
@@ -284,8 +219,8 @@ declare module '../../index' {
|
|
|
284
219
|
/** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
|
|
285
220
|
callback?: NodesRef.BoundingClientRectCallback,
|
|
286
221
|
): SelectorQuery
|
|
287
|
-
/** 添加节点的 Context 对象查询请求。目前支持 [VideoContext](
|
|
288
|
-
* @supported weapp
|
|
222
|
+
/** 添加节点的 Context 对象查询请求。目前支持 [VideoContext](/docs/apis/media/video/VideoContext)、[CanvasContext](/docs/apis/canvas/CanvasContext)、[LivePlayerContext](/docs/apis/media/live/LivePlayerContext)、[EditorContext](/docs/apis/media/editor/EditorContext)和 [MapContext](/docs/apis/media/map/MapContext) 的获取。
|
|
223
|
+
* @supported weapp, h5
|
|
289
224
|
* @example
|
|
290
225
|
* ```tsx
|
|
291
226
|
* Taro.createSelectorQuery().select('.the-video-class').context(function (res) {
|
|
@@ -333,8 +268,8 @@ declare module '../../index' {
|
|
|
333
268
|
/** 回调函数 */
|
|
334
269
|
callback?: NodesRef.FieldsCallback,
|
|
335
270
|
): SelectorQuery
|
|
336
|
-
/** 获取 Node 节点实例。目前支持 [Canvas](
|
|
337
|
-
* @supported weapp
|
|
271
|
+
/** 获取 Node 节点实例。目前支持 [Canvas](/docs/components/canvas/canvas) 的获取。
|
|
272
|
+
* @supported weapp, h5
|
|
338
273
|
* @example
|
|
339
274
|
* ```tsx
|
|
340
275
|
* Taro.createSelectorQuery().select('.canvas').node(function(res){
|
|
@@ -444,6 +379,109 @@ declare module '../../index' {
|
|
|
444
379
|
}
|
|
445
380
|
}
|
|
446
381
|
|
|
382
|
+
/** 查询节点信息的对象
|
|
383
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html
|
|
384
|
+
*/
|
|
385
|
+
interface SelectorQuery {
|
|
386
|
+
/** 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。
|
|
387
|
+
* @supported weapp, h5
|
|
388
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html
|
|
389
|
+
*/
|
|
390
|
+
exec(
|
|
391
|
+
/** 回调函数 */
|
|
392
|
+
callback?: (...args: any[]) => any,
|
|
393
|
+
): NodesRef
|
|
394
|
+
/** 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
|
|
395
|
+
* @supported weapp, h5
|
|
396
|
+
* @example
|
|
397
|
+
* ```tsx
|
|
398
|
+
* Component({
|
|
399
|
+
* queryMultipleNodes () {
|
|
400
|
+
* const query = Taro.createSelectorQuery().in(this)
|
|
401
|
+
* query.select('#the-id').boundingClientRect(function(res){
|
|
402
|
+
* res.top // 这个组件内 #the-id 节点的上边界坐标
|
|
403
|
+
* }).exec()
|
|
404
|
+
* }
|
|
405
|
+
* })
|
|
406
|
+
* ```
|
|
407
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.in.html
|
|
408
|
+
*/
|
|
409
|
+
in(
|
|
410
|
+
/** 自定义组件实例 */
|
|
411
|
+
component: TaroGeneral.IAnyObject,
|
|
412
|
+
): SelectorQuery
|
|
413
|
+
/** 在当前页面下选择第一个匹配选择器 `selector` 的节点。返回一个 `NodesRef` 对象实例,可以用于获取节点信息。
|
|
414
|
+
*
|
|
415
|
+
* **selector 语法**
|
|
416
|
+
*
|
|
417
|
+
*
|
|
418
|
+
* selector类似于 CSS 的选择器,但仅支持下列语法。
|
|
419
|
+
*
|
|
420
|
+
* - ID选择器:#the-id
|
|
421
|
+
* - class选择器(可以连续指定多个):.a-class.another-class
|
|
422
|
+
* - 子元素选择器:.the-parent > .the-child
|
|
423
|
+
* - 后代选择器:.the-ancestor .the-descendant
|
|
424
|
+
* - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
|
|
425
|
+
* - 多选择器的并集:#a-node, .some-other-nodes
|
|
426
|
+
* @supported weapp, h5
|
|
427
|
+
* @example
|
|
428
|
+
* ```tsx
|
|
429
|
+
* Taro.createSelectorQuery().select('#the-id').fields({
|
|
430
|
+
* dataset: true,
|
|
431
|
+
* size: true,
|
|
432
|
+
* scrollOffset: true,
|
|
433
|
+
* properties: ['scrollX', 'scrollY']
|
|
434
|
+
* }, function (res){
|
|
435
|
+
* res.dataset // 节点的dataset
|
|
436
|
+
* res.width // 节点的宽度
|
|
437
|
+
* res.height // 节点的高度
|
|
438
|
+
* res.scrollLeft // 节点的水平滚动位置
|
|
439
|
+
* res.scrollTop // 节点的竖直滚动位置
|
|
440
|
+
* res.scrollX // 节点 scroll-x 属性的当前值
|
|
441
|
+
* res.scrollY // 节点 scroll-x 属性的当前值
|
|
442
|
+
* }).exec()
|
|
443
|
+
* ```
|
|
444
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html
|
|
445
|
+
*/
|
|
446
|
+
select(
|
|
447
|
+
/** 选择器 */
|
|
448
|
+
selector: string,
|
|
449
|
+
): NodesRef
|
|
450
|
+
/** 在当前页面下选择匹配选择器 selector 的所有节点。
|
|
451
|
+
*
|
|
452
|
+
* **selector 语法**
|
|
453
|
+
*
|
|
454
|
+
* selector类似于 CSS 的选择器,但仅支持下列语法。
|
|
455
|
+
*
|
|
456
|
+
* - ID选择器:#the-id
|
|
457
|
+
* - class选择器(可以连续指定多个):.a-class.another-class
|
|
458
|
+
* - 子元素选择器:.the-parent > .the-child
|
|
459
|
+
* - 后代选择器:.the-ancestor .the-descendant
|
|
460
|
+
* - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
|
|
461
|
+
* - 多选择器的并集:#a-node, .some-other-nodes
|
|
462
|
+
* @supported weapp, h5
|
|
463
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html
|
|
464
|
+
*/
|
|
465
|
+
selectAll(
|
|
466
|
+
/** 选择器 */
|
|
467
|
+
selector: string,
|
|
468
|
+
): NodesRef
|
|
469
|
+
/** 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。
|
|
470
|
+
* @supported weapp, h5
|
|
471
|
+
* @example
|
|
472
|
+
* ```tsx
|
|
473
|
+
* Taro.createSelectorQuery().selectViewport().scrollOffset(function (res) {
|
|
474
|
+
* res.id // 节点的ID
|
|
475
|
+
* res.dataset // 节点的dataset
|
|
476
|
+
* res.scrollLeft // 节点的水平滚动位置
|
|
477
|
+
* res.scrollTop // 节点的竖直滚动位置
|
|
478
|
+
* }).exec()
|
|
479
|
+
* ```
|
|
480
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectViewport.html
|
|
481
|
+
*/
|
|
482
|
+
selectViewport(): NodesRef
|
|
483
|
+
}
|
|
484
|
+
|
|
447
485
|
interface TaroStatic {
|
|
448
486
|
/** 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
|
|
449
487
|
* @supported weapp, h5
|
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,109 +89,114 @@ 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
|
|
|
110
110
|
interface Runtime {
|
|
111
111
|
enableInnerHTML: boolean
|
|
112
112
|
enableSizeAPIs: boolean
|
|
113
|
+
enableAdjacentHTML: boolean
|
|
114
|
+
enableTemplateContent: boolean
|
|
115
|
+
enableCloneNode: boolean
|
|
116
|
+
enableContains: boolean
|
|
117
|
+
enableMutationObserver: boolean
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
export interface IMiniAppConfig {
|
|
116
|
-
appOutput?: boolean
|
|
117
|
-
enableSourceMap?: boolean
|
|
118
|
-
sourceMapType?: string
|
|
119
|
-
debugReact?: boolean
|
|
121
|
+
appOutput?: boolean
|
|
122
|
+
enableSourceMap?: boolean
|
|
123
|
+
sourceMapType?: string
|
|
124
|
+
debugReact?: boolean
|
|
120
125
|
minifyXML?: {
|
|
121
126
|
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)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
webpackChain?: (chain: any, webpack: any, PARSE_AST_TYPE: any) => void
|
|
130
|
+
entry?: webpack.Entry
|
|
131
|
+
output?: webpack.Output
|
|
132
|
+
postcss?: IPostcssOption
|
|
133
|
+
cssLoaderOption?: IOption
|
|
134
|
+
sassLoaderOption?: IOption
|
|
135
|
+
lessLoaderOption?: IOption
|
|
136
|
+
stylusLoaderOption?: IOption
|
|
137
|
+
mediaUrlLoaderOption?: IOption
|
|
138
|
+
fontUrlLoaderOption?: IOption
|
|
139
|
+
imageUrlLoaderOption?: IOption
|
|
140
|
+
miniCssExtractPluginOption?: IOption
|
|
141
|
+
|
|
142
|
+
customFilesTypes?: IMINI_APP_FILE_TYPE
|
|
143
|
+
commonChunks?: string[] | ((commonChunks: string[]) => string[])
|
|
144
|
+
addChunkPages?: ((pages: Map<string, string[]>, pagesNames?: string[]) => void)
|
|
140
145
|
optimizeMainPackage?: {
|
|
141
|
-
enable?: boolean
|
|
146
|
+
enable?: boolean
|
|
142
147
|
exclude?: any[]
|
|
143
|
-
}
|
|
148
|
+
}
|
|
144
149
|
|
|
145
150
|
compile?: {
|
|
146
|
-
exclude?: any[]
|
|
151
|
+
exclude?: any[]
|
|
147
152
|
include?: any[]
|
|
148
153
|
}
|
|
149
154
|
runtime?: Runtime
|
|
150
155
|
}
|
|
151
156
|
|
|
152
157
|
export type TogglableOptions<T = IOption> = {
|
|
153
|
-
enable?: boolean
|
|
158
|
+
enable?: boolean
|
|
154
159
|
config?: T
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
export interface IH5RouterConfig {
|
|
158
|
-
mode?: 'hash' | 'browser' | 'multi'
|
|
159
|
-
customRoutes?: IOption
|
|
160
|
-
basename?: string
|
|
161
|
-
lazyload?: boolean | ((pagename: string) => boolean)
|
|
163
|
+
mode?: 'hash' | 'browser' | 'multi'
|
|
164
|
+
customRoutes?: IOption
|
|
165
|
+
basename?: string
|
|
166
|
+
lazyload?: boolean | ((pagename: string) => boolean)
|
|
162
167
|
renamePagename?: (pagename: string) => string
|
|
163
168
|
forcePath?: string
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
export interface IH5Config {
|
|
167
|
-
publicPath?: string
|
|
168
|
-
staticDirectory?: string
|
|
169
|
-
chunkDirectory?: string
|
|
172
|
+
publicPath?: string
|
|
173
|
+
staticDirectory?: string
|
|
174
|
+
chunkDirectory?: string
|
|
170
175
|
|
|
171
176
|
webpack?: ((webpackConfig: webpack.Configuration, webpack) => webpack.Configuration) | webpack.Configuration
|
|
172
177
|
|
|
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
|
|
178
|
+
webpackChain?: (chain: any, webpack: any) => void
|
|
179
|
+
|
|
180
|
+
entry?: webpack.Entry
|
|
181
|
+
output?: webpack.Output
|
|
182
|
+
router?: IH5RouterConfig
|
|
183
|
+
devServer?: webpackDevServer.Configuration
|
|
184
|
+
enableSourceMap?: boolean
|
|
185
|
+
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'
|
|
186
|
+
enableExtract?: boolean
|
|
187
|
+
transformOnly?: boolean
|
|
188
|
+
|
|
189
|
+
cssLoaderOption?: IOption
|
|
190
|
+
styleLoaderOption?: IOption
|
|
191
|
+
sassLoaderOption?: IOption
|
|
192
|
+
lessLoaderOption?: IOption
|
|
193
|
+
stylusLoaderOption?: IOption
|
|
194
|
+
mediaUrlLoaderOption?: IOption
|
|
195
|
+
fontUrlLoaderOption?: IOption
|
|
196
|
+
imageUrlLoaderOption?: IOption
|
|
197
|
+
miniCssExtractPluginOption?: IOption
|
|
198
|
+
esnextModules?: string[]
|
|
199
|
+
useHtmlComponents?: boolean
|
|
195
200
|
|
|
196
201
|
postcss?: IPostcssOption
|
|
197
202
|
}
|
|
@@ -213,11 +218,11 @@ export type SystemConfig = {
|
|
|
213
218
|
/**
|
|
214
219
|
* 打印日志等级,分为 off,error,warn,info,log,debug
|
|
215
220
|
*/
|
|
216
|
-
logLevel?: LogLevel
|
|
221
|
+
logLevel?: LogLevel
|
|
217
222
|
/**
|
|
218
223
|
* 页面设计基准宽度,根据实际设备宽度来缩放元素大小
|
|
219
224
|
*/
|
|
220
|
-
designWidth?: number
|
|
225
|
+
designWidth?: number
|
|
221
226
|
/**
|
|
222
227
|
* 全局数据对象,属性名不能以$或_开头,在页面中可通过 this 进行访问;如果全局数据属性与页面的数据属性重名,则页面初始化时,全局数据会覆盖页面中对应的属性值
|
|
223
228
|
*/
|
|
@@ -228,7 +233,7 @@ type RouterConfig = {
|
|
|
228
233
|
/**
|
|
229
234
|
* 首页名称
|
|
230
235
|
*/
|
|
231
|
-
entry: string
|
|
236
|
+
entry: string
|
|
232
237
|
/**
|
|
233
238
|
* 页面配置列表,key 值为页面名称(对应页面目录名,例如 Hello 对应'Hello'目录),value 为页面详细配置 page
|
|
234
239
|
*/
|
|
@@ -238,14 +243,14 @@ type RouterPage = {
|
|
|
238
243
|
/**
|
|
239
244
|
* 页面对应的组件名,与 ux 文件名保持一致,例如'hello' 对应 'hello.ux'
|
|
240
245
|
*/
|
|
241
|
-
component: string
|
|
246
|
+
component: string
|
|
242
247
|
/**
|
|
243
248
|
* 页面路径,例如“/user”,不填则默认为/<页面名称>。
|
|
244
249
|
* path 必须唯一,不能和其他 page 的 path 相同。
|
|
245
250
|
* 下面 page 的 path 因为缺失,会被设置为“/Index”:
|
|
246
251
|
* "Index": {"component": "index"}
|
|
247
252
|
*/
|
|
248
|
-
path?: string
|
|
253
|
+
path?: string
|
|
249
254
|
/**
|
|
250
255
|
* 声明页面可以处理某种请求
|
|
251
256
|
*/
|
|
@@ -260,31 +265,31 @@ interface IDefaultDisplayConfig {
|
|
|
260
265
|
/**
|
|
261
266
|
* 窗口背景颜色
|
|
262
267
|
*/
|
|
263
|
-
backgroundColor?: string
|
|
268
|
+
backgroundColor?: string
|
|
264
269
|
/**
|
|
265
270
|
* 是否是全屏模式,默认不会同时作用于 titleBar,titleBar 需要继续通过 titleBar 控制
|
|
266
271
|
*/
|
|
267
|
-
fullScreen?: boolean
|
|
272
|
+
fullScreen?: boolean
|
|
268
273
|
/**
|
|
269
274
|
* 是否显示 titleBar
|
|
270
275
|
*/
|
|
271
|
-
titleBar?: boolean
|
|
276
|
+
titleBar?: boolean
|
|
272
277
|
/**
|
|
273
278
|
* 标题栏背景色
|
|
274
279
|
*/
|
|
275
|
-
titleBarBackgroundColor?: string
|
|
280
|
+
titleBarBackgroundColor?: string
|
|
276
281
|
/**
|
|
277
282
|
* 标题栏文字颜色
|
|
278
283
|
*/
|
|
279
|
-
titleBarTextColor?: string
|
|
284
|
+
titleBarTextColor?: string
|
|
280
285
|
/**
|
|
281
286
|
* 标题栏文字(也可通过页面跳转传递参数(titleBarText)设置)
|
|
282
287
|
*/
|
|
283
|
-
titleBarText?: string
|
|
288
|
+
titleBarText?: string
|
|
284
289
|
/**
|
|
285
290
|
* 是否显示标题栏右上角菜单按钮,点击菜单按钮调用页面生命周期 onMenuPress 方法,如果该方法未实现则显示系统默认菜单
|
|
286
291
|
*/
|
|
287
|
-
menu?: boolean
|
|
292
|
+
menu?: boolean
|
|
288
293
|
/**
|
|
289
294
|
* 软键盘弹出时为保证输入框可见,页面的调整方式。 adjustPan:上移页面; adjustResize:压缩页面显示区域,当页面全屏时,此设置不生效
|
|
290
295
|
*/
|
|
@@ -304,31 +309,31 @@ export interface ITaroManifestConfig {
|
|
|
304
309
|
/**
|
|
305
310
|
* 应用包名,确认与原生应用的包名不一致,推荐采用 com.company.module 的格式,如:com.example.demo
|
|
306
311
|
*/
|
|
307
|
-
package: string
|
|
312
|
+
package: string
|
|
308
313
|
/**
|
|
309
314
|
* 应用名称,6 个汉字以内,与应用商店保存的名称一致,用于在桌面图标、弹窗等处显示应用名称
|
|
310
315
|
*/
|
|
311
|
-
name: string
|
|
316
|
+
name: string
|
|
312
317
|
/**
|
|
313
318
|
* 应用图标,提供 192x192 大小的即可
|
|
314
319
|
*/
|
|
315
|
-
icon: string
|
|
320
|
+
icon: string
|
|
316
321
|
/**
|
|
317
322
|
* 应用版本名称,如:"1.0"
|
|
318
323
|
*/
|
|
319
|
-
versionName?: string
|
|
324
|
+
versionName?: string
|
|
320
325
|
/**
|
|
321
326
|
* 应用版本号,从1自增,推荐每次重新上传包时versionCode+1
|
|
322
327
|
*/
|
|
323
|
-
versionCode: number
|
|
328
|
+
versionCode: number
|
|
324
329
|
/**
|
|
325
330
|
* 支持的最小平台版本号,兼容性检查,避免上线后在低版本平台运行并导致不兼容;如果不填按照内测版本处理
|
|
326
331
|
*/
|
|
327
|
-
minPlatformVersion?: string
|
|
332
|
+
minPlatformVersion?: string
|
|
328
333
|
/**
|
|
329
334
|
* 接口列表,绝大部分接口都需要在这里声明,否则不能调用,详见每个接口的文档说明
|
|
330
335
|
*/
|
|
331
|
-
features?: FeatureItem[]
|
|
336
|
+
features?: FeatureItem[]
|
|
332
337
|
/**
|
|
333
338
|
*
|
|
334
339
|
*/
|
|
@@ -339,11 +344,11 @@ export interface IManifestConfig extends ITaroManifestConfig {
|
|
|
339
344
|
/**
|
|
340
345
|
* 系统配置信息
|
|
341
346
|
*/
|
|
342
|
-
config: SystemConfig
|
|
347
|
+
config: SystemConfig
|
|
343
348
|
/**
|
|
344
349
|
* 路由信息
|
|
345
350
|
*/
|
|
346
|
-
router: RouterConfig
|
|
351
|
+
router: RouterConfig
|
|
347
352
|
/**
|
|
348
353
|
* UI 显示相关配置
|
|
349
354
|
*/
|
|
@@ -353,24 +358,24 @@ export interface IManifestConfig extends ITaroManifestConfig {
|
|
|
353
358
|
export type PluginItem = string | [string, object]
|
|
354
359
|
|
|
355
360
|
export interface IProjectBaseConfig {
|
|
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[]
|
|
361
|
+
projectName?: string
|
|
362
|
+
date?: string
|
|
363
|
+
designWidth?: number
|
|
364
|
+
watcher?: any[]
|
|
365
|
+
deviceRatio?: TaroGeneral.TDeviceRatio
|
|
366
|
+
sourceRoot?: string
|
|
367
|
+
outputRoot?: string
|
|
368
|
+
env?: IOption
|
|
369
|
+
alias?: IOption
|
|
370
|
+
defineConstants?: IOption
|
|
371
|
+
copy?: ICopyOptions
|
|
372
|
+
csso?: TogglableOptions
|
|
373
|
+
terser?: TogglableOptions
|
|
374
|
+
uglify?: TogglableOptions
|
|
375
|
+
sass?: ISassOptions
|
|
376
|
+
plugins?: PluginItem[]
|
|
372
377
|
presets?: PluginItem[]
|
|
373
|
-
baseLevel?: number
|
|
378
|
+
baseLevel?: number
|
|
374
379
|
framework?: string
|
|
375
380
|
}
|
|
376
381
|
|