@tarojs/taro 4.0.0-canary.9 → 4.0.1-alpha.0

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-canary.9",
3
+ "version": "4.0.1-alpha.0",
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-canary.9"
26
+ "@types/postcss-url": "^10.0.4",
27
+ "@tarojs/api": "4.0.1-alpha.0",
28
+ "@tarojs/runtime": "4.0.1-alpha.0"
25
29
  },
26
30
  "devDependencies": {
27
- "@tarojs/helper": "4.0.0-canary.9",
28
- "@tarojs/shared": "4.0.0-canary.9",
29
- "@tarojs/runtime": "4.0.0-canary.9"
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.1-alpha.0",
39
+ "@tarojs/shared": "4.0.1-alpha.0",
40
+ "@tarojs/components": "4.0.1-alpha.0"
30
41
  },
31
42
  "peerDependencies": {
32
- "@tarojs/helper": "~4.0.0-canary.9",
33
- "@tarojs/shared": "~4.0.0-canary.9",
34
- "@tarojs/runtime": "~4.0.0-canary.9"
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.1-alpha.0",
52
+ "@tarojs/helper": "4.0.1-alpha.0",
53
+ "@tarojs/shared": "4.0.1-alpha.0"
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
  /** 接口调用失败的回调函数 */
@@ -800,6 +800,15 @@ declare module '../../index' {
800
800
  setPosition(...args: any[]): void
801
801
  }
802
802
 
803
+ namespace createInnerAudioContext {
804
+ interface Option {
805
+ /** 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项。
806
+ * @supported weapp
807
+ */
808
+ useWebAudioImplement: boolean
809
+ }
810
+ }
811
+
803
812
  interface TaroStatic {
804
813
  /** 结束播放语音。
805
814
  * **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.createInnerAudioContext](./createInnerAudioContext) 接口**
@@ -979,7 +988,7 @@ declare module '../../index' {
979
988
  * ```
980
989
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html
981
990
  */
982
- createInnerAudioContext(): InnerAudioContext
991
+ createInnerAudioContext(option?: createInnerAudioContext.Option): InnerAudioContext
983
992
 
984
993
  /** 创建 audio 上下文 AudioContext 对象。
985
994
  * **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.createInnerAudioContext](./createInnerAudioContext) 接口**
@@ -221,7 +221,7 @@ declare module '../../index' {
221
221
  /** 压缩后图片的宽度,单位为px,若不填写则默认以 compressedHeight 为准等比缩放。 */
222
222
  compressedWidth?: number
223
223
  /** 压缩后图片的高度,单位为px,若不填写则默认以 compressedWidth 为准等比缩放。 */
224
- compressHeight?: number
224
+ compressedHeight?: number
225
225
  /** 接口调用成功的回调函数 */
226
226
  success?: (result: SuccessCallbackResult) => void
227
227
  }
@@ -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
 
@@ -13,8 +13,8 @@ declare module '../../index' {
13
13
  */
14
14
  header?: TaroGeneral.IAnyObject
15
15
  /** 超时时间,单位为毫秒
16
- * @default 2000
17
- * @supported weapp, h5, tt, alipay
16
+ * @default 60000
17
+ * @supported weapp, h5, tt, alipay, rn
18
18
  */
19
19
  timeout?: number
20
20
  /** HTTP 请求方法
@@ -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 {
@@ -43,7 +43,7 @@ declare module '../../index' {
43
43
  1
44
44
  }
45
45
  }
46
-
46
+
47
47
  namespace deleteBookshelf {
48
48
  interface Option {
49
49
  /** 要删除的内容分类 */
@@ -115,13 +115,13 @@ declare module '../../index' {
115
115
  1
116
116
  }
117
117
  }
118
-
118
+
119
119
  namespace updateBookshelfReadTime {
120
120
  interface Option {
121
121
  /** 添加的内容分类 */
122
122
  category: keyof Category | string
123
123
  /** 要更新内容的 id;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
124
- contentIds: string[]
124
+ contentIds: string[]
125
125
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
126
126
  complete?: (res: TaroGeneral.CallbackResult) => void
127
127
  /** 接口调用失败的回调函数 */
@@ -278,7 +278,7 @@ declare module '../../index' {
278
278
  * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
279
279
  */
280
280
  updateBookshelfReadTime(option: updateBookshelfReadTime.Option): void
281
-
281
+
282
282
  /** 跳转到宿主书架
283
283
  * @supported swan
284
284
  * @swan (需宿主支持书架入口)
@@ -304,4 +304,4 @@ declare module '../../index' {
304
304
  */
305
305
  navigateToBookshelf(option: navigateToBookshelf.Option): void
306
306
  }
307
- }
307
+ }
@@ -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
+ }
@@ -147,7 +147,7 @@ declare module '../index' {
147
147
  Current: getCurrentInstance.Current
148
148
 
149
149
  /** Vue3 插件,用于设置 `getApp()` 中的全局变量
150
- * @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
150
+ * @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp, harmony_hybrid
151
151
  * @example
152
152
  * ```js
153
153
  * // 使用插件
@@ -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
  /** 配置路由模式 */
@@ -16,6 +17,8 @@ export interface IH5RouterConfig {
16
17
  lazyload?: boolean | ((pagename: string) => boolean)
17
18
  renamePagename?: (pagename: string) => string
18
19
  forcePath?: string
20
+ /** 加上这个参数,可以解决返回页面的时候白屏的问题,但是某些不支持 :has() 选择器的浏览器会有问题 */
21
+ enhanceAnimation?: boolean
19
22
  }
20
23
 
21
24
  export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
@@ -40,7 +43,9 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
40
43
  /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
41
44
  * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
42
45
  */
43
- output?: T extends 'vite' ? Pick<RollupOutputOptions, 'chunkFileNames' | 'assetFileNames' > : Webpack.Configuration['output']
46
+ output?: T extends 'vite'
47
+ ? Pick<RollupOutputOptions, 'chunkFileNames' | 'assetFileNames'> & OutputExt
48
+ : Webpack.Configuration['output']
44
49
 
45
50
  /** 路由相关的配置 */
46
51
  router?: IH5RouterConfig
@@ -100,7 +105,7 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
100
105
  /** 配置需要额外的经由 Taro 预设的 postcss 编译的模块 */
101
106
  esnextModules?: string[]
102
107
 
103
- /** 用于控制在 H5 端是否使用兼容性组件库,详情请看 [React 兼容性组件库](https://taro-docs.jd.com/docs/next/h5#react-兼容性组件库)。(默认值:false) */
108
+ /** 用于控制在 H5 端是否使用兼容性组件库,详情请看 [React 兼容性组件库](https://taro-docs.jd.com/docs/h5#react-兼容性组件库)。(默认值:false) */
104
109
  useHtmlComponents?: boolean
105
110
 
106
111
  /** 用于控制在 H5 端是否使用旧版本适配器,旧版本采用全局注册组件,懒加载组件相关依赖;新版本适配器会自动注册相关组件,不再需要引入 @tarojs/components/loader 中的全局 defineCustomElements 方法。(默认值:false) */
@@ -120,7 +125,7 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
120
125
  }
121
126
  /** 生成的代码是否要兼容旧版浏览器,值为 true 时,会去读取 package.json 的 browserslist 字段。只在 vite 编译模式下有效 */
122
127
  legacy?: T extends 'vite' ? boolean : undefined
123
-
124
- /** 使用的编译工具。可选值:webpack4、webpack5、vite */
128
+
129
+ /** 使用的编译工具。可选值:webpack5、vite */
125
130
  compiler?: Compiler<T>
126
131
  }
@@ -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
 
@@ -20,6 +25,24 @@ export interface IHarmonyConfig<T extends CompilerTypes = CompilerWebpackTypes>
20
25
  */
21
26
  name?: string
22
27
 
28
+ /** oh-package.json 配置 */
29
+ ohPackage?: {
30
+ dependencies?: { [name: string]: string }
31
+ devDependencies?: { [name: string]: string }
32
+ main?: string
33
+ [k: string]: any
34
+ }
35
+
36
+ /** ohpm-cli
37
+ * @default "~/Library/Huawei/ohpm/bin/ohpm"
38
+ */
39
+ ohpm?: string
40
+
41
+ /** 核心依赖前缀
42
+ * @description 用于告诉编译内容如何解析核心依赖,传入时将直接使用依赖前缀,同时不会为工程导入核心依赖
43
+ */
44
+ chorePackagePrefix?: string
45
+
23
46
  /** 用于告诉 Taro 编译器需要抽取的公共文件 */
24
47
  commonChunks?: string[] | ((commonChunks: string[]) => string[])
25
48
 
@@ -30,6 +53,16 @@ export interface IHarmonyConfig<T extends CompilerTypes = CompilerWebpackTypes>
30
53
  filter?: (filename: string) => boolean
31
54
  }
32
55
 
56
+ /** 用于配置半编译模式下的选项 */
57
+ compileModeSetting?: {
58
+ componentReplace?: {
59
+ [key: string]: {
60
+ current_init: string
61
+ dependency_define: string
62
+ }
63
+ }
64
+ }
65
+
33
66
  /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
34
67
  enableSourceMap?: boolean
35
68
 
@@ -47,12 +80,15 @@ export interface IHarmonyConfig<T extends CompilerTypes = CompilerWebpackTypes>
47
80
  webpackChain?: (chain: Chain, webpack: typeof Webpack) => void
48
81
 
49
82
  /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
50
- * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
51
- */
83
+ * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
84
+ */
52
85
  output?: T extends 'vite'
53
- ? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
86
+ ? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
54
87
  : Webpack.Configuration['output'] & OutputExt
55
88
 
89
+ /** 路由相关的配置 */
90
+ router?: IHarmonyRouterConfig
91
+
56
92
  /** 配置 postcss 相关插件 */
57
93
  postcss?: IPostcssOption<'harmony'>
58
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、nervvuevue3 */
297
- framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
299
+ /** 使用的开发框架。可选值:react、preact、solidvue3none */
300
+ framework?: 'react' | 'preact' | 'solid' | 'vue3' | 'none'
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,10 +135,11 @@ 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
138
- modifyHostPackageDep: (outDir: string, deps?: Record<string, string>, devDeps?: Record<string, string>) => void
142
+ modifyHostPackage: (deps?: Record<string, string>, devDeps?: Record<string, string>) => Exclude<IHarmonyConfig['ohPackage'], void>
139
143
  collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
140
144
  getScriptPath: (filePath: string) => string
141
145
  getStylePath: (filePath: string) => string
package/types/index.d.ts CHANGED
@@ -3,53 +3,64 @@
3
3
  *
4
4
  * 目录结构
5
5
  * ├── api 小程序端能力 API
6
- * │ ├── ad
6
+ * │   ├── ad
7
7
  * │ │ └── index.d.ts 广告 API
8
- * │ ├── alipay
8
+ * │   ├── ai
9
+ * │   │   ├── face.d.ts 人脸检测 API
10
+ * │   │   ├── inference.d.ts AI 推理 API
11
+ * │   │   └── visionkit.d.ts 视觉算法 API
12
+ * │   ├── alipay
9
13
  * │ │ └── index.d.ts 支付宝小程序 API
10
- * │ ├── base
14
+ * │   ├── base
11
15
  * │ │ ├── index.d.ts 基础 API
16
+ * │   │   ├── crypto.d.ts 基础 -> 加密 API
12
17
  * │ │ ├── debug.d.ts 基础 -> 调试 API
18
+ * │   │   ├── env.d.ts 基础 -> ENV
19
+ * │   │   ├── performance.d.ts
13
20
  * │ │ ├── system.d.ts 基础 -> 系统 API
14
- * │ ├── update.d.ts 基础 -> 更新 API
15
- * │ ├── weapp 基础 -> 小程序 API
16
- * │ ├── life-cycle.d.ts 基础 -> 小程序 API -> 生命周期
17
- * │ └── app-event.d.ts 基础 -> 小程序 API -> 应用级事件
18
- * │ │ └── env.d.ts 基础 -> ENV
19
- * │ ├── canvas
21
+ * │      ├── update.d.ts 基础 -> 更新 API
22
+ * │      └── weapp 基础 -> 小程序 API
23
+ * │      ├── app-event.d.ts 基础 -> 小程序 API -> 应用级事件
24
+ * │      └── life-cycle.d.ts 基础 -> 小程序 API -> 生命周期
25
+ * │   ├── canvas
20
26
  * │ │ └── index.d.ts 画布 API
21
- * │ ├── cloud
27
+ * │   ├── cloud
22
28
  * │ │ └── index.d.ts 微信小程序云开发 API
23
- * │ ├── data-analysis
29
+ * │   ├── data-analysis
24
30
  * │ │ └── index.d.ts 数据分析 API
25
- * │ ├── device
31
+ * │   ├── device
26
32
  * │ │ ├── accelerometer.d.ts 设备 -> 加速计 API
33
+ * │   │   ├── accessibility.d.ts 设备 -> 无障碍 API
27
34
  * │ │ ├── battery.d.ts 设备 -> 电量 API
28
- * │ ├── ble.d.ts 设备 -> 低功耗蓝牙 API
29
- * │ ├── bluetooth.d. 设备 -> 蓝牙 API
35
+ * │      ├── bluetooth-ble.d.ts 设备 -> 蓝牙-低功耗中心设备 API
36
+ * │      ├── bluetooth-peripheral.d.ts 设备 -> 蓝牙-低功耗外围设备 API
37
+ * │   │   ├── bluetooth.d.ts 设备 -> 蓝牙-通用 API
38
+ * │   │   ├── calendar.d.ts 设备 -> 日历 API
30
39
  * │ │ ├── clipboard.d.ts 设备 -> 剪贴板 API
31
40
  * │ │ ├── compass.d.ts 设备 -> 罗盘 API
32
41
  * │ │ ├── contact.d.ts 设备 -> 联系人 API
33
- * │ │ ├── motion.d.ts 设备 -> 设备方向 API
34
42
  * │ │ ├── gyroscope.d.ts 设备 -> 陀螺仪 API
35
43
  * │ │ ├── iBeacon.d.ts 设备 -> iBeacon API
36
- * │ ├── network.d.ts 设备 -> 网络 API
37
- * │ ├── nfc.d.ts 设备 -> NFC API
38
- * │ │ ├── performance.d.ts 设备 -> 性能 API
44
+ * │      ├── keyboard.d.ts 设备 -> 键盘 API
45
+ * │      ├── memory.d.ts 设备 -> 内存 API
46
+ * │ │ ├── motion.d.ts 设备 -> 设备方向 API
47
+ * │   │   ├── network.d.ts 设备 -> 网络 API
48
+ * │   │   ├── nfc.d.ts 设备 -> NFC 读写 API
39
49
  * │ │ ├── phone.d.ts 设备 -> 电话 API
40
50
  * │ │ ├── scan.d.ts 设备 -> 扫码 API
41
51
  * │ │ ├── screen.d.ts 设备 -> 屏幕 API
52
+ * │   │   ├── sms.d.ts 设备 -> 短信 API
42
53
  * │ │ ├── vibrate.d.ts 设备 -> 振动 API
43
54
  * │ │ └── wifi.d.ts 设备 -> Wi-Fi API
44
- * │ ├── ext
55
+ * │   ├── ext
45
56
  * │ │ └── index.d.ts 第三方平台 API
46
- * │ ├── files
57
+ * │   ├── files
47
58
  * │ │ └── index.d.ts 文件 API
48
- * │ ├── framework
59
+ * │   ├── framework
49
60
  * │ │ └── index.d.ts 小程序框架 API
50
- * │ ├── location
61
+ * │   ├── location
51
62
  * │ │ └── index.d.ts 位置 API
52
- * │ ├── media
63
+ * │   ├── media
53
64
  * │ │ ├── audio.d.ts 媒体 -> 音频 API
54
65
  * │ │ ├── background-audio.d.ts 媒体 -> 背景音频 API
55
66
  * │ │ ├── camera.d.ts 媒体 -> 相机 API
@@ -57,21 +68,26 @@
57
68
  * │ │ ├── image.d.ts 媒体 -> 图片 API
58
69
  * │ │ ├── live.d.ts 媒体 -> 实时音视频 API
59
70
  * │ │ ├── map.d.ts 媒体 -> 地图 API
71
+ * │   │   ├── media-recorder.d.ts 媒体 -> 画面录制器 API
60
72
  * │ │ ├── recorder.d.ts 媒体 -> 录音 API
61
- * │ ├── video.d.ts 媒体 -> 视频 API
73
+ * │      ├── video-decoder.d.ts 媒体 -> 视频解码器 API
62
74
  * │ │ └── video-processing.d.ts 媒体 -> 音视频合成 API
63
- * │ ├── network
75
+ * │ ├── video.d.ts 媒体 -> 视频 API
76
+ * │   │   └── voip.d.ts 媒体 -> 实时语音 API
77
+ * │   ├── navigate
78
+ * │   │   └── index.d.ts 跳转 API
79
+ * │   ├── network
64
80
  * │ │ ├── download.d.ts 网络 -> 下载 API
65
81
  * │ │ ├── mdns.d.ts 网络 -> mDNS API
66
82
  * │ │ ├── request.d.ts 网络 -> 发起请求 API
83
+ * │   │   ├── tcp.d.ts 网络 -> TCP 通信 API
67
84
  * │ │ ├── udp.d.ts 网络 -> UDP 通信 API
68
85
  * │ │ ├── upload.d.ts 网络 -> 上传 API
69
86
  * │ │ └── websocket.d.ts 网络 -> WebSocket API
70
- * │ ├── open-api
87
+ * │   ├── open-api
71
88
  * │ │ ├── account.d.ts 开放接口 -> 账号信息 API
72
89
  * │ │ ├── address.d.ts 开放接口 -> 收货地址 API
73
90
  * │ │ ├── authorize.d.ts 开放接口 -> 授权 API
74
- * │ │ ├── bookshelf.d.ts 开放接口 -> 书架 API
75
91
  * │ │ ├── card.d.ts 开放接口 -> 卡券 API
76
92
  * | | ├── channels.d.ts 开放接口 -> 视频号 API
77
93
  * | | ├── customer-service.d.ts 开放接口 -> 微信客服 API
@@ -80,11 +96,10 @@
80
96
  * │ │ ├── favorites.d.ts 开放接口 -> 收藏 API
81
97
  * │ │ ├── group.d.ts 开放接口 -> 微信群 API
82
98
  * │ │ ├── invoice.d.ts 开放接口 -> 发票 API
83
- * │ ├── licence-plate.d.ts 开放接口 -> 车牌 API
99
+ * │      ├── license-plate.d.ts 开放接口 -> 车牌 API
84
100
  * │ │ ├── login.d.ts 开放接口 -> 登录 API
85
101
  * │ │ ├── my-miniprogram.d.ts 开放接口 -> 我的小程序 API
86
102
  * │ │ ├── privacy.d.ts 开放接口 -> 隐私信息授权 API
87
- * │ │ ├── payment.d.ts 开放接口 -> 支付 API
88
103
  * │ │ ├── redpackage.d.ts 开放接口 -> 微信红包 API
89
104
  * │ │ ├── settings.d.ts 开放接口 -> 设置 API
90
105
  * │ │ ├── soter.d.ts 开放接口 -> 生物认证 API
@@ -92,23 +107,33 @@
92
107
  * | | ├── subscribe-message.d.ts 开放接口 -> 订阅消息 API
93
108
  * │ │ ├── user-info.d.ts 开放接口 -> 用户信息 API
94
109
  * │ │ └── werun.d.ts 开放接口 -> 微信运动 API
95
- * │ ├── route
110
+ * │   ├── payment
111
+ * │   │   └── index.d.ts 支付 API
112
+ * │   ├── qq
113
+ * │   │   └── index.d.ts QQ 小程序 API
114
+ * │   ├── route
96
115
  * │ │ └── index.d.ts 路由 API
97
- * │ ├── share
116
+ * │   ├── share
98
117
  * │ │ └── index.d.ts 转发 API
99
- * │ ├── skyline
118
+ * │   ├── skyline
100
119
  * │ │ └── index.d.ts 微信 Skyline API
101
- * │ ├── storage
120
+ * │   ├── storage
102
121
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
103
- * │ └── index.d.ts 数据缓存 API
104
- * │ ├── swan
122
+ * │      ├── cache-manager.d.ts 数据缓存 -> 缓存管理 API
123
+ * │   │   └── index.d.ts 数据缓存 API
124
+ * │   ├── swan
125
+ * │   │   ├── bookshelf.d.ts 百度小程序 -> 书架 API
126
+ * │   │   ├── download-package.d.ts 百度小程序 -> 下载包 API
105
127
  * │ │ └── index.d.ts 百度小程序 API
106
- * │ ├── ui
128
+ * │   │   └── pay.d.ts 百度小程序 -> 支付 API
129
+ * │   ├── taro.extend.d.ts Taro 扩展 API 类型定义
130
+ * │   ├── taro.hooks.d.ts Taro Hooks 类型定义
131
+ * │   ├── ui
107
132
  * │ │ ├── animation.d.ts 界面 -> 动画 API
108
133
  * │ │ ├── background.d.ts 界面 -> 背景 API
109
134
  * │ │ ├── custom-component.d.ts 界面 -> 自定义组件 API
110
135
  * │ │ ├── fonts.d.ts 界面 -> 字体 API
111
- * │ ├── keyboard.d.ts 界面 -> 键盘 API
136
+ * │      ├── interaction.d.ts 界面 -> 交互 API
112
137
  * │ │ ├── menu.d.ts 界面 -> 菜单 API
113
138
  * │ │ ├── navigation-bar.d.ts 界面 -> 导航栏 API
114
139
  * │ │ ├── pull-down-refresh.d.ts 界面 -> 下拉刷新 API
@@ -116,14 +141,25 @@
116
141
  * │ │ ├── sticky.d.ts 界面 -> 置顶 API
117
142
  * │ │ ├── tab-bar.d.ts 界面 -> TabBar API
118
143
  * │ │ ├── window.d.ts 界面 -> 窗口 API
119
- * │ │ └── interaction.d.ts 界面 -> 交互 API
120
- * │ ├── worker
144
+ * │   ├── worker
121
145
  * │ │ └── index.d.ts Worker API
122
- * │ ├── wxml
146
+ * │   └── wxml
123
147
  * │ │ └── index.d.ts WXML API
124
- * ├── taro.extend.d.ts Taro 扩展 API 类型定义
125
- * │ └── taro.hooks.d.ts Taro Hooks 类型定义
148
+ * ├── compile
149
+ * │   ├── compiler.d.ts
150
+ * │   ├── config
151
+ * │   │   ├── h5.d.ts
152
+ * │   │   ├── index.d.ts
153
+ * │   │   ├── manifest.d.ts
154
+ * │   │   ├── mini.d.ts
155
+ * │   │   ├── project.d.ts
156
+ * │   │   ├── rn.d.ts
157
+ * │   │   └── util.d.ts
158
+ * │   ├── hooks.d.ts Taro Hooks 类型定义
159
+ * │   └── index.d.ts
160
+ * ├── global.d.ts
126
161
  * ├── index.d.ts 此文件
162
+ * ├── taro.api.d.ts
127
163
  * ├── taro.component.d.ts Taro Component 类型定义
128
164
  * ├── taro.config.d.ts Taro 小程序 App 与 Window 设置类型定义
129
165
  * └── taro.lifecycle.d.ts Taro 生命周期类型定义
@@ -135,6 +171,7 @@
135
171
  /// <reference path="taro.component.d.ts" />
136
172
  /// <reference path="taro.config.d.ts" />
137
173
  /// <reference path="taro.lifecycle.d.ts" />
174
+ /// <reference path="taro.runtime.d.ts" />
138
175
 
139
176
  /// <reference types="@tarojs/plugin-platform-alipay/types/shims-alipay" />
140
177
  /// <reference types="@tarojs/plugin-platform-jd/types/shims-jd" />
@@ -150,10 +187,9 @@ export as namespace Taro
150
187
  declare const Taro: Taro.TaroStatic
151
188
 
152
189
  declare namespace Taro {
153
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
154
190
  interface TaroStatic {}
155
191
  }
156
192
  declare global {
157
- const defineAppConfig: (config: Taro.Config) => Taro.Config
158
- const definePageConfig: (config: Taro.Config) => Taro.Config
193
+ const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
194
+ const definePageConfig: (config: Taro.PageConfig) => Taro.Config
159
195
  }
@@ -63,7 +63,6 @@
63
63
  /// <reference path="api/open-api/account.d.ts" />
64
64
  /// <reference path="api/open-api/address.d.ts" />
65
65
  /// <reference path="api/open-api/authorize.d.ts" />
66
- /// <reference path="api/open-api/bookshelf.d.ts" />
67
66
  /// <reference path="api/open-api/card.d.ts" />
68
67
  /// <reference path="api/open-api/channels.d.ts" />
69
68
  /// <reference path="api/open-api/customer-service.d.ts" />
@@ -121,6 +120,7 @@
121
120
  /// <reference path="api/alipay/index.d.ts" />
122
121
  /// <reference path="api/qq/index.d.ts" />
123
122
 
123
+ /// <reference path="api/swan/bookshelf.d.ts" />
124
124
  /// <reference path="api/swan/download-package.d.ts" />
125
125
  /// <reference path="api/swan/index.d.ts" />
126
126
  /// <reference path="api/swan/pay.d.ts" />
@@ -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,9 +32,14 @@ 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
- * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
42
+ * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
38
43
  * @default: "dark"
39
44
  */
40
45
  backgroundTextStyle?: 'dark' | 'light' | string
@@ -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
  /** 聊天素材小程序打开相关配置
@@ -56,9 +56,12 @@ declare module './index' {
56
56
  }
57
57
 
58
58
  interface PageResizeObject {
59
+ deviceOrientation?: 'portrait' | 'landscape'
59
60
  size: {
60
61
  windowWidth: number
61
62
  windowHeight: number
63
+ screenWidth?: number
64
+ screenHeight?: number
62
65
  }
63
66
  }
64
67
 
@@ -0,0 +1,9 @@
1
+ import type { options } from '@tarojs/runtime'
2
+
3
+ import Taro from './index'
4
+
5
+ declare module './index' {
6
+ interface TaroStatic {
7
+ options: typeof options
8
+ }
9
+ }