@tarojs/taro 3.6.8 → 3.6.9-alpha.2

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": "3.6.8",
3
+ "version": "3.6.9-alpha.2",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,11 +21,15 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.6.8",
25
- "@tarojs/runtime": "3.6.8"
24
+ "@tarojs/api": "3.6.9-alpha.2",
25
+ "@tarojs/runtime": "3.6.9-alpha.2"
26
26
  },
27
27
  "devDependencies": {
28
- "@tarojs/helper": "3.6.8"
28
+ "postcss": "^8.4.18",
29
+ "@tarojs/helper": "3.6.9-alpha.2"
30
+ },
31
+ "peerDependencies": {
32
+ "postcss": "^8.4.18"
29
33
  },
30
34
  "peerDependenciesMeta": {
31
35
  "@types/react": {
@@ -1,8 +1,9 @@
1
1
  import type Webpack from 'webpack'
2
2
  import type Chain from 'webpack-chain'
3
+ import { type Input } from 'postcss'
3
4
  import type { Compiler } from '../compiler'
4
5
  import type { IModifyWebpackChain } from '../hooks'
5
- import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from "./util"
6
+ import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from './util'
6
7
  import type { IH5Config } from './h5'
7
8
  import type { IMiniAppConfig } from './mini'
8
9
 
@@ -22,58 +23,114 @@ interface ILogger {
22
23
  export interface IProjectBaseConfig {
23
24
  isWatch?: boolean
24
25
  port?: number
26
+ /** 项目名称 */
25
27
  projectName?: string
28
+
29
+ /** 项目创建日期 */
26
30
  date?: string
27
- designWidth?: number | ((size?: string | number) => number)
31
+
32
+ /** 设计稿尺寸 */
33
+ designWidth?: number | ((size?: string | number | Input) => number)
34
+
35
+ /** 设计稿尺寸换算规则 */
28
36
  deviceRatio?: TaroGeneral.TDeviceRatio
37
+
29
38
  watcher?: any[]
39
+
40
+ /** 源码存放目录 (默认值:'src') */
30
41
  sourceRoot?: string
42
+
43
+ /** 代码编译后的生产目录 (默认值:'dist') */
31
44
  outputRoot?: string
45
+
46
+ /** 用于设置环境变量 (除了NODE_ENV以外,其他环境变量建议在根目录下的.env文件中) */
32
47
  env?: IOption
48
+
49
+ /** 用于配置目录别名,从而方便书写代码引用路径 */
33
50
  alias?: IOption
51
+
52
+ /** 用于配置一些全局变量供代码中进行使用(建议放在根目录下的.env文件中) */
34
53
  defineConstants?: IOption
54
+
55
+ /** 用于把文件从源码目录直接拷贝到编译后的生产目录 */
35
56
  copy?: ICopyOptions
57
+
58
+ /** 配置 JS 压缩工具 (默认 terser) */
36
59
  jsMinimizer?: 'terser' | 'esbuild'
60
+
61
+ /** 配置 CSS 压缩工具 (默认 csso) */
37
62
  cssMinimizer?: 'csso' | 'esbuild' | 'parcelCss'
63
+
64
+ /** 配置 csso 工具以压缩 CSS 代码 */
38
65
  csso?: TogglableOptions
66
+
67
+ /** 配置 terser 工具以压缩 JS 代码 */
39
68
  terser?: TogglableOptions
69
+
40
70
  esbuild?: Record<'minify', TogglableOptions>
71
+
41
72
  uglify?: TogglableOptions
73
+
74
+ /** 用于控制对 scss 代码的编译行为,默认使用 dart-sass,具体配置可以参考 https://www.npmjs.com/package/sass */
42
75
  sass?: ISassOptions
76
+
77
+ /** 配置 Taro 插件 */
43
78
  plugins?: PluginItem[]
79
+
80
+ /** 一个 preset 是一系列 Taro 插件的集合,配置语法同 plugins */
44
81
  presets?: PluginItem[]
82
+
83
+ /** 模板循环次数 */
45
84
  baseLevel?: number
46
- framework?: string
85
+
86
+ /** 使用的开发框架。可选值:react、preact、nerv、vue、vue3 */
87
+ framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
47
88
  frameworkExts?: string[]
89
+
90
+ /** 使用的编译工具。可选值:webpack4、webpack5 */
48
91
  compiler?: Compiler
92
+
93
+ /** Webpack5 持久化缓存配置。具体配置请参考 [WebpackConfig.cache](https://webpack.js.org/configuration/cache/#cache) */
49
94
  cache?: ICache
95
+
96
+ /** 控制 Taro 编译日志的输出方式 */
50
97
  logger?: ILogger
98
+
99
+ /** 用于控制是否生成 js、css 对应的 sourceMap */
51
100
  enableSourceMap?: boolean
101
+
52
102
  /**
53
103
  * 编译开始
54
104
  */
55
105
  onBuildStart?: (...args: any[]) => Promise<any>
106
+
56
107
  /**
57
108
  * 编译完成(启动项目后首次编译结束后会触发一次)
58
109
  */
59
110
  onBuildComplete?: (...args: any[]) => Promise<any>
111
+
60
112
  /**
61
113
  * 编译结束(保存代码每次编译结束后都会触发)
62
114
  */
63
- onBuildFinish?: (res: { error, stats, isWatch }) => Promise<any>
115
+ onBuildFinish?: (res: { error; stats; isWatch }) => Promise<any>
116
+
64
117
  /**
65
118
  * 修改编译过程中的页面组件配置
66
119
  */
67
120
  onCompilerMake?: (compilation: Webpack.Compilation, compiler: Webpack.Compiler, plugin: any) => Promise<any>
121
+
68
122
  onWebpackChainReady?: (webpackChain: Chain) => Promise<any>
123
+
69
124
  /**
70
125
  * 编译中修改 webpack 配置,在这个钩子中,你可以对 webpackChain 作出想要的调整,等同于配置 [`webpackChain`](./config-detail#miniwebpackchain)
71
126
  */
72
127
  modifyWebpackChain?: (chain: Chain, webpack: typeof Webpack, data: IModifyWebpackChain) => Promise<any>
128
+
73
129
  /**
74
130
  * 修改编译过程中的页面组件配置
75
131
  */
76
132
  modifyMiniConfigs?: (configMap: any) => Promise<any>
133
+
77
134
  /**
78
135
  * 修改编译后的结果
79
136
  */
@@ -81,11 +138,14 @@ export interface IProjectBaseConfig {
81
138
  }
82
139
 
83
140
  export interface IProjectConfig extends IProjectBaseConfig {
84
- ui?: {
85
- extraWatchFiles?: any[]
86
- }
141
+ /** 专属于小程序的配置 */
87
142
  mini?: IMiniAppConfig
143
+
144
+ /** 专属于 H5 的配置 */
88
145
  h5?: IH5Config
146
+
147
+ /** 专属于 RN 的配置 */
89
148
  rn?: IH5Config
149
+
90
150
  [key: string]: any
91
151
  }