@tarojs/taro 3.6.5 → 3.7.0-alpha.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 +3 -3
- package/types/api/canvas/index.d.ts +21 -18
- package/types/api/cloud/index.d.ts +1 -0
- package/types/api/network/request.d.ts +10 -1
- package/types/api/open-api/favorites.d.ts +2 -23
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/compile/compiler.d.ts +2 -1
- package/types/compile/config/project.d.ts +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0-alpha.0",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"author": "O2Team",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tarojs/api": "3.
|
|
25
|
-
"@tarojs/runtime": "3.
|
|
24
|
+
"@tarojs/api": "3.7.0-alpha.0",
|
|
25
|
+
"@tarojs/runtime": "3.7.0-alpha.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"@types/react": {
|
|
@@ -1730,28 +1730,31 @@ declare module '../../index' {
|
|
|
1730
1730
|
|
|
1731
1731
|
/** 创建 canvas 的绘图上下文 [CanvasContext](/docs/apis/canvas/CanvasContext) 对象
|
|
1732
1732
|
*
|
|
1733
|
-
* **Tip**: 需要指定 canvasId,该绘图上下文只作用于对应的 `<canvas
|
|
1733
|
+
* **Tip**: 需要指定 canvasId,该绘图上下文只作用于对应的 `<canvas/>`;另外,Web 端需要在 `useReady` 回调中执行它,否则会因为底层 canvas 渲染出来之前而去获取 CanvasContext,导致其底层的 context 为 `undefined`,从而不能正常绘图。
|
|
1734
1734
|
* @supported weapp, h5
|
|
1735
1735
|
* @example
|
|
1736
1736
|
* ```tsx
|
|
1737
|
-
*
|
|
1737
|
+
* import { useReady } from '@tarojs/taro'
|
|
1738
1738
|
*
|
|
1739
|
-
*
|
|
1740
|
-
* context.
|
|
1741
|
-
*
|
|
1742
|
-
*
|
|
1743
|
-
*
|
|
1744
|
-
*
|
|
1745
|
-
*
|
|
1746
|
-
*
|
|
1747
|
-
*
|
|
1748
|
-
*
|
|
1749
|
-
*
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1739
|
+
* useReady(() => {
|
|
1740
|
+
* const context = Taro.createCanvasContext('canvas')
|
|
1741
|
+
* context.setStrokeStyle("#00ff00")
|
|
1742
|
+
* context.setLineWidth(5)
|
|
1743
|
+
* context.rect(0, 0, 200, 200)
|
|
1744
|
+
* context.stroke()
|
|
1745
|
+
* context.setStrokeStyle("#ff0000")
|
|
1746
|
+
* context.setLineWidth(2)
|
|
1747
|
+
* context.moveTo(160, 100)
|
|
1748
|
+
* context.arc(100, 100, 60, 0, 2 * Math.PI, true)
|
|
1749
|
+
* context.moveTo(140, 100)
|
|
1750
|
+
* context.arc(100, 100, 40, 0, Math.PI, false)
|
|
1751
|
+
* context.moveTo(85, 80)
|
|
1752
|
+
* context.arc(80, 80, 5, 0, 2 * Math.PI, true)
|
|
1753
|
+
* context.moveTo(125, 80)
|
|
1754
|
+
* context.arc(120, 80, 5, 0, 2 * Math.PI, true)
|
|
1755
|
+
* context.stroke()
|
|
1756
|
+
* context.draw()
|
|
1757
|
+
* })
|
|
1755
1758
|
* ```
|
|
1756
1759
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createCanvasContext.html
|
|
1757
1760
|
*/
|
|
@@ -496,6 +496,7 @@ declare module '../../index' {
|
|
|
496
496
|
callContainer < R = any, P = any >(params: cloud.CallContainerParam<P>): Promise<cloud.CallContainerResult<R>>
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
+
/** @ignore */
|
|
499
500
|
interface Cloud {
|
|
500
501
|
/** 在调用云开发各 API 前,需先调用初始化方法 init 一次(全局只需一次,多次调用时只有第一次生效)
|
|
501
502
|
* @supported weapp
|
|
@@ -284,7 +284,7 @@ declare module '../../index' {
|
|
|
284
284
|
/** Transfer-Encoding Chunk Received 事件的回调函数 */
|
|
285
285
|
callback: RequestTask.onChunkReceived.Callback,
|
|
286
286
|
): void
|
|
287
|
-
/**
|
|
287
|
+
/** 移除 Transfer-Encoding Chunk Received 事件的监听函数
|
|
288
288
|
* @supported weapp
|
|
289
289
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offChunkReceived.html
|
|
290
290
|
*/
|
|
@@ -401,6 +401,15 @@ declare module '../../index' {
|
|
|
401
401
|
*/
|
|
402
402
|
addInterceptor(interceptor: interceptor): any
|
|
403
403
|
|
|
404
|
+
/** 清除所有拦截器
|
|
405
|
+
* @example
|
|
406
|
+
* ```tsx
|
|
407
|
+
* Taro.cleanInterceptors()
|
|
408
|
+
* ```
|
|
409
|
+
* @supported weapp, h5, alipay, swan, tt, qq
|
|
410
|
+
*/
|
|
411
|
+
cleanInterceptors(): void
|
|
412
|
+
|
|
404
413
|
interceptors: interceptors
|
|
405
414
|
}
|
|
406
415
|
}
|
|
@@ -31,22 +31,6 @@ declare module '../../index' {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
namespace checkIsAddedToMyMiniProgram {
|
|
35
|
-
interface Option {
|
|
36
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
37
|
-
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
38
|
-
/** 接口调用失败的回调函数 */
|
|
39
|
-
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
40
|
-
/** 接口调用成功的回调函数 */
|
|
41
|
-
success?: (res: TaroGeneral.CallbackResult) => void
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
45
|
-
/**是否被添加至 「我的小程序」 */
|
|
46
|
-
added: boolean
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
34
|
interface TaroStatic {
|
|
51
35
|
/** 收藏视频
|
|
52
36
|
* @supported weapp
|
|
@@ -80,7 +64,8 @@ declare module '../../index' {
|
|
|
80
64
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addVideoToFavorites.html
|
|
81
65
|
*/
|
|
82
66
|
addVideoToFavorites(option?: addVideoToFavorites.Option): Promise<TaroGeneral.CallbackResult>
|
|
83
|
-
|
|
67
|
+
|
|
68
|
+
/** 收藏文件
|
|
84
69
|
* @supported weapp
|
|
85
70
|
* @example
|
|
86
71
|
* ```tsx
|
|
@@ -112,11 +97,5 @@ declare module '../../index' {
|
|
|
112
97
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addFileToFavorites.html
|
|
113
98
|
*/
|
|
114
99
|
addFileToFavorites(option?: addFileToFavorites.Option): Promise<TaroGeneral.CallbackResult>
|
|
115
|
-
/**
|
|
116
|
-
* 检查小程序是否被添加至 「我的小程序」
|
|
117
|
-
* @supported weapp
|
|
118
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
|
|
119
|
-
*/
|
|
120
|
-
checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option):Promise<checkIsAddedToMyMiniProgram.SuccessCallbackResult>
|
|
121
100
|
}
|
|
122
101
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace checkIsAddedToMyMiniProgram {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
15
|
+
/**是否被添加至 「我的小程序」 */
|
|
16
|
+
added: boolean
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface TaroStatic {
|
|
21
|
+
/**
|
|
22
|
+
* 检查小程序是否被添加至 「我的小程序」
|
|
23
|
+
* @supported weapp
|
|
24
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
|
|
25
|
+
*/
|
|
26
|
+
checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option):Promise<checkIsAddedToMyMiniProgram.SuccessCallbackResult>
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type swc from '@swc/core'
|
|
2
2
|
import type Webpack from 'webpack'
|
|
3
3
|
|
|
4
|
-
type CompilerTypes = 'webpack4' | 'webpack5'
|
|
4
|
+
type CompilerTypes = 'webpack4' | 'webpack5' | 'vite'
|
|
5
5
|
|
|
6
6
|
interface IPrebundle {
|
|
7
7
|
enable?: boolean
|
|
@@ -20,6 +20,7 @@ interface IPrebundle {
|
|
|
20
20
|
interface ICompiler {
|
|
21
21
|
type: CompilerTypes
|
|
22
22
|
prebundle?: IPrebundle
|
|
23
|
+
vitePlugins?: any[]
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export type Compiler = CompilerTypes | ICompiler
|
|
@@ -3,8 +3,8 @@ import type Chain from 'webpack-chain'
|
|
|
3
3
|
import type { Compiler } from '../compiler'
|
|
4
4
|
import type { IModifyWebpackChain } from '../hooks'
|
|
5
5
|
import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from "./util"
|
|
6
|
-
import { IH5Config } from './h5'
|
|
7
|
-
import { IMiniAppConfig } from './mini'
|
|
6
|
+
import type { IH5Config } from './h5'
|
|
7
|
+
import type { IMiniAppConfig } from './mini'
|
|
8
8
|
|
|
9
9
|
export type PluginItem = string | [string, object]
|
|
10
10
|
|
|
@@ -67,9 +67,13 @@ export interface IProjectBaseConfig {
|
|
|
67
67
|
onCompilerMake?: (compilation: Webpack.Compilation, compiler: Webpack.Compiler, plugin: any) => Promise<any>
|
|
68
68
|
onWebpackChainReady?: (webpackChain: Chain) => Promise<any>
|
|
69
69
|
/**
|
|
70
|
-
* 编译中修改 webpack 配置,在这个钩子中,你可以对 webpackChain 作出想要的调整,等同于配置 [`webpackChain`](./config-detail
|
|
70
|
+
* 编译中修改 webpack 配置,在这个钩子中,你可以对 webpackChain 作出想要的调整,等同于配置 [`webpackChain`](./config-detail#miniwebpackchain)
|
|
71
71
|
*/
|
|
72
72
|
modifyWebpackChain?: (chain: Chain, webpack: typeof Webpack, data: IModifyWebpackChain) => Promise<any>
|
|
73
|
+
/**
|
|
74
|
+
* 编译中修改 vite 配置
|
|
75
|
+
*/
|
|
76
|
+
modifyViteConfig?: (viteConfig: any, componentConfig: IModifyWebpackChain['componentConfig']) => void
|
|
73
77
|
/**
|
|
74
78
|
* 修改编译过程中的页面组件配置
|
|
75
79
|
*/
|