@tarojs/taro 3.6.9-alpha.3 → 3.6.9-alpha.4

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.9-alpha.3",
3
+ "version": "3.6.9-alpha.4",
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,11 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.6.9-alpha.3",
25
- "@tarojs/runtime": "3.6.9-alpha.3"
24
+ "@tarojs/api": "3.6.9-alpha.4",
25
+ "@tarojs/runtime": "3.6.9-alpha.4"
26
26
  },
27
27
  "devDependencies": {
28
- "@tarojs/helper": "3.6.9-alpha.3"
28
+ "@tarojs/helper": "3.6.9-alpha.4"
29
29
  },
30
30
  "peerDependenciesMeta": {
31
31
  "@types/react": {
@@ -11,13 +11,32 @@ import { IRNConfig } from './rn'
11
11
  export type PluginItem = string | [string, object] | [string, () => object | Promise<object>]
12
12
 
13
13
  interface ICache {
14
+ /**
15
+ * 是否开启持久化缓存 (默认值 false)
16
+ * @description ```
17
+ * 值为 false 时:开发模式下 WebpackConfig.cache.type = 'memory',而生产模式下 WebpackConfig.cache = false;
18
+ * 值为 true 时:开发模式和生产模式下均为 WebpackConfig.cache.type = 'filesystem'
19
+ * ```
20
+ */
14
21
  enable?: boolean
22
+
23
+ /**
24
+ * 当依赖的文件或该文件的依赖改变时,使缓存失效。
25
+ * @description 详详情请参考 [WebpackConfig.cache.buildDependencies](https://webpack.js.org/configuration/cache/#cachebuilddependencies)。
26
+ */
15
27
  buildDependencies?: Record<string, any>
28
+
29
+ /**
30
+ * 缓存子目录的名称 (默认值 process.env.NODE_ENV-process.env.TARO_ENV)
31
+ * @description 详情请参考 [WebpackConfig.cache.name](https://webpack.js.org/configuration/cache/#cachename)
32
+ */
16
33
  name?: string
17
34
  }
18
35
 
19
36
  interface ILogger {
37
+ /** 是否简化输出日志 (默认值 true)*/
20
38
  quiet: boolean
39
+ /** 是否输出 Webpack Stats 信息 (默认值 false) */
21
40
  stats: boolean
22
41
  }
23
42
 
@@ -1,3 +1,5 @@
1
+ import { type Input } from 'postcss'
2
+
1
3
  export type Func = (...args: any[]) => any
2
4
 
3
5
  export type IOption = Record<string, any>
@@ -9,7 +11,9 @@ export type TogglableOptions<T = IOption> = {
9
11
 
10
12
  export namespace PostcssOption {
11
13
  export type cssModules = TogglableOptions<{
14
+ /** 转换模式,取值为 global/module */
12
15
  namingPattern: 'global' | string
16
+ /** 自定义生成的class名称规则 */
13
17
  generateScopedName: string | ((localName: string, absoluteFilePath: string) => string)
14
18
  }>
15
19
  export type url = TogglableOptions<{
@@ -18,11 +22,65 @@ export namespace PostcssOption {
18
22
  }>
19
23
  }
20
24
 
25
+ export interface IHtmlTransformOption {
26
+ /** 是否启用 postcss-html-transform 插件 */
27
+ enable?: boolean
28
+ config?: {
29
+ /** 当前编译平台 (此选项插件内部根据编译平台自行生成,无需传入) */
30
+ readonly platform?: string
31
+ /** 设置是否去除 cursor 相关样式 (h5默认值:true) */
32
+ removeCursorStyle: boolean
33
+ }
34
+ }
35
+
36
+ export interface IPxTransformOption {
37
+ /** 设置 1px 是否需要被转换 */
38
+ onePxTransform?: boolean
39
+ /** REM 单位允许的小数位 */
40
+ unitPrecision?: number
41
+ /** 允许转换的属性列表 (默认 [*]) */
42
+ propList?: string[]
43
+ /** 黑名单里的选择器将会被忽略 */
44
+ selectorBlackList?: Array<string | RegExp>
45
+ /** 直接替换而不是追加一条进行覆盖 */
46
+ replace?: boolean
47
+ /** 允许媒体查询里的 px 单位转换 */
48
+ mediaQuery?: boolean
49
+ /** 设置一个可被转换的最小 px 值 */
50
+ minPixelValue?: number
51
+ /**
52
+ * 转换后的单位,可选值为 rpx、vw、rem,当前仅支持小程序 (默认 rpx) 和 Web 端 (默认 rem)
53
+ * @description Web 端使用 rem 单位时会注入脚本用于设置 body 上的 font-size 属性,其他单位无该操作
54
+ */
55
+ targetUnit?: 'rpx' | 'vw' | 'rem'
56
+ /**
57
+ * H5 字体尺寸大小基准值,开发者可以自行调整单位换算的基准值(默认20)
58
+ * @supported h5
59
+ */
60
+ baseFontSize?: number
61
+ /**
62
+ * H5 根节点 font-size 的最大值 (默认 40)
63
+ * @supported h5
64
+ */
65
+ maxRootSize?: number
66
+ /**
67
+ * H5 根节点 font-size 的最小值(默认 20)
68
+ * @supported h5
69
+ */
70
+ minRootSize?: number
71
+ /** 设计稿尺寸 */
72
+ designWidth?: number | ((size?: string | number | Input) => number)
73
+ /** 设计稿尺寸换算规则 */
74
+ deviceRatio?: TaroGeneral.TDeviceRatio
75
+ }
76
+
21
77
  export interface IPostcssOption {
22
78
  autoprefixer?: TogglableOptions
23
- pxtransform?: TogglableOptions
79
+ pxtransform?: TogglableOptions<IPxTransformOption>
24
80
  cssModules?: PostcssOption.cssModules
25
81
  url?: PostcssOption.url
82
+ /** 插件 postcss-html-transform 相关配置, 一般启用了 @tarojs/plugin-html 插件才配置 */
83
+ htmltransform?: IHtmlTransformOption
26
84
  [key: string]: any
27
85
  }
28
86
 
@@ -96,9 +154,9 @@ export const enum CONFIG_TYPES {
96
154
  }
97
155
 
98
156
  export type IMINI_APP_FILE_TYPE = {
99
- TEMPL: TEMPLATE_TYPES,
100
- STYLE: STYLE_TYPES,
101
- SCRIPT: SCRIPT_TYPES,
157
+ TEMPL: TEMPLATE_TYPES
158
+ STYLE: STYLE_TYPES
159
+ SCRIPT: SCRIPT_TYPES
102
160
  CONFIG: CONFIG_TYPES
103
161
  }
104
162