@weapp-tailwindcss/postcss 3.1.1 → 3.1.3
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/compat/web-css.d.ts +7 -0
- package/dist/generator-plugin/types.d.ts +3 -1
- package/dist/html-transform.js +193 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2205 -896
- package/dist/index.mjs +2158 -852
- package/dist/rolldown-runtime-emK7D4bc.js +35 -0
- package/dist/types.d.ts +14 -0
- package/package.json +3 -3
- package/dist/html-transform-CMF3g0Cc.js +0 -232
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
Object.defineProperty(exports, "__commonJSMin", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function() {
|
|
27
|
+
return __commonJSMin;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "__toESM", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function() {
|
|
33
|
+
return __toESM;
|
|
34
|
+
}
|
|
35
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -62,6 +62,20 @@ export interface CssAtRules {
|
|
|
62
62
|
supports?: boolean | undefined;
|
|
63
63
|
media?: boolean | undefined;
|
|
64
64
|
}
|
|
65
|
+
export type WebCssCompatPreset = 'off' | 'legacy-web';
|
|
66
|
+
export interface WebCssCompatFeatures {
|
|
67
|
+
theme?: boolean | undefined;
|
|
68
|
+
layer?: boolean | undefined;
|
|
69
|
+
property?: boolean | undefined;
|
|
70
|
+
oklch?: boolean | undefined;
|
|
71
|
+
colorFunctions?: boolean | undefined;
|
|
72
|
+
supports?: boolean | undefined;
|
|
73
|
+
}
|
|
74
|
+
export interface WebCssCompatOptions {
|
|
75
|
+
preset?: WebCssCompatPreset | undefined;
|
|
76
|
+
features?: WebCssCompatFeatures | undefined;
|
|
77
|
+
}
|
|
78
|
+
export type WebCssCompatUserOptions = boolean | WebCssCompatOptions;
|
|
65
79
|
export interface CssOptions {
|
|
66
80
|
cssPreflight?: CssPreflightOptions | undefined;
|
|
67
81
|
cssPreflightRange?: 'all' | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/postcss",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "@weapp-tailwindcss/postcss",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@tailwindcss-mangle/engine": "0.1.1",
|
|
68
68
|
"@weapp-core/escape": "~8.0.0",
|
|
69
|
-
"autoprefixer": "^10.5.
|
|
69
|
+
"autoprefixer": "^10.5.2",
|
|
70
70
|
"lru-cache": "11.5.1",
|
|
71
71
|
"micromatch": "^4.0.8",
|
|
72
72
|
"postcss": "^8.5.15",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"tailwindcss-config": "2.0.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@csstools/css-color-parser": "^4.1.
|
|
84
|
+
"@csstools/css-color-parser": "^4.1.9",
|
|
85
85
|
"@csstools/css-parser-algorithms": "^4.0.0",
|
|
86
86
|
"@csstools/css-tokenizer": "^4.0.0",
|
|
87
87
|
"@csstools/postcss-is-pseudo-class": "^6.0.0",
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
|
-
let node_process = require("node:process");
|
|
25
|
-
node_process = __toESM(node_process);
|
|
26
|
-
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
27
|
-
//#region src/html-transform.ts
|
|
28
|
-
const htmlTags = [
|
|
29
|
-
"html",
|
|
30
|
-
"body",
|
|
31
|
-
"a",
|
|
32
|
-
"audio",
|
|
33
|
-
"button",
|
|
34
|
-
"canvas",
|
|
35
|
-
"form",
|
|
36
|
-
"iframe",
|
|
37
|
-
"img",
|
|
38
|
-
"input",
|
|
39
|
-
"label",
|
|
40
|
-
"progress",
|
|
41
|
-
"select",
|
|
42
|
-
"slot",
|
|
43
|
-
"textarea",
|
|
44
|
-
"video",
|
|
45
|
-
"abbr",
|
|
46
|
-
"area",
|
|
47
|
-
"b",
|
|
48
|
-
"bdi",
|
|
49
|
-
"big",
|
|
50
|
-
"br",
|
|
51
|
-
"cite",
|
|
52
|
-
"code",
|
|
53
|
-
"data",
|
|
54
|
-
"datalist",
|
|
55
|
-
"del",
|
|
56
|
-
"dfn",
|
|
57
|
-
"em",
|
|
58
|
-
"i",
|
|
59
|
-
"ins",
|
|
60
|
-
"kbd",
|
|
61
|
-
"map",
|
|
62
|
-
"mark",
|
|
63
|
-
"meter",
|
|
64
|
-
"output",
|
|
65
|
-
"picture",
|
|
66
|
-
"q",
|
|
67
|
-
"s",
|
|
68
|
-
"samp",
|
|
69
|
-
"small",
|
|
70
|
-
"span",
|
|
71
|
-
"strong",
|
|
72
|
-
"sub",
|
|
73
|
-
"sup",
|
|
74
|
-
"td",
|
|
75
|
-
"template",
|
|
76
|
-
"th",
|
|
77
|
-
"time",
|
|
78
|
-
"tt",
|
|
79
|
-
"u",
|
|
80
|
-
"var",
|
|
81
|
-
"wbr",
|
|
82
|
-
"address",
|
|
83
|
-
"article",
|
|
84
|
-
"aside",
|
|
85
|
-
"blockquote",
|
|
86
|
-
"caption",
|
|
87
|
-
"dd",
|
|
88
|
-
"details",
|
|
89
|
-
"dialog",
|
|
90
|
-
"div",
|
|
91
|
-
"dl",
|
|
92
|
-
"dt",
|
|
93
|
-
"fieldset",
|
|
94
|
-
"figcaption",
|
|
95
|
-
"figure",
|
|
96
|
-
"footer",
|
|
97
|
-
"h1",
|
|
98
|
-
"h2",
|
|
99
|
-
"h3",
|
|
100
|
-
"h4",
|
|
101
|
-
"h5",
|
|
102
|
-
"h6",
|
|
103
|
-
"header",
|
|
104
|
-
"hgroup",
|
|
105
|
-
"hr",
|
|
106
|
-
"legend",
|
|
107
|
-
"li",
|
|
108
|
-
"main",
|
|
109
|
-
"nav",
|
|
110
|
-
"ol",
|
|
111
|
-
"p",
|
|
112
|
-
"pre",
|
|
113
|
-
"section",
|
|
114
|
-
"summary",
|
|
115
|
-
"table",
|
|
116
|
-
"tbody",
|
|
117
|
-
"tfoot",
|
|
118
|
-
"thead",
|
|
119
|
-
"tr",
|
|
120
|
-
"ul",
|
|
121
|
-
"svg"
|
|
122
|
-
];
|
|
123
|
-
const miniAppTags = [
|
|
124
|
-
"cover-image",
|
|
125
|
-
"cover-view",
|
|
126
|
-
"match-media",
|
|
127
|
-
"movable-area",
|
|
128
|
-
"movable-view",
|
|
129
|
-
"page-container",
|
|
130
|
-
"scroll-view",
|
|
131
|
-
"share-element",
|
|
132
|
-
"swiper",
|
|
133
|
-
"swiper-item",
|
|
134
|
-
"view",
|
|
135
|
-
"icon",
|
|
136
|
-
"progress",
|
|
137
|
-
"rich-text",
|
|
138
|
-
"text",
|
|
139
|
-
"button",
|
|
140
|
-
"checkbox",
|
|
141
|
-
"checkbox-group",
|
|
142
|
-
"editor",
|
|
143
|
-
"form",
|
|
144
|
-
"input",
|
|
145
|
-
"keyboard-accessory",
|
|
146
|
-
"label",
|
|
147
|
-
"picker",
|
|
148
|
-
"picker-view",
|
|
149
|
-
"picker-view-column",
|
|
150
|
-
"radio",
|
|
151
|
-
"radio-group",
|
|
152
|
-
"slider",
|
|
153
|
-
"switch",
|
|
154
|
-
"textarea",
|
|
155
|
-
"functional-page-navigator",
|
|
156
|
-
"navigator",
|
|
157
|
-
"audio",
|
|
158
|
-
"camera",
|
|
159
|
-
"image",
|
|
160
|
-
"live-player",
|
|
161
|
-
"live-pusher",
|
|
162
|
-
"video",
|
|
163
|
-
"voip-room",
|
|
164
|
-
"map",
|
|
165
|
-
"canvas",
|
|
166
|
-
"web-view",
|
|
167
|
-
"ad",
|
|
168
|
-
"ad-custom",
|
|
169
|
-
"official-account",
|
|
170
|
-
"open-data",
|
|
171
|
-
"navigation-bar",
|
|
172
|
-
"page-meta"
|
|
173
|
-
];
|
|
174
|
-
const tags2Rgx = (tags = []) => new RegExp(`(^| |\\+|,|~|>|\\n)(${tags.join("|")})\\b(?=$| |\\.|\\+|,|~|:|\\[)`, "g");
|
|
175
|
-
const UNIVERSAL_SELECTOR_RE = /(?:^| )\*(?![=/*])/;
|
|
176
|
-
const postcssHtmlTransform = (opts = {}) => {
|
|
177
|
-
const options = (0, _weapp_tailwindcss_shared.defu)(opts, { platform: node_process.default.env.TARO_ENV });
|
|
178
|
-
let selectorFilter;
|
|
179
|
-
let walkRules;
|
|
180
|
-
switch (options.platform) {
|
|
181
|
-
case "h5":
|
|
182
|
-
selectorFilter = tags2Rgx(miniAppTags);
|
|
183
|
-
walkRules = (rule) => {
|
|
184
|
-
rule.selector = rule.selector.replace(selectorFilter, "$1taro-$2-core");
|
|
185
|
-
};
|
|
186
|
-
break;
|
|
187
|
-
case "rn": break;
|
|
188
|
-
case "quickapp": break;
|
|
189
|
-
default: {
|
|
190
|
-
const selector = tags2Rgx(htmlTags);
|
|
191
|
-
walkRules = (rule) => {
|
|
192
|
-
if (options.removeUniversal && UNIVERSAL_SELECTOR_RE.test(rule.selector)) {
|
|
193
|
-
rule.remove();
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
rule.selector = rule.selector.replace(selector, "$1.h5-$2");
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return {
|
|
201
|
-
postcssPlugin: "postcss-html-transform",
|
|
202
|
-
Rule(rule) {
|
|
203
|
-
if (typeof walkRules === "function") if (selectorFilter && selectorFilter.test(rule.selector)) walkRules(rule);
|
|
204
|
-
else walkRules(rule);
|
|
205
|
-
},
|
|
206
|
-
Declaration(decl) {
|
|
207
|
-
if (options?.removeCursorStyle) {
|
|
208
|
-
if (decl.prop === "cursor") decl.remove();
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
postcssHtmlTransform.postcss = true;
|
|
214
|
-
//#endregion
|
|
215
|
-
Object.defineProperty(exports, "__commonJSMin", {
|
|
216
|
-
enumerable: true,
|
|
217
|
-
get: function() {
|
|
218
|
-
return __commonJSMin;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
Object.defineProperty(exports, "__toESM", {
|
|
222
|
-
enumerable: true,
|
|
223
|
-
get: function() {
|
|
224
|
-
return __toESM;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
Object.defineProperty(exports, "postcssHtmlTransform", {
|
|
228
|
-
enumerable: true,
|
|
229
|
-
get: function() {
|
|
230
|
-
return postcssHtmlTransform;
|
|
231
|
-
}
|
|
232
|
-
});
|