@weapp-tailwindcss/postcss 2.1.6 → 2.2.0-alpha.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.
- package/dist/chunk-2DNJBRQ3.mjs +64 -0
- package/dist/chunk-2Y3ULRB3.js +64 -0
- package/dist/html-transform.js +4 -61
- package/dist/html-transform.mjs +3 -60
- package/dist/index.d.mts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +426 -84
- package/dist/index.mjs +382 -40
- package/dist/{types-CsRGpZ_r.d.mts → types-DiOShlJF.d.mts} +39 -4
- package/dist/{types-CsRGpZ_r.d.ts → types-DiOShlJF.d.ts} +39 -4
- package/dist/types.d.mts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +8 -5
|
@@ -3,7 +3,28 @@ import { AcceptedPlugin, Result as Result$1 } from 'postcss';
|
|
|
3
3
|
import { Result } from 'postcss-load-config';
|
|
4
4
|
import { PxTransformOptions } from 'postcss-pxtrans';
|
|
5
5
|
import { UserDefinedOptions } from 'postcss-rem-to-responsive-pixel';
|
|
6
|
-
import { UserDefinedOptions as UserDefinedOptions$1 } from 'postcss-
|
|
6
|
+
import { UserDefinedOptions as UserDefinedOptions$1, UnitMap, GlobalUnitTransform } from 'postcss-rule-unit-converter';
|
|
7
|
+
import autoprefixer from 'autoprefixer';
|
|
8
|
+
|
|
9
|
+
type AutoprefixerOptions = autoprefixer.Options;
|
|
10
|
+
type WeappAutoprefixerOptions = boolean | AutoprefixerOptions;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* CSS 内容特征探测模块
|
|
14
|
+
*
|
|
15
|
+
* 通过正则和字符串匹配快速判断 CSS 是否包含特定特征,
|
|
16
|
+
* 用于在构建流水线前决定哪些插件可以跳过。
|
|
17
|
+
* 仅使用字符串方法和正则表达式,不引入 AST 解析开销。
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* CSS 内容特征信号,表示哪些特征存在于当前 CSS 中
|
|
21
|
+
*/
|
|
22
|
+
interface FeatureSignal {
|
|
23
|
+
/** CSS 中是否包含现代颜色函数语法(如 rgb(r g b / a) 空格分隔写法) */
|
|
24
|
+
hasModernColorFunction: boolean;
|
|
25
|
+
/** CSS 中是否包含需要 postcss-preset-env 处理的特征 */
|
|
26
|
+
hasPresetEnvFeatures: boolean;
|
|
27
|
+
}
|
|
7
28
|
|
|
8
29
|
type PipelineStage = 'pre' | 'normal' | 'post';
|
|
9
30
|
interface PipelineNodeCursor {
|
|
@@ -45,7 +66,7 @@ interface StyleProcessingPipeline {
|
|
|
45
66
|
nodes: ResolvedPipelineNode[];
|
|
46
67
|
plugins: AcceptedPlugin[];
|
|
47
68
|
}
|
|
48
|
-
declare function createStylePipeline(options: IStyleHandlerOptions): StyleProcessingPipeline;
|
|
69
|
+
declare function createStylePipeline(options: IStyleHandlerOptions, signal?: FeatureSignal): StyleProcessingPipeline;
|
|
49
70
|
|
|
50
71
|
declare function createContext(): {
|
|
51
72
|
variablesScopeWeakMap: WeakMap<WeakKey, any>;
|
|
@@ -77,6 +98,8 @@ interface IPropValue {
|
|
|
77
98
|
prop: string;
|
|
78
99
|
value: string;
|
|
79
100
|
}
|
|
101
|
+
type UniAppXCssTarget = 'uvue';
|
|
102
|
+
type UniAppXUnsupportedMode = 'error' | 'warn' | 'silent';
|
|
80
103
|
type CssPreflightOptions = {
|
|
81
104
|
[key: string]: string | number | boolean;
|
|
82
105
|
} | false;
|
|
@@ -95,12 +118,19 @@ interface InternalCssSelectorReplacerOptions {
|
|
|
95
118
|
interface CssCalcOptions extends PostCssCalcOptions {
|
|
96
119
|
includeCustomProperties?: (string | RegExp)[];
|
|
97
120
|
}
|
|
121
|
+
interface UnitsToPxOptions extends Pick<UserDefinedOptions$1, 'disabled' | 'exclude' | 'mediaQuery' | 'propList' | 'replace' | 'selectorBlackList' | 'unitPrecision'> {
|
|
122
|
+
minValue?: number;
|
|
123
|
+
to?: string;
|
|
124
|
+
unitMap?: UnitMap;
|
|
125
|
+
transform?: GlobalUnitTransform | false;
|
|
126
|
+
}
|
|
98
127
|
type IStyleHandlerOptions = {
|
|
99
128
|
ctx?: IContext;
|
|
100
129
|
postcssOptions?: LoadedPostcssOptions;
|
|
101
130
|
cssRemoveProperty?: boolean;
|
|
102
131
|
cssRemoveHoverPseudoClass?: boolean;
|
|
103
132
|
cssPresetEnv?: PresetEnvOptions;
|
|
133
|
+
autoprefixer?: WeappAutoprefixerOptions;
|
|
104
134
|
cssCalc?: boolean | CssCalcOptions | (string | RegExp)[];
|
|
105
135
|
atRules?: {
|
|
106
136
|
property?: boolean;
|
|
@@ -108,6 +138,8 @@ type IStyleHandlerOptions = {
|
|
|
108
138
|
media?: boolean;
|
|
109
139
|
};
|
|
110
140
|
uniAppX?: boolean;
|
|
141
|
+
uniAppXCssTarget?: UniAppXCssTarget;
|
|
142
|
+
uniAppXUnsupported?: UniAppXUnsupportedMode;
|
|
111
143
|
majorVersion?: number;
|
|
112
144
|
} & RequiredStyleHandlerOptions;
|
|
113
145
|
interface UserDefinedPostcssOptions {
|
|
@@ -115,6 +147,7 @@ interface UserDefinedPostcssOptions {
|
|
|
115
147
|
cssPreflightRange?: 'all';
|
|
116
148
|
cssChildCombinatorReplaceValue?: string | string[];
|
|
117
149
|
cssPresetEnv?: PresetEnvOptions;
|
|
150
|
+
autoprefixer?: WeappAutoprefixerOptions;
|
|
118
151
|
injectAdditionalCssVarScope?: boolean;
|
|
119
152
|
cssSelectorReplacement?: {
|
|
120
153
|
root?: string | string[] | false;
|
|
@@ -122,11 +155,13 @@ interface UserDefinedPostcssOptions {
|
|
|
122
155
|
};
|
|
123
156
|
rem2rpx?: boolean | UserDefinedOptions;
|
|
124
157
|
px2rpx?: boolean | PxTransformOptions;
|
|
125
|
-
unitsToPx?: boolean |
|
|
158
|
+
unitsToPx?: boolean | UnitsToPxOptions;
|
|
126
159
|
postcssOptions?: LoadedPostcssOptions;
|
|
127
160
|
cssRemoveHoverPseudoClass?: boolean;
|
|
128
161
|
cssRemoveProperty?: boolean;
|
|
129
162
|
uniAppX?: boolean;
|
|
163
|
+
uniAppXCssTarget?: UniAppXCssTarget;
|
|
164
|
+
uniAppXUnsupported?: UniAppXUnsupportedMode;
|
|
130
165
|
}
|
|
131
166
|
|
|
132
167
|
interface StyleHandler {
|
|
@@ -134,4 +169,4 @@ interface StyleHandler {
|
|
|
134
169
|
getPipeline: (opt?: Partial<IStyleHandlerOptions>) => StyleProcessingPipeline;
|
|
135
170
|
}
|
|
136
171
|
|
|
137
|
-
export { type CssCalcOptions as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type PipelineNodeContext as P, type RequiredStyleHandlerOptions as R, type StyleHandler as S, type
|
|
172
|
+
export { type CssCalcOptions as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type PipelineNodeContext as P, type RequiredStyleHandlerOptions as R, type StyleHandler as S, type UniAppXCssTarget as U, type WeappAutoprefixerOptions as W, type InternalCssSelectorReplacerOptions as a, type CssPreflightOptions as b, type IPropValue as c, type PipelineNodeCursor as d, type PipelineStage as e, type PresetEnvOptions as f, type ResolvedPipelineNode as g, type StyleProcessingPipeline as h, type UniAppXUnsupportedMode as i, type UnitsToPxOptions as j, type UserDefinedPostcssOptions as k, createInjectPreflight as l, createStylePipeline as m };
|
|
@@ -3,7 +3,28 @@ import { AcceptedPlugin, Result as Result$1 } from 'postcss';
|
|
|
3
3
|
import { Result } from 'postcss-load-config';
|
|
4
4
|
import { PxTransformOptions } from 'postcss-pxtrans';
|
|
5
5
|
import { UserDefinedOptions } from 'postcss-rem-to-responsive-pixel';
|
|
6
|
-
import { UserDefinedOptions as UserDefinedOptions$1 } from 'postcss-
|
|
6
|
+
import { UserDefinedOptions as UserDefinedOptions$1, UnitMap, GlobalUnitTransform } from 'postcss-rule-unit-converter';
|
|
7
|
+
import autoprefixer from 'autoprefixer';
|
|
8
|
+
|
|
9
|
+
type AutoprefixerOptions = autoprefixer.Options;
|
|
10
|
+
type WeappAutoprefixerOptions = boolean | AutoprefixerOptions;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* CSS 内容特征探测模块
|
|
14
|
+
*
|
|
15
|
+
* 通过正则和字符串匹配快速判断 CSS 是否包含特定特征,
|
|
16
|
+
* 用于在构建流水线前决定哪些插件可以跳过。
|
|
17
|
+
* 仅使用字符串方法和正则表达式,不引入 AST 解析开销。
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* CSS 内容特征信号,表示哪些特征存在于当前 CSS 中
|
|
21
|
+
*/
|
|
22
|
+
interface FeatureSignal {
|
|
23
|
+
/** CSS 中是否包含现代颜色函数语法(如 rgb(r g b / a) 空格分隔写法) */
|
|
24
|
+
hasModernColorFunction: boolean;
|
|
25
|
+
/** CSS 中是否包含需要 postcss-preset-env 处理的特征 */
|
|
26
|
+
hasPresetEnvFeatures: boolean;
|
|
27
|
+
}
|
|
7
28
|
|
|
8
29
|
type PipelineStage = 'pre' | 'normal' | 'post';
|
|
9
30
|
interface PipelineNodeCursor {
|
|
@@ -45,7 +66,7 @@ interface StyleProcessingPipeline {
|
|
|
45
66
|
nodes: ResolvedPipelineNode[];
|
|
46
67
|
plugins: AcceptedPlugin[];
|
|
47
68
|
}
|
|
48
|
-
declare function createStylePipeline(options: IStyleHandlerOptions): StyleProcessingPipeline;
|
|
69
|
+
declare function createStylePipeline(options: IStyleHandlerOptions, signal?: FeatureSignal): StyleProcessingPipeline;
|
|
49
70
|
|
|
50
71
|
declare function createContext(): {
|
|
51
72
|
variablesScopeWeakMap: WeakMap<WeakKey, any>;
|
|
@@ -77,6 +98,8 @@ interface IPropValue {
|
|
|
77
98
|
prop: string;
|
|
78
99
|
value: string;
|
|
79
100
|
}
|
|
101
|
+
type UniAppXCssTarget = 'uvue';
|
|
102
|
+
type UniAppXUnsupportedMode = 'error' | 'warn' | 'silent';
|
|
80
103
|
type CssPreflightOptions = {
|
|
81
104
|
[key: string]: string | number | boolean;
|
|
82
105
|
} | false;
|
|
@@ -95,12 +118,19 @@ interface InternalCssSelectorReplacerOptions {
|
|
|
95
118
|
interface CssCalcOptions extends PostCssCalcOptions {
|
|
96
119
|
includeCustomProperties?: (string | RegExp)[];
|
|
97
120
|
}
|
|
121
|
+
interface UnitsToPxOptions extends Pick<UserDefinedOptions$1, 'disabled' | 'exclude' | 'mediaQuery' | 'propList' | 'replace' | 'selectorBlackList' | 'unitPrecision'> {
|
|
122
|
+
minValue?: number;
|
|
123
|
+
to?: string;
|
|
124
|
+
unitMap?: UnitMap;
|
|
125
|
+
transform?: GlobalUnitTransform | false;
|
|
126
|
+
}
|
|
98
127
|
type IStyleHandlerOptions = {
|
|
99
128
|
ctx?: IContext;
|
|
100
129
|
postcssOptions?: LoadedPostcssOptions;
|
|
101
130
|
cssRemoveProperty?: boolean;
|
|
102
131
|
cssRemoveHoverPseudoClass?: boolean;
|
|
103
132
|
cssPresetEnv?: PresetEnvOptions;
|
|
133
|
+
autoprefixer?: WeappAutoprefixerOptions;
|
|
104
134
|
cssCalc?: boolean | CssCalcOptions | (string | RegExp)[];
|
|
105
135
|
atRules?: {
|
|
106
136
|
property?: boolean;
|
|
@@ -108,6 +138,8 @@ type IStyleHandlerOptions = {
|
|
|
108
138
|
media?: boolean;
|
|
109
139
|
};
|
|
110
140
|
uniAppX?: boolean;
|
|
141
|
+
uniAppXCssTarget?: UniAppXCssTarget;
|
|
142
|
+
uniAppXUnsupported?: UniAppXUnsupportedMode;
|
|
111
143
|
majorVersion?: number;
|
|
112
144
|
} & RequiredStyleHandlerOptions;
|
|
113
145
|
interface UserDefinedPostcssOptions {
|
|
@@ -115,6 +147,7 @@ interface UserDefinedPostcssOptions {
|
|
|
115
147
|
cssPreflightRange?: 'all';
|
|
116
148
|
cssChildCombinatorReplaceValue?: string | string[];
|
|
117
149
|
cssPresetEnv?: PresetEnvOptions;
|
|
150
|
+
autoprefixer?: WeappAutoprefixerOptions;
|
|
118
151
|
injectAdditionalCssVarScope?: boolean;
|
|
119
152
|
cssSelectorReplacement?: {
|
|
120
153
|
root?: string | string[] | false;
|
|
@@ -122,11 +155,13 @@ interface UserDefinedPostcssOptions {
|
|
|
122
155
|
};
|
|
123
156
|
rem2rpx?: boolean | UserDefinedOptions;
|
|
124
157
|
px2rpx?: boolean | PxTransformOptions;
|
|
125
|
-
unitsToPx?: boolean |
|
|
158
|
+
unitsToPx?: boolean | UnitsToPxOptions;
|
|
126
159
|
postcssOptions?: LoadedPostcssOptions;
|
|
127
160
|
cssRemoveHoverPseudoClass?: boolean;
|
|
128
161
|
cssRemoveProperty?: boolean;
|
|
129
162
|
uniAppX?: boolean;
|
|
163
|
+
uniAppXCssTarget?: UniAppXCssTarget;
|
|
164
|
+
uniAppXUnsupported?: UniAppXUnsupportedMode;
|
|
130
165
|
}
|
|
131
166
|
|
|
132
167
|
interface StyleHandler {
|
|
@@ -134,4 +169,4 @@ interface StyleHandler {
|
|
|
134
169
|
getPipeline: (opt?: Partial<IStyleHandlerOptions>) => StyleProcessingPipeline;
|
|
135
170
|
}
|
|
136
171
|
|
|
137
|
-
export { type CssCalcOptions as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type PipelineNodeContext as P, type RequiredStyleHandlerOptions as R, type StyleHandler as S, type
|
|
172
|
+
export { type CssCalcOptions as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type PipelineNodeContext as P, type RequiredStyleHandlerOptions as R, type StyleHandler as S, type UniAppXCssTarget as U, type WeappAutoprefixerOptions as W, type InternalCssSelectorReplacerOptions as a, type CssPreflightOptions as b, type IPropValue as c, type PipelineNodeCursor as d, type PipelineStage as e, type PresetEnvOptions as f, type ResolvedPipelineNode as g, type StyleProcessingPipeline as h, type UniAppXUnsupportedMode as i, type UnitsToPxOptions as j, type UserDefinedPostcssOptions as k, createInjectPreflight as l, createStylePipeline as m };
|
package/dist/types.d.mts
CHANGED
|
@@ -3,5 +3,6 @@ import 'postcss';
|
|
|
3
3
|
import 'postcss-load-config';
|
|
4
4
|
export { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
|
|
5
5
|
export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
|
|
6
|
-
|
|
7
|
-
export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, S as StyleHandler, U as UserDefinedPostcssOptions } from './types-
|
|
6
|
+
import 'postcss-rule-unit-converter';
|
|
7
|
+
export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, S as StyleHandler, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UnitsToPxOptions, k as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions } from './types-DiOShlJF.mjs';
|
|
8
|
+
import 'autoprefixer';
|
package/dist/types.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import 'postcss';
|
|
|
3
3
|
import 'postcss-load-config';
|
|
4
4
|
export { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
|
|
5
5
|
export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
|
|
6
|
-
|
|
7
|
-
export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, S as StyleHandler, U as UserDefinedPostcssOptions } from './types-
|
|
6
|
+
import 'postcss-rule-unit-converter';
|
|
7
|
+
export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, S as StyleHandler, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UnitsToPxOptions, k as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions } from './types-DiOShlJF.js';
|
|
8
|
+
import 'autoprefixer';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/postcss",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.0-alpha.1",
|
|
4
4
|
"description": "@weapp-tailwindcss/postcss",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,17 +58,20 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@weapp-core/escape": "~7.0.0",
|
|
60
60
|
"@weapp-tailwindcss/postcss-calc": "^1.0.0",
|
|
61
|
-
"
|
|
61
|
+
"autoprefixer": "^10.5.0",
|
|
62
|
+
"lru-cache": "10.4.3",
|
|
63
|
+
"postcss": "^8.5.12",
|
|
62
64
|
"postcss-preset-env": "^10.6.1",
|
|
63
|
-
"postcss-pxtrans": "^1.0.
|
|
64
|
-
"postcss-rem-to-responsive-pixel": "^7.0.
|
|
65
|
+
"postcss-pxtrans": "^1.0.4",
|
|
66
|
+
"postcss-rem-to-responsive-pixel": "^7.0.4",
|
|
67
|
+
"postcss-rule-unit-converter": "^0.2.2",
|
|
65
68
|
"postcss-selector-parser": "~7.1.1",
|
|
66
|
-
"postcss-units-to-px": "^0.2.0",
|
|
67
69
|
"postcss-value-parser": "^4.2.0",
|
|
68
70
|
"@weapp-tailwindcss/shared": "1.1.3"
|
|
69
71
|
},
|
|
70
72
|
"devDependencies": {
|
|
71
73
|
"@csstools/postcss-is-pseudo-class": "^6.0.0",
|
|
74
|
+
"fast-check": "^4.7.0",
|
|
72
75
|
"postcss-calc": "^10.1.1",
|
|
73
76
|
"postcss-custom-properties": "^14.0.6"
|
|
74
77
|
},
|