@weapp-tailwindcss/postcss 3.1.3 → 3.1.5

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.
@@ -1,5 +1,7 @@
1
1
  //#region src/css-macro/constants.ts
2
2
  const queryKey = "weapp-tw-platform";
3
+ const ifdefAtRule = "weapp-tw-ifdef";
4
+ const ifndefAtRule = "weapp-tw-ifndef";
3
5
  const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
4
6
  const WHITESPACE_RE = /\s+/g;
5
7
  const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
@@ -155,4 +157,4 @@ const creator = () => {
155
157
  };
156
158
  creator.postcss = true;
157
159
  //#endregion
158
- export { creator as n, CSS_MACRO_POSTCSS_PLUGIN_NAME as t };
160
+ export { CSS_MACRO_POSTCSS_PLUGIN_NAME, creator, ifdefAtRule, ifndefAtRule };
@@ -1,5 +1,7 @@
1
1
  //#region src/css-macro/constants.ts
2
2
  const queryKey = "weapp-tw-platform";
3
+ const ifdefAtRule = "weapp-tw-ifdef";
4
+ const ifndefAtRule = "weapp-tw-ifndef";
3
5
  const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
4
6
  const WHITESPACE_RE = /\s+/g;
5
7
  const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
@@ -167,3 +169,15 @@ Object.defineProperty(exports, "creator", {
167
169
  return creator;
168
170
  }
169
171
  });
172
+ Object.defineProperty(exports, "ifdefAtRule", {
173
+ enumerable: true,
174
+ get: function() {
175
+ return ifdefAtRule;
176
+ }
177
+ });
178
+ Object.defineProperty(exports, "ifndefAtRule", {
179
+ enumerable: true,
180
+ get: function() {
181
+ return ifndefAtRule;
182
+ }
183
+ });
@@ -8,4 +8,4 @@ export type ParserTransformOptions = Partial<{
8
8
  export declare function normalizeTransformOptions(options?: ParserTransformOptions): ParserTransformOptions;
9
9
  export declare function mklist(node: Node): Node[];
10
10
  export declare function composeIsPseudoAst(strs: string | string[]): Node[];
11
- export declare function getCombinatorSelectorAst(options: IStyleHandlerOptions): (psp.Pseudo | psp.Selector | psp.String | psp.Tag | psp.Root | psp.Nesting | psp.Identifier | psp.Comment | psp.Combinator | psp.ClassName | psp.Attribute | psp.Universal)[];
11
+ export declare function getCombinatorSelectorAst(options: IStyleHandlerOptions): (psp.Pseudo | psp.Selector | psp.String | psp.Root | psp.Tag | psp.Nesting | psp.Identifier | psp.Comment | psp.Combinator | psp.ClassName | psp.Attribute | psp.Universal)[];
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { PostCssCalcOptions } from '@weapp-tailwindcss/postcss-calc';
2
2
  import type { Result as PostcssResult } from 'postcss';
3
3
  import type { Result } from 'postcss-load-config';
4
- import type { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
4
+ import type pxtrans from 'postcss-pxtrans';
5
5
  import type { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
6
6
  import type { GlobalUnitTransform, UserDefinedOptions as UnitConverterOptions, UnitMap } from 'postcss-rule-unit-converter';
7
7
  import type { WeappAutoprefixerOptions } from './autoprefixer';
@@ -14,6 +14,7 @@ export interface IPropValue {
14
14
  prop: string;
15
15
  value: string;
16
16
  }
17
+ export type Px2rpxOptions = NonNullable<Parameters<typeof pxtrans>[0]>;
17
18
  export type UniAppXCssTarget = 'uvue';
18
19
  export type UniAppXUnsupportedMode = 'error' | 'warn' | 'silent';
19
20
  export type CssPreflightOptions = {
@@ -63,16 +64,47 @@ export interface CssAtRules {
63
64
  media?: boolean | undefined;
64
65
  }
65
66
  export type WebCssCompatPreset = 'off' | 'legacy-web';
67
+ /**
68
+ * Web 兼容降级的功能开关。
69
+ */
66
70
  export interface WebCssCompatFeatures {
71
+ /**
72
+ * 降级 Tailwind CSS v4 `@theme` 变量规则。
73
+ */
67
74
  theme?: boolean | undefined;
75
+ /**
76
+ * 移除或展平 `@layer`,避免旧 WebView 对层叠层支持不足。
77
+ */
68
78
  layer?: boolean | undefined;
79
+ /**
80
+ * 移除 `@property`,避免旧 WebView 解析失败。
81
+ */
69
82
  property?: boolean | undefined;
83
+ /**
84
+ * 展开 CSS nesting 语法。
85
+ */
86
+ nesting?: boolean | undefined;
87
+ /**
88
+ * 为 `oklch()` 颜色补充兼容声明。
89
+ */
70
90
  oklch?: boolean | undefined;
91
+ /**
92
+ * 为现代颜色函数补充兼容声明。
93
+ */
71
94
  colorFunctions?: boolean | undefined;
95
+ /**
96
+ * 处理 Tailwind CSS v4 生成的 `@supports` 包裹。
97
+ */
72
98
  supports?: boolean | undefined;
73
99
  }
74
100
  export interface WebCssCompatOptions {
101
+ /**
102
+ * 兼容预设。`legacy-web` 面向旧 Android/iOS WebView,`off` 表示关闭降级。
103
+ */
75
104
  preset?: WebCssCompatPreset | undefined;
105
+ /**
106
+ * 按功能覆盖预设中的降级开关。
107
+ */
76
108
  features?: WebCssCompatFeatures | undefined;
77
109
  }
78
110
  export type WebCssCompatUserOptions = boolean | WebCssCompatOptions;
@@ -212,7 +244,7 @@ export interface UserDefinedPostcssOptions {
212
244
  uniAppXCssTarget?: UniAppXCssTarget | undefined;
213
245
  uniAppXUnsupported?: UniAppXUnsupportedMode | undefined;
214
246
  }
215
- export type { CssCalcOptions, PresetEnvOptions, Px2rpxOptions, Rem2rpxOptions, WeappAutoprefixerOptions, };
247
+ export type { CssCalcOptions, PresetEnvOptions, Rem2rpxOptions, WeappAutoprefixerOptions, };
216
248
  export interface StyleHandler {
217
249
  (rawSource: string, opt?: Partial<IStyleHandlerOptions>): Promise<PostcssResult>;
218
250
  getPipeline: (opt?: Partial<IStyleHandlerOptions>) => StyleProcessingPipeline;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "@weapp-tailwindcss/postcss",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -64,12 +64,12 @@
64
64
  "node": "^20.19.0 || >=22.12.0"
65
65
  },
66
66
  "dependencies": {
67
- "@tailwindcss-mangle/engine": "0.1.1",
67
+ "@tailwindcss-mangle/engine": "0.1.2",
68
68
  "@weapp-core/escape": "~8.0.0",
69
69
  "autoprefixer": "^10.5.2",
70
70
  "lru-cache": "11.5.1",
71
71
  "micromatch": "^4.0.8",
72
- "postcss": "^8.5.15",
72
+ "postcss": "^8.5.16",
73
73
  "postcss-load-config": "^6.0.1",
74
74
  "postcss-pxtrans": "^1.0.4",
75
75
  "postcss-rem-to-responsive-pixel": "^7.0.4",
@@ -78,7 +78,7 @@
78
78
  "postcss-value-parser": "^4.2.0",
79
79
  "@weapp-tailwindcss/postcss-calc": "^1.0.2",
80
80
  "@weapp-tailwindcss/shared": "2.0.0",
81
- "tailwindcss-config": "2.0.0"
81
+ "tailwindcss-config": "2.0.1"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@csstools/css-color-parser": "^4.1.9",
@@ -88,7 +88,7 @@
88
88
  "fast-check": "^4.8.0",
89
89
  "postcss-calc": "link:packages/postcss-calc",
90
90
  "postcss-custom-properties": "^15.0.1",
91
- "postcss-preset-env": "^11.3.1"
91
+ "postcss-preset-env": "^11.3.2"
92
92
  },
93
93
  "scripts": {
94
94
  "dev": "tsdown --watch --sourcemap",