@tarojs/taro 4.2.2-alpha.1 → 4.2.2-alpha.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": "4.2.2-alpha.1",
3
+ "version": "4.2.2-alpha.3",
4
4
  "description": "Taro framework",
5
5
  "author": "O2Team",
6
6
  "license": "MIT",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@types/postcss-url": "^10.0.4",
27
- "@tarojs/api": "4.2.2-alpha.1",
28
- "@tarojs/runtime": "4.2.2-alpha.1"
27
+ "@tarojs/runtime": "4.2.2-alpha.3",
28
+ "@tarojs/api": "4.2.2-alpha.3"
29
29
  },
30
30
  "devDependencies": {
31
31
  "html-webpack-plugin": "^5.6.0",
@@ -33,9 +33,9 @@
33
33
  "webpack-chain": "^6.5.1",
34
34
  "webpack-dev-server": "^4.15.2",
35
35
  "rollup": "^3.29.4",
36
- "@tarojs/components": "4.2.2-alpha.1",
37
- "@tarojs/helper": "4.2.2-alpha.1",
38
- "@tarojs/shared": "4.2.2-alpha.1"
36
+ "@tarojs/components": "4.2.2-alpha.3",
37
+ "@tarojs/helper": "4.2.2-alpha.3",
38
+ "@tarojs/shared": "4.2.2-alpha.3"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@types/react": "^18",
@@ -46,9 +46,9 @@
46
46
  "webpack": "^5",
47
47
  "webpack-chain": "^6",
48
48
  "webpack-dev-server": "^4",
49
- "@tarojs/components": "4.2.2-alpha.1",
50
- "@tarojs/helper": "4.2.2-alpha.1",
51
- "@tarojs/shared": "4.2.2-alpha.1"
49
+ "@tarojs/components": "4.2.2-alpha.3",
50
+ "@tarojs/helper": "4.2.2-alpha.3",
51
+ "@tarojs/shared": "4.2.2-alpha.3"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "@types/react": {
@@ -2,7 +2,7 @@ import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
4
  namespace request {
5
- interface Option<T = any, U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any> {
5
+ interface Option<T = any, U = any> {
6
6
  /** 开发者服务器接口地址 */
7
7
  url: string
8
8
  /** 请求的参数 */
@@ -150,8 +150,7 @@ declare module '../../index' {
150
150
  storeCheck?(): boolean
151
151
  }
152
152
 
153
- interface SuccessCallbackResult<T extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any>
154
- extends TaroGeneral.CallbackResult {
153
+ interface SuccessCallbackResult<T = any> extends TaroGeneral.CallbackResult {
155
154
  /** 开发者服务器返回的数据 */
156
155
  data: T
157
156
  /** 开发者服务器返回的 HTTP Response Header */
@@ -379,6 +378,11 @@ declare module '../../index' {
379
378
  }
380
379
  }
381
380
 
381
+ /** @ignore */
382
+ interface RequestParams<T = any> extends request.Option<T, any> {
383
+ [propName: string]: any
384
+ }
385
+
382
386
  /** @ignore */
383
387
  type interceptor = (chain: Chain) => any
384
388
 
@@ -31,6 +31,37 @@ declare module '../../index' {
31
31
  }
32
32
  }
33
33
 
34
+ namespace requestCommonPayment {
35
+ interface Option {
36
+ /** 支付的类型 */
37
+ mode: Mode
38
+ /** 具体支付参数。该参数需要序列化为字符串传递 */
39
+ signData: string
40
+ /** 支付签名,详见微信官方文档《签名详解》 */
41
+ paySig: string
42
+ /** 用户态签名,详见微信官方文档《签名详解》 */
43
+ signature: string
44
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
45
+ complete?: (res: TaroGeneral.CallbackResult) => void
46
+ /** 接口调用失败的回调函数 */
47
+ fail?: (res: FailCallbackResult) => void
48
+ /** 接口调用成功的回调函数 */
49
+ success?: (res: SuccessCallbackResult) => void
50
+ }
51
+
52
+ /**
53
+ * 支付类型:B2b 支付、间接支付、合单支付或多渠道 B2b 支付
54
+ */
55
+ type Mode = 'retail_pay_goods' | 'retail_pay_indirect_goods' | 'retail_pay_combined_goods' | 'retail_pay_goods_new'
56
+
57
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {}
58
+
59
+ interface FailCallbackResult extends TaroGeneral.CallbackResult {
60
+ /** 错误码 */
61
+ errno: number
62
+ }
63
+ }
64
+
34
65
  namespace requestOrderPayment {
35
66
  interface Option {
36
67
  /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
@@ -84,6 +115,33 @@ declare module '../../index' {
84
115
  */
85
116
  requestPayment(option: requestPayment.Option): Promise<TaroGeneral.CallbackResult>
86
117
 
118
+ /** 发起通用支付。目前仅支持 B2b 支付类型
119
+ * @supported weapp
120
+ * @since 2.19.2
121
+ * @example
122
+ * ```tsx
123
+ * Taro.requestCommonPayment({
124
+ * mode: 'retail_pay_goods',
125
+ * signData: JSON.stringify({
126
+ * mchid: '1234567890',
127
+ * out_trade_no: 'test1244',
128
+ * description: '测试订单',
129
+ * amount: {
130
+ * order_amount: 1,
131
+ * currency: 'CNY'
132
+ * },
133
+ * env: 0
134
+ * }),
135
+ * paySig: '',
136
+ * signature: '',
137
+ * success (res) { },
138
+ * fail (res) { }
139
+ * })
140
+ * ```
141
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestCommonPayment.html
142
+ */
143
+ requestCommonPayment(option: requestCommonPayment.Option): void
144
+
87
145
  /** 创建自定义版交易组件订单,并发起支付。 仅接入了[自定义版交易组件](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/Introduction2)的小程序需要使用,普通小程序可直接使用 `Taro.requestPayment`。
88
146
  * @supported weapp
89
147
  * @example
@@ -23,6 +23,19 @@ interface IPrebundle {
23
23
 
24
24
  interface ICompiler<T> {
25
25
  type: T
26
+ /**
27
+ * 使用的自定义 runner 模块标识。未配置时根据 `type` 使用默认 runner。
28
+ * 该值必须是 Node.js 可解析的非空字符串,且不能包含首尾空白。
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * compiler: {
33
+ * type: 'webpack5',
34
+ * runner: '@tarojs/rspack-runner',
35
+ * }
36
+ * ```
37
+ */
38
+ runner?: string
26
39
  prebundle?: IPrebundle
27
40
  vitePlugins?: any
28
41
  /** 错误处理级别。可选值:0、1 */
@@ -100,23 +100,6 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
100
100
  /** 插件内部使用 */
101
101
  runtime?: Runtime
102
102
 
103
- /**
104
- * 共享运行时(split 模式):额外纳入共享的运行时包名列表。
105
- * 用于把业务自研的运行时 API 也一并 external 到共享运行时全局,随异步核共享一份。
106
- * 仅在使用 `--shared-runtime --shared-runtime-mode split` 编译时生效。
107
- */
108
- sharedRuntimeExtraPackages?: string[]
109
-
110
- /**
111
- * 共享运行时(split 模式):需要在**同步核**阶段就执行副作用的额外共享包名列表。
112
- * 与 `sharedRuntimeExtraPackages` 平行——后者随异步核加载(`.then` 回调,晚于首屏 onLoad),
113
- * 前者随业务 app.js 顶层同步 `require` 立即执行。适用于必须先于首屏 window `INIT`
114
- * 事件广播就注册监听器/设置全局状态的场景(如 rem 根字号计算的 `window.on(CONTEXT_ACTIONS.INIT)`
115
- * 注册)。代价:每个业务包各自打包一份(不共享),故此清单应仅放**必须首屏就位**的极小内容。
116
- * 仅在 `--shared-runtime --shared-runtime-mode split` 编译时生效。
117
- */
118
- sharedRuntimeSyncExtraPackages?: string[]
119
-
120
103
  /** 使用的编译工具。可选值:webpack5、vite */
121
104
  compiler?: Compiler<T>
122
105