weapp-tailwindcss 5.0.0-next.30 → 5.0.0-next.32
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/auto-DEHRmEAx.mjs +200 -0
- package/dist/auto-dPpsm6FB.js +238 -0
- package/dist/{bundle-state-Bi-cQua6.mjs → bundle-state-BIsgsoNW.mjs} +2 -2
- package/dist/{bundle-state-Ct_8GcSR.js → bundle-state-C4ib5xPG.js} +3 -3
- package/dist/bundlers/shared/generator-css/directives.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +2 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{generator-CrU-Ghc1.js → generator-BEXaaUzP.js} +1 -1
- package/dist/{generator-Qw-tZ0Z2.mjs → generator-CpsHA4Wd.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +7 -7
- package/dist/gulp.mjs +6 -6
- package/dist/{incremental-runtime-class-set-BxvZONkv.js → incremental-runtime-class-set-CLP1Qv8F.js} +266 -11
- package/dist/{incremental-runtime-class-set-BdZHkoTs.mjs → incremental-runtime-class-set-D2fsgk5t.mjs} +260 -11
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-C6zOQqlL.mjs → postcss-BvkdIZr8.mjs} +3 -3
- package/dist/{postcss-DAWf9D3C.js → postcss-DN7IQzYb.js} +4 -4
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-D7gJSmJz.js → precheck-CQeqnfo5.js} +4 -4
- package/dist/{precheck-D7K12zeX.mjs → precheck-nITnYBDn.mjs} +3 -3
- package/dist/presets.js +4 -4
- package/dist/presets.mjs +3 -3
- package/dist/{source-candidates-DNM8iwXW.js → source-candidates-7Q-kTOSb.js} +1 -1
- package/dist/{source-candidates-CX2ozpKM.mjs → source-candidates-_x8bq0Mz.mjs} +1 -1
- package/dist/{tailwindcss-B-e2RiXr.js → tailwindcss-Cl7hUlYV.js} +3 -3
- package/dist/{tailwindcss-C7dJHZ0G.mjs → tailwindcss-udhXxMX9.mjs} +2 -2
- package/dist/{v3-engine-DcvCCHfs.mjs → v3-engine-C_KeUQG3.mjs} +6 -6
- package/dist/{v3-engine-CHItlVq5.js → v3-engine-DwY4Fixu.js} +7 -7
- package/dist/{vite-rmL1rsA_.mjs → vite-BAHjBu8j.mjs} +17 -10
- package/dist/{vite-C65DdWEj.js → vite-CYkkJZ3Q.js} +18 -11
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +328 -12
- package/dist/{webpack-CqGvjvSQ.js → webpack-CPwDaKy3.js} +8 -8
- package/dist/{webpack-BU2Er4qg.mjs → webpack-xxmiRxcy.mjs} +7 -7
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +4 -4
- package/dist/auto-TH1jG2UW.js +0 -115
- package/dist/auto-XyKTOP7B.mjs +0 -78
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { n as creator } from "./postcss-C7BMYpEF.mjs";
|
|
2
|
+
import postcss from "postcss";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
//#region src/css-macro/auto.ts
|
|
5
|
+
const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
|
|
6
|
+
const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
|
|
7
|
+
const PLATFORM_ENV_KEYS = [
|
|
8
|
+
"WEAPP_TW_TARGET",
|
|
9
|
+
"WEAPP_TAILWINDCSS_TARGET",
|
|
10
|
+
"UNI_PLATFORM",
|
|
11
|
+
"UNI_UTS_PLATFORM",
|
|
12
|
+
"TARO_ENV",
|
|
13
|
+
"MPX_CLI_MODE",
|
|
14
|
+
"MPX_CURRENT_TARGET_MODE"
|
|
15
|
+
];
|
|
16
|
+
const CONDITIONAL_END_RE = /^\s*#endif\s*$/;
|
|
17
|
+
function readEnvValue(key) {
|
|
18
|
+
return typeof process === "undefined" ? void 0 : process.env[key];
|
|
19
|
+
}
|
|
20
|
+
function normalizePlatformToken(value) {
|
|
21
|
+
return value?.trim().replaceAll("_", "-").toUpperCase() || void 0;
|
|
22
|
+
}
|
|
23
|
+
function resolveCssMacroPlatform(options) {
|
|
24
|
+
const explicit = normalizePlatformToken(options?.platform);
|
|
25
|
+
if (explicit) return explicit;
|
|
26
|
+
for (const key of PLATFORM_ENV_KEYS) {
|
|
27
|
+
const value = normalizePlatformToken(readEnvValue(key));
|
|
28
|
+
if (value) return value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function createPlatformTokenSet(platform) {
|
|
32
|
+
const normalized = normalizePlatformToken(platform);
|
|
33
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
34
|
+
if (!normalized) return tokens;
|
|
35
|
+
tokens.add(normalized);
|
|
36
|
+
if (normalized.startsWith("MP-")) tokens.add("MP");
|
|
37
|
+
if (normalized === "WEAPP" || normalized === "WEIXIN" || normalized === "WX") {
|
|
38
|
+
tokens.add("MP");
|
|
39
|
+
tokens.add("MP-WEIXIN");
|
|
40
|
+
}
|
|
41
|
+
if (normalized === "MP-WEIXIN") {
|
|
42
|
+
tokens.add("WEAPP");
|
|
43
|
+
tokens.add("WEIXIN");
|
|
44
|
+
tokens.add("WX");
|
|
45
|
+
}
|
|
46
|
+
if (normalized === "H5") tokens.add("WEB");
|
|
47
|
+
if (normalized === "WEB") tokens.add("H5");
|
|
48
|
+
if (normalized === "APP") tokens.add("APP-PLUS");
|
|
49
|
+
if (normalized.startsWith("APP-")) tokens.add("APP");
|
|
50
|
+
if (normalized.startsWith("QUICKAPP-WEBVIEW")) tokens.add("QUICKAPP-WEBVIEW");
|
|
51
|
+
return tokens;
|
|
52
|
+
}
|
|
53
|
+
function combineAnd(values) {
|
|
54
|
+
if (values.includes(false)) return false;
|
|
55
|
+
return values.every((value) => value === true) ? true : void 0;
|
|
56
|
+
}
|
|
57
|
+
function combineOr(values) {
|
|
58
|
+
if (values.includes(true)) return true;
|
|
59
|
+
return values.every((value) => value === false) ? false : void 0;
|
|
60
|
+
}
|
|
61
|
+
function evaluatePlatformExpression(expression, platformTokens) {
|
|
62
|
+
return combineOr(expression.split(/\s*\|\|\s*/).map((orPart) => {
|
|
63
|
+
return combineAnd(orPart.split(/\s*&&\s*/).map((part) => {
|
|
64
|
+
const token = normalizePlatformToken(part);
|
|
65
|
+
if (!token || /[<>=!()]/.test(token)) return;
|
|
66
|
+
return platformTokens.has(token);
|
|
67
|
+
}));
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
function negateConditionalValue(value) {
|
|
71
|
+
return value === void 0 ? void 0 : !value;
|
|
72
|
+
}
|
|
73
|
+
function getActiveConditionalValue(stack) {
|
|
74
|
+
if (stack.includes(false)) return false;
|
|
75
|
+
return stack.includes(void 0) ? void 0 : true;
|
|
76
|
+
}
|
|
77
|
+
function parseConditionalStart(text) {
|
|
78
|
+
const normalized = text.trim();
|
|
79
|
+
if (!normalized.startsWith("#")) return;
|
|
80
|
+
const body = normalized.slice(1).trimStart();
|
|
81
|
+
for (const directive of ["ifndef", "ifdef"]) {
|
|
82
|
+
if (!body.startsWith(directive)) continue;
|
|
83
|
+
const expression = body.slice(directive.length).trim();
|
|
84
|
+
if (expression.length === 0) return;
|
|
85
|
+
return {
|
|
86
|
+
directive,
|
|
87
|
+
expression
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function compileCssMacroConditionalComments(css, options) {
|
|
92
|
+
const platformTokens = createPlatformTokenSet(resolveCssMacroPlatform(options));
|
|
93
|
+
if (platformTokens.size === 0 || !css.includes("#if")) return css;
|
|
94
|
+
try {
|
|
95
|
+
const root = postcss.parse(css);
|
|
96
|
+
const transformContainer = (container) => {
|
|
97
|
+
const stack = [];
|
|
98
|
+
for (const node of [...container.nodes ?? []]) {
|
|
99
|
+
if (node.type === "comment") {
|
|
100
|
+
const start = parseConditionalStart(node.text);
|
|
101
|
+
if (start) {
|
|
102
|
+
const value = start.directive === "ifndef" ? negateConditionalValue(evaluatePlatformExpression(start.expression, platformTokens)) : evaluatePlatformExpression(start.expression, platformTokens);
|
|
103
|
+
const parentActive = getActiveConditionalValue(stack);
|
|
104
|
+
stack.push(value);
|
|
105
|
+
if (parentActive !== void 0 && value !== void 0) node.remove();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (CONDITIONAL_END_RE.test(node.text)) {
|
|
109
|
+
const value = stack.pop();
|
|
110
|
+
if (getActiveConditionalValue(stack) !== void 0 && value !== void 0) node.remove();
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (getActiveConditionalValue(stack) === false) {
|
|
115
|
+
node.remove();
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if ("nodes" in node && node.nodes) transformContainer(node);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
transformContainer(root);
|
|
122
|
+
return root.toString();
|
|
123
|
+
} catch {
|
|
124
|
+
return css;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function markCssMacroPlugin(value) {
|
|
128
|
+
Object.defineProperty(value, CSS_MACRO_PLUGIN_MARKER, {
|
|
129
|
+
configurable: false,
|
|
130
|
+
enumerable: false,
|
|
131
|
+
value: true
|
|
132
|
+
});
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
function isCssMacroTailwindPlugin(value) {
|
|
136
|
+
return Boolean(value && (typeof value === "function" || typeof value === "object") && value["__weappTailwindcssCssMacro"] === true);
|
|
137
|
+
}
|
|
138
|
+
function hasCssMacroTailwindPlugin(plugins) {
|
|
139
|
+
if (!plugins) return false;
|
|
140
|
+
if (Array.isArray(plugins)) return plugins.some(isCssMacroTailwindPlugin);
|
|
141
|
+
if (typeof plugins === "object") return Object.values(plugins).some(isCssMacroTailwindPlugin);
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
function parseCssPluginRequest(params) {
|
|
145
|
+
const value = params.trim();
|
|
146
|
+
const quoted = /^(['"])(.*?)\1/.exec(value);
|
|
147
|
+
if (quoted) return quoted[2];
|
|
148
|
+
const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
|
|
149
|
+
return url?.[2] ?? url?.[3];
|
|
150
|
+
}
|
|
151
|
+
function isCssMacroPluginRequest(request) {
|
|
152
|
+
return request === "weapp-tailwindcss/css-macro";
|
|
153
|
+
}
|
|
154
|
+
function hasCssMacroTailwindV4Directive(css) {
|
|
155
|
+
if (!css?.includes("css-macro")) return false;
|
|
156
|
+
try {
|
|
157
|
+
let found = false;
|
|
158
|
+
postcss.parse(css).walkAtRules("plugin", (rule) => {
|
|
159
|
+
if (isCssMacroPluginRequest(parseCssPluginRequest(rule.params))) found = true;
|
|
160
|
+
});
|
|
161
|
+
return found;
|
|
162
|
+
} catch {
|
|
163
|
+
return /@plugin\s+(?:url\(\s*)?["']weapp-tailwindcss\/css-macro["']/.test(css);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function isCssMacroPostcssPlugin(plugin) {
|
|
167
|
+
if (plugin === creator) return true;
|
|
168
|
+
return Boolean(plugin && (typeof plugin === "function" || typeof plugin === "object") && plugin.postcssPlugin === "postcss-weapp-tw-css-macro-plugin");
|
|
169
|
+
}
|
|
170
|
+
function withCssMacroPostcssPlugins(plugins) {
|
|
171
|
+
const macroPlugin = creator();
|
|
172
|
+
if (!plugins) return [macroPlugin];
|
|
173
|
+
if (Array.isArray(plugins)) return plugins.some(isCssMacroPostcssPlugin) ? plugins : [...plugins, macroPlugin];
|
|
174
|
+
if (typeof plugins === "object") {
|
|
175
|
+
const values = Object.values(plugins).filter(Boolean);
|
|
176
|
+
if (values.some(isCssMacroPostcssPlugin)) return values;
|
|
177
|
+
return [...values, macroPlugin];
|
|
178
|
+
}
|
|
179
|
+
return [macroPlugin];
|
|
180
|
+
}
|
|
181
|
+
function withCssMacroStyleOptions(options) {
|
|
182
|
+
const postcssOptions = options?.postcssOptions;
|
|
183
|
+
return {
|
|
184
|
+
...options,
|
|
185
|
+
[CSS_MACRO_STYLE_OPTIONS_MARKER]: true,
|
|
186
|
+
postcssOptions: {
|
|
187
|
+
...postcssOptions,
|
|
188
|
+
plugins: withCssMacroPostcssPlugins(postcssOptions?.plugins)
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function hasCssMacroStyleOptions(options) {
|
|
193
|
+
return Boolean(options?.[CSS_MACRO_STYLE_OPTIONS_MARKER]);
|
|
194
|
+
}
|
|
195
|
+
async function transformCssMacroCss(css, options) {
|
|
196
|
+
const result = (await postcss([creator()]).process(css, { from: void 0 })).css;
|
|
197
|
+
return compileCssMacroConditionalComments(result, options);
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
export { transformCssMacroCss as a, markCssMacroPlugin as i, hasCssMacroTailwindPlugin as n, withCssMacroStyleOptions as o, hasCssMacroTailwindV4Directive as r, hasCssMacroStyleOptions as t };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
+
const require_postcss = require("./postcss-CiYLsqZn.js");
|
|
3
|
+
let postcss = require("postcss");
|
|
4
|
+
postcss = require_chunk.__toESM(postcss);
|
|
5
|
+
let node_process = require("node:process");
|
|
6
|
+
node_process = require_chunk.__toESM(node_process);
|
|
7
|
+
//#region src/css-macro/auto.ts
|
|
8
|
+
const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
|
|
9
|
+
const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
|
|
10
|
+
const PLATFORM_ENV_KEYS = [
|
|
11
|
+
"WEAPP_TW_TARGET",
|
|
12
|
+
"WEAPP_TAILWINDCSS_TARGET",
|
|
13
|
+
"UNI_PLATFORM",
|
|
14
|
+
"UNI_UTS_PLATFORM",
|
|
15
|
+
"TARO_ENV",
|
|
16
|
+
"MPX_CLI_MODE",
|
|
17
|
+
"MPX_CURRENT_TARGET_MODE"
|
|
18
|
+
];
|
|
19
|
+
const CONDITIONAL_END_RE = /^\s*#endif\s*$/;
|
|
20
|
+
function readEnvValue(key) {
|
|
21
|
+
return typeof node_process.default === "undefined" ? void 0 : node_process.default.env[key];
|
|
22
|
+
}
|
|
23
|
+
function normalizePlatformToken(value) {
|
|
24
|
+
return value?.trim().replaceAll("_", "-").toUpperCase() || void 0;
|
|
25
|
+
}
|
|
26
|
+
function resolveCssMacroPlatform(options) {
|
|
27
|
+
const explicit = normalizePlatformToken(options?.platform);
|
|
28
|
+
if (explicit) return explicit;
|
|
29
|
+
for (const key of PLATFORM_ENV_KEYS) {
|
|
30
|
+
const value = normalizePlatformToken(readEnvValue(key));
|
|
31
|
+
if (value) return value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function createPlatformTokenSet(platform) {
|
|
35
|
+
const normalized = normalizePlatformToken(platform);
|
|
36
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
37
|
+
if (!normalized) return tokens;
|
|
38
|
+
tokens.add(normalized);
|
|
39
|
+
if (normalized.startsWith("MP-")) tokens.add("MP");
|
|
40
|
+
if (normalized === "WEAPP" || normalized === "WEIXIN" || normalized === "WX") {
|
|
41
|
+
tokens.add("MP");
|
|
42
|
+
tokens.add("MP-WEIXIN");
|
|
43
|
+
}
|
|
44
|
+
if (normalized === "MP-WEIXIN") {
|
|
45
|
+
tokens.add("WEAPP");
|
|
46
|
+
tokens.add("WEIXIN");
|
|
47
|
+
tokens.add("WX");
|
|
48
|
+
}
|
|
49
|
+
if (normalized === "H5") tokens.add("WEB");
|
|
50
|
+
if (normalized === "WEB") tokens.add("H5");
|
|
51
|
+
if (normalized === "APP") tokens.add("APP-PLUS");
|
|
52
|
+
if (normalized.startsWith("APP-")) tokens.add("APP");
|
|
53
|
+
if (normalized.startsWith("QUICKAPP-WEBVIEW")) tokens.add("QUICKAPP-WEBVIEW");
|
|
54
|
+
return tokens;
|
|
55
|
+
}
|
|
56
|
+
function combineAnd(values) {
|
|
57
|
+
if (values.includes(false)) return false;
|
|
58
|
+
return values.every((value) => value === true) ? true : void 0;
|
|
59
|
+
}
|
|
60
|
+
function combineOr(values) {
|
|
61
|
+
if (values.includes(true)) return true;
|
|
62
|
+
return values.every((value) => value === false) ? false : void 0;
|
|
63
|
+
}
|
|
64
|
+
function evaluatePlatformExpression(expression, platformTokens) {
|
|
65
|
+
return combineOr(expression.split(/\s*\|\|\s*/).map((orPart) => {
|
|
66
|
+
return combineAnd(orPart.split(/\s*&&\s*/).map((part) => {
|
|
67
|
+
const token = normalizePlatformToken(part);
|
|
68
|
+
if (!token || /[<>=!()]/.test(token)) return;
|
|
69
|
+
return platformTokens.has(token);
|
|
70
|
+
}));
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
function negateConditionalValue(value) {
|
|
74
|
+
return value === void 0 ? void 0 : !value;
|
|
75
|
+
}
|
|
76
|
+
function getActiveConditionalValue(stack) {
|
|
77
|
+
if (stack.includes(false)) return false;
|
|
78
|
+
return stack.includes(void 0) ? void 0 : true;
|
|
79
|
+
}
|
|
80
|
+
function parseConditionalStart(text) {
|
|
81
|
+
const normalized = text.trim();
|
|
82
|
+
if (!normalized.startsWith("#")) return;
|
|
83
|
+
const body = normalized.slice(1).trimStart();
|
|
84
|
+
for (const directive of ["ifndef", "ifdef"]) {
|
|
85
|
+
if (!body.startsWith(directive)) continue;
|
|
86
|
+
const expression = body.slice(directive.length).trim();
|
|
87
|
+
if (expression.length === 0) return;
|
|
88
|
+
return {
|
|
89
|
+
directive,
|
|
90
|
+
expression
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function compileCssMacroConditionalComments(css, options) {
|
|
95
|
+
const platformTokens = createPlatformTokenSet(resolveCssMacroPlatform(options));
|
|
96
|
+
if (platformTokens.size === 0 || !css.includes("#if")) return css;
|
|
97
|
+
try {
|
|
98
|
+
const root = postcss.default.parse(css);
|
|
99
|
+
const transformContainer = (container) => {
|
|
100
|
+
const stack = [];
|
|
101
|
+
for (const node of [...container.nodes ?? []]) {
|
|
102
|
+
if (node.type === "comment") {
|
|
103
|
+
const start = parseConditionalStart(node.text);
|
|
104
|
+
if (start) {
|
|
105
|
+
const value = start.directive === "ifndef" ? negateConditionalValue(evaluatePlatformExpression(start.expression, platformTokens)) : evaluatePlatformExpression(start.expression, platformTokens);
|
|
106
|
+
const parentActive = getActiveConditionalValue(stack);
|
|
107
|
+
stack.push(value);
|
|
108
|
+
if (parentActive !== void 0 && value !== void 0) node.remove();
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (CONDITIONAL_END_RE.test(node.text)) {
|
|
112
|
+
const value = stack.pop();
|
|
113
|
+
if (getActiveConditionalValue(stack) !== void 0 && value !== void 0) node.remove();
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (getActiveConditionalValue(stack) === false) {
|
|
118
|
+
node.remove();
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if ("nodes" in node && node.nodes) transformContainer(node);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
transformContainer(root);
|
|
125
|
+
return root.toString();
|
|
126
|
+
} catch {
|
|
127
|
+
return css;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function markCssMacroPlugin(value) {
|
|
131
|
+
Object.defineProperty(value, CSS_MACRO_PLUGIN_MARKER, {
|
|
132
|
+
configurable: false,
|
|
133
|
+
enumerable: false,
|
|
134
|
+
value: true
|
|
135
|
+
});
|
|
136
|
+
return value;
|
|
137
|
+
}
|
|
138
|
+
function isCssMacroTailwindPlugin(value) {
|
|
139
|
+
return Boolean(value && (typeof value === "function" || typeof value === "object") && value["__weappTailwindcssCssMacro"] === true);
|
|
140
|
+
}
|
|
141
|
+
function hasCssMacroTailwindPlugin(plugins) {
|
|
142
|
+
if (!plugins) return false;
|
|
143
|
+
if (Array.isArray(plugins)) return plugins.some(isCssMacroTailwindPlugin);
|
|
144
|
+
if (typeof plugins === "object") return Object.values(plugins).some(isCssMacroTailwindPlugin);
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
function parseCssPluginRequest(params) {
|
|
148
|
+
const value = params.trim();
|
|
149
|
+
const quoted = /^(['"])(.*?)\1/.exec(value);
|
|
150
|
+
if (quoted) return quoted[2];
|
|
151
|
+
const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
|
|
152
|
+
return url?.[2] ?? url?.[3];
|
|
153
|
+
}
|
|
154
|
+
function isCssMacroPluginRequest(request) {
|
|
155
|
+
return request === "weapp-tailwindcss/css-macro";
|
|
156
|
+
}
|
|
157
|
+
function hasCssMacroTailwindV4Directive(css) {
|
|
158
|
+
if (!css?.includes("css-macro")) return false;
|
|
159
|
+
try {
|
|
160
|
+
let found = false;
|
|
161
|
+
postcss.default.parse(css).walkAtRules("plugin", (rule) => {
|
|
162
|
+
if (isCssMacroPluginRequest(parseCssPluginRequest(rule.params))) found = true;
|
|
163
|
+
});
|
|
164
|
+
return found;
|
|
165
|
+
} catch {
|
|
166
|
+
return /@plugin\s+(?:url\(\s*)?["']weapp-tailwindcss\/css-macro["']/.test(css);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function isCssMacroPostcssPlugin(plugin) {
|
|
170
|
+
if (plugin === require_postcss.creator) return true;
|
|
171
|
+
return Boolean(plugin && (typeof plugin === "function" || typeof plugin === "object") && plugin.postcssPlugin === "postcss-weapp-tw-css-macro-plugin");
|
|
172
|
+
}
|
|
173
|
+
function withCssMacroPostcssPlugins(plugins) {
|
|
174
|
+
const macroPlugin = require_postcss.creator();
|
|
175
|
+
if (!plugins) return [macroPlugin];
|
|
176
|
+
if (Array.isArray(plugins)) return plugins.some(isCssMacroPostcssPlugin) ? plugins : [...plugins, macroPlugin];
|
|
177
|
+
if (typeof plugins === "object") {
|
|
178
|
+
const values = Object.values(plugins).filter(Boolean);
|
|
179
|
+
if (values.some(isCssMacroPostcssPlugin)) return values;
|
|
180
|
+
return [...values, macroPlugin];
|
|
181
|
+
}
|
|
182
|
+
return [macroPlugin];
|
|
183
|
+
}
|
|
184
|
+
function withCssMacroStyleOptions(options) {
|
|
185
|
+
const postcssOptions = options?.postcssOptions;
|
|
186
|
+
return {
|
|
187
|
+
...options,
|
|
188
|
+
[CSS_MACRO_STYLE_OPTIONS_MARKER]: true,
|
|
189
|
+
postcssOptions: {
|
|
190
|
+
...postcssOptions,
|
|
191
|
+
plugins: withCssMacroPostcssPlugins(postcssOptions?.plugins)
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function hasCssMacroStyleOptions(options) {
|
|
196
|
+
return Boolean(options?.[CSS_MACRO_STYLE_OPTIONS_MARKER]);
|
|
197
|
+
}
|
|
198
|
+
async function transformCssMacroCss(css, options) {
|
|
199
|
+
const result = (await (0, postcss.default)([require_postcss.creator()]).process(css, { from: void 0 })).css;
|
|
200
|
+
return compileCssMacroConditionalComments(result, options);
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
Object.defineProperty(exports, "hasCssMacroStyleOptions", {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
get: function() {
|
|
206
|
+
return hasCssMacroStyleOptions;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
Object.defineProperty(exports, "hasCssMacroTailwindPlugin", {
|
|
210
|
+
enumerable: true,
|
|
211
|
+
get: function() {
|
|
212
|
+
return hasCssMacroTailwindPlugin;
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
Object.defineProperty(exports, "hasCssMacroTailwindV4Directive", {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
get: function() {
|
|
218
|
+
return hasCssMacroTailwindV4Directive;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
Object.defineProperty(exports, "markCssMacroPlugin", {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
get: function() {
|
|
224
|
+
return markCssMacroPlugin;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(exports, "transformCssMacroCss", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function() {
|
|
230
|
+
return transformCssMacroCss;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
Object.defineProperty(exports, "withCssMacroStyleOptions", {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: function() {
|
|
236
|
+
return withCssMacroStyleOptions;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as traverse, h as babelParse, o as Parser } from "./precheck-
|
|
1
|
+
import { g as traverse, h as babelParse, o as Parser } from "./precheck-nITnYBDn.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import path from "node:path";
|
|
4
3
|
import process from "node:process";
|
|
4
|
+
import path from "node:path";
|
|
5
5
|
import { cleanUrl, ensurePosix } from "@weapp-tailwindcss/shared";
|
|
6
6
|
import { Buffer } from "node:buffer";
|
|
7
7
|
//#region src/bundlers/shared/module-graph.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_precheck = require("./precheck-CQeqnfo5.js");
|
|
3
3
|
let node_module = require("node:module");
|
|
4
|
-
let node_path = require("node:path");
|
|
5
|
-
node_path = require_chunk.__toESM(node_path);
|
|
6
4
|
let node_process = require("node:process");
|
|
7
5
|
node_process = require_chunk.__toESM(node_process);
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_chunk.__toESM(node_path);
|
|
8
8
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
9
9
|
let node_buffer = require("node:buffer");
|
|
10
10
|
//#region src/bundlers/shared/module-graph.ts
|
|
@@ -3,6 +3,7 @@ interface TailwindDirectiveOptions {
|
|
|
3
3
|
}
|
|
4
4
|
export declare function parseImportRequest(params: string): string | undefined;
|
|
5
5
|
export declare function normalizeTailwindSourceForGenerator(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
6
|
+
export declare function normalizeTailwindV3CssEntrySource(rawSource: string): string;
|
|
6
7
|
export declare function normalizeTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
7
8
|
export declare function removeTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
8
9
|
export declare function hasTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function wrapUserLayerComponentsCss(css: string): string;
|
|
2
|
+
export declare function extractMarkedUserLayerComponentsCss(css: string): {
|
|
3
|
+
layers: string[];
|
|
4
|
+
rest: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function reorderMarkedUserLayerComponentsCss(css: string): string;
|
|
7
|
+
export declare function mergeMarkedUserLayerComponentsCss(baseCss: string, markedCss: string): {
|
|
8
|
+
css: string;
|
|
9
|
+
merged: boolean;
|
|
10
|
+
};
|
package/dist/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_precheck = require("./precheck-CQeqnfo5.js");
|
|
3
3
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
4
4
|
//#region src/core.ts
|
|
5
5
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-
|
|
1
|
+
import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-nITnYBDn.mjs";
|
|
2
2
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
3
3
|
//#region src/core.ts
|
|
4
4
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
package/dist/css-macro/auto.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
2
|
export declare const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
|
|
3
3
|
export declare const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
|
|
4
|
+
export declare function compileCssMacroConditionalComments(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): string;
|
|
4
5
|
export declare function markCssMacroPlugin<T extends object>(value: T): T;
|
|
5
6
|
export declare function isCssMacroTailwindPlugin(value: unknown): boolean;
|
|
6
7
|
export declare function hasCssMacroTailwindPlugin(plugins: unknown): boolean;
|
|
7
8
|
export declare function hasCssMacroTailwindV4Directive(css: string | undefined): boolean;
|
|
8
9
|
export declare function withCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions>;
|
|
9
10
|
export declare function hasCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): boolean;
|
|
10
|
-
export declare function transformCssMacroCss(css: string): Promise<string>;
|
|
11
|
+
export declare function transformCssMacroCss(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): Promise<string>;
|
package/dist/css-macro.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
2
|
const require_postcss = require("./postcss-CiYLsqZn.js");
|
|
3
|
-
const require_auto = require("./auto-
|
|
3
|
+
const require_auto = require("./auto-dPpsm6FB.js");
|
|
4
4
|
require("./utils-D7Ygohep.js");
|
|
5
5
|
let tailwindcss_plugin = require("tailwindcss/plugin");
|
|
6
6
|
tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
|
package/dist/css-macro.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as createNegativeConditionalAtRule, r as createConditionalAtRule } from "./postcss-C7BMYpEF.mjs";
|
|
2
|
-
import { i as markCssMacroPlugin } from "./auto-
|
|
2
|
+
import { i as markCssMacroPlugin } from "./auto-DEHRmEAx.mjs";
|
|
3
3
|
import { t as defu } from "./utils-DsaS975I.mjs";
|
|
4
4
|
import plugin from "tailwindcss/plugin";
|
|
5
5
|
//#region src/css-macro/index.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
|
|
3
3
|
let node_process = require("node:process");
|
|
4
4
|
node_process = require_chunk.__toESM(node_process);
|
|
5
5
|
//#region src/generator/options.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-
|
|
1
|
+
import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-C_KeUQG3.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
//#region src/generator/options.ts
|
|
4
4
|
const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
|
package/dist/generator.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
|
|
3
|
+
const require_generator = require("./generator-BEXaaUzP.js");
|
|
4
4
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
5
5
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
6
6
|
exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
|
package/dist/generator.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-C_KeUQG3.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-CpsHA4Wd.mjs";
|
|
3
3
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
package/dist/gulp.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_source_candidates = require("./source-candidates-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CLP1Qv8F.js");
|
|
5
|
+
const require_precheck = require("./precheck-CQeqnfo5.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-Cl7hUlYV.js");
|
|
7
|
+
const require_source_candidates = require("./source-candidates-7Q-kTOSb.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
10
|
-
let node_path = require("node:path");
|
|
11
|
-
node_path = require_chunk.__toESM(node_path);
|
|
12
10
|
let node_process = require("node:process");
|
|
13
11
|
node_process = require_chunk.__toESM(node_process);
|
|
12
|
+
let node_path = require("node:path");
|
|
13
|
+
node_path = require_chunk.__toESM(node_path);
|
|
14
14
|
let node_buffer = require("node:buffer");
|
|
15
15
|
let node_stream = require("node:stream");
|
|
16
16
|
node_stream = require_chunk.__toESM(node_stream);
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-
|
|
2
|
-
import { B as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-
|
|
3
|
-
import {
|
|
4
|
-
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
5
|
-
import { t as createSourceCandidateCollector } from "./source-candidates-
|
|
1
|
+
import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-nITnYBDn.mjs";
|
|
2
|
+
import { B as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-C_KeUQG3.mjs";
|
|
3
|
+
import { c as hasTailwindRootDirectives, i as generateCssByGenerator, r as emitHmrTiming, s as processCachedTask, t as createBundleRuntimeClassSetManager, u as normalizeTailwindSourceForGenerator } from "./incremental-runtime-class-set-D2fsgk5t.mjs";
|
|
4
|
+
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-udhXxMX9.mjs";
|
|
5
|
+
import { t as createSourceCandidateCollector } from "./source-candidates-_x8bq0Mz.mjs";
|
|
6
6
|
import fs from "node:fs";
|
|
7
|
-
import path from "node:path";
|
|
8
7
|
import process from "node:process";
|
|
8
|
+
import path from "node:path";
|
|
9
9
|
import { Buffer } from "node:buffer";
|
|
10
10
|
import stream from "node:stream";
|
|
11
11
|
//#region src/bundlers/gulp/index.ts
|