@tarojs/taro 4.0.8-beta.1 → 4.0.8-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": "4.0.8-beta.1",
3
+ "version": "4.0.8-beta.3",
4
4
  "description": "Taro framework",
5
5
  "author": "O2Team",
6
6
  "license": "MIT",
@@ -24,20 +24,19 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@types/postcss-url": "^10.0.4",
27
- "@tarojs/api": "4.0.8-beta.1",
28
- "@tarojs/runtime": "4.0.8-beta.1"
27
+ "@tarojs/api": "4.0.8-beta.3",
28
+ "@tarojs/runtime": "4.0.8-beta.3"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/react": "^18.3.1",
32
31
  "html-webpack-plugin": "^5.6.0",
33
32
  "postcss": "^8.4.38",
34
33
  "webpack": "5.91.0",
35
34
  "webpack-chain": "^6.5.1",
36
35
  "webpack-dev-server": "^4.15.2",
37
36
  "rollup": "^3.29.4",
38
- "@tarojs/components": "4.0.8-beta.1",
39
- "@tarojs/helper": "4.0.8-beta.1",
40
- "@tarojs/shared": "4.0.8-beta.1"
37
+ "@tarojs/helper": "4.0.8-beta.3",
38
+ "@tarojs/components": "4.0.8-beta.3",
39
+ "@tarojs/shared": "4.0.8-beta.3"
41
40
  },
42
41
  "peerDependencies": {
43
42
  "@types/react": "^18",
@@ -48,9 +47,9 @@
48
47
  "webpack": "^5",
49
48
  "webpack-chain": "^6",
50
49
  "webpack-dev-server": "^4",
51
- "@tarojs/shared": "4.0.8-beta.1",
52
- "@tarojs/components": "4.0.8-beta.1",
53
- "@tarojs/helper": "4.0.8-beta.1"
50
+ "@tarojs/components": "4.0.8-beta.3",
51
+ "@tarojs/shared": "4.0.8-beta.3",
52
+ "@tarojs/helper": "4.0.8-beta.3"
54
53
  },
55
54
  "peerDependenciesMeta": {
56
55
  "@types/react": {
@@ -2048,7 +2048,7 @@ declare module '../../index' {
2048
2048
  /** 创建 canvas 的绘图上下文 [CanvasContext](/docs/apis/canvas/CanvasContext) 对象
2049
2049
  *
2050
2050
  * **Tip**: 需要指定 canvasId,该绘图上下文只作用于对应的 `<canvas/>`;另外,Web 端需要在 `useReady` 回调中执行它,否则会因为底层 canvas 渲染出来之前而去获取 CanvasContext,导致其底层的 context 为 `undefined`,从而不能正常绘图。
2051
- * @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
2051
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid, harmony
2052
2052
  * @example
2053
2053
  * ```tsx
2054
2054
  * import { useReady } from '@tarojs/taro'
@@ -1,4 +1,4 @@
1
- import Taro, { DownloadTask, UploadTask } from "../../index"
1
+ import Taro from "../../index"
2
2
 
3
3
  declare module '../../index' {
4
4
  namespace cloud {
@@ -212,6 +212,10 @@ declare module '../../index' {
212
212
 
213
213
  /** 调用云托管参数 */
214
214
  interface CallContainerParam < P extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > {
215
+ config?:{
216
+ /** 微信云托管的环境ID, 如果在 Taro.cloud.init 中配置了env, 则可以不配置。 */
217
+ env: string,
218
+ }
215
219
  /** 服务路径 */
216
220
  path: string
217
221
  /** HTTP请求方法,默认 GET */
@@ -43,7 +43,7 @@ declare module '../../index' {
43
43
 
44
44
  interface TaroStatic {
45
45
  /** 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
46
- * @supported weapp, alipay, swan, jd, tt, rn, harmony_hybrid
46
+ * @supported weapp, alipay, swan, jd, tt, rn, harmony_hybrid, harmony
47
47
  * @example
48
48
  * ```tsx
49
49
  * Taro.hideKeyboard({
@@ -26,7 +26,7 @@ declare module '../../index' {
26
26
  /** 监听内存不足告警事件。
27
27
  *
28
28
  * 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
29
- * @supported weapp, alipay, swan, jd, tt
29
+ * @supported weapp, alipay, swan, jd, tt, harmony
30
30
  * @example
31
31
  * ```tsx
32
32
  * Taro.onMemoryWarning(function () {
@@ -41,7 +41,7 @@ declare module '../../index' {
41
41
  ): void
42
42
 
43
43
  /** 取消监听内存不足告警事件。
44
- * @supported weapp, alipay, swan
44
+ * @supported weapp, alipay, swan, harmony
45
45
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.offMemoryWarning.html
46
46
  */
47
47
  offMemoryWarning(
@@ -1464,7 +1464,7 @@ declare module '../../index' {
1464
1464
  getFileInfo(option: getFileInfo.Option): Promise<getFileInfo.SuccessCallbackResult | getFileInfo.FailCallbackResult>
1465
1465
 
1466
1466
  /** 获取全局唯一的文件管理器
1467
- * @supported weapp, alipay, swan, jd, qq, tt, harmony_hybrid
1467
+ * @supported weapp, alipay, swan, jd, qq, tt, harmony_hybrid, harmony
1468
1468
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html
1469
1469
  */
1470
1470
  getFileSystemManager(): FileSystemManager
@@ -455,7 +455,7 @@ declare module '../../index' {
455
455
  * **注意**
456
456
  * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
457
457
  * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。
458
- * @supported weapp, swan, jd, qq, tt, rn, harmony_hybrid
458
+ * @supported weapp, swan, jd, qq, tt, rn, harmony_hybrid, harmony
459
459
  * @example
460
460
  * ```tsx
461
461
  * Taro.getLocation({
@@ -740,7 +740,11 @@ declare module '../../index' {
740
740
  * ```
741
741
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html
742
742
  */
743
- decodeAudioData(): AudioBuffer
743
+ decodeAudioData(
744
+ audioData: ArrayBuffer,
745
+ successCallback: (buffer: AudioBuffer) => void,
746
+ errorCallback: (error: any) => void
747
+ ): Promise<AudioBuffer>
744
748
  }
745
749
 
746
750
  namespace WebAudioContext {
@@ -442,7 +442,7 @@ declare module '../../index' {
442
442
  getVideoInfo(option: getVideoInfo.Option): Promise<getVideoInfo.SuccessCallbackResult>
443
443
 
444
444
  /** 创建 video 上下文 VideoContext 对象。
445
- * @supported weapp, h5, rn, harmony_hybrid
445
+ * @supported weapp, h5, rn, harmony_hybrid, harmony
446
446
  * @example
447
447
  * ```tsx
448
448
  * videoContext = Taro.createVideoContext('myVideo')
@@ -505,7 +505,7 @@ declare module '../../index' {
505
505
  chooseVideo(option: chooseVideo.Option): Promise<chooseVideo.SuccessCallbackResult>
506
506
 
507
507
  /** 拍摄或从手机相册中选择图片或视频。
508
- * @supported weapp, h5, harmony_hybrid
508
+ * @supported weapp, h5, harmony_hybrid, harmony
509
509
  * @example
510
510
  * ```tsx
511
511
  * Taro.chooseMedia({
@@ -320,7 +320,7 @@ declare module '../../index' {
320
320
  * @supported weapp
321
321
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.setEnable1v1Chat.html
322
322
  */
323
- setEnable1v1Chat(option: subscribeVoIPVideoMembers.Option): Promise<TaroGeneral.CallbackResult>
323
+ setEnable1v1Chat(option: setEnable1v1Chat.Option): Promise<TaroGeneral.CallbackResult>
324
324
  /** 监听实时语音通话成员视频状态变化事件
325
325
  * @supported weapp
326
326
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPVideoMembersChanged.html
@@ -373,7 +373,7 @@ declare module '../../index' {
373
373
  */
374
374
  offVoIPChatInterrupted(callback: onVoIPChatInterrupted.Callback): void
375
375
  /** 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html)
376
- *
376
+ *
377
377
  * 调用前需要用户授权 `scope.record`,若房间类型为视频房间需要用户授权 `scope.camera`。
378
378
  * @supported weapp
379
379
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html
@@ -151,7 +151,7 @@ declare module '../../index' {
151
151
  /** 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径,单次下载允许的最大文件为 50MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
152
152
  *
153
153
  * 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
154
- * @supported weapp, h5, alipay, swan, rn, tt, harmony_hybrid
154
+ * @supported weapp, h5, alipay, swan, rn, tt, harmony_hybrid, harmony
155
155
  * @example
156
156
  * ```tsx
157
157
  * Taro.downloadFile({
@@ -152,7 +152,7 @@ declare module '../../index' {
152
152
 
153
153
  interface TaroStatic {
154
154
  /** 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 `content-type` 为 `multipart/form-data`。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
155
- * @supported weapp, swan, alipay, h5, rn, tt, harmony_hybrid
155
+ * @supported weapp, swan, alipay, h5, rn, tt, harmony_hybrid, harmony
156
156
  * @example
157
157
  * ```tsx
158
158
  * Taro.chooseImage({
@@ -220,7 +220,7 @@ declare module '../../index' {
220
220
 
221
221
  interface TaroStatic {
222
222
  /** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
223
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
223
+ * @supported weapp, h5, rn, tt, harmony_hybrid
224
224
  * @example
225
225
  * ```json
226
226
  * {
@@ -310,7 +310,7 @@ declare module '../../index' {
310
310
  createBufferURL(
311
311
  /** 需要存入内存的二进制数据 */
312
312
  buffer: ArrayBuffer | TypedArray
313
- ): void
313
+ ): string
314
314
 
315
315
  /** Taro.clearStorage 的同步版本
316
316
  * @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
@@ -327,7 +327,7 @@ declare module '../../index' {
327
327
  clearStorageSync(): void
328
328
 
329
329
  /** 清理本地数据缓存
330
- * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
330
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
331
331
  * @example
332
332
  * ```tsx
333
333
  * Taro.clearStorage()
@@ -22,7 +22,7 @@ declare module '../index' {
22
22
  onShow: string
23
23
  preloadData?: Record<any, any>
24
24
  /**
25
- * RN 私有对象navigationRef,用于使用底层接口控制路由
25
+ * RN 私有对象 navigationRef,用于使用底层接口控制路由
26
26
  */
27
27
  rnNavigationRef?: React.RefObject<any>
28
28
  }
@@ -48,13 +48,14 @@ declare module '../index' {
48
48
  [TaroGeneral.ENV_TYPE.HARMONY]: TaroGeneral.ENV_TYPE.HARMONY
49
49
  [TaroGeneral.ENV_TYPE.QUICKAPP]: TaroGeneral.ENV_TYPE.QUICKAPP
50
50
  [TaroGeneral.ENV_TYPE.HARMONYHYBRID]: TaroGeneral.ENV_TYPE.HARMONYHYBRID
51
+ [TaroGeneral.ENV_TYPE.ASCF]: TaroGeneral.ENV_TYPE.ASCF
51
52
  }
52
53
 
53
54
  namespace interceptorify {
54
- type promiseifyApi<T, R> = (requestParams: T) => Promise<R>
55
+ type promisifyApi<T, R> = (requestParams: T) => Promise<R>
55
56
  interface InterceptorifyChain<T, R> {
56
57
  requestParams: T
57
- proceed: promiseifyApi<T, R>
58
+ proceed: promisifyApi<T, R>
58
59
  }
59
60
  type InterceptorifyInterceptor<T, R> = (chain: InterceptorifyChain<T, R>) => Promise<R>
60
61
  interface Interceptorify<T, R> {
@@ -111,7 +112,7 @@ declare module '../index' {
111
112
  mpVersion: string
112
113
  /** 小程序环境 */
113
114
  envType: string
114
- /** 小程序appId */
115
+ /** 小程序 appId */
115
116
  appId: string
116
117
  }
117
118
  /** 插件信息 */
@@ -120,7 +121,7 @@ declare module '../index' {
120
121
  common: {
121
122
  /** 用户数据存储的路径 */
122
123
  USER_DATA_PATH: string
123
- /** 校验白名单属性中的appInfoLaunchFrom后返回额外信息 */
124
+ /** 校验白名单属性中的 appInfoLaunchFrom 后返回额外信息 */
124
125
  location: string | undefined
125
126
  launchFrom: string | undefined
126
127
  schema: string | undefined
@@ -173,9 +174,9 @@ declare module '../index' {
173
174
  getRenderer(): 'webview' | 'skyline'
174
175
 
175
176
  /**
176
- * 包裹 promiseify api 的洋葱圈模型
177
+ * 包裹 promisify api 的洋葱圈模型
177
178
  * @supported global
178
- * @param promiseifyApi
179
+ * @param promisifyApi
179
180
  * @example
180
181
  * ```tsx
181
182
  * // 创建实例
@@ -227,6 +228,6 @@ declare module '../index' {
227
228
  * })
228
229
  * ```
229
230
  */
230
- interceptorify<T, R>(promiseifyApi: interceptorify.promiseifyApi<T, R>): interceptorify.Interceptorify<T, R>
231
+ interceptorify<T, R>(api: interceptorify.promisifyApi<T, R>): interceptorify.Interceptorify<T, R>
231
232
  }
232
233
  }
@@ -98,20 +98,20 @@ declare module '../index' {
98
98
 
99
99
  /**
100
100
  * 页面加载完成时的回调。
101
- * @supported weapp, h5, harmony_hybrid
101
+ * @supported weapp, h5, harmony_hybrid, harmony
102
102
  */
103
103
  useLoad<T extends {} = Record<string, any>>(callback: (param: T) => void): void
104
104
 
105
105
  /**
106
106
  * 页面卸载时的回调。
107
- * @supported weapp, h5, harmony_hybrid
107
+ * @supported weapp, h5, harmony_hybrid, harmony
108
108
  */
109
109
  useUnload(callback: () => void): void
110
110
 
111
111
  /**
112
112
  * 页面初次渲染完成的回调。
113
113
  * 此时页面已经准备妥当,可以和视图层进行交互。
114
- * @supported weapp, h5, harmony_hybrid
114
+ * @supported weapp, h5, harmony_hybrid, harmony
115
115
  */
116
116
  useReady(callback: () => void): void
117
117
 
@@ -133,6 +133,12 @@ declare module '../index' {
133
133
  */
134
134
  useOptionMenuClick(callback: () => void): void
135
135
 
136
+ /**
137
+ * 键盘高度变化时的回调。
138
+ * @supported alipay
139
+ */
140
+ useKeyboardHeight(callback: (payload: { height: number }) => void): void
141
+
136
142
  /**
137
143
  * 下拉中断时的回调。
138
144
  * @supported alipay, h5, harmony_hybrid
@@ -121,13 +121,13 @@ declare module '../../index' {
121
121
 
122
122
  interface TaroStatic {
123
123
  /** 显示 tabBar 某一项的右上角的红点
124
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
124
+ * @supported weapp, h5, rn, tt, harmony_hybrid
125
125
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html
126
126
  */
127
127
  showTabBarRedDot(option: showTabBarRedDot.Option): Promise<TaroGeneral.CallbackResult>
128
128
 
129
129
  /** 显示 tabBar
130
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
130
+ * @supported weapp, h5, rn, tt, harmony_hybrid
131
131
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html
132
132
  */
133
133
  showTabBar(option?: showTabBar.Option): Promise<TaroGeneral.CallbackResult>
@@ -148,7 +148,7 @@ declare module '../../index' {
148
148
  setTabBarStyle(option?: setTabBarStyle.Option): Promise<TaroGeneral.CallbackResult>
149
149
 
150
150
  /** 动态设置 tabBar 某一项的内容,`2.7.0` 起图片支持临时文件和网络文件。
151
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
151
+ * @supported weapp, h5, rn, tt, harmony_hybrid
152
152
  * @example
153
153
  * ```tsx
154
154
  * Taro.setTabBarItem({
@@ -163,7 +163,7 @@ declare module '../../index' {
163
163
  setTabBarItem(option: setTabBarItem.Option): Promise<TaroGeneral.CallbackResult>
164
164
 
165
165
  /** 为 tabBar 某一项的右上角添加文本
166
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
166
+ * @supported weapp, h5, rn, tt, harmony_hybrid
167
167
  * @example
168
168
  * ```tsx
169
169
  * Taro.setTabBarBadge({
@@ -176,19 +176,19 @@ declare module '../../index' {
176
176
  setTabBarBadge(option: setTabBarBadge.Option): Promise<TaroGeneral.CallbackResult>
177
177
 
178
178
  /** 移除 tabBar 某一项右上角的文本
179
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
179
+ * @supported weapp, h5, rn, tt, harmony_hybrid
180
180
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html
181
181
  */
182
182
  removeTabBarBadge(option: removeTabBarBadge.Option): Promise<TaroGeneral.CallbackResult>
183
183
 
184
184
  /** 隐藏 tabBar 某一项的右上角的红点
185
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
185
+ * @supported weapp, h5, rn, tt, harmony_hybrid
186
186
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html
187
187
  */
188
188
  hideTabBarRedDot(option: hideTabBarRedDot.Option): Promise<TaroGeneral.CallbackResult>
189
189
 
190
190
  /** 隐藏 tabBar
191
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
191
+ * @supported weapp, h5, rn, tt, harmony_hybrid
192
192
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html
193
193
  */
194
194
  hideTabBar(option?: hideTabBar.Option): Promise<TaroGeneral.CallbackResult>
@@ -6,6 +6,7 @@ import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
6
6
  import type { OutputOptions as RollupOutputOptions } from 'rollup'
7
7
  import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
8
8
  import type { OutputExt } from './project'
9
+ import type { ServerOptions as ViteServerOptions } from 'vite'
9
10
 
10
11
  export interface IH5RouterConfig {
11
12
  /** 配置路由模式 */
@@ -51,7 +52,8 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
51
52
  router?: IH5RouterConfig
52
53
 
53
54
  /** 预览服务的配置,可以更改端口等参数。具体配置参考 [webpack-dev-server](https://webpack.js.org/configuration/dev-server) */
54
- devServer?: webpackDevServer.Configuration
55
+ // 修改后:同时支持 Webpack 和 Vite
56
+ devServer?: T extends 'vite' ? ViteServerOptions : webpackDevServer.Configuration
55
57
 
56
58
  /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
57
59
  enableSourceMap?: boolean
@@ -9,6 +9,7 @@ import type { AppConfig, PageConfig } from '../index'
9
9
 
10
10
  export interface ViteNativeCompMeta {
11
11
  name: string
12
+ exportName: string
12
13
  scriptPath: string
13
14
  configPath: string
14
15
  config: PageConfig
@@ -16,6 +17,7 @@ export interface ViteNativeCompMeta {
16
17
  templatePath: string
17
18
  cssPath?: string
18
19
  isPackage?: boolean
20
+ isGenerated?: boolean
19
21
  }
20
22
 
21
23
  export interface ViteFileType {
@@ -57,6 +59,7 @@ export interface ViteHarmonyBuildConfig extends CommonBuildConfig, IHarmonyConfi
57
59
  runtimePath?: string | string[]
58
60
  isPure?: boolean
59
61
  taroComponentsPath: string
62
+ cssVariables?: boolean // 是否动态解析css变量
60
63
  }
61
64
 
62
65
  export interface CommonBuildConfig extends IProjectConfig<'vite'> {
@@ -109,6 +112,7 @@ export interface ViteCompilerContext<T> {
109
112
  configFileList: string[]
110
113
  compilePage: (pageName: string) => VitePageMeta
111
114
  watchConfigFile: (rollupCtx: PluginContext) => void
115
+ collectedDeps: (rollupCtx: PluginContext, id: string, filter, cache: Set<string> = new Set()) => Promise<Set<string>>
112
116
  getAppScriptPath: () => string
113
117
  getApp: () => ViteAppMeta
114
118
  getPages: () => VitePageMeta[]
@@ -140,7 +144,9 @@ export interface ViteHarmonyCompilerContext extends ViteCompilerContext<ViteHarm
140
144
  getCommonChunks: () => string[]
141
145
  modifyHarmonyConfig: (config: Partial<AppConfig>) => void
142
146
  modifyHostPackage: (deps?: Record<string, string>, devDeps?: Record<string, string>) => Exclude<IHarmonyConfig['ohPackage'], void>
143
- collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
147
+ resolvePageImportPath: (scriptPath: string, pageName: string) => string
148
+ collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => ViteNativeCompMeta[]
149
+ generateNativeComponent: (rollupCtx: PluginContext, meta: ViteNativeCompMeta, implicitlyLoadedAfterOneOf: string[] = []) => void
144
150
  getScriptPath: (filePath: string) => string
145
151
  getStylePath: (filePath: string) => string
146
152
  getConfigPath: (filePath: string) => string
@@ -151,7 +157,9 @@ export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBui
151
157
  commonChunks: string[]
152
158
  nativeComponents : Map<string, ViteNativeCompMeta>
153
159
  getCommonChunks: () => string[]
154
- collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
160
+ resolvePageImportPath: (scriptPath: string, pageName: string) => string
161
+ collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => ViteNativeCompMeta[]
162
+ generateNativeComponent: (rollupCtx: PluginContext, meta: ViteNativeCompMeta, implicitlyLoadedAfterOneOf: string[] = []) => void
155
163
  getScriptPath: (filePath: string) => string
156
164
  getTemplatePath: (filePath: string) => string
157
165
  getStylePath: (filePath: string) => string
package/types/global.d.ts CHANGED
@@ -410,6 +410,7 @@ declare namespace TaroGeneral {
410
410
 
411
411
  // ENV_TYPE
412
412
  enum ENV_TYPE {
413
+ ASCF = 'ASCF',
413
414
  WEAPP = 'WEAPP',
414
415
  SWAN = 'SWAN',
415
416
  ALIPAY = 'ALIPAY',
package/types/index.d.ts CHANGED
@@ -192,4 +192,5 @@ declare namespace Taro {
192
192
  declare global {
193
193
  const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
194
194
  const definePageConfig: (config: Taro.PageConfig) => Taro.Config
195
+ const importNativeComponent: <T> (path: string, name = '', exportName = 'default') => Awaited<T>
195
196
  }
@@ -45,6 +45,8 @@ declare module './index' {
45
45
  eh?(event: MpEvent): void
46
46
  onLoad(options: Record<string, unknown>): void
47
47
  onOptionMenuClick?(): void
48
+ /** 键盘高度变化时触发 @supported alipay */
49
+ onKeyboardHeight?(opt: { height: number; }): void
48
50
  onPageScroll?(opt: PageScrollObject): void
49
51
  onPopMenuClick?(): void
50
52
  onPullDownRefresh?(): void
@@ -193,7 +193,7 @@ declare module './index' {
193
193
  /** 页面自定义组件配置
194
194
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
195
195
  */
196
- usingComponents?: Record<string, string>
196
+ usingComponents?: Record<string, string | [string, string]>
197
197
  /** 指定使用升级后的 weui 样式
198
198
  * - v2: 可表明启用新版的组件样式
199
199
  * @default default
@@ -581,7 +581,7 @@ declare module './index' {
581
581
  desc: string
582
582
  /** 在该场景下打开小程序时跳转页面 */
583
583
  path: string
584
- }
584
+ }[]
585
585
  /** 定制化型服务商票据 */
586
586
  serviceProviderTicket?: string
587
587
  /** 半屏小程序 appId */