weapp-tailwindcss 5.0.7 → 5.0.10

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.
Files changed (67) hide show
  1. package/dist/auto-CTp6wE5a.js +33 -0
  2. package/dist/auto-Cl8_hsG6.mjs +22 -0
  3. package/dist/{bundle-state-BzwPS-UI.js → bundle-state-BwtEqxvU.js} +3 -3
  4. package/dist/{bundle-state-ChcOKb9w.mjs → bundle-state-CXzPknlT.mjs} +2 -2
  5. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +0 -2
  6. package/dist/cli.js +3 -159
  7. package/dist/cli.mjs +3 -159
  8. package/dist/core.js +1 -1
  9. package/dist/core.mjs +1 -1
  10. package/dist/css-macro/auto.d.ts +1 -7
  11. package/dist/css-macro/postcss.d.ts +1 -6
  12. package/dist/css-macro/postcss.js +15 -3
  13. package/dist/css-macro/postcss.mjs +2 -2
  14. package/dist/css-macro.js +19 -5
  15. package/dist/css-macro.mjs +16 -2
  16. package/dist/{generator-6yF8wjxR.js → generator-ChgOWNOj.js} +1 -1
  17. package/dist/{generator-BON6M1bL.mjs → generator-h2XRiJ9-.mjs} +1 -1
  18. package/dist/generator.js +2 -2
  19. package/dist/generator.mjs +2 -2
  20. package/dist/{gulp-oE-Byqk6.mjs → gulp-Be88jhoY.mjs} +5 -5
  21. package/dist/{gulp-_7p1Z2vc.js → gulp-CHtZF-oT.js} +6 -6
  22. package/dist/gulp.js +1 -1
  23. package/dist/gulp.mjs +1 -1
  24. package/dist/{hmr-timing-BKQNRxHr.js → hmr-timing-BkivBZvN.js} +41 -43
  25. package/dist/{hmr-timing-BVTGf5ch.mjs → hmr-timing-Ct5w4hdM.mjs} +6 -7
  26. package/dist/index.js +6 -6
  27. package/dist/index.mjs +5 -5
  28. package/dist/postcss.d.ts +2 -13
  29. package/dist/postcss.js +14 -3
  30. package/dist/postcss.mjs +10 -1
  31. package/dist/{precheck-CZjr87m_.mjs → precheck-BpHxsWRd.mjs} +4 -4
  32. package/dist/{precheck-fhIkzCSU.js → precheck-CY9oaH49.js} +5 -5
  33. package/dist/presets.js +4 -4
  34. package/dist/presets.mjs +3 -3
  35. package/dist/tailwindcss/source-scan/inline-source.d.ts +1 -1
  36. package/dist/{tailwindcss-bbQUg25J.mjs → tailwindcss-Bfy2egdX.mjs} +2 -2
  37. package/dist/{tailwindcss-vswd1gc3.js → tailwindcss-DbbAKAZP.js} +3 -3
  38. package/dist/{transform-CReJxxh_.js → transform-Cd634UZV.js} +1 -1
  39. package/dist/{transform-DEsFlG9k.mjs → transform-r5evL6Hn.mjs} +1 -1
  40. package/dist/types/index.d.ts +1 -2
  41. package/dist/{v3-engine-CdIwmHuc.mjs → v3-engine-CFkP6dWF.mjs} +55 -19
  42. package/dist/{v3-engine-CEMXFegG.js → v3-engine-D0yA9ZkF.js} +86 -87
  43. package/dist/{vite-C7BGAlCE.mjs → vite-BM_iIFmS.mjs} +10 -411
  44. package/dist/{vite-0jFbh9hx.js → vite-Bh-BNp5g.js} +27 -431
  45. package/dist/vite.js +1 -1
  46. package/dist/vite.mjs +1 -1
  47. package/dist/watch-dependencies-bpG6kmAf.js +80 -0
  48. package/dist/weapp-tw-css-import-rewrite-loader.js +111 -407
  49. package/dist/weapp-tw-runtime-classset-loader.js +2 -2
  50. package/dist/{webpack-aEuDoYfQ.js → webpack-CJAOcYEO.js} +16 -9
  51. package/dist/{webpack-Dx6_eg5k.mjs → webpack-DPdrcC2X.mjs} +15 -8
  52. package/dist/webpack.js +1 -1
  53. package/dist/webpack.mjs +1 -1
  54. package/package.json +5 -7
  55. package/dist/auto-Cvy0zWpS.js +0 -238
  56. package/dist/auto-DEHRmEAx.mjs +0 -200
  57. package/dist/bundlers/vite/postcss-config.d.ts +0 -6
  58. package/dist/bundlers/vite/processed-css-assets/css-rules.d.ts +0 -17
  59. package/dist/postcss/config-directive.d.ts +0 -1
  60. package/dist/postcss/context.d.ts +0 -9
  61. package/dist/postcss/source-files.d.ts +0 -8
  62. package/dist/postcss/tailwind-version.d.ts +0 -3
  63. package/dist/postcss-BTIunhWl.js +0 -284
  64. package/dist/postcss-BtmrrZ31.mjs +0 -275
  65. package/dist/postcss-C7BMYpEF.mjs +0 -169
  66. package/dist/postcss-CiYLsqZn.js +0 -192
  67. package/dist/watch-dependencies-zwx4EhBn.js +0 -5535
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_watch_dependencies = require("./watch-dependencies-zwx4EhBn.js");
5
+ const require_watch_dependencies = require("./watch-dependencies-bpG6kmAf.js");
6
6
  let node_buffer = require("node:buffer");
7
7
  let node_process = require("node:process");
8
8
  node_process = require_watch_dependencies.__toESM(node_process);
@@ -14,6 +14,7 @@ node_path = require_watch_dependencies.__toESM(node_path);
14
14
  let node_util = require("node:util");
15
15
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
16
16
  let tailwindcss_patch = require("tailwindcss-patch");
17
+ tailwindcss_patch = require_watch_dependencies.__toESM(tailwindcss_patch);
17
18
  let node_module = require("node:module");
18
19
  let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
19
20
  let node_url = require("node:url");
@@ -62,284 +63,6 @@ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
62
63
  function createBundlerGeneratedCssMarker(bundler, file) {
63
64
  return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
64
65
  }
65
- //#endregion
66
- //#region src/css-macro/constants.ts
67
- const queryKey = "weapp-tw-platform";
68
- const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
69
- const WHITESPACE_RE = /\s+/g;
70
- const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
71
- function normalComment(text) {
72
- if (typeof text === "string") {
73
- const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
74
- if (normalized.includes("\\")) return normalized;
75
- return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
76
- }
77
- return text;
78
- }
79
- function ifdef(text) {
80
- return {
81
- start: `#ifdef ${normalComment(text)}`,
82
- end: `#endif`
83
- };
84
- }
85
- function ifndef(text) {
86
- return {
87
- start: `#ifndef ${normalComment(text)}`,
88
- end: `#endif`
89
- };
90
- }
91
- const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
92
- function matchCustomPropertyFromValue(str, cb) {
93
- let index = 0;
94
- QUERY_KEY_REGEX.lastIndex = 0;
95
- let arr = QUERY_KEY_REGEX.exec(str);
96
- while (arr !== null) {
97
- cb(arr, index);
98
- index++;
99
- arr = QUERY_KEY_REGEX.exec(str);
100
- }
101
- }
102
- function parseConditionalAtRuleParam(params) {
103
- const value = params.trim();
104
- const quoted = /^(['"])((?:\\.|(?!\1).)*)\1/.exec(value);
105
- if (!quoted) return value;
106
- return quoted[2]?.replaceAll(/\\(["'\\])/g, "$1") ?? "";
107
- }
108
- //#endregion
109
- //#region src/css-macro/postcss.ts
110
- const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
111
- const CONDITIONAL_COMMENT_SPACING = " ";
112
- const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
113
- const creator = () => {
114
- return {
115
- postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
116
- prepare() {
117
- function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
118
- const hasPreviousNode = Boolean(atRule.prev());
119
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
120
- const startComment = helper.comment({
121
- raws: {
122
- left: CONDITIONAL_COMMENT_SPACING,
123
- right: CONDITIONAL_COMMENT_SPACING
124
- },
125
- text: comment.start
126
- });
127
- const endComment = helper.comment({
128
- raws: {
129
- left: CONDITIONAL_COMMENT_SPACING,
130
- right: CONDITIONAL_COMMENT_SPACING
131
- },
132
- text: comment.end
133
- });
134
- const nextNodes = [
135
- startComment,
136
- ...clonedNodes,
137
- endComment
138
- ];
139
- atRule.replaceWith(nextNodes);
140
- startComment.raws.before = hasPreviousNode ? "\n" : "";
141
- startComment.raws["after"] = "\n";
142
- if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
143
- endComment.raws.before = "\n";
144
- endComment.raws["after"] = "\n";
145
- const nextNode = endComment?.next();
146
- if (nextNode) nextNode.raws.before = "\n";
147
- }
148
- function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
149
- if (atRule.parent?.type !== "rule") return false;
150
- const parentRule = atRule.parent;
151
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
152
- const conditionalRule = parentRule.clone();
153
- conditionalRule.removeAll();
154
- conditionalRule.append(...clonedNodes);
155
- const startComment = helper.comment({
156
- raws: {
157
- left: CONDITIONAL_COMMENT_SPACING,
158
- right: CONDITIONAL_COMMENT_SPACING
159
- },
160
- text: comment.start
161
- });
162
- const endComment = helper.comment({
163
- raws: {
164
- left: CONDITIONAL_COMMENT_SPACING,
165
- right: CONDITIONAL_COMMENT_SPACING
166
- },
167
- text: comment.end
168
- });
169
- const nextNodes = [
170
- startComment,
171
- conditionalRule,
172
- endComment
173
- ];
174
- const hasPreviousNode = Boolean(parentRule.prev());
175
- atRule.remove();
176
- if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
177
- else parentRule.after(nextNodes);
178
- startComment.raws.before = hasPreviousNode ? "\n" : "";
179
- startComment.raws["after"] = "\n";
180
- conditionalRule.raws.before = "\n";
181
- endComment.raws.before = "\n";
182
- endComment.raws["after"] = "\n";
183
- const nextNode = endComment.next();
184
- if (nextNode) nextNode.raws.before = "\n";
185
- return true;
186
- }
187
- return {
188
- AtRule(atRule, helper) {
189
- if (atRule.name === "weapp-tw-ifdef" || atRule.name === "weapp-tw-ifndef") {
190
- const text = parseConditionalAtRuleParam(atRule.params);
191
- const comment = atRule.name === "weapp-tw-ifndef" ? ifndef(text) : ifdef(text);
192
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
193
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
194
- return;
195
- }
196
- if (atRule.name === "media") {
197
- const values = [];
198
- matchCustomPropertyFromValue(atRule.params, (arr) => {
199
- const value = arr[1];
200
- if (value) values.push(value);
201
- });
202
- if (values.length > 0) {
203
- const isNegative = atRule.params.includes("not");
204
- const text = values.join(" ");
205
- const comment = isNegative ? ifndef(text) : ifdef(text);
206
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
207
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
208
- }
209
- }
210
- },
211
- CommentExit(comment) {
212
- if (IFDEF_ENDIF_RE.test(comment.text)) {
213
- comment.raws.left = CONDITIONAL_COMMENT_SPACING;
214
- comment.raws.right = CONDITIONAL_COMMENT_SPACING;
215
- }
216
- }
217
- };
218
- }
219
- };
220
- };
221
- creator.postcss = true;
222
- const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
223
- const PLATFORM_ENV_KEYS = [
224
- "WEAPP_TW_TARGET",
225
- "WEAPP_TAILWINDCSS_TARGET",
226
- "UNI_PLATFORM",
227
- "UNI_UTS_PLATFORM",
228
- "TARO_ENV",
229
- "MPX_CLI_MODE",
230
- "MPX_CURRENT_TARGET_MODE"
231
- ];
232
- const CONDITIONAL_END_RE = /^\s*#endif\s*$/;
233
- function readEnvValue(key) {
234
- return typeof node_process.default === "undefined" ? void 0 : node_process.default.env[key];
235
- }
236
- function normalizePlatformToken(value) {
237
- return value?.trim().replaceAll("_", "-").toUpperCase() || void 0;
238
- }
239
- function resolveCssMacroPlatform(options) {
240
- const explicit = normalizePlatformToken(options?.platform);
241
- if (explicit) return explicit;
242
- for (const key of PLATFORM_ENV_KEYS) {
243
- const value = normalizePlatformToken(readEnvValue(key));
244
- if (value) return value;
245
- }
246
- }
247
- function createPlatformTokenSet(platform) {
248
- const normalized = normalizePlatformToken(platform);
249
- const tokens = /* @__PURE__ */ new Set();
250
- if (!normalized) return tokens;
251
- tokens.add(normalized);
252
- if (normalized.startsWith("MP-")) tokens.add("MP");
253
- if (normalized === "WEAPP" || normalized === "WEIXIN" || normalized === "WX") {
254
- tokens.add("MP");
255
- tokens.add("MP-WEIXIN");
256
- }
257
- if (normalized === "MP-WEIXIN") {
258
- tokens.add("WEAPP");
259
- tokens.add("WEIXIN");
260
- tokens.add("WX");
261
- }
262
- if (normalized === "H5") tokens.add("WEB");
263
- if (normalized === "WEB") tokens.add("H5");
264
- if (normalized === "APP") tokens.add("APP-PLUS");
265
- if (normalized.startsWith("APP-")) tokens.add("APP");
266
- if (normalized.startsWith("QUICKAPP-WEBVIEW")) tokens.add("QUICKAPP-WEBVIEW");
267
- return tokens;
268
- }
269
- function combineAnd(values) {
270
- if (values.includes(false)) return false;
271
- return values.every((value) => value === true) ? true : void 0;
272
- }
273
- function combineOr(values) {
274
- if (values.includes(true)) return true;
275
- return values.every((value) => value === false) ? false : void 0;
276
- }
277
- function evaluatePlatformExpression(expression, platformTokens) {
278
- return combineOr(expression.split(/\s*\|\|\s*/).map((orPart) => {
279
- return combineAnd(orPart.split(/\s*&&\s*/).map((part) => {
280
- const token = normalizePlatformToken(part);
281
- if (!token || /[<>=!()]/.test(token)) return;
282
- return platformTokens.has(token);
283
- }));
284
- }));
285
- }
286
- function negateConditionalValue(value) {
287
- return value === void 0 ? void 0 : !value;
288
- }
289
- function getActiveConditionalValue(stack) {
290
- if (stack.includes(false)) return false;
291
- return stack.includes(void 0) ? void 0 : true;
292
- }
293
- function parseConditionalStart(text) {
294
- const normalized = text.trim();
295
- if (!normalized.startsWith("#")) return;
296
- const body = normalized.slice(1).trimStart();
297
- for (const directive of ["ifndef", "ifdef"]) {
298
- if (!body.startsWith(directive)) continue;
299
- const expression = body.slice(directive.length).trim();
300
- if (expression.length === 0) return;
301
- return {
302
- directive,
303
- expression
304
- };
305
- }
306
- }
307
- function compileCssMacroConditionalComments(css, options) {
308
- const platformTokens = createPlatformTokenSet(resolveCssMacroPlatform(options));
309
- if (platformTokens.size === 0 || !css.includes("#if")) return css;
310
- try {
311
- const root = require_watch_dependencies.postcss_default.parse(css);
312
- const transformContainer = (container) => {
313
- const stack = [];
314
- for (const node of [...container.nodes ?? []]) {
315
- if (node.type === "comment") {
316
- const start = parseConditionalStart(node.text);
317
- if (start) {
318
- const value = start.directive === "ifndef" ? negateConditionalValue(evaluatePlatformExpression(start.expression, platformTokens)) : evaluatePlatformExpression(start.expression, platformTokens);
319
- const parentActive = getActiveConditionalValue(stack);
320
- stack.push(value);
321
- if (parentActive !== void 0 && value !== void 0) node.remove();
322
- continue;
323
- }
324
- if (CONDITIONAL_END_RE.test(node.text)) {
325
- const value = stack.pop();
326
- if (getActiveConditionalValue(stack) !== void 0 && value !== void 0) node.remove();
327
- continue;
328
- }
329
- }
330
- if (getActiveConditionalValue(stack) === false) {
331
- node.remove();
332
- continue;
333
- }
334
- if ("nodes" in node && node.nodes) transformContainer(node);
335
- }
336
- };
337
- transformContainer(root);
338
- return root.toString();
339
- } catch {
340
- return css;
341
- }
342
- }
343
66
  function isCssMacroTailwindPlugin(value) {
344
67
  return Boolean(value && (typeof value === "function" || typeof value === "object") && value["__weappTailwindcssCssMacro"] === true);
345
68
  }
@@ -349,61 +72,6 @@ function hasCssMacroTailwindPlugin(plugins) {
349
72
  if (typeof plugins === "object") return Object.values(plugins).some(isCssMacroTailwindPlugin);
350
73
  return false;
351
74
  }
352
- function parseCssPluginRequest(params) {
353
- const value = params.trim();
354
- const quoted = /^(['"])(.*?)\1/.exec(value);
355
- if (quoted) return quoted[2];
356
- const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
357
- return url?.[2] ?? url?.[3];
358
- }
359
- function isCssMacroPluginRequest(request) {
360
- return request === "weapp-tailwindcss/css-macro";
361
- }
362
- function hasCssMacroTailwindV4Directive(css) {
363
- if (!css?.includes("css-macro")) return false;
364
- try {
365
- let found = false;
366
- require_watch_dependencies.postcss_default.parse(css).walkAtRules("plugin", (rule) => {
367
- if (isCssMacroPluginRequest(parseCssPluginRequest(rule.params))) found = true;
368
- });
369
- return found;
370
- } catch {
371
- return /@plugin\s+(?:url\(\s*)?["']weapp-tailwindcss\/css-macro["']/.test(css);
372
- }
373
- }
374
- function isCssMacroPostcssPlugin(plugin) {
375
- if (plugin === creator) return true;
376
- return Boolean(plugin && (typeof plugin === "function" || typeof plugin === "object") && plugin.postcssPlugin === "postcss-weapp-tw-css-macro-plugin");
377
- }
378
- function withCssMacroPostcssPlugins(plugins) {
379
- const macroPlugin = creator();
380
- if (!plugins) return [macroPlugin];
381
- if (Array.isArray(plugins)) return plugins.some(isCssMacroPostcssPlugin) ? plugins : [...plugins, macroPlugin];
382
- if (typeof plugins === "object") {
383
- const values = Object.values(plugins).filter(Boolean);
384
- if (values.some(isCssMacroPostcssPlugin)) return values;
385
- return [...values, macroPlugin];
386
- }
387
- return [macroPlugin];
388
- }
389
- function withCssMacroStyleOptions(options) {
390
- const postcssOptions = options?.postcssOptions;
391
- return {
392
- ...options,
393
- [CSS_MACRO_STYLE_OPTIONS_MARKER]: true,
394
- postcssOptions: {
395
- ...postcssOptions,
396
- plugins: withCssMacroPostcssPlugins(postcssOptions?.plugins)
397
- }
398
- };
399
- }
400
- function hasCssMacroStyleOptions(options) {
401
- return Boolean(options?.[CSS_MACRO_STYLE_OPTIONS_MARKER]);
402
- }
403
- async function transformCssMacroCss(css, options) {
404
- const result = (await require_watch_dependencies.postcss_default([creator()]).process(css, { from: void 0 })).css;
405
- return compileCssMacroConditionalComments(result, options);
406
- }
407
75
  //#endregion
408
76
  //#region src/utils/object.ts
409
77
  function definedEntries(value) {
@@ -443,7 +111,7 @@ function collectApplyCandidatesFromCss(css) {
443
111
  if (!css.includes("@apply")) return [];
444
112
  const candidates = /* @__PURE__ */ new Set();
445
113
  try {
446
- require_watch_dependencies.postcss_default.parse(css).walkAtRules("apply", (rule) => {
114
+ _weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules("apply", (rule) => {
447
115
  for (const candidate of rule.params.split(/\s+/)) {
448
116
  const normalized = candidate.replace(/!important$/, "").trim();
449
117
  if (normalized) candidates.add(normalized);
@@ -484,7 +152,7 @@ function collectLayerCandidatesFromCss(css) {
484
152
  if (!css.includes("@layer")) return [];
485
153
  const candidates = /* @__PURE__ */ new Set();
486
154
  try {
487
- require_watch_dependencies.postcss_default.parse(css).walkAtRules("layer", (layer) => {
155
+ _weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules("layer", (layer) => {
488
156
  if (!isTailwindCandidateLayer(layer.params)) return;
489
157
  layer.walkRules((rule) => {
490
158
  extractClassCandidatesFromSelector(rule.selector, candidates);
@@ -1892,7 +1560,7 @@ function removeUnlayeredTailwindV4PreflightImports(css) {
1892
1560
  if (!css.includes("preflight")) return css;
1893
1561
  let root;
1894
1562
  try {
1895
- root = require_watch_dependencies.postcss_default.parse(css);
1563
+ root = _weapp_tailwindcss_postcss.postcss.parse(css);
1896
1564
  } catch {
1897
1565
  return css;
1898
1566
  }
@@ -1920,7 +1588,7 @@ function removeUnsupportedThemeVendorKeyframes(css) {
1920
1588
  if (!css.includes("@theme") || !css.includes("@-")) return css;
1921
1589
  let root;
1922
1590
  try {
1923
- root = require_watch_dependencies.postcss_default.parse(css);
1591
+ root = _weapp_tailwindcss_postcss.postcss.parse(css);
1924
1592
  } catch {
1925
1593
  return css;
1926
1594
  }
@@ -2051,7 +1719,7 @@ async function resolveCssDefinedScanSources(source) {
2051
1719
  const from = source.dependencies[0];
2052
1720
  let root;
2053
1721
  try {
2054
- root = require_watch_dependencies.postcss_default.parse(source.css, { from });
1722
+ root = _weapp_tailwindcss_postcss.postcss.parse(source.css, { from });
2055
1723
  } catch {
2056
1724
  return;
2057
1725
  }
@@ -2098,7 +1766,7 @@ function normalizeTailwindV4GeneratedUrlValues(css) {
2098
1766
  });
2099
1767
  }
2100
1768
  async function transformTailwindV4CssToWeapp(css, options) {
2101
- const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(hasCssMacroStyleOptions(options) ? await transformCssMacroCss(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
1769
+ const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues((0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options) ? await (0, _weapp_tailwindcss_postcss.transformCssMacroCss)(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
2102
1770
  const result = await defaultStyleHandler$1(protectedCss.css, {
2103
1771
  cssChildCombinatorReplaceValue: ["view", "text"],
2104
1772
  cssRemoveHoverPseudoClass: true,
@@ -2106,12 +1774,12 @@ async function transformTailwindV4CssToWeapp(css, options) {
2106
1774
  majorVersion: 4,
2107
1775
  ...options
2108
1776
  });
2109
- const pruneOptions = { preserveConditionalComments: hasCssMacroStyleOptions(options) };
1777
+ const pruneOptions = { preserveConditionalComments: (0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options) };
2110
1778
  return (0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(protectedCss.restore(result.css), pruneOptions);
2111
1779
  }
2112
1780
  async function transformTailwindV4CssByTarget(css, target, options) {
2113
1781
  if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
2114
- return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css, options) : css;
1782
+ return (0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options) ? (0, _weapp_tailwindcss_postcss.transformCssMacroCss)(css, options) : css;
2115
1783
  }
2116
1784
  //#endregion
2117
1785
  //#region src/tailwindcss/v4-engine/generator.ts
@@ -2198,12 +1866,12 @@ function createIncrementalStyleOptions(styleOptions) {
2198
1866
  };
2199
1867
  }
2200
1868
  function resolveStyleOptions$1(source, options) {
2201
- return hasCssMacroTailwindV4Directive(source.css) ? withCssMacroStyleOptions(options) : options;
1869
+ return (0, _weapp_tailwindcss_postcss.hasCssMacroTailwindV4Directive)(source.css) ? (0, _weapp_tailwindcss_postcss.withCssMacroStyleOptions)(options) : options;
2202
1870
  }
2203
1871
  function collectCustomPropertyValues(css) {
2204
1872
  const values = /* @__PURE__ */ new Map();
2205
1873
  try {
2206
- require_watch_dependencies.postcss_default.parse(css).walkDecls((decl) => {
1874
+ _weapp_tailwindcss_postcss.postcss.parse(css).walkDecls((decl) => {
2207
1875
  if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
2208
1876
  });
2209
1877
  } catch {}
@@ -2692,12 +2360,12 @@ function normalizeTailwindSourceForGenerator(rawSource, options = {}) {
2692
2360
  }
2693
2361
  function normalizeTailwindV3CssEntrySource(rawSource) {
2694
2362
  try {
2695
- const root = require_watch_dependencies.postcss_default.parse(rawSource);
2363
+ const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
2696
2364
  let changed = false;
2697
2365
  root.walkAtRules("import", (node) => {
2698
2366
  const layer = TAILWIND_V3_SUBPATH_IMPORT_LAYERS.get(parseImportRequest(node.params) ?? "");
2699
2367
  if (!layer) return;
2700
- node.replaceWith(require_watch_dependencies.postcss_default.atRule({
2368
+ node.replaceWith(_weapp_tailwindcss_postcss.postcss.atRule({
2701
2369
  name: "tailwind",
2702
2370
  params: layer
2703
2371
  }));
@@ -2711,7 +2379,7 @@ function normalizeTailwindV3CssEntrySource(rawSource) {
2711
2379
  function normalizeTailwindSourceDirectives(rawSource, options = {}) {
2712
2380
  if (!options.importFallback) return rawSource;
2713
2381
  try {
2714
- const root = require_watch_dependencies.postcss_default.parse(rawSource);
2382
+ const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
2715
2383
  return normalizeTailwindImportAtRules(root, options) ? root.toString() : rawSource;
2716
2384
  } catch {
2717
2385
  return extractTailwindSourceForPostcssFallback(rawSource, options) ?? rawSource;
@@ -2746,7 +2414,7 @@ function removeTailwindSourceDirectives(rawSource, options = {}) {
2746
2414
  try {
2747
2415
  const source = hasPreprocessorOnlySyntax(rawSource) ? extractTailwindSourceForPostcssFallback(rawSource, options) : stripGeneratorPlaceholderMarkers(rawSource);
2748
2416
  if (!source) return "";
2749
- const root = require_watch_dependencies.postcss_default.parse(source);
2417
+ const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2750
2418
  let removed = false;
2751
2419
  root.walk((node) => {
2752
2420
  if (isTailwindSourceDirective(node, options)) {
@@ -2762,7 +2430,7 @@ function removeTailwindSourceDirectives(rawSource, options = {}) {
2762
2430
  function hasTailwindSourceDirectives(rawSource, options = {}) {
2763
2431
  try {
2764
2432
  if (GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
2765
- const root = require_watch_dependencies.postcss_default.parse(rawSource);
2433
+ const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
2766
2434
  let found = false;
2767
2435
  const ignoreLayer = hasGeneratedCssArtifacts(rawSource);
2768
2436
  root.walk((node) => {
@@ -2782,7 +2450,7 @@ function hasTailwindSourceDirectives(rawSource, options = {}) {
2782
2450
  function hasTailwindRootDirectives(rawSource, options = {}) {
2783
2451
  if (!TAILWIND_ROOT_DIRECTIVE_RE.test(rawSource) && !(options.importFallback && rawSource.includes("weapp-tailwindcss"))) return false;
2784
2452
  try {
2785
- const root = require_watch_dependencies.postcss_default.parse(rawSource);
2453
+ const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
2786
2454
  let found = false;
2787
2455
  root.walkAtRules((node) => {
2788
2456
  const request = node.name === "import" ? parseImportRequest(node.params) : node.name === "config" || node.name === "plugin" ? parseConfigRequest(node.params) : void 0;
@@ -2799,7 +2467,7 @@ function hasTailwindRootDirectives(rawSource, options = {}) {
2799
2467
  function hasTailwindApplyDirective(rawSource) {
2800
2468
  if (!rawSource.includes("@apply")) return false;
2801
2469
  try {
2802
- const root = require_watch_dependencies.postcss_default.parse(rawSource);
2470
+ const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
2803
2471
  let found = false;
2804
2472
  root.walkAtRules("apply", () => {
2805
2473
  found = true;
@@ -2812,7 +2480,7 @@ function hasTailwindApplyDirective(rawSource) {
2812
2480
  }
2813
2481
  function resolveCssEntrySource(rawSource, base, options = {}) {
2814
2482
  try {
2815
- const root = require_watch_dependencies.postcss_default.parse(rawSource);
2483
+ const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
2816
2484
  const normalizedImports = normalizeTailwindImportAtRules(root, options);
2817
2485
  let found = false;
2818
2486
  let config;
@@ -2955,7 +2623,7 @@ function normalizeTailwindV4CssPackageImports(css, packageName) {
2955
2623
  if (!css.includes("tailwindcss")) return css;
2956
2624
  let root;
2957
2625
  try {
2958
- root = require_watch_dependencies.postcss_default.parse(css);
2626
+ root = _weapp_tailwindcss_postcss.postcss.parse(css);
2959
2627
  } catch {
2960
2628
  return css;
2961
2629
  }
@@ -3310,7 +2978,7 @@ async function resolveConfigContentEntries(root, base) {
3310
2978
  async function resolveTailwindV4EntriesFromCss(css, base) {
3311
2979
  let root;
3312
2980
  try {
3313
- root = require_watch_dependencies.postcss_default.parse(css);
2981
+ root = _weapp_tailwindcss_postcss.postcss.parse(css);
3314
2982
  } catch {
3315
2983
  return;
3316
2984
  }
@@ -3488,7 +3156,7 @@ function hasResetDeclaration(rule) {
3488
3156
  }
3489
3157
  function createPreflightDeclarations(cssPreflight) {
3490
3158
  if (!cssPreflight || typeof cssPreflight !== "object") return [];
3491
- return Object.entries(cssPreflight).filter((entry) => entry[1] !== false).map(([prop, value]) => require_watch_dependencies.postcss_default.decl({
3159
+ return Object.entries(cssPreflight).filter((entry) => entry[1] !== false).map(([prop, value]) => _weapp_tailwindcss_postcss.postcss.decl({
3492
3160
  prop,
3493
3161
  value: value.toString()
3494
3162
  }));
@@ -3497,7 +3165,7 @@ function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
3497
3165
  const declarations = createPreflightDeclarations(cssPreflight);
3498
3166
  if (declarations.length === 0) return css;
3499
3167
  try {
3500
- const root = require_watch_dependencies.postcss_default.parse(css);
3168
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
3501
3169
  let targetRule;
3502
3170
  let hasReset = false;
3503
3171
  root.walkRules((rule) => {
@@ -3513,7 +3181,7 @@ function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
3513
3181
  }
3514
3182
  }
3515
3183
  async function transformTailwindV3CssToWeapp(css, options) {
3516
- const result = await defaultStyleHandler(hasCssMacroStyleOptions(options) ? await transformCssMacroCss(css, options) : css, {
3184
+ const result = await defaultStyleHandler((0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options) ? await (0, _weapp_tailwindcss_postcss.transformCssMacroCss)(css, options) : css, {
3517
3185
  cssChildCombinatorReplaceValue: ["view", "text"],
3518
3186
  cssRemoveHoverPseudoClass: true,
3519
3187
  isMainChunk: true,
@@ -3522,17 +3190,24 @@ async function transformTailwindV3CssToWeapp(css, options) {
3522
3190
  });
3523
3191
  const pruneOptions = {
3524
3192
  preservePreflight: true,
3525
- preserveConditionalComments: hasCssMacroStyleOptions(options)
3193
+ preserveConditionalComments: (0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options)
3526
3194
  };
3527
3195
  return ensureMiniProgramV3PreflightReset((0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(result.css, pruneOptions), options?.cssPreflight);
3528
3196
  }
3529
3197
  async function transformTailwindV3CssByTarget(css, target, options) {
3530
3198
  if (target === "weapp") return transformTailwindV3CssToWeapp(css, options);
3531
- return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css, options) : css;
3199
+ return (0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options) ? (0, _weapp_tailwindcss_postcss.transformCssMacroCss)(css, options) : css;
3532
3200
  }
3533
3201
  //#endregion
3534
3202
  //#region src/tailwindcss/v3-engine/generator.ts
3535
3203
  const incrementalGenerateCache = /* @__PURE__ */ new Map();
3204
+ const patchRawStyleGenerator = typeof tailwindcss_patch.generateTailwindV3RawStyle === "function" ? tailwindcss_patch.generateTailwindV3RawStyle : void 0;
3205
+ function isTailwindV3PatchResolutionError(error, packageName) {
3206
+ if (!error || typeof error !== "object") return false;
3207
+ const code = error.code;
3208
+ if (code !== "MODULE_NOT_FOUND" && code !== "ERR_PACKAGE_PATH_NOT_EXPORTED") return false;
3209
+ return String(error.message ?? "").includes(`${packageName}/lib/`);
3210
+ }
3536
3211
  function normalizeBareArbitraryValueCandidate(candidate, bareArbitraryValues) {
3537
3212
  return (0, tailwindcss_patch.resolveBareArbitraryValueCandidate)(candidate, bareArbitraryValues)?.canonicalCandidate ?? candidate;
3538
3213
  }
@@ -3592,7 +3267,7 @@ function shouldAutoEnableCssMacro(source) {
3592
3267
  return hasCssMacroTailwindPlugin(normalizeConfigObject(source.configObject)?.plugins);
3593
3268
  }
3594
3269
  function resolveStyleOptions(source, options) {
3595
- return shouldAutoEnableCssMacro(source) ? withCssMacroStyleOptions(options) : options;
3270
+ return shouldAutoEnableCssMacro(source) ? (0, _weapp_tailwindcss_postcss.withCssMacroStyleOptions)(options) : options;
3596
3271
  }
3597
3272
  function loadTailwindV3Internals(source) {
3598
3273
  const requireFromProject = (0, node_module.createRequire)(`${source.cwd}/package.json`);
@@ -3659,6 +3334,26 @@ function appendUtilityRules(root, context, rules) {
3659
3334
  function appendDirectUtilityRules(root, context) {
3660
3335
  appendUtilityRules(root, context, [...context.ruleCache]);
3661
3336
  }
3337
+ async function generateRawStyleWithPatch(generateSource, candidates, sources) {
3338
+ if (!patchRawStyleGenerator) return;
3339
+ try {
3340
+ return await patchRawStyleGenerator({
3341
+ cwd: generateSource.cwd,
3342
+ packageName: generateSource.packageName,
3343
+ css: generateSource.css,
3344
+ candidates,
3345
+ sources,
3346
+ config: createTailwindConfig(generateSource, {
3347
+ candidates,
3348
+ sources
3349
+ }),
3350
+ directUtilitiesOnly: "auto"
3351
+ });
3352
+ } catch (error) {
3353
+ if (isTailwindV3PatchResolutionError(error, generateSource.packageName)) return;
3354
+ throw error;
3355
+ }
3356
+ }
3662
3357
  function createTailwindV3Engine(source) {
3663
3358
  const runtimeReadyPromise = createRuntimeReadyPromise(source);
3664
3359
  let tailwindInternals;
@@ -3678,29 +3373,38 @@ function createTailwindV3Engine(source) {
3678
3373
  const tailwindConfig = internals.validateConfig(internals.resolveConfig(createTailwindConfig(generateSource, tailwindOptions)));
3679
3374
  const candidates = normalizedCandidates.candidates;
3680
3375
  const changedContent = createChangedContentEntries(candidates, options.sources ?? []);
3681
- const root = require_watch_dependencies.postcss_default.parse(generateSource.css, { from: void 0 });
3376
+ const root = _weapp_tailwindcss_postcss.postcss.parse(generateSource.css, { from: void 0 });
3682
3377
  const result = {
3683
3378
  css: "",
3684
3379
  messages: []
3685
3380
  };
3686
3381
  let context;
3687
- if (isDirectUtilitiesOnlyCss(generateSource.css)) {
3688
- context = internals.createContext(tailwindConfig, changedContent, root);
3689
- internals.generateRules(new Set(sortCandidates([internals.notOnDemandCandidate, ...candidates])), context);
3690
- root.removeAll();
3691
- appendDirectUtilityRules(root, context);
3692
- internals.resolveDefaultsAtRules(context)(root, result);
3693
- internals.collapseAdjacentRules(context)(root, result);
3694
- internals.collapseDuplicateDeclarations(context)(root, result);
3382
+ let rawCss;
3383
+ let dependencies;
3384
+ const patchGenerated = await generateRawStyleWithPatch(generateSource, candidates, options.sources ?? []);
3385
+ if (patchGenerated) {
3386
+ context = patchGenerated.context;
3387
+ rawCss = restoreBareArbitraryValueCssSelectors(patchGenerated.css, requestedCandidates, options.bareArbitraryValues, internals.escapeClassName);
3388
+ dependencies = new Set(patchGenerated.dependencies);
3695
3389
  } else {
3696
- const setupContext = () => {
3697
- return (currentRoot) => internals.createContext(tailwindConfig, changedContent, currentRoot);
3698
- };
3699
- context = await internals.processTailwindFeatures(setupContext)(root, result);
3390
+ if (isDirectUtilitiesOnlyCss(generateSource.css)) {
3391
+ context = internals.createContext(tailwindConfig, changedContent, root);
3392
+ internals.generateRules(new Set(sortCandidates([internals.notOnDemandCandidate, ...candidates])), context);
3393
+ root.removeAll();
3394
+ appendDirectUtilityRules(root, context);
3395
+ internals.resolveDefaultsAtRules(context)(root, result);
3396
+ internals.collapseAdjacentRules(context)(root, result);
3397
+ internals.collapseDuplicateDeclarations(context)(root, result);
3398
+ } else {
3399
+ const setupContext = () => {
3400
+ return (currentRoot) => internals.createContext(tailwindConfig, changedContent, currentRoot);
3401
+ };
3402
+ context = await internals.processTailwindFeatures(setupContext)(root, result);
3403
+ }
3404
+ rawCss = restoreBareArbitraryValueCssSelectors(root.toString(), requestedCandidates, options.bareArbitraryValues, internals.escapeClassName);
3405
+ dependencies = collectDependencyMessages(result);
3700
3406
  }
3701
- const rawCss = restoreBareArbitraryValueCssSelectors(root.toString(), requestedCandidates, options.bareArbitraryValues, internals.escapeClassName);
3702
3407
  const css = await transformTailwindV3CssByTarget(rawCss, target, resolvedStyleOptions);
3703
- const dependencies = collectDependencyMessages(result);
3704
3408
  for (const dependency of generateSource.dependencies) dependencies.add(dependency);
3705
3409
  const classSet = restoreBareArbitraryValueClassSet(collectClassSet(context), requestedCandidates, options.bareArbitraryValues);
3706
3410
  return {
@@ -3719,7 +3423,7 @@ function createTailwindV3Engine(source) {
3719
3423
  async function generateIncrementalMissingUtilities(context, candidates, target, styleOptions, bareArbitraryValues) {
3720
3424
  tailwindInternals ??= loadTailwindV3Internals(source);
3721
3425
  const internals = tailwindInternals;
3722
- const root = require_watch_dependencies.postcss_default.root();
3426
+ const root = _weapp_tailwindcss_postcss.postcss.root();
3723
3427
  const result = {
3724
3428
  css: "",
3725
3429
  messages: []
@@ -3841,7 +3545,7 @@ function resolveCssConfig(css, base) {
3841
3545
  css,
3842
3546
  config: void 0
3843
3547
  };
3844
- const root = require_watch_dependencies.postcss_default.parse(css);
3548
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
3845
3549
  let config;
3846
3550
  root.walkAtRules("config", (rule) => {
3847
3551
  const configPath = parseConfigParam(rule.params);
@@ -4401,7 +4105,7 @@ function collectGeneratedSelectors(css) {
4401
4105
  if (cached) return cached;
4402
4106
  const selectors = /* @__PURE__ */ new Set();
4403
4107
  try {
4404
- require_watch_dependencies.postcss_default.parse(css).walkRules((rule) => {
4108
+ _weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
4405
4109
  if (isCustomPropertyOnlyRule(rule) && !isPseudoContentInitRule(rule) && !hasUtilityClassSelector(rule.selector)) return;
4406
4110
  for (const selector of getRuleCompatSelectorKeys(rule)) selectors.add(selector);
4407
4111
  });
@@ -4414,7 +4118,7 @@ function collectGeneratedSelectors(css) {
4414
4118
  function collectGeneratedDeclarationPropsBySelector(generatedCss, selectors) {
4415
4119
  const propsBySelector = /* @__PURE__ */ new Map();
4416
4120
  try {
4417
- require_watch_dependencies.postcss_default.parse(generatedCss).walkRules((rule) => {
4121
+ _weapp_tailwindcss_postcss.postcss.parse(generatedCss).walkRules((rule) => {
4418
4122
  const matchedSelectors = getRuleCompatSelectorKeys(rule).filter((selector) => selectors.has(selector));
4419
4123
  if (matchedSelectors.length === 0) return;
4420
4124
  const props = /* @__PURE__ */ new Set();
@@ -4436,7 +4140,7 @@ function removeGeneratedSelectorCompatCss(css, generatedCss) {
4436
4140
  const generatedSelectors = collectGeneratedSelectors(generatedCss);
4437
4141
  if (generatedSelectors.size === 0) return css;
4438
4142
  try {
4439
- const root = require_watch_dependencies.postcss_default.parse(css);
4143
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
4440
4144
  let removed = false;
4441
4145
  root.walkRules((rule) => {
4442
4146
  if (isPseudoContentInitRule(rule)) {
@@ -4464,7 +4168,7 @@ function collectDedupedPostTransformCompatCss(css, generatedCss) {
4464
4168
  const generatedDeclarationPropsBySelector = collectGeneratedDeclarationPropsBySelector(generatedCss, generatedSelectors);
4465
4169
  const preservedNodes = [];
4466
4170
  try {
4467
- const root = require_watch_dependencies.postcss_default.parse(css);
4171
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
4468
4172
  root.each((node) => {
4469
4173
  if (node.type === "rule") {
4470
4174
  const nodeSelectors = getRuleCompatSelectorKeys(node);
@@ -4493,7 +4197,7 @@ function collectDedupedPostTransformCompatCss(css, generatedCss) {
4493
4197
  preservedNodes.push(node.clone());
4494
4198
  });
4495
4199
  if (preservedNodes.length === root.nodes.length) return css;
4496
- const nextRoot = require_watch_dependencies.postcss_default.root();
4200
+ const nextRoot = _weapp_tailwindcss_postcss.postcss.root();
4497
4201
  nextRoot.append(preservedNodes);
4498
4202
  return nextRoot.toString();
4499
4203
  } catch {
@@ -5002,7 +4706,7 @@ function createTailwindV4ApplyReferenceSource(css, sourceOptions) {
5002
4706
  function collectTailwindApplyUtilities(css) {
5003
4707
  let root;
5004
4708
  try {
5005
- root = require_watch_dependencies.postcss_default.parse(css);
4709
+ root = _weapp_tailwindcss_postcss.postcss.parse(css);
5006
4710
  } catch {
5007
4711
  return [];
5008
4712
  }
@@ -5276,7 +4980,7 @@ function countUnclosedBlocks(source) {
5276
4980
  }
5277
4981
  function closeTrailingUnclosedBlocks(source) {
5278
4982
  try {
5279
- require_watch_dependencies.postcss_default.parse(source);
4983
+ _weapp_tailwindcss_postcss.postcss.parse(source);
5280
4984
  return source;
5281
4985
  } catch (error) {
5282
4986
  if (error.reason !== "Unclosed block") return source;
@@ -5286,7 +4990,7 @@ function closeTrailingUnclosedBlocks(source) {
5286
4990
  }
5287
4991
  function removeTailwindApplyRules(rawSource) {
5288
4992
  try {
5289
- const root = require_watch_dependencies.postcss_default.parse(rawSource);
4993
+ const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
5290
4994
  let removed = false;
5291
4995
  root.walkAtRules("apply", (rule) => {
5292
4996
  const parent = rule.parent;
@@ -5311,7 +5015,7 @@ function resolveLegacyCompatCssSource(rawSource) {
5311
5015
  }
5312
5016
  function removeMiniProgramContainerCompatCss(css) {
5313
5017
  try {
5314
- const root = require_watch_dependencies.postcss_default.parse(css);
5018
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
5315
5019
  let removed = false;
5316
5020
  root.walkRules((rule) => {
5317
5021
  if (rule.selectors?.length === 1 && rule.selectors[0] === ".container") {
@@ -5401,7 +5105,7 @@ const CSS_LENGTH_UNIT_RE = /(?:^|[\s(,])[-+]?(?:\d+|\d*\.\d+)(?:px|rem)\b/i;
5401
5105
  const RPX_UNIT_RE = /(?:^|[\s(,])[-+]?(?:\d+|\d*\.\d+)rpx\b/i;
5402
5106
  function createLegacyDeclarationValueMap(css) {
5403
5107
  const values = /* @__PURE__ */ new Map();
5404
- require_watch_dependencies.postcss_default.parse(css).walkRules((rule) => {
5108
+ _weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
5405
5109
  if (!rule.selectors || rule.selectors.length === 0) return;
5406
5110
  for (const selector of rule.selectors) {
5407
5111
  const normalizedSelectors = normalizeCompatSelectors(selector);
@@ -5416,7 +5120,7 @@ function inheritLegacyUnitConvertedDeclarations(css, legacyCss) {
5416
5120
  try {
5417
5121
  const legacyValues = createLegacyDeclarationValueMap(legacyCss);
5418
5122
  if (legacyValues.size === 0) return css;
5419
- const root = require_watch_dependencies.postcss_default.parse(css);
5123
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
5420
5124
  let changed = false;
5421
5125
  root.walkRules((rule) => {
5422
5126
  if (!rule.selectors || rule.selectors.length === 0) return;
@@ -5454,7 +5158,7 @@ function isLocalImportRequest(request) {
5454
5158
  function isPureLocalCssImportWrapper(css) {
5455
5159
  let hasImport = false;
5456
5160
  try {
5457
- const root = require_watch_dependencies.postcss_default.parse(css);
5161
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
5458
5162
  for (const node of root.nodes) {
5459
5163
  if (node.type === "comment") continue;
5460
5164
  if (node.type !== "atrule" || node.name !== "import") return false;
@@ -5471,7 +5175,7 @@ function cleanLocalCssImportWrapperTailwindDirectives(css) {
5471
5175
  let hasLocalImport = false;
5472
5176
  let hasTailwindDirective = false;
5473
5177
  try {
5474
- const root = require_watch_dependencies.postcss_default.parse(css);
5178
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
5475
5179
  for (const node of root.nodes) {
5476
5180
  if (node.type === "comment") continue;
5477
5181
  if (node.type === "atrule" && node.name === "import") {
@@ -5493,7 +5197,7 @@ function cleanLocalCssImportWrapperTailwindDirectives(css) {
5493
5197
  }
5494
5198
  function prefixLocalCssImportsWithWebpackIgnore(css) {
5495
5199
  try {
5496
- const root = require_watch_dependencies.postcss_default.parse(css);
5200
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
5497
5201
  root.walkAtRules("import", (atRule) => {
5498
5202
  const request = parseImportRequest(atRule.params);
5499
5203
  if (request && isLocalImportRequest(request)) atRule.raws.before = `${atRule.raws.before ?? ""}/* webpackIgnore: true */\n`;
@@ -5505,8 +5209,8 @@ function prefixLocalCssImportsWithWebpackIgnore(css) {
5505
5209
  }
5506
5210
  function splitLocalCssImports(source) {
5507
5211
  try {
5508
- const root = require_watch_dependencies.postcss_default.parse(source);
5509
- const importRoot = require_watch_dependencies.postcss_default.root();
5212
+ const root = _weapp_tailwindcss_postcss.postcss.parse(source);
5213
+ const importRoot = _weapp_tailwindcss_postcss.postcss.root();
5510
5214
  let changed = false;
5511
5215
  for (const node of [...root.nodes]) {
5512
5216
  if (node.type !== "atrule" || node.name !== "import") continue;
@@ -5543,7 +5247,7 @@ const TAILWIND_V4_GENERATOR_AT_RULES = new Set([
5543
5247
  function removeTailwindApplyAtRules(source) {
5544
5248
  if (!source.includes("@apply")) return source;
5545
5249
  try {
5546
- const root = require_watch_dependencies.postcss_default.parse(source);
5250
+ const root = _weapp_tailwindcss_postcss.postcss.parse(source);
5547
5251
  let changed = false;
5548
5252
  root.walkAtRules("apply", (rule) => {
5549
5253
  rule.remove();
@@ -5559,7 +5263,7 @@ function removeTailwindApplyAtRules(source) {
5559
5263
  }
5560
5264
  function removeTailwindV4GeneratorAtRules(source) {
5561
5265
  try {
5562
- const root = require_watch_dependencies.postcss_default.parse(source);
5266
+ const root = _weapp_tailwindcss_postcss.postcss.parse(source);
5563
5267
  let changed = false;
5564
5268
  root.walkAtRules((rule) => {
5565
5269
  if (!TAILWIND_V4_GENERATOR_AT_RULES.has(rule.name)) return;
@@ -5579,7 +5283,7 @@ function removeTailwindV4GeneratorAtRules(source) {
5579
5283
  }
5580
5284
  function isCommentOnlyCss(source) {
5581
5285
  try {
5582
- const root = require_watch_dependencies.postcss_default.parse(source);
5286
+ const root = _weapp_tailwindcss_postcss.postcss.parse(source);
5583
5287
  return root.nodes.length > 0 && root.nodes.every((node) => node.type === "comment");
5584
5288
  } catch {
5585
5289
  return false;
@@ -5605,7 +5309,7 @@ function stripLeadingTailwindSourceMediaCloseFragment(source) {
5605
5309
  }
5606
5310
  function stripUnmatchedTailwindSourceMediaCloseFragments(source) {
5607
5311
  try {
5608
- require_watch_dependencies.postcss_default.parse(source);
5312
+ _weapp_tailwindcss_postcss.postcss.parse(source);
5609
5313
  return source;
5610
5314
  } catch {
5611
5315
  return stripLeadingTailwindSourceMediaCloseFragment(source).replace(/\s*\}\s*$/, "");
@@ -5617,9 +5321,9 @@ function splitUserCssLayerBlocks(source) {
5617
5321
  rest: source
5618
5322
  };
5619
5323
  try {
5620
- const root = require_watch_dependencies.postcss_default.parse(source);
5621
- const layerRoot = require_watch_dependencies.postcss_default.root();
5622
- const restRoot = require_watch_dependencies.postcss_default.root();
5324
+ const root = _weapp_tailwindcss_postcss.postcss.parse(source);
5325
+ const layerRoot = _weapp_tailwindcss_postcss.postcss.root();
5326
+ const restRoot = _weapp_tailwindcss_postcss.postcss.root();
5623
5327
  for (const node of root.nodes) (node.type === "atrule" && node.name === "layer" && node.nodes?.length ? layerRoot : restRoot).append(node.clone());
5624
5328
  return {
5625
5329
  layer: layerRoot.toString(),
@@ -5636,7 +5340,7 @@ function hasUserCssLayerBlocks(source) {
5636
5340
  if (!source.includes("@layer")) return false;
5637
5341
  try {
5638
5342
  let hasLayerBlock = false;
5639
- require_watch_dependencies.postcss_default.parse(source).walkAtRules("layer", (node) => {
5343
+ _weapp_tailwindcss_postcss.postcss.parse(source).walkAtRules("layer", (node) => {
5640
5344
  if (node.nodes?.length) hasLayerBlock = true;
5641
5345
  });
5642
5346
  return hasLayerBlock;
@@ -5647,7 +5351,7 @@ function hasUserCssLayerBlocks(source) {
5647
5351
  function collectUserLayerSelectors(source) {
5648
5352
  const selectors = /* @__PURE__ */ new Set();
5649
5353
  try {
5650
- require_watch_dependencies.postcss_default.parse(source).walkRules((rule) => {
5354
+ _weapp_tailwindcss_postcss.postcss.parse(source).walkRules((rule) => {
5651
5355
  for (const selector of rule.selectors ?? [rule.selector]) {
5652
5356
  const normalized = selector.trim();
5653
5357
  if (normalized) selectors.add(normalized);
@@ -5669,8 +5373,8 @@ function extractGeneratedCssForUserLayerSelectors(css, userLayerSource) {
5669
5373
  rest: css
5670
5374
  };
5671
5375
  try {
5672
- const root = require_watch_dependencies.postcss_default.parse(css);
5673
- const layerRoot = require_watch_dependencies.postcss_default.root();
5376
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
5377
+ const layerRoot = _weapp_tailwindcss_postcss.postcss.root();
5674
5378
  const selectorList = [...selectors];
5675
5379
  root.walkRules((rule) => {
5676
5380
  if ((rule.selectors ?? [rule.selector]).some((selector) => selectorList.some((userSelector) => matchesUserLayerSelector(selector.trim(), userSelector)))) {
@@ -5695,7 +5399,7 @@ function normalizeGeneratedSelector(selector) {
5695
5399
  function collectApplyOnlySourceSelectors(source) {
5696
5400
  const selectors = /* @__PURE__ */ new Set();
5697
5401
  try {
5698
- require_watch_dependencies.postcss_default.parse(source).walkRules((rule) => {
5402
+ _weapp_tailwindcss_postcss.postcss.parse(source).walkRules((rule) => {
5699
5403
  if (!rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply")) return;
5700
5404
  for (const selector of rule.selectors ?? [rule.selector]) {
5701
5405
  const normalized = normalizeGeneratedSelector(selector);
@@ -5709,7 +5413,7 @@ function hasOnlyApplyBackedSourceRules(source) {
5709
5413
  let hasApplyRule = false;
5710
5414
  let hasNonApplyRule = false;
5711
5415
  try {
5712
- require_watch_dependencies.postcss_default.parse(source).walkRules((rule) => {
5416
+ _weapp_tailwindcss_postcss.postcss.parse(source).walkRules((rule) => {
5713
5417
  if (rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply")) hasApplyRule = true;
5714
5418
  else hasNonApplyRule = true;
5715
5419
  });
@@ -5723,7 +5427,7 @@ function filterApplyOnlyGeneratedCss(css, source) {
5723
5427
  if (selectors.size === 0) return css;
5724
5428
  const selectorList = [...selectors];
5725
5429
  try {
5726
- const root = require_watch_dependencies.postcss_default.parse(css);
5430
+ const root = _weapp_tailwindcss_postcss.postcss.parse(css);
5727
5431
  root.walkRules((rule) => {
5728
5432
  const isApplySelector = (rule.selectors ?? [rule.selector]).some((selector) => {
5729
5433
  const normalized = normalizeGeneratedSelector(selector);