@tarojs/taro 4.0.0-beta.11 → 4.0.0-beta.110

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,8 +1,9 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "4.0.0-beta.11",
3
+ "version": "4.0.0-beta.110",
4
4
  "description": "Taro framework",
5
- "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
5
+ "author": "O2Team",
6
+ "license": "MIT",
6
7
  "main": "index.js",
7
8
  "typings": "types/index.d.ts",
8
9
  "files": [
@@ -18,45 +19,60 @@
18
19
  "keywords": [
19
20
  "taro"
20
21
  ],
21
- "author": "O2Team",
22
- "license": "MIT",
22
+ "engines": {
23
+ "node": ">= 18"
24
+ },
23
25
  "dependencies": {
24
- "@tarojs/api": "4.0.0-beta.11"
26
+ "@types/postcss-url": "^10.0.4",
27
+ "@tarojs/api": "4.0.0-beta.110",
28
+ "@tarojs/runtime": "4.0.0-beta.110"
25
29
  },
26
30
  "devDependencies": {
27
- "@tarojs/helper": "4.0.0-beta.11",
28
- "@tarojs/shared": "4.0.0-beta.11",
29
- "@tarojs/runtime": "4.0.0-beta.11"
31
+ "@types/react": "^18.3.1",
32
+ "html-webpack-plugin": "^5.6.0",
33
+ "postcss": "^8.4.38",
34
+ "webpack": "5.91.0",
35
+ "webpack-chain": "^6.5.1",
36
+ "webpack-dev-server": "^4.15.2",
37
+ "rollup": "^3.29.4",
38
+ "@tarojs/helper": "4.0.0-beta.110",
39
+ "@tarojs/shared": "4.0.0-beta.110",
40
+ "@tarojs/components": "4.0.0-beta.110"
30
41
  },
31
42
  "peerDependencies": {
32
- "@tarojs/helper": "~4.0.0-beta.11",
33
- "@tarojs/shared": "~4.0.0-beta.11",
34
- "@tarojs/runtime": "~4.0.0-beta.11"
43
+ "@types/react": "^18",
44
+ "html-webpack-plugin": "^5",
45
+ "rollup": "^3",
46
+ "postcss": "^8",
47
+ "vue": "^3",
48
+ "webpack": "^5",
49
+ "webpack-chain": "^6",
50
+ "webpack-dev-server": "^4",
51
+ "@tarojs/components": "4.0.0-beta.110",
52
+ "@tarojs/helper": "4.0.0-beta.110",
53
+ "@tarojs/shared": "4.0.0-beta.110"
35
54
  },
36
55
  "peerDependenciesMeta": {
37
56
  "@types/react": {
38
57
  "optional": true
39
58
  },
40
- "@types/webpack": {
59
+ "html-webpack-plugin": {
41
60
  "optional": true
42
61
  },
43
- "@types/webpack-dev-server": {
62
+ "rollup": {
44
63
  "optional": true
45
64
  },
46
- "@types/postcss-url": {
65
+ "vue": {
47
66
  "optional": true
48
67
  },
49
- "postcss": {
68
+ "webpack": {
50
69
  "optional": true
51
70
  },
52
- "vue": {
71
+ "webpack-chain": {
53
72
  "optional": true
54
73
  },
55
- "rollup": {
74
+ "webpack-dev-server": {
56
75
  "optional": true
57
76
  }
58
- },
59
- "scripts": {
60
- "test": "echo \"Error: run tests from root\" && exit 1"
61
77
  }
62
78
  }
@@ -9,7 +9,7 @@ declare module '../../index' {
9
9
  env: {
10
10
  [key: string]: string | undefined
11
11
  /** 框架 */
12
- FRAMEWORK: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
12
+ FRAMEWORK: 'react' | 'preact' | 'solid' | 'vue3'
13
13
  /** Taro 环境变量 */
14
14
  TARO_ENV: 'weapp' | 'h5' | 'rn' | 'swan' | 'alipay' | 'tt' | 'qq' | 'jd' | 'quickapp'
15
15
  /** 文件系统中的用户目录路径 (本地路径) */
@@ -191,7 +191,7 @@ declare module '../../index' {
191
191
  src: string
192
192
  }
193
193
  interface Option {
194
- data: AssetsObjectType[]
194
+ data: AssetsObject[]
195
195
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
196
196
  complete?: (res: TaroGeneral.CallbackResult) => void
197
197
  /** 接口调用失败的回调函数 */
@@ -315,10 +315,10 @@ declare module '../../index' {
315
315
  '4:5'
316
316
  /** 宽高比为5比4 */
317
317
  '5:4'
318
- /** 宽高比为619 */
319
- '6:19'
320
- /** 宽高比为196 */
321
- '19:6'
318
+ /** 宽高比为916 */
319
+ '9:16'
320
+ /** 宽高比为169 */
321
+ '16:9'
322
322
  }
323
323
  }
324
324
 
@@ -78,7 +78,7 @@ declare module '../../index' {
78
78
  /** 接口调用失败的回调函数 */
79
79
  fail?: (res: TaroGeneral.CallbackResult) => void
80
80
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
81
- complete?: (res: TaroGeneral.CallbackResult) => void
81
+ complete?: (res: Partial<SuccessCallbackResult> & TaroGeneral.CallbackResult) => void
82
82
  /** 设置是否使用 jsonp 方式获取数据
83
83
  * @default false
84
84
  * @supported h5
@@ -256,7 +256,7 @@ declare module '../../index' {
256
256
  ): T
257
257
 
258
258
  /** Taro.getStorageInfo 的同步版本
259
- * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
259
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
260
260
  * @example
261
261
  * ```tsx
262
262
  * try {
@@ -1,4 +1,4 @@
1
- import { Interface } from 'readline'
1
+ import { Interface } from 'node:readline'
2
2
  import Taro from '../../index'
3
3
 
4
4
  declare module '../../index' {
@@ -117,12 +117,12 @@ declare module '../../index' {
117
117
  }
118
118
 
119
119
  interface TaroStatic {
120
- /**
120
+ /**
121
121
  * 1)百度收银台,聚合了主流的百度钱包、微信、支付宝、网银等多种支付渠道,方便开发者一站式快速接入多种支付渠道,让百度用户能在智能小程序场景下,直接完成支付、交易闭环,提升用户支付体验的同时,提高智能小程序的订单转化率。
122
122
  * 2)上述支付渠道在 C 端收银台有两种展示方式,开发者可以选择其中一种实现。
123
123
  * 方式一:将支付渠道内嵌在小程序提单页面中,实现方式参考文档[inline-payment-panel内嵌支付组件](https://smartprogram.baidu.com/docs/develop/component/inline_payment_panel/)。
124
124
  * 方式二:在用户确认订单后,调起收银台半屏面板承载支付渠道,实现方式参考文档调起[百度收银台](https://smartprogram.baidu.com/docs/develop/function/tune_up_2.0/#%E7%99%BE%E5%BA%A6%E6%94%B6%E9%93%B6%E5%8F%B0%E6%8E%A5%E5%8F%A32-0-%E8%AF%B4%E6%98%8E)。
125
- *
125
+ *
126
126
  * Web 态说明:为了保证用户交易行为全流程闭环体验,在 Web 态下调用该方法会做打开百度 App 对应小程序页面的降级处理。
127
127
  * @supported swan
128
128
  * @see https://smartprogram.baidu.com/docs/develop/api/open/payment_swan-requestPolymerPayment/
@@ -136,4 +136,4 @@ declare module '../../index' {
136
136
  */
137
137
  getOptimalPriceInfo(option: getOptimalPriceInfo.Option): void
138
138
  }
139
- }
139
+ }
@@ -238,7 +238,7 @@ declare module '../../index' {
238
238
  showActionSheet(option: showActionSheet.Option): Promise<showActionSheet.SuccessCallbackResult>
239
239
 
240
240
  /** 隐藏消息提示框
241
- * @supported weapp, h5, rn, tt, harmony, harmony_hybrid
241
+ * @supported weapp, h5, rn, tt, harmony_hybrid
242
242
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html
243
243
  */
244
244
  hideToast(option?: hideToast.Option): void
@@ -66,19 +66,25 @@ declare module '../../index' {
66
66
  }
67
67
 
68
68
  namespace IntersectionObserver {
69
- /** 监听相交状态变化的回调函数 */
69
+ /** 监听相交状态变化的回调函数
70
+ * @description Harmony 找不到对应元素时,回调会返回一个 Error 对象
71
+ */
70
72
  type ObserveCallback = (result: ObserveCallbackResult) => void
71
- interface ObserveCallbackResult {
73
+ interface ObserveCallbackResult extends TaroGeneral.CallbackResult {
74
+ /** 错误信息,会在找不到对应元素时返回
75
+ * @supported harmony
76
+ */
77
+ errMsg?: string
72
78
  /** 目标边界 */
73
- boundingClientRect: BoundingClientRectResult
79
+ boundingClientRect?: BoundingClientRectResult
74
80
  /** 相交比例 */
75
- intersectionRatio: number
81
+ intersectionRatio?: number
76
82
  /** 相交区域的边界 */
77
- intersectionRect: IntersectionRectResult
83
+ intersectionRect?: IntersectionRectResult
78
84
  /** 参照区域的边界 */
79
- relativeRect: RelativeRectResult
85
+ relativeRect?: RelativeRectResult
80
86
  /** 相交检测时的时间戳 */
81
- time: number
87
+ time?: number
82
88
  }
83
89
  /** 参照区域的边界 */
84
90
  interface RelativeRectResult {
@@ -1,9 +1,11 @@
1
1
  import type { swc } from '@tarojs/helper'
2
2
  import type Webpack from 'webpack'
3
3
 
4
- export type CompilerTypes = CompilerWebpackTypes | 'vite'
4
+ export type CompilerViteTypes = 'vite'
5
5
 
6
- export type CompilerWebpackTypes = 'webpack5' | 'webpack4'
6
+ export type CompilerWebpackTypes = 'webpack5'
7
+
8
+ export type CompilerTypes = CompilerWebpackTypes | CompilerViteTypes
7
9
 
8
10
  interface IPrebundle {
9
11
  enable?: boolean
@@ -5,6 +5,7 @@ import type HtmlWebpackPlugin from 'html-webpack-plugin'
5
5
  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
+ import type { OutputExt } from './project'
8
9
 
9
10
  export interface IH5RouterConfig {
10
11
  /** 配置路由模式 */
@@ -40,7 +41,9 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
40
41
  /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
41
42
  * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
42
43
  */
43
- output?: T extends 'vite' ? Pick<RollupOutputOptions, 'chunkFileNames' | 'assetFileNames' > : Webpack.Configuration['output']
44
+ output?: T extends 'vite'
45
+ ? Pick<RollupOutputOptions, 'chunkFileNames' | 'assetFileNames'> & OutputExt
46
+ : Webpack.Configuration['output']
44
47
 
45
48
  /** 路由相关的配置 */
46
49
  router?: IH5RouterConfig
@@ -100,7 +103,7 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
100
103
  /** 配置需要额外的经由 Taro 预设的 postcss 编译的模块 */
101
104
  esnextModules?: string[]
102
105
 
103
- /** 用于控制在 H5 端是否使用兼容性组件库,详情请看 [React 兼容性组件库](https://taro-docs.jd.com/docs/next/h5#react-兼容性组件库)。(默认值:false) */
106
+ /** 用于控制在 H5 端是否使用兼容性组件库,详情请看 [React 兼容性组件库](https://taro-docs.jd.com/docs/h5#react-兼容性组件库)。(默认值:false) */
104
107
  useHtmlComponents?: boolean
105
108
 
106
109
  /** 用于控制在 H5 端是否使用旧版本适配器,旧版本采用全局注册组件,懒加载组件相关依赖;新版本适配器会自动注册相关组件,不再需要引入 @tarojs/components/loader 中的全局 defineCustomElements 方法。(默认值:false) */
@@ -120,7 +123,7 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
120
123
  }
121
124
  /** 生成的代码是否要兼容旧版浏览器,值为 true 时,会去读取 package.json 的 browserslist 字段。只在 vite 编译模式下有效 */
122
125
  legacy?: T extends 'vite' ? boolean : undefined
123
-
124
- /** 使用的编译工具。可选值:webpack4、webpack5、vite */
126
+
127
+ /** 使用的编译工具。可选值:webpack5、vite */
125
128
  compiler?: Compiler<T>
126
129
  }
@@ -1,12 +1,17 @@
1
+ import type { OutputOptions as RollupOutputOptions } from 'rollup'
2
+ import type Webpack from 'webpack'
1
3
  import type Chain from 'webpack-chain'
2
4
 
3
5
  import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
4
- import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
6
+ import type { CompilerTypes, CompilerWebpackTypes } from '../compiler'
7
+ import type { OutputExt } from './project'
5
8
 
6
- export interface IHarmonyConfig<T extends CompilerTypes = CompilerWebpackTypes> {
7
- /** Harmony 编译方式 */
8
- compiler?: Compiler
9
+ export interface IHarmonyRouterConfig {
10
+ /** 配置自定义路由 */
11
+ customRoutes?: IOption
12
+ }
9
13
 
14
+ export interface IHarmonyConfig<T extends CompilerTypes = 'vite'> {
10
15
  /** Harmony 项目地址 */
11
16
  projectPath: string
12
17
 
@@ -48,6 +53,16 @@ export interface IHarmonyConfig<T extends CompilerTypes = CompilerWebpackTypes>
48
53
  filter?: (filename: string) => boolean
49
54
  }
50
55
 
56
+ /** 用于配置半编译模式下的选项 */
57
+ compileModeSetting?: {
58
+ componentReplace?: {
59
+ [key: string]: {
60
+ current_init: string
61
+ dependency_define: string
62
+ }
63
+ }
64
+ }
65
+
51
66
  /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
52
67
  enableSourceMap?: boolean
53
68
 
@@ -65,12 +80,15 @@ export interface IHarmonyConfig<T extends CompilerTypes = CompilerWebpackTypes>
65
80
  webpackChain?: (chain: Chain, webpack: typeof Webpack) => void
66
81
 
67
82
  /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
68
- * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
69
- */
83
+ * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
84
+ */
70
85
  output?: T extends 'vite'
71
- ? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
86
+ ? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
72
87
  : Webpack.Configuration['output'] & OutputExt
73
88
 
89
+ /** 路由相关的配置 */
90
+ router?: IHarmonyRouterConfig
91
+
74
92
  /** 配置 postcss 相关插件 */
75
93
  postcss?: IPostcssOption<'harmony'>
76
94
 
@@ -1,6 +1,7 @@
1
1
  export * from './h5'
2
2
  export * from './harmony'
3
3
  export * from './mini'
4
+ export * from './rn'
4
5
 
5
6
  export * from './manifest'
6
7
  export * from './project'
@@ -3,6 +3,7 @@ import type Chain from 'webpack-chain'
3
3
  import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
4
4
  import type { OutputOptions as RollupOutputOptions } from 'rollup'
5
5
  import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
6
+ import type { OutputExt } from './project'
6
7
 
7
8
  interface Runtime {
8
9
  enableInnerHTML?: boolean
@@ -14,21 +15,6 @@ interface Runtime {
14
15
  enableMutationObserver?: boolean
15
16
  }
16
17
 
17
- interface OutputExt {
18
- /**
19
- * 编译前清空输出目录
20
- * @since Taro v3.6.9
21
- * @description
22
- * - 默认清空输出目录,可设置 clean: false 不清空
23
- * - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件
24
- * - 注意 clean.keep 不支持函数
25
- */
26
- clean?: boolean | {
27
- /** 保留指定文件不删除 */
28
- keep?: Array<string | RegExp> | string | RegExp
29
- }
30
- }
31
-
32
18
  export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes> {
33
19
  /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
34
20
  enableSourceMap?: boolean
@@ -113,7 +99,7 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
113
99
  /** 插件内部使用 */
114
100
  runtime?: Runtime
115
101
 
116
- /** 使用的编译工具。可选值:webpack4、webpack5、vite */
102
+ /** 使用的编译工具。可选值:webpack5、vite */
117
103
  compiler?: Compiler<T>
118
104
 
119
105
  /** 体验式功能 */
@@ -1,6 +1,7 @@
1
1
  import type Webpack from 'webpack'
2
2
  import type Chain from 'webpack-chain'
3
3
  import type { Input } from 'postcss'
4
+ import type { AppConfig } from '../../index'
4
5
  import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
5
6
  import type { IModifyChainData } from '../hooks'
6
7
  import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from './util'
@@ -115,7 +116,7 @@ export interface IProjectBaseConfig {
115
116
  jsMinimizer?: 'terser' | 'esbuild'
116
117
 
117
118
  /** 配置 CSS 压缩工具 (默认 csso) */
118
- cssMinimizer?: 'csso' | 'esbuild' | 'parcelCss'
119
+ cssMinimizer?: 'csso' | 'esbuild' | 'lightningcss'
119
120
 
120
121
  /** 配置 csso 工具以压缩 CSS 代码 */
121
122
  csso?: TogglableOptions
@@ -139,11 +140,11 @@ export interface IProjectBaseConfig {
139
140
  /** 模板循环次数 */
140
141
  baseLevel?: number
141
142
 
142
- /** 使用的开发框架。可选值:react、preact、nerv、vue、vue3 */
143
- framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
143
+ /** 使用的开发框架。可选值:react、preact、vue3 */
144
+ framework?: 'react' | 'preact' | 'solid' | 'vue3'
144
145
  frameworkExts?: string[]
145
146
 
146
- /** 使用的编译工具。可选值:webpack4、webpack5 */
147
+ /** 使用的编译工具。可选值:webpack5 */
147
148
  compiler?: Compiler
148
149
 
149
150
  /** Webpack5 持久化缓存配置。具体配置请参考 [WebpackConfig.cache](https://webpack.js.org/configuration/cache/#cache) */
@@ -177,6 +178,8 @@ export interface IProjectBaseConfig {
177
178
 
178
179
  onWebpackChainReady?: (webpackChain: Chain) => Promise<any>
179
180
 
181
+ modifyAppConfig?: (appConfig: AppConfig) => Promise<any>
182
+
180
183
  /**
181
184
  * 编译中修改 webpack 配置,在这个钩子中,你可以对 webpackChain 作出想要的调整,等同于配置 [`webpackChain`](./config-detail#miniwebpackchain)
182
185
  */
@@ -274,7 +277,7 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
274
277
  jsMinimizer?: 'terser' | 'esbuild'
275
278
 
276
279
  /** 配置 CSS 压缩工具 (默认 csso) */
277
- cssMinimizer?: 'csso' | 'esbuild' | 'parcelCss'
280
+ cssMinimizer?: 'csso' | 'esbuild' | 'lightningcss'
278
281
 
279
282
  /** 配置 csso 工具以压缩 CSS 代码 */
280
283
  csso?: TogglableOptions
@@ -293,8 +296,8 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
293
296
  /** 一个 preset 是一系列 Taro 插件的集合,配置语法同 plugins */
294
297
  presets?: PluginItem[]
295
298
 
296
- /** 使用的开发框架。可选值:react、preact、nervvue、vue3 */
297
- framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
299
+ /** 使用的开发框架。可选值:react、preact、solid、vue3 */
300
+ framework?: 'react' | 'preact' | 'solid' | 'vue3'
298
301
 
299
302
  /** Webpack5 持久化缓存配置。具体配置请参考 [WebpackConfig.cache](https://webpack.js.org/configuration/cache/#cache) */
300
303
  cache?: ICache
@@ -302,7 +305,7 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
302
305
  /** 控制 Taro 编译日志的输出方式 */
303
306
  logger?: ILogger
304
307
 
305
- /** 使用的编译工具。可选值:webpack4、webpack5、vite */
308
+ /** 使用的编译工具。可选值:webpack5、vite */
306
309
  compiler?: Compiler<T>
307
310
 
308
311
  /** 专属于 H5 的配置 */
@@ -318,3 +321,18 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
318
321
 
319
322
  [key: string]: any
320
323
  }
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
+ }
@@ -2,6 +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 { RollupOptions } from 'rollup'
5
6
  import type { IOption, IPostcssOption } from './util'
6
7
 
7
8
  export interface IRNConfig {
@@ -20,7 +21,7 @@ export interface IRNConfig {
20
21
  /** [less](https://lesscss.org/usage/#less-options) 相关配置 */
21
22
  less?: IOption
22
23
 
23
- /** [stylus](https://github.com/NervJS/taro/blob/next/packages/taro-rn-style-transformer/README.md#rnstylus) 相关配置 */
24
+ /** [stylus](https://github.com/NervJS/taro/blob/main/packages/taro-rn-style-transformer/README.md#rnstylus) 相关配置 */
24
25
  stylus?: IOption
25
26
 
26
27
  /** 配置 postcss 相关插件 */
@@ -61,4 +62,24 @@ export interface IRNConfig {
61
62
 
62
63
  /** 设计稿尺寸换算规则 */
63
64
  deviceRatio?: TaroGeneral.TDeviceRatio
65
+
66
+ /** 原生组件编译配置 */
67
+ nativeComponents?: {
68
+ /**
69
+ * 外部依赖
70
+ */
71
+ external?: Array<string | RegExp> | ((arr: Array<string | RegExp>) => Array<string | RegExp>)
72
+ /**
73
+ * 设置外部依赖,如果返回 string, 则将该值作为 external, 我们默认将 node_modules 路径下的文件设置为外部依赖
74
+ */
75
+ exteranlResolve?: (importee: string, importer: string) => string
76
+ /**
77
+ * 组件输出路径,默认值为 'dist'
78
+ */
79
+ output?: string
80
+ /**
81
+ * 修改 Rollup 打包配置
82
+ */
83
+ modifyRollupConfig?: (config: RollupOptions, innerPlugins: { taroResolver: typeof taroResolver, styleTransformer: typeof styleTransformer }) => RollupOptions
84
+ }
64
85
  }
@@ -1,3 +1,11 @@
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
+
3
11
  export * from './config'
@@ -1,9 +1,11 @@
1
1
  import type { RecursiveTemplate, UnRecursiveTemplate } from '@tarojs/shared/dist/template'
2
+
2
3
  import type { PluginContext } from 'rollup'
3
- import type { AppConfig, PageConfig } from '../index'
4
4
  import type { IMiniFilesConfig, IH5Config, IHarmonyConfig, IMiniAppConfig } from './config'
5
5
  import type { IProjectConfig } from './config/project'
6
6
  import type { IComponentConfig } from './hooks'
7
+ import type { IFileType } from './index'
8
+ import type { AppConfig, PageConfig } from '../index'
7
9
 
8
10
  export interface ViteNativeCompMeta {
9
11
  name: string
@@ -13,6 +15,7 @@ export interface ViteNativeCompMeta {
13
15
  isNative: true
14
16
  templatePath: string
15
17
  cssPath?: string
18
+ isPackage?: boolean
16
19
  }
17
20
 
18
21
  export interface ViteFileType {
@@ -41,7 +44,6 @@ export interface VitePageMeta {
41
44
  cssPath?: string
42
45
  }
43
46
 
44
-
45
47
  export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'> {
46
48
  entryFileName?: string
47
49
  runtimePath?: string | string[]
@@ -53,6 +55,7 @@ export interface ViteHarmonyBuildConfig extends CommonBuildConfig, IHarmonyConfi
53
55
  useJSON5?: boolean
54
56
  blended?: boolean
55
57
  runtimePath?: string | string[]
58
+ isPure?: boolean
56
59
  taroComponentsPath: string
57
60
  }
58
61
 
@@ -132,6 +135,7 @@ export interface ViteHarmonyCompilerContext extends ViteCompilerContext<ViteHarm
132
135
  nativeExt: string[]
133
136
  fileType: ViteFileType
134
137
  commonChunks: string[]
138
+ extraComponents: string[]
135
139
  nativeComponents : Map<string, ViteNativeCompMeta>
136
140
  getCommonChunks: () => string[]
137
141
  modifyHarmonyConfig: (config: Partial<AppConfig>) => void
package/types/index.d.ts CHANGED
@@ -187,7 +187,6 @@ 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
191
190
  interface TaroStatic {}
192
191
  }
193
192
  declare global {
@@ -19,6 +19,7 @@ declare module './index' {
19
19
  shareTicket: string | undefined
20
20
  scene: number | undefined
21
21
  exitState?: any
22
+ $taroPath?: string
22
23
  }
23
24
 
24
25
  interface Show {
@@ -139,5 +140,7 @@ declare module './index' {
139
140
  path?: string
140
141
  /** 页面的组件选项 */
141
142
  options?: Record<string, unknown>
143
+ /** 获得一个 EventChannel 对象,用于页面间通讯 */
144
+ getOpenerEventChannel?(): Record<string, any>
142
145
  }
143
146
  }
@@ -32,6 +32,11 @@ 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
35
40
  /** 下拉背景字体、loading 图的样式,仅支持 dark/light
36
41
  * 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
37
42
  * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
@@ -424,7 +429,7 @@ declare module './index' {
424
429
  decodeQuery?: 'disable'
425
430
  }
426
431
 
427
- interface AppConfig {
432
+ export interface AppConfig {
428
433
  /** 小程序默认启动首页,未指定 entryPagePath 时,数组的第一项代表小程序的初始页面(首页)。 */
429
434
  entryPagePath?: string
430
435
  /** 接受一个数组,每一项都是字符串,来指定小程序由哪些页面组成,数组的第一项代表小程序的初始页面 */
@@ -561,7 +566,7 @@ declare module './index' {
561
566
  */
562
567
  themeLocation?: string
563
568
  /** 配置自定义组件代码按需注入 */
564
- lazyCodeLoading?: string
569
+ lazyCodeLoading?: 'requiredComponents' | string
565
570
  /** 单页模式相关配置 */
566
571
  singlePage?: SinglePage
567
572
  /** 聊天素材小程序打开相关配置