weapp-tailwindcss 5.0.0-next.9 → 5.0.0

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 (167) hide show
  1. package/README.md +2 -2
  2. package/dist/auto-DEHRmEAx.mjs +200 -0
  3. package/dist/auto-dPpsm6FB.js +238 -0
  4. package/dist/bundle-state-CnaJxkFY.mjs +413 -0
  5. package/dist/bundle-state-DgGEhk_z.js +529 -0
  6. package/dist/bundlers/shared/cache.d.ts +9 -7
  7. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
  8. package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
  9. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  10. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  11. package/dist/bundlers/shared/generator-css/directives.d.ts +11 -3
  12. package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
  13. package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
  14. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
  15. package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
  16. package/dist/bundlers/shared/generator-css.d.ts +6 -2
  17. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  18. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  19. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  20. package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
  21. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
  22. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
  23. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
  24. package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
  25. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
  26. package/dist/bundlers/vite/index.d.ts +5 -2
  27. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  28. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
  29. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
  30. package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
  31. package/dist/bundlers/vite/source-candidates.d.ts +24 -2
  32. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  33. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  34. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
  35. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
  36. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
  37. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  38. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  39. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
  40. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  41. package/dist/cache/index.d.ts +6 -6
  42. package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
  43. package/dist/cli/context.d.ts +1 -11
  44. package/dist/cli/doctor/types.d.ts +11 -11
  45. package/dist/cli/vscode-entry.d.ts +3 -3
  46. package/dist/cli.js +684 -41
  47. package/dist/cli.mjs +682 -40
  48. package/dist/context/runtime-package-replacements.d.ts +2 -0
  49. package/dist/context/style-options.d.ts +3 -0
  50. package/dist/context/tailwindcss.d.ts +1 -1
  51. package/dist/core.js +1 -2
  52. package/dist/core.mjs +1 -1
  53. package/dist/css-macro/auto.d.ts +11 -0
  54. package/dist/css-macro/constants.d.ts +5 -2
  55. package/dist/css-macro/postcss.d.ts +1 -0
  56. package/dist/css-macro/postcss.js +7 -46
  57. package/dist/css-macro/postcss.mjs +2 -46
  58. package/dist/css-macro.js +16 -7
  59. package/dist/css-macro.mjs +15 -6
  60. package/dist/defaults-8xrgzxFY.mjs +151 -0
  61. package/dist/defaults-zKUH2mDe.js +193 -0
  62. package/dist/defaults.js +6 -150
  63. package/dist/defaults.mjs +1 -143
  64. package/dist/escape.js +10 -2
  65. package/dist/escape.mjs +10 -2
  66. package/dist/generator/options.d.ts +11 -6
  67. package/dist/generator/types.d.ts +3 -3
  68. package/dist/generator--0-ekuVO.js +92 -0
  69. package/dist/generator-B76ovqsv.mjs +67 -0
  70. package/dist/generator.js +12 -12
  71. package/dist/generator.mjs +2 -1
  72. package/dist/gulp.js +163 -40
  73. package/dist/gulp.mjs +155 -32
  74. package/dist/incremental-runtime-class-set-CN6K_97P.js +2366 -0
  75. package/dist/incremental-runtime-class-set-x10M9bn_.mjs +2291 -0
  76. package/dist/index.d.ts +2 -1
  77. package/dist/index.js +17 -5
  78. package/dist/index.mjs +6 -5
  79. package/dist/js/babel/cache-options.d.ts +3 -0
  80. package/dist/js/babel/parse.d.ts +7 -4
  81. package/dist/js/precheck.d.ts +2 -2
  82. package/dist/js/replacement-cache.d.ts +5 -0
  83. package/dist/postcss-C7BMYpEF.mjs +169 -0
  84. package/dist/{postcss-w48mGIhe.mjs → postcss-CR9UCaIK.mjs} +54 -114
  85. package/dist/postcss-CiYLsqZn.js +192 -0
  86. package/dist/{postcss-QIXwT40c.js → postcss-hYimKoN_.js} +60 -121
  87. package/dist/postcss-html-transform.js +1 -1
  88. package/dist/postcss.js +1 -1
  89. package/dist/postcss.mjs +1 -1
  90. package/dist/precheck-BrNwLG2e.mjs +4716 -0
  91. package/dist/precheck-DPtJjZmV.js +4842 -0
  92. package/dist/presets/index.d.ts +1 -0
  93. package/dist/presets/uni-app-x.d.ts +1 -0
  94. package/dist/presets.js +27 -13
  95. package/dist/presets.mjs +25 -13
  96. package/dist/reset.js +1 -1
  97. package/dist/runtime-registry-DpcR3IHI.js +5496 -0
  98. package/dist/shared/mpx.d.ts +1 -0
  99. package/dist/source-candidates-DN1mihlU.mjs +322 -0
  100. package/dist/source-candidates-DSxme_O2.js +335 -0
  101. package/dist/tailwindcss/miniprogram.d.ts +1 -5
  102. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  103. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  104. package/dist/tailwindcss/runtime.d.ts +9 -9
  105. package/dist/tailwindcss/source-scan.d.ts +35 -0
  106. package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
  107. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  108. package/dist/tailwindcss/v4/patcher.d.ts +1 -1
  109. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  110. package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
  111. package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-DWtPieNE.mjs} +72 -60
  112. package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-glCm_d3H.js} +81 -69
  113. package/dist/typedoc.export.d.ts +1 -1
  114. package/dist/types/index.d.ts +51 -41
  115. package/dist/types/shared.d.ts +3 -0
  116. package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
  117. package/dist/types/user-defined-options/general.d.ts +25 -22
  118. package/dist/types/user-defined-options/important.d.ts +32 -27
  119. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  120. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  121. package/dist/unocss/index.d.ts +2 -0
  122. package/dist/utils/object.d.ts +9 -0
  123. package/dist/utils/options.d.ts +2 -0
  124. package/dist/utils/regex.d.ts +1 -0
  125. package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
  126. package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
  127. package/dist/v3-engine-D3BMLVAN.js +3712 -0
  128. package/dist/v3-engine-DCxNPBVs.mjs +3417 -0
  129. package/dist/vite-DOprpdH-.mjs +24493 -0
  130. package/dist/vite-Ec0uX6kF.js +24507 -0
  131. package/dist/vite.js +1 -1
  132. package/dist/vite.mjs +1 -1
  133. package/dist/weapp-tw-css-import-rewrite-loader.js +5444 -22
  134. package/dist/weapp-tw-runtime-classset-loader.js +32 -9
  135. package/dist/{webpack-BzN2ly34.js → webpack-Ccohlg3A.js} +341 -96
  136. package/dist/{webpack-DJazm5sT.mjs → webpack-DFlZcqAU.mjs} +323 -79
  137. package/dist/webpack.d.ts +1 -3
  138. package/dist/webpack.js +3 -4
  139. package/dist/webpack.mjs +2 -2
  140. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
  141. package/package.json +22 -20
  142. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
  143. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
  144. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
  145. package/dist/cache-BVAiJV3J.js +0 -502
  146. package/dist/cache-CHs4DXui.mjs +0 -434
  147. package/dist/constants-BoB_6lFw.js +0 -73
  148. package/dist/constants-E_loJC49.mjs +0 -44
  149. package/dist/generator-DKkhJbOg.js +0 -1531
  150. package/dist/generator-UBmfduYg.mjs +0 -1432
  151. package/dist/generator-css-Bwp3nbrl.js +0 -1381
  152. package/dist/generator-css-DeLLmp2N.mjs +0 -1342
  153. package/dist/lightningcss/index.d.ts +0 -8
  154. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  155. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  156. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  157. package/dist/lightningcss/style-handler.d.ts +0 -17
  158. package/dist/precheck-B32p-gLI.js +0 -2736
  159. package/dist/precheck-B4RH6ZNN.mjs +0 -2622
  160. package/dist/run-tasks-B50A3pxt.js +0 -128
  161. package/dist/run-tasks-DdNi-hkk.mjs +0 -91
  162. package/dist/runtime-patch-CwN5ya72.mjs +0 -71
  163. package/dist/runtime-patch-D6mBo_KB.js +0 -85
  164. package/dist/vite-By5KQi9s.js +0 -2419
  165. package/dist/vite-Cyp42bBf.mjs +0 -2406
  166. /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
  167. /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
@@ -0,0 +1,3417 @@
1
+ import { a as transformCssMacroCss, n as hasCssMacroTailwindPlugin, o as withCssMacroStyleOptions, r as hasCssMacroTailwindV4Directive, t as hasCssMacroStyleOptions } from "./auto-DEHRmEAx.mjs";
2
+ import { createRequire } from "node:module";
3
+ import fs, { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
4
+ import postcss from "postcss";
5
+ import { TailwindcssPatcher, createTailwindV4Engine, extractRawCandidates, extractSourceCandidates, isBareArbitraryValuesEnabled, loadTailwindV4DesignSystem, resolveBareArbitraryValueCandidate, resolveProjectSourceFiles, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions } from "tailwindcss-patch";
6
+ import process from "node:process";
7
+ import path from "node:path";
8
+ import { logger } from "@weapp-tailwindcss/logger";
9
+ import { defuOverrideArray } from "@weapp-tailwindcss/shared";
10
+ import { fileURLToPath } from "node:url";
11
+ import _createDebug from "debug";
12
+ import { stat } from "node:fs/promises";
13
+ import fg from "fast-glob";
14
+ import { loadConfig } from "tailwindcss-config";
15
+ import micromatch from "micromatch";
16
+ import { createStyleHandler, protectDynamicColorMixAlpha, pruneMiniProgramGeneratedCss } from "@weapp-tailwindcss/postcss";
17
+ //#region src/context/workspace.ts
18
+ const IGNORED_WORKSPACE_DIRS = new Set([
19
+ "node_modules",
20
+ ".git",
21
+ ".hg",
22
+ ".svn",
23
+ ".turbo",
24
+ ".output",
25
+ ".next",
26
+ "dist",
27
+ "build"
28
+ ]);
29
+ function findWorkspaceRoot(startDir) {
30
+ if (!startDir) return;
31
+ let current = path.resolve(startDir);
32
+ while (true) {
33
+ if (existsSync(path.join(current, "pnpm-workspace.yaml"))) return current;
34
+ const parent = path.dirname(current);
35
+ if (parent === current) return;
36
+ current = parent;
37
+ }
38
+ }
39
+ function findNearestPackageRoot(startDir) {
40
+ if (!startDir) return;
41
+ let current = path.resolve(startDir);
42
+ while (true) {
43
+ if (existsSync(path.join(current, "package.json"))) return current;
44
+ const parent = path.dirname(current);
45
+ if (parent === current) return;
46
+ current = parent;
47
+ }
48
+ }
49
+ function findWorkspacePackageDir(rootDir, packageName) {
50
+ const visited = /* @__PURE__ */ new Set();
51
+ const queue = [path.resolve(rootDir)];
52
+ while (queue.length > 0) {
53
+ const current = queue.shift();
54
+ const normalized = path.normalize(current);
55
+ if (visited.has(normalized)) continue;
56
+ visited.add(normalized);
57
+ try {
58
+ const pkgPath = path.join(normalized, "package.json");
59
+ if (existsSync(pkgPath)) {
60
+ if (JSON.parse(readFileSync(pkgPath, "utf8"))?.name === packageName) return normalized;
61
+ }
62
+ } catch {}
63
+ let entries;
64
+ try {
65
+ entries = readdirSync(normalized, { withFileTypes: true });
66
+ } catch {
67
+ continue;
68
+ }
69
+ for (const entry of entries) {
70
+ if (!entry.isDirectory() || IGNORED_WORKSPACE_DIRS.has(entry.name) || entry.isSymbolicLink?.()) continue;
71
+ queue.push(path.join(normalized, entry.name));
72
+ }
73
+ }
74
+ }
75
+ //#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
+ //#region src/utils/options.ts
85
+ function resolveBooleanObjectOption(value, enabledValue) {
86
+ if (!value) return false;
87
+ if (value === true) return enabledValue;
88
+ return value;
89
+ }
90
+ function normalizeStringListOption(value) {
91
+ if (!value) return;
92
+ const values = typeof value === "string" ? [value] : Array.isArray(value) ? value : void 0;
93
+ if (!values) return;
94
+ const normalized = values.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
95
+ return normalized.length > 0 ? normalized : void 0;
96
+ }
97
+ //#endregion
98
+ //#region src/tailwindcss/patcher-options.ts
99
+ function resolveTailwindcssOptions(options) {
100
+ return options?.tailwindcss ?? options?.tailwind;
101
+ }
102
+ function normalizeExtendLengthUnits(value) {
103
+ if (value === void 0) return;
104
+ const resolved = resolveBooleanObjectOption(value, { enabled: true });
105
+ return resolved && typeof resolved === "object" ? {
106
+ enabled: true,
107
+ ...resolved
108
+ } : resolved;
109
+ }
110
+ function normalizeTailwindcssPatcherOptions(options) {
111
+ return options;
112
+ }
113
+ //#endregion
114
+ //#region src/tailwindcss/patcher-resolve.ts
115
+ const GENERIC_RELATIVE_SPECIFIERS = [".", ".."];
116
+ const DEFAULT_TAILWIND_CONFIG_SPECIFIERS = ["stubs/config.full.js", "defaultConfig.js"];
117
+ const TAILWIND_CONFIG_FILES = [
118
+ "tailwind.config.js",
119
+ "tailwind.config.cjs",
120
+ "tailwind.config.mjs",
121
+ "tailwind.config.ts",
122
+ "tailwind.config.cts",
123
+ "tailwind.config.mts"
124
+ ];
125
+ function isPathSpecifier(specifier) {
126
+ if (!specifier) return false;
127
+ if (specifier.startsWith("file://")) return true;
128
+ if (path.isAbsolute(specifier)) return true;
129
+ return GENERIC_RELATIVE_SPECIFIERS.some((prefix) => specifier.startsWith(`${prefix}/`) || specifier.startsWith(`${prefix}\\`));
130
+ }
131
+ function resolveModuleFromPaths(specifier, paths) {
132
+ if (!specifier || isPathSpecifier(specifier) || paths.length === 0) return;
133
+ try {
134
+ return createRequire(import.meta.url).resolve(specifier, { paths });
135
+ } catch {
136
+ return;
137
+ }
138
+ }
139
+ function resolveTailwindConfigFallback(packageName, paths) {
140
+ if (!packageName) return;
141
+ for (const suffix of DEFAULT_TAILWIND_CONFIG_SPECIFIERS) {
142
+ const resolved = resolveModuleFromPaths(`${packageName}/${suffix}`, paths);
143
+ if (resolved) return resolved;
144
+ }
145
+ }
146
+ function appendNodeModules(paths, dir) {
147
+ if (!dir) return;
148
+ const nodeModulesDir = path.join(dir, "node_modules");
149
+ if (existsSync(nodeModulesDir)) paths.add(nodeModulesDir);
150
+ }
151
+ function findTailwindConfig(searchRoots) {
152
+ for (const root of searchRoots) for (const file of TAILWIND_CONFIG_FILES) {
153
+ const candidate = path.resolve(root, file);
154
+ if (existsSync(candidate)) return candidate;
155
+ }
156
+ }
157
+ function createDefaultResolvePaths(basedir) {
158
+ const paths = /* @__PURE__ */ new Set();
159
+ let fallbackCandidates = [];
160
+ if (basedir) {
161
+ const resolvedBase = path.resolve(basedir);
162
+ appendNodeModules(paths, resolvedBase);
163
+ fallbackCandidates.push(resolvedBase);
164
+ const packageRoot = findNearestPackageRoot(resolvedBase);
165
+ if (packageRoot) {
166
+ appendNodeModules(paths, packageRoot);
167
+ fallbackCandidates.push(packageRoot);
168
+ }
169
+ }
170
+ const cwd = process.cwd();
171
+ appendNodeModules(paths, cwd);
172
+ try {
173
+ const modulePath = fileURLToPath(import.meta.url);
174
+ const candidate = existsSync(modulePath) && !path.extname(modulePath) ? modulePath : path.dirname(modulePath);
175
+ paths.add(candidate);
176
+ } catch {
177
+ paths.add(import.meta.url);
178
+ }
179
+ if (paths.size === 0) {
180
+ fallbackCandidates = fallbackCandidates.filter(Boolean);
181
+ if (fallbackCandidates.length === 0) fallbackCandidates.push(cwd);
182
+ for (const candidate of fallbackCandidates) paths.add(candidate);
183
+ }
184
+ return [...paths];
185
+ }
186
+ //#endregion
187
+ //#region src/tailwindcss/version.ts
188
+ function normalizeSupportedTailwindcssMajorVersion(version) {
189
+ return version === 3 || version === 4 ? version : void 0;
190
+ }
191
+ function readPackageJson(packageJsonPath) {
192
+ try {
193
+ return JSON.parse(readFileSync(packageJsonPath, "utf8"));
194
+ } catch {
195
+ return;
196
+ }
197
+ }
198
+ function findPackageJsonDeclaringPackage(packageName, base) {
199
+ let current = path.resolve(base);
200
+ while (true) {
201
+ const pkgPath = path.join(current, "package.json");
202
+ if (existsSync(pkgPath)) {
203
+ const pkg = readPackageJson(pkgPath);
204
+ if (readDeclaredPackageVersion(packageName, pkg)) return pkgPath;
205
+ if (pkg?.name !== "weapp-tailwindcss") return;
206
+ }
207
+ const parent = path.dirname(current);
208
+ if (parent === current) return;
209
+ current = parent;
210
+ }
211
+ }
212
+ function readDeclaredPackageVersion(packageName, pkg) {
213
+ return pkg?.dependencies?.[packageName] ?? pkg?.devDependencies?.[packageName] ?? pkg?.peerDependencies?.[packageName] ?? pkg?.optionalDependencies?.[packageName];
214
+ }
215
+ function readDeclaredPackageMajorVersion(version) {
216
+ const match = version?.match(/(?:^|\D)([34])(?:\.|\b)/);
217
+ return normalizeSupportedTailwindcssMajorVersion(match ? Number(match[1]) : void 0);
218
+ }
219
+ function readInstalledPackageMajorVersion(packageName, base) {
220
+ const packageJsonPath = findPackageJsonDeclaringPackage(packageName, base);
221
+ if (!packageJsonPath) return;
222
+ const declaredVersion = readDeclaredPackageVersion(packageName, readPackageJson(packageJsonPath));
223
+ if (!declaredVersion) return;
224
+ try {
225
+ const pkg = createRequire(packageJsonPath)(`${packageName}/package.json`);
226
+ return normalizeSupportedTailwindcssMajorVersion(Number(pkg.version?.split(".")[0]));
227
+ } catch {
228
+ return readDeclaredPackageMajorVersion(declaredVersion);
229
+ }
230
+ }
231
+ //#endregion
232
+ //#region src/tailwindcss/patcher.ts
233
+ function createFallbackTailwindcssPatcher() {
234
+ return {
235
+ packageInfo: {
236
+ name: "tailwindcss",
237
+ version: void 0,
238
+ rootPath: "",
239
+ packageJsonPath: "",
240
+ packageJson: {}
241
+ },
242
+ majorVersion: 4,
243
+ async getClassSet() {
244
+ return /* @__PURE__ */ new Set();
245
+ },
246
+ async extract(_options) {
247
+ return {
248
+ classList: [],
249
+ classSet: /* @__PURE__ */ new Set()
250
+ };
251
+ },
252
+ async collectContentTokens() {
253
+ return {
254
+ entries: [],
255
+ filesScanned: 0,
256
+ sources: [],
257
+ skippedFiles: []
258
+ };
259
+ }
260
+ };
261
+ }
262
+ let hasLoggedMissingTailwind = false;
263
+ const TAILWINDCSS_NOT_FOUND_RE = /tailwindcss not found/i;
264
+ const UNABLE_TO_LOCATE_TAILWINDCSS_RE = /unable to locate tailwind css package/i;
265
+ function isTailwindcssV4PackageName(packageName) {
266
+ return packageName === "@tailwindcss/postcss" || packageName === "tailwindcss4" || Boolean(packageName && packageName.includes("tailwindcss4"));
267
+ }
268
+ function createTailwindcssPatcher(options) {
269
+ const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions } = options || {};
270
+ const cache = { driver: "memory" };
271
+ const normalizedBasedir = basedir ? path.resolve(basedir) : void 0;
272
+ const cacheRoot = findNearestPackageRoot(normalizedBasedir) ?? normalizedBasedir ?? process.cwd();
273
+ if (cacheDir) if (path.isAbsolute(cacheDir)) cache.dir = cacheDir;
274
+ else if (normalizedBasedir) cache.dir = path.resolve(normalizedBasedir, cacheDir);
275
+ else cache.dir = path.resolve(process.cwd(), cacheDir);
276
+ else cache.dir = path.join(cacheRoot, "node_modules", ".cache", "tailwindcss-patch");
277
+ if (normalizedBasedir) cache.cwd = normalizedBasedir;
278
+ const resolvePaths = createDefaultResolvePaths(cache.cwd ?? normalizedBasedir ?? process.cwd());
279
+ const normalizedUserOptions = normalizeTailwindcssPatcherOptions(tailwindcssPatcherOptions);
280
+ const extendLengthUnits = normalizeExtendLengthUnits(supportCustomLengthUnitsPatch ?? true);
281
+ const baseTailwindOptions = defuOverrideArray(tailwindcss ?? {}, omitUndefined({
282
+ cwd: normalizedBasedir,
283
+ resolve: { paths: resolvePaths }
284
+ }));
285
+ if (!baseTailwindOptions.packageName) baseTailwindOptions.packageName = "tailwindcss";
286
+ if (!baseTailwindOptions.postcssPlugin) baseTailwindOptions.postcssPlugin = baseTailwindOptions.version === 4 || isTailwindcssV4PackageName(baseTailwindOptions.packageName) ? "@tailwindcss/postcss" : "tailwindcss";
287
+ if (typeof baseTailwindOptions.postcssPlugin === "string") {
288
+ const resolvedPlugin = resolveModuleFromPaths(baseTailwindOptions.postcssPlugin, resolvePaths);
289
+ if (resolvedPlugin) baseTailwindOptions.postcssPlugin = resolvedPlugin;
290
+ }
291
+ const baseOptions = omitUndefined({
292
+ projectRoot: normalizedBasedir,
293
+ cache,
294
+ tailwindcss: baseTailwindOptions,
295
+ apply: omitUndefined({
296
+ exposeContext: true,
297
+ extendLengthUnits
298
+ })
299
+ });
300
+ const resolvedOptions = defuOverrideArray(normalizedUserOptions ?? {}, baseOptions);
301
+ const resolvedTailwindOptions = resolvedOptions.tailwindcss;
302
+ if (resolvedTailwindOptions) {
303
+ const existingResolve = resolvedTailwindOptions.resolve ?? {};
304
+ const sourcePaths = Array.isArray(existingResolve.paths) && existingResolve.paths.length > 0 ? existingResolve.paths : resolvePaths;
305
+ resolvedTailwindOptions.resolve = {
306
+ ...existingResolve,
307
+ paths: [...new Set(sourcePaths)]
308
+ };
309
+ logger.debug("Tailwind resolve config %O", {
310
+ packageName: resolvedTailwindOptions.packageName,
311
+ version: resolvedTailwindOptions.version,
312
+ resolve: resolvedTailwindOptions.resolve,
313
+ cwd: resolvedTailwindOptions.cwd
314
+ });
315
+ if (typeof resolvedTailwindOptions.postcssPlugin === "string") {
316
+ const resolvedPlugin = resolveModuleFromPaths(resolvedTailwindOptions.postcssPlugin, resolvedTailwindOptions.resolve?.paths ?? resolvePaths);
317
+ if (resolvedPlugin) resolvedTailwindOptions.postcssPlugin = resolvedPlugin;
318
+ }
319
+ const searchRoots = /* @__PURE__ */ new Set();
320
+ if (resolvedTailwindOptions.cwd) searchRoots.add(resolvedTailwindOptions.cwd);
321
+ for (const resolvePath of resolvedTailwindOptions.resolve?.paths ?? []) {
322
+ const parentDir = path.dirname(resolvePath);
323
+ searchRoots.add(parentDir);
324
+ }
325
+ const configPath = findTailwindConfig(searchRoots);
326
+ if (!resolvedTailwindOptions.config) if (configPath) resolvedTailwindOptions.config = configPath;
327
+ else {
328
+ const fallbackConfig = resolveTailwindConfigFallback(resolvedTailwindOptions.packageName, resolvedTailwindOptions.resolve.paths ?? resolvePaths);
329
+ if (fallbackConfig) resolvedTailwindOptions.config = fallbackConfig;
330
+ }
331
+ if (!resolvedTailwindOptions.cwd && configPath) resolvedTailwindOptions.cwd = path.dirname(configPath);
332
+ resolvedOptions.tailwindcss = resolvedTailwindOptions;
333
+ }
334
+ try {
335
+ return new TailwindcssPatcher(resolvedOptions);
336
+ } catch (error) {
337
+ const searchPaths = resolvedOptions.tailwindcss?.resolve?.paths;
338
+ if (error instanceof Error && TAILWINDCSS_NOT_FOUND_RE.test(error.message)) {
339
+ if (!hasLoggedMissingTailwind) {
340
+ logger.warn("Tailwind CSS 未安装,已跳过 Tailwind 运行时能力。若需使用 Tailwind 能力,请安装 tailwindcss。");
341
+ hasLoggedMissingTailwind = true;
342
+ }
343
+ return createFallbackTailwindcssPatcher();
344
+ }
345
+ if (error instanceof Error && UNABLE_TO_LOCATE_TAILWINDCSS_RE.test(error.message)) logger.error("无法定位 Tailwind CSS 包 \"%s\",已尝试路径: %O", resolvedOptions.tailwindcss?.packageName, searchPaths);
346
+ throw error;
347
+ }
348
+ }
349
+ //#endregion
350
+ //#region src/debug/index.ts
351
+ const _debug = _createDebug("weapp-tw");
352
+ function createDebug(prefix) {
353
+ const debug = ((formatter, ...args) => {
354
+ return _debug((prefix ?? "") + formatter, ...args);
355
+ });
356
+ Object.defineProperty(debug, "enabled", {
357
+ enumerable: false,
358
+ configurable: false,
359
+ get() {
360
+ return _debug.enabled;
361
+ }
362
+ });
363
+ return debug;
364
+ }
365
+ //#endregion
366
+ //#region src/tailwindcss/source-scan.ts
367
+ const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
368
+ "html",
369
+ "wxml",
370
+ "axml",
371
+ "jxml",
372
+ "ksml",
373
+ "ttml",
374
+ "qml",
375
+ "tyml",
376
+ "xhsml",
377
+ "swan",
378
+ "vue",
379
+ "mpx",
380
+ "js",
381
+ "jsx",
382
+ "ts",
383
+ "tsx"
384
+ ];
385
+ const FULL_SOURCE_SCAN_EXTENSIONS = [
386
+ "js",
387
+ "jsx",
388
+ "mjs",
389
+ "cjs",
390
+ "ts",
391
+ "tsx",
392
+ "mts",
393
+ "cts",
394
+ "vue",
395
+ "uvue",
396
+ "nvue",
397
+ "svelte",
398
+ "mpx",
399
+ "html",
400
+ "wxml",
401
+ "axml",
402
+ "jxml",
403
+ "ksml",
404
+ "ttml",
405
+ "qml",
406
+ "tyml",
407
+ "xhsml",
408
+ "swan",
409
+ "css",
410
+ "wxss",
411
+ "acss",
412
+ "jxss",
413
+ "ttss",
414
+ "qss",
415
+ "tyss",
416
+ "scss",
417
+ "sass",
418
+ "less",
419
+ "styl",
420
+ "stylus"
421
+ ];
422
+ function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
423
+ return `**/*.{${extensions.join(",")}}`;
424
+ }
425
+ const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
426
+ const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
427
+ function toPosixPath(value) {
428
+ return value.split(path.sep).join("/");
429
+ }
430
+ function resolveSourceScanPath(value) {
431
+ const resolved = path.resolve(value);
432
+ try {
433
+ return realpathSync.native(resolved);
434
+ } catch {
435
+ return resolved;
436
+ }
437
+ }
438
+ function normalizeEntryPattern(entry) {
439
+ return path.isAbsolute(entry.pattern) ? toPosixPath(path.relative(resolveSourceScanPath(entry.base), entry.pattern)) : entry.pattern;
440
+ }
441
+ function isFileMatchedByTailwindSourceEntry(file, entry) {
442
+ const relative = toPosixPath(path.relative(resolveSourceScanPath(entry.base), file));
443
+ return relative && !relative.startsWith("../") && !path.isAbsolute(relative) && micromatch.isMatch(relative, normalizeEntryPattern(entry));
444
+ }
445
+ function isFileExcludedByTailwindSourceEntries(file, entries) {
446
+ if (!entries?.length) return false;
447
+ const resolvedFile = resolveSourceScanPath(file);
448
+ return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
449
+ }
450
+ function isFileMatchedByTailwindSourceEntries(file, entries) {
451
+ if (!entries?.length) return true;
452
+ const positiveEntries = entries.filter((entry) => !entry.negated);
453
+ const negativeEntries = entries.filter((entry) => entry.negated);
454
+ const resolvedFile = resolveSourceScanPath(file);
455
+ if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
456
+ if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
457
+ return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
458
+ }
459
+ function createTailwindSourceEntryMatcher(entries) {
460
+ if (!entries?.length) return;
461
+ return (file) => isFileMatchedByTailwindSourceEntries(file, entries);
462
+ }
463
+ function resolveTailwindV4CssSourceBase(source, fallbackBase) {
464
+ if (typeof source.base === "string" && source.base.length > 0) return source.base;
465
+ if (typeof source.file === "string" && source.file.length > 0) return path.dirname(source.file);
466
+ return fallbackBase;
467
+ }
468
+ const NUMERICAL_RANGE_RE = /^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/;
469
+ function parseConfigParam$1(params) {
470
+ const value = params.trim();
471
+ return /^(['"])(.+)\1$/.exec(value)?.[2];
472
+ }
473
+ function isLegacyContentObject$1(value) {
474
+ return typeof value === "object" && value !== null && "files" in value;
475
+ }
476
+ function normalizeGlobPattern(pattern) {
477
+ return pattern.startsWith("./") ? pattern.slice(2) : pattern;
478
+ }
479
+ function hasGlobMagic(value) {
480
+ return /[*?[\]{}()!+@]/.test(value);
481
+ }
482
+ function splitStaticGlobPrefix(pattern) {
483
+ const segments = normalizeGlobPattern(pattern).split(/[\\/]+/);
484
+ const prefix = [];
485
+ const rest = [];
486
+ let reachedGlob = false;
487
+ for (const segment of segments) {
488
+ if (!reachedGlob && segment && !hasGlobMagic(segment)) {
489
+ prefix.push(segment);
490
+ continue;
491
+ }
492
+ reachedGlob = true;
493
+ rest.push(segment);
494
+ }
495
+ return {
496
+ prefix,
497
+ rest
498
+ };
499
+ }
500
+ function segmentTopLevel(input, separator, options = {}) {
501
+ const parts = [];
502
+ const stack = [];
503
+ let lastPos = 0;
504
+ let quote;
505
+ for (let index = 0; index < input.length; index++) {
506
+ const char = input[index];
507
+ if (char === "\\") {
508
+ index += 1;
509
+ continue;
510
+ }
511
+ if (quote) {
512
+ if (char === quote) quote = void 0;
513
+ continue;
514
+ }
515
+ if (char === "\"" || char === "'") {
516
+ quote = char;
517
+ continue;
518
+ }
519
+ if (char === "(") {
520
+ stack.push(")");
521
+ continue;
522
+ }
523
+ if (char === "[") {
524
+ stack.push("]");
525
+ continue;
526
+ }
527
+ if (char === "{") {
528
+ stack.push("}");
529
+ continue;
530
+ }
531
+ if (stack.length > 0 && char === stack[stack.length - 1]) {
532
+ stack.pop();
533
+ continue;
534
+ }
535
+ if (stack.length === 0 && char === separator) {
536
+ const part = input.slice(lastPos, index);
537
+ if (part || options.keepEmpty) parts.push(part);
538
+ lastPos = index + 1;
539
+ }
540
+ }
541
+ const part = input.slice(lastPos);
542
+ if (part || options.keepEmpty) parts.push(part);
543
+ return parts;
544
+ }
545
+ function isSequence(value) {
546
+ return NUMERICAL_RANGE_RE.test(value);
547
+ }
548
+ function expandSequence(value) {
549
+ const match = value.match(NUMERICAL_RANGE_RE);
550
+ if (!match) return [value];
551
+ const [, start, end, stepValue] = match;
552
+ if (start === void 0 || end === void 0) return [value];
553
+ let step = stepValue ? Number.parseInt(stepValue, 10) : void 0;
554
+ const startNumber = Number.parseInt(start, 10);
555
+ const endNumber = Number.parseInt(end, 10);
556
+ const increasing = startNumber < endNumber;
557
+ if (step === void 0) step = increasing ? 1 : -1;
558
+ if (step === 0) return [];
559
+ if (increasing && step < 0) step = -step;
560
+ if (!increasing && step > 0) step = -step;
561
+ const result = [];
562
+ for (let value = startNumber; increasing ? value <= endNumber : value >= endNumber; value += step) result.push(String(value));
563
+ return result;
564
+ }
565
+ function expandInlineSourceCandidatePattern(pattern) {
566
+ const index = pattern.indexOf("{");
567
+ if (index === -1) return [pattern];
568
+ const prefix = pattern.slice(0, index);
569
+ const rest = pattern.slice(index);
570
+ let depth = 0;
571
+ let endIndex = -1;
572
+ for (let index = 0; index < rest.length; index++) {
573
+ const char = rest[index];
574
+ if (char === "{") depth += 1;
575
+ else if (char === "}") {
576
+ depth -= 1;
577
+ if (depth === 0) {
578
+ endIndex = index;
579
+ break;
580
+ }
581
+ }
582
+ }
583
+ if (endIndex === -1) return [pattern];
584
+ const inner = rest.slice(1, endIndex);
585
+ const suffix = rest.slice(endIndex + 1);
586
+ const parts = (isSequence(inner) ? expandSequence(inner) : segmentTopLevel(inner, ",", { keepEmpty: true })).flatMap((part) => expandInlineSourceCandidatePattern(part));
587
+ return expandInlineSourceCandidatePattern(suffix).flatMap((suffix) => parts.map((part) => `${prefix}${part}${suffix}`));
588
+ }
589
+ function parseSourceInlineParam(params) {
590
+ let value = params.trim();
591
+ const negated = value.startsWith("not ");
592
+ if (negated) value = value.slice(4).trim();
593
+ if (!value.startsWith("inline(") || !value.endsWith(")")) return;
594
+ const inlineValue = value.slice(7, -1).trim();
595
+ const match = /^(['"])([\s\S]*)\1$/.exec(inlineValue);
596
+ if (!match) return;
597
+ const source = match[2];
598
+ if (source === void 0) return;
599
+ return {
600
+ negated,
601
+ source
602
+ };
603
+ }
604
+ function collectCssInlineSourceCandidates(root) {
605
+ const included = /* @__PURE__ */ new Set();
606
+ const excluded = /* @__PURE__ */ new Set();
607
+ root.walkAtRules("source", (rule) => {
608
+ const parsed = parseSourceInlineParam(rule.params);
609
+ if (!parsed) return;
610
+ const target = parsed.negated ? excluded : included;
611
+ for (const source of segmentTopLevel(parsed.source, " ")) {
612
+ const trimmed = source.trim();
613
+ if (!trimmed) continue;
614
+ for (const candidate of expandInlineSourceCandidatePattern(trimmed)) {
615
+ const normalized = candidate.trim();
616
+ if (normalized) target.add(normalized);
617
+ }
618
+ }
619
+ });
620
+ for (const candidate of excluded) included.delete(candidate);
621
+ return {
622
+ included,
623
+ excluded
624
+ };
625
+ }
626
+ function normalizeLegacyContentEntries(content, base) {
627
+ if (typeof content === "string") {
628
+ const negated = content.startsWith("!");
629
+ return [{
630
+ base,
631
+ negated,
632
+ pattern: normalizeGlobPattern(negated ? content.slice(1) : content)
633
+ }];
634
+ }
635
+ if (Array.isArray(content)) return content.flatMap((item) => normalizeLegacyContentEntries(item, base));
636
+ if (isLegacyContentObject$1(content)) return normalizeLegacyContentEntries(content.files, base);
637
+ return [];
638
+ }
639
+ async function pathExistsAsDirectory(file) {
640
+ try {
641
+ return (await stat(file)).isDirectory();
642
+ } catch {
643
+ return false;
644
+ }
645
+ }
646
+ async function resolveTailwindSourceEntry(sourcePath, base, negated, defaultPattern = createSourceScanPattern()) {
647
+ const absoluteSource = path.isAbsolute(sourcePath) ? path.resolve(sourcePath) : path.resolve(base, sourcePath);
648
+ if (await pathExistsAsDirectory(absoluteSource)) return {
649
+ base: absoluteSource,
650
+ negated,
651
+ pattern: normalizeGlobPattern(defaultPattern)
652
+ };
653
+ if (path.isAbsolute(sourcePath)) return {
654
+ base: path.dirname(absoluteSource),
655
+ negated,
656
+ pattern: normalizeGlobPattern(path.basename(absoluteSource))
657
+ };
658
+ const { prefix, rest } = splitStaticGlobPrefix(sourcePath);
659
+ if (prefix.length > 0 && rest.length > 0) return {
660
+ base: path.resolve(base, ...prefix),
661
+ negated,
662
+ pattern: normalizeGlobPattern(rest.join("/"))
663
+ };
664
+ return {
665
+ base,
666
+ negated,
667
+ pattern: normalizeGlobPattern(sourcePath)
668
+ };
669
+ }
670
+ function parseSourceFileParam(params) {
671
+ const value = params.trim();
672
+ if (!value || value === "none" || value.startsWith("inline(")) return;
673
+ const negated = value.startsWith("not ");
674
+ const sourceValue = negated ? value.slice(4).trim() : value;
675
+ if (sourceValue.startsWith("inline(")) return;
676
+ const match = /^(['"])(.+)\1$/.exec(sourceValue);
677
+ return match?.[2] ? {
678
+ negated,
679
+ sourcePath: match[2]
680
+ } : void 0;
681
+ }
682
+ async function resolveCssSourceEntries(root, base, defaultPattern = createSourceScanPattern()) {
683
+ const entries = [];
684
+ const tasks = [];
685
+ root.walkAtRules("source", (rule) => {
686
+ const parsed = parseSourceFileParam(rule.params);
687
+ if (!parsed) return;
688
+ tasks.push(resolveTailwindSourceEntry(parsed.sourcePath, base, parsed.negated, defaultPattern));
689
+ });
690
+ entries.push(...await Promise.all(tasks));
691
+ return entries;
692
+ }
693
+ async function expandTailwindSourceEntries(entries, options = {}) {
694
+ if (entries.length === 0) return [];
695
+ const files = /* @__PURE__ */ new Set();
696
+ const entriesByBase = /* @__PURE__ */ new Map();
697
+ for (const entry of entries) {
698
+ const base = path.resolve(entry.base);
699
+ const group = entriesByBase.get(base) ?? [];
700
+ group.push({
701
+ ...entry,
702
+ base
703
+ });
704
+ entriesByBase.set(base, group);
705
+ }
706
+ await Promise.all([...entriesByBase.entries()].map(async ([base, group]) => {
707
+ const ignoredSources = options.ignore?.map((pattern) => ({
708
+ base,
709
+ pattern: normalizeGlobPattern(pattern),
710
+ negated: true
711
+ }));
712
+ const matched = await resolveProjectSourceFiles({
713
+ cwd: base,
714
+ sources: group,
715
+ ...ignoredSources === void 0 ? {} : { ignoredSources }
716
+ });
717
+ for (const file of matched) files.add(path.resolve(file));
718
+ }));
719
+ return [...files].filter((file) => !isFileExcludedByTailwindSourceEntries(file, entries));
720
+ }
721
+ //#endregion
722
+ //#region src/tailwindcss/v4-engine/candidates.ts
723
+ const UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE = /(?:^|:)(?:group|peer|in|not-in)-[^\s:]*\/|(?:^|:)(?:in|not-in)-\[/;
724
+ function isUnsupportedMiniProgramTailwindV4Candidate(candidate) {
725
+ return UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE.test(candidate);
726
+ }
727
+ function filterUnsupportedMiniProgramTailwindV4Candidates(candidates) {
728
+ if (!candidates) return;
729
+ return new Set([...candidates].filter((candidate) => !isUnsupportedMiniProgramTailwindV4Candidate(candidate)));
730
+ }
731
+ //#endregion
732
+ //#region src/tailwindcss/v4-engine/miniprogram.ts
733
+ const defaultStyleHandler$1 = createStyleHandler({
734
+ cssChildCombinatorReplaceValue: ["view", "text"],
735
+ cssRemoveHoverPseudoClass: true,
736
+ isMainChunk: true,
737
+ majorVersion: 4
738
+ });
739
+ const CSS_DECLARATION_URL_RE = /(:\s*)url\(([^\n\r"';[\]{}]*[[\]{}][^\n\r;]*)\)(?=\s*;)/g;
740
+ function normalizeTailwindV4GeneratedUrlValues(css) {
741
+ return css.replace(CSS_DECLARATION_URL_RE, (match, prefix, urlValue) => {
742
+ try {
743
+ return `${prefix}url("${urlValue.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}")`;
744
+ } catch {
745
+ return match;
746
+ }
747
+ });
748
+ }
749
+ async function transformTailwindV4CssToWeapp(css, options) {
750
+ const protectedCss = protectDynamicColorMixAlpha(normalizeTailwindV4GeneratedUrlValues(hasCssMacroStyleOptions(options) ? await transformCssMacroCss(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
751
+ const result = await defaultStyleHandler$1(protectedCss.css, {
752
+ cssChildCombinatorReplaceValue: ["view", "text"],
753
+ cssRemoveHoverPseudoClass: true,
754
+ isMainChunk: true,
755
+ majorVersion: 4,
756
+ ...options
757
+ });
758
+ const pruneOptions = { preserveConditionalComments: hasCssMacroStyleOptions(options) };
759
+ return pruneMiniProgramGeneratedCss(protectedCss.restore(result.css), pruneOptions);
760
+ }
761
+ async function transformTailwindV4CssByTarget(css, target, options) {
762
+ if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
763
+ return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css, options) : css;
764
+ }
765
+ //#endregion
766
+ //#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
767
+ const TAILWIND_V3_COLOR_STEPS = [
768
+ "50",
769
+ "100",
770
+ "200",
771
+ "300",
772
+ "400",
773
+ "500",
774
+ "600",
775
+ "700",
776
+ "800",
777
+ "900",
778
+ "950"
779
+ ];
780
+ const TAILWIND_V3_COLOR_PALETTE = {
781
+ slate: [
782
+ "#f8fafc",
783
+ "#f1f5f9",
784
+ "#e2e8f0",
785
+ "#cbd5e1",
786
+ "#94a3b8",
787
+ "#64748b",
788
+ "#475569",
789
+ "#334155",
790
+ "#1e293b",
791
+ "#0f172a",
792
+ "#020617"
793
+ ],
794
+ gray: [
795
+ "#f9fafb",
796
+ "#f3f4f6",
797
+ "#e5e7eb",
798
+ "#d1d5db",
799
+ "#9ca3af",
800
+ "#6b7280",
801
+ "#4b5563",
802
+ "#374151",
803
+ "#1f2937",
804
+ "#111827",
805
+ "#030712"
806
+ ],
807
+ zinc: [
808
+ "#fafafa",
809
+ "#f4f4f5",
810
+ "#e4e4e7",
811
+ "#d4d4d8",
812
+ "#a1a1aa",
813
+ "#71717a",
814
+ "#52525b",
815
+ "#3f3f46",
816
+ "#27272a",
817
+ "#18181b",
818
+ "#09090b"
819
+ ],
820
+ neutral: [
821
+ "#fafafa",
822
+ "#f5f5f5",
823
+ "#e5e5e5",
824
+ "#d4d4d4",
825
+ "#a3a3a3",
826
+ "#737373",
827
+ "#525252",
828
+ "#404040",
829
+ "#262626",
830
+ "#171717",
831
+ "#0a0a0a"
832
+ ],
833
+ stone: [
834
+ "#fafaf9",
835
+ "#f5f5f4",
836
+ "#e7e5e4",
837
+ "#d6d3d1",
838
+ "#a8a29e",
839
+ "#78716c",
840
+ "#57534e",
841
+ "#44403c",
842
+ "#292524",
843
+ "#1c1917",
844
+ "#0c0a09"
845
+ ],
846
+ red: [
847
+ "#fef2f2",
848
+ "#fee2e2",
849
+ "#fecaca",
850
+ "#fca5a5",
851
+ "#f87171",
852
+ "#ef4444",
853
+ "#dc2626",
854
+ "#b91c1c",
855
+ "#991b1b",
856
+ "#7f1d1d",
857
+ "#450a0a"
858
+ ],
859
+ orange: [
860
+ "#fff7ed",
861
+ "#ffedd5",
862
+ "#fed7aa",
863
+ "#fdba74",
864
+ "#fb923c",
865
+ "#f97316",
866
+ "#ea580c",
867
+ "#c2410c",
868
+ "#9a3412",
869
+ "#7c2d12",
870
+ "#431407"
871
+ ],
872
+ amber: [
873
+ "#fffbeb",
874
+ "#fef3c7",
875
+ "#fde68a",
876
+ "#fcd34d",
877
+ "#fbbf24",
878
+ "#f59e0b",
879
+ "#d97706",
880
+ "#b45309",
881
+ "#92400e",
882
+ "#78350f",
883
+ "#451a03"
884
+ ],
885
+ yellow: [
886
+ "#fefce8",
887
+ "#fef9c3",
888
+ "#fef08a",
889
+ "#fde047",
890
+ "#facc15",
891
+ "#eab308",
892
+ "#ca8a04",
893
+ "#a16207",
894
+ "#854d0e",
895
+ "#713f12",
896
+ "#422006"
897
+ ],
898
+ lime: [
899
+ "#f7fee7",
900
+ "#ecfccb",
901
+ "#d9f99d",
902
+ "#bef264",
903
+ "#a3e635",
904
+ "#84cc16",
905
+ "#65a30d",
906
+ "#4d7c0f",
907
+ "#3f6212",
908
+ "#365314",
909
+ "#1a2e05"
910
+ ],
911
+ green: [
912
+ "#f0fdf4",
913
+ "#dcfce7",
914
+ "#bbf7d0",
915
+ "#86efac",
916
+ "#4ade80",
917
+ "#22c55e",
918
+ "#16a34a",
919
+ "#15803d",
920
+ "#166534",
921
+ "#14532d",
922
+ "#052e16"
923
+ ],
924
+ emerald: [
925
+ "#ecfdf5",
926
+ "#d1fae5",
927
+ "#a7f3d0",
928
+ "#6ee7b7",
929
+ "#34d399",
930
+ "#10b981",
931
+ "#059669",
932
+ "#047857",
933
+ "#065f46",
934
+ "#064e3b",
935
+ "#022c22"
936
+ ],
937
+ teal: [
938
+ "#f0fdfa",
939
+ "#ccfbf1",
940
+ "#99f6e4",
941
+ "#5eead4",
942
+ "#2dd4bf",
943
+ "#14b8a6",
944
+ "#0d9488",
945
+ "#0f766e",
946
+ "#115e59",
947
+ "#134e4a",
948
+ "#042f2e"
949
+ ],
950
+ cyan: [
951
+ "#ecfeff",
952
+ "#cffafe",
953
+ "#a5f3fc",
954
+ "#67e8f9",
955
+ "#22d3ee",
956
+ "#06b6d4",
957
+ "#0891b2",
958
+ "#0e7490",
959
+ "#155e75",
960
+ "#164e63",
961
+ "#083344"
962
+ ],
963
+ sky: [
964
+ "#f0f9ff",
965
+ "#e0f2fe",
966
+ "#bae6fd",
967
+ "#7dd3fc",
968
+ "#38bdf8",
969
+ "#0ea5e9",
970
+ "#0284c7",
971
+ "#0369a1",
972
+ "#075985",
973
+ "#0c4a6e",
974
+ "#082f49"
975
+ ],
976
+ blue: [
977
+ "#eff6ff",
978
+ "#dbeafe",
979
+ "#bfdbfe",
980
+ "#93c5fd",
981
+ "#60a5fa",
982
+ "#3b82f6",
983
+ "#2563eb",
984
+ "#1d4ed8",
985
+ "#1e40af",
986
+ "#1e3a8a",
987
+ "#172554"
988
+ ],
989
+ indigo: [
990
+ "#eef2ff",
991
+ "#e0e7ff",
992
+ "#c7d2fe",
993
+ "#a5b4fc",
994
+ "#818cf8",
995
+ "#6366f1",
996
+ "#4f46e5",
997
+ "#4338ca",
998
+ "#3730a3",
999
+ "#312e81",
1000
+ "#1e1b4b"
1001
+ ],
1002
+ violet: [
1003
+ "#f5f3ff",
1004
+ "#ede9fe",
1005
+ "#ddd6fe",
1006
+ "#c4b5fd",
1007
+ "#a78bfa",
1008
+ "#8b5cf6",
1009
+ "#7c3aed",
1010
+ "#6d28d9",
1011
+ "#5b21b6",
1012
+ "#4c1d95",
1013
+ "#2e1065"
1014
+ ],
1015
+ purple: [
1016
+ "#faf5ff",
1017
+ "#f3e8ff",
1018
+ "#e9d5ff",
1019
+ "#d8b4fe",
1020
+ "#c084fc",
1021
+ "#a855f7",
1022
+ "#9333ea",
1023
+ "#7e22ce",
1024
+ "#6b21a8",
1025
+ "#581c87",
1026
+ "#3b0764"
1027
+ ],
1028
+ fuchsia: [
1029
+ "#fdf4ff",
1030
+ "#fae8ff",
1031
+ "#f5d0fe",
1032
+ "#f0abfc",
1033
+ "#e879f9",
1034
+ "#d946ef",
1035
+ "#c026d3",
1036
+ "#a21caf",
1037
+ "#86198f",
1038
+ "#701a75",
1039
+ "#4a044e"
1040
+ ],
1041
+ pink: [
1042
+ "#fdf2f8",
1043
+ "#fce7f3",
1044
+ "#fbcfe8",
1045
+ "#f9a8d4",
1046
+ "#f472b6",
1047
+ "#ec4899",
1048
+ "#db2777",
1049
+ "#be185d",
1050
+ "#9d174d",
1051
+ "#831843",
1052
+ "#500724"
1053
+ ],
1054
+ rose: [
1055
+ "#fff1f2",
1056
+ "#ffe4e6",
1057
+ "#fecdd3",
1058
+ "#fda4af",
1059
+ "#fb7185",
1060
+ "#f43f5e",
1061
+ "#e11d48",
1062
+ "#be123c",
1063
+ "#9f1239",
1064
+ "#881337",
1065
+ "#4c0519"
1066
+ ]
1067
+ };
1068
+ function createTailwindV3DefaultColorThemeCss() {
1069
+ const declarations = [" --color-black: #000;", " --color-white: #fff;"];
1070
+ for (const [color, values] of Object.entries(TAILWIND_V3_COLOR_PALETTE)) for (let index = 0; index < TAILWIND_V3_COLOR_STEPS.length; index++) declarations.push(` --color-${color}-${TAILWIND_V3_COLOR_STEPS[index]}: ${values[index]};`);
1071
+ return [
1072
+ "@theme {",
1073
+ ...declarations,
1074
+ "}"
1075
+ ].join("\n");
1076
+ }
1077
+ //#endregion
1078
+ //#region src/tailwindcss/v4-engine/tailwind-v3-compatibility.ts
1079
+ const TAILWIND_V3_COMPATIBILITY_THEME_CSS = [
1080
+ "@theme {",
1081
+ " --default-ring-width: 3px;",
1082
+ " --default-ring-color: var(--color-blue-500, #3b82f6);",
1083
+ " --default-outline-width: 3px;",
1084
+ "",
1085
+ " --shadow-xs: 0 1px rgb(0 0 0 / 0.05);",
1086
+ " --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);",
1087
+ " --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);",
1088
+ " --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);",
1089
+ " --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);",
1090
+ " --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);",
1091
+ "",
1092
+ " --blur-xs: 4px;",
1093
+ " --blur-sm: 4px;",
1094
+ " --blur: 8px;",
1095
+ " --backdrop-blur-xs: 4px;",
1096
+ " --backdrop-blur-sm: 4px;",
1097
+ " --backdrop-blur: 8px;",
1098
+ "",
1099
+ " --radius-xs: 0.125rem;",
1100
+ " --radius-sm: 0.125rem;",
1101
+ " --radius: 0.25rem;",
1102
+ "}",
1103
+ createTailwindV3DefaultColorThemeCss()
1104
+ ].join("\n");
1105
+ const TAILWIND_V3_COMPATIBILITY_BASE_CSS = [
1106
+ "*,",
1107
+ "::after,",
1108
+ "::before,",
1109
+ "::backdrop,",
1110
+ "::file-selector-button {",
1111
+ " border-color: var(--color-gray-200, currentcolor);",
1112
+ "}",
1113
+ "",
1114
+ "input::placeholder,",
1115
+ "textarea::placeholder {",
1116
+ " opacity: 1;",
1117
+ " color: var(--color-gray-400, currentcolor);",
1118
+ "}",
1119
+ "",
1120
+ "button:not(:disabled),",
1121
+ "[role=\"button\"]:not(:disabled) {",
1122
+ " cursor: pointer;",
1123
+ "}",
1124
+ "",
1125
+ "dialog {",
1126
+ " margin: auto;",
1127
+ "}"
1128
+ ].join("\n");
1129
+ function applyTailwindV3CompatibilityCss(css) {
1130
+ return `${TAILWIND_V3_COMPATIBILITY_THEME_CSS}\n${css}\n${TAILWIND_V3_COMPATIBILITY_BASE_CSS}`;
1131
+ }
1132
+ //#endregion
1133
+ //#region src/tailwindcss/v4-engine/tailwind-v4-default-colors.ts
1134
+ const TAILWIND_V4_COLOR_STEPS = [
1135
+ "50",
1136
+ "100",
1137
+ "200",
1138
+ "300",
1139
+ "400",
1140
+ "500",
1141
+ "600",
1142
+ "700",
1143
+ "800",
1144
+ "900",
1145
+ "950"
1146
+ ];
1147
+ const TAILWIND_V4_COLOR_PALETTE = {
1148
+ slate: [
1149
+ "#f8fafc",
1150
+ "#f1f5f9",
1151
+ "#e2e8f0",
1152
+ "#cad5e2",
1153
+ "#90a1b9",
1154
+ "#62748e",
1155
+ "#45556c",
1156
+ "#314158",
1157
+ "#1d293d",
1158
+ "#0f172b",
1159
+ "#020618"
1160
+ ],
1161
+ gray: [
1162
+ "#f9fafb",
1163
+ "#f3f4f6",
1164
+ "#e5e7eb",
1165
+ "#d1d5dc",
1166
+ "#99a1af",
1167
+ "#6a7282",
1168
+ "#4a5565",
1169
+ "#364153",
1170
+ "#1e2939",
1171
+ "#101828",
1172
+ "#030712"
1173
+ ],
1174
+ zinc: [
1175
+ "#fafafa",
1176
+ "#f4f4f5",
1177
+ "#e4e4e7",
1178
+ "#d4d4d8",
1179
+ "#9f9fa9",
1180
+ "#71717b",
1181
+ "#52525c",
1182
+ "#3f3f46",
1183
+ "#27272a",
1184
+ "#18181b",
1185
+ "#09090b"
1186
+ ],
1187
+ neutral: [
1188
+ "#fafafa",
1189
+ "#f5f5f5",
1190
+ "#e5e5e5",
1191
+ "#d4d4d4",
1192
+ "#a1a1a1",
1193
+ "#737373",
1194
+ "#525252",
1195
+ "#404040",
1196
+ "#262626",
1197
+ "#171717",
1198
+ "#0a0a0a"
1199
+ ],
1200
+ stone: [
1201
+ "#fafaf9",
1202
+ "#f5f5f4",
1203
+ "#e7e5e4",
1204
+ "#d6d3d1",
1205
+ "#a6a09b",
1206
+ "#79716b",
1207
+ "#57534d",
1208
+ "#44403b",
1209
+ "#292524",
1210
+ "#1c1917",
1211
+ "#0c0a09"
1212
+ ],
1213
+ mauve: [
1214
+ "#fafafa",
1215
+ "#f3f1f3",
1216
+ "#e7e4e7",
1217
+ "#d7d0d7",
1218
+ "#a89ea9",
1219
+ "#79697b",
1220
+ "#594c5b",
1221
+ "#463947",
1222
+ "#2a212c",
1223
+ "#1d161e",
1224
+ "#0c090c"
1225
+ ],
1226
+ olive: [
1227
+ "#fbfbf9",
1228
+ "#f4f4f0",
1229
+ "#e8e8e3",
1230
+ "#d8d8d0",
1231
+ "#abab9c",
1232
+ "#7c7c67",
1233
+ "#5b5b4b",
1234
+ "#474739",
1235
+ "#2b2b22",
1236
+ "#1d1d16",
1237
+ "#0c0c09"
1238
+ ],
1239
+ mist: [
1240
+ "#f9fbfb",
1241
+ "#f1f3f3",
1242
+ "#e3e7e8",
1243
+ "#d0d6d8",
1244
+ "#9ca8ab",
1245
+ "#67787c",
1246
+ "#4b585b",
1247
+ "#394447",
1248
+ "#22292b",
1249
+ "#161b1d",
1250
+ "#090b0c"
1251
+ ],
1252
+ taupe: [
1253
+ "#fbfaf9",
1254
+ "#f3f1f1",
1255
+ "#e8e4e3",
1256
+ "#d8d2d0",
1257
+ "#aba09c",
1258
+ "#7c6d67",
1259
+ "#5b4f4b",
1260
+ "#473c39",
1261
+ "#2b2422",
1262
+ "#1d1816",
1263
+ "#0c0a09"
1264
+ ],
1265
+ red: [
1266
+ "#fef2f2",
1267
+ "#ffe2e2",
1268
+ "#ffc9c9",
1269
+ "#ffa2a2",
1270
+ "#ff6467",
1271
+ "#fb2c36",
1272
+ "#e7000b",
1273
+ "#c10007",
1274
+ "#9f0712",
1275
+ "#82181a",
1276
+ "#460809"
1277
+ ],
1278
+ orange: [
1279
+ "#fff7ed",
1280
+ "#ffedd4",
1281
+ "#ffd6a7",
1282
+ "#ffb86a",
1283
+ "#ff8904",
1284
+ "#ff6900",
1285
+ "#f54900",
1286
+ "#ca3500",
1287
+ "#9f2d00",
1288
+ "#7e2a0c",
1289
+ "#441306"
1290
+ ],
1291
+ amber: [
1292
+ "#fffbeb",
1293
+ "#fef3c6",
1294
+ "#fee685",
1295
+ "#ffd230",
1296
+ "#ffb900",
1297
+ "#fe9a00",
1298
+ "#e17100",
1299
+ "#bb4d00",
1300
+ "#973c00",
1301
+ "#7b3306",
1302
+ "#461901"
1303
+ ],
1304
+ yellow: [
1305
+ "#fefce8",
1306
+ "#fef9c2",
1307
+ "#fff085",
1308
+ "#ffdf20",
1309
+ "#fdc700",
1310
+ "#f0b100",
1311
+ "#d08700",
1312
+ "#a65f00",
1313
+ "#894b00",
1314
+ "#733e0a",
1315
+ "#432004"
1316
+ ],
1317
+ lime: [
1318
+ "#f7fee7",
1319
+ "#ecfcca",
1320
+ "#d8f999",
1321
+ "#bbf451",
1322
+ "#9ae600",
1323
+ "#7ccf00",
1324
+ "#5ea500",
1325
+ "#497d00",
1326
+ "#3c6300",
1327
+ "#35530e",
1328
+ "#192e03"
1329
+ ],
1330
+ green: [
1331
+ "#f0fdf4",
1332
+ "#dcfce7",
1333
+ "#b9f8cf",
1334
+ "#7bf1a8",
1335
+ "#05df72",
1336
+ "#00c950",
1337
+ "#00a63e",
1338
+ "#008236",
1339
+ "#016630",
1340
+ "#0d542b",
1341
+ "#032e15"
1342
+ ],
1343
+ emerald: [
1344
+ "#ecfdf5",
1345
+ "#d0fae5",
1346
+ "#a4f4cf",
1347
+ "#5ee9b5",
1348
+ "#00d492",
1349
+ "#00bc7d",
1350
+ "#009966",
1351
+ "#007a55",
1352
+ "#006045",
1353
+ "#004f3b",
1354
+ "#002c22"
1355
+ ],
1356
+ teal: [
1357
+ "#f0fdfa",
1358
+ "#cbfbf1",
1359
+ "#96f7e4",
1360
+ "#46ecd5",
1361
+ "#00d5be",
1362
+ "#00bba7",
1363
+ "#009689",
1364
+ "#00786f",
1365
+ "#005f5a",
1366
+ "#0b4f4a",
1367
+ "#022f2e"
1368
+ ],
1369
+ cyan: [
1370
+ "#ecfeff",
1371
+ "#cefafe",
1372
+ "#a2f4fd",
1373
+ "#53eafd",
1374
+ "#00d3f2",
1375
+ "#00b8db",
1376
+ "#0092b8",
1377
+ "#007595",
1378
+ "#005f78",
1379
+ "#104e64",
1380
+ "#053345"
1381
+ ],
1382
+ sky: [
1383
+ "#f0f9ff",
1384
+ "#dff2fe",
1385
+ "#b8e6fe",
1386
+ "#74d4ff",
1387
+ "#00bcff",
1388
+ "#00a6f4",
1389
+ "#0084d1",
1390
+ "#0069a8",
1391
+ "#00598a",
1392
+ "#024a70",
1393
+ "#052f4a"
1394
+ ],
1395
+ blue: [
1396
+ "#eff6ff",
1397
+ "#dbeafe",
1398
+ "#bedbff",
1399
+ "#8ec5ff",
1400
+ "#51a2ff",
1401
+ "#2b7fff",
1402
+ "#155dfc",
1403
+ "#1447e6",
1404
+ "#193cb8",
1405
+ "#1c398e",
1406
+ "#162456"
1407
+ ],
1408
+ indigo: [
1409
+ "#eef2ff",
1410
+ "#e0e7ff",
1411
+ "#c6d2ff",
1412
+ "#a3b3ff",
1413
+ "#7c86ff",
1414
+ "#615fff",
1415
+ "#4f39f6",
1416
+ "#432dd7",
1417
+ "#372aac",
1418
+ "#312c85",
1419
+ "#1e1a4d"
1420
+ ],
1421
+ violet: [
1422
+ "#f5f3ff",
1423
+ "#ede9fe",
1424
+ "#ddd6ff",
1425
+ "#c4b4ff",
1426
+ "#a684ff",
1427
+ "#8e51ff",
1428
+ "#7f22fe",
1429
+ "#7008e7",
1430
+ "#5d0ec0",
1431
+ "#4d179a",
1432
+ "#2f0d68"
1433
+ ],
1434
+ purple: [
1435
+ "#faf5ff",
1436
+ "#f3e8ff",
1437
+ "#e9d4ff",
1438
+ "#dab2ff",
1439
+ "#c27aff",
1440
+ "#ad46ff",
1441
+ "#9810fa",
1442
+ "#8200db",
1443
+ "#6e11b0",
1444
+ "#59168b",
1445
+ "#3c0366"
1446
+ ],
1447
+ fuchsia: [
1448
+ "#fdf4ff",
1449
+ "#fae8ff",
1450
+ "#f6cfff",
1451
+ "#f4a8ff",
1452
+ "#ed6aff",
1453
+ "#e12afb",
1454
+ "#c800de",
1455
+ "#a800b7",
1456
+ "#8a0194",
1457
+ "#721378",
1458
+ "#4b004f"
1459
+ ],
1460
+ pink: [
1461
+ "#fdf2f8",
1462
+ "#fce7f3",
1463
+ "#fccee8",
1464
+ "#fda5d5",
1465
+ "#fb64b6",
1466
+ "#f6339a",
1467
+ "#e60076",
1468
+ "#c6005c",
1469
+ "#a3004c",
1470
+ "#861043",
1471
+ "#510424"
1472
+ ],
1473
+ rose: [
1474
+ "#fff1f2",
1475
+ "#ffe4e6",
1476
+ "#ffccd3",
1477
+ "#ffa1ad",
1478
+ "#ff637e",
1479
+ "#ff2056",
1480
+ "#ec003f",
1481
+ "#c70036",
1482
+ "#a50036",
1483
+ "#8b0836",
1484
+ "#4d0218"
1485
+ ]
1486
+ };
1487
+ function createTailwindV4DefaultColorThemeCss() {
1488
+ const declarations = [" --color-black: #000;", " --color-white: #fff;"];
1489
+ for (const [color, values] of Object.entries(TAILWIND_V4_COLOR_PALETTE)) for (let index = 0; index < TAILWIND_V4_COLOR_STEPS.length; index++) declarations.push(` --color-${color}-${TAILWIND_V4_COLOR_STEPS[index]}: ${values[index]};`);
1490
+ return [
1491
+ "@theme {",
1492
+ ...declarations,
1493
+ "}"
1494
+ ].join("\n");
1495
+ }
1496
+ //#endregion
1497
+ //#region src/tailwindcss/v4-engine/generator.ts
1498
+ const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
1499
+ const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
1500
+ const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
1501
+ const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
1502
+ const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
1503
+ "**/.git/**",
1504
+ "**/.hg/**",
1505
+ "**/.jj/**",
1506
+ "**/.next/**",
1507
+ "**/.parcel-cache/**",
1508
+ "**/.pnpm-store/**",
1509
+ "**/.svelte-kit/**",
1510
+ "**/.svn/**",
1511
+ "**/.turbo/**",
1512
+ "**/.venv/**",
1513
+ "**/.vercel/**",
1514
+ "**/.yarn/**",
1515
+ "**/__pycache__/**",
1516
+ "**/node_modules/**",
1517
+ "**/venv/**",
1518
+ "**/*.less",
1519
+ "**/*.lock",
1520
+ "**/*.sass",
1521
+ "**/*.scss",
1522
+ "**/*.styl",
1523
+ "**/*.log",
1524
+ "**/package-lock.json",
1525
+ "**/pnpm-lock.yaml",
1526
+ "**/bun.lockb",
1527
+ "**/.gitignore",
1528
+ "**/.env",
1529
+ "**/.env.*"
1530
+ ];
1531
+ function findLeadingImportInsertionIndex(css) {
1532
+ const importPattern = /(?:^|\n)\s*@import\b[^;]*;/g;
1533
+ let insertionIndex = 0;
1534
+ let match = importPattern.exec(css);
1535
+ while (match !== null) {
1536
+ insertionIndex = match.index + match[0].length;
1537
+ match = importPattern.exec(css);
1538
+ }
1539
+ return insertionIndex;
1540
+ }
1541
+ function applyMiniProgramTailwindV4DefaultColorCss(css) {
1542
+ const themeCss = createTailwindV4DefaultColorThemeCss();
1543
+ const insertionIndex = findLeadingImportInsertionIndex(css);
1544
+ if (insertionIndex === 0) return `${themeCss}\n${css}`;
1545
+ return `${css.slice(0, insertionIndex)}\n${themeCss}\n${css.slice(insertionIndex)}`;
1546
+ }
1547
+ function collectCandidates$1(candidates) {
1548
+ return new Set(candidates ?? []);
1549
+ }
1550
+ function hasRemovedCandidates$1(previousCandidates, nextCandidates) {
1551
+ for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
1552
+ return false;
1553
+ }
1554
+ function normalizeRpxTextCandidate(candidate) {
1555
+ return candidate.replace(BARE_RPX_TEXT_CANDIDATE_RE, "$1text-[length:$2]$3");
1556
+ }
1557
+ function normalizeRpxTextCandidates(candidates) {
1558
+ const normalized = /* @__PURE__ */ new Set();
1559
+ const restoreCandidates = /* @__PURE__ */ new Map();
1560
+ for (const candidate of candidates) {
1561
+ const normalizedCandidate = normalizeRpxTextCandidate(candidate);
1562
+ normalized.add(normalizedCandidate);
1563
+ if (normalizedCandidate !== candidate) restoreCandidates.set(normalizedCandidate, candidate);
1564
+ }
1565
+ return {
1566
+ candidates: normalized,
1567
+ restoreCandidates
1568
+ };
1569
+ }
1570
+ function restoreRpxTextCandidates(candidates, restoreCandidates) {
1571
+ if (restoreCandidates.size === 0) return new Set(candidates);
1572
+ return new Set([...candidates].map((candidate) => restoreCandidates.get(candidate) ?? candidate));
1573
+ }
1574
+ function normalizeCssEscapedRpxSelectorValue(value) {
1575
+ return value.replace(/\\([.+-])/g, "$1");
1576
+ }
1577
+ function restoreRpxTextCssSelectors(css, restoreCandidates) {
1578
+ if (restoreCandidates.size === 0 || !css.includes("text-\\[length\\:")) return css;
1579
+ const restoredValues = new Set([...restoreCandidates.keys()].map((candidate) => {
1580
+ return BARE_RPX_TEXT_CANDIDATE_RE.exec(candidate.replace("[length:", "["))?.[2];
1581
+ }).filter((value) => Boolean(value)));
1582
+ return css.replace(RPX_TEXT_LENGTH_SELECTOR_RE, (match, value) => {
1583
+ return restoredValues.has(normalizeCssEscapedRpxSelectorValue(value)) ? `text-\\[${value}\\]` : match;
1584
+ });
1585
+ }
1586
+ function createStableJson$1(value) {
1587
+ if (value === void 0) return "undefined";
1588
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
1589
+ if (Array.isArray(value)) return `[${value.map((item) => createStableJson$1(item)).join(",")}]`;
1590
+ return `{${Object.keys(value).sort().map((key) => {
1591
+ const record = value;
1592
+ return `${JSON.stringify(key)}:${createStableJson$1(record[key])}`;
1593
+ }).join(",")}}`;
1594
+ }
1595
+ function createDependencyFingerprint$1(files) {
1596
+ return files.map((file) => {
1597
+ try {
1598
+ const stat = fs.statSync(file);
1599
+ return `${file}:${stat.size}:${stat.mtimeMs}`;
1600
+ } catch {
1601
+ return `${file}:missing`;
1602
+ }
1603
+ }).join("|");
1604
+ }
1605
+ function createIncrementalGenerateCacheKey$1(source, target, styleOptions, tailwindcssV3Compatibility) {
1606
+ return [
1607
+ source.projectRoot,
1608
+ source.base,
1609
+ createStableJson$1(source.baseFallbacks),
1610
+ source.css,
1611
+ createDependencyFingerprint$1(source.dependencies),
1612
+ target,
1613
+ createStableJson$1(styleOptions),
1614
+ createStableJson$1(tailwindcssV3Compatibility)
1615
+ ].join("\0");
1616
+ }
1617
+ function createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources) {
1618
+ return [
1619
+ cacheKey,
1620
+ scanSources === true ? "scan:1" : "scan:0",
1621
+ [...requestedCandidates].sort().join("\n")
1622
+ ].join("\0");
1623
+ }
1624
+ function runIncrementalGenerateTask(cacheKey, requestedCandidates, scanSources, task) {
1625
+ const taskKey = createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources);
1626
+ const cachedTask = incrementalGenerateTaskCache.get(taskKey);
1627
+ if (cachedTask) return cachedTask;
1628
+ const promise = task();
1629
+ incrementalGenerateTaskCache.set(taskKey, promise);
1630
+ promise.finally(() => {
1631
+ if (incrementalGenerateTaskCache.get(taskKey) === promise) incrementalGenerateTaskCache.delete(taskKey);
1632
+ });
1633
+ return promise;
1634
+ }
1635
+ function createIncrementalDesignSystemPromise(source, cacheKey) {
1636
+ const promise = loadTailwindV4DesignSystem(source);
1637
+ promise.catch(() => {
1638
+ if (incrementalGenerateCache$1.get(cacheKey)?.designSystemPromise === promise) incrementalGenerateCache$1.delete(cacheKey);
1639
+ });
1640
+ return promise;
1641
+ }
1642
+ function createCompatibleSource(source, target, tailwindcssV3Compatibility) {
1643
+ const shouldApplyTailwindV3Compatibility = tailwindcssV3Compatibility ?? target === "weapp";
1644
+ const filteredSourceCss = target === "weapp" ? removeUnlayeredTailwindV4PreflightImports(source.css) : source.css;
1645
+ const compatibleSourceCss = removeUnsupportedThemeVendorKeyframes(shouldApplyTailwindV3Compatibility ? applyTailwindV3CompatibilityCss(filteredSourceCss) : target === "weapp" ? applyMiniProgramTailwindV4DefaultColorCss(filteredSourceCss) : filteredSourceCss);
1646
+ return compatibleSourceCss === source.css ? source : {
1647
+ ...source,
1648
+ css: compatibleSourceCss
1649
+ };
1650
+ }
1651
+ function resolveTargetCandidates(candidates, target) {
1652
+ const collected = collectCandidates$1(candidates);
1653
+ return target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(collected) : collected;
1654
+ }
1655
+ function collectSeenCandidates(generated, requestedCandidates) {
1656
+ return new Set([
1657
+ ...requestedCandidates,
1658
+ ...generated.rawCandidates,
1659
+ ...generated.classSet
1660
+ ]);
1661
+ }
1662
+ function createIncrementalStyleOptions(styleOptions) {
1663
+ return {
1664
+ ...styleOptions,
1665
+ isMainChunk: false
1666
+ };
1667
+ }
1668
+ function resolveStyleOptions$1(source, options) {
1669
+ return hasCssMacroTailwindV4Directive(source.css) ? withCssMacroStyleOptions(options) : options;
1670
+ }
1671
+ function collectCustomPropertyValues(css) {
1672
+ const values = /* @__PURE__ */ new Map();
1673
+ try {
1674
+ postcss.parse(css).walkDecls((decl) => {
1675
+ if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
1676
+ });
1677
+ } catch {}
1678
+ return values;
1679
+ }
1680
+ function mergeCustomPropertyValues(target, css) {
1681
+ for (const [prop, value] of collectCustomPropertyValues(css)) target.set(prop, value);
1682
+ }
1683
+ function seedIncrementalGenerateCache(options) {
1684
+ const cacheKey = createIncrementalGenerateCacheKey$1(options.compatibleSource, options.target, options.styleOptions, options.tailwindcssV3Compatibility);
1685
+ const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
1686
+ mergeCustomPropertyValues(customPropertyValues, options.generated.css);
1687
+ incrementalGenerateCache$1.set(cacheKey, {
1688
+ seenCandidates: collectSeenCandidates(options.generated, options.requestedCandidates),
1689
+ classSet: new Set(options.generated.classSet),
1690
+ css: options.generated.css,
1691
+ rawCss: options.generated.rawCss,
1692
+ customPropertyValues,
1693
+ designSystemPromise: createIncrementalDesignSystemPromise(options.compatibleSource, cacheKey),
1694
+ dependencies: options.generated.dependencies,
1695
+ sources: options.generated.sources,
1696
+ root: options.generated.root,
1697
+ target: options.generated.target
1698
+ });
1699
+ }
1700
+ function parseImportSourceParam$1(params) {
1701
+ const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
1702
+ if (!match) return;
1703
+ return {
1704
+ none: match[1] === "none",
1705
+ sourcePath: match[3]
1706
+ };
1707
+ }
1708
+ function isTailwindCssImport$1(params) {
1709
+ return /^\s*(['"])tailwindcss(?:\/[^'"]*)?\1/.test(params);
1710
+ }
1711
+ function parseCssImportSpecifier$1(params) {
1712
+ const value = params.trim();
1713
+ const quoted = /^(['"])(.*?)\1/.exec(value);
1714
+ if (quoted) return quoted[2];
1715
+ const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
1716
+ return url?.[2] ?? url?.[3];
1717
+ }
1718
+ function isTailwindCssPreflightImport(params) {
1719
+ const specifier = parseCssImportSpecifier$1(params);
1720
+ return specifier === "tailwindcss/preflight.css" || specifier === "tailwindcss/preflight";
1721
+ }
1722
+ function hasImportLayerOption(params) {
1723
+ return /\blayer(?:\s*\(|\s*$)/.test(params);
1724
+ }
1725
+ function removeUnlayeredTailwindV4PreflightImports(css) {
1726
+ if (!css.includes("preflight")) return css;
1727
+ let root;
1728
+ try {
1729
+ root = postcss.parse(css);
1730
+ } catch {
1731
+ return css;
1732
+ }
1733
+ let changed = false;
1734
+ root.walkAtRules("import", (rule) => {
1735
+ if (isTailwindCssPreflightImport(rule.params) && !hasImportLayerOption(rule.params)) {
1736
+ rule.remove();
1737
+ changed = true;
1738
+ }
1739
+ });
1740
+ return changed ? root.toString() : css;
1741
+ }
1742
+ function resolveSourceBase$1(base, sourcePath) {
1743
+ return path.isAbsolute(sourcePath) ? sourcePath : path.resolve(base, sourcePath);
1744
+ }
1745
+ function createDefaultIgnoredScanSources(base) {
1746
+ return TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS.map((pattern) => ({
1747
+ base,
1748
+ pattern,
1749
+ negated: true
1750
+ }));
1751
+ }
1752
+ function normalizeCssDefinedScanSources(base, entries) {
1753
+ return entries.length > 0 && entries.every((entry) => entry.negated) ? [{
1754
+ base,
1755
+ pattern: "**/*",
1756
+ negated: false
1757
+ }, ...entries] : entries;
1758
+ }
1759
+ async function resolveCssDefinedScanSources(source) {
1760
+ let importSourceBase;
1761
+ let hasSourceNone = false;
1762
+ const from = source.dependencies[0];
1763
+ let root;
1764
+ try {
1765
+ root = postcss.parse(source.css, { from });
1766
+ } catch {
1767
+ return;
1768
+ }
1769
+ root.walkAtRules((rule) => {
1770
+ if (rule.name === "import") {
1771
+ if (!isTailwindCssImport$1(rule.params)) return;
1772
+ const sourceParam = parseImportSourceParam$1(rule.params);
1773
+ if (sourceParam?.none) hasSourceNone = true;
1774
+ if (sourceParam?.sourcePath) importSourceBase = resolveSourceBase$1(source.base, sourceParam.sourcePath);
1775
+ }
1776
+ });
1777
+ const sourcePatterns = await resolveCssSourceEntries(root, source.base, "**/*");
1778
+ if (!importSourceBase) {
1779
+ if (sourcePatterns.length > 0) return [...normalizeCssDefinedScanSources(source.base, sourcePatterns), ...createDefaultIgnoredScanSources(source.base)];
1780
+ if (hasSourceNone) return false;
1781
+ return;
1782
+ }
1783
+ return [
1784
+ await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"),
1785
+ ...sourcePatterns,
1786
+ ...createDefaultIgnoredScanSources(importSourceBase)
1787
+ ];
1788
+ }
1789
+ async function resolveScanSources(source, scanSources) {
1790
+ if (scanSources !== true) return scanSources;
1791
+ return await resolveCssDefinedScanSources(source) ?? false;
1792
+ }
1793
+ function hasThemeParent(rule) {
1794
+ let parent = rule.parent;
1795
+ while (parent) {
1796
+ if (parent.type === "atrule" && parent.name === "theme") return true;
1797
+ parent = parent.parent;
1798
+ }
1799
+ return false;
1800
+ }
1801
+ function isVendorPrefixedKeyframes(rule) {
1802
+ return rule.name.startsWith("-") && rule.name.endsWith("keyframes");
1803
+ }
1804
+ function removeUnsupportedThemeVendorKeyframes(css) {
1805
+ if (!css.includes("@theme") || !css.includes("@-")) return css;
1806
+ let root;
1807
+ try {
1808
+ root = postcss.parse(css);
1809
+ } catch {
1810
+ return css;
1811
+ }
1812
+ let changed = false;
1813
+ root.walkAtRules((rule) => {
1814
+ if (isVendorPrefixedKeyframes(rule) && hasThemeParent(rule)) {
1815
+ rule.remove();
1816
+ changed = true;
1817
+ }
1818
+ });
1819
+ return changed ? root.toString() : css;
1820
+ }
1821
+ function createTailwindV4Engine$1(source) {
1822
+ async function generateOnce(generateSource, options = {}) {
1823
+ const { scanSources = true, styleOptions, tailwindcssV3Compatibility, target = "weapp", ...patchOptions } = options;
1824
+ const resolvedStyleOptions = resolveStyleOptions$1(generateSource, styleOptions);
1825
+ const engine = createTailwindV4Engine(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
1826
+ const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
1827
+ const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await extractRawCandidates(resolvedScanSources, { bareArbitraryValues: patchOptions.bareArbitraryValues })) : void 0;
1828
+ const normalizedCandidates = normalizeRpxTextCandidates(resolveTargetCandidates(new Set([...collectCandidates$1(patchOptions.candidates), ...filesystemCandidates ?? []]), target));
1829
+ const result = await engine.generate(omitUndefined({
1830
+ scanSources: false,
1831
+ ...patchOptions,
1832
+ candidates: normalizedCandidates.candidates
1833
+ }));
1834
+ const rawCss = restoreRpxTextCssSelectors(result.css, normalizedCandidates.restoreCandidates);
1835
+ const css = await transformTailwindV4CssByTarget(rawCss, target, resolvedStyleOptions);
1836
+ return {
1837
+ ...result,
1838
+ classSet: restoreRpxTextCandidates(result.classSet, normalizedCandidates.restoreCandidates),
1839
+ rawCandidates: restoreRpxTextCandidates(result.rawCandidates, normalizedCandidates.restoreCandidates),
1840
+ css,
1841
+ rawCss,
1842
+ target
1843
+ };
1844
+ }
1845
+ async function generateWithIncrementalCache(options = {}) {
1846
+ const target = options.target ?? "weapp";
1847
+ const compatibleSource = createCompatibleSource(source, target, options.tailwindcssV3Compatibility);
1848
+ const requestedCandidates = resolveTargetCandidates(options.candidates, target);
1849
+ const styleOptions = resolveStyleOptions$1(source, options.styleOptions);
1850
+ if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(source, options);
1851
+ const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target, styleOptions, options.tailwindcssV3Compatibility);
1852
+ if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1853
+ const generated = await generateOnce(source, options);
1854
+ seedIncrementalGenerateCache({
1855
+ compatibleSource,
1856
+ generated,
1857
+ requestedCandidates,
1858
+ styleOptions: options.styleOptions,
1859
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
1860
+ target
1861
+ });
1862
+ return generated;
1863
+ });
1864
+ const cached = incrementalGenerateCache$1.get(cacheKey);
1865
+ if (cached) {
1866
+ if (hasRemovedCandidates$1(cached.seenCandidates, requestedCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1867
+ const generated = await generateOnce(source, options);
1868
+ seedIncrementalGenerateCache({
1869
+ compatibleSource,
1870
+ generated,
1871
+ requestedCandidates,
1872
+ styleOptions,
1873
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
1874
+ target
1875
+ });
1876
+ return generated;
1877
+ });
1878
+ const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
1879
+ if (missingCandidates.length === 0) return {
1880
+ css: cached.css,
1881
+ rawCss: cached.rawCss,
1882
+ incrementalCss: "",
1883
+ incrementalRawCss: "",
1884
+ classSet: new Set(cached.classSet),
1885
+ rawCandidates: new Set(cached.seenCandidates),
1886
+ dependencies: cached.dependencies,
1887
+ sources: cached.sources,
1888
+ root: cached.root,
1889
+ target: cached.target
1890
+ };
1891
+ return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1892
+ const designSystem = await cached.designSystemPromise;
1893
+ const normalizedMissing = normalizeRpxTextCandidates(missingCandidates);
1894
+ const normalizedMissingCandidates = [...normalizedMissing.candidates];
1895
+ const cssByCandidate = designSystem.candidatesToCss(normalizedMissingCandidates);
1896
+ const rawCssParts = [];
1897
+ const classSet = /* @__PURE__ */ new Set();
1898
+ for (let index = 0; index < normalizedMissingCandidates.length; index += 1) {
1899
+ const candidate = normalizedMissingCandidates[index];
1900
+ const css = cssByCandidate[index];
1901
+ if (candidate && typeof css === "string" && css.trim().length > 0) {
1902
+ rawCssParts.push(restoreRpxTextCssSelectors(css, normalizedMissing.restoreCandidates));
1903
+ classSet.add(normalizedMissing.restoreCandidates.get(candidate) ?? candidate);
1904
+ }
1905
+ }
1906
+ const rawCss = rawCssParts.join("\n");
1907
+ const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, {
1908
+ ...createIncrementalStyleOptions(styleOptions),
1909
+ customPropertyValues: cached.customPropertyValues
1910
+ }) : "";
1911
+ for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
1912
+ for (const className of classSet) cached.classSet.add(className);
1913
+ cached.css = [cached.css, incrementalCss].filter(Boolean).join("\n");
1914
+ cached.rawCss = [cached.rawCss, rawCss].filter(Boolean).join("\n");
1915
+ mergeCustomPropertyValues(cached.customPropertyValues, incrementalCss);
1916
+ return {
1917
+ css: cached.css,
1918
+ rawCss: cached.rawCss,
1919
+ incrementalCss,
1920
+ incrementalRawCss: rawCss,
1921
+ classSet: new Set(cached.classSet),
1922
+ rawCandidates: new Set(cached.seenCandidates),
1923
+ dependencies: cached.dependencies,
1924
+ sources: cached.sources,
1925
+ root: cached.root,
1926
+ target: cached.target
1927
+ };
1928
+ });
1929
+ }
1930
+ return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1931
+ const generated = await generateOnce(source, options);
1932
+ seedIncrementalGenerateCache({
1933
+ compatibleSource,
1934
+ generated,
1935
+ requestedCandidates,
1936
+ styleOptions,
1937
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
1938
+ target
1939
+ });
1940
+ return generated;
1941
+ });
1942
+ }
1943
+ async function generate(options = {}) {
1944
+ return options.incrementalCache ? generateWithIncrementalCache(options) : generateOnce(source, options);
1945
+ }
1946
+ return {
1947
+ source,
1948
+ loadDesignSystem: createTailwindV4Engine(source).loadDesignSystem,
1949
+ validateCandidates: createTailwindV4Engine(source).validateCandidates,
1950
+ generate
1951
+ };
1952
+ }
1953
+ //#endregion
1954
+ //#region src/tailwindcss/v4-engine/source.ts
1955
+ function isPostcssPluginImportTarget(value) {
1956
+ if (!value) return false;
1957
+ return value === "@tailwindcss/postcss" || value.includes("/postcss");
1958
+ }
1959
+ function uniqueDefined(values) {
1960
+ return [...new Set(values.filter((value) => typeof value === "string" && value.length > 0))];
1961
+ }
1962
+ function getProjectRoot$1(patcher) {
1963
+ return patcher.options?.projectRoot ?? process.cwd();
1964
+ }
1965
+ function resolveBase(value, fallback) {
1966
+ return value === void 0 ? fallback : path.isAbsolute(value) ? path.resolve(value) : path.resolve(fallback, value);
1967
+ }
1968
+ function resolveConfigDir(config, projectRoot) {
1969
+ if (!config) return;
1970
+ const configPath = path.isAbsolute(config) ? config : path.resolve(projectRoot, config);
1971
+ return path.dirname(configPath);
1972
+ }
1973
+ function isBarePackageSpecifier(specifier) {
1974
+ return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.includes("\\") && !/^[a-z][a-z\d+.-]*:/i.test(specifier);
1975
+ }
1976
+ function parseCssImportSpecifier(params) {
1977
+ const value = params.trim();
1978
+ const quoted = /^(['"])(.*?)\1/.exec(value);
1979
+ if (quoted) {
1980
+ const specifier = quoted[2];
1981
+ if (specifier === void 0) return;
1982
+ return {
1983
+ quote: quoted[1],
1984
+ raw: quoted[0],
1985
+ specifier
1986
+ };
1987
+ }
1988
+ const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
1989
+ if (!url) return;
1990
+ const specifier = url[2] ?? url[3];
1991
+ if (specifier === void 0) return;
1992
+ return {
1993
+ quote: url[1],
1994
+ raw: url[0],
1995
+ specifier
1996
+ };
1997
+ }
1998
+ function quoteCssImportSpecifier(specifier, quote = "\"") {
1999
+ return `${quote}${specifier.replaceAll("\\", "\\\\").replaceAll(quote, `\\${quote}`)}${quote}`;
2000
+ }
2001
+ function createTailwindV4CssImportSpecifierSet(packageName) {
2002
+ const specifiers = new Set(["tailwindcss"]);
2003
+ if (packageName && isBarePackageSpecifier(packageName)) specifiers.add(packageName);
2004
+ return specifiers;
2005
+ }
2006
+ function normalizeTailwindV4CssPackageImports(css, packageName) {
2007
+ if (!css.includes("tailwindcss")) return css;
2008
+ let root;
2009
+ try {
2010
+ root = postcss.parse(css);
2011
+ } catch {
2012
+ return css;
2013
+ }
2014
+ const importSpecifiers = createTailwindV4CssImportSpecifierSet(packageName);
2015
+ let changed = false;
2016
+ root.walkAtRules("import", (rule) => {
2017
+ const parsed = parseCssImportSpecifier(rule.params);
2018
+ if (!parsed || !importSpecifiers.has(parsed.specifier)) return;
2019
+ rule.params = rule.params.replace(parsed.raw, quoteCssImportSpecifier(`${parsed.specifier}/index.css`, parsed.quote));
2020
+ changed = true;
2021
+ });
2022
+ return changed ? root.toString() : css;
2023
+ }
2024
+ function resolveTailwindCssImportTarget(patcher) {
2025
+ const configuredPackageName = resolveTailwindcssOptions(patcher.options)?.packageName;
2026
+ if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) return configuredPackageName;
2027
+ const packageName = patcher.packageInfo?.name;
2028
+ if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) return packageName;
2029
+ return "tailwindcss";
2030
+ }
2031
+ function readTailwindV4Options(patcher) {
2032
+ return resolveTailwindcssOptions(patcher.options)?.v4 ?? patcher.options?.tailwind?.v4;
2033
+ }
2034
+ function isRawTailwindcssPatchOptions(options) {
2035
+ return Boolean(options && "tailwindcss" in options);
2036
+ }
2037
+ function resolvePatchTailwindV4SourceOptions(patcher) {
2038
+ if (patcher.options) {
2039
+ const projectRoot = getProjectRoot$1(patcher);
2040
+ const tailwindOptions = resolveTailwindcssOptions(patcher.options);
2041
+ const tailwindV4Options = readTailwindV4Options(patcher);
2042
+ const cwd = resolveBase(tailwindOptions?.cwd, projectRoot);
2043
+ const configuredBase = tailwindV4Options?.configuredBase ?? (isRawTailwindcssPatchOptions(patcher.options) ? tailwindV4Options?.base : void 0);
2044
+ const baseFallbacks = uniqueDefined([
2045
+ configuredBase,
2046
+ cwd,
2047
+ projectRoot,
2048
+ resolveConfigDir(tailwindOptions?.config, projectRoot)
2049
+ ]);
2050
+ return {
2051
+ projectRoot,
2052
+ cwd,
2053
+ ...configuredBase === void 0 ? {} : { base: configuredBase },
2054
+ baseFallbacks,
2055
+ ...tailwindV4Options?.css === void 0 ? {} : { css: tailwindV4Options.css },
2056
+ ...tailwindV4Options?.cssSources === void 0 ? {} : { cssSources: tailwindV4Options.cssSources },
2057
+ ...tailwindV4Options?.cssEntries === void 0 ? {} : { cssEntries: tailwindV4Options.cssEntries },
2058
+ packageName: resolveTailwindCssImportTarget(patcher)
2059
+ };
2060
+ }
2061
+ return {
2062
+ projectRoot: getProjectRoot$1(patcher),
2063
+ packageName: resolveTailwindCssImportTarget(patcher)
2064
+ };
2065
+ }
2066
+ function resolveTailwindV4SourceOptionsFromPatcher(patcher) {
2067
+ const tailwindV4Options = readTailwindV4Options(patcher);
2068
+ return omitUndefined({
2069
+ ...resolvePatchTailwindV4SourceOptions(patcher),
2070
+ sources: tailwindV4Options?.sources
2071
+ });
2072
+ }
2073
+ function resolveTailwindV4Source$1(options) {
2074
+ return resolveTailwindV4Source(options?.css === void 0 ? options : {
2075
+ ...options,
2076
+ css: normalizeTailwindV4CssPackageImports(options.css, options.packageName)
2077
+ });
2078
+ }
2079
+ async function resolveTailwindV4SourceFromPatcher(patcher) {
2080
+ return resolveTailwindV4Source$1(resolveTailwindV4SourceOptionsFromPatcher(patcher));
2081
+ }
2082
+ //#endregion
2083
+ //#region src/bundlers/vite/static-config-content.ts
2084
+ function skipWhitespaceAndComments(source, start) {
2085
+ let index = start;
2086
+ while (index < source.length) {
2087
+ const char = source[index];
2088
+ if (/\s/.test(char ?? "")) {
2089
+ index += 1;
2090
+ continue;
2091
+ }
2092
+ if (char === "/" && source[index + 1] === "/") {
2093
+ index += 2;
2094
+ while (index < source.length && source[index] !== "\n") index += 1;
2095
+ continue;
2096
+ }
2097
+ if (char === "/" && source[index + 1] === "*") {
2098
+ index += 2;
2099
+ while (index < source.length && !(source[index] === "*" && source[index + 1] === "/")) index += 1;
2100
+ index = Math.min(index + 2, source.length);
2101
+ continue;
2102
+ }
2103
+ break;
2104
+ }
2105
+ return index;
2106
+ }
2107
+ function readQuotedString(source, start) {
2108
+ const quote = source[start];
2109
+ if (quote !== "\"" && quote !== "'") return;
2110
+ let value = "";
2111
+ for (let index = start + 1; index < source.length; index++) {
2112
+ const char = source[index];
2113
+ if (char === "\\") {
2114
+ const next = source[index + 1];
2115
+ if (next === void 0) return;
2116
+ value += next;
2117
+ index += 1;
2118
+ continue;
2119
+ }
2120
+ if (char === quote) return {
2121
+ end: index + 1,
2122
+ value
2123
+ };
2124
+ value += char;
2125
+ }
2126
+ }
2127
+ function readIdentifier(source, start) {
2128
+ return /^[A-Z_$][\w$]*/i.exec(source.slice(start))?.[0];
2129
+ }
2130
+ function findMatchingBracket(source, start, open, close) {
2131
+ let depth = 0;
2132
+ let quote;
2133
+ for (let index = start; index < source.length; index++) {
2134
+ const char = source[index];
2135
+ if (char === "\\") {
2136
+ index += 1;
2137
+ continue;
2138
+ }
2139
+ if (quote) {
2140
+ if (char === quote) quote = void 0;
2141
+ continue;
2142
+ }
2143
+ if (char === "\"" || char === "'") {
2144
+ quote = char;
2145
+ continue;
2146
+ }
2147
+ if (char === "`") return;
2148
+ if (char === open) {
2149
+ depth += 1;
2150
+ continue;
2151
+ }
2152
+ if (char === close) {
2153
+ depth -= 1;
2154
+ if (depth === 0) return index;
2155
+ }
2156
+ }
2157
+ }
2158
+ function findContentPropertyValue(source) {
2159
+ let index = 0;
2160
+ while (index < source.length) {
2161
+ const nextIndex = source.indexOf("content", index);
2162
+ if (nextIndex === -1) return;
2163
+ const previous = source[nextIndex - 1];
2164
+ const next = source[nextIndex + 7];
2165
+ if (previous && /[\w$]/.test(previous) || next && /[\w$]/.test(next)) {
2166
+ index = nextIndex + 7;
2167
+ continue;
2168
+ }
2169
+ let colonIndex = skipWhitespaceAndComments(source, nextIndex + 7);
2170
+ if (source[colonIndex] !== ":") {
2171
+ index = nextIndex + 7;
2172
+ continue;
2173
+ }
2174
+ colonIndex = skipWhitespaceAndComments(source, colonIndex + 1);
2175
+ return { start: colonIndex };
2176
+ }
2177
+ }
2178
+ function parseStaticContentArray(source, start) {
2179
+ if (source[start] !== "[") return;
2180
+ const value = [];
2181
+ let index = skipWhitespaceAndComments(source, start + 1);
2182
+ while (index < source.length) {
2183
+ if (source[index] === "]") return {
2184
+ end: index + 1,
2185
+ value
2186
+ };
2187
+ const parsed = parseStaticContentValue(source, index);
2188
+ if (!parsed) return;
2189
+ value.push(parsed.value);
2190
+ index = skipWhitespaceAndComments(source, parsed.end);
2191
+ if (source[index] === ",") {
2192
+ index = skipWhitespaceAndComments(source, index + 1);
2193
+ continue;
2194
+ }
2195
+ if (source[index] === "]") continue;
2196
+ return;
2197
+ }
2198
+ }
2199
+ function parseStaticContentObject(source, start) {
2200
+ if (source[start] !== "{") return;
2201
+ const end = findMatchingBracket(source, start, "{", "}");
2202
+ if (end === void 0) return;
2203
+ let index = skipWhitespaceAndComments(source, start + 1);
2204
+ let files;
2205
+ while (index < end) {
2206
+ let key;
2207
+ const quotedKey = readQuotedString(source, index);
2208
+ if (quotedKey) {
2209
+ key = quotedKey.value;
2210
+ index = quotedKey.end;
2211
+ } else {
2212
+ key = readIdentifier(source, index);
2213
+ if (!key) return;
2214
+ index += key.length;
2215
+ }
2216
+ index = skipWhitespaceAndComments(source, index);
2217
+ if (source[index] !== ":") return;
2218
+ index = skipWhitespaceAndComments(source, index + 1);
2219
+ const parsedValue = parseStaticContentValue(source, index);
2220
+ if (!parsedValue) return;
2221
+ if (key === "files") files = parsedValue.value;
2222
+ index = skipWhitespaceAndComments(source, parsedValue.end);
2223
+ if (source[index] === ",") {
2224
+ index = skipWhitespaceAndComments(source, index + 1);
2225
+ continue;
2226
+ }
2227
+ if (index < end) return;
2228
+ }
2229
+ return files === void 0 ? void 0 : {
2230
+ end: end + 1,
2231
+ value: { files }
2232
+ };
2233
+ }
2234
+ function parseStaticContentValue(source, start) {
2235
+ const index = skipWhitespaceAndComments(source, start);
2236
+ const quoted = readQuotedString(source, index);
2237
+ if (quoted) return quoted;
2238
+ if (source[index] === "[") return parseStaticContentArray(source, index);
2239
+ if (source[index] === "{") return parseStaticContentObject(source, index);
2240
+ }
2241
+ function readStaticConfigContent(configPath) {
2242
+ let source;
2243
+ try {
2244
+ source = readFileSync(configPath, "utf8");
2245
+ } catch {
2246
+ return;
2247
+ }
2248
+ const contentProperty = findContentPropertyValue(source);
2249
+ if (!contentProperty) return;
2250
+ return parseStaticContentValue(source, contentProperty.start)?.value;
2251
+ }
2252
+ //#endregion
2253
+ //#region src/bundlers/vite/source-scan.ts
2254
+ const VITE_SOURCE_CANDIDATE_PATTERN = FULL_SOURCE_SCAN_PATTERN;
2255
+ const VITE_TAILWIND_CSS_ENTRY_PATTERN = "**/*.{css,less,sass,scss,styl,stylus,pcss,postcss}";
2256
+ const tailwindV4CssEntriesCache = /* @__PURE__ */ new Map();
2257
+ function parseImportSourceParam(params) {
2258
+ const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
2259
+ if (!match) return;
2260
+ return {
2261
+ none: match[1] === "none",
2262
+ sourcePath: match[3]
2263
+ };
2264
+ }
2265
+ function isTailwindCssImport(params) {
2266
+ return /^\s*(['"])tailwindcss(?:\/[^'"]*)?\1/.test(params);
2267
+ }
2268
+ function resolveSourceBase(base, sourcePath) {
2269
+ return path.isAbsolute(sourcePath) ? sourcePath : path.resolve(base, sourcePath);
2270
+ }
2271
+ function resolveConfigPath(base, configPath) {
2272
+ if (path.isAbsolute(configPath)) return path.resolve(configPath);
2273
+ let current = path.resolve(base);
2274
+ while (true) {
2275
+ const candidate = path.resolve(current, configPath);
2276
+ if (existsSync(candidate)) return candidate;
2277
+ const parent = path.dirname(current);
2278
+ if (parent === current) break;
2279
+ current = parent;
2280
+ }
2281
+ return path.resolve(base, configPath);
2282
+ }
2283
+ function createCssEntriesCacheKey(css, base, dependencies) {
2284
+ return JSON.stringify({
2285
+ base: path.resolve(base),
2286
+ css,
2287
+ dependencies
2288
+ });
2289
+ }
2290
+ function addSourceScanDependency(dependencies, file) {
2291
+ if (typeof file === "string" && file.length > 0) dependencies.add(path.resolve(file));
2292
+ }
2293
+ function addSourceScanDependencies(dependencies, files) {
2294
+ for (const file of files ?? []) addSourceScanDependency(dependencies, file);
2295
+ }
2296
+ function createResolvedViteSourceScan(input, dependencies) {
2297
+ return {
2298
+ ...input,
2299
+ ...dependencies.size > 0 ? { dependencies: [...dependencies].sort() } : {}
2300
+ };
2301
+ }
2302
+ async function statConfigDependency(file) {
2303
+ try {
2304
+ const stats = await stat(file);
2305
+ return {
2306
+ file,
2307
+ mtimeMs: stats.mtimeMs,
2308
+ size: stats.size
2309
+ };
2310
+ } catch {
2311
+ return {
2312
+ file,
2313
+ mtimeMs: -1,
2314
+ size: -1
2315
+ };
2316
+ }
2317
+ }
2318
+ async function collectConfigDependencySignatures(root, base) {
2319
+ const configPaths = /* @__PURE__ */ new Set();
2320
+ root.walkAtRules("config", (rule) => {
2321
+ const configPath = parseConfigParam$1(rule.params);
2322
+ if (configPath) configPaths.add(resolveConfigPath(base, configPath));
2323
+ });
2324
+ return Promise.all([...configPaths].sort().map(statConfigDependency));
2325
+ }
2326
+ function mergeTailwindInlineSourceCandidates(allInlineCandidates) {
2327
+ const merged = {
2328
+ included: /* @__PURE__ */ new Set(),
2329
+ excluded: /* @__PURE__ */ new Set()
2330
+ };
2331
+ for (const inlineCandidates of allInlineCandidates) {
2332
+ if (!inlineCandidates) continue;
2333
+ for (const candidate of inlineCandidates.included) if (!merged.excluded.has(candidate)) merged.included.add(candidate);
2334
+ for (const candidate of inlineCandidates.excluded) {
2335
+ merged.excluded.add(candidate);
2336
+ merged.included.delete(candidate);
2337
+ }
2338
+ }
2339
+ return merged.included.size > 0 || merged.excluded.size > 0 ? merged : void 0;
2340
+ }
2341
+ async function resolveConfigContentEntries(root, base) {
2342
+ const configPaths = /* @__PURE__ */ new Set();
2343
+ root.walkAtRules("config", (rule) => {
2344
+ const configPath = parseConfigParam$1(rule.params);
2345
+ if (configPath) configPaths.add(resolveConfigPath(base, configPath));
2346
+ });
2347
+ const entries = [];
2348
+ for (const configPath of configPaths) {
2349
+ const staticContent = readStaticConfigContent(configPath);
2350
+ if (staticContent !== void 0) {
2351
+ entries.push(...normalizeLegacyContentEntries(staticContent, path.dirname(configPath)));
2352
+ continue;
2353
+ }
2354
+ try {
2355
+ const loaded = await loadConfig({
2356
+ config: configPath,
2357
+ cwd: path.dirname(configPath)
2358
+ });
2359
+ entries.push(...normalizeLegacyContentEntries(loaded?.config.content, path.dirname(configPath)));
2360
+ } catch {}
2361
+ }
2362
+ return {
2363
+ dependencies: [...configPaths],
2364
+ entries
2365
+ };
2366
+ }
2367
+ async function resolveTailwindV4EntriesFromCss(css, base) {
2368
+ let root;
2369
+ try {
2370
+ root = postcss.parse(css);
2371
+ } catch {
2372
+ return;
2373
+ }
2374
+ let importSourceBase;
2375
+ let hasSourceNone = false;
2376
+ let hasTailwindCssImport = false;
2377
+ const [sourceEntries, configEntries] = await Promise.all([resolveCssSourceEntries(root, base, VITE_SOURCE_CANDIDATE_PATTERN), resolveConfigContentEntries(root, base)]);
2378
+ const entries = [...configEntries.entries, ...sourceEntries];
2379
+ const hasPositiveEntries = entries.some((entry) => !entry.negated);
2380
+ const inlineCandidates = collectCssInlineSourceCandidates(root);
2381
+ root.walkAtRules("import", (rule) => {
2382
+ if (!isTailwindCssImport(rule.params)) return;
2383
+ hasTailwindCssImport = true;
2384
+ const sourceParam = parseImportSourceParam(rule.params);
2385
+ if (sourceParam?.none) hasSourceNone = true;
2386
+ if (sourceParam?.sourcePath) importSourceBase = resolveSourceBase(base, sourceParam.sourcePath);
2387
+ });
2388
+ if (importSourceBase) return {
2389
+ entries: [{
2390
+ base: importSourceBase,
2391
+ negated: false,
2392
+ pattern: VITE_SOURCE_CANDIDATE_PATTERN
2393
+ }, ...entries],
2394
+ explicit: true,
2395
+ inlineCandidates,
2396
+ dependencies: configEntries.dependencies
2397
+ };
2398
+ if (hasSourceNone) return {
2399
+ entries,
2400
+ explicit: true,
2401
+ inlineCandidates,
2402
+ dependencies: configEntries.dependencies
2403
+ };
2404
+ if (hasPositiveEntries) return {
2405
+ entries,
2406
+ explicit: true,
2407
+ inlineCandidates,
2408
+ dependencies: configEntries.dependencies
2409
+ };
2410
+ if (inlineCandidates.included.size > 0 || inlineCandidates.excluded.size > 0) return {
2411
+ entries: [],
2412
+ explicit: true,
2413
+ inlineCandidates,
2414
+ dependencies: configEntries.dependencies
2415
+ };
2416
+ return hasTailwindCssImport ? {
2417
+ entries,
2418
+ explicit: false,
2419
+ inlineCandidates,
2420
+ dependencies: configEntries.dependencies
2421
+ } : void 0;
2422
+ }
2423
+ async function resolveViteTailwindV4CssDependencies(css, base) {
2424
+ return (await resolveTailwindV4EntriesFromCss(css, base))?.dependencies ?? [];
2425
+ }
2426
+ function collectExistingCssEntries(options) {
2427
+ return [
2428
+ ...options.cssEntries ?? [],
2429
+ ...options.tailwindcss?.v4?.cssEntries ?? [],
2430
+ ...options.tailwindcssPatcherOptions?.tailwindcss?.v4?.cssEntries ?? []
2431
+ ].filter((item) => typeof item === "string" && item.length > 0).map((item) => path.resolve(item)).filter((item) => existsSync(item));
2432
+ }
2433
+ async function pathExistsAsFile(file) {
2434
+ try {
2435
+ return (await stat(file)).isFile();
2436
+ } catch {
2437
+ return false;
2438
+ }
2439
+ }
2440
+ async function resolveTailwindV4EntriesFromCssCached(css, base) {
2441
+ let root;
2442
+ try {
2443
+ root = postcss.parse(css);
2444
+ } catch {
2445
+ return;
2446
+ }
2447
+ const cacheKey = createCssEntriesCacheKey(css, base, await collectConfigDependencySignatures(root, base));
2448
+ const cached = tailwindV4CssEntriesCache.get(cacheKey);
2449
+ if (cached) return cached;
2450
+ const task = resolveTailwindV4EntriesFromCss(css, base);
2451
+ tailwindV4CssEntriesCache.set(cacheKey, task);
2452
+ return task;
2453
+ }
2454
+ async function discoverTailwindV4CssEntries(root, outDir) {
2455
+ const resolvedRoot = path.resolve(root);
2456
+ const ignore = ["**/node_modules/**", "**/.git/**"];
2457
+ const resolvedOutDir = outDir ? path.resolve(resolvedRoot, outDir) : void 0;
2458
+ if (resolvedOutDir) {
2459
+ const relativeOutDir = path.relative(resolvedRoot, resolvedOutDir);
2460
+ if (relativeOutDir && !relativeOutDir.startsWith("..") && !path.isAbsolute(relativeOutDir)) ignore.push(`${relativeOutDir.split(path.sep).join("/")}/**`);
2461
+ }
2462
+ const candidates = await fg(VITE_TAILWIND_CSS_ENTRY_PATTERN, {
2463
+ absolute: true,
2464
+ cwd: resolvedRoot,
2465
+ ignore,
2466
+ onlyFiles: true,
2467
+ unique: true
2468
+ });
2469
+ const entries = [];
2470
+ for (const file of candidates) {
2471
+ if (!await pathExistsAsFile(file)) continue;
2472
+ try {
2473
+ const css = readFileSync(file, "utf8");
2474
+ if (css.includes("tailwindcss") || css.includes("@source") || css.includes("@config")) {
2475
+ if (await resolveTailwindV4EntriesFromCssCached(css, path.dirname(file))) entries.push(file);
2476
+ }
2477
+ } catch {}
2478
+ }
2479
+ return entries;
2480
+ }
2481
+ function collectConfiguredCssSources(options) {
2482
+ return [...options.tailwindcss?.v4?.cssSources ?? [], ...options.tailwindcssPatcherOptions?.tailwindcss?.v4?.cssSources ?? []];
2483
+ }
2484
+ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {}) {
2485
+ if (patcher.majorVersion === 3) {
2486
+ const source = await resolveTailwindV3SourceFromPatcher(patcher);
2487
+ const contentEntries = normalizeLegacyContentEntries(source.configObject?.content, source.config ? path.dirname(source.config) : source.cwd);
2488
+ const dependencies = /* @__PURE__ */ new Set();
2489
+ addSourceScanDependency(dependencies, source.config);
2490
+ return contentEntries.length > 0 ? createResolvedViteSourceScan({ entries: contentEntries }, dependencies) : void 0;
2491
+ }
2492
+ if (patcher.majorVersion === 4) {
2493
+ const sourceOptions = resolveTailwindV4SourceOptionsFromPatcher(patcher);
2494
+ const cssEntries = collectExistingCssEntries(options);
2495
+ if (cssEntries.length === 0 && !sourceOptions.css && !sourceOptions.cssSources?.length) {
2496
+ const scanRoot = scanOptions.root;
2497
+ const sourceProjectRoot = sourceOptions.projectRoot;
2498
+ if (scanRoot && sourceProjectRoot && path.resolve(scanRoot) === path.resolve(sourceProjectRoot)) {
2499
+ const discoveredCssEntries = await discoverTailwindV4CssEntries(scanRoot, scanOptions.outDir);
2500
+ cssEntries.push(...discoveredCssEntries);
2501
+ }
2502
+ }
2503
+ const entries = [];
2504
+ const cssInlineCandidates = [];
2505
+ const dependencies = /* @__PURE__ */ new Set();
2506
+ let explicit = false;
2507
+ let readableCssEntryCount = 0;
2508
+ for (const cssEntry of cssEntries) {
2509
+ addSourceScanDependency(dependencies, cssEntry);
2510
+ let css;
2511
+ try {
2512
+ css = readFileSync(cssEntry, "utf8");
2513
+ } catch {
2514
+ continue;
2515
+ }
2516
+ readableCssEntryCount++;
2517
+ const resolved = await resolveTailwindV4EntriesFromCssCached(css, path.dirname(cssEntry));
2518
+ if (resolved) {
2519
+ entries.push(...resolved.entries);
2520
+ cssInlineCandidates.push(resolved.inlineCandidates);
2521
+ addSourceScanDependencies(dependencies, resolved.dependencies);
2522
+ explicit || (explicit = resolved.explicit);
2523
+ }
2524
+ }
2525
+ const inlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
2526
+ if (entries.length > 0 || inlineCandidates || explicit || readableCssEntryCount > 0) return createResolvedViteSourceScan({
2527
+ entries: explicit ? entries : entries.length > 0 ? entries : void 0,
2528
+ explicit,
2529
+ inlineCandidates
2530
+ }, dependencies);
2531
+ if (typeof sourceOptions.css === "string" && sourceOptions.css.length > 0) {
2532
+ const resolved = await resolveTailwindV4EntriesFromCssCached(sourceOptions.css, sourceOptions.base ?? sourceOptions.projectRoot ?? process.cwd());
2533
+ return resolved ? createResolvedViteSourceScan({
2534
+ entries: resolved.explicit ? resolved.entries : resolved.entries.length > 0 ? resolved.entries : void 0,
2535
+ explicit: resolved.explicit,
2536
+ inlineCandidates: resolved.inlineCandidates
2537
+ }, new Set(resolved.dependencies)) : void 0;
2538
+ }
2539
+ const sourceOptionBase = sourceOptions.base ?? sourceOptions.projectRoot ?? process.cwd();
2540
+ const configuredCssSources = collectConfiguredCssSources(options);
2541
+ for (const cssSource of [...configuredCssSources, ...sourceOptions.cssSources ?? []]) {
2542
+ if (typeof cssSource.css !== "string" || cssSource.css.length === 0) continue;
2543
+ addSourceScanDependency(dependencies, cssSource.file);
2544
+ addSourceScanDependencies(dependencies, cssSource.dependencies);
2545
+ const resolved = await resolveTailwindV4EntriesFromCssCached(cssSource.css, resolveTailwindV4CssSourceBase(cssSource, sourceOptionBase));
2546
+ if (resolved) {
2547
+ entries.push(...resolved.entries);
2548
+ cssInlineCandidates.push(resolved.inlineCandidates);
2549
+ addSourceScanDependencies(dependencies, resolved.dependencies);
2550
+ explicit || (explicit = resolved.explicit);
2551
+ }
2552
+ }
2553
+ const cssSourceInlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
2554
+ if (entries.length > 0 || cssSourceInlineCandidates || explicit || sourceOptions.cssSources?.length || configuredCssSources.length > 0) return createResolvedViteSourceScan({
2555
+ entries: explicit ? entries : entries.length > 0 ? entries : void 0,
2556
+ explicit,
2557
+ inlineCandidates: cssSourceInlineCandidates
2558
+ }, dependencies);
2559
+ const source = await resolveTailwindV4SourceFromPatcher(patcher);
2560
+ addSourceScanDependency(dependencies, source.file);
2561
+ addSourceScanDependencies(dependencies, source.dependencies);
2562
+ const resolved = await resolveTailwindV4EntriesFromCssCached(source.css, source.base);
2563
+ return resolved ? createResolvedViteSourceScan({
2564
+ entries: resolved.explicit ? resolved.entries : resolved.entries.length > 0 ? resolved.entries : void 0,
2565
+ explicit: resolved.explicit,
2566
+ inlineCandidates: resolved.inlineCandidates
2567
+ }, new Set([...dependencies, ...resolved.dependencies])) : void 0;
2568
+ }
2569
+ }
2570
+ function createViteSourceScanMatcher(entries) {
2571
+ return createTailwindSourceEntryMatcher(entries);
2572
+ }
2573
+ //#endregion
2574
+ //#region src/tailwindcss/runtime/cache.ts
2575
+ const runtimeClassSetCache = /* @__PURE__ */ new WeakMap();
2576
+ const runtimeFileSignatureCache = /* @__PURE__ */ new Map();
2577
+ const runtimeTrackedSourceFilesCache = /* @__PURE__ */ new Map();
2578
+ let runtimeFileSignatureCacheClearTimer;
2579
+ const runtimeSignaturePatchersSymbol = Symbol.for("weapp-tailwindcss.runtimeSignaturePatchers");
2580
+ function getCacheEntry(twPatcher) {
2581
+ let entry = runtimeClassSetCache.get(twPatcher);
2582
+ if (!entry) {
2583
+ entry = {};
2584
+ runtimeClassSetCache.set(twPatcher, entry);
2585
+ }
2586
+ return entry;
2587
+ }
2588
+ function scheduleRuntimeConfigSignatureCacheClear() {
2589
+ if (runtimeFileSignatureCacheClearTimer) return;
2590
+ runtimeFileSignatureCacheClearTimer = setTimeout(() => {
2591
+ runtimeFileSignatureCache.clear();
2592
+ runtimeTrackedSourceFilesCache.clear();
2593
+ runtimeFileSignatureCacheClearTimer = void 0;
2594
+ }, 0);
2595
+ runtimeFileSignatureCacheClearTimer.unref?.();
2596
+ }
2597
+ function getFileSignature(filePath) {
2598
+ const cached = runtimeFileSignatureCache.get(filePath);
2599
+ if (cached !== void 0) return cached;
2600
+ let signature;
2601
+ try {
2602
+ const stats = statSync(filePath);
2603
+ signature = `${filePath}:${stats.size}:${stats.mtimeMs}`;
2604
+ } catch {
2605
+ signature = `${filePath}:missing`;
2606
+ }
2607
+ runtimeFileSignatureCache.set(filePath, signature);
2608
+ scheduleRuntimeConfigSignatureCacheClear();
2609
+ return signature;
2610
+ }
2611
+ function getTailwindTrackedFiles(twPatcher) {
2612
+ const tailwindOptions = resolveTailwindcssOptions(twPatcher.options);
2613
+ const tracked = /* @__PURE__ */ new Set();
2614
+ const configPath = tailwindOptions?.config;
2615
+ if (typeof configPath === "string" && configPath.length > 0) tracked.add(configPath);
2616
+ for (const entry of tailwindOptions?.v4?.cssEntries ?? []) if (typeof entry === "string" && entry.length > 0) tracked.add(entry);
2617
+ for (const source of tailwindOptions?.v4?.cssSources ?? []) {
2618
+ if (typeof source.file === "string" && source.file.length > 0) tracked.add(source.file);
2619
+ for (const dependency of source.dependencies ?? []) if (typeof dependency === "string" && dependency.length > 0) tracked.add(dependency);
2620
+ }
2621
+ return tracked;
2622
+ }
2623
+ function normalizeTrackedSourceSignature(cssEntries, cssSources) {
2624
+ return normalizeSignatureValue({
2625
+ cssEntries: cssEntries?.map((entry) => {
2626
+ if (!existsSync(entry)) return `${entry}:missing`;
2627
+ return getFileSignature(entry);
2628
+ }),
2629
+ cssSources
2630
+ });
2631
+ }
2632
+ async function collectTailwindV4TrackedSourceFiles(twPatcher) {
2633
+ const tailwindOptions = resolveTailwindcssOptions(twPatcher.options);
2634
+ const signature = normalizeTrackedSourceSignature(tailwindOptions?.v4?.cssEntries, tailwindOptions?.v4?.cssSources);
2635
+ const cached = runtimeTrackedSourceFilesCache.get(signature);
2636
+ if (cached) return cached;
2637
+ const files = /* @__PURE__ */ new Set();
2638
+ for (const cssEntry of tailwindOptions?.v4?.cssEntries ?? []) {
2639
+ if (!existsSync(cssEntry)) continue;
2640
+ const resolved = await resolveTailwindV4EntriesFromCssCached(readFileSync(cssEntry, "utf8"), path.dirname(cssEntry));
2641
+ const expanded = resolved?.entries?.length ? await expandTailwindSourceEntries(resolved.entries) : [];
2642
+ for (const file of expanded) files.add(file);
2643
+ }
2644
+ for (const cssSource of tailwindOptions?.v4?.cssSources ?? []) {
2645
+ if (typeof cssSource.css !== "string" || cssSource.css.length === 0) continue;
2646
+ const base = typeof cssSource.file === "string" && cssSource.file.length > 0 ? path.dirname(cssSource.file) : tailwindOptions?.v4?.base ?? tailwindOptions?.cwd ?? twPatcher.options?.projectRoot ?? process.cwd();
2647
+ const resolved = await resolveTailwindV4EntriesFromCssCached(cssSource.css, base);
2648
+ const expanded = resolved?.entries?.length ? await expandTailwindSourceEntries(resolved.entries) : [];
2649
+ for (const file of expanded) files.add(file);
2650
+ }
2651
+ const result = [...files].sort((a, b) => a.localeCompare(b));
2652
+ runtimeTrackedSourceFilesCache.set(signature, result);
2653
+ return result;
2654
+ }
2655
+ function normalizeSignatureValue(value) {
2656
+ if (value == null) return "null";
2657
+ if (typeof value === "string") return value;
2658
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
2659
+ if (Array.isArray(value)) return `[${value.map((item) => normalizeSignatureValue(item)).join(",")}]`;
2660
+ if (typeof value === "object") return `{${Object.entries(value).filter(([, item]) => item !== void 0).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${key}:${normalizeSignatureValue(item)}`).join(",")}}`;
2661
+ return String(value);
2662
+ }
2663
+ function readOptionalProperty(value, key) {
2664
+ if (typeof value !== "object" || value === null || !(key in value)) return;
2665
+ return value[key];
2666
+ }
2667
+ function getTailwindOptionsSignature(twPatcher) {
2668
+ const options = twPatcher.options;
2669
+ const tailwindOptions = resolveTailwindcssOptions(options);
2670
+ return normalizeSignatureValue({
2671
+ projectRoot: options?.projectRoot,
2672
+ packageName: tailwindOptions?.packageName,
2673
+ versionHint: readOptionalProperty(tailwindOptions, "versionHint"),
2674
+ cwd: tailwindOptions?.cwd,
2675
+ config: tailwindOptions?.config,
2676
+ v2: tailwindOptions?.v2,
2677
+ v3: tailwindOptions?.v3,
2678
+ v4: {
2679
+ base: tailwindOptions?.v4?.base,
2680
+ configuredBase: readOptionalProperty(tailwindOptions?.v4, "configuredBase"),
2681
+ css: tailwindOptions?.v4?.css,
2682
+ cssEntries: tailwindOptions?.v4?.cssEntries,
2683
+ cssSources: tailwindOptions?.v4?.cssSources,
2684
+ hasUserDefinedSources: readOptionalProperty(tailwindOptions?.v4, "hasUserDefinedSources"),
2685
+ sources: tailwindOptions?.v4?.sources
2686
+ }
2687
+ });
2688
+ }
2689
+ function getRuntimeTargetSignature(twPatcher) {
2690
+ const packageInfo = twPatcher.packageInfo;
2691
+ return [
2692
+ packageInfo?.name ?? "missing",
2693
+ packageInfo?.rootPath ?? "missing",
2694
+ packageInfo?.version ?? "unknown",
2695
+ twPatcher.majorVersion ?? "unknown",
2696
+ getTailwindOptionsSignature(twPatcher)
2697
+ ].join(":");
2698
+ }
2699
+ function getNestedPatchers$1(twPatcher) {
2700
+ const nested = twPatcher[runtimeSignaturePatchersSymbol];
2701
+ return Array.isArray(nested) && nested.length > 0 ? nested : void 0;
2702
+ }
2703
+ function getOwnRuntimeClassSetSignature(twPatcher) {
2704
+ const trackedFiles = [...getTailwindTrackedFiles(twPatcher)].sort((a, b) => a.localeCompare(b)).map(getFileSignature);
2705
+ return `${trackedFiles.length > 0 ? trackedFiles.join("|") : "files:missing"}|runtime:${getRuntimeTargetSignature(twPatcher)}`;
2706
+ }
2707
+ function invalidateRuntimeClassSet(twPatcher) {
2708
+ if (!twPatcher) return;
2709
+ const nestedPatchers = getNestedPatchers$1(twPatcher);
2710
+ if (nestedPatchers) for (const patcher of nestedPatchers) invalidateRuntimeClassSet(patcher);
2711
+ for (const trackedFile of getTailwindTrackedFiles(twPatcher)) runtimeFileSignatureCache.delete(trackedFile);
2712
+ runtimeTrackedSourceFilesCache.clear();
2713
+ runtimeClassSetCache.delete(twPatcher);
2714
+ }
2715
+ function getRuntimeClassSetCacheEntry(twPatcher) {
2716
+ return getCacheEntry(twPatcher);
2717
+ }
2718
+ function getRuntimeClassSetSignature(twPatcher) {
2719
+ const nestedPatchers = getNestedPatchers$1(twPatcher);
2720
+ if (nestedPatchers) return nestedPatchers.map(getOwnRuntimeClassSetSignature).sort((a, b) => a.localeCompare(b)).join("||");
2721
+ return getOwnRuntimeClassSetSignature(twPatcher);
2722
+ }
2723
+ async function getRuntimeClassSetSignatureWithSources(twPatcher) {
2724
+ const baseSignature = getRuntimeClassSetSignature(twPatcher);
2725
+ if (twPatcher.majorVersion !== 4) return baseSignature;
2726
+ const trackedSourceFiles = await collectTailwindV4TrackedSourceFiles(twPatcher);
2727
+ if (trackedSourceFiles.length === 0) return baseSignature;
2728
+ return [baseSignature, trackedSourceFiles.map(getFileSignature).join("|")].join("|sources:");
2729
+ }
2730
+ //#endregion
2731
+ //#region src/tailwindcss/runtime-patch.ts
2732
+ const debug = createDebug("[tailwindcss:runtime-patch] ");
2733
+ const require = createRequire(import.meta.url);
2734
+ const runtimePatchPromiseCache = /* @__PURE__ */ new WeakMap();
2735
+ function getNestedPatchers(twPatcher) {
2736
+ const nested = twPatcher[runtimeSignaturePatchersSymbol];
2737
+ return Array.isArray(nested) && nested.length > 0 ? nested : void 0;
2738
+ }
2739
+ function shouldApplyRuntimePatch(twPatcher) {
2740
+ return twPatcher.majorVersion === 3 && typeof twPatcher.patch === "function";
2741
+ }
2742
+ function clearTailwindcssRequireCache(twPatcher) {
2743
+ const rootPath = twPatcher.packageInfo?.rootPath;
2744
+ if (!rootPath) return;
2745
+ const normalizedRoot = path.resolve(rootPath);
2746
+ let count = 0;
2747
+ for (const id of Object.keys(require.cache)) {
2748
+ const normalizedId = path.resolve(id);
2749
+ if (normalizedId === normalizedRoot || normalizedId.startsWith(`${normalizedRoot}${path.sep}`)) {
2750
+ delete require.cache[id];
2751
+ count += 1;
2752
+ }
2753
+ }
2754
+ if (count > 0) debug("clear tailwindcss require cache after runtime patch, count=%d root=%s", count, normalizedRoot);
2755
+ }
2756
+ async function ensureTailwindcssRuntimePatch(twPatcher, options = {}) {
2757
+ const nestedPatchers = getNestedPatchers(twPatcher);
2758
+ if (nestedPatchers) {
2759
+ await Promise.all(nestedPatchers.map((patcher) => ensureTailwindcssRuntimePatch(patcher)));
2760
+ return;
2761
+ }
2762
+ if (!shouldApplyRuntimePatch(twPatcher)) return;
2763
+ const cached = runtimePatchPromiseCache.get(twPatcher);
2764
+ if (cached) {
2765
+ await cached;
2766
+ if (options.clearRequireCache) clearTailwindcssRequireCache(twPatcher);
2767
+ return;
2768
+ }
2769
+ const task = Promise.resolve().then(async () => {
2770
+ debug("apply tailwindcss runtime patch, package=%s version=%s root=%s", twPatcher.packageInfo?.name ?? "tailwindcss", twPatcher.packageInfo?.version ?? "unknown", twPatcher.packageInfo?.rootPath ?? "unknown");
2771
+ await twPatcher.patch?.();
2772
+ if (options.clearRequireCache) clearTailwindcssRequireCache(twPatcher);
2773
+ }).catch((error) => {
2774
+ runtimePatchPromiseCache.delete(twPatcher);
2775
+ throw error;
2776
+ });
2777
+ runtimePatchPromiseCache.set(twPatcher, task);
2778
+ return task;
2779
+ }
2780
+ //#endregion
2781
+ //#region src/tailwindcss/v3-engine/miniprogram.ts
2782
+ const defaultStyleHandler = createStyleHandler({
2783
+ cssChildCombinatorReplaceValue: ["view", "text"],
2784
+ cssRemoveHoverPseudoClass: true,
2785
+ isMainChunk: true,
2786
+ majorVersion: 3
2787
+ });
2788
+ const MINI_PROGRAM_V3_PREFLIGHT_SELECTORS = new Set([
2789
+ "view,text,:before,:after",
2790
+ "view,text,:after,:before",
2791
+ "view,text,::before,::after",
2792
+ "view,text,::after,::before"
2793
+ ]);
2794
+ const V3_PREFLIGHT_RESET_PROPS = new Set([
2795
+ "box-sizing",
2796
+ "border",
2797
+ "border-width",
2798
+ "border-style",
2799
+ "border-color",
2800
+ "margin",
2801
+ "padding"
2802
+ ]);
2803
+ function normalizeSelector(selector) {
2804
+ return selector.trim().replace(/\s+/g, "");
2805
+ }
2806
+ function isMiniProgramV3PreflightRule(rule) {
2807
+ return MINI_PROGRAM_V3_PREFLIGHT_SELECTORS.has(normalizeSelector(rule.selector));
2808
+ }
2809
+ function hasResetDeclaration(rule) {
2810
+ let found = false;
2811
+ rule.walkDecls((decl) => {
2812
+ if (V3_PREFLIGHT_RESET_PROPS.has(decl.prop)) found = true;
2813
+ });
2814
+ return found;
2815
+ }
2816
+ function createPreflightDeclarations(cssPreflight) {
2817
+ if (!cssPreflight || typeof cssPreflight !== "object") return [];
2818
+ return Object.entries(cssPreflight).filter((entry) => entry[1] !== false).map(([prop, value]) => postcss.decl({
2819
+ prop,
2820
+ value: value.toString()
2821
+ }));
2822
+ }
2823
+ function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
2824
+ const declarations = createPreflightDeclarations(cssPreflight);
2825
+ if (declarations.length === 0) return css;
2826
+ try {
2827
+ const root = postcss.parse(css);
2828
+ let targetRule;
2829
+ let hasReset = false;
2830
+ root.walkRules((rule) => {
2831
+ if (!isMiniProgramV3PreflightRule(rule)) return;
2832
+ targetRule ?? (targetRule = rule);
2833
+ if (hasResetDeclaration(rule)) hasReset = true;
2834
+ });
2835
+ if (!targetRule || hasReset) return css;
2836
+ targetRule.append(...declarations.map((decl) => decl.clone()));
2837
+ return root.toString();
2838
+ } catch {
2839
+ return css;
2840
+ }
2841
+ }
2842
+ async function transformTailwindV3CssToWeapp(css, options) {
2843
+ const result = await defaultStyleHandler(hasCssMacroStyleOptions(options) ? await transformCssMacroCss(css, options) : css, {
2844
+ cssChildCombinatorReplaceValue: ["view", "text"],
2845
+ cssRemoveHoverPseudoClass: true,
2846
+ isMainChunk: true,
2847
+ majorVersion: 3,
2848
+ ...options
2849
+ });
2850
+ const pruneOptions = {
2851
+ preservePreflight: true,
2852
+ preserveConditionalComments: hasCssMacroStyleOptions(options)
2853
+ };
2854
+ return ensureMiniProgramV3PreflightReset(pruneMiniProgramGeneratedCss(result.css, pruneOptions), options?.cssPreflight);
2855
+ }
2856
+ async function transformTailwindV3CssByTarget(css, target, options) {
2857
+ if (target === "weapp") return transformTailwindV3CssToWeapp(css, options);
2858
+ return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css, options) : css;
2859
+ }
2860
+ //#endregion
2861
+ //#region src/tailwindcss/v3-engine/generator.ts
2862
+ const runtimeReadyPromiseCache = /* @__PURE__ */ new Map();
2863
+ const incrementalGenerateCache = /* @__PURE__ */ new Map();
2864
+ function isLegacyContentObject(value) {
2865
+ return typeof value === "object" && value !== null && "files" in value;
2866
+ }
2867
+ function createRawContentEntries(candidates, sources) {
2868
+ const entries = [];
2869
+ const candidateContent = [...candidates].join(" ");
2870
+ if (candidateContent.length > 0) entries.push({
2871
+ raw: candidateContent,
2872
+ extension: "html"
2873
+ });
2874
+ for (const source of sources) entries.push({
2875
+ raw: source.content,
2876
+ extension: source.extension ?? "html"
2877
+ });
2878
+ return entries;
2879
+ }
2880
+ function createChangedContentEntries(candidates, sources) {
2881
+ return createRawContentEntries(candidates, sources).map((entry) => ({
2882
+ content: entry.raw,
2883
+ extension: entry.extension
2884
+ }));
2885
+ }
2886
+ function collectCandidates(candidates) {
2887
+ return new Set(candidates ?? []);
2888
+ }
2889
+ function normalizeBareArbitraryValueCandidate(candidate, bareArbitraryValues) {
2890
+ return resolveBareArbitraryValueCandidate(candidate, bareArbitraryValues)?.canonicalCandidate ?? candidate;
2891
+ }
2892
+ function normalizeBareArbitraryValueCandidates(candidates, bareArbitraryValues) {
2893
+ const normalized = /* @__PURE__ */ new Set();
2894
+ const restoreCandidates = /* @__PURE__ */ new Map();
2895
+ for (const candidate of candidates) {
2896
+ const normalizedCandidate = normalizeBareArbitraryValueCandidate(candidate, bareArbitraryValues);
2897
+ normalized.add(normalizedCandidate);
2898
+ if (normalizedCandidate !== candidate) restoreCandidates.set(normalizedCandidate, candidate);
2899
+ }
2900
+ return {
2901
+ candidates: normalized,
2902
+ restoreCandidates
2903
+ };
2904
+ }
2905
+ async function collectSourceBareArbitraryValueCandidates(sources, bareArbitraryValues) {
2906
+ if (!isBareArbitraryValuesEnabled(bareArbitraryValues)) return [];
2907
+ const candidates = /* @__PURE__ */ new Set();
2908
+ for (const source of sources ?? []) for (const candidate of await extractSourceCandidates(source.content, source.extension ?? "html", { bareArbitraryValues })) if (resolveBareArbitraryValueCandidate(candidate, bareArbitraryValues)) candidates.add(candidate);
2909
+ return [...candidates];
2910
+ }
2911
+ function escapeCssClassSelector(className) {
2912
+ return className.replace(/[^\w-]/g, (char) => `\\${char}`);
2913
+ }
2914
+ function restoreBareArbitraryValueCssSelectors(css, originalCandidates, bareArbitraryValues, escapeClassName) {
2915
+ if (!isBareArbitraryValuesEnabled(bareArbitraryValues)) return css;
2916
+ let restored = css;
2917
+ for (const originalCandidate of originalCandidates) {
2918
+ const canonical = resolveBareArbitraryValueCandidate(originalCandidate, bareArbitraryValues)?.canonicalCandidate;
2919
+ if (canonical) restored = restored.split(`.${escapeClassName(canonical)}`).join(`.${escapeCssClassSelector(originalCandidate)}`);
2920
+ }
2921
+ return restored;
2922
+ }
2923
+ function restoreBareArbitraryValueClassSet(classSet, originalCandidates, bareArbitraryValues) {
2924
+ if (!isBareArbitraryValuesEnabled(bareArbitraryValues)) return new Set(classSet);
2925
+ const restored = new Set(classSet);
2926
+ for (const originalCandidate of originalCandidates) {
2927
+ const canonical = resolveBareArbitraryValueCandidate(originalCandidate, bareArbitraryValues)?.canonicalCandidate;
2928
+ if (canonical && restored.has(canonical)) {
2929
+ restored.delete(canonical);
2930
+ restored.add(originalCandidate);
2931
+ }
2932
+ }
2933
+ return restored;
2934
+ }
2935
+ function collectGeneratedCandidates(context, candidates, restoreCandidates) {
2936
+ const classSet = /* @__PURE__ */ new Set();
2937
+ for (const candidate of candidates) if (context.classCache.has(candidate)) classSet.add(restoreCandidates.get(candidate) ?? candidate);
2938
+ return classSet;
2939
+ }
2940
+ function hasRemovedCandidates(previousCandidates, nextCandidates) {
2941
+ for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
2942
+ return false;
2943
+ }
2944
+ function collectApplyCandidatesFromCss(css) {
2945
+ if (!css.includes("@apply")) return [];
2946
+ const candidates = /* @__PURE__ */ new Set();
2947
+ try {
2948
+ postcss.parse(css).walkAtRules("apply", (rule) => {
2949
+ for (const candidate of rule.params.split(/\s+/)) {
2950
+ const normalized = candidate.replace(/!important$/, "").trim();
2951
+ if (normalized) candidates.add(normalized);
2952
+ }
2953
+ });
2954
+ } catch {}
2955
+ return [...candidates];
2956
+ }
2957
+ function isTailwindCandidateLayer(params) {
2958
+ return params.split(/[,\s]+/).some((layer) => layer === "components" || layer === "utilities");
2959
+ }
2960
+ function extractClassCandidatesFromSelector(selector, candidates) {
2961
+ for (let index = 0; index < selector.length; index++) {
2962
+ if (selector[index] !== ".") continue;
2963
+ let candidate = "";
2964
+ let escaped = false;
2965
+ for (let tokenIndex = index + 1; tokenIndex < selector.length; tokenIndex++) {
2966
+ const char = selector[tokenIndex];
2967
+ if (escaped) {
2968
+ candidate += char;
2969
+ escaped = false;
2970
+ continue;
2971
+ }
2972
+ if (char === "\\") {
2973
+ escaped = true;
2974
+ continue;
2975
+ }
2976
+ if (char && /[\w-]/.test(char)) {
2977
+ candidate += char;
2978
+ continue;
2979
+ }
2980
+ break;
2981
+ }
2982
+ if (candidate) candidates.add(candidate);
2983
+ }
2984
+ }
2985
+ function collectLayerCandidatesFromCss(css) {
2986
+ if (!css.includes("@layer")) return [];
2987
+ const candidates = /* @__PURE__ */ new Set();
2988
+ try {
2989
+ postcss.parse(css).walkAtRules("layer", (layer) => {
2990
+ if (!isTailwindCandidateLayer(layer.params)) return;
2991
+ layer.walkRules((rule) => {
2992
+ extractClassCandidatesFromSelector(rule.selector, candidates);
2993
+ });
2994
+ });
2995
+ } catch {}
2996
+ return [...candidates];
2997
+ }
2998
+ function mergeGenerateCandidates(source, options) {
2999
+ return collectCandidates([
3000
+ ...collectLayerCandidatesFromCss(source.css),
3001
+ ...collectApplyCandidatesFromCss(source.css),
3002
+ ...collectCandidates(options.candidates)
3003
+ ]);
3004
+ }
3005
+ function mergeContent(content, rawEntries) {
3006
+ if (isLegacyContentObject(content)) return {
3007
+ ...content,
3008
+ relative: content.relative ?? true,
3009
+ files: [...[].concat(content.files ?? []), ...rawEntries]
3010
+ };
3011
+ return {
3012
+ relative: true,
3013
+ files: [...[].concat(content ?? []), ...rawEntries]
3014
+ };
3015
+ }
3016
+ function normalizeConfigObject(config) {
3017
+ if (!config || typeof config !== "object") return config;
3018
+ const maybeDefault = config.default;
3019
+ if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
3020
+ return config;
3021
+ }
3022
+ function hasExplicitContentInput(options) {
3023
+ return options.candidates !== void 0 || options.sources !== void 0;
3024
+ }
3025
+ function createExplicitContentConfig(rawEntries) {
3026
+ return {
3027
+ relative: true,
3028
+ files: rawEntries
3029
+ };
3030
+ }
3031
+ function createTailwindConfig(source, options) {
3032
+ const config = { ...normalizeConfigObject(source.configObject) ?? {} };
3033
+ const rawEntries = createRawContentEntries(mergeGenerateCandidates(source, options), options.sources ?? []);
3034
+ config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
3035
+ return config;
3036
+ }
3037
+ function shouldAutoEnableCssMacro(source) {
3038
+ return hasCssMacroTailwindPlugin(normalizeConfigObject(source.configObject)?.plugins);
3039
+ }
3040
+ function resolveStyleOptions(source, options) {
3041
+ return shouldAutoEnableCssMacro(source) ? withCssMacroStyleOptions(options) : options;
3042
+ }
3043
+ function loadTailwindV3Internals(source) {
3044
+ const requireFromProject = createRequire(`${source.cwd}/package.json`);
3045
+ const requireFromRuntime = createRequire(import.meta.url);
3046
+ const requireTailwind = (id) => {
3047
+ try {
3048
+ return requireFromProject(id);
3049
+ } catch {
3050
+ return requireFromRuntime(id);
3051
+ }
3052
+ };
3053
+ const collapseAdjacentRulesModule = requireTailwind(`${source.packageName}/lib/lib/collapseAdjacentRules`);
3054
+ const collapseDuplicateDeclarationsModule = requireTailwind(`${source.packageName}/lib/lib/collapseDuplicateDeclarations`);
3055
+ const escapeClassNameModule = requireTailwind(`${source.packageName}/lib/util/escapeClassName`);
3056
+ const generateRulesModule = requireTailwind(`${source.packageName}/lib/lib/generateRules`);
3057
+ const sharedStateModule = requireTailwind(`${source.packageName}/lib/lib/sharedState`);
3058
+ const setupContextUtils = requireTailwind(`${source.packageName}/lib/lib/setupContextUtils`);
3059
+ const processTailwindFeaturesModule = requireTailwind(`${source.packageName}/lib/processTailwindFeatures`);
3060
+ const resolveDefaultsAtRulesModule = requireTailwind(`${source.packageName}/lib/lib/resolveDefaultsAtRules`);
3061
+ const resolveConfigModule = requireTailwind(`${source.packageName}/lib/public/resolve-config`);
3062
+ const validateConfigModule = requireTailwind(`${source.packageName}/lib/util/validateConfig.js`);
3063
+ return {
3064
+ collapseAdjacentRules: collapseAdjacentRulesModule["default"] ?? collapseAdjacentRulesModule,
3065
+ collapseDuplicateDeclarations: collapseDuplicateDeclarationsModule["default"] ?? collapseDuplicateDeclarationsModule,
3066
+ createContext: setupContextUtils["createContext"],
3067
+ escapeClassName: escapeClassNameModule["default"] ?? escapeClassNameModule,
3068
+ generateRules: generateRulesModule["generateRules"],
3069
+ notOnDemandCandidate: String(sharedStateModule["NOT_ON_DEMAND"] ?? "*"),
3070
+ processTailwindFeatures: processTailwindFeaturesModule["default"] ?? processTailwindFeaturesModule,
3071
+ resolveDefaultsAtRules: resolveDefaultsAtRulesModule["default"] ?? resolveDefaultsAtRulesModule,
3072
+ resolveConfig: resolveConfigModule["default"] ?? resolveConfigModule,
3073
+ validateConfig: validateConfigModule["validateConfig"]
3074
+ };
3075
+ }
3076
+ function createStableJson(value) {
3077
+ if (value === void 0) return "undefined";
3078
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
3079
+ if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
3080
+ return `{${Object.keys(value).sort().map((key) => {
3081
+ const record = value;
3082
+ return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
3083
+ }).join(",")}}`;
3084
+ }
3085
+ function createDependencyFingerprint(files) {
3086
+ return files.map((file) => {
3087
+ try {
3088
+ const stat = fs.statSync(file);
3089
+ return `${file}:${stat.size}:${stat.mtimeMs}`;
3090
+ } catch {
3091
+ return `${file}:missing`;
3092
+ }
3093
+ }).join("|");
3094
+ }
3095
+ function createIncrementalGenerateCacheKey(source, target, styleOptions, bareArbitraryValues) {
3096
+ return [
3097
+ source.packageName,
3098
+ source.postcssPlugin,
3099
+ source.cwd,
3100
+ source.config ?? "config:missing",
3101
+ createDependencyFingerprint(source.dependencies),
3102
+ source.css,
3103
+ createStableJson(normalizeConfigObject(source.configObject)?.content),
3104
+ target,
3105
+ createStableJson(styleOptions),
3106
+ createStableJson(bareArbitraryValues)
3107
+ ].join("\0");
3108
+ }
3109
+ function createRuntimeReadyCacheKey(source, rootPath) {
3110
+ return [
3111
+ source.packageName,
3112
+ source.postcssPlugin,
3113
+ rootPath ?? "missing",
3114
+ source.config ?? "config:missing",
3115
+ source.cwd
3116
+ ].join("\0");
3117
+ }
3118
+ function isDirectUtilitiesOnlyCss(css) {
3119
+ return css.replace(/\s+/g, "") === "@tailwindutilities;";
3120
+ }
3121
+ function collectClassSet(context) {
3122
+ const classSet = /* @__PURE__ */ new Set();
3123
+ for (const candidate of context.classCache.keys()) if (String(candidate) !== "*") classSet.add(candidate);
3124
+ return classSet;
3125
+ }
3126
+ function collectDependencyMessages(result) {
3127
+ const dependencies = /* @__PURE__ */ new Set();
3128
+ for (const message of result.messages) {
3129
+ const file = message["file"];
3130
+ if (message["type"] === "dependency" && typeof file === "string") dependencies.add(file);
3131
+ }
3132
+ return dependencies;
3133
+ }
3134
+ function sortCandidates(candidates) {
3135
+ return [...candidates].sort((a, z) => {
3136
+ if (a === z) return 0;
3137
+ return a < z ? -1 : 1;
3138
+ });
3139
+ }
3140
+ function appendUtilityRules(root, context, rules) {
3141
+ const sortedRules = context.offsets.sort(rules);
3142
+ for (const [sort, rule] of sortedRules) {
3143
+ const tailwindRaw = rule.raws.tailwind;
3144
+ if (sort.layer === "utilities" || sort.layer === "variants" && tailwindRaw?.parentLayer === "utilities") root.append(rule.clone());
3145
+ }
3146
+ }
3147
+ function appendDirectUtilityRules(root, context) {
3148
+ appendUtilityRules(root, context, [...context.ruleCache]);
3149
+ }
3150
+ function createRuntimeReadyPromise(source) {
3151
+ const patcher = createTailwindcssPatcher({
3152
+ basedir: source.cwd,
3153
+ supportCustomLengthUnitsPatch: true,
3154
+ tailwindcss: {
3155
+ ...source.config === void 0 ? {} : { config: source.config },
3156
+ cwd: source.cwd,
3157
+ packageName: source.packageName,
3158
+ postcssPlugin: source.postcssPlugin,
3159
+ version: 3
3160
+ }
3161
+ });
3162
+ const cacheKey = createRuntimeReadyCacheKey(source, patcher.packageInfo?.rootPath);
3163
+ const cached = runtimeReadyPromiseCache.get(cacheKey);
3164
+ if (cached) return cached;
3165
+ const task = ensureTailwindcssRuntimePatch(patcher, { clearRequireCache: true }).catch((error) => {
3166
+ runtimeReadyPromiseCache.delete(cacheKey);
3167
+ throw error;
3168
+ });
3169
+ runtimeReadyPromiseCache.set(cacheKey, task);
3170
+ return task;
3171
+ }
3172
+ function createTailwindV3Engine(source) {
3173
+ const runtimeReadyPromise = createRuntimeReadyPromise(source);
3174
+ let tailwindInternals;
3175
+ async function generateOnce(generateSource, options = {}) {
3176
+ await runtimeReadyPromise;
3177
+ tailwindInternals ?? (tailwindInternals = loadTailwindV3Internals(source));
3178
+ const internals = tailwindInternals;
3179
+ const { styleOptions, target = "weapp" } = options;
3180
+ const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
3181
+ const requestedCandidates = mergeGenerateCandidates(generateSource, options);
3182
+ for (const candidate of await collectSourceBareArbitraryValueCandidates(options.sources, options.bareArbitraryValues)) requestedCandidates.add(candidate);
3183
+ const normalizedCandidates = normalizeBareArbitraryValueCandidates(requestedCandidates, options.bareArbitraryValues);
3184
+ const tailwindOptions = {
3185
+ ...options,
3186
+ candidates: normalizedCandidates.candidates
3187
+ };
3188
+ const tailwindConfig = internals.validateConfig(internals.resolveConfig(createTailwindConfig(generateSource, tailwindOptions)));
3189
+ const candidates = normalizedCandidates.candidates;
3190
+ const changedContent = createChangedContentEntries(candidates, options.sources ?? []);
3191
+ const root = postcss.parse(generateSource.css, { from: void 0 });
3192
+ const result = {
3193
+ css: "",
3194
+ messages: []
3195
+ };
3196
+ let context;
3197
+ if (isDirectUtilitiesOnlyCss(generateSource.css)) {
3198
+ context = internals.createContext(tailwindConfig, changedContent, root);
3199
+ internals.generateRules(new Set(sortCandidates([internals.notOnDemandCandidate, ...candidates])), context);
3200
+ root.removeAll();
3201
+ appendDirectUtilityRules(root, context);
3202
+ internals.resolveDefaultsAtRules(context)(root, result);
3203
+ internals.collapseAdjacentRules(context)(root, result);
3204
+ internals.collapseDuplicateDeclarations(context)(root, result);
3205
+ } else {
3206
+ const setupContext = () => {
3207
+ return (currentRoot) => internals.createContext(tailwindConfig, changedContent, currentRoot);
3208
+ };
3209
+ context = await internals.processTailwindFeatures(setupContext)(root, result);
3210
+ }
3211
+ const rawCss = restoreBareArbitraryValueCssSelectors(root.toString(), requestedCandidates, options.bareArbitraryValues, internals.escapeClassName);
3212
+ const css = await transformTailwindV3CssByTarget(rawCss, target, resolvedStyleOptions);
3213
+ const dependencies = collectDependencyMessages(result);
3214
+ for (const dependency of generateSource.dependencies) dependencies.add(dependency);
3215
+ const classSet = restoreBareArbitraryValueClassSet(collectClassSet(context), requestedCandidates, options.bareArbitraryValues);
3216
+ return {
3217
+ css,
3218
+ rawCss,
3219
+ context,
3220
+ classSet,
3221
+ rawCandidates: requestedCandidates,
3222
+ dependencies: [...dependencies],
3223
+ sources: [],
3224
+ root: null,
3225
+ target,
3226
+ version: 3
3227
+ };
3228
+ }
3229
+ async function generateIncrementalMissingUtilities(context, candidates, target, styleOptions, bareArbitraryValues) {
3230
+ tailwindInternals ?? (tailwindInternals = loadTailwindV3Internals(source));
3231
+ const internals = tailwindInternals;
3232
+ const root = postcss.root();
3233
+ const result = {
3234
+ css: "",
3235
+ messages: []
3236
+ };
3237
+ const normalizedCandidates = normalizeBareArbitraryValueCandidates(candidates, bareArbitraryValues);
3238
+ const sortedCandidates = sortCandidates(normalizedCandidates.candidates);
3239
+ appendUtilityRules(root, context, internals.generateRules(new Set(sortedCandidates), context));
3240
+ internals.resolveDefaultsAtRules(context)(root, result);
3241
+ internals.collapseAdjacentRules(context)(root, result);
3242
+ internals.collapseDuplicateDeclarations(context)(root, result);
3243
+ const rawCss = restoreBareArbitraryValueCssSelectors(root.toString(), candidates, bareArbitraryValues, internals.escapeClassName);
3244
+ return {
3245
+ css: await transformTailwindV3CssByTarget(rawCss, target, resolveStyleOptions(source, styleOptions)),
3246
+ rawCss,
3247
+ classSet: collectGeneratedCandidates(context, sortedCandidates, normalizedCandidates.restoreCandidates),
3248
+ dependencies: collectDependencyMessages(result)
3249
+ };
3250
+ }
3251
+ async function generateWithIncrementalCache(options = {}) {
3252
+ if ((options.sources?.length ?? 0) > 0) return generateOnce(source, options);
3253
+ const target = options.target ?? "weapp";
3254
+ const requestedCandidates = mergeGenerateCandidates(source, options);
3255
+ if (requestedCandidates.size === 0) return generateOnce(source, options);
3256
+ const styleOptions = resolveStyleOptions(source, options.styleOptions);
3257
+ const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions, options.bareArbitraryValues);
3258
+ const cached = incrementalGenerateCache.get(cacheKey);
3259
+ if (cached) {
3260
+ if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) {
3261
+ const generated = await generateOnce(source, options);
3262
+ incrementalGenerateCache.set(cacheKey, {
3263
+ context: generated.context,
3264
+ seenCandidates: new Set(requestedCandidates),
3265
+ classSet: new Set(generated.classSet),
3266
+ css: generated.css,
3267
+ rawCss: generated.rawCss,
3268
+ dependencies: generated.dependencies,
3269
+ target: generated.target
3270
+ });
3271
+ return generated;
3272
+ }
3273
+ const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
3274
+ if (missingCandidates.length === 0) return {
3275
+ css: cached.css,
3276
+ rawCss: cached.rawCss,
3277
+ incrementalCss: "",
3278
+ incrementalRawCss: "",
3279
+ classSet: new Set(cached.classSet),
3280
+ rawCandidates: new Set(cached.seenCandidates),
3281
+ dependencies: cached.dependencies,
3282
+ sources: [],
3283
+ root: null,
3284
+ target: cached.target,
3285
+ version: 3
3286
+ };
3287
+ const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target, styleOptions, options.bareArbitraryValues);
3288
+ for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
3289
+ for (const className of generated.classSet) cached.classSet.add(className);
3290
+ cached.css = [cached.css, generated.css].filter(Boolean).join("\n");
3291
+ cached.rawCss = [cached.rawCss, generated.rawCss].filter(Boolean).join("\n");
3292
+ cached.dependencies = [...new Set([...cached.dependencies, ...generated.dependencies])];
3293
+ return {
3294
+ css: cached.css,
3295
+ rawCss: cached.rawCss,
3296
+ incrementalCss: generated.css,
3297
+ incrementalRawCss: generated.rawCss,
3298
+ classSet: new Set(cached.classSet),
3299
+ rawCandidates: new Set(cached.seenCandidates),
3300
+ dependencies: cached.dependencies,
3301
+ sources: [],
3302
+ root: null,
3303
+ target: cached.target,
3304
+ version: 3
3305
+ };
3306
+ }
3307
+ const generated = await generateOnce(source, options);
3308
+ incrementalGenerateCache.set(cacheKey, {
3309
+ context: generated.context,
3310
+ seenCandidates: new Set(requestedCandidates),
3311
+ classSet: new Set(generated.classSet),
3312
+ css: generated.css,
3313
+ rawCss: generated.rawCss,
3314
+ dependencies: generated.dependencies,
3315
+ target: generated.target
3316
+ });
3317
+ return generated;
3318
+ }
3319
+ async function generate(options = {}) {
3320
+ return options.incrementalCache ? generateWithIncrementalCache(options) : generateOnce(source, options);
3321
+ }
3322
+ return {
3323
+ source,
3324
+ async validateCandidates(candidates) {
3325
+ return (await generate({
3326
+ candidates,
3327
+ incrementalCache: true,
3328
+ target: "tailwind"
3329
+ })).classSet;
3330
+ },
3331
+ generate
3332
+ };
3333
+ }
3334
+ //#endregion
3335
+ //#region src/tailwindcss/v3-engine/source.ts
3336
+ const DEFAULT_TAILWIND_V3_CSS = [
3337
+ "@tailwind base;",
3338
+ "@tailwind components;",
3339
+ "@tailwind utilities;"
3340
+ ].join("\n");
3341
+ function parseConfigParam(params) {
3342
+ const value = params.trim();
3343
+ return /^(['"])(.+)\1$/.exec(value)?.[2];
3344
+ }
3345
+ function resolveOptionalPath(value, base) {
3346
+ if (!value) return;
3347
+ return path.isAbsolute(value) ? value : path.resolve(base, value);
3348
+ }
3349
+ function resolveCssConfig(css, base) {
3350
+ if (!css) return {
3351
+ css,
3352
+ config: void 0
3353
+ };
3354
+ const root = postcss.parse(css);
3355
+ let config;
3356
+ root.walkAtRules("config", (rule) => {
3357
+ const configPath = parseConfigParam(rule.params);
3358
+ if (!configPath) return;
3359
+ if (!config) config = resolveOptionalPath(configPath, base);
3360
+ rule.remove();
3361
+ });
3362
+ return {
3363
+ config,
3364
+ css: root.toString()
3365
+ };
3366
+ }
3367
+ function getProjectRoot(patcher) {
3368
+ return patcher.options?.projectRoot ?? process.cwd();
3369
+ }
3370
+ function normalizeLoadedConfig(config) {
3371
+ if (!config || typeof config !== "object") return config;
3372
+ const maybeDefault = config.default;
3373
+ if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
3374
+ return config;
3375
+ }
3376
+ function resolveTailwindCssPackageName(patcher) {
3377
+ return resolveTailwindcssOptions(patcher.options)?.packageName ?? patcher.packageInfo?.name ?? "tailwindcss";
3378
+ }
3379
+ async function resolveTailwindV3Source(options = {}) {
3380
+ const projectRoot = options.projectRoot ?? process.cwd();
3381
+ const base = options.base ?? options.cwd ?? projectRoot;
3382
+ const cssConfig = resolveCssConfig(options.css, base);
3383
+ const config = resolveOptionalPath(options.config, base) ?? cssConfig.config;
3384
+ const cwd = options.cwd ?? (config ? path.dirname(config) : projectRoot);
3385
+ const loaded = await loadConfig(omitUndefined({
3386
+ config,
3387
+ cwd
3388
+ }));
3389
+ return {
3390
+ version: 3,
3391
+ projectRoot,
3392
+ cwd,
3393
+ base,
3394
+ css: cssConfig.css ?? options.css ?? DEFAULT_TAILWIND_V3_CSS,
3395
+ config: loaded?.filepath ?? config,
3396
+ configObject: normalizeLoadedConfig(loaded?.config),
3397
+ dependencies: loaded?.filepath ? [loaded.filepath] : [],
3398
+ packageName: options.packageName ?? "tailwindcss",
3399
+ postcssPlugin: options.postcssPlugin ?? options.packageName ?? "tailwindcss"
3400
+ };
3401
+ }
3402
+ function resolveTailwindV3SourceOptionsFromPatcher(patcher) {
3403
+ const projectRoot = getProjectRoot(patcher);
3404
+ const tailwindOptions = resolveTailwindcssOptions(patcher.options);
3405
+ return {
3406
+ projectRoot,
3407
+ cwd: tailwindOptions?.v3?.cwd ?? tailwindOptions?.cwd ?? projectRoot,
3408
+ config: tailwindOptions?.v3?.config ?? tailwindOptions?.config,
3409
+ packageName: resolveTailwindCssPackageName(patcher),
3410
+ postcssPlugin: tailwindOptions?.v3?.postcssPlugin ?? tailwindOptions?.postcssPlugin
3411
+ };
3412
+ }
3413
+ function resolveTailwindV3SourceFromPatcher(patcher) {
3414
+ return resolveTailwindV3Source(resolveTailwindV3SourceOptionsFromPatcher(patcher));
3415
+ }
3416
+ //#endregion
3417
+ export { collectCssInlineSourceCandidates as A, createDebug as B, createTailwindV4Engine$1 as C, loadTailwindV4DesignSystem as D, filterUnsupportedMiniProgramTailwindV4Candidates as E, parseConfigParam$1 as F, normalizeStringListOption as G, readInstalledPackageMajorVersion as H, resolveCssSourceEntries as I, findNearestPackageRoot as J, resolveBooleanObjectOption as K, resolveSourceScanPath as L, expandTailwindSourceEntries as M, isFileMatchedByTailwindSourceEntries as N, DEFAULT_SOURCE_SCAN_EXTENSIONS as O, normalizeLegacyContentEntries as P, resolveTailwindV4CssSourceBase as R, resolveTailwindV4SourceOptionsFromPatcher as S, transformTailwindV4CssToWeapp as T, findTailwindConfig as U, createTailwindcssPatcher as V, resolveTailwindcssOptions as W, findWorkspaceRoot as X, findWorkspacePackageDir as Y, resolveViteSourceScanEntries as _, transformTailwindV3CssByTarget as a, resolveTailwindV4SourceFromPatchOptions as b, getRuntimeClassSetCacheEntry as c, invalidateRuntimeClassSet as d, runtimeSignaturePatchersSymbol as f, resolveTailwindV4EntriesFromCssCached as g, resolveTailwindV4EntriesFromCss as h, createTailwindV3Engine as i, createSourceScanPattern as j, FULL_SOURCE_SCAN_EXTENSION_RE as k, getRuntimeClassSetSignature as l, discoverTailwindV4CssEntries as m, resolveTailwindV3SourceFromPatcher as n, transformTailwindV3CssToWeapp as o, createViteSourceScanMatcher as p, omitUndefined as q, resolveTailwindV3SourceOptionsFromPatcher as r, ensureTailwindcssRuntimePatch as s, resolveTailwindV3Source as t, getRuntimeClassSetSignatureWithSources as u, resolveViteTailwindV4CssDependencies as v, transformTailwindV4CssByTarget as w, resolveTailwindV4SourceFromPatcher as x, resolveTailwindV4Source$1 as y, toPosixPath as z };