Skip to content

Commit 93a0b0d

Browse files
authored
refactor(types): sync components types
1 parent bee3753 commit 93a0b0d

File tree

6 files changed

+18
-8
lines changed

6 files changed

+18
-8
lines changed

docs/apis/network/request/request.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ sidebar_label: request
4949
| referrerStrategy | `keyof ReferrerStrategy` | `"querystring"` | 否 | referer 策略,用于控制当前请求 header 对象中 referer 字段格式。该参数默认值可通过 app.json 中的配置进行修改。<br />API 支持度: alipay 支付宝: 10.3.50+ APPX: 2.8.7 开发者工具: 3.5.1<br />[参考地址](https://opendocs.alipay.com/mini/api/owycmh#referrerStrategy%20%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E) |
5050
| success | `(result: SuccessCallbackResult<T>) => void` | | 否 | 接口调用成功的回调函数 |
5151
| fail | `(res: TaroGeneral.CallbackResult) => void` | | 否 | 接口调用失败的回调函数 |
52-
| complete | `(res: Partial<SuccessCallbackResult> & TaroGeneral.CallbackResult) => void` | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
52+
| complete | `(res: any) => void` | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
5353
| jsonp | string or boolean | `false` | 否 | 设置是否使用 jsonp 方式获取数据<br />API 支持度: h5 |
5454
| jsonpCache | `RequestCache` | | 否 | 设置 jsonp 请求 url 是否需要被缓存<br />API 支持度: h5 |
5555
| mode | `keyof CorsMode` | `"same-origin"` | 否 | 设置是否允许跨域请求<br />API 支持度: h5 |

packages/taro/types/compile/config/h5.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
119119

120120
/** Web 编译过程的相关配置 */
121121
compile?: {
122-
exclude?: (string | RegExp)[]
123-
include?: (string | RegExp)[]
122+
exclude?: any[]
123+
include?: any[]
124+
/** 对应 @rollup/plugin-babel 插件的 filter 配置。只在 vite 编译模式下有效 */
124125
filter?: (filename: string) => boolean
125126
}
126127
/** 生成的代码是否要兼容旧版浏览器,值为 true 时,会去读取 package.json 的 browserslist 字段。只在 vite 编译模式下有效 */

packages/taro/types/compile/config/mini.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
9191

9292
/** 小程序编译过程的相关配置 */
9393
compile?: {
94-
exclude?: (string | RegExp)[]
95-
include?: (string | RegExp)[]
94+
exclude?: any[]
95+
include?: any[]
96+
/** 对应 @rollup/plugin-babel 插件的 filter 配置。只在 vite 编译模式下有效 */
9697
filter?: (filename: string) => boolean
9798
}
9899

packages/taro/types/compile/viteCompilerContext.d.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import type { AppConfig, PageConfig } from '../index'
99

1010
export interface ViteNativeCompMeta {
1111
name: string
12+
exportName: string
1213
scriptPath: string
1314
configPath: string
1415
config: PageConfig
1516
isNative: true
1617
templatePath: string
1718
cssPath?: string
1819
isPackage?: boolean
20+
isGenerated?: boolean
1921
}
2022

2123
export interface ViteFileType {
@@ -109,6 +111,7 @@ export interface ViteCompilerContext<T> {
109111
configFileList: string[]
110112
compilePage: (pageName: string) => VitePageMeta
111113
watchConfigFile: (rollupCtx: PluginContext) => void
114+
collectedDeps: (rollupCtx: PluginContext, id: string, filter, cache: Set<string> = new Set()) => Promise<Set<string>>
112115
getAppScriptPath: () => string
113116
getApp: () => ViteAppMeta
114117
getPages: () => VitePageMeta[]
@@ -140,7 +143,9 @@ export interface ViteHarmonyCompilerContext extends ViteCompilerContext<ViteHarm
140143
getCommonChunks: () => string[]
141144
modifyHarmonyConfig: (config: Partial<AppConfig>) => void
142145
modifyHostPackage: (deps?: Record<string, string>, devDeps?: Record<string, string>) => Exclude<IHarmonyConfig['ohPackage'], void>
143-
collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
146+
resolvePageImportPath: (scriptPath: string, pageName: string) => string
147+
collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => ViteNativeCompMeta[]
148+
generateNativeComponent: (rollupCtx: PluginContext, meta: ViteNativeCompMeta, implicitlyLoadedAfterOneOf: string[] = []) => void
144149
getScriptPath: (filePath: string) => string
145150
getStylePath: (filePath: string) => string
146151
getConfigPath: (filePath: string) => string
@@ -151,7 +156,9 @@ export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBui
151156
commonChunks: string[]
152157
nativeComponents : Map<string, ViteNativeCompMeta>
153158
getCommonChunks: () => string[]
154-
collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
159+
resolvePageImportPath: (scriptPath: string, pageName: string) => string
160+
collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => ViteNativeCompMeta[]
161+
generateNativeComponent: (rollupCtx: PluginContext, meta: ViteNativeCompMeta, implicitlyLoadedAfterOneOf: string[] = []) => void
155162
getScriptPath: (filePath: string) => string
156163
getTemplatePath: (filePath: string) => string
157164
getStylePath: (filePath: string) => string

packages/taro/types/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,5 @@ declare namespace Taro {
192192
declare global {
193193
const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
194194
const definePageConfig: (config: Taro.PageConfig) => Taro.Config
195+
const importNativeComponent: <T> (path: string, name = '', exportName = 'default') => Awaited<T>
195196
}

packages/taro/types/taro.config.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ declare module './index' {
193193
/** 页面自定义组件配置
194194
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
195195
*/
196-
usingComponents?: Record<string, string>
196+
usingComponents?: Record<string, string | [string, string]>
197197
/** 指定使用升级后的 weui 样式
198198
* - v2: 可表明启用新版的组件样式
199199
* @default default

0 commit comments

Comments
 (0)