@weapp-tailwindcss/postcss 3.0.2 → 3.0.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/README.en.md ADDED
@@ -0,0 +1,9 @@
1
+ # @weapp-tailwindcss/postcss
2
+
3
+ > English | [简体中文](./README.md)
4
+
5
+ This package is the CSS processing core of weapp-tailwindcss. It handles PostCSS AST transforms, selector compatibility, platform differences, and Tailwind output post-processing for mini programs.
6
+
7
+ ## Website
8
+
9
+ For setup guides, configuration references, and framework examples, see the [official weapp-tailwindcss documentation](https://tw.icebreaker.top).
package/README.md CHANGED
@@ -1,99 +1,9 @@
1
- <p align="center">
1
+ # @weapp-tailwindcss/postcss
2
2
 
3
- <a href="https://tw.icebreaker.top">
3
+ > 简体中文 | [English](./README.en.md)
4
4
 
5
- <img src="./assets/logo.png" alt="weapp-tailwindcss-logo" width="128">
6
- </a>
5
+ 这个包是 weapp-tailwindcss 的 CSS 处理核心,负责小程序端的 PostCSS AST 转换、选择器兼容、平台差异处理和 Tailwind 输出后处理。
7
6
 
8
- <br>
7
+ ## 官网
9
8
 
10
- <h1 align="center">weapp-tailwindcss</h1>
11
-
12
- </p>
13
-
14
- > 简体中文(zh-cn) | [English](./README_en.md)
15
-
16
- ![star](https://badgen.net/github/stars/sonofmagic/weapp-tailwindcss)
17
- ![dm0](https://badgen.net/npm/dm/weapp-tailwindcss)
18
- ![license](https://badgen.net/npm/license/weapp-tailwindcss)
19
- [![test](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
20
- [![codecov](https://codecov.io/gh/sonofmagic/weapp-tailwindcss/branch/main/graph/badge.svg?token=zn05qXYznt)](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
21
-
22
- > [!NOTE]
23
- > 降低开发维护成本,提升开发效率的 `小程序` `tailwindcss` 全方面解决方案
24
- >
25
- > `weapp-tailwindcss@4.2.x` 现已支持 `uni-app x` 同时构建 `Web`,`小程序`,`安卓`,`IOS`,`鸿蒙`,详见 [**uni-app x 专题**](https://tw.icebreaker.top/docs/uni-app-x)
26
-
27
- \[[文档地址](https://tw.icebreaker.top)\] \| \[[备用文档地址](https://ice-tw.netlify.app/)\] \| \[[加入技术交流群](https://tw.icebreaker.top/docs/community/group)\]
28
-
29
- - [特性](#特性)
30
- - [版本对应](#版本对应)
31
- - [安装与使用方式](#安装与使用方式)
32
- - [生态和解决方案](#生态和解决方案)
33
- - [常见问题](#常见问题)
34
- - [各个框架的模板](#各个框架的模板)
35
- - [旧版本迁移指南](#旧版本迁移指南)
36
- - [配置项参考](#配置项参考)
37
- - [Contribute](#contribute)
38
- - [License](#license)
39
- - [Star History](#star-history)
40
- - [Related projects](#related-projects)
41
- - [weapp-vite](#weapp-vite)
42
-
43
- ## 特性
44
-
45
- | 不仅仅是`webpack` | 主流框架与原生开发支持 |
46
- | --------------------------------------------------- | ----------------------------------------------- |
47
- | ![wepback+vite+gulp](./assets/weapp-tw-plugins.png) | ![frameworks](./assets/weapp-tw-frameworks.png) |
48
-
49
- 核心插件支持 `webpack`/`vite`/`rspack`/`rollup`/`rolldown`/`gulp` 为基底的框架类小程序开发,涵盖了市面上几乎所有的主流的开发框架。
50
-
51
- 也支持直接从各个开发者工具中,直接创建的原生小程序应用。
52
-
53
- 这些插件能够自动识别并精确处理所有 `tailwindcss` 的工具类来适配小程序环境。
54
-
55
- ## 版本对应
56
-
57
- 目前,`weapp-tailwindcss` 的 `5.x` 版本
58
-
59
- - 支持最新版本的 `tailwindcss v4` 和 `v3`。
60
- - 支持 `webpack5`、`vite`、`rspack`、`rollup`、`rolldown` 和 `gulp` 这些打包工具,也支持纯 `Nodejs` API 的方式,集成到你自己的构建工具中。
61
-
62
- > `weapp-tailwindcss@5` 面向 Tailwind CSS v3/v4 和现代构建链路,不再内置 Webpack4、PostCSS7、Tailwind CSS v2 兼容入口。`weapp-tailwindcss@5` 需要 `nodejs` 版本 `^20.19.0 || >=22.12.0`,建议安装 `nodejs` 的 `LTS` 版本,详见 [nodejs/release](https://github.com/nodejs/release)
63
-
64
- ## [安装与使用方式](https://tw.icebreaker.top/docs/quick-start/install)
65
-
66
- ## [生态和解决方案](https://tw.icebreaker.top/docs/community/templates)
67
-
68
- ## [常见问题](https://tw.icebreaker.top/docs/issues/)
69
-
70
- ## [各个框架的模板](https://tw.icebreaker.top/docs/community/templates)
71
-
72
- ## [旧版本迁移指南](https://tw.icebreaker.top/docs/migrations/v2)
73
-
74
- ## [配置项参考](https://tw.icebreaker.top/docs/api/interfaces/UserDefinedOptions)
75
-
76
- ## Contribute
77
-
78
- 我们邀请你来贡献和帮助改进 `weapp-tailwindcss` 💚💚💚
79
-
80
- 以下有几个方式可以参与:
81
-
82
- - 报告错误:如果您遇到任何错误或问题,请提`issue`并提供完善的错误信息和复现方式。
83
- - 建议:有增强 `weapp-tailwindcss` 的想法吗?请提 `issue` 来分享您的建议。
84
- - 文档:如果您对文档有更好的见解或者更棒的修辞方式,欢迎 `pr`。
85
- - 代码:任何人的代码都不是完美的,我们欢迎你通过 `pr` 给代码提供更好的质量与活力。
86
-
87
- ## License
88
-
89
- [MIT](./LICENSE)
90
-
91
- ## Star History
92
-
93
- [![Star History Chart](https://api.star-history.com/svg?repos=sonofmagic/weapp-tailwindcss&type=Date)](https://star-history.com/#sonofmagic/weapp-tailwindcss&Date)
94
-
95
- ## Related projects
96
-
97
- ### weapp-vite
98
-
99
- [weapp-vite](https://vite.icebreaker.top/): 把现代化的开发模式带入小程序开发!
9
+ 更多接入方式、配置说明和框架示例见 [weapp-tailwindcss 官方文档](https://tw.icebreaker.top)。
@@ -0,0 +1,9 @@
1
+ export declare const COLOR_MIX_NAME = "color-mix";
2
+ export declare const MODERN_COLOR_FUNCTION_NAMES: Set<string>;
3
+ export declare const PLACEHOLDER_PREFIX = "__weapp_tw_color_mix_";
4
+ export declare const DYNAMIC_ALPHA_RE: RegExp;
5
+ export declare const INTERNAL_TAILWIND_ALPHA_RE: RegExp;
6
+ export declare const TRANSPARENT_COLOR_RE: RegExp;
7
+ export declare const CURRENT_COLOR_RE: RegExp;
8
+ export declare const CSS_WIDE_KEYWORD_RE: RegExp;
9
+ export declare const CUSTOM_PROPERTY_RE: RegExp;
@@ -0,0 +1,2 @@
1
+ export declare function isDisplayP3ColorFunction(colorSource: string): boolean;
2
+ export declare function hasUnsupportedModernColorFunction(value: string): boolean;
@@ -0,0 +1,9 @@
1
+ import type { ColorData } from '@csstools/css-color-parser';
2
+ import type { Node } from 'postcss-value-parser';
3
+ export declare function splitArguments(nodes: Node[]): Node[][];
4
+ export declare function splitStopSegments(nodes: Node[]): Node[][];
5
+ export declare function trimNodes(nodes: Node[]): Node[];
6
+ export declare function parseAlphaValue(alphaSource: string): number | undefined;
7
+ export declare function resolveColorData(colorSource: string, customPropertyValues: ReadonlyMap<string, string>, depth?: number): ColorData | undefined;
8
+ export declare function normalizeColorFunctionName(colorSource: string, alpha: number, customPropertyValues: ReadonlyMap<string, string>): string | undefined;
9
+ export declare function normalizeStandaloneColorFunction(colorSource: string): string | undefined;
@@ -0,0 +1,5 @@
1
+ import type { FunctionNode } from 'postcss-value-parser';
2
+ export declare function tryResolveColorMix(node: FunctionNode, customPropertyValues: ReadonlyMap<string, string>): {
3
+ value: string;
4
+ deferred: boolean;
5
+ } | undefined;
@@ -0,0 +1,5 @@
1
+ import postcss from 'postcss';
2
+ export declare const TAILWIND_V4_BANNER_RE: RegExp;
3
+ export declare function hasTailwindcssV4Signal(css: string): boolean;
4
+ export declare function unwrapTailwindSourceMedia(root: postcss.Root): void;
5
+ export declare function removeTailwindGenerationDirectives(root: postcss.Root): void;
@@ -0,0 +1,6 @@
1
+ import type { CssPreflightOptions } from '../../types';
2
+ export interface FinalizeMiniProgramCssOptions {
3
+ cssPreflight?: CssPreflightOptions | undefined;
4
+ preservePseudoContentInit?: boolean;
5
+ isTailwindcssV4?: boolean | undefined;
6
+ }
@@ -1,13 +1,6 @@
1
- import type { CssPreflightOptions } from '../../types';
2
- import postcss from 'postcss';
3
- export interface FinalizeMiniProgramCssOptions {
4
- cssPreflight?: CssPreflightOptions | undefined;
5
- preservePseudoContentInit?: boolean;
6
- isTailwindcssV4?: boolean | undefined;
7
- }
8
- export declare function collectPreflightRules(root: postcss.Root, options?: {
9
- preservePseudoContentInit?: boolean;
10
- }): postcss.Rule[];
11
- export declare function insertHoistedRules(root: postcss.Root, rules: postcss.Rule[], anchor?: postcss.Comment): void;
1
+ import type { FinalizeMiniProgramCssOptions } from './finalize-options';
2
+ export type { FinalizeMiniProgramCssOptions } from './finalize-options';
3
+ export { insertHoistedRules } from './hoist';
4
+ export { collectPreflightRules } from './preflight';
12
5
  export declare function hoistTailwindPreflightBase(css: string): string;
13
6
  export declare function finalizeMiniProgramCss(css: string, options?: FinalizeMiniProgramCssOptions): string;
@@ -0,0 +1,4 @@
1
+ import postcss from 'postcss';
2
+ export declare function createHoistInsertionAnchor(root: postcss.Root): postcss.Comment | undefined;
3
+ export declare function insertHoistedRules(root: postcss.Root, rules: postcss.Rule[], anchor?: postcss.Comment): void;
4
+ export declare function mergeEquivalentHoistedRules(rules: postcss.Rule[]): postcss.Rule[];
@@ -0,0 +1,7 @@
1
+ import type { CssPreflightOptions } from '../../types';
2
+ import postcss from 'postcss';
3
+ export declare function collectPreflightRules(root: postcss.Root, options?: {
4
+ preservePseudoContentInit?: boolean;
5
+ cssPreflight?: CssPreflightOptions | undefined;
6
+ }): postcss.Rule[];
7
+ export declare function createPreflightResetRule(cssPreflight: CssPreflightOptions | undefined): postcss.Rule | undefined;
@@ -2,4 +2,10 @@ import type postcss from 'postcss';
2
2
  export declare function removeSpecificityPlaceholders(root: postcss.Root): void;
3
3
  export declare function removeUnsupportedBrowserSelectors(root: postcss.Root): void;
4
4
  export declare function removeDisplayP3Declarations(root: postcss.Root): void;
5
+ interface RemoveTailwindContainerRulesOptions {
6
+ generatedOnly?: boolean;
7
+ }
8
+ export declare function removeTailwindContainerMaxWidthMediaRules(root: postcss.Root): void;
9
+ export declare function removeTailwindContainerWidthRules(root: postcss.Root, options?: RemoveTailwindContainerRulesOptions): void;
5
10
  export declare function removeUnsupportedModernColorDeclarations(root: postcss.Root): void;
11
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { FinalizeMiniProgramCssOptions } from './finalize-options';
2
+ import postcss from 'postcss';
3
+ export declare function collectThemeVariableRule(root: postcss.Root, options?: FinalizeMiniProgramCssOptions): postcss.Rule | undefined;