weapp-tailwindcss 5.0.5 → 5.0.7

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 (103) hide show
  1. package/dist/{bundle-state-Cso_ceUo.js → bundle-state-BzwPS-UI.js} +2 -1
  2. package/dist/{bundle-state-DEyxCR4f.mjs → bundle-state-ChcOKb9w.mjs} +2 -1
  3. package/dist/bundlers/gulp/index.d.ts +3 -4
  4. package/dist/bundlers/gulp/module-graph.d.ts +2 -0
  5. package/dist/bundlers/gulp/runtime-snapshot.d.ts +5 -0
  6. package/dist/bundlers/gulp/vinyl-transform.d.ts +3 -0
  7. package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
  8. package/dist/bundlers/shared/css-source-trace.d.ts +20 -0
  9. package/dist/bundlers/shared/generator-css/directives/fallback.d.ts +11 -0
  10. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +56 -0
  11. package/dist/bundlers/shared/generator-css/local-imports.d.ts +7 -0
  12. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
  13. package/dist/bundlers/shared/generator-css/types.d.ts +27 -0
  14. package/dist/bundlers/shared/generator-css/user-css.d.ts +26 -0
  15. package/dist/bundlers/shared/generator-css/validate.d.ts +5 -0
  16. package/dist/bundlers/shared/generator-css.d.ts +4 -32
  17. package/dist/bundlers/vite/css-finalizer.d.ts +3 -0
  18. package/dist/bundlers/vite/generate-bundle/css-config-directives.d.ts +2 -0
  19. package/dist/bundlers/vite/generate-bundle/css-output.d.ts +14 -0
  20. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +11 -0
  21. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +9 -0
  22. package/dist/bundlers/vite/generate-bundle/style-matching.d.ts +5 -0
  23. package/dist/bundlers/vite/generate-bundle/subpackages.d.ts +7 -0
  24. package/dist/bundlers/vite/generate-bundle/types.d.ts +68 -0
  25. package/dist/bundlers/vite/generate-bundle.d.ts +4 -62
  26. package/dist/bundlers/vite/incremental-runtime-class-set/entries.d.ts +4 -0
  27. package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +2 -0
  28. package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +13 -0
  29. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +1 -0
  30. package/dist/bundlers/vite/processed-css-assets/css-rules.d.ts +17 -0
  31. package/dist/bundlers/vite/processed-css-assets.d.ts +2 -0
  32. package/dist/bundlers/vite/source-candidates/scan-root.d.ts +10 -0
  33. package/dist/bundlers/vite/source-candidates/script.d.ts +7 -0
  34. package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +1 -0
  35. package/dist/bundlers/vite/source-candidates.d.ts +8 -3
  36. package/dist/bundlers/vite/source-scan/css-entries.d.ts +20 -0
  37. package/dist/bundlers/vite/source-scan/dependencies.d.ts +2 -0
  38. package/dist/bundlers/vite/source-scan.d.ts +2 -12
  39. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -0
  40. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -20
  41. package/dist/cli.js +69 -69
  42. package/dist/cli.mjs +69 -69
  43. package/dist/core.js +1 -1
  44. package/dist/core.mjs +1 -1
  45. package/dist/{defaults-BPUuNYcD.js → defaults-Boc26eel.js} +1 -0
  46. package/dist/{defaults-8xrgzxFY.mjs → defaults-DH0ZQRhy.mjs} +1 -0
  47. package/dist/defaults.js +1 -1
  48. package/dist/defaults.mjs +1 -1
  49. package/dist/{generator-AD-eX8Tr.js → generator-6yF8wjxR.js} +1 -1
  50. package/dist/{generator-DVWLNO0n.mjs → generator-BON6M1bL.mjs} +1 -1
  51. package/dist/generator.js +2 -2
  52. package/dist/generator.mjs +2 -2
  53. package/dist/gulp-_7p1Z2vc.js +473 -0
  54. package/dist/gulp-oE-Byqk6.mjs +463 -0
  55. package/dist/gulp.js +4 -414
  56. package/dist/gulp.mjs +1 -406
  57. package/dist/{incremental-runtime-class-set-vOetpdWs.js → hmr-timing-BKQNRxHr.js} +1257 -459
  58. package/dist/{incremental-runtime-class-set-xf49kky6.mjs → hmr-timing-BVTGf5ch.mjs} +1221 -477
  59. package/dist/index.js +5 -5
  60. package/dist/index.mjs +5 -5
  61. package/dist/{postcss-Cbi6RFpf.js → postcss-BTIunhWl.js} +7 -7
  62. package/dist/{postcss-hSUxK7oR.mjs → postcss-BtmrrZ31.mjs} +4 -4
  63. package/dist/postcss.js +1 -1
  64. package/dist/postcss.mjs +1 -1
  65. package/dist/{precheck-Bsn_LMmo.mjs → precheck-CZjr87m_.mjs} +19 -5
  66. package/dist/{precheck-b8Y8qZg0.js → precheck-fhIkzCSU.js} +19 -5
  67. package/dist/presets.js +2 -2
  68. package/dist/presets.mjs +2 -2
  69. package/dist/tailwindcss/source-scan/inline-source.d.ts +7 -0
  70. package/dist/tailwindcss/source-scan.d.ts +2 -7
  71. package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +3 -0
  72. package/dist/tailwindcss/v3-engine/generator/content.d.ts +10 -0
  73. package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +2 -0
  74. package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +2 -0
  75. package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +6 -0
  76. package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +2 -0
  77. package/dist/tailwindcss/v4-engine/types.d.ts +1 -1
  78. package/dist/{tailwindcss-AWaPVF2B.mjs → tailwindcss-bbQUg25J.mjs} +2 -2
  79. package/dist/{tailwindcss-CpQ6X4l6.js → tailwindcss-vswd1gc3.js} +2 -2
  80. package/dist/{transform-BkGtbxb1.js → transform-CReJxxh_.js} +11 -2
  81. package/dist/{transform-DumSZmTh.mjs → transform-DEsFlG9k.mjs} +11 -2
  82. package/dist/types/typedoc-tailwindcss-patch.d.ts +4 -2
  83. package/dist/types/user-defined-options/general.d.ts +5 -0
  84. package/dist/uni-app-x/component-local-style.d.ts +1 -0
  85. package/dist/uni-app-x/harmony.d.ts +1 -0
  86. package/dist/uni-app-x/style-asset/style-value.d.ts +16 -0
  87. package/dist/uni-app-x/style-asset.d.ts +20 -0
  88. package/dist/uni-app-x/transform.d.ts +1 -0
  89. package/dist/uni-app-x/vite.d.ts +1 -0
  90. package/dist/{v3-engine-CM0TRa8V.js → v3-engine-CEMXFegG.js} +714 -663
  91. package/dist/{v3-engine-Cczrkzqt.mjs → v3-engine-CdIwmHuc.mjs} +758 -707
  92. package/dist/{vite-CTuHPC91.js → vite-0jFbh9hx.js} +1797 -386
  93. package/dist/{vite-DLXDMHON.mjs → vite-C7BGAlCE.mjs} +1779 -369
  94. package/dist/vite.js +1 -1
  95. package/dist/vite.mjs +1 -1
  96. package/dist/weapp-tw-css-import-rewrite-loader.js +1169 -1002
  97. package/dist/{webpack-DJFw08SK.mjs → webpack-Dx6_eg5k.mjs} +96 -36
  98. package/dist/{webpack-BBHJYKqB.js → webpack-aEuDoYfQ.js} +105 -44
  99. package/dist/webpack.js +1 -1
  100. package/dist/webpack.mjs +1 -1
  101. package/package.json +6 -5
  102. package/dist/source-candidates-BsWYoIPN.mjs +0 -355
  103. package/dist/source-candidates-o2ZrKWzu.js +0 -374
@@ -1,13 +1,13 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
2
  const require_auto = require("./auto-Cvy0zWpS.js");
3
- let node_fs = require("node:fs");
4
- node_fs = require_chunk.__toESM(node_fs);
5
3
  let node_module = require("node:module");
6
4
  let postcss = require("postcss");
7
5
  postcss = require_chunk.__toESM(postcss);
8
6
  let tailwindcss_patch = require("tailwindcss-patch");
9
7
  let node_process = require("node:process");
10
8
  node_process = require_chunk.__toESM(node_process);
9
+ let node_fs = require("node:fs");
10
+ node_fs = require_chunk.__toESM(node_fs);
11
11
  let node_path = require("node:path");
12
12
  node_path = require_chunk.__toESM(node_path);
13
13
  let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
@@ -16,12 +16,175 @@ let node_url = require("node:url");
16
16
  let debug = require("debug");
17
17
  debug = require_chunk.__toESM(debug);
18
18
  let node_fs_promises = require("node:fs/promises");
19
- let fast_glob = require("fast-glob");
20
- fast_glob = require_chunk.__toESM(fast_glob);
21
- let tailwindcss_config = require("tailwindcss-config");
22
19
  let micromatch = require("micromatch");
23
20
  micromatch = require_chunk.__toESM(micromatch);
24
21
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
22
+ let fast_glob = require("fast-glob");
23
+ fast_glob = require_chunk.__toESM(fast_glob);
24
+ let tailwindcss_config = require("tailwindcss-config");
25
+ //#region src/utils/object.ts
26
+ function definedEntries(value) {
27
+ return Object.entries(value).filter(([, item]) => item !== void 0);
28
+ }
29
+ function omitUndefined(value) {
30
+ return Object.fromEntries(definedEntries(value));
31
+ }
32
+ //#endregion
33
+ //#region src/tailwindcss/v3-engine/generator/content.ts
34
+ function isLegacyContentObject$1(value) {
35
+ return typeof value === "object" && value !== null && "files" in value;
36
+ }
37
+ function createRawContentEntries(candidates, sources) {
38
+ const entries = [];
39
+ const candidateContent = [...candidates].join(" ");
40
+ if (candidateContent.length > 0) entries.push({
41
+ raw: candidateContent,
42
+ extension: "html"
43
+ });
44
+ for (const source of sources) entries.push({
45
+ raw: source.content,
46
+ extension: source.extension ?? "html"
47
+ });
48
+ return entries;
49
+ }
50
+ function createChangedContentEntries(candidates, sources) {
51
+ return createRawContentEntries(candidates, sources).map((entry) => ({
52
+ content: entry.raw,
53
+ extension: entry.extension
54
+ }));
55
+ }
56
+ function collectCandidates$1(candidates) {
57
+ return new Set(candidates ?? []);
58
+ }
59
+ function collectApplyCandidatesFromCss(css) {
60
+ if (!css.includes("@apply")) return [];
61
+ const candidates = /* @__PURE__ */ new Set();
62
+ try {
63
+ postcss.default.parse(css).walkAtRules("apply", (rule) => {
64
+ for (const candidate of rule.params.split(/\s+/)) {
65
+ const normalized = candidate.replace(/!important$/, "").trim();
66
+ if (normalized) candidates.add(normalized);
67
+ }
68
+ });
69
+ } catch {}
70
+ return [...candidates];
71
+ }
72
+ function isTailwindCandidateLayer(params) {
73
+ return params.split(/[,\s]+/).some((layer) => layer === "components" || layer === "utilities");
74
+ }
75
+ function extractClassCandidatesFromSelector(selector, candidates) {
76
+ for (let index = 0; index < selector.length; index++) {
77
+ if (selector[index] !== ".") continue;
78
+ let candidate = "";
79
+ let escaped = false;
80
+ for (let tokenIndex = index + 1; tokenIndex < selector.length; tokenIndex++) {
81
+ const char = selector[tokenIndex];
82
+ if (escaped) {
83
+ candidate += char;
84
+ escaped = false;
85
+ continue;
86
+ }
87
+ if (char === "\\") {
88
+ escaped = true;
89
+ continue;
90
+ }
91
+ if (char && /[\w-]/.test(char)) {
92
+ candidate += char;
93
+ continue;
94
+ }
95
+ break;
96
+ }
97
+ if (candidate) candidates.add(candidate);
98
+ }
99
+ }
100
+ function collectLayerCandidatesFromCss(css) {
101
+ if (!css.includes("@layer")) return [];
102
+ const candidates = /* @__PURE__ */ new Set();
103
+ try {
104
+ postcss.default.parse(css).walkAtRules("layer", (layer) => {
105
+ if (!isTailwindCandidateLayer(layer.params)) return;
106
+ layer.walkRules((rule) => {
107
+ extractClassCandidatesFromSelector(rule.selector, candidates);
108
+ });
109
+ });
110
+ } catch {}
111
+ return [...candidates];
112
+ }
113
+ function mergeGenerateCandidates(source, options) {
114
+ return collectCandidates$1([
115
+ ...collectLayerCandidatesFromCss(source.css),
116
+ ...collectApplyCandidatesFromCss(source.css),
117
+ ...collectCandidates$1(options.candidates)
118
+ ]);
119
+ }
120
+ function mergeContent(content, rawEntries) {
121
+ if (isLegacyContentObject$1(content)) return {
122
+ ...content,
123
+ relative: content.relative ?? true,
124
+ files: [...[].concat(content.files ?? []), ...rawEntries]
125
+ };
126
+ return {
127
+ relative: true,
128
+ files: [...[].concat(content ?? []), ...rawEntries]
129
+ };
130
+ }
131
+ function normalizeConfigObject(config) {
132
+ if (!config || typeof config !== "object") return config;
133
+ const maybeDefault = config.default;
134
+ if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
135
+ return config;
136
+ }
137
+ function hasExplicitContentInput(options) {
138
+ return options.candidates !== void 0 || options.sources !== void 0;
139
+ }
140
+ function createExplicitContentConfig(rawEntries) {
141
+ return {
142
+ relative: true,
143
+ files: rawEntries
144
+ };
145
+ }
146
+ function createTailwindConfig(source, options) {
147
+ const config = { ...normalizeConfigObject(source.configObject) ?? {} };
148
+ const rawEntries = createRawContentEntries(mergeGenerateCandidates(source, options), options.sources ?? []);
149
+ config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
150
+ return config;
151
+ }
152
+ //#endregion
153
+ //#region src/tailwindcss/v3-engine/generator/cache-key.ts
154
+ function createStableJson$1(value) {
155
+ if (value === void 0) return "undefined";
156
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
157
+ if (Array.isArray(value)) return `[${value.map((item) => createStableJson$1(item)).join(",")}]`;
158
+ return `{${Object.keys(value).sort().map((key) => {
159
+ const record = value;
160
+ return `${JSON.stringify(key)}:${createStableJson$1(record[key])}`;
161
+ }).join(",")}}`;
162
+ }
163
+ function createDependencyFingerprint$1(files) {
164
+ return files.map((file) => {
165
+ try {
166
+ const stat = node_fs.default.statSync(file);
167
+ return `${file}:${stat.size}:${stat.mtimeMs}`;
168
+ } catch {
169
+ return `${file}:missing`;
170
+ }
171
+ }).join("|");
172
+ }
173
+ function createIncrementalGenerateCacheKey$1(source, target, styleOptions, bareArbitraryValues) {
174
+ return [
175
+ source.packageName,
176
+ source.postcssPlugin,
177
+ source.cwd,
178
+ source.config ?? "config:missing",
179
+ createDependencyFingerprint$1(source.dependencies),
180
+ source.css,
181
+ createStableJson$1(normalizeConfigObject(source.configObject)?.content),
182
+ target,
183
+ createStableJson$1(styleOptions),
184
+ createStableJson$1(bareArbitraryValues)
185
+ ].join("\0");
186
+ }
187
+ //#endregion
25
188
  //#region src/context/workspace.ts
26
189
  const IGNORED_WORKSPACE_DIRS = new Set([
27
190
  "node_modules",
@@ -81,14 +244,6 @@ function findWorkspacePackageDir(rootDir, packageName) {
81
244
  }
82
245
  }
83
246
  //#endregion
84
- //#region src/utils/object.ts
85
- function definedEntries(value) {
86
- return Object.entries(value).filter(([, item]) => item !== void 0);
87
- }
88
- function omitUndefined(value) {
89
- return Object.fromEntries(definedEntries(value));
90
- }
91
- //#endregion
92
247
  //#region src/utils/options.ts
93
248
  function resolveBooleanObjectOption(value, enabledValue) {
94
249
  if (!value) return false;
@@ -311,7 +466,7 @@ function createTailwindcssPatcher(options) {
311
466
  const resolvedTailwindOptions = resolvedOptions.tailwindcss;
312
467
  if (resolvedTailwindOptions) {
313
468
  const existingResolve = resolvedTailwindOptions.resolve ?? {};
314
- const sourcePaths = Array.isArray(existingResolve.paths) && existingResolve.paths.length > 0 ? [...existingResolve.paths, ...resolvePaths] : resolvePaths;
469
+ const sourcePaths = Array.isArray(existingResolve.paths) && existingResolve.paths.length > 0 ? [...existingResolve.paths ?? [], ...resolvePaths] : resolvePaths;
315
470
  resolvedTailwindOptions.resolve = {
316
471
  ...existingResolve,
317
472
  paths: [...new Set(sourcePaths)]
@@ -373,140 +528,8 @@ function createDebug(prefix) {
373
528
  return debug$2;
374
529
  }
375
530
  //#endregion
376
- //#region src/tailwindcss/source-scan.ts
377
- const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
378
- "html",
379
- "wxml",
380
- "axml",
381
- "jxml",
382
- "ksml",
383
- "ttml",
384
- "qml",
385
- "tyml",
386
- "xhsml",
387
- "swan",
388
- "vue",
389
- "mpx",
390
- "js",
391
- "jsx",
392
- "ts",
393
- "tsx"
394
- ];
395
- const FULL_SOURCE_SCAN_EXTENSIONS = [
396
- "js",
397
- "jsx",
398
- "mjs",
399
- "cjs",
400
- "ts",
401
- "tsx",
402
- "mts",
403
- "cts",
404
- "vue",
405
- "uvue",
406
- "nvue",
407
- "svelte",
408
- "mpx",
409
- "html",
410
- "wxml",
411
- "axml",
412
- "jxml",
413
- "ksml",
414
- "ttml",
415
- "qml",
416
- "tyml",
417
- "xhsml",
418
- "swan",
419
- "css",
420
- "wxss",
421
- "acss",
422
- "jxss",
423
- "ttss",
424
- "qss",
425
- "tyss",
426
- "scss",
427
- "sass",
428
- "less",
429
- "styl",
430
- "stylus"
431
- ];
432
- function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
433
- return `**/*.{${extensions.join(",")}}`;
434
- }
435
- const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
436
- const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
437
- function toPosixPath(value) {
438
- return value.split(node_path.default.sep).join("/");
439
- }
440
- function resolveSourceScanPath(value) {
441
- const resolved = node_path.default.resolve(value);
442
- try {
443
- return node_fs.realpathSync.native(resolved);
444
- } catch {
445
- return resolved;
446
- }
447
- }
448
- function normalizeEntryPattern(entry) {
449
- return node_path.default.isAbsolute(entry.pattern) ? toPosixPath(node_path.default.relative(resolveSourceScanPath(entry.base), entry.pattern)) : entry.pattern;
450
- }
451
- function isFileMatchedByTailwindSourceEntry(file, entry) {
452
- const relative = toPosixPath(node_path.default.relative(resolveSourceScanPath(entry.base), file));
453
- return relative && !relative.startsWith("../") && !node_path.default.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizeEntryPattern(entry));
454
- }
455
- function isFileExcludedByTailwindSourceEntries(file, entries) {
456
- if (!entries?.length) return false;
457
- const resolvedFile = resolveSourceScanPath(file);
458
- return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
459
- }
460
- function isFileMatchedByTailwindSourceEntries(file, entries) {
461
- if (!entries?.length) return true;
462
- const positiveEntries = entries.filter((entry) => !entry.negated);
463
- const negativeEntries = entries.filter((entry) => entry.negated);
464
- const resolvedFile = resolveSourceScanPath(file);
465
- if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
466
- if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
467
- return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
468
- }
469
- function createTailwindSourceEntryMatcher(entries) {
470
- if (!entries?.length) return;
471
- return (file) => isFileMatchedByTailwindSourceEntries(file, entries);
472
- }
473
- function resolveTailwindV4CssSourceBase(source, fallbackBase) {
474
- if (typeof source.base === "string" && source.base.length > 0) return source.base;
475
- if (typeof source.file === "string" && source.file.length > 0) return node_path.default.dirname(source.file);
476
- return fallbackBase;
477
- }
531
+ //#region src/tailwindcss/source-scan/inline-source.ts
478
532
  const NUMERICAL_RANGE_RE = /^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/;
479
- function parseConfigParam$1(params) {
480
- const value = params.trim();
481
- return /^(['"])(.+)\1$/.exec(value)?.[2];
482
- }
483
- function isLegacyContentObject$1(value) {
484
- return typeof value === "object" && value !== null && "files" in value;
485
- }
486
- function normalizeGlobPattern(pattern) {
487
- return pattern.startsWith("./") ? pattern.slice(2) : pattern;
488
- }
489
- function hasGlobMagic(value) {
490
- return /[*?[\]{}()!+@]/.test(value);
491
- }
492
- function splitStaticGlobPrefix(pattern) {
493
- const segments = normalizeGlobPattern(pattern).split(/[\\/]+/);
494
- const prefix = [];
495
- const rest = [];
496
- let reachedGlob = false;
497
- for (const segment of segments) {
498
- if (!reachedGlob && segment && !hasGlobMagic(segment)) {
499
- prefix.push(segment);
500
- continue;
501
- }
502
- reachedGlob = true;
503
- rest.push(segment);
504
- }
505
- return {
506
- prefix,
507
- rest
508
- };
509
- }
510
533
  function segmentTopLevel(input, separator, options = {}) {
511
534
  const parts = [];
512
535
  const stack = [];
@@ -633,6 +656,140 @@ function collectCssInlineSourceCandidates(root) {
633
656
  excluded
634
657
  };
635
658
  }
659
+ //#endregion
660
+ //#region src/tailwindcss/source-scan.ts
661
+ const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
662
+ "html",
663
+ "wxml",
664
+ "axml",
665
+ "jxml",
666
+ "ksml",
667
+ "ttml",
668
+ "qml",
669
+ "tyml",
670
+ "xhsml",
671
+ "swan",
672
+ "vue",
673
+ "mpx",
674
+ "js",
675
+ "jsx",
676
+ "ts",
677
+ "tsx"
678
+ ];
679
+ const FULL_SOURCE_SCAN_EXTENSIONS = [
680
+ "js",
681
+ "jsx",
682
+ "mjs",
683
+ "cjs",
684
+ "ts",
685
+ "tsx",
686
+ "mts",
687
+ "cts",
688
+ "vue",
689
+ "uvue",
690
+ "nvue",
691
+ "svelte",
692
+ "mpx",
693
+ "html",
694
+ "wxml",
695
+ "axml",
696
+ "jxml",
697
+ "ksml",
698
+ "ttml",
699
+ "qml",
700
+ "tyml",
701
+ "xhsml",
702
+ "swan",
703
+ "css",
704
+ "wxss",
705
+ "acss",
706
+ "jxss",
707
+ "ttss",
708
+ "qss",
709
+ "tyss",
710
+ "scss",
711
+ "sass",
712
+ "less",
713
+ "styl",
714
+ "stylus"
715
+ ];
716
+ function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
717
+ return `**/*.{${extensions.join(",")}}`;
718
+ }
719
+ const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
720
+ const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
721
+ function toPosixPath(value) {
722
+ return value.split(node_path.default.sep).join("/");
723
+ }
724
+ function resolveSourceScanPath(value) {
725
+ const resolved = node_path.default.resolve(value);
726
+ try {
727
+ return node_fs.realpathSync.native(resolved);
728
+ } catch {
729
+ return resolved;
730
+ }
731
+ }
732
+ function normalizeEntryPattern(entry) {
733
+ return node_path.default.isAbsolute(entry.pattern) ? toPosixPath(node_path.default.relative(resolveSourceScanPath(entry.base), entry.pattern)) : entry.pattern;
734
+ }
735
+ function isFileMatchedByTailwindSourceEntry(file, entry) {
736
+ const relative = toPosixPath(node_path.default.relative(resolveSourceScanPath(entry.base), file));
737
+ return relative && !relative.startsWith("../") && !node_path.default.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizeEntryPattern(entry));
738
+ }
739
+ function isFileExcludedByTailwindSourceEntries(file, entries) {
740
+ if (!entries?.length) return false;
741
+ const resolvedFile = resolveSourceScanPath(file);
742
+ return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
743
+ }
744
+ function isFileMatchedByTailwindSourceEntries(file, entries) {
745
+ if (!entries?.length) return true;
746
+ const positiveEntries = entries.filter((entry) => !entry.negated);
747
+ const negativeEntries = entries.filter((entry) => entry.negated);
748
+ const resolvedFile = resolveSourceScanPath(file);
749
+ if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
750
+ if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
751
+ return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
752
+ }
753
+ function createTailwindSourceEntryMatcher(entries) {
754
+ if (!entries?.length) return;
755
+ return (file) => isFileMatchedByTailwindSourceEntries(file, entries);
756
+ }
757
+ function resolveTailwindV4CssSourceBase(source, fallbackBase) {
758
+ if (typeof source.base === "string" && source.base.length > 0) return source.base;
759
+ if (typeof source.file === "string" && source.file.length > 0) return node_path.default.dirname(source.file);
760
+ return fallbackBase;
761
+ }
762
+ function parseConfigParam$1(params) {
763
+ const value = params.trim();
764
+ return /^(['"])(.+)\1$/.exec(value)?.[2];
765
+ }
766
+ function isLegacyContentObject(value) {
767
+ return typeof value === "object" && value !== null && "files" in value;
768
+ }
769
+ function normalizeGlobPattern(pattern) {
770
+ return pattern.startsWith("./") ? pattern.slice(2) : pattern;
771
+ }
772
+ function hasGlobMagic(value) {
773
+ return /[*?[\]{}()!+@]/.test(value);
774
+ }
775
+ function splitStaticGlobPrefix(pattern) {
776
+ const segments = normalizeGlobPattern(pattern).split(/[\\/]+/);
777
+ const prefix = [];
778
+ const rest = [];
779
+ let reachedGlob = false;
780
+ for (const segment of segments) {
781
+ if (!reachedGlob && segment && !hasGlobMagic(segment)) {
782
+ prefix.push(segment);
783
+ continue;
784
+ }
785
+ reachedGlob = true;
786
+ rest.push(segment);
787
+ }
788
+ return {
789
+ prefix,
790
+ rest
791
+ };
792
+ }
636
793
  function normalizeLegacyContentEntries(content, base, options = {}) {
637
794
  if (typeof content === "string") {
638
795
  const negated = content.startsWith("!");
@@ -643,7 +800,7 @@ function normalizeLegacyContentEntries(content, base, options = {}) {
643
800
  }];
644
801
  }
645
802
  if (Array.isArray(content)) return content.flatMap((item) => normalizeLegacyContentEntries(item, base, options));
646
- if (isLegacyContentObject$1(content)) return normalizeLegacyContentEntries(content.files, content.relative && options.relativeBase ? options.relativeBase : base, options);
803
+ if (isLegacyContentObject(content)) return normalizeLegacyContentEntries(content.files, content.relative && options.relativeBase ? options.relativeBase : base, options);
647
804
  return [];
648
805
  }
649
806
  async function pathExistsAsDirectory(file) {
@@ -739,40 +896,6 @@ function filterUnsupportedMiniProgramTailwindV4Candidates(candidates) {
739
896
  return new Set([...candidates].filter((candidate) => !isUnsupportedMiniProgramTailwindV4Candidate(candidate)));
740
897
  }
741
898
  //#endregion
742
- //#region src/tailwindcss/v4-engine/miniprogram.ts
743
- const defaultStyleHandler$1 = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
744
- cssChildCombinatorReplaceValue: ["view", "text"],
745
- cssRemoveHoverPseudoClass: true,
746
- isMainChunk: true,
747
- majorVersion: 4
748
- });
749
- const CSS_DECLARATION_URL_RE = /(:\s*)url\(([^\n\r"';[\]{}]*[[\]{}][^\n\r;]*)\)(?=\s*;)/g;
750
- function normalizeTailwindV4GeneratedUrlValues(css) {
751
- return css.replace(CSS_DECLARATION_URL_RE, (match, prefix, urlValue) => {
752
- try {
753
- return `${prefix}url("${urlValue.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}")`;
754
- } catch {
755
- return match;
756
- }
757
- });
758
- }
759
- async function transformTailwindV4CssToWeapp(css, options) {
760
- const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(require_auto.hasCssMacroStyleOptions(options) ? await require_auto.transformCssMacroCss(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
761
- const result = await defaultStyleHandler$1(protectedCss.css, {
762
- cssChildCombinatorReplaceValue: ["view", "text"],
763
- cssRemoveHoverPseudoClass: true,
764
- isMainChunk: true,
765
- majorVersion: 4,
766
- ...options
767
- });
768
- const pruneOptions = { preserveConditionalComments: require_auto.hasCssMacroStyleOptions(options) };
769
- return (0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(protectedCss.restore(result.css), pruneOptions);
770
- }
771
- async function transformTailwindV4CssByTarget(css, target, options) {
772
- if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
773
- return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css, options) : css;
774
- }
775
- //#endregion
776
899
  //#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
777
900
  const TAILWIND_V3_COLOR_STEPS = [
778
901
  "50",
@@ -1504,40 +1627,7 @@ function createTailwindV4DefaultColorThemeCss() {
1504
1627
  ].join("\n");
1505
1628
  }
1506
1629
  //#endregion
1507
- //#region src/tailwindcss/v4-engine/generator.ts
1508
- const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
1509
- const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
1510
- const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
1511
- const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
1512
- const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
1513
- "**/.git/**",
1514
- "**/.hg/**",
1515
- "**/.jj/**",
1516
- "**/.next/**",
1517
- "**/.parcel-cache/**",
1518
- "**/.pnpm-store/**",
1519
- "**/.svelte-kit/**",
1520
- "**/.svn/**",
1521
- "**/.turbo/**",
1522
- "**/.venv/**",
1523
- "**/.vercel/**",
1524
- "**/.yarn/**",
1525
- "**/__pycache__/**",
1526
- "**/node_modules/**",
1527
- "**/venv/**",
1528
- "**/*.less",
1529
- "**/*.lock",
1530
- "**/*.sass",
1531
- "**/*.scss",
1532
- "**/*.styl",
1533
- "**/*.log",
1534
- "**/package-lock.json",
1535
- "**/pnpm-lock.yaml",
1536
- "**/bun.lockb",
1537
- "**/.gitignore",
1538
- "**/.env",
1539
- "**/.env.*"
1540
- ];
1630
+ //#region src/tailwindcss/v4-engine/generator/css-compat.ts
1541
1631
  function findLeadingImportInsertionIndex(css) {
1542
1632
  const importPattern = /(?:^|\n)\s*@import\b[^;]*;/g;
1543
1633
  let insertionIndex = 0;
@@ -1554,13 +1644,78 @@ function applyMiniProgramTailwindV4DefaultColorCss(css) {
1554
1644
  if (insertionIndex === 0) return `${themeCss}\n${css}`;
1555
1645
  return `${css.slice(0, insertionIndex)}\n${themeCss}\n${css.slice(insertionIndex)}`;
1556
1646
  }
1557
- function collectCandidates$1(candidates) {
1558
- return new Set(candidates ?? []);
1559
- }
1560
- function hasRemovedCandidates$1(previousCandidates, nextCandidates) {
1561
- for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
1647
+ function parseCssImportSpecifier$3(params) {
1648
+ const value = params.trim();
1649
+ const quoted = /^(['"])(.*?)\1/.exec(value);
1650
+ if (quoted) return quoted[2];
1651
+ const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
1652
+ return url?.[2] ?? url?.[3];
1653
+ }
1654
+ function isTailwindCssPreflightImport(params) {
1655
+ const specifier = parseCssImportSpecifier$3(params);
1656
+ return specifier === "tailwindcss/preflight.css" || specifier === "tailwindcss/preflight";
1657
+ }
1658
+ function hasImportLayerOption(params) {
1659
+ return /\blayer(?:\s*\(|\s*$)/.test(params);
1660
+ }
1661
+ function removeUnlayeredTailwindV4PreflightImports(css) {
1662
+ if (!css.includes("preflight")) return css;
1663
+ let root;
1664
+ try {
1665
+ root = postcss.default.parse(css);
1666
+ } catch {
1667
+ return css;
1668
+ }
1669
+ let changed = false;
1670
+ root.walkAtRules("import", (rule) => {
1671
+ if (isTailwindCssPreflightImport(rule.params) && !hasImportLayerOption(rule.params)) {
1672
+ rule.remove();
1673
+ changed = true;
1674
+ }
1675
+ });
1676
+ return changed ? root.toString() : css;
1677
+ }
1678
+ function hasThemeParent(rule) {
1679
+ let parent = rule.parent;
1680
+ while (parent) {
1681
+ if (parent.type === "atrule" && parent.name === "theme") return true;
1682
+ parent = parent.parent;
1683
+ }
1562
1684
  return false;
1563
1685
  }
1686
+ function isVendorPrefixedKeyframes(rule) {
1687
+ return rule.name.startsWith("-") && rule.name.endsWith("keyframes");
1688
+ }
1689
+ function removeUnsupportedThemeVendorKeyframes(css) {
1690
+ if (!css.includes("@theme") || !css.includes("@-")) return css;
1691
+ let root;
1692
+ try {
1693
+ root = postcss.default.parse(css);
1694
+ } catch {
1695
+ return css;
1696
+ }
1697
+ let changed = false;
1698
+ root.walkAtRules((rule) => {
1699
+ if (isVendorPrefixedKeyframes(rule) && hasThemeParent(rule)) {
1700
+ rule.remove();
1701
+ changed = true;
1702
+ }
1703
+ });
1704
+ return changed ? root.toString() : css;
1705
+ }
1706
+ function createCompatibleSource(source, target, tailwindcssV3Compatibility) {
1707
+ const shouldApplyTailwindV3Compatibility = tailwindcssV3Compatibility ?? target === "weapp";
1708
+ const filteredSourceCss = target === "weapp" ? removeUnlayeredTailwindV4PreflightImports(source.css) : source.css;
1709
+ const compatibleSourceCss = removeUnsupportedThemeVendorKeyframes(shouldApplyTailwindV3Compatibility ? applyTailwindV3CompatibilityCss(filteredSourceCss) : target === "weapp" ? applyMiniProgramTailwindV4DefaultColorCss(filteredSourceCss) : filteredSourceCss);
1710
+ return compatibleSourceCss === source.css ? source : {
1711
+ ...source,
1712
+ css: compatibleSourceCss
1713
+ };
1714
+ }
1715
+ //#endregion
1716
+ //#region src/tailwindcss/v4-engine/generator/rpx-candidates.ts
1717
+ const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
1718
+ const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
1564
1719
  function normalizeRpxTextCandidate(candidate) {
1565
1720
  return candidate.replace(BARE_RPX_TEXT_CANDIDATE_RE, "$1text-[length:$2]$3");
1566
1721
  }
@@ -1593,16 +1748,162 @@ function restoreRpxTextCssSelectors(css, restoreCandidates) {
1593
1748
  return restoredValues.has(normalizeCssEscapedRpxSelectorValue(value)) ? `text-\\[${value}\\]` : match;
1594
1749
  });
1595
1750
  }
1596
- function createStableJson$1(value) {
1751
+ //#endregion
1752
+ //#region src/tailwindcss/v4-engine/generator/scan-sources.ts
1753
+ const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
1754
+ "**/.git/**",
1755
+ "**/.hg/**",
1756
+ "**/.jj/**",
1757
+ "**/.next/**",
1758
+ "**/.parcel-cache/**",
1759
+ "**/.pnpm-store/**",
1760
+ "**/.svelte-kit/**",
1761
+ "**/.svn/**",
1762
+ "**/.turbo/**",
1763
+ "**/.venv/**",
1764
+ "**/.vercel/**",
1765
+ "**/.yarn/**",
1766
+ "**/__pycache__/**",
1767
+ "**/node_modules/**",
1768
+ "**/venv/**",
1769
+ "**/*.less",
1770
+ "**/*.lock",
1771
+ "**/*.sass",
1772
+ "**/*.scss",
1773
+ "**/*.styl",
1774
+ "**/*.log",
1775
+ "**/package-lock.json",
1776
+ "**/pnpm-lock.yaml",
1777
+ "**/bun.lockb",
1778
+ "**/.gitignore",
1779
+ "**/.env",
1780
+ "**/.env.*"
1781
+ ];
1782
+ function parseImportSourceParam$1(params) {
1783
+ const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
1784
+ if (!match) return;
1785
+ return {
1786
+ none: match[1] === "none",
1787
+ sourcePath: match[3]
1788
+ };
1789
+ }
1790
+ function parseCssImportSpecifier$2(params) {
1791
+ const value = params.trim();
1792
+ const quoted = /^(['"])(.*?)\1/.exec(value);
1793
+ if (quoted) return quoted[2];
1794
+ const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
1795
+ return url?.[2] ?? url?.[3];
1796
+ }
1797
+ function isTailwindCssImport$1(params) {
1798
+ const specifier = parseCssImportSpecifier$2(params);
1799
+ return specifier === "tailwindcss" || specifier?.startsWith("tailwindcss/") || specifier?.replaceAll("\\", "/").endsWith("/tailwindcss/index.css");
1800
+ }
1801
+ function resolveSourceBase$1(base, sourcePath) {
1802
+ return node_path.default.isAbsolute(sourcePath) ? sourcePath : node_path.default.resolve(base, sourcePath);
1803
+ }
1804
+ function createDefaultIgnoredScanSources(base) {
1805
+ return TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS.map((pattern) => ({
1806
+ base,
1807
+ pattern,
1808
+ negated: true
1809
+ }));
1810
+ }
1811
+ function normalizeCssDefinedScanSources(base, entries) {
1812
+ return entries.length > 0 && entries.every((entry) => entry.negated) ? [{
1813
+ base,
1814
+ pattern: "**/*",
1815
+ negated: false
1816
+ }, ...entries] : entries;
1817
+ }
1818
+ async function resolveCssDefinedScanSources(source) {
1819
+ let importSourceBase;
1820
+ let hasSourceNone = false;
1821
+ const from = source.dependencies[0];
1822
+ let root;
1823
+ try {
1824
+ root = postcss.default.parse(source.css, { from });
1825
+ } catch {
1826
+ return;
1827
+ }
1828
+ root.walkAtRules((rule) => {
1829
+ if (rule.name === "import") {
1830
+ if (!isTailwindCssImport$1(rule.params)) return;
1831
+ const sourceParam = parseImportSourceParam$1(rule.params);
1832
+ if (sourceParam?.none) hasSourceNone = true;
1833
+ if (sourceParam?.sourcePath) importSourceBase = resolveSourceBase$1(source.base, sourceParam.sourcePath);
1834
+ }
1835
+ });
1836
+ const sourcePatterns = await resolveCssSourceEntries(root, source.base, "**/*");
1837
+ if (!importSourceBase) {
1838
+ if (sourcePatterns.length > 0) return [...normalizeCssDefinedScanSources(source.base, sourcePatterns), ...createDefaultIgnoredScanSources(source.base)];
1839
+ if (hasSourceNone) return false;
1840
+ return;
1841
+ }
1842
+ return [
1843
+ await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"),
1844
+ ...sourcePatterns,
1845
+ ...createDefaultIgnoredScanSources(importSourceBase)
1846
+ ];
1847
+ }
1848
+ async function resolveScanSources(source, scanSources) {
1849
+ if (scanSources !== true) return scanSources;
1850
+ return await resolveCssDefinedScanSources(source) ?? false;
1851
+ }
1852
+ //#endregion
1853
+ //#region src/tailwindcss/v4-engine/miniprogram.ts
1854
+ const defaultStyleHandler$1 = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
1855
+ cssChildCombinatorReplaceValue: ["view", "text"],
1856
+ cssRemoveHoverPseudoClass: true,
1857
+ isMainChunk: true,
1858
+ majorVersion: 4
1859
+ });
1860
+ const CSS_DECLARATION_URL_RE = /(:\s*)url\(([^\n\r"';[\]{}]*[[\]{}][^\n\r;]*)\)(?=\s*;)/g;
1861
+ function normalizeTailwindV4GeneratedUrlValues(css) {
1862
+ return css.replace(CSS_DECLARATION_URL_RE, (match, prefix, urlValue) => {
1863
+ try {
1864
+ return `${prefix}url("${urlValue.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}")`;
1865
+ } catch {
1866
+ return match;
1867
+ }
1868
+ });
1869
+ }
1870
+ async function transformTailwindV4CssToWeapp(css, options) {
1871
+ const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(require_auto.hasCssMacroStyleOptions(options) ? await require_auto.transformCssMacroCss(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
1872
+ const result = await defaultStyleHandler$1(protectedCss.css, {
1873
+ cssChildCombinatorReplaceValue: ["view", "text"],
1874
+ cssRemoveHoverPseudoClass: true,
1875
+ isMainChunk: true,
1876
+ majorVersion: 4,
1877
+ ...options
1878
+ });
1879
+ const pruneOptions = { preserveConditionalComments: require_auto.hasCssMacroStyleOptions(options) };
1880
+ return (0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(protectedCss.restore(result.css), pruneOptions);
1881
+ }
1882
+ async function transformTailwindV4CssByTarget(css, target, options) {
1883
+ if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
1884
+ return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css, options) : css;
1885
+ }
1886
+ //#endregion
1887
+ //#region src/tailwindcss/v4-engine/generator.ts
1888
+ const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
1889
+ const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
1890
+ function collectCandidates(candidates) {
1891
+ return new Set(candidates ?? []);
1892
+ }
1893
+ function hasRemovedCandidates$1(previousCandidates, nextCandidates) {
1894
+ for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
1895
+ return false;
1896
+ }
1897
+ function createStableJson(value) {
1597
1898
  if (value === void 0) return "undefined";
1598
1899
  if (value === null || typeof value !== "object") return JSON.stringify(value);
1599
- if (Array.isArray(value)) return `[${value.map((item) => createStableJson$1(item)).join(",")}]`;
1900
+ if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
1600
1901
  return `{${Object.keys(value).sort().map((key) => {
1601
1902
  const record = value;
1602
- return `${JSON.stringify(key)}:${createStableJson$1(record[key])}`;
1903
+ return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
1603
1904
  }).join(",")}}`;
1604
1905
  }
1605
- function createDependencyFingerprint$1(files) {
1906
+ function createDependencyFingerprint(files) {
1606
1907
  return files.map((file) => {
1607
1908
  try {
1608
1909
  const stat = node_fs.default.statSync(file);
@@ -1612,16 +1913,16 @@ function createDependencyFingerprint$1(files) {
1612
1913
  }
1613
1914
  }).join("|");
1614
1915
  }
1615
- function createIncrementalGenerateCacheKey$1(source, target, styleOptions, tailwindcssV3Compatibility) {
1916
+ function createIncrementalGenerateCacheKey(source, target, styleOptions, tailwindcssV3Compatibility) {
1616
1917
  return [
1617
1918
  source.projectRoot,
1618
1919
  source.base,
1619
- createStableJson$1(source.baseFallbacks),
1920
+ createStableJson(source.baseFallbacks),
1620
1921
  source.css,
1621
- createDependencyFingerprint$1(source.dependencies),
1922
+ createDependencyFingerprint(source.dependencies),
1622
1923
  target,
1623
- createStableJson$1(styleOptions),
1624
- createStableJson$1(tailwindcssV3Compatibility)
1924
+ createStableJson(styleOptions),
1925
+ createStableJson(tailwindcssV3Compatibility)
1625
1926
  ].join("\0");
1626
1927
  }
1627
1928
  function createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources) {
@@ -1649,17 +1950,8 @@ function createIncrementalDesignSystemPromise(source, cacheKey) {
1649
1950
  });
1650
1951
  return promise;
1651
1952
  }
1652
- function createCompatibleSource(source, target, tailwindcssV3Compatibility) {
1653
- const shouldApplyTailwindV3Compatibility = tailwindcssV3Compatibility ?? target === "weapp";
1654
- const filteredSourceCss = target === "weapp" ? removeUnlayeredTailwindV4PreflightImports(source.css) : source.css;
1655
- const compatibleSourceCss = removeUnsupportedThemeVendorKeyframes(shouldApplyTailwindV3Compatibility ? applyTailwindV3CompatibilityCss(filteredSourceCss) : target === "weapp" ? applyMiniProgramTailwindV4DefaultColorCss(filteredSourceCss) : filteredSourceCss);
1656
- return compatibleSourceCss === source.css ? source : {
1657
- ...source,
1658
- css: compatibleSourceCss
1659
- };
1660
- }
1661
1953
  function resolveTargetCandidates(candidates, target) {
1662
- const collected = collectCandidates$1(candidates);
1954
+ const collected = collectCandidates(candidates);
1663
1955
  return target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(collected) : collected;
1664
1956
  }
1665
1957
  function collectSeenCandidates(generated, requestedCandidates) {
@@ -1691,7 +1983,7 @@ function mergeCustomPropertyValues(target, css) {
1691
1983
  for (const [prop, value] of collectCustomPropertyValues(css)) target.set(prop, value);
1692
1984
  }
1693
1985
  function seedIncrementalGenerateCache(options) {
1694
- const cacheKey = createIncrementalGenerateCacheKey$1(options.compatibleSource, options.target, options.styleOptions, options.tailwindcssV3Compatibility);
1986
+ const cacheKey = createIncrementalGenerateCacheKey(options.compatibleSource, options.target, options.styleOptions, options.tailwindcssV3Compatibility);
1695
1987
  const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
1696
1988
  mergeCustomPropertyValues(customPropertyValues, options.generated.css);
1697
1989
  incrementalGenerateCache$1.set(cacheKey, {
@@ -1707,136 +1999,14 @@ function seedIncrementalGenerateCache(options) {
1707
1999
  target: options.generated.target
1708
2000
  });
1709
2001
  }
1710
- function parseImportSourceParam$1(params) {
1711
- const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
1712
- if (!match) return;
1713
- return {
1714
- none: match[1] === "none",
1715
- sourcePath: match[3]
1716
- };
1717
- }
1718
- function isTailwindCssImport$1(params) {
1719
- const specifier = parseCssImportSpecifier$2(params);
1720
- return specifier === "tailwindcss" || specifier?.startsWith("tailwindcss/") || specifier?.replaceAll("\\", "/").endsWith("/tailwindcss/index.css");
1721
- }
1722
- function parseCssImportSpecifier$2(params) {
1723
- const value = params.trim();
1724
- const quoted = /^(['"])(.*?)\1/.exec(value);
1725
- if (quoted) return quoted[2];
1726
- const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
1727
- return url?.[2] ?? url?.[3];
1728
- }
1729
- function isTailwindCssPreflightImport(params) {
1730
- const specifier = parseCssImportSpecifier$2(params);
1731
- return specifier === "tailwindcss/preflight.css" || specifier === "tailwindcss/preflight";
1732
- }
1733
- function hasImportLayerOption(params) {
1734
- return /\blayer(?:\s*\(|\s*$)/.test(params);
1735
- }
1736
- function removeUnlayeredTailwindV4PreflightImports(css) {
1737
- if (!css.includes("preflight")) return css;
1738
- let root;
1739
- try {
1740
- root = postcss.default.parse(css);
1741
- } catch {
1742
- return css;
1743
- }
1744
- let changed = false;
1745
- root.walkAtRules("import", (rule) => {
1746
- if (isTailwindCssPreflightImport(rule.params) && !hasImportLayerOption(rule.params)) {
1747
- rule.remove();
1748
- changed = true;
1749
- }
1750
- });
1751
- return changed ? root.toString() : css;
1752
- }
1753
- function resolveSourceBase$1(base, sourcePath) {
1754
- return node_path.default.isAbsolute(sourcePath) ? sourcePath : node_path.default.resolve(base, sourcePath);
1755
- }
1756
- function createDefaultIgnoredScanSources(base) {
1757
- return TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS.map((pattern) => ({
1758
- base,
1759
- pattern,
1760
- negated: true
1761
- }));
1762
- }
1763
- function normalizeCssDefinedScanSources(base, entries) {
1764
- return entries.length > 0 && entries.every((entry) => entry.negated) ? [{
1765
- base,
1766
- pattern: "**/*",
1767
- negated: false
1768
- }, ...entries] : entries;
1769
- }
1770
- async function resolveCssDefinedScanSources(source) {
1771
- let importSourceBase;
1772
- let hasSourceNone = false;
1773
- const from = source.dependencies[0];
1774
- let root;
1775
- try {
1776
- root = postcss.default.parse(source.css, { from });
1777
- } catch {
1778
- return;
1779
- }
1780
- root.walkAtRules((rule) => {
1781
- if (rule.name === "import") {
1782
- if (!isTailwindCssImport$1(rule.params)) return;
1783
- const sourceParam = parseImportSourceParam$1(rule.params);
1784
- if (sourceParam?.none) hasSourceNone = true;
1785
- if (sourceParam?.sourcePath) importSourceBase = resolveSourceBase$1(source.base, sourceParam.sourcePath);
1786
- }
1787
- });
1788
- const sourcePatterns = await resolveCssSourceEntries(root, source.base, "**/*");
1789
- if (!importSourceBase) {
1790
- if (sourcePatterns.length > 0) return [...normalizeCssDefinedScanSources(source.base, sourcePatterns), ...createDefaultIgnoredScanSources(source.base)];
1791
- if (hasSourceNone) return false;
1792
- return;
1793
- }
1794
- return [
1795
- await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"),
1796
- ...sourcePatterns,
1797
- ...createDefaultIgnoredScanSources(importSourceBase)
1798
- ];
1799
- }
1800
- async function resolveScanSources(source, scanSources) {
1801
- if (scanSources !== true) return scanSources;
1802
- return await resolveCssDefinedScanSources(source) ?? false;
1803
- }
1804
- function hasThemeParent(rule) {
1805
- let parent = rule.parent;
1806
- while (parent) {
1807
- if (parent.type === "atrule" && parent.name === "theme") return true;
1808
- parent = parent.parent;
1809
- }
1810
- return false;
1811
- }
1812
- function isVendorPrefixedKeyframes(rule) {
1813
- return rule.name.startsWith("-") && rule.name.endsWith("keyframes");
1814
- }
1815
- function removeUnsupportedThemeVendorKeyframes(css) {
1816
- if (!css.includes("@theme") || !css.includes("@-")) return css;
1817
- let root;
1818
- try {
1819
- root = postcss.default.parse(css);
1820
- } catch {
1821
- return css;
1822
- }
1823
- let changed = false;
1824
- root.walkAtRules((rule) => {
1825
- if (isVendorPrefixedKeyframes(rule) && hasThemeParent(rule)) {
1826
- rule.remove();
1827
- changed = true;
1828
- }
1829
- });
1830
- return changed ? root.toString() : css;
1831
- }
1832
2002
  function createTailwindV4Engine(source) {
1833
2003
  async function generateOnce(generateSource, options = {}) {
1834
2004
  const { scanSources = true, styleOptions, tailwindcssV3Compatibility, target = "weapp", ...patchOptions } = options;
1835
2005
  const resolvedStyleOptions = resolveStyleOptions$1(generateSource, styleOptions);
1836
2006
  const engine = (0, tailwindcss_patch.createTailwindV4Engine)(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
1837
2007
  const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
1838
- const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, tailwindcss_patch.extractRawCandidates)(resolvedScanSources, { bareArbitraryValues: patchOptions.bareArbitraryValues })) : void 0;
1839
- const normalizedCandidates = normalizeRpxTextCandidates(resolveTargetCandidates(new Set([...collectCandidates$1(patchOptions.candidates), ...filesystemCandidates ?? []]), target));
2008
+ const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, tailwindcss_patch.extractRawCandidates)(resolvedScanSources, { ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues } })) : void 0;
2009
+ const normalizedCandidates = normalizeRpxTextCandidates(resolveTargetCandidates(new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target));
1840
2010
  const result = await engine.generate(omitUndefined({
1841
2011
  scanSources: false,
1842
2012
  ...patchOptions,
@@ -1859,7 +2029,7 @@ function createTailwindV4Engine(source) {
1859
2029
  const requestedCandidates = resolveTargetCandidates(options.candidates, target);
1860
2030
  const styleOptions = resolveStyleOptions$1(source, options.styleOptions);
1861
2031
  if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(source, options);
1862
- const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target, styleOptions, options.tailwindcssV3Compatibility);
2032
+ const cacheKey = createIncrementalGenerateCacheKey(compatibleSource, target, styleOptions, options.tailwindcssV3Compatibility);
1863
2033
  if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1864
2034
  const generated = await generateOnce(source, options);
1865
2035
  seedIncrementalGenerateCache({
@@ -2048,109 +2218,48 @@ function hasTailwindGeneratedCssMarkers(rawSource) {
2048
2218
  return TAILWIND_GENERATED_CSS_MARKER_RE.test(rawSource) || GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource);
2049
2219
  }
2050
2220
  //#endregion
2051
- //#region src/bundlers/shared/generator-css/directives.ts
2052
- const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
2053
- "config",
2054
- "custom-variant",
2055
- "layer",
2056
- "plugin",
2057
- "reference",
2058
- "source",
2059
- "tailwind",
2060
- "theme",
2061
- "utility",
2062
- "variant"
2063
- ]);
2064
- const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
2065
- "config",
2066
- "custom-variant",
2067
- "plugin",
2068
- "source",
2069
- "tailwind",
2070
- "theme",
2071
- "utility",
2072
- "variant"
2073
- ]);
2074
- const TAILWIND_ROOT_DIRECTIVE_RE = /@(?:import\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|(?:use|forward)\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|tailwind|config|custom-variant|plugin|source|theme|utility|variant)\b/;
2221
+ //#region src/bundlers/shared/generator-css/directives/fallback.ts
2075
2222
  const TAILWIND_EXTRACTABLE_DIRECTIVE_RE = /^\s*@(?:import|use|forward|tailwind|config|source|reference|plugin)\b[\s\S]*?(?:;|$)/;
2076
2223
  const TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE = /^\s*@layer\s[^;{]+;\s*$/;
2077
- const TAILWIND_EXTRACTABLE_BLOCK_START_RE = /^\s*@(?:layer|theme|utility|variant|custom-variant)\b[\s\S]*\{/;
2078
- const TAILWIND_V3_SUBPATH_IMPORT_LAYERS = new Map([
2079
- ["tailwindcss/base", "base"],
2080
- ["tailwindcss/components", "components"],
2081
- ["tailwindcss/utilities", "utilities"]
2082
- ]);
2083
- function parseImportRequest(params) {
2224
+ const TAILWIND_EXTRACTABLE_BLOCK_START_RE = /^\s*@(?:layer|theme|utility|variant|custom-variant|plugin)\b[\s\S]*\{/;
2225
+ function parseImportRequest$1(params) {
2084
2226
  return /^(?:url\(\s*)?(["']?)([^"')\s]+)\1\s*\)?/.exec(params.trim())?.[2];
2085
2227
  }
2086
- function hasLocalCssImport(rawSource) {
2087
- let found = false;
2088
- try {
2089
- postcss.default.parse(rawSource).walkAtRules("import", (rule) => {
2090
- const request = parseImportRequest(rule.params);
2091
- if (request?.startsWith(".") === true || request?.startsWith("/") === true) {
2092
- found = true;
2093
- return false;
2094
- }
2095
- });
2096
- } catch {}
2097
- return found;
2098
- }
2099
- function parseConfigRequest(params) {
2228
+ function parseConfigRequest$1(params) {
2100
2229
  return /^(["'])(.+)\1\s*;?$/.exec(params.trim())?.[2];
2101
2230
  }
2102
- function isPackageJsonImportRequest(request) {
2231
+ function isPackageJsonImportRequest$1(request) {
2103
2232
  return typeof request === "string" && request.startsWith("#");
2104
2233
  }
2105
- function isWeappTailwindcssImportRequest(request) {
2234
+ function isWeappTailwindcssImportRequest$1(request) {
2106
2235
  return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
2107
2236
  }
2108
- function normalizeTailwindImportRequest(request, options = {}) {
2109
- if (options.importFallback && isWeappTailwindcssImportRequest(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
2237
+ function isTailwindImportRequest$1(request) {
2238
+ return request === "tailwindcss" || request === "tailwindcss4" || request?.startsWith("tailwindcss/") || request?.startsWith("tailwindcss4/");
2239
+ }
2240
+ function normalizeTailwindImportRequest$1(request, options = {}) {
2241
+ if (options.importFallback && isWeappTailwindcssImportRequest$1(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
2110
2242
  return request;
2111
2243
  }
2112
- function replaceImportRequest(params, request, replacement) {
2244
+ function replaceImportRequest$1(params, request, replacement) {
2113
2245
  const index = params.indexOf(request);
2114
2246
  if (index === -1) return params;
2115
2247
  return `${params.slice(0, index)}${replacement}${params.slice(index + request.length)}`;
2116
2248
  }
2117
- function normalizeTailwindImportAtRules(root, options = {}) {
2118
- if (!options.importFallback) return false;
2119
- let changed = false;
2120
- const seenCanonicalImports = /* @__PURE__ */ new Set();
2121
- root.walkAtRules("import", (node) => {
2122
- const request = parseImportRequest(node.params);
2123
- const normalizedRequest = normalizeTailwindImportRequest(request, options);
2124
- if (!normalizedRequest || !isTailwindImportRequest(normalizedRequest)) return;
2125
- const normalizedParams = request && normalizedRequest !== request ? replaceImportRequest(node.params, request, normalizedRequest) : node.params;
2126
- const normalizedKey = normalizedParams.trim();
2127
- if (seenCanonicalImports.has(normalizedKey)) {
2128
- node.remove();
2129
- changed = true;
2130
- return;
2131
- }
2132
- seenCanonicalImports.add(normalizedKey);
2133
- if (normalizedParams !== node.params) {
2134
- node.params = normalizedParams;
2135
- changed = true;
2136
- }
2137
- });
2138
- return changed;
2139
- }
2140
2249
  function normalizeTailwindDirectiveLine(line, options = {}) {
2141
2250
  const trimmed = line.trimStart();
2142
2251
  if (/^@(?:use|forward)\b/.test(trimmed)) {
2143
- const request = parseImportRequest(trimmed.replace(/^@(?:use|forward)\b/, ""));
2144
- if (isTailwindImportRequest(request) || options.importFallback && isWeappTailwindcssImportRequest(request)) {
2145
- const normalizedRequest = normalizeTailwindImportRequest(request, options);
2146
- return replaceImportRequest(line.replace(/^(\s*)@(?:use|forward)\b/, "$1@import"), request, normalizedRequest);
2252
+ const request = parseImportRequest$1(trimmed.replace(/^@(?:use|forward)\b/, ""));
2253
+ if (isTailwindImportRequest$1(request) || options.importFallback && isWeappTailwindcssImportRequest$1(request)) {
2254
+ const normalizedRequest = normalizeTailwindImportRequest$1(request, options);
2255
+ return replaceImportRequest$1(line.replace(/^(\s*)@(?:use|forward)\b/, "$1@import"), request, normalizedRequest);
2147
2256
  }
2148
2257
  return line;
2149
2258
  }
2150
2259
  if (!options.importFallback || !trimmed.startsWith("@import")) return line;
2151
- const request = parseImportRequest(trimmed.replace(/^@import\b/, ""));
2152
- if (!request || !isWeappTailwindcssImportRequest(request)) return line;
2153
- return replaceImportRequest(line, request, request.replace(/^weapp-tailwindcss/, "tailwindcss"));
2260
+ const request = parseImportRequest$1(trimmed.replace(/^@import\b/, ""));
2261
+ if (!request || !isWeappTailwindcssImportRequest$1(request)) return line;
2262
+ return replaceImportRequest$1(line, request, request.replace(/^weapp-tailwindcss/, "tailwindcss"));
2154
2263
  }
2155
2264
  function extractTailwindDirectiveLines(rawSource, options = {}) {
2156
2265
  const directives = [];
@@ -2160,13 +2269,14 @@ function extractTailwindDirectiveLines(rawSource, options = {}) {
2160
2269
  if (!trimmed || trimmed.startsWith("//")) continue;
2161
2270
  const directive = TAILWIND_EXTRACTABLE_DIRECTIVE_RE.exec(line)?.[0] ?? TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE.exec(line)?.[0];
2162
2271
  if (!directive) continue;
2272
+ if (TAILWIND_EXTRACTABLE_BLOCK_START_RE.test(directive)) continue;
2163
2273
  const normalized = normalizeTailwindDirectiveLine(directive.trimEnd(), options);
2164
2274
  const normalizedTrimmed = normalized.trim();
2165
2275
  if (options.removeConfig && normalizedTrimmed.startsWith("@config")) continue;
2166
- const request = /^@(?:import|use|forward)\b/.test(normalizedTrimmed) ? parseImportRequest(normalizedTrimmed.replace(/^@(?:import|use|forward)\b/, "")) : void 0;
2167
- if (request && !isTailwindImportRequest(request) && !isPackageJsonImportRequest(request)) continue;
2276
+ const request = /^@(?:import|use|forward)\b/.test(normalizedTrimmed) ? parseImportRequest$1(normalizedTrimmed.replace(/^@(?:import|use|forward)\b/, "")) : void 0;
2277
+ if (request && !isTailwindImportRequest$1(request) && !isPackageJsonImportRequest$1(request)) continue;
2168
2278
  if (/^@(?:import|use|forward)\b/.test(normalizedTrimmed) && !request) continue;
2169
- if (request && isTailwindImportRequest(request)) {
2279
+ if (request && isTailwindImportRequest$1(request)) {
2170
2280
  const key = normalizedTrimmed;
2171
2281
  if (seenImports.has(key)) continue;
2172
2282
  seenImports.add(key);
@@ -2262,10 +2372,97 @@ function extractTailwindSourceForPostcssFallback(rawSource, options = {}) {
2262
2372
  function extractConfigRequestFromSource(rawSource) {
2263
2373
  for (const line of rawSource.split(/\r?\n/)) {
2264
2374
  const match = /^\s*@config\b([\s\S]*?)(?:;|$)/.exec(line);
2265
- const request = match ? parseConfigRequest(match[1] ?? "") : void 0;
2375
+ const request = match ? parseConfigRequest$1(match[1] ?? "") : void 0;
2266
2376
  if (request) return request;
2267
2377
  }
2268
2378
  }
2379
+ //#endregion
2380
+ //#region src/bundlers/shared/generator-css/directives.ts
2381
+ const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
2382
+ "config",
2383
+ "custom-variant",
2384
+ "layer",
2385
+ "plugin",
2386
+ "reference",
2387
+ "source",
2388
+ "tailwind",
2389
+ "theme",
2390
+ "utility",
2391
+ "variant"
2392
+ ]);
2393
+ const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
2394
+ "config",
2395
+ "custom-variant",
2396
+ "plugin",
2397
+ "source",
2398
+ "tailwind",
2399
+ "theme",
2400
+ "utility",
2401
+ "variant"
2402
+ ]);
2403
+ const TAILWIND_ROOT_DIRECTIVE_RE = /@(?:import\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|(?:use|forward)\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|tailwind|config|custom-variant|plugin|source|theme|utility|variant)\b/;
2404
+ const TAILWIND_V3_SUBPATH_IMPORT_LAYERS = new Map([
2405
+ ["tailwindcss/base", "base"],
2406
+ ["tailwindcss/components", "components"],
2407
+ ["tailwindcss/utilities", "utilities"]
2408
+ ]);
2409
+ function parseImportRequest(params) {
2410
+ return /^(?:url\(\s*)?(["']?)([^"')\s]+)\1\s*\)?/.exec(params.trim())?.[2];
2411
+ }
2412
+ function hasLocalCssImport(rawSource) {
2413
+ let found = false;
2414
+ try {
2415
+ postcss.default.parse(rawSource).walkAtRules("import", (rule) => {
2416
+ const request = parseImportRequest(rule.params);
2417
+ if (request?.startsWith(".") === true || request?.startsWith("/") === true) {
2418
+ found = true;
2419
+ return false;
2420
+ }
2421
+ });
2422
+ } catch {}
2423
+ return found;
2424
+ }
2425
+ function parseConfigRequest(params) {
2426
+ return /^(["'])(.+)\1\s*;?$/.exec(params.trim())?.[2];
2427
+ }
2428
+ function isPackageJsonImportRequest(request) {
2429
+ return typeof request === "string" && request.startsWith("#");
2430
+ }
2431
+ function isWeappTailwindcssImportRequest(request) {
2432
+ return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
2433
+ }
2434
+ function normalizeTailwindImportRequest(request, options = {}) {
2435
+ if (options.importFallback && isWeappTailwindcssImportRequest(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
2436
+ return request;
2437
+ }
2438
+ function replaceImportRequest(params, request, replacement) {
2439
+ const index = params.indexOf(request);
2440
+ if (index === -1) return params;
2441
+ return `${params.slice(0, index)}${replacement}${params.slice(index + request.length)}`;
2442
+ }
2443
+ function normalizeTailwindImportAtRules(root, options = {}) {
2444
+ if (!options.importFallback) return false;
2445
+ let changed = false;
2446
+ const seenCanonicalImports = /* @__PURE__ */ new Set();
2447
+ root.walkAtRules("import", (node) => {
2448
+ const request = parseImportRequest(node.params);
2449
+ const normalizedRequest = normalizeTailwindImportRequest(request, options);
2450
+ if (!normalizedRequest || !isTailwindImportRequest(normalizedRequest)) return;
2451
+ const normalizedParams = request && normalizedRequest !== request ? replaceImportRequest(node.params, request, normalizedRequest) : node.params;
2452
+ const normalizedKey = normalizedParams.trim();
2453
+ if (seenCanonicalImports.has(normalizedKey)) {
2454
+ node.remove();
2455
+ changed = true;
2456
+ return;
2457
+ }
2458
+ seenCanonicalImports.add(normalizedKey);
2459
+ if (normalizedParams !== node.params) {
2460
+ node.params = normalizedParams;
2461
+ changed = true;
2462
+ }
2463
+ });
2464
+ return changed;
2465
+ }
2269
2466
  function resolveConfigPath$1(base, configPath) {
2270
2467
  if (node_path.default.isAbsolute(configPath) || isPackageJsonImportRequest(configPath)) return node_path.default.isAbsolute(configPath) ? configPath : void 0;
2271
2468
  return node_path.default.resolve(base, configPath);
@@ -2845,7 +3042,15 @@ function readStaticConfigContent(configPath) {
2845
3042
  return parseStaticContentValue(source, contentProperty.start)?.value;
2846
3043
  }
2847
3044
  //#endregion
2848
- //#region src/bundlers/vite/source-scan.ts
3045
+ //#region src/bundlers/vite/source-scan/dependencies.ts
3046
+ function addSourceScanDependency(dependencies, file) {
3047
+ if (typeof file === "string" && file.length > 0) dependencies.add(node_path.default.resolve(file));
3048
+ }
3049
+ function addSourceScanDependencies(dependencies, files) {
3050
+ for (const file of files ?? []) addSourceScanDependency(dependencies, file);
3051
+ }
3052
+ //#endregion
3053
+ //#region src/bundlers/vite/source-scan/css-entries.ts
2849
3054
  const VITE_SOURCE_CANDIDATE_PATTERN = FULL_SOURCE_SCAN_PATTERN;
2850
3055
  const VITE_TAILWIND_CSS_ENTRY_PATTERN = "**/*.{css,less,sass,scss,styl,stylus,pcss,postcss}";
2851
3056
  const tailwindV4CssEntriesCache = /* @__PURE__ */ new Map();
@@ -2882,23 +3087,6 @@ function createCssEntriesCacheKey(css, base, dependencies) {
2882
3087
  dependencies
2883
3088
  });
2884
3089
  }
2885
- function addSourceScanDependency(dependencies, file) {
2886
- if (typeof file === "string" && file.length > 0) dependencies.add(node_path.default.resolve(file));
2887
- }
2888
- function addSourceScanDependencies(dependencies, files) {
2889
- for (const file of files ?? []) addSourceScanDependency(dependencies, file);
2890
- }
2891
- function createResolvedViteSourceScan(input, dependencies) {
2892
- return {
2893
- ...input,
2894
- ...dependencies.size > 0 ? { dependencies: [...dependencies].sort() } : {}
2895
- };
2896
- }
2897
- function createMergedCssEntrySourceScanEntries(entries, options) {
2898
- if (options.sourceCount <= 1) return entries;
2899
- const positiveEntries = entries.filter((entry) => !entry.negated);
2900
- return positiveEntries.length > 0 ? positiveEntries : entries;
2901
- }
2902
3090
  async function statConfigDependency(file) {
2903
3091
  try {
2904
3092
  const stats = await (0, node_fs_promises.stat)(file);
@@ -3112,6 +3300,26 @@ async function discoverTailwindV4CssEntries(root, outDir) {
3112
3300
  function collectConfiguredCssSources(options) {
3113
3301
  return [...options.tailwindcss?.v4?.cssSources ?? [], ...options.tailwindcssPatcherOptions?.tailwindcss?.v4?.cssSources ?? []];
3114
3302
  }
3303
+ //#endregion
3304
+ //#region src/bundlers/vite/source-scan.ts
3305
+ function createResolvedViteSourceScan(input, dependencies) {
3306
+ return {
3307
+ ...input,
3308
+ ...dependencies.size > 0 ? { dependencies: [...dependencies].sort() } : {}
3309
+ };
3310
+ }
3311
+ function createMergedCssEntrySourceScanEntries(entries, options) {
3312
+ if (options.sourceCount <= 1) return entries;
3313
+ const positiveEntries = entries.filter((entry) => !entry.negated);
3314
+ return positiveEntries.length > 0 ? positiveEntries : entries;
3315
+ }
3316
+ function createResolvedV4CssScanInput(entries, inlineCandidates, explicit) {
3317
+ return {
3318
+ entries: explicit ? entries : entries.length > 0 ? entries : void 0,
3319
+ explicit,
3320
+ inlineCandidates
3321
+ };
3322
+ }
3115
3323
  async function resolveViteSourceScanEntries(options, patcher, scanOptions = {}) {
3116
3324
  if (patcher.majorVersion === 3) {
3117
3325
  const [source, cssEntryScan] = await Promise.all([resolveTailwindV3SourceFromPatcher(patcher), resolveTailwindV3CssEntryScan(options, patcher)]);
@@ -3163,11 +3371,7 @@ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {})
3163
3371
  }, dependencies);
3164
3372
  if (typeof sourceOptions.css === "string" && sourceOptions.css.length > 0) {
3165
3373
  const resolved = await resolveTailwindV4EntriesFromCssCached(sourceOptions.css, sourceOptions.base ?? sourceOptions.projectRoot ?? node_process.default.cwd());
3166
- return resolved ? createResolvedViteSourceScan({
3167
- entries: resolved.explicit ? resolved.entries : resolved.entries.length > 0 ? resolved.entries : void 0,
3168
- explicit: resolved.explicit,
3169
- inlineCandidates: resolved.inlineCandidates
3170
- }, new Set(resolved.dependencies)) : void 0;
3374
+ return resolved ? createResolvedViteSourceScan(createResolvedV4CssScanInput(resolved.entries, resolved.inlineCandidates, resolved.explicit), new Set(resolved.dependencies)) : void 0;
3171
3375
  }
3172
3376
  const sourceOptionBase = sourceOptions.base ?? sourceOptions.projectRoot ?? node_process.default.cwd();
3173
3377
  const configuredCssSources = collectConfiguredCssSources(options);
@@ -3194,11 +3398,7 @@ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {})
3194
3398
  addSourceScanDependency(dependencies, source.file);
3195
3399
  addSourceScanDependencies(dependencies, source.dependencies);
3196
3400
  const resolved = await resolveTailwindV4EntriesFromCssCached(source.css, source.base);
3197
- return resolved ? createResolvedViteSourceScan({
3198
- entries: resolved.explicit ? resolved.entries : resolved.entries.length > 0 ? resolved.entries : void 0,
3199
- explicit: resolved.explicit,
3200
- inlineCandidates: resolved.inlineCandidates
3201
- }, new Set([...dependencies, ...resolved.dependencies])) : void 0;
3401
+ return resolved ? createResolvedViteSourceScan(createResolvedV4CssScanInput(resolved.entries, resolved.inlineCandidates, resolved.explicit), new Set([...dependencies, ...resolved.dependencies])) : void 0;
3202
3402
  }
3203
3403
  }
3204
3404
  function createViteSourceScanMatcher(entries) {
@@ -3412,6 +3612,40 @@ async function ensureTailwindcssRuntimePatch(twPatcher, options = {}) {
3412
3612
  return task;
3413
3613
  }
3414
3614
  //#endregion
3615
+ //#region src/tailwindcss/v3-engine/generator/runtime-ready.ts
3616
+ const runtimeReadyPromiseCache = /* @__PURE__ */ new Map();
3617
+ function createRuntimeReadyCacheKey(source, rootPath) {
3618
+ return [
3619
+ source.packageName,
3620
+ source.postcssPlugin,
3621
+ rootPath ?? "missing",
3622
+ source.config ?? "config:missing",
3623
+ source.cwd
3624
+ ].join("\0");
3625
+ }
3626
+ function createRuntimeReadyPromise(source) {
3627
+ const patcher = createTailwindcssPatcher({
3628
+ basedir: source.cwd,
3629
+ supportCustomLengthUnitsPatch: true,
3630
+ tailwindcss: {
3631
+ ...source.config === void 0 ? {} : { config: source.config },
3632
+ cwd: source.cwd,
3633
+ packageName: source.packageName,
3634
+ postcssPlugin: source.postcssPlugin,
3635
+ version: 3
3636
+ }
3637
+ });
3638
+ const cacheKey = createRuntimeReadyCacheKey(source, patcher.packageInfo?.rootPath);
3639
+ const cached = runtimeReadyPromiseCache.get(cacheKey);
3640
+ if (cached) return cached;
3641
+ const task = ensureTailwindcssRuntimePatch(patcher, { clearRequireCache: true }).catch((error) => {
3642
+ runtimeReadyPromiseCache.delete(cacheKey);
3643
+ throw error;
3644
+ });
3645
+ runtimeReadyPromiseCache.set(cacheKey, task);
3646
+ return task;
3647
+ }
3648
+ //#endregion
3415
3649
  //#region src/tailwindcss/v3-engine/miniprogram.ts
3416
3650
  const defaultStyleHandler = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
3417
3651
  cssChildCombinatorReplaceValue: ["view", "text"],
@@ -3493,33 +3727,7 @@ async function transformTailwindV3CssByTarget(css, target, options) {
3493
3727
  }
3494
3728
  //#endregion
3495
3729
  //#region src/tailwindcss/v3-engine/generator.ts
3496
- const runtimeReadyPromiseCache = /* @__PURE__ */ new Map();
3497
3730
  const incrementalGenerateCache = /* @__PURE__ */ new Map();
3498
- function isLegacyContentObject(value) {
3499
- return typeof value === "object" && value !== null && "files" in value;
3500
- }
3501
- function createRawContentEntries(candidates, sources) {
3502
- const entries = [];
3503
- const candidateContent = [...candidates].join(" ");
3504
- if (candidateContent.length > 0) entries.push({
3505
- raw: candidateContent,
3506
- extension: "html"
3507
- });
3508
- for (const source of sources) entries.push({
3509
- raw: source.content,
3510
- extension: source.extension ?? "html"
3511
- });
3512
- return entries;
3513
- }
3514
- function createChangedContentEntries(candidates, sources) {
3515
- return createRawContentEntries(candidates, sources).map((entry) => ({
3516
- content: entry.raw,
3517
- extension: entry.extension
3518
- }));
3519
- }
3520
- function collectCandidates(candidates) {
3521
- return new Set(candidates ?? []);
3522
- }
3523
3731
  function normalizeBareArbitraryValueCandidate(candidate, bareArbitraryValues) {
3524
3732
  return (0, tailwindcss_patch.resolveBareArbitraryValueCandidate)(candidate, bareArbitraryValues)?.canonicalCandidate ?? candidate;
3525
3733
  }
@@ -3539,7 +3747,7 @@ function normalizeBareArbitraryValueCandidates(candidates, bareArbitraryValues)
3539
3747
  async function collectSourceBareArbitraryValueCandidates(sources, bareArbitraryValues) {
3540
3748
  if (!(0, tailwindcss_patch.isBareArbitraryValuesEnabled)(bareArbitraryValues)) return [];
3541
3749
  const candidates = /* @__PURE__ */ new Set();
3542
- for (const source of sources ?? []) for (const candidate of await (0, tailwindcss_patch.extractSourceCandidates)(source.content, source.extension ?? "html", { bareArbitraryValues })) if ((0, tailwindcss_patch.resolveBareArbitraryValueCandidate)(candidate, bareArbitraryValues)) candidates.add(candidate);
3750
+ for (const source of sources ?? []) for (const candidate of await (0, tailwindcss_patch.extractSourceCandidates)(source.content, source.extension ?? "html", omitUndefined({ bareArbitraryValues }))) if ((0, tailwindcss_patch.resolveBareArbitraryValueCandidate)(candidate, bareArbitraryValues)) candidates.add(candidate);
3543
3751
  return [...candidates];
3544
3752
  }
3545
3753
  function escapeCssClassSelector(className) {
@@ -3575,99 +3783,6 @@ function hasRemovedCandidates(previousCandidates, nextCandidates) {
3575
3783
  for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
3576
3784
  return false;
3577
3785
  }
3578
- function collectApplyCandidatesFromCss(css) {
3579
- if (!css.includes("@apply")) return [];
3580
- const candidates = /* @__PURE__ */ new Set();
3581
- try {
3582
- postcss.default.parse(css).walkAtRules("apply", (rule) => {
3583
- for (const candidate of rule.params.split(/\s+/)) {
3584
- const normalized = candidate.replace(/!important$/, "").trim();
3585
- if (normalized) candidates.add(normalized);
3586
- }
3587
- });
3588
- } catch {}
3589
- return [...candidates];
3590
- }
3591
- function isTailwindCandidateLayer(params) {
3592
- return params.split(/[,\s]+/).some((layer) => layer === "components" || layer === "utilities");
3593
- }
3594
- function extractClassCandidatesFromSelector(selector, candidates) {
3595
- for (let index = 0; index < selector.length; index++) {
3596
- if (selector[index] !== ".") continue;
3597
- let candidate = "";
3598
- let escaped = false;
3599
- for (let tokenIndex = index + 1; tokenIndex < selector.length; tokenIndex++) {
3600
- const char = selector[tokenIndex];
3601
- if (escaped) {
3602
- candidate += char;
3603
- escaped = false;
3604
- continue;
3605
- }
3606
- if (char === "\\") {
3607
- escaped = true;
3608
- continue;
3609
- }
3610
- if (char && /[\w-]/.test(char)) {
3611
- candidate += char;
3612
- continue;
3613
- }
3614
- break;
3615
- }
3616
- if (candidate) candidates.add(candidate);
3617
- }
3618
- }
3619
- function collectLayerCandidatesFromCss(css) {
3620
- if (!css.includes("@layer")) return [];
3621
- const candidates = /* @__PURE__ */ new Set();
3622
- try {
3623
- postcss.default.parse(css).walkAtRules("layer", (layer) => {
3624
- if (!isTailwindCandidateLayer(layer.params)) return;
3625
- layer.walkRules((rule) => {
3626
- extractClassCandidatesFromSelector(rule.selector, candidates);
3627
- });
3628
- });
3629
- } catch {}
3630
- return [...candidates];
3631
- }
3632
- function mergeGenerateCandidates(source, options) {
3633
- return collectCandidates([
3634
- ...collectLayerCandidatesFromCss(source.css),
3635
- ...collectApplyCandidatesFromCss(source.css),
3636
- ...collectCandidates(options.candidates)
3637
- ]);
3638
- }
3639
- function mergeContent(content, rawEntries) {
3640
- if (isLegacyContentObject(content)) return {
3641
- ...content,
3642
- relative: content.relative ?? true,
3643
- files: [...[].concat(content.files ?? []), ...rawEntries]
3644
- };
3645
- return {
3646
- relative: true,
3647
- files: [...[].concat(content ?? []), ...rawEntries]
3648
- };
3649
- }
3650
- function normalizeConfigObject(config) {
3651
- if (!config || typeof config !== "object") return config;
3652
- const maybeDefault = config.default;
3653
- if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
3654
- return config;
3655
- }
3656
- function hasExplicitContentInput(options) {
3657
- return options.candidates !== void 0 || options.sources !== void 0;
3658
- }
3659
- function createExplicitContentConfig(rawEntries) {
3660
- return {
3661
- relative: true,
3662
- files: rawEntries
3663
- };
3664
- }
3665
- function createTailwindConfig(source, options) {
3666
- const config = { ...normalizeConfigObject(source.configObject) ?? {} };
3667
- const rawEntries = createRawContentEntries(mergeGenerateCandidates(source, options), options.sources ?? []);
3668
- config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
3669
- return config;
3670
- }
3671
3786
  function shouldAutoEnableCssMacro(source) {
3672
3787
  return require_auto.hasCssMacroTailwindPlugin(normalizeConfigObject(source.configObject)?.plugins);
3673
3788
  }
@@ -3707,48 +3822,6 @@ function loadTailwindV3Internals(source) {
3707
3822
  validateConfig: validateConfigModule["validateConfig"]
3708
3823
  };
3709
3824
  }
3710
- function createStableJson(value) {
3711
- if (value === void 0) return "undefined";
3712
- if (value === null || typeof value !== "object") return JSON.stringify(value);
3713
- if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
3714
- return `{${Object.keys(value).sort().map((key) => {
3715
- const record = value;
3716
- return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
3717
- }).join(",")}}`;
3718
- }
3719
- function createDependencyFingerprint(files) {
3720
- return files.map((file) => {
3721
- try {
3722
- const stat = node_fs.default.statSync(file);
3723
- return `${file}:${stat.size}:${stat.mtimeMs}`;
3724
- } catch {
3725
- return `${file}:missing`;
3726
- }
3727
- }).join("|");
3728
- }
3729
- function createIncrementalGenerateCacheKey(source, target, styleOptions, bareArbitraryValues) {
3730
- return [
3731
- source.packageName,
3732
- source.postcssPlugin,
3733
- source.cwd,
3734
- source.config ?? "config:missing",
3735
- createDependencyFingerprint(source.dependencies),
3736
- source.css,
3737
- createStableJson(normalizeConfigObject(source.configObject)?.content),
3738
- target,
3739
- createStableJson(styleOptions),
3740
- createStableJson(bareArbitraryValues)
3741
- ].join("\0");
3742
- }
3743
- function createRuntimeReadyCacheKey(source, rootPath) {
3744
- return [
3745
- source.packageName,
3746
- source.postcssPlugin,
3747
- rootPath ?? "missing",
3748
- source.config ?? "config:missing",
3749
- source.cwd
3750
- ].join("\0");
3751
- }
3752
3825
  function isDirectUtilitiesOnlyCss(css) {
3753
3826
  return css.replace(/\s+/g, "") === "@tailwindutilities;";
3754
3827
  }
@@ -3781,28 +3854,6 @@ function appendUtilityRules(root, context, rules) {
3781
3854
  function appendDirectUtilityRules(root, context) {
3782
3855
  appendUtilityRules(root, context, [...context.ruleCache]);
3783
3856
  }
3784
- function createRuntimeReadyPromise(source) {
3785
- const patcher = createTailwindcssPatcher({
3786
- basedir: source.cwd,
3787
- supportCustomLengthUnitsPatch: true,
3788
- tailwindcss: {
3789
- ...source.config === void 0 ? {} : { config: source.config },
3790
- cwd: source.cwd,
3791
- packageName: source.packageName,
3792
- postcssPlugin: source.postcssPlugin,
3793
- version: 3
3794
- }
3795
- });
3796
- const cacheKey = createRuntimeReadyCacheKey(source, patcher.packageInfo?.rootPath);
3797
- const cached = runtimeReadyPromiseCache.get(cacheKey);
3798
- if (cached) return cached;
3799
- const task = ensureTailwindcssRuntimePatch(patcher, { clearRequireCache: true }).catch((error) => {
3800
- runtimeReadyPromiseCache.delete(cacheKey);
3801
- throw error;
3802
- });
3803
- runtimeReadyPromiseCache.set(cacheKey, task);
3804
- return task;
3805
- }
3806
3857
  function createTailwindV3Engine(source) {
3807
3858
  const runtimeReadyPromise = createRuntimeReadyPromise(source);
3808
3859
  let tailwindInternals;
@@ -3888,7 +3939,7 @@ function createTailwindV3Engine(source) {
3888
3939
  const requestedCandidates = mergeGenerateCandidates(source, options);
3889
3940
  if (requestedCandidates.size === 0) return generateOnce(source, options);
3890
3941
  const styleOptions = resolveStyleOptions(source, options.styleOptions);
3891
- const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions, options.bareArbitraryValues);
3942
+ const cacheKey = createIncrementalGenerateCacheKey$1(source, target, styleOptions, options.bareArbitraryValues);
3892
3943
  const cached = incrementalGenerateCache.get(cacheKey);
3893
3944
  if (cached) {
3894
3945
  if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) {