@tarojs/taro 4.0.1-alpha.0 → 4.0.1

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.
Files changed (38) hide show
  1. package/package.json +16 -40
  2. package/types/api/base/env.d.ts +1 -1
  3. package/types/api/base/system.d.ts +2 -2
  4. package/types/api/base/weapp/app-event.d.ts +4 -4
  5. package/types/api/device/accelerometer.d.ts +4 -4
  6. package/types/api/device/battery.d.ts +2 -2
  7. package/types/api/device/clipboard.d.ts +14 -14
  8. package/types/api/device/keyboard.d.ts +2 -2
  9. package/types/api/device/network.d.ts +3 -3
  10. package/types/api/device/phone.d.ts +1 -1
  11. package/types/api/device/screen.d.ts +2 -2
  12. package/types/api/device/vibrate.d.ts +2 -2
  13. package/types/api/media/image.d.ts +2 -2
  14. package/types/api/network/request.d.ts +1 -1
  15. package/types/api/route/index.d.ts +5 -5
  16. package/types/api/storage/index.d.ts +4 -4
  17. package/types/api/swan/pay.d.ts +4 -4
  18. package/types/api/taro.extend.d.ts +3 -5
  19. package/types/api/ui/animation.d.ts +1 -1
  20. package/types/api/ui/interaction.d.ts +3 -3
  21. package/types/api/ui/navigation-bar.d.ts +5 -5
  22. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  23. package/types/api/ui/scroll.d.ts +1 -1
  24. package/types/api/ui/tab-bar.d.ts +7 -7
  25. package/types/api/wxml/index.d.ts +9 -15
  26. package/types/compile/compiler.d.ts +4 -9
  27. package/types/compile/config/h5.d.ts +10 -23
  28. package/types/compile/config/index.d.ts +0 -1
  29. package/types/compile/config/mini.d.ts +24 -29
  30. package/types/compile/config/project.d.ts +21 -49
  31. package/types/compile/config/util.d.ts +7 -21
  32. package/types/compile/index.d.ts +0 -8
  33. package/types/index.d.ts +1 -0
  34. package/types/taro.component.d.ts +0 -1
  35. package/types/taro.config.d.ts +0 -5
  36. package/types/compile/config/harmony.d.ts +0 -118
  37. package/types/compile/config/plugin.d.ts +0 -34
  38. package/types/compile/viteCompilerContext.d.ts +0 -159
@@ -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>
@@ -66,25 +66,19 @@ declare module '../../index' {
66
66
  }
67
67
 
68
68
  namespace IntersectionObserver {
69
- /** 监听相交状态变化的回调函数
70
- * @description Harmony 找不到对应元素时,回调会返回一个 Error 对象
71
- */
69
+ /** 监听相交状态变化的回调函数 */
72
70
  type ObserveCallback = (result: ObserveCallbackResult) => void
73
- interface ObserveCallbackResult extends TaroGeneral.CallbackResult {
74
- /** 错误信息,会在找不到对应元素时返回
75
- * @supported harmony
76
- */
77
- errMsg?: string
71
+ interface ObserveCallbackResult {
78
72
  /** 目标边界 */
79
- boundingClientRect?: BoundingClientRectResult
73
+ boundingClientRect: BoundingClientRectResult
80
74
  /** 相交比例 */
81
- intersectionRatio?: number
75
+ intersectionRatio: number
82
76
  /** 相交区域的边界 */
83
- intersectionRect?: IntersectionRectResult
77
+ intersectionRect: IntersectionRectResult
84
78
  /** 参照区域的边界 */
85
- relativeRect?: RelativeRectResult
79
+ relativeRect: RelativeRectResult
86
80
  /** 相交检测时的时间戳 */
87
- time?: number
81
+ time: number
88
82
  }
89
83
  /** 参照区域的边界 */
90
84
  interface RelativeRectResult {
@@ -490,7 +484,7 @@ declare module '../../index' {
490
484
 
491
485
  interface TaroStatic {
492
486
  /** 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
493
- * @supported weapp, h5, tt, harmony, harmony_hybrid
487
+ * @supported weapp, h5, tt, harmony_hybrid
494
488
  * @example
495
489
  * ```tsx
496
490
  * const query = Taro.createSelectorQuery()
@@ -506,7 +500,7 @@ declare module '../../index' {
506
500
  createSelectorQuery(): SelectorQuery
507
501
 
508
502
  /** 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。
509
- * @supported weapp, h5, tt, harmony, harmony_hybrid
503
+ * @supported weapp, h5, tt, harmony_hybrid
510
504
  * @example
511
505
  * ```tsx
512
506
  * const observer = Taro.createIntersectionObserver(this, { thresholds: [0], observeAll: true })
@@ -1,11 +1,7 @@
1
1
  import type { swc } from '@tarojs/helper'
2
2
  import type Webpack from 'webpack'
3
3
 
4
- export type CompilerViteTypes = 'vite'
5
-
6
- export type CompilerWebpackTypes = 'webpack5'
7
-
8
- export type CompilerTypes = CompilerWebpackTypes | CompilerViteTypes
4
+ type CompilerTypes = 'webpack4' | 'webpack5'
9
5
 
10
6
  interface IPrebundle {
11
7
  enable?: boolean
@@ -21,12 +17,11 @@ interface IPrebundle {
21
17
  }
22
18
  }
23
19
 
24
- interface ICompiler<T> {
25
- type: T
20
+ interface ICompiler {
21
+ type: CompilerTypes
26
22
  prebundle?: IPrebundle
27
- vitePlugins?: any
28
23
  /** 错误处理级别。可选值:0、1 */
29
24
  errorLevel?: number
30
25
  }
31
26
 
32
- export type Compiler<T extends CompilerTypes = CompilerWebpackTypes> = T | ICompiler<T>
27
+ export type Compiler = CompilerTypes | ICompiler
@@ -2,10 +2,7 @@ import type Webpack from 'webpack'
2
2
  import type Chain from 'webpack-chain'
3
3
  import type webpackDevServer from 'webpack-dev-server'
4
4
  import type HtmlWebpackPlugin from 'html-webpack-plugin'
5
- import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
6
- import type { OutputOptions as RollupOutputOptions } from 'rollup'
7
- import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
8
- import type { OutputExt } from './project'
5
+ import type { IOption, IPostcssOption } from './util'
9
6
 
10
7
  export interface IH5RouterConfig {
11
8
  /** 配置路由模式 */
@@ -21,7 +18,7 @@ export interface IH5RouterConfig {
21
18
  enhanceAnimation?: boolean
22
19
  }
23
20
 
24
- export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
21
+ export interface IH5Config {
25
22
  /** 设置输出解析文件的目录(默认值:'/')*/
26
23
  publicPath?: string
27
24
 
@@ -40,12 +37,8 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
40
37
  */
41
38
  webpackChain?: (chain: Chain, webpack: typeof Webpack) => void
42
39
 
43
- /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
44
- * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
45
- */
46
- output?: T extends 'vite'
47
- ? Pick<RollupOutputOptions, 'chunkFileNames' | 'assetFileNames'> & OutputExt
48
- : Webpack.Configuration['output']
40
+ /** 可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/) */
41
+ output?: Webpack.Configuration['output']
49
42
 
50
43
  /** 路由相关的配置 */
51
44
  router?: IH5RouterConfig
@@ -91,13 +84,13 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
91
84
  stylusLoaderOption?: IOption
92
85
 
93
86
  /** 针对 mp4 | webm | ogg | mp3 | wav | flac | aac 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
94
- mediaUrlLoaderOption?: IUrlLoaderOption
87
+ mediaUrlLoaderOption?: IOption
95
88
 
96
89
  /** 针对 woff | woff2 | eot | ttf | otf 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
97
- fontUrlLoaderOption?: IUrlLoaderOption
90
+ fontUrlLoaderOption?: IOption
98
91
 
99
92
  /** 针对 png | jpg | jpeg | gif | bpm | svg 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
100
- imageUrlLoaderOption?: IUrlLoaderOption
93
+ imageUrlLoaderOption?: IOption
101
94
 
102
95
  /** [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) 的附加配置 */
103
96
  miniCssExtractPluginOption?: IOption
@@ -112,20 +105,14 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
112
105
  useDeprecatedAdapterComponent?: boolean
113
106
 
114
107
  /** 配置 postcss 相关插件 */
115
- postcss?: IPostcssOption<'h5'>
108
+ postcss?: IPostcssOption
116
109
 
117
110
  /** html-webpack-plugin 的具体配置 */
118
111
  htmlPluginOption?: HtmlWebpackPlugin.Options
119
112
 
120
113
  /** Web 编译过程的相关配置 */
121
114
  compile?: {
122
- exclude?: (string | RegExp)[]
123
- include?: (string | RegExp)[]
124
- filter?: (filename: string) => boolean
115
+ exclude?: any[]
116
+ include?: any[]
125
117
  }
126
- /** 生成的代码是否要兼容旧版浏览器,值为 true 时,会去读取 package.json 的 browserslist 字段。只在 vite 编译模式下有效 */
127
- legacy?: T extends 'vite' ? boolean : undefined
128
-
129
- /** 使用的编译工具。可选值:webpack5、vite */
130
- compiler?: Compiler<T>
131
118
  }
@@ -1,5 +1,4 @@
1
1
  export * from './h5'
2
- export * from './harmony'
3
2
  export * from './mini'
4
3
  export * from './rn'
5
4
 
@@ -1,9 +1,6 @@
1
1
  import type Webpack from 'webpack'
2
2
  import type Chain from 'webpack-chain'
3
- import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
4
- import type { OutputOptions as RollupOutputOptions } from 'rollup'
5
- import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
6
- import type { OutputExt } from './project'
3
+ import type { IOption, IPostcssOption } from './util'
7
4
 
8
5
  interface Runtime {
9
6
  enableInnerHTML?: boolean
@@ -15,7 +12,7 @@ interface Runtime {
15
12
  enableMutationObserver?: boolean
16
13
  }
17
14
 
18
- export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes> {
15
+ export interface IMiniAppConfig {
19
16
  /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
20
17
  enableSourceMap?: boolean
21
18
 
@@ -43,15 +40,24 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
43
40
  */
44
41
  webpackChain?: (chain: Chain, webpack: typeof Webpack, PARSE_AST_TYPE: any) => void
45
42
 
46
- /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
47
- * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
48
- */
49
- output?: T extends 'vite'
50
- ? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
51
- : Webpack.Configuration['output'] & OutputExt
43
+ /** 可用于修改、拓展 Webpack 的 [output](https://webpack.js.org/configuration/output/) 选项 */
44
+ output?: Webpack.Configuration['output'] & {
45
+ /**
46
+ * 编译前清空输出目录
47
+ * @since Taro v3.6.9
48
+ * @description
49
+ * - 默认清空输出目录,可设置 clean: false 不清空
50
+ * - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件
51
+ * - 注意 clean.keep 不支持函数
52
+ */
53
+ clean?: boolean | {
54
+ /** 保留指定文件不删除 */
55
+ keep?: Array<string | RegExp> | string | RegExp
56
+ }
57
+ }
52
58
 
53
59
  /** 配置 postcss 相关插件 */
54
- postcss?: IPostcssOption<'mini'>
60
+ postcss?: IPostcssOption
55
61
 
56
62
  /** [css-loader](https://github.com/webpack-contrib/css-loader) 的附加配置 */
57
63
  cssLoaderOption?: IOption
@@ -66,13 +72,13 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
66
72
  stylusLoaderOption?: IOption
67
73
 
68
74
  /** 针对 mp4 | webm | ogg | mp3 | wav | flac | aac 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
69
- mediaUrlLoaderOption?: IUrlLoaderOption
75
+ mediaUrlLoaderOption?: IOption
70
76
 
71
77
  /** 针对 woff | woff2 | eot | ttf | otf 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
72
- fontUrlLoaderOption?: IUrlLoaderOption
78
+ fontUrlLoaderOption?: IOption
73
79
 
74
80
  /** 针对 png | jpg | jpeg | gif | bpm | svg 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
75
- imageUrlLoaderOption?: IUrlLoaderOption
81
+ imageUrlLoaderOption?: IOption
76
82
 
77
83
  /** [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) 的附加配置 */
78
84
  miniCssExtractPluginOption?: IOption
@@ -91,27 +97,16 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
91
97
 
92
98
  /** 小程序编译过程的相关配置 */
93
99
  compile?: {
94
- exclude?: (string | RegExp)[]
95
- include?: (string | RegExp)[]
96
- filter?: (filename: string) => boolean
100
+ exclude?: any[]
101
+ include?: any[]
97
102
  }
98
103
 
99
104
  /** 插件内部使用 */
100
105
  runtime?: Runtime
101
106
 
102
- /** 使用的编译工具。可选值:webpack5、vite */
103
- compiler?: Compiler<T>
104
-
105
107
  /** 体验式功能 */
106
108
  experimental?: {
107
109
  /** 是否开启编译模式 */
108
- compileMode?: boolean | string
109
- }
110
- }
111
-
112
- export interface IMiniFilesConfig {
113
- [configName: string]: {
114
- content: any
115
- path: string
110
+ compileMode?: boolean
116
111
  }
117
112
  }
@@ -1,14 +1,13 @@
1
1
  import type Webpack from 'webpack'
2
2
  import type Chain from 'webpack-chain'
3
- import type { Input } from 'postcss'
4
- import type { AppConfig } from '../../index'
5
- import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
3
+ import { type Input } from 'postcss'
4
+ import type { Compiler } from '../compiler'
6
5
  import type { IModifyChainData } from '../hooks'
7
6
  import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from './util'
8
7
  import type { IH5Config } from './h5'
9
- import type { IHarmonyConfig } from './harmony'
10
- import type { IMiniAppConfig, IMiniFilesConfig } from './mini'
11
- import type { IRNConfig } from './rn'
8
+ import type { IMiniAppConfig } from './mini'
9
+ import { IRNConfig } from './rn'
10
+ import { AppConfig } from '../..'
12
11
 
13
12
  export type PluginItem<T = object> = string | [string, T] | [string, () => T | Promise<T>]
14
13
 
@@ -116,7 +115,7 @@ export interface IProjectBaseConfig {
116
115
  jsMinimizer?: 'terser' | 'esbuild'
117
116
 
118
117
  /** 配置 CSS 压缩工具 (默认 csso) */
119
- cssMinimizer?: 'csso' | 'esbuild' | 'lightningcss'
118
+ cssMinimizer?: 'csso' | 'esbuild' | 'parcelCss'
120
119
 
121
120
  /** 配置 csso 工具以压缩 CSS 代码 */
122
121
  csso?: TogglableOptions
@@ -140,11 +139,11 @@ export interface IProjectBaseConfig {
140
139
  /** 模板循环次数 */
141
140
  baseLevel?: number
142
141
 
143
- /** 使用的开发框架。可选值:react、preact、vue3 */
144
- framework?: 'react' | 'preact' | 'solid' | 'vue3'
142
+ /** 使用的开发框架。可选值:react、preact、nerv、vue、vue3 */
143
+ framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
145
144
  frameworkExts?: string[]
146
145
 
147
- /** 使用的编译工具。可选值:webpack5 */
146
+ /** 使用的编译工具。可选值:webpack4、webpack5 */
148
147
  compiler?: Compiler
149
148
 
150
149
  /** Webpack5 持久化缓存配置。具体配置请参考 [WebpackConfig.cache](https://webpack.js.org/configuration/cache/#cache) */
@@ -186,28 +185,18 @@ export interface IProjectBaseConfig {
186
185
  modifyWebpackChain?: (chain: Chain, webpack: typeof Webpack, data: IModifyChainData) => Promise<any>
187
186
 
188
187
  /**
189
- * 编译中修改 vite 配置
188
+ * 修改编译过程中的页面组件配置
190
189
  */
191
- modifyViteConfig?: (viteConfig: any, data: IModifyChainData) => void
190
+ modifyMiniConfigs?: (configMap: any) => Promise<any>
192
191
 
193
192
  /**
194
193
  * 修改编译后的结果
195
194
  */
196
195
  modifyBuildAssets?: (assets: any, miniPlugin?: any) => Promise<any>
197
-
198
- /**
199
- * 修改编译过程中的页面组件配置
200
- */
201
- modifyMiniConfigs?: (configMap: IMiniFilesConfig) => Promise<any>
202
-
203
- /**
204
- * 修改 Taro 编译配置
205
- */
206
- modifyRunnerOpts?: (opts: any) => Promise<any>
207
196
  }
208
197
 
209
198
  /** 暴露出来给 config/index 使用的配置类型,参考 https://github.com/NervJS/taro-doctor/blob/main/assets/config_schema.json */
210
- export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes> {
199
+ export interface IProjectConfig {
211
200
  /** 项目名称 */
212
201
  projectName?: string
213
202
 
@@ -277,7 +266,7 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
277
266
  jsMinimizer?: 'terser' | 'esbuild'
278
267
 
279
268
  /** 配置 CSS 压缩工具 (默认 csso) */
280
- cssMinimizer?: 'csso' | 'esbuild' | 'lightningcss'
269
+ cssMinimizer?: 'csso' | 'esbuild' | 'parcelCss'
281
270
 
282
271
  /** 配置 csso 工具以压缩 CSS 代码 */
283
272
  csso?: TogglableOptions
@@ -296,8 +285,11 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
296
285
  /** 一个 preset 是一系列 Taro 插件的集合,配置语法同 plugins */
297
286
  presets?: PluginItem[]
298
287
 
299
- /** 使用的开发框架。可选值:react、preact、solid、vue3 none */
300
- framework?: 'react' | 'preact' | 'solid' | 'vue3' | 'none'
288
+ /** 使用的开发框架。可选值:react、preact、nervvue、vue3 */
289
+ framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
290
+
291
+ /** 使用的编译工具。可选值:webpack4、webpack5 */
292
+ compiler?: Compiler
301
293
 
302
294
  /** Webpack5 持久化缓存配置。具体配置请参考 [WebpackConfig.cache](https://webpack.js.org/configuration/cache/#cache) */
303
295
  cache?: ICache
@@ -305,34 +297,14 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
305
297
  /** 控制 Taro 编译日志的输出方式 */
306
298
  logger?: ILogger
307
299
 
308
- /** 使用的编译工具。可选值:webpack5、vite */
309
- compiler?: Compiler<T>
300
+ /** 专属于小程序的配置 */
301
+ mini?: IMiniAppConfig
310
302
 
311
303
  /** 专属于 H5 的配置 */
312
- h5?: IH5Config<T>
313
-
314
- /** 专属于小程序的配置 */
315
- mini?: IMiniAppConfig<T>
304
+ h5?: IH5Config
316
305
 
317
306
  /** 专属于 RN 的配置 */
318
307
  rn?: IRNConfig
319
308
 
320
- harmony?: IHarmonyConfig<T>
321
-
322
309
  [key: string]: any
323
310
  }
324
-
325
- export interface OutputExt {
326
- /**
327
- * 编译前清空输出目录
328
- * @since Taro v3.6.9
329
- * @description
330
- * - 默认清空输出目录,可设置 clean: false 不清空
331
- * - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件
332
- * - 注意 clean.keep 不支持函数
333
- */
334
- clean?: boolean | {
335
- /** 保留指定文件不删除 */
336
- keep?: Array<string | RegExp> | string | RegExp
337
- }
338
- }
@@ -1,5 +1,4 @@
1
- import type { Input } from 'postcss'
2
- import type { Options as PostcssUrlOption } from 'postcss-url'
1
+ import { type Input } from 'postcss'
3
2
 
4
3
  export type Func = (...args: any[]) => any
5
4
 
@@ -10,11 +9,6 @@ export type TogglableOptions<T = IOption> = {
10
9
  config?: T
11
10
  }
12
11
 
13
- export interface IUrlLoaderOption extends IOption {
14
- limit?: number | boolean
15
- name?: ((moduleId: string) => string) | string
16
- }
17
-
18
12
  export namespace PostcssOption {
19
13
  export type cssModules = TogglableOptions<{
20
14
  /** 转换模式,取值为 global/module */
@@ -22,7 +16,10 @@ export namespace PostcssOption {
22
16
  /** 自定义生成的class名称规则 */
23
17
  generateScopedName: string | ((localName: string, absoluteFilePath: string) => string)
24
18
  }>
25
- export type url = TogglableOptions<PostcssUrlOption>
19
+ export type url = TogglableOptions<{
20
+ limit: number
21
+ basePath?: string | string[]
22
+ }>
26
23
  }
27
24
 
28
25
  export interface IHtmlTransformOption {
@@ -75,29 +72,18 @@ export interface IPxTransformOption {
75
72
  designWidth?: number | ((size?: string | number | Input) => number)
76
73
  /** 设计稿尺寸换算规则 */
77
74
  deviceRatio?: TaroGeneral.TDeviceRatio
78
- /** 平台 */
79
- platform?: 'weapp' | 'h5' | string
80
- /** 启用的能力 Scope 默认为 ['platform', 'size'] */
81
- methods?: string[]
82
- /** filter 回调函数,可 exclude 不处理的文件 */
83
- exclude?: (fileName: string) => boolean
84
75
  }
85
76
 
86
- interface IBasePostcssOption {
77
+ export interface IPostcssOption {
87
78
  autoprefixer?: TogglableOptions
88
79
  pxtransform?: TogglableOptions<IPxTransformOption>
89
80
  cssModules?: PostcssOption.cssModules
81
+ url?: PostcssOption.url
90
82
  /** 插件 postcss-html-transform 相关配置, 一般启用了 @tarojs/plugin-html 插件才配置 */
91
83
  htmltransform?: IHtmlTransformOption
92
84
  [key: string]: any
93
85
  }
94
86
 
95
- export type IPostcssOption<T = 'h5' | 'harmony' | 'mini'> = T extends 'h5'
96
- ? IBasePostcssOption & { url?: PostcssOption.url }
97
- : IBasePostcssOption
98
-
99
- export type Config = ViteConfig | WebpackConfig
100
-
101
87
  export interface ICopyOptions {
102
88
  patterns: {
103
89
  from: string
@@ -1,11 +1,3 @@
1
1
  export { Current } from '@tarojs/runtime'
2
2
 
3
- export interface IFileType {
4
- style: string
5
- script: string
6
- templ: string
7
- config: string
8
- xs?: string
9
- }
10
-
11
3
  export * from './config'
package/types/index.d.ts CHANGED
@@ -187,6 +187,7 @@ export as namespace Taro
187
187
  declare const Taro: Taro.TaroStatic
188
188
 
189
189
  declare namespace Taro {
190
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
190
191
  interface TaroStatic {}
191
192
  }
192
193
  declare global {
@@ -19,7 +19,6 @@ declare module './index' {
19
19
  shareTicket: string | undefined
20
20
  scene: number | undefined
21
21
  exitState?: any
22
- $taroPath?: string
23
22
  }
24
23
 
25
24
  interface Show {
@@ -32,11 +32,6 @@ declare module './index' {
32
32
  * @default: "#ffffff"
33
33
  */
34
34
  backgroundColor?: string
35
- /** 页面容器背景色, HexColor
36
- * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/custom-route.html#%E8%AE%BE%E7%BD%AE%E9%A1%B5%E9%9D%A2%E9%80%8F%E6%98%8E
37
- * @default: "#ffffff"
38
- */
39
- backgroundColorContent?: string
40
35
  /** 下拉背景字体、loading 图的样式,仅支持 dark/light
41
36
  * 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
42
37
  * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html