weapp-tailwindcss 5.0.6 → 5.0.8

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-CdNXQl-o.mjs → bundle-state-5FtFktJr.mjs} +2 -1
  2. package/dist/{bundle-state-CFgzVHFP.js → bundle-state-cHwTyrOS.js} +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 +71 -69
  42. package/dist/cli.mjs +71 -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-C56PJYxA.js → generator-C--TrAod.js} +1 -1
  50. package/dist/{generator-Bgn4m8An.mjs → generator-DnwUQOXB.mjs} +1 -1
  51. package/dist/generator.js +2 -2
  52. package/dist/generator.mjs +2 -2
  53. package/dist/gulp-5Tan5bHG.js +473 -0
  54. package/dist/gulp-B22YSGU_.mjs +463 -0
  55. package/dist/gulp.js +4 -414
  56. package/dist/gulp.mjs +1 -406
  57. package/dist/{incremental-runtime-class-set-Bmzdjlk0.js → hmr-timing-CscCNKb9.js} +1205 -449
  58. package/dist/{incremental-runtime-class-set-BEYHQkZc.mjs → hmr-timing-DK-mine6.mjs} +1169 -467
  59. package/dist/index.js +5 -5
  60. package/dist/index.mjs +5 -5
  61. package/dist/{postcss-BgINK7Nm.mjs → postcss-CjWuDZwL.mjs} +4 -4
  62. package/dist/{postcss-B7QNe78h.js → postcss-R5pDVHUy.js} +7 -7
  63. package/dist/postcss.js +1 -1
  64. package/dist/postcss.mjs +1 -1
  65. package/dist/{precheck-CyPbGn38.js → precheck-B8y6tDvG.js} +19 -5
  66. package/dist/{precheck-Copn2SqE.mjs → precheck-CcxTR7E_.mjs} +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-C0Zgo3Es.mjs → tailwindcss-0DaftXcU.mjs} +2 -2
  79. package/dist/{tailwindcss-Tw6CSVHL.js → tailwindcss-DbZ4o4m_.js} +2 -2
  80. package/dist/{transform-DgCFGtQR.mjs → transform-DRyWUN5X.mjs} +11 -2
  81. package/dist/{transform-95ivJthq.js → transform-DiW_u3eD.js} +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-Ji6AXPh2.mjs → v3-engine-ArQVHEau.mjs} +786 -699
  91. package/dist/{v3-engine-6FVAcrZl.js → v3-engine-DdlvXpID.js} +788 -701
  92. package/dist/{vite-Bw6LOXvf.js → vite-C_IUnDBy.js} +1797 -386
  93. package/dist/{vite-ChZ2cbn4.mjs → vite-_iUhzc4t.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 +1148 -987
  97. package/dist/{webpack-CMJ7iqN7.mjs → webpack-CqnI4Ymw.mjs} +104 -37
  98. package/dist/{webpack-nn3P8_S_.js → webpack-KLoTb5Dr.js} +113 -45
  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-BODCmzz5.mjs +0 -355
  103. package/dist/source-candidates-Caf2GDvx.js +0 -374
@@ -1,19 +1,183 @@
1
1
  import { a as transformCssMacroCss, n as hasCssMacroTailwindPlugin, o as withCssMacroStyleOptions, r as hasCssMacroTailwindV4Directive, t as hasCssMacroStyleOptions } from "./auto-DEHRmEAx.mjs";
2
2
  import { createRequire } from "node:module";
3
- import fs, { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
4
3
  import postcss from "postcss";
4
+ import * as tailwindcssPatch from "tailwindcss-patch";
5
5
  import { TailwindcssPatcher, createTailwindV4Engine, extractRawCandidates, extractSourceCandidates, isBareArbitraryValuesEnabled, loadTailwindV4DesignSystem, resolveBareArbitraryValueCandidate, resolveProjectSourceFiles, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions } from "tailwindcss-patch";
6
6
  import process from "node:process";
7
+ import fs, { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
7
8
  import path from "node:path";
8
9
  import { logger } from "@weapp-tailwindcss/logger";
9
10
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
10
11
  import { fileURLToPath } from "node:url";
11
12
  import _createDebug from "debug";
12
13
  import { stat } from "node:fs/promises";
13
- import fg from "fast-glob";
14
- import { loadConfig } from "tailwindcss-config";
15
14
  import micromatch from "micromatch";
16
15
  import { createStyleHandler, protectDynamicColorMixAlpha, pruneMiniProgramGeneratedCss } from "@weapp-tailwindcss/postcss";
16
+ import fg from "fast-glob";
17
+ import { loadConfig } from "tailwindcss-config";
18
+ //#region src/utils/object.ts
19
+ function definedEntries(value) {
20
+ return Object.entries(value).filter(([, item]) => item !== void 0);
21
+ }
22
+ function omitUndefined(value) {
23
+ return Object.fromEntries(definedEntries(value));
24
+ }
25
+ //#endregion
26
+ //#region src/tailwindcss/v3-engine/generator/content.ts
27
+ function isLegacyContentObject$1(value) {
28
+ return typeof value === "object" && value !== null && "files" in value;
29
+ }
30
+ function createRawContentEntries(candidates, sources) {
31
+ const entries = [];
32
+ const candidateContent = [...candidates].join(" ");
33
+ if (candidateContent.length > 0) entries.push({
34
+ raw: candidateContent,
35
+ extension: "html"
36
+ });
37
+ for (const source of sources) entries.push({
38
+ raw: source.content,
39
+ extension: source.extension ?? "html"
40
+ });
41
+ return entries;
42
+ }
43
+ function createChangedContentEntries(candidates, sources) {
44
+ return createRawContentEntries(candidates, sources).map((entry) => ({
45
+ content: entry.raw,
46
+ extension: entry.extension
47
+ }));
48
+ }
49
+ function collectCandidates$1(candidates) {
50
+ return new Set(candidates ?? []);
51
+ }
52
+ function collectApplyCandidatesFromCss(css) {
53
+ if (!css.includes("@apply")) return [];
54
+ const candidates = /* @__PURE__ */ new Set();
55
+ try {
56
+ postcss.parse(css).walkAtRules("apply", (rule) => {
57
+ for (const candidate of rule.params.split(/\s+/)) {
58
+ const normalized = candidate.replace(/!important$/, "").trim();
59
+ if (normalized) candidates.add(normalized);
60
+ }
61
+ });
62
+ } catch {}
63
+ return [...candidates];
64
+ }
65
+ function isTailwindCandidateLayer(params) {
66
+ return params.split(/[,\s]+/).some((layer) => layer === "components" || layer === "utilities");
67
+ }
68
+ function extractClassCandidatesFromSelector(selector, candidates) {
69
+ for (let index = 0; index < selector.length; index++) {
70
+ if (selector[index] !== ".") continue;
71
+ let candidate = "";
72
+ let escaped = false;
73
+ for (let tokenIndex = index + 1; tokenIndex < selector.length; tokenIndex++) {
74
+ const char = selector[tokenIndex];
75
+ if (escaped) {
76
+ candidate += char;
77
+ escaped = false;
78
+ continue;
79
+ }
80
+ if (char === "\\") {
81
+ escaped = true;
82
+ continue;
83
+ }
84
+ if (char && /[\w-]/.test(char)) {
85
+ candidate += char;
86
+ continue;
87
+ }
88
+ break;
89
+ }
90
+ if (candidate) candidates.add(candidate);
91
+ }
92
+ }
93
+ function collectLayerCandidatesFromCss(css) {
94
+ if (!css.includes("@layer")) return [];
95
+ const candidates = /* @__PURE__ */ new Set();
96
+ try {
97
+ postcss.parse(css).walkAtRules("layer", (layer) => {
98
+ if (!isTailwindCandidateLayer(layer.params)) return;
99
+ layer.walkRules((rule) => {
100
+ extractClassCandidatesFromSelector(rule.selector, candidates);
101
+ });
102
+ });
103
+ } catch {}
104
+ return [...candidates];
105
+ }
106
+ function mergeGenerateCandidates(source, options) {
107
+ return collectCandidates$1([
108
+ ...collectLayerCandidatesFromCss(source.css),
109
+ ...collectApplyCandidatesFromCss(source.css),
110
+ ...collectCandidates$1(options.candidates)
111
+ ]);
112
+ }
113
+ function mergeContent(content, rawEntries) {
114
+ if (isLegacyContentObject$1(content)) return {
115
+ ...content,
116
+ relative: content.relative ?? true,
117
+ files: [...[].concat(content.files ?? []), ...rawEntries]
118
+ };
119
+ return {
120
+ relative: true,
121
+ files: [...[].concat(content ?? []), ...rawEntries]
122
+ };
123
+ }
124
+ function normalizeConfigObject(config) {
125
+ if (!config || typeof config !== "object") return config;
126
+ const maybeDefault = config.default;
127
+ if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
128
+ return config;
129
+ }
130
+ function hasExplicitContentInput(options) {
131
+ return options.candidates !== void 0 || options.sources !== void 0;
132
+ }
133
+ function createExplicitContentConfig(rawEntries) {
134
+ return {
135
+ relative: true,
136
+ files: rawEntries
137
+ };
138
+ }
139
+ function createTailwindConfig(source, options) {
140
+ const config = { ...normalizeConfigObject(source.configObject) ?? {} };
141
+ const rawEntries = createRawContentEntries(mergeGenerateCandidates(source, options), options.sources ?? []);
142
+ config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
143
+ return config;
144
+ }
145
+ //#endregion
146
+ //#region src/tailwindcss/v3-engine/generator/cache-key.ts
147
+ function createStableJson$1(value) {
148
+ if (value === void 0) return "undefined";
149
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
150
+ if (Array.isArray(value)) return `[${value.map((item) => createStableJson$1(item)).join(",")}]`;
151
+ return `{${Object.keys(value).sort().map((key) => {
152
+ const record = value;
153
+ return `${JSON.stringify(key)}:${createStableJson$1(record[key])}`;
154
+ }).join(",")}}`;
155
+ }
156
+ function createDependencyFingerprint$1(files) {
157
+ return files.map((file) => {
158
+ try {
159
+ const stat = fs.statSync(file);
160
+ return `${file}:${stat.size}:${stat.mtimeMs}`;
161
+ } catch {
162
+ return `${file}:missing`;
163
+ }
164
+ }).join("|");
165
+ }
166
+ function createIncrementalGenerateCacheKey$1(source, target, styleOptions, bareArbitraryValues) {
167
+ return [
168
+ source.packageName,
169
+ source.postcssPlugin,
170
+ source.cwd,
171
+ source.config ?? "config:missing",
172
+ createDependencyFingerprint$1(source.dependencies),
173
+ source.css,
174
+ createStableJson$1(normalizeConfigObject(source.configObject)?.content),
175
+ target,
176
+ createStableJson$1(styleOptions),
177
+ createStableJson$1(bareArbitraryValues)
178
+ ].join("\0");
179
+ }
180
+ //#endregion
17
181
  //#region src/context/workspace.ts
18
182
  const IGNORED_WORKSPACE_DIRS = new Set([
19
183
  "node_modules",
@@ -73,14 +237,6 @@ function findWorkspacePackageDir(rootDir, packageName) {
73
237
  }
74
238
  }
75
239
  //#endregion
76
- //#region src/utils/object.ts
77
- function definedEntries(value) {
78
- return Object.entries(value).filter(([, item]) => item !== void 0);
79
- }
80
- function omitUndefined(value) {
81
- return Object.fromEntries(definedEntries(value));
82
- }
83
- //#endregion
84
240
  //#region src/utils/options.ts
85
241
  function resolveBooleanObjectOption(value, enabledValue) {
86
242
  if (!value) return false;
@@ -303,7 +459,7 @@ function createTailwindcssPatcher(options) {
303
459
  const resolvedTailwindOptions = resolvedOptions.tailwindcss;
304
460
  if (resolvedTailwindOptions) {
305
461
  const existingResolve = resolvedTailwindOptions.resolve ?? {};
306
- const sourcePaths = Array.isArray(existingResolve.paths) && existingResolve.paths.length > 0 ? [...existingResolve.paths, ...resolvePaths] : resolvePaths;
462
+ const sourcePaths = Array.isArray(existingResolve.paths) && existingResolve.paths.length > 0 ? [...existingResolve.paths ?? [], ...resolvePaths] : resolvePaths;
307
463
  resolvedTailwindOptions.resolve = {
308
464
  ...existingResolve,
309
465
  paths: [...new Set(sourcePaths)]
@@ -365,140 +521,8 @@ function createDebug(prefix) {
365
521
  return debug;
366
522
  }
367
523
  //#endregion
368
- //#region src/tailwindcss/source-scan.ts
369
- const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
370
- "html",
371
- "wxml",
372
- "axml",
373
- "jxml",
374
- "ksml",
375
- "ttml",
376
- "qml",
377
- "tyml",
378
- "xhsml",
379
- "swan",
380
- "vue",
381
- "mpx",
382
- "js",
383
- "jsx",
384
- "ts",
385
- "tsx"
386
- ];
387
- const FULL_SOURCE_SCAN_EXTENSIONS = [
388
- "js",
389
- "jsx",
390
- "mjs",
391
- "cjs",
392
- "ts",
393
- "tsx",
394
- "mts",
395
- "cts",
396
- "vue",
397
- "uvue",
398
- "nvue",
399
- "svelte",
400
- "mpx",
401
- "html",
402
- "wxml",
403
- "axml",
404
- "jxml",
405
- "ksml",
406
- "ttml",
407
- "qml",
408
- "tyml",
409
- "xhsml",
410
- "swan",
411
- "css",
412
- "wxss",
413
- "acss",
414
- "jxss",
415
- "ttss",
416
- "qss",
417
- "tyss",
418
- "scss",
419
- "sass",
420
- "less",
421
- "styl",
422
- "stylus"
423
- ];
424
- function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
425
- return `**/*.{${extensions.join(",")}}`;
426
- }
427
- const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
428
- const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
429
- function toPosixPath(value) {
430
- return value.split(path.sep).join("/");
431
- }
432
- function resolveSourceScanPath(value) {
433
- const resolved = path.resolve(value);
434
- try {
435
- return realpathSync.native(resolved);
436
- } catch {
437
- return resolved;
438
- }
439
- }
440
- function normalizeEntryPattern(entry) {
441
- return path.isAbsolute(entry.pattern) ? toPosixPath(path.relative(resolveSourceScanPath(entry.base), entry.pattern)) : entry.pattern;
442
- }
443
- function isFileMatchedByTailwindSourceEntry(file, entry) {
444
- const relative = toPosixPath(path.relative(resolveSourceScanPath(entry.base), file));
445
- return relative && !relative.startsWith("../") && !path.isAbsolute(relative) && micromatch.isMatch(relative, normalizeEntryPattern(entry));
446
- }
447
- function isFileExcludedByTailwindSourceEntries(file, entries) {
448
- if (!entries?.length) return false;
449
- const resolvedFile = resolveSourceScanPath(file);
450
- return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
451
- }
452
- function isFileMatchedByTailwindSourceEntries(file, entries) {
453
- if (!entries?.length) return true;
454
- const positiveEntries = entries.filter((entry) => !entry.negated);
455
- const negativeEntries = entries.filter((entry) => entry.negated);
456
- const resolvedFile = resolveSourceScanPath(file);
457
- if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
458
- if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
459
- return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
460
- }
461
- function createTailwindSourceEntryMatcher(entries) {
462
- if (!entries?.length) return;
463
- return (file) => isFileMatchedByTailwindSourceEntries(file, entries);
464
- }
465
- function resolveTailwindV4CssSourceBase(source, fallbackBase) {
466
- if (typeof source.base === "string" && source.base.length > 0) return source.base;
467
- if (typeof source.file === "string" && source.file.length > 0) return path.dirname(source.file);
468
- return fallbackBase;
469
- }
524
+ //#region src/tailwindcss/source-scan/inline-source.ts
470
525
  const NUMERICAL_RANGE_RE = /^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/;
471
- function parseConfigParam$1(params) {
472
- const value = params.trim();
473
- return /^(['"])(.+)\1$/.exec(value)?.[2];
474
- }
475
- function isLegacyContentObject$1(value) {
476
- return typeof value === "object" && value !== null && "files" in value;
477
- }
478
- function normalizeGlobPattern(pattern) {
479
- return pattern.startsWith("./") ? pattern.slice(2) : pattern;
480
- }
481
- function hasGlobMagic(value) {
482
- return /[*?[\]{}()!+@]/.test(value);
483
- }
484
- function splitStaticGlobPrefix(pattern) {
485
- const segments = normalizeGlobPattern(pattern).split(/[\\/]+/);
486
- const prefix = [];
487
- const rest = [];
488
- let reachedGlob = false;
489
- for (const segment of segments) {
490
- if (!reachedGlob && segment && !hasGlobMagic(segment)) {
491
- prefix.push(segment);
492
- continue;
493
- }
494
- reachedGlob = true;
495
- rest.push(segment);
496
- }
497
- return {
498
- prefix,
499
- rest
500
- };
501
- }
502
526
  function segmentTopLevel(input, separator, options = {}) {
503
527
  const parts = [];
504
528
  const stack = [];
@@ -625,6 +649,140 @@ function collectCssInlineSourceCandidates(root) {
625
649
  excluded
626
650
  };
627
651
  }
652
+ //#endregion
653
+ //#region src/tailwindcss/source-scan.ts
654
+ const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
655
+ "html",
656
+ "wxml",
657
+ "axml",
658
+ "jxml",
659
+ "ksml",
660
+ "ttml",
661
+ "qml",
662
+ "tyml",
663
+ "xhsml",
664
+ "swan",
665
+ "vue",
666
+ "mpx",
667
+ "js",
668
+ "jsx",
669
+ "ts",
670
+ "tsx"
671
+ ];
672
+ const FULL_SOURCE_SCAN_EXTENSIONS = [
673
+ "js",
674
+ "jsx",
675
+ "mjs",
676
+ "cjs",
677
+ "ts",
678
+ "tsx",
679
+ "mts",
680
+ "cts",
681
+ "vue",
682
+ "uvue",
683
+ "nvue",
684
+ "svelte",
685
+ "mpx",
686
+ "html",
687
+ "wxml",
688
+ "axml",
689
+ "jxml",
690
+ "ksml",
691
+ "ttml",
692
+ "qml",
693
+ "tyml",
694
+ "xhsml",
695
+ "swan",
696
+ "css",
697
+ "wxss",
698
+ "acss",
699
+ "jxss",
700
+ "ttss",
701
+ "qss",
702
+ "tyss",
703
+ "scss",
704
+ "sass",
705
+ "less",
706
+ "styl",
707
+ "stylus"
708
+ ];
709
+ function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
710
+ return `**/*.{${extensions.join(",")}}`;
711
+ }
712
+ const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
713
+ const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
714
+ function toPosixPath(value) {
715
+ return value.split(path.sep).join("/");
716
+ }
717
+ function resolveSourceScanPath(value) {
718
+ const resolved = path.resolve(value);
719
+ try {
720
+ return realpathSync.native(resolved);
721
+ } catch {
722
+ return resolved;
723
+ }
724
+ }
725
+ function normalizeEntryPattern(entry) {
726
+ return path.isAbsolute(entry.pattern) ? toPosixPath(path.relative(resolveSourceScanPath(entry.base), entry.pattern)) : entry.pattern;
727
+ }
728
+ function isFileMatchedByTailwindSourceEntry(file, entry) {
729
+ const relative = toPosixPath(path.relative(resolveSourceScanPath(entry.base), file));
730
+ return relative && !relative.startsWith("../") && !path.isAbsolute(relative) && micromatch.isMatch(relative, normalizeEntryPattern(entry));
731
+ }
732
+ function isFileExcludedByTailwindSourceEntries(file, entries) {
733
+ if (!entries?.length) return false;
734
+ const resolvedFile = resolveSourceScanPath(file);
735
+ return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
736
+ }
737
+ function isFileMatchedByTailwindSourceEntries(file, entries) {
738
+ if (!entries?.length) return true;
739
+ const positiveEntries = entries.filter((entry) => !entry.negated);
740
+ const negativeEntries = entries.filter((entry) => entry.negated);
741
+ const resolvedFile = resolveSourceScanPath(file);
742
+ if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
743
+ if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
744
+ return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
745
+ }
746
+ function createTailwindSourceEntryMatcher(entries) {
747
+ if (!entries?.length) return;
748
+ return (file) => isFileMatchedByTailwindSourceEntries(file, entries);
749
+ }
750
+ function resolveTailwindV4CssSourceBase(source, fallbackBase) {
751
+ if (typeof source.base === "string" && source.base.length > 0) return source.base;
752
+ if (typeof source.file === "string" && source.file.length > 0) return path.dirname(source.file);
753
+ return fallbackBase;
754
+ }
755
+ function parseConfigParam$1(params) {
756
+ const value = params.trim();
757
+ return /^(['"])(.+)\1$/.exec(value)?.[2];
758
+ }
759
+ function isLegacyContentObject(value) {
760
+ return typeof value === "object" && value !== null && "files" in value;
761
+ }
762
+ function normalizeGlobPattern(pattern) {
763
+ return pattern.startsWith("./") ? pattern.slice(2) : pattern;
764
+ }
765
+ function hasGlobMagic(value) {
766
+ return /[*?[\]{}()!+@]/.test(value);
767
+ }
768
+ function splitStaticGlobPrefix(pattern) {
769
+ const segments = normalizeGlobPattern(pattern).split(/[\\/]+/);
770
+ const prefix = [];
771
+ const rest = [];
772
+ let reachedGlob = false;
773
+ for (const segment of segments) {
774
+ if (!reachedGlob && segment && !hasGlobMagic(segment)) {
775
+ prefix.push(segment);
776
+ continue;
777
+ }
778
+ reachedGlob = true;
779
+ rest.push(segment);
780
+ }
781
+ return {
782
+ prefix,
783
+ rest
784
+ };
785
+ }
628
786
  function normalizeLegacyContentEntries(content, base, options = {}) {
629
787
  if (typeof content === "string") {
630
788
  const negated = content.startsWith("!");
@@ -635,7 +793,7 @@ function normalizeLegacyContentEntries(content, base, options = {}) {
635
793
  }];
636
794
  }
637
795
  if (Array.isArray(content)) return content.flatMap((item) => normalizeLegacyContentEntries(item, base, options));
638
- if (isLegacyContentObject$1(content)) return normalizeLegacyContentEntries(content.files, content.relative && options.relativeBase ? options.relativeBase : base, options);
796
+ if (isLegacyContentObject(content)) return normalizeLegacyContentEntries(content.files, content.relative && options.relativeBase ? options.relativeBase : base, options);
639
797
  return [];
640
798
  }
641
799
  async function pathExistsAsDirectory(file) {
@@ -731,40 +889,6 @@ function filterUnsupportedMiniProgramTailwindV4Candidates(candidates) {
731
889
  return new Set([...candidates].filter((candidate) => !isUnsupportedMiniProgramTailwindV4Candidate(candidate)));
732
890
  }
733
891
  //#endregion
734
- //#region src/tailwindcss/v4-engine/miniprogram.ts
735
- const defaultStyleHandler$1 = createStyleHandler({
736
- cssChildCombinatorReplaceValue: ["view", "text"],
737
- cssRemoveHoverPseudoClass: true,
738
- isMainChunk: true,
739
- majorVersion: 4
740
- });
741
- const CSS_DECLARATION_URL_RE = /(:\s*)url\(([^\n\r"';[\]{}]*[[\]{}][^\n\r;]*)\)(?=\s*;)/g;
742
- function normalizeTailwindV4GeneratedUrlValues(css) {
743
- return css.replace(CSS_DECLARATION_URL_RE, (match, prefix, urlValue) => {
744
- try {
745
- return `${prefix}url("${urlValue.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}")`;
746
- } catch {
747
- return match;
748
- }
749
- });
750
- }
751
- async function transformTailwindV4CssToWeapp(css, options) {
752
- const protectedCss = protectDynamicColorMixAlpha(normalizeTailwindV4GeneratedUrlValues(hasCssMacroStyleOptions(options) ? await transformCssMacroCss(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
753
- const result = await defaultStyleHandler$1(protectedCss.css, {
754
- cssChildCombinatorReplaceValue: ["view", "text"],
755
- cssRemoveHoverPseudoClass: true,
756
- isMainChunk: true,
757
- majorVersion: 4,
758
- ...options
759
- });
760
- const pruneOptions = { preserveConditionalComments: hasCssMacroStyleOptions(options) };
761
- return pruneMiniProgramGeneratedCss(protectedCss.restore(result.css), pruneOptions);
762
- }
763
- async function transformTailwindV4CssByTarget(css, target, options) {
764
- if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
765
- return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css, options) : css;
766
- }
767
- //#endregion
768
892
  //#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
769
893
  const TAILWIND_V3_COLOR_STEPS = [
770
894
  "50",
@@ -1496,40 +1620,7 @@ function createTailwindV4DefaultColorThemeCss() {
1496
1620
  ].join("\n");
1497
1621
  }
1498
1622
  //#endregion
1499
- //#region src/tailwindcss/v4-engine/generator.ts
1500
- const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
1501
- const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
1502
- const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
1503
- const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
1504
- const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
1505
- "**/.git/**",
1506
- "**/.hg/**",
1507
- "**/.jj/**",
1508
- "**/.next/**",
1509
- "**/.parcel-cache/**",
1510
- "**/.pnpm-store/**",
1511
- "**/.svelte-kit/**",
1512
- "**/.svn/**",
1513
- "**/.turbo/**",
1514
- "**/.venv/**",
1515
- "**/.vercel/**",
1516
- "**/.yarn/**",
1517
- "**/__pycache__/**",
1518
- "**/node_modules/**",
1519
- "**/venv/**",
1520
- "**/*.less",
1521
- "**/*.lock",
1522
- "**/*.sass",
1523
- "**/*.scss",
1524
- "**/*.styl",
1525
- "**/*.log",
1526
- "**/package-lock.json",
1527
- "**/pnpm-lock.yaml",
1528
- "**/bun.lockb",
1529
- "**/.gitignore",
1530
- "**/.env",
1531
- "**/.env.*"
1532
- ];
1623
+ //#region src/tailwindcss/v4-engine/generator/css-compat.ts
1533
1624
  function findLeadingImportInsertionIndex(css) {
1534
1625
  const importPattern = /(?:^|\n)\s*@import\b[^;]*;/g;
1535
1626
  let insertionIndex = 0;
@@ -1546,13 +1637,78 @@ function applyMiniProgramTailwindV4DefaultColorCss(css) {
1546
1637
  if (insertionIndex === 0) return `${themeCss}\n${css}`;
1547
1638
  return `${css.slice(0, insertionIndex)}\n${themeCss}\n${css.slice(insertionIndex)}`;
1548
1639
  }
1549
- function collectCandidates$1(candidates) {
1550
- return new Set(candidates ?? []);
1640
+ function parseCssImportSpecifier$3(params) {
1641
+ const value = params.trim();
1642
+ const quoted = /^(['"])(.*?)\1/.exec(value);
1643
+ if (quoted) return quoted[2];
1644
+ const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
1645
+ return url?.[2] ?? url?.[3];
1551
1646
  }
1552
- function hasRemovedCandidates$1(previousCandidates, nextCandidates) {
1553
- for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
1647
+ function isTailwindCssPreflightImport(params) {
1648
+ const specifier = parseCssImportSpecifier$3(params);
1649
+ return specifier === "tailwindcss/preflight.css" || specifier === "tailwindcss/preflight";
1650
+ }
1651
+ function hasImportLayerOption(params) {
1652
+ return /\blayer(?:\s*\(|\s*$)/.test(params);
1653
+ }
1654
+ function removeUnlayeredTailwindV4PreflightImports(css) {
1655
+ if (!css.includes("preflight")) return css;
1656
+ let root;
1657
+ try {
1658
+ root = postcss.parse(css);
1659
+ } catch {
1660
+ return css;
1661
+ }
1662
+ let changed = false;
1663
+ root.walkAtRules("import", (rule) => {
1664
+ if (isTailwindCssPreflightImport(rule.params) && !hasImportLayerOption(rule.params)) {
1665
+ rule.remove();
1666
+ changed = true;
1667
+ }
1668
+ });
1669
+ return changed ? root.toString() : css;
1670
+ }
1671
+ function hasThemeParent(rule) {
1672
+ let parent = rule.parent;
1673
+ while (parent) {
1674
+ if (parent.type === "atrule" && parent.name === "theme") return true;
1675
+ parent = parent.parent;
1676
+ }
1554
1677
  return false;
1555
1678
  }
1679
+ function isVendorPrefixedKeyframes(rule) {
1680
+ return rule.name.startsWith("-") && rule.name.endsWith("keyframes");
1681
+ }
1682
+ function removeUnsupportedThemeVendorKeyframes(css) {
1683
+ if (!css.includes("@theme") || !css.includes("@-")) return css;
1684
+ let root;
1685
+ try {
1686
+ root = postcss.parse(css);
1687
+ } catch {
1688
+ return css;
1689
+ }
1690
+ let changed = false;
1691
+ root.walkAtRules((rule) => {
1692
+ if (isVendorPrefixedKeyframes(rule) && hasThemeParent(rule)) {
1693
+ rule.remove();
1694
+ changed = true;
1695
+ }
1696
+ });
1697
+ return changed ? root.toString() : css;
1698
+ }
1699
+ function createCompatibleSource(source, target, tailwindcssV3Compatibility) {
1700
+ const shouldApplyTailwindV3Compatibility = tailwindcssV3Compatibility ?? target === "weapp";
1701
+ const filteredSourceCss = target === "weapp" ? removeUnlayeredTailwindV4PreflightImports(source.css) : source.css;
1702
+ const compatibleSourceCss = removeUnsupportedThemeVendorKeyframes(shouldApplyTailwindV3Compatibility ? applyTailwindV3CompatibilityCss(filteredSourceCss) : target === "weapp" ? applyMiniProgramTailwindV4DefaultColorCss(filteredSourceCss) : filteredSourceCss);
1703
+ return compatibleSourceCss === source.css ? source : {
1704
+ ...source,
1705
+ css: compatibleSourceCss
1706
+ };
1707
+ }
1708
+ //#endregion
1709
+ //#region src/tailwindcss/v4-engine/generator/rpx-candidates.ts
1710
+ const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
1711
+ const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
1556
1712
  function normalizeRpxTextCandidate(candidate) {
1557
1713
  return candidate.replace(BARE_RPX_TEXT_CANDIDATE_RE, "$1text-[length:$2]$3");
1558
1714
  }
@@ -1585,120 +1741,37 @@ function restoreRpxTextCssSelectors(css, restoreCandidates) {
1585
1741
  return restoredValues.has(normalizeCssEscapedRpxSelectorValue(value)) ? `text-\\[${value}\\]` : match;
1586
1742
  });
1587
1743
  }
1588
- function createStableJson$1(value) {
1589
- if (value === void 0) return "undefined";
1590
- if (value === null || typeof value !== "object") return JSON.stringify(value);
1591
- if (Array.isArray(value)) return `[${value.map((item) => createStableJson$1(item)).join(",")}]`;
1592
- return `{${Object.keys(value).sort().map((key) => {
1593
- const record = value;
1594
- return `${JSON.stringify(key)}:${createStableJson$1(record[key])}`;
1595
- }).join(",")}}`;
1596
- }
1597
- function createDependencyFingerprint$1(files) {
1598
- return files.map((file) => {
1599
- try {
1600
- const stat = fs.statSync(file);
1601
- return `${file}:${stat.size}:${stat.mtimeMs}`;
1602
- } catch {
1603
- return `${file}:missing`;
1604
- }
1605
- }).join("|");
1606
- }
1607
- function createIncrementalGenerateCacheKey$1(source, target, styleOptions, tailwindcssV3Compatibility) {
1608
- return [
1609
- source.projectRoot,
1610
- source.base,
1611
- createStableJson$1(source.baseFallbacks),
1612
- source.css,
1613
- createDependencyFingerprint$1(source.dependencies),
1614
- target,
1615
- createStableJson$1(styleOptions),
1616
- createStableJson$1(tailwindcssV3Compatibility)
1617
- ].join("\0");
1618
- }
1619
- function createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources) {
1620
- return [
1621
- cacheKey,
1622
- scanSources === true ? "scan:1" : "scan:0",
1623
- [...requestedCandidates].sort().join("\n")
1624
- ].join("\0");
1625
- }
1626
- function runIncrementalGenerateTask(cacheKey, requestedCandidates, scanSources, task) {
1627
- const taskKey = createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources);
1628
- const cachedTask = incrementalGenerateTaskCache.get(taskKey);
1629
- if (cachedTask) return cachedTask;
1630
- const promise = task();
1631
- incrementalGenerateTaskCache.set(taskKey, promise);
1632
- promise.finally(() => {
1633
- if (incrementalGenerateTaskCache.get(taskKey) === promise) incrementalGenerateTaskCache.delete(taskKey);
1634
- });
1635
- return promise;
1636
- }
1637
- function createIncrementalDesignSystemPromise(source, cacheKey) {
1638
- const promise = loadTailwindV4DesignSystem(source);
1639
- promise.catch(() => {
1640
- if (incrementalGenerateCache$1.get(cacheKey)?.designSystemPromise === promise) incrementalGenerateCache$1.delete(cacheKey);
1641
- });
1642
- return promise;
1643
- }
1644
- function createCompatibleSource(source, target, tailwindcssV3Compatibility) {
1645
- const shouldApplyTailwindV3Compatibility = tailwindcssV3Compatibility ?? target === "weapp";
1646
- const filteredSourceCss = target === "weapp" ? removeUnlayeredTailwindV4PreflightImports(source.css) : source.css;
1647
- const compatibleSourceCss = removeUnsupportedThemeVendorKeyframes(shouldApplyTailwindV3Compatibility ? applyTailwindV3CompatibilityCss(filteredSourceCss) : target === "weapp" ? applyMiniProgramTailwindV4DefaultColorCss(filteredSourceCss) : filteredSourceCss);
1648
- return compatibleSourceCss === source.css ? source : {
1649
- ...source,
1650
- css: compatibleSourceCss
1651
- };
1652
- }
1653
- function resolveTargetCandidates(candidates, target) {
1654
- const collected = collectCandidates$1(candidates);
1655
- return target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(collected) : collected;
1656
- }
1657
- function collectSeenCandidates(generated, requestedCandidates) {
1658
- return new Set([
1659
- ...requestedCandidates,
1660
- ...generated.rawCandidates,
1661
- ...generated.classSet
1662
- ]);
1663
- }
1664
- function createIncrementalStyleOptions(styleOptions) {
1665
- return {
1666
- ...styleOptions,
1667
- isMainChunk: false
1668
- };
1669
- }
1670
- function resolveStyleOptions$1(source, options) {
1671
- return hasCssMacroTailwindV4Directive(source.css) ? withCssMacroStyleOptions(options) : options;
1672
- }
1673
- function collectCustomPropertyValues(css) {
1674
- const values = /* @__PURE__ */ new Map();
1675
- try {
1676
- postcss.parse(css).walkDecls((decl) => {
1677
- if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
1678
- });
1679
- } catch {}
1680
- return values;
1681
- }
1682
- function mergeCustomPropertyValues(target, css) {
1683
- for (const [prop, value] of collectCustomPropertyValues(css)) target.set(prop, value);
1684
- }
1685
- function seedIncrementalGenerateCache(options) {
1686
- const cacheKey = createIncrementalGenerateCacheKey$1(options.compatibleSource, options.target, options.styleOptions, options.tailwindcssV3Compatibility);
1687
- const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
1688
- mergeCustomPropertyValues(customPropertyValues, options.generated.css);
1689
- incrementalGenerateCache$1.set(cacheKey, {
1690
- seenCandidates: collectSeenCandidates(options.generated, options.requestedCandidates),
1691
- classSet: new Set(options.generated.classSet),
1692
- css: options.generated.css,
1693
- rawCss: options.generated.rawCss,
1694
- customPropertyValues,
1695
- designSystemPromise: createIncrementalDesignSystemPromise(options.compatibleSource, cacheKey),
1696
- dependencies: options.generated.dependencies,
1697
- sources: options.generated.sources,
1698
- root: options.generated.root,
1699
- target: options.generated.target
1700
- });
1701
- }
1744
+ //#endregion
1745
+ //#region src/tailwindcss/v4-engine/generator/scan-sources.ts
1746
+ const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
1747
+ "**/.git/**",
1748
+ "**/.hg/**",
1749
+ "**/.jj/**",
1750
+ "**/.next/**",
1751
+ "**/.parcel-cache/**",
1752
+ "**/.pnpm-store/**",
1753
+ "**/.svelte-kit/**",
1754
+ "**/.svn/**",
1755
+ "**/.turbo/**",
1756
+ "**/.venv/**",
1757
+ "**/.vercel/**",
1758
+ "**/.yarn/**",
1759
+ "**/__pycache__/**",
1760
+ "**/node_modules/**",
1761
+ "**/venv/**",
1762
+ "**/*.less",
1763
+ "**/*.lock",
1764
+ "**/*.sass",
1765
+ "**/*.scss",
1766
+ "**/*.styl",
1767
+ "**/*.log",
1768
+ "**/package-lock.json",
1769
+ "**/pnpm-lock.yaml",
1770
+ "**/bun.lockb",
1771
+ "**/.gitignore",
1772
+ "**/.env",
1773
+ "**/.env.*"
1774
+ ];
1702
1775
  function parseImportSourceParam$1(params) {
1703
1776
  const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
1704
1777
  if (!match) return;
@@ -1707,10 +1780,6 @@ function parseImportSourceParam$1(params) {
1707
1780
  sourcePath: match[3]
1708
1781
  };
1709
1782
  }
1710
- function isTailwindCssImport$1(params) {
1711
- const specifier = parseCssImportSpecifier$2(params);
1712
- return specifier === "tailwindcss" || specifier?.startsWith("tailwindcss/") || specifier?.replaceAll("\\", "/").endsWith("/tailwindcss/index.css");
1713
- }
1714
1783
  function parseCssImportSpecifier$2(params) {
1715
1784
  const value = params.trim();
1716
1785
  const quoted = /^(['"])(.*?)\1/.exec(value);
@@ -1718,29 +1787,9 @@ function parseCssImportSpecifier$2(params) {
1718
1787
  const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
1719
1788
  return url?.[2] ?? url?.[3];
1720
1789
  }
1721
- function isTailwindCssPreflightImport(params) {
1790
+ function isTailwindCssImport$1(params) {
1722
1791
  const specifier = parseCssImportSpecifier$2(params);
1723
- return specifier === "tailwindcss/preflight.css" || specifier === "tailwindcss/preflight";
1724
- }
1725
- function hasImportLayerOption(params) {
1726
- return /\blayer(?:\s*\(|\s*$)/.test(params);
1727
- }
1728
- function removeUnlayeredTailwindV4PreflightImports(css) {
1729
- if (!css.includes("preflight")) return css;
1730
- let root;
1731
- try {
1732
- root = postcss.parse(css);
1733
- } catch {
1734
- return css;
1735
- }
1736
- let changed = false;
1737
- root.walkAtRules("import", (rule) => {
1738
- if (isTailwindCssPreflightImport(rule.params) && !hasImportLayerOption(rule.params)) {
1739
- rule.remove();
1740
- changed = true;
1741
- }
1742
- });
1743
- return changed ? root.toString() : css;
1792
+ return specifier === "tailwindcss" || specifier?.startsWith("tailwindcss/") || specifier?.replaceAll("\\", "/").endsWith("/tailwindcss/index.css");
1744
1793
  }
1745
1794
  function resolveSourceBase$1(base, sourcePath) {
1746
1795
  return path.isAbsolute(sourcePath) ? sourcePath : path.resolve(base, sourcePath);
@@ -1784,42 +1833,164 @@ async function resolveCssDefinedScanSources(source) {
1784
1833
  return;
1785
1834
  }
1786
1835
  return [
1787
- await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"),
1788
- ...sourcePatterns,
1789
- ...createDefaultIgnoredScanSources(importSourceBase)
1790
- ];
1836
+ await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"),
1837
+ ...sourcePatterns,
1838
+ ...createDefaultIgnoredScanSources(importSourceBase)
1839
+ ];
1840
+ }
1841
+ async function resolveScanSources(source, scanSources) {
1842
+ if (scanSources !== true) return scanSources;
1843
+ return await resolveCssDefinedScanSources(source) ?? false;
1844
+ }
1845
+ //#endregion
1846
+ //#region src/tailwindcss/v4-engine/miniprogram.ts
1847
+ const defaultStyleHandler$1 = createStyleHandler({
1848
+ cssChildCombinatorReplaceValue: ["view", "text"],
1849
+ cssRemoveHoverPseudoClass: true,
1850
+ isMainChunk: true,
1851
+ majorVersion: 4
1852
+ });
1853
+ const CSS_DECLARATION_URL_RE = /(:\s*)url\(([^\n\r"';[\]{}]*[[\]{}][^\n\r;]*)\)(?=\s*;)/g;
1854
+ function normalizeTailwindV4GeneratedUrlValues(css) {
1855
+ return css.replace(CSS_DECLARATION_URL_RE, (match, prefix, urlValue) => {
1856
+ try {
1857
+ return `${prefix}url("${urlValue.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}")`;
1858
+ } catch {
1859
+ return match;
1860
+ }
1861
+ });
1862
+ }
1863
+ async function transformTailwindV4CssToWeapp(css, options) {
1864
+ const protectedCss = protectDynamicColorMixAlpha(normalizeTailwindV4GeneratedUrlValues(hasCssMacroStyleOptions(options) ? await transformCssMacroCss(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
1865
+ const result = await defaultStyleHandler$1(protectedCss.css, {
1866
+ cssChildCombinatorReplaceValue: ["view", "text"],
1867
+ cssRemoveHoverPseudoClass: true,
1868
+ isMainChunk: true,
1869
+ majorVersion: 4,
1870
+ ...options
1871
+ });
1872
+ const pruneOptions = { preserveConditionalComments: hasCssMacroStyleOptions(options) };
1873
+ return pruneMiniProgramGeneratedCss(protectedCss.restore(result.css), pruneOptions);
1874
+ }
1875
+ async function transformTailwindV4CssByTarget(css, target, options) {
1876
+ if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
1877
+ return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css, options) : css;
1878
+ }
1879
+ //#endregion
1880
+ //#region src/tailwindcss/v4-engine/generator.ts
1881
+ const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
1882
+ const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
1883
+ function collectCandidates(candidates) {
1884
+ return new Set(candidates ?? []);
1885
+ }
1886
+ function hasRemovedCandidates$1(previousCandidates, nextCandidates) {
1887
+ for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
1888
+ return false;
1889
+ }
1890
+ function createStableJson(value) {
1891
+ if (value === void 0) return "undefined";
1892
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
1893
+ if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
1894
+ return `{${Object.keys(value).sort().map((key) => {
1895
+ const record = value;
1896
+ return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
1897
+ }).join(",")}}`;
1898
+ }
1899
+ function createDependencyFingerprint(files) {
1900
+ return files.map((file) => {
1901
+ try {
1902
+ const stat = fs.statSync(file);
1903
+ return `${file}:${stat.size}:${stat.mtimeMs}`;
1904
+ } catch {
1905
+ return `${file}:missing`;
1906
+ }
1907
+ }).join("|");
1908
+ }
1909
+ function createIncrementalGenerateCacheKey(source, target, styleOptions, tailwindcssV3Compatibility) {
1910
+ return [
1911
+ source.projectRoot,
1912
+ source.base,
1913
+ createStableJson(source.baseFallbacks),
1914
+ source.css,
1915
+ createDependencyFingerprint(source.dependencies),
1916
+ target,
1917
+ createStableJson(styleOptions),
1918
+ createStableJson(tailwindcssV3Compatibility)
1919
+ ].join("\0");
1920
+ }
1921
+ function createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources) {
1922
+ return [
1923
+ cacheKey,
1924
+ scanSources === true ? "scan:1" : "scan:0",
1925
+ [...requestedCandidates].sort().join("\n")
1926
+ ].join("\0");
1791
1927
  }
1792
- async function resolveScanSources(source, scanSources) {
1793
- if (scanSources !== true) return scanSources;
1794
- return await resolveCssDefinedScanSources(source) ?? false;
1928
+ function runIncrementalGenerateTask(cacheKey, requestedCandidates, scanSources, task) {
1929
+ const taskKey = createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources);
1930
+ const cachedTask = incrementalGenerateTaskCache.get(taskKey);
1931
+ if (cachedTask) return cachedTask;
1932
+ const promise = task();
1933
+ incrementalGenerateTaskCache.set(taskKey, promise);
1934
+ promise.finally(() => {
1935
+ if (incrementalGenerateTaskCache.get(taskKey) === promise) incrementalGenerateTaskCache.delete(taskKey);
1936
+ });
1937
+ return promise;
1795
1938
  }
1796
- function hasThemeParent(rule) {
1797
- let parent = rule.parent;
1798
- while (parent) {
1799
- if (parent.type === "atrule" && parent.name === "theme") return true;
1800
- parent = parent.parent;
1801
- }
1802
- return false;
1939
+ function createIncrementalDesignSystemPromise(source, cacheKey) {
1940
+ const promise = loadTailwindV4DesignSystem(source);
1941
+ promise.catch(() => {
1942
+ if (incrementalGenerateCache$1.get(cacheKey)?.designSystemPromise === promise) incrementalGenerateCache$1.delete(cacheKey);
1943
+ });
1944
+ return promise;
1803
1945
  }
1804
- function isVendorPrefixedKeyframes(rule) {
1805
- return rule.name.startsWith("-") && rule.name.endsWith("keyframes");
1946
+ function resolveTargetCandidates(candidates, target) {
1947
+ const collected = collectCandidates(candidates);
1948
+ return target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(collected) : collected;
1806
1949
  }
1807
- function removeUnsupportedThemeVendorKeyframes(css) {
1808
- if (!css.includes("@theme") || !css.includes("@-")) return css;
1809
- let root;
1950
+ function collectSeenCandidates(generated, requestedCandidates) {
1951
+ return new Set([
1952
+ ...requestedCandidates,
1953
+ ...generated.rawCandidates,
1954
+ ...generated.classSet
1955
+ ]);
1956
+ }
1957
+ function createIncrementalStyleOptions(styleOptions) {
1958
+ return {
1959
+ ...styleOptions,
1960
+ isMainChunk: false
1961
+ };
1962
+ }
1963
+ function resolveStyleOptions$1(source, options) {
1964
+ return hasCssMacroTailwindV4Directive(source.css) ? withCssMacroStyleOptions(options) : options;
1965
+ }
1966
+ function collectCustomPropertyValues(css) {
1967
+ const values = /* @__PURE__ */ new Map();
1810
1968
  try {
1811
- root = postcss.parse(css);
1812
- } catch {
1813
- return css;
1814
- }
1815
- let changed = false;
1816
- root.walkAtRules((rule) => {
1817
- if (isVendorPrefixedKeyframes(rule) && hasThemeParent(rule)) {
1818
- rule.remove();
1819
- changed = true;
1820
- }
1969
+ postcss.parse(css).walkDecls((decl) => {
1970
+ if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
1971
+ });
1972
+ } catch {}
1973
+ return values;
1974
+ }
1975
+ function mergeCustomPropertyValues(target, css) {
1976
+ for (const [prop, value] of collectCustomPropertyValues(css)) target.set(prop, value);
1977
+ }
1978
+ function seedIncrementalGenerateCache(options) {
1979
+ const cacheKey = createIncrementalGenerateCacheKey(options.compatibleSource, options.target, options.styleOptions, options.tailwindcssV3Compatibility);
1980
+ const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
1981
+ mergeCustomPropertyValues(customPropertyValues, options.generated.css);
1982
+ incrementalGenerateCache$1.set(cacheKey, {
1983
+ seenCandidates: collectSeenCandidates(options.generated, options.requestedCandidates),
1984
+ classSet: new Set(options.generated.classSet),
1985
+ css: options.generated.css,
1986
+ rawCss: options.generated.rawCss,
1987
+ customPropertyValues,
1988
+ designSystemPromise: createIncrementalDesignSystemPromise(options.compatibleSource, cacheKey),
1989
+ dependencies: options.generated.dependencies,
1990
+ sources: options.generated.sources,
1991
+ root: options.generated.root,
1992
+ target: options.generated.target
1821
1993
  });
1822
- return changed ? root.toString() : css;
1823
1994
  }
1824
1995
  function createTailwindV4Engine$1(source) {
1825
1996
  async function generateOnce(generateSource, options = {}) {
@@ -1827,8 +1998,8 @@ function createTailwindV4Engine$1(source) {
1827
1998
  const resolvedStyleOptions = resolveStyleOptions$1(generateSource, styleOptions);
1828
1999
  const engine = createTailwindV4Engine(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
1829
2000
  const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
1830
- const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await extractRawCandidates(resolvedScanSources, { bareArbitraryValues: patchOptions.bareArbitraryValues })) : void 0;
1831
- const normalizedCandidates = normalizeRpxTextCandidates(resolveTargetCandidates(new Set([...collectCandidates$1(patchOptions.candidates), ...filesystemCandidates ?? []]), target));
2001
+ const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await extractRawCandidates(resolvedScanSources, { ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues } })) : void 0;
2002
+ const normalizedCandidates = normalizeRpxTextCandidates(resolveTargetCandidates(new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target));
1832
2003
  const result = await engine.generate(omitUndefined({
1833
2004
  scanSources: false,
1834
2005
  ...patchOptions,
@@ -1851,7 +2022,7 @@ function createTailwindV4Engine$1(source) {
1851
2022
  const requestedCandidates = resolveTargetCandidates(options.candidates, target);
1852
2023
  const styleOptions = resolveStyleOptions$1(source, options.styleOptions);
1853
2024
  if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(source, options);
1854
- const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target, styleOptions, options.tailwindcssV3Compatibility);
2025
+ const cacheKey = createIncrementalGenerateCacheKey(compatibleSource, target, styleOptions, options.tailwindcssV3Compatibility);
1855
2026
  if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1856
2027
  const generated = await generateOnce(source, options);
1857
2028
  seedIncrementalGenerateCache({
@@ -2040,109 +2211,48 @@ function hasTailwindGeneratedCssMarkers(rawSource) {
2040
2211
  return TAILWIND_GENERATED_CSS_MARKER_RE.test(rawSource) || GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource);
2041
2212
  }
2042
2213
  //#endregion
2043
- //#region src/bundlers/shared/generator-css/directives.ts
2044
- const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
2045
- "config",
2046
- "custom-variant",
2047
- "layer",
2048
- "plugin",
2049
- "reference",
2050
- "source",
2051
- "tailwind",
2052
- "theme",
2053
- "utility",
2054
- "variant"
2055
- ]);
2056
- const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
2057
- "config",
2058
- "custom-variant",
2059
- "plugin",
2060
- "source",
2061
- "tailwind",
2062
- "theme",
2063
- "utility",
2064
- "variant"
2065
- ]);
2066
- 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/;
2214
+ //#region src/bundlers/shared/generator-css/directives/fallback.ts
2067
2215
  const TAILWIND_EXTRACTABLE_DIRECTIVE_RE = /^\s*@(?:import|use|forward|tailwind|config|source|reference|plugin)\b[\s\S]*?(?:;|$)/;
2068
2216
  const TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE = /^\s*@layer\s[^;{]+;\s*$/;
2069
2217
  const TAILWIND_EXTRACTABLE_BLOCK_START_RE = /^\s*@(?:layer|theme|utility|variant|custom-variant|plugin)\b[\s\S]*\{/;
2070
- const TAILWIND_V3_SUBPATH_IMPORT_LAYERS = new Map([
2071
- ["tailwindcss/base", "base"],
2072
- ["tailwindcss/components", "components"],
2073
- ["tailwindcss/utilities", "utilities"]
2074
- ]);
2075
- function parseImportRequest(params) {
2218
+ function parseImportRequest$1(params) {
2076
2219
  return /^(?:url\(\s*)?(["']?)([^"')\s]+)\1\s*\)?/.exec(params.trim())?.[2];
2077
2220
  }
2078
- function hasLocalCssImport(rawSource) {
2079
- let found = false;
2080
- try {
2081
- postcss.parse(rawSource).walkAtRules("import", (rule) => {
2082
- const request = parseImportRequest(rule.params);
2083
- if (request?.startsWith(".") === true || request?.startsWith("/") === true) {
2084
- found = true;
2085
- return false;
2086
- }
2087
- });
2088
- } catch {}
2089
- return found;
2090
- }
2091
- function parseConfigRequest(params) {
2221
+ function parseConfigRequest$1(params) {
2092
2222
  return /^(["'])(.+)\1\s*;?$/.exec(params.trim())?.[2];
2093
2223
  }
2094
- function isPackageJsonImportRequest(request) {
2224
+ function isPackageJsonImportRequest$1(request) {
2095
2225
  return typeof request === "string" && request.startsWith("#");
2096
2226
  }
2097
- function isWeappTailwindcssImportRequest(request) {
2227
+ function isWeappTailwindcssImportRequest$1(request) {
2098
2228
  return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
2099
2229
  }
2100
- function normalizeTailwindImportRequest(request, options = {}) {
2101
- if (options.importFallback && isWeappTailwindcssImportRequest(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
2230
+ function isTailwindImportRequest$1(request) {
2231
+ return request === "tailwindcss" || request === "tailwindcss4" || request?.startsWith("tailwindcss/") || request?.startsWith("tailwindcss4/");
2232
+ }
2233
+ function normalizeTailwindImportRequest$1(request, options = {}) {
2234
+ if (options.importFallback && isWeappTailwindcssImportRequest$1(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
2102
2235
  return request;
2103
2236
  }
2104
- function replaceImportRequest(params, request, replacement) {
2237
+ function replaceImportRequest$1(params, request, replacement) {
2105
2238
  const index = params.indexOf(request);
2106
2239
  if (index === -1) return params;
2107
2240
  return `${params.slice(0, index)}${replacement}${params.slice(index + request.length)}`;
2108
2241
  }
2109
- function normalizeTailwindImportAtRules(root, options = {}) {
2110
- if (!options.importFallback) return false;
2111
- let changed = false;
2112
- const seenCanonicalImports = /* @__PURE__ */ new Set();
2113
- root.walkAtRules("import", (node) => {
2114
- const request = parseImportRequest(node.params);
2115
- const normalizedRequest = normalizeTailwindImportRequest(request, options);
2116
- if (!normalizedRequest || !isTailwindImportRequest(normalizedRequest)) return;
2117
- const normalizedParams = request && normalizedRequest !== request ? replaceImportRequest(node.params, request, normalizedRequest) : node.params;
2118
- const normalizedKey = normalizedParams.trim();
2119
- if (seenCanonicalImports.has(normalizedKey)) {
2120
- node.remove();
2121
- changed = true;
2122
- return;
2123
- }
2124
- seenCanonicalImports.add(normalizedKey);
2125
- if (normalizedParams !== node.params) {
2126
- node.params = normalizedParams;
2127
- changed = true;
2128
- }
2129
- });
2130
- return changed;
2131
- }
2132
2242
  function normalizeTailwindDirectiveLine(line, options = {}) {
2133
2243
  const trimmed = line.trimStart();
2134
2244
  if (/^@(?:use|forward)\b/.test(trimmed)) {
2135
- const request = parseImportRequest(trimmed.replace(/^@(?:use|forward)\b/, ""));
2136
- if (isTailwindImportRequest(request) || options.importFallback && isWeappTailwindcssImportRequest(request)) {
2137
- const normalizedRequest = normalizeTailwindImportRequest(request, options);
2138
- return replaceImportRequest(line.replace(/^(\s*)@(?:use|forward)\b/, "$1@import"), request, normalizedRequest);
2245
+ const request = parseImportRequest$1(trimmed.replace(/^@(?:use|forward)\b/, ""));
2246
+ if (isTailwindImportRequest$1(request) || options.importFallback && isWeappTailwindcssImportRequest$1(request)) {
2247
+ const normalizedRequest = normalizeTailwindImportRequest$1(request, options);
2248
+ return replaceImportRequest$1(line.replace(/^(\s*)@(?:use|forward)\b/, "$1@import"), request, normalizedRequest);
2139
2249
  }
2140
2250
  return line;
2141
2251
  }
2142
2252
  if (!options.importFallback || !trimmed.startsWith("@import")) return line;
2143
- const request = parseImportRequest(trimmed.replace(/^@import\b/, ""));
2144
- if (!request || !isWeappTailwindcssImportRequest(request)) return line;
2145
- return replaceImportRequest(line, request, request.replace(/^weapp-tailwindcss/, "tailwindcss"));
2253
+ const request = parseImportRequest$1(trimmed.replace(/^@import\b/, ""));
2254
+ if (!request || !isWeappTailwindcssImportRequest$1(request)) return line;
2255
+ return replaceImportRequest$1(line, request, request.replace(/^weapp-tailwindcss/, "tailwindcss"));
2146
2256
  }
2147
2257
  function extractTailwindDirectiveLines(rawSource, options = {}) {
2148
2258
  const directives = [];
@@ -2156,10 +2266,10 @@ function extractTailwindDirectiveLines(rawSource, options = {}) {
2156
2266
  const normalized = normalizeTailwindDirectiveLine(directive.trimEnd(), options);
2157
2267
  const normalizedTrimmed = normalized.trim();
2158
2268
  if (options.removeConfig && normalizedTrimmed.startsWith("@config")) continue;
2159
- const request = /^@(?:import|use|forward)\b/.test(normalizedTrimmed) ? parseImportRequest(normalizedTrimmed.replace(/^@(?:import|use|forward)\b/, "")) : void 0;
2160
- if (request && !isTailwindImportRequest(request) && !isPackageJsonImportRequest(request)) continue;
2269
+ const request = /^@(?:import|use|forward)\b/.test(normalizedTrimmed) ? parseImportRequest$1(normalizedTrimmed.replace(/^@(?:import|use|forward)\b/, "")) : void 0;
2270
+ if (request && !isTailwindImportRequest$1(request) && !isPackageJsonImportRequest$1(request)) continue;
2161
2271
  if (/^@(?:import|use|forward)\b/.test(normalizedTrimmed) && !request) continue;
2162
- if (request && isTailwindImportRequest(request)) {
2272
+ if (request && isTailwindImportRequest$1(request)) {
2163
2273
  const key = normalizedTrimmed;
2164
2274
  if (seenImports.has(key)) continue;
2165
2275
  seenImports.add(key);
@@ -2255,10 +2365,97 @@ function extractTailwindSourceForPostcssFallback(rawSource, options = {}) {
2255
2365
  function extractConfigRequestFromSource(rawSource) {
2256
2366
  for (const line of rawSource.split(/\r?\n/)) {
2257
2367
  const match = /^\s*@config\b([\s\S]*?)(?:;|$)/.exec(line);
2258
- const request = match ? parseConfigRequest(match[1] ?? "") : void 0;
2368
+ const request = match ? parseConfigRequest$1(match[1] ?? "") : void 0;
2259
2369
  if (request) return request;
2260
2370
  }
2261
2371
  }
2372
+ //#endregion
2373
+ //#region src/bundlers/shared/generator-css/directives.ts
2374
+ const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
2375
+ "config",
2376
+ "custom-variant",
2377
+ "layer",
2378
+ "plugin",
2379
+ "reference",
2380
+ "source",
2381
+ "tailwind",
2382
+ "theme",
2383
+ "utility",
2384
+ "variant"
2385
+ ]);
2386
+ const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
2387
+ "config",
2388
+ "custom-variant",
2389
+ "plugin",
2390
+ "source",
2391
+ "tailwind",
2392
+ "theme",
2393
+ "utility",
2394
+ "variant"
2395
+ ]);
2396
+ 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/;
2397
+ const TAILWIND_V3_SUBPATH_IMPORT_LAYERS = new Map([
2398
+ ["tailwindcss/base", "base"],
2399
+ ["tailwindcss/components", "components"],
2400
+ ["tailwindcss/utilities", "utilities"]
2401
+ ]);
2402
+ function parseImportRequest(params) {
2403
+ return /^(?:url\(\s*)?(["']?)([^"')\s]+)\1\s*\)?/.exec(params.trim())?.[2];
2404
+ }
2405
+ function hasLocalCssImport(rawSource) {
2406
+ let found = false;
2407
+ try {
2408
+ postcss.parse(rawSource).walkAtRules("import", (rule) => {
2409
+ const request = parseImportRequest(rule.params);
2410
+ if (request?.startsWith(".") === true || request?.startsWith("/") === true) {
2411
+ found = true;
2412
+ return false;
2413
+ }
2414
+ });
2415
+ } catch {}
2416
+ return found;
2417
+ }
2418
+ function parseConfigRequest(params) {
2419
+ return /^(["'])(.+)\1\s*;?$/.exec(params.trim())?.[2];
2420
+ }
2421
+ function isPackageJsonImportRequest(request) {
2422
+ return typeof request === "string" && request.startsWith("#");
2423
+ }
2424
+ function isWeappTailwindcssImportRequest(request) {
2425
+ return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
2426
+ }
2427
+ function normalizeTailwindImportRequest(request, options = {}) {
2428
+ if (options.importFallback && isWeappTailwindcssImportRequest(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
2429
+ return request;
2430
+ }
2431
+ function replaceImportRequest(params, request, replacement) {
2432
+ const index = params.indexOf(request);
2433
+ if (index === -1) return params;
2434
+ return `${params.slice(0, index)}${replacement}${params.slice(index + request.length)}`;
2435
+ }
2436
+ function normalizeTailwindImportAtRules(root, options = {}) {
2437
+ if (!options.importFallback) return false;
2438
+ let changed = false;
2439
+ const seenCanonicalImports = /* @__PURE__ */ new Set();
2440
+ root.walkAtRules("import", (node) => {
2441
+ const request = parseImportRequest(node.params);
2442
+ const normalizedRequest = normalizeTailwindImportRequest(request, options);
2443
+ if (!normalizedRequest || !isTailwindImportRequest(normalizedRequest)) return;
2444
+ const normalizedParams = request && normalizedRequest !== request ? replaceImportRequest(node.params, request, normalizedRequest) : node.params;
2445
+ const normalizedKey = normalizedParams.trim();
2446
+ if (seenCanonicalImports.has(normalizedKey)) {
2447
+ node.remove();
2448
+ changed = true;
2449
+ return;
2450
+ }
2451
+ seenCanonicalImports.add(normalizedKey);
2452
+ if (normalizedParams !== node.params) {
2453
+ node.params = normalizedParams;
2454
+ changed = true;
2455
+ }
2456
+ });
2457
+ return changed;
2458
+ }
2262
2459
  function resolveConfigPath$1(base, configPath) {
2263
2460
  if (path.isAbsolute(configPath) || isPackageJsonImportRequest(configPath)) return path.isAbsolute(configPath) ? configPath : void 0;
2264
2461
  return path.resolve(base, configPath);
@@ -2838,7 +3035,15 @@ function readStaticConfigContent(configPath) {
2838
3035
  return parseStaticContentValue(source, contentProperty.start)?.value;
2839
3036
  }
2840
3037
  //#endregion
2841
- //#region src/bundlers/vite/source-scan.ts
3038
+ //#region src/bundlers/vite/source-scan/dependencies.ts
3039
+ function addSourceScanDependency(dependencies, file) {
3040
+ if (typeof file === "string" && file.length > 0) dependencies.add(path.resolve(file));
3041
+ }
3042
+ function addSourceScanDependencies(dependencies, files) {
3043
+ for (const file of files ?? []) addSourceScanDependency(dependencies, file);
3044
+ }
3045
+ //#endregion
3046
+ //#region src/bundlers/vite/source-scan/css-entries.ts
2842
3047
  const VITE_SOURCE_CANDIDATE_PATTERN = FULL_SOURCE_SCAN_PATTERN;
2843
3048
  const VITE_TAILWIND_CSS_ENTRY_PATTERN = "**/*.{css,less,sass,scss,styl,stylus,pcss,postcss}";
2844
3049
  const tailwindV4CssEntriesCache = /* @__PURE__ */ new Map();
@@ -2875,23 +3080,6 @@ function createCssEntriesCacheKey(css, base, dependencies) {
2875
3080
  dependencies
2876
3081
  });
2877
3082
  }
2878
- function addSourceScanDependency(dependencies, file) {
2879
- if (typeof file === "string" && file.length > 0) dependencies.add(path.resolve(file));
2880
- }
2881
- function addSourceScanDependencies(dependencies, files) {
2882
- for (const file of files ?? []) addSourceScanDependency(dependencies, file);
2883
- }
2884
- function createResolvedViteSourceScan(input, dependencies) {
2885
- return {
2886
- ...input,
2887
- ...dependencies.size > 0 ? { dependencies: [...dependencies].sort() } : {}
2888
- };
2889
- }
2890
- function createMergedCssEntrySourceScanEntries(entries, options) {
2891
- if (options.sourceCount <= 1) return entries;
2892
- const positiveEntries = entries.filter((entry) => !entry.negated);
2893
- return positiveEntries.length > 0 ? positiveEntries : entries;
2894
- }
2895
3083
  async function statConfigDependency(file) {
2896
3084
  try {
2897
3085
  const stats = await stat(file);
@@ -3105,6 +3293,26 @@ async function discoverTailwindV4CssEntries(root, outDir) {
3105
3293
  function collectConfiguredCssSources(options) {
3106
3294
  return [...options.tailwindcss?.v4?.cssSources ?? [], ...options.tailwindcssPatcherOptions?.tailwindcss?.v4?.cssSources ?? []];
3107
3295
  }
3296
+ //#endregion
3297
+ //#region src/bundlers/vite/source-scan.ts
3298
+ function createResolvedViteSourceScan(input, dependencies) {
3299
+ return {
3300
+ ...input,
3301
+ ...dependencies.size > 0 ? { dependencies: [...dependencies].sort() } : {}
3302
+ };
3303
+ }
3304
+ function createMergedCssEntrySourceScanEntries(entries, options) {
3305
+ if (options.sourceCount <= 1) return entries;
3306
+ const positiveEntries = entries.filter((entry) => !entry.negated);
3307
+ return positiveEntries.length > 0 ? positiveEntries : entries;
3308
+ }
3309
+ function createResolvedV4CssScanInput(entries, inlineCandidates, explicit) {
3310
+ return {
3311
+ entries: explicit ? entries : entries.length > 0 ? entries : void 0,
3312
+ explicit,
3313
+ inlineCandidates
3314
+ };
3315
+ }
3108
3316
  async function resolveViteSourceScanEntries(options, patcher, scanOptions = {}) {
3109
3317
  if (patcher.majorVersion === 3) {
3110
3318
  const [source, cssEntryScan] = await Promise.all([resolveTailwindV3SourceFromPatcher(patcher), resolveTailwindV3CssEntryScan(options, patcher)]);
@@ -3156,11 +3364,7 @@ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {})
3156
3364
  }, dependencies);
3157
3365
  if (typeof sourceOptions.css === "string" && sourceOptions.css.length > 0) {
3158
3366
  const resolved = await resolveTailwindV4EntriesFromCssCached(sourceOptions.css, sourceOptions.base ?? sourceOptions.projectRoot ?? process.cwd());
3159
- return resolved ? createResolvedViteSourceScan({
3160
- entries: resolved.explicit ? resolved.entries : resolved.entries.length > 0 ? resolved.entries : void 0,
3161
- explicit: resolved.explicit,
3162
- inlineCandidates: resolved.inlineCandidates
3163
- }, new Set(resolved.dependencies)) : void 0;
3367
+ return resolved ? createResolvedViteSourceScan(createResolvedV4CssScanInput(resolved.entries, resolved.inlineCandidates, resolved.explicit), new Set(resolved.dependencies)) : void 0;
3164
3368
  }
3165
3369
  const sourceOptionBase = sourceOptions.base ?? sourceOptions.projectRoot ?? process.cwd();
3166
3370
  const configuredCssSources = collectConfiguredCssSources(options);
@@ -3187,11 +3391,7 @@ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {})
3187
3391
  addSourceScanDependency(dependencies, source.file);
3188
3392
  addSourceScanDependencies(dependencies, source.dependencies);
3189
3393
  const resolved = await resolveTailwindV4EntriesFromCssCached(source.css, source.base);
3190
- return resolved ? createResolvedViteSourceScan({
3191
- entries: resolved.explicit ? resolved.entries : resolved.entries.length > 0 ? resolved.entries : void 0,
3192
- explicit: resolved.explicit,
3193
- inlineCandidates: resolved.inlineCandidates
3194
- }, new Set([...dependencies, ...resolved.dependencies])) : void 0;
3394
+ return resolved ? createResolvedViteSourceScan(createResolvedV4CssScanInput(resolved.entries, resolved.inlineCandidates, resolved.explicit), new Set([...dependencies, ...resolved.dependencies])) : void 0;
3195
3395
  }
3196
3396
  }
3197
3397
  function createViteSourceScanMatcher(entries) {
@@ -3405,6 +3605,40 @@ async function ensureTailwindcssRuntimePatch(twPatcher, options = {}) {
3405
3605
  return task;
3406
3606
  }
3407
3607
  //#endregion
3608
+ //#region src/tailwindcss/v3-engine/generator/runtime-ready.ts
3609
+ const runtimeReadyPromiseCache = /* @__PURE__ */ new Map();
3610
+ function createRuntimeReadyCacheKey(source, rootPath) {
3611
+ return [
3612
+ source.packageName,
3613
+ source.postcssPlugin,
3614
+ rootPath ?? "missing",
3615
+ source.config ?? "config:missing",
3616
+ source.cwd
3617
+ ].join("\0");
3618
+ }
3619
+ function createRuntimeReadyPromise(source) {
3620
+ const patcher = createTailwindcssPatcher({
3621
+ basedir: source.cwd,
3622
+ supportCustomLengthUnitsPatch: true,
3623
+ tailwindcss: {
3624
+ ...source.config === void 0 ? {} : { config: source.config },
3625
+ cwd: source.cwd,
3626
+ packageName: source.packageName,
3627
+ postcssPlugin: source.postcssPlugin,
3628
+ version: 3
3629
+ }
3630
+ });
3631
+ const cacheKey = createRuntimeReadyCacheKey(source, patcher.packageInfo?.rootPath);
3632
+ const cached = runtimeReadyPromiseCache.get(cacheKey);
3633
+ if (cached) return cached;
3634
+ const task = ensureTailwindcssRuntimePatch(patcher, { clearRequireCache: true }).catch((error) => {
3635
+ runtimeReadyPromiseCache.delete(cacheKey);
3636
+ throw error;
3637
+ });
3638
+ runtimeReadyPromiseCache.set(cacheKey, task);
3639
+ return task;
3640
+ }
3641
+ //#endregion
3408
3642
  //#region src/tailwindcss/v3-engine/miniprogram.ts
3409
3643
  const defaultStyleHandler = createStyleHandler({
3410
3644
  cssChildCombinatorReplaceValue: ["view", "text"],
@@ -3486,32 +3720,13 @@ async function transformTailwindV3CssByTarget(css, target, options) {
3486
3720
  }
3487
3721
  //#endregion
3488
3722
  //#region src/tailwindcss/v3-engine/generator.ts
3489
- const runtimeReadyPromiseCache = /* @__PURE__ */ new Map();
3490
3723
  const incrementalGenerateCache = /* @__PURE__ */ new Map();
3491
- function isLegacyContentObject(value) {
3492
- return typeof value === "object" && value !== null && "files" in value;
3493
- }
3494
- function createRawContentEntries(candidates, sources) {
3495
- const entries = [];
3496
- const candidateContent = [...candidates].join(" ");
3497
- if (candidateContent.length > 0) entries.push({
3498
- raw: candidateContent,
3499
- extension: "html"
3500
- });
3501
- for (const source of sources) entries.push({
3502
- raw: source.content,
3503
- extension: source.extension ?? "html"
3504
- });
3505
- return entries;
3506
- }
3507
- function createChangedContentEntries(candidates, sources) {
3508
- return createRawContentEntries(candidates, sources).map((entry) => ({
3509
- content: entry.raw,
3510
- extension: entry.extension
3511
- }));
3512
- }
3513
- function collectCandidates(candidates) {
3514
- return new Set(candidates ?? []);
3724
+ const patchRawStyleGenerator = typeof tailwindcssPatch.generateTailwindV3RawStyle === "function" ? tailwindcssPatch.generateTailwindV3RawStyle : void 0;
3725
+ function isTailwindV3PatchResolutionError(error, packageName) {
3726
+ if (!error || typeof error !== "object") return false;
3727
+ const code = error.code;
3728
+ if (code !== "MODULE_NOT_FOUND" && code !== "ERR_PACKAGE_PATH_NOT_EXPORTED") return false;
3729
+ return String(error.message ?? "").includes(`${packageName}/lib/`);
3515
3730
  }
3516
3731
  function normalizeBareArbitraryValueCandidate(candidate, bareArbitraryValues) {
3517
3732
  return resolveBareArbitraryValueCandidate(candidate, bareArbitraryValues)?.canonicalCandidate ?? candidate;
@@ -3532,7 +3747,7 @@ function normalizeBareArbitraryValueCandidates(candidates, bareArbitraryValues)
3532
3747
  async function collectSourceBareArbitraryValueCandidates(sources, bareArbitraryValues) {
3533
3748
  if (!isBareArbitraryValuesEnabled(bareArbitraryValues)) return [];
3534
3749
  const candidates = /* @__PURE__ */ new Set();
3535
- for (const source of sources ?? []) for (const candidate of await extractSourceCandidates(source.content, source.extension ?? "html", { bareArbitraryValues })) if (resolveBareArbitraryValueCandidate(candidate, bareArbitraryValues)) candidates.add(candidate);
3750
+ for (const source of sources ?? []) for (const candidate of await extractSourceCandidates(source.content, source.extension ?? "html", omitUndefined({ bareArbitraryValues }))) if (resolveBareArbitraryValueCandidate(candidate, bareArbitraryValues)) candidates.add(candidate);
3536
3751
  return [...candidates];
3537
3752
  }
3538
3753
  function escapeCssClassSelector(className) {
@@ -3568,99 +3783,6 @@ function hasRemovedCandidates(previousCandidates, nextCandidates) {
3568
3783
  for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
3569
3784
  return false;
3570
3785
  }
3571
- function collectApplyCandidatesFromCss(css) {
3572
- if (!css.includes("@apply")) return [];
3573
- const candidates = /* @__PURE__ */ new Set();
3574
- try {
3575
- postcss.parse(css).walkAtRules("apply", (rule) => {
3576
- for (const candidate of rule.params.split(/\s+/)) {
3577
- const normalized = candidate.replace(/!important$/, "").trim();
3578
- if (normalized) candidates.add(normalized);
3579
- }
3580
- });
3581
- } catch {}
3582
- return [...candidates];
3583
- }
3584
- function isTailwindCandidateLayer(params) {
3585
- return params.split(/[,\s]+/).some((layer) => layer === "components" || layer === "utilities");
3586
- }
3587
- function extractClassCandidatesFromSelector(selector, candidates) {
3588
- for (let index = 0; index < selector.length; index++) {
3589
- if (selector[index] !== ".") continue;
3590
- let candidate = "";
3591
- let escaped = false;
3592
- for (let tokenIndex = index + 1; tokenIndex < selector.length; tokenIndex++) {
3593
- const char = selector[tokenIndex];
3594
- if (escaped) {
3595
- candidate += char;
3596
- escaped = false;
3597
- continue;
3598
- }
3599
- if (char === "\\") {
3600
- escaped = true;
3601
- continue;
3602
- }
3603
- if (char && /[\w-]/.test(char)) {
3604
- candidate += char;
3605
- continue;
3606
- }
3607
- break;
3608
- }
3609
- if (candidate) candidates.add(candidate);
3610
- }
3611
- }
3612
- function collectLayerCandidatesFromCss(css) {
3613
- if (!css.includes("@layer")) return [];
3614
- const candidates = /* @__PURE__ */ new Set();
3615
- try {
3616
- postcss.parse(css).walkAtRules("layer", (layer) => {
3617
- if (!isTailwindCandidateLayer(layer.params)) return;
3618
- layer.walkRules((rule) => {
3619
- extractClassCandidatesFromSelector(rule.selector, candidates);
3620
- });
3621
- });
3622
- } catch {}
3623
- return [...candidates];
3624
- }
3625
- function mergeGenerateCandidates(source, options) {
3626
- return collectCandidates([
3627
- ...collectLayerCandidatesFromCss(source.css),
3628
- ...collectApplyCandidatesFromCss(source.css),
3629
- ...collectCandidates(options.candidates)
3630
- ]);
3631
- }
3632
- function mergeContent(content, rawEntries) {
3633
- if (isLegacyContentObject(content)) return {
3634
- ...content,
3635
- relative: content.relative ?? true,
3636
- files: [...[].concat(content.files ?? []), ...rawEntries]
3637
- };
3638
- return {
3639
- relative: true,
3640
- files: [...[].concat(content ?? []), ...rawEntries]
3641
- };
3642
- }
3643
- function normalizeConfigObject(config) {
3644
- if (!config || typeof config !== "object") return config;
3645
- const maybeDefault = config.default;
3646
- if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
3647
- return config;
3648
- }
3649
- function hasExplicitContentInput(options) {
3650
- return options.candidates !== void 0 || options.sources !== void 0;
3651
- }
3652
- function createExplicitContentConfig(rawEntries) {
3653
- return {
3654
- relative: true,
3655
- files: rawEntries
3656
- };
3657
- }
3658
- function createTailwindConfig(source, options) {
3659
- const config = { ...normalizeConfigObject(source.configObject) ?? {} };
3660
- const rawEntries = createRawContentEntries(mergeGenerateCandidates(source, options), options.sources ?? []);
3661
- config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
3662
- return config;
3663
- }
3664
3786
  function shouldAutoEnableCssMacro(source) {
3665
3787
  return hasCssMacroTailwindPlugin(normalizeConfigObject(source.configObject)?.plugins);
3666
3788
  }
@@ -3700,48 +3822,6 @@ function loadTailwindV3Internals(source) {
3700
3822
  validateConfig: validateConfigModule["validateConfig"]
3701
3823
  };
3702
3824
  }
3703
- function createStableJson(value) {
3704
- if (value === void 0) return "undefined";
3705
- if (value === null || typeof value !== "object") return JSON.stringify(value);
3706
- if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
3707
- return `{${Object.keys(value).sort().map((key) => {
3708
- const record = value;
3709
- return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
3710
- }).join(",")}}`;
3711
- }
3712
- function createDependencyFingerprint(files) {
3713
- return files.map((file) => {
3714
- try {
3715
- const stat = fs.statSync(file);
3716
- return `${file}:${stat.size}:${stat.mtimeMs}`;
3717
- } catch {
3718
- return `${file}:missing`;
3719
- }
3720
- }).join("|");
3721
- }
3722
- function createIncrementalGenerateCacheKey(source, target, styleOptions, bareArbitraryValues) {
3723
- return [
3724
- source.packageName,
3725
- source.postcssPlugin,
3726
- source.cwd,
3727
- source.config ?? "config:missing",
3728
- createDependencyFingerprint(source.dependencies),
3729
- source.css,
3730
- createStableJson(normalizeConfigObject(source.configObject)?.content),
3731
- target,
3732
- createStableJson(styleOptions),
3733
- createStableJson(bareArbitraryValues)
3734
- ].join("\0");
3735
- }
3736
- function createRuntimeReadyCacheKey(source, rootPath) {
3737
- return [
3738
- source.packageName,
3739
- source.postcssPlugin,
3740
- rootPath ?? "missing",
3741
- source.config ?? "config:missing",
3742
- source.cwd
3743
- ].join("\0");
3744
- }
3745
3825
  function isDirectUtilitiesOnlyCss(css) {
3746
3826
  return css.replace(/\s+/g, "") === "@tailwindutilities;";
3747
3827
  }
@@ -3774,27 +3854,25 @@ function appendUtilityRules(root, context, rules) {
3774
3854
  function appendDirectUtilityRules(root, context) {
3775
3855
  appendUtilityRules(root, context, [...context.ruleCache]);
3776
3856
  }
3777
- function createRuntimeReadyPromise(source) {
3778
- const patcher = createTailwindcssPatcher({
3779
- basedir: source.cwd,
3780
- supportCustomLengthUnitsPatch: true,
3781
- tailwindcss: {
3782
- ...source.config === void 0 ? {} : { config: source.config },
3783
- cwd: source.cwd,
3784
- packageName: source.packageName,
3785
- postcssPlugin: source.postcssPlugin,
3786
- version: 3
3787
- }
3788
- });
3789
- const cacheKey = createRuntimeReadyCacheKey(source, patcher.packageInfo?.rootPath);
3790
- const cached = runtimeReadyPromiseCache.get(cacheKey);
3791
- if (cached) return cached;
3792
- const task = ensureTailwindcssRuntimePatch(patcher, { clearRequireCache: true }).catch((error) => {
3793
- runtimeReadyPromiseCache.delete(cacheKey);
3857
+ async function generateRawStyleWithPatch(generateSource, candidates, sources) {
3858
+ if (!patchRawStyleGenerator) return;
3859
+ try {
3860
+ return await patchRawStyleGenerator({
3861
+ cwd: generateSource.cwd,
3862
+ packageName: generateSource.packageName,
3863
+ css: generateSource.css,
3864
+ candidates,
3865
+ sources,
3866
+ config: createTailwindConfig(generateSource, {
3867
+ candidates,
3868
+ sources
3869
+ }),
3870
+ directUtilitiesOnly: "auto"
3871
+ });
3872
+ } catch (error) {
3873
+ if (isTailwindV3PatchResolutionError(error, generateSource.packageName)) return;
3794
3874
  throw error;
3795
- });
3796
- runtimeReadyPromiseCache.set(cacheKey, task);
3797
- return task;
3875
+ }
3798
3876
  }
3799
3877
  function createTailwindV3Engine(source) {
3800
3878
  const runtimeReadyPromise = createRuntimeReadyPromise(source);
@@ -3821,23 +3899,32 @@ function createTailwindV3Engine(source) {
3821
3899
  messages: []
3822
3900
  };
3823
3901
  let context;
3824
- if (isDirectUtilitiesOnlyCss(generateSource.css)) {
3825
- context = internals.createContext(tailwindConfig, changedContent, root);
3826
- internals.generateRules(new Set(sortCandidates([internals.notOnDemandCandidate, ...candidates])), context);
3827
- root.removeAll();
3828
- appendDirectUtilityRules(root, context);
3829
- internals.resolveDefaultsAtRules(context)(root, result);
3830
- internals.collapseAdjacentRules(context)(root, result);
3831
- internals.collapseDuplicateDeclarations(context)(root, result);
3902
+ let rawCss;
3903
+ let dependencies;
3904
+ const patchGenerated = await generateRawStyleWithPatch(generateSource, candidates, options.sources ?? []);
3905
+ if (patchGenerated) {
3906
+ context = patchGenerated.context;
3907
+ rawCss = restoreBareArbitraryValueCssSelectors(patchGenerated.css, requestedCandidates, options.bareArbitraryValues, internals.escapeClassName);
3908
+ dependencies = new Set(patchGenerated.dependencies);
3832
3909
  } else {
3833
- const setupContext = () => {
3834
- return (currentRoot) => internals.createContext(tailwindConfig, changedContent, currentRoot);
3835
- };
3836
- context = await internals.processTailwindFeatures(setupContext)(root, result);
3910
+ if (isDirectUtilitiesOnlyCss(generateSource.css)) {
3911
+ context = internals.createContext(tailwindConfig, changedContent, root);
3912
+ internals.generateRules(new Set(sortCandidates([internals.notOnDemandCandidate, ...candidates])), context);
3913
+ root.removeAll();
3914
+ appendDirectUtilityRules(root, context);
3915
+ internals.resolveDefaultsAtRules(context)(root, result);
3916
+ internals.collapseAdjacentRules(context)(root, result);
3917
+ internals.collapseDuplicateDeclarations(context)(root, result);
3918
+ } else {
3919
+ const setupContext = () => {
3920
+ return (currentRoot) => internals.createContext(tailwindConfig, changedContent, currentRoot);
3921
+ };
3922
+ context = await internals.processTailwindFeatures(setupContext)(root, result);
3923
+ }
3924
+ rawCss = restoreBareArbitraryValueCssSelectors(root.toString(), requestedCandidates, options.bareArbitraryValues, internals.escapeClassName);
3925
+ dependencies = collectDependencyMessages(result);
3837
3926
  }
3838
- const rawCss = restoreBareArbitraryValueCssSelectors(root.toString(), requestedCandidates, options.bareArbitraryValues, internals.escapeClassName);
3839
3927
  const css = await transformTailwindV3CssByTarget(rawCss, target, resolvedStyleOptions);
3840
- const dependencies = collectDependencyMessages(result);
3841
3928
  for (const dependency of generateSource.dependencies) dependencies.add(dependency);
3842
3929
  const classSet = restoreBareArbitraryValueClassSet(collectClassSet(context), requestedCandidates, options.bareArbitraryValues);
3843
3930
  return {
@@ -3881,7 +3968,7 @@ function createTailwindV3Engine(source) {
3881
3968
  const requestedCandidates = mergeGenerateCandidates(source, options);
3882
3969
  if (requestedCandidates.size === 0) return generateOnce(source, options);
3883
3970
  const styleOptions = resolveStyleOptions(source, options.styleOptions);
3884
- const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions, options.bareArbitraryValues);
3971
+ const cacheKey = createIncrementalGenerateCacheKey$1(source, target, styleOptions, options.bareArbitraryValues);
3885
3972
  const cached = incrementalGenerateCache.get(cacheKey);
3886
3973
  if (cached) {
3887
3974
  if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) {
@@ -4041,4 +4128,4 @@ function resolveTailwindV3SourceFromPatcher(patcher) {
4041
4128
  return resolveTailwindV3Source(resolveTailwindV3SourceOptionsFromPatcher(patcher));
4042
4129
  }
4043
4130
  //#endregion
4044
- export { collectCssInlineSourceCandidates as $, normalizeTailwindV3CssEntrySource as A, splitTailwindV4GeneratedCssBySourceOrder as B, hasLocalCssImport as C, normalizeTailwindConfigDirectives as D, hasTailwindSourceDirectives as E, createCssAppend as F, prependConfigDirective as G, stripTailwindBanner as H, hasTailwindGeneratedCss as I, transformTailwindV4CssToWeapp as J, createTailwindV4Engine$1 as K, hasTailwindGeneratedCssMarkers as L, removeTailwindSourceDirectives as M, resolveCssEntrySource as N, normalizeTailwindSourceDirectives as O, VITE_MARKER_RE as P, FULL_SOURCE_SCAN_EXTENSION_RE as Q, splitGeneratorPlaceholderCssBySourceOrder as R, resolveTailwindV4SourceOptionsFromPatcher as S, hasTailwindRootDirectives as T, stripTailwindBanners as U, stripGeneratorPlaceholderMarkers as V, normalizeConfigDirective as W, loadTailwindV4DesignSystem as X, filterUnsupportedMiniProgramTailwindV4Candidates as Y, DEFAULT_SOURCE_SCAN_EXTENSIONS as Z, resolveViteSourceScanEntries as _, findNearestPackageRoot as _t, transformTailwindV3CssByTarget as a, resolveCssSourceEntries as at, resolveTailwindV4SourceFromPatchOptions as b, getRuntimeClassSetCacheEntry as c, toPosixPath as ct, invalidateRuntimeClassSet as d, readInstalledPackageMajorVersion as dt, createSourceScanPattern as et, runtimeSignaturePatchersSymbol as f, findTailwindConfig as ft, resolveTailwindV4EntriesFromCssCached as g, omitUndefined as gt, resolveTailwindV4EntriesFromCss as h, resolveBooleanObjectOption as ht, createTailwindV3Engine as i, parseConfigParam$1 as it, parseImportRequest as j, normalizeTailwindSourceForGenerator as k, getRuntimeClassSetSignature as l, createDebug as lt, discoverTailwindV4CssEntries as m, normalizeStringListOption as mt, resolveTailwindV3SourceFromPatcher as n, isFileMatchedByTailwindSourceEntries as nt, transformTailwindV3CssToWeapp as o, resolveSourceScanPath as ot, createViteSourceScanMatcher as p, resolveTailwindcssOptions as pt, transformTailwindV4CssByTarget as q, resolveTailwindV3SourceOptionsFromPatcher as r, normalizeLegacyContentEntries as rt, ensureTailwindcssRuntimePatch as s, resolveTailwindV4CssSourceBase as st, resolveTailwindV3Source as t, expandTailwindSourceEntries as tt, getRuntimeClassSetSignatureWithSources as u, createTailwindcssPatcher as ut, resolveViteTailwindV4CssDependencies as v, findWorkspacePackageDir as vt, hasTailwindApplyDirective as w, resolveTailwindV4SourceFromPatcher as x, resolveTailwindV4Source$1 as y, findWorkspaceRoot as yt, splitTailwindGeneratedCssByBanner as z };
4131
+ export { createSourceScanPattern as $, normalizeTailwindV3CssEntrySource as A, splitTailwindV4GeneratedCssBySourceOrder as B, hasLocalCssImport as C, normalizeTailwindConfigDirectives as D, hasTailwindSourceDirectives as E, createCssAppend as F, prependConfigDirective as G, stripTailwindBanner as H, hasTailwindGeneratedCss as I, transformTailwindV4CssToWeapp as J, createTailwindV4Engine$1 as K, hasTailwindGeneratedCssMarkers as L, removeTailwindSourceDirectives as M, resolveCssEntrySource as N, normalizeTailwindSourceDirectives as O, VITE_MARKER_RE as P, FULL_SOURCE_SCAN_EXTENSION_RE as Q, splitGeneratorPlaceholderCssBySourceOrder as R, resolveTailwindV4SourceOptionsFromPatcher as S, hasTailwindRootDirectives as T, stripTailwindBanners as U, stripGeneratorPlaceholderMarkers as V, normalizeConfigDirective as W, loadTailwindV4DesignSystem as X, filterUnsupportedMiniProgramTailwindV4Candidates as Y, DEFAULT_SOURCE_SCAN_EXTENSIONS as Z, resolveTailwindV4EntriesFromCssCached as _, findWorkspacePackageDir as _t, transformTailwindV3CssByTarget as a, resolveSourceScanPath as at, resolveTailwindV4SourceFromPatchOptions as b, getRuntimeClassSetCacheEntry as c, collectCssInlineSourceCandidates as ct, invalidateRuntimeClassSet as d, readInstalledPackageMajorVersion as dt, expandTailwindSourceEntries as et, runtimeSignaturePatchersSymbol as f, findTailwindConfig as ft, resolveTailwindV4EntriesFromCss as g, findNearestPackageRoot as gt, discoverTailwindV4CssEntries as h, resolveBooleanObjectOption as ht, createTailwindV3Engine as i, resolveCssSourceEntries as it, parseImportRequest as j, normalizeTailwindSourceForGenerator as k, getRuntimeClassSetSignature as l, createDebug as lt, resolveViteSourceScanEntries as m, normalizeStringListOption as mt, resolveTailwindV3SourceFromPatcher as n, normalizeLegacyContentEntries as nt, transformTailwindV3CssToWeapp as o, resolveTailwindV4CssSourceBase as ot, createViteSourceScanMatcher as p, resolveTailwindcssOptions as pt, transformTailwindV4CssByTarget as q, resolveTailwindV3SourceOptionsFromPatcher as r, parseConfigParam$1 as rt, ensureTailwindcssRuntimePatch as s, toPosixPath as st, resolveTailwindV3Source as t, isFileMatchedByTailwindSourceEntries as tt, getRuntimeClassSetSignatureWithSources as u, createTailwindcssPatcher as ut, resolveViteTailwindV4CssDependencies as v, findWorkspaceRoot as vt, hasTailwindApplyDirective as w, resolveTailwindV4SourceFromPatcher as x, resolveTailwindV4Source$1 as y, omitUndefined as yt, splitTailwindGeneratedCssByBanner as z };