weapp-tailwindcss 5.0.0-next.3 → 5.0.0-next.30

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 (243) hide show
  1. package/README.md +6 -7
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/auto-TH1jG2UW.js +115 -0
  4. package/dist/auto-XyKTOP7B.mjs +78 -0
  5. package/dist/bundle-state-Bi-cQua6.mjs +413 -0
  6. package/dist/bundle-state-Ct_8GcSR.js +529 -0
  7. package/dist/bundlers/shared/cache.d.ts +6 -6
  8. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -0
  9. package/dist/bundlers/shared/css-cleanup.d.ts +1 -4
  10. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  11. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  12. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  13. package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
  14. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  15. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  16. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  17. package/dist/bundlers/shared/generator-css/markers.d.ts +28 -0
  18. package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
  19. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
  20. package/dist/bundlers/shared/generator-css.d.ts +16 -22
  21. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  22. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  23. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  24. package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
  25. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  26. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
  27. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -0
  28. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  29. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  30. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  31. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  32. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  33. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  34. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  35. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  36. package/dist/bundlers/vite/generate-bundle.d.ts +14 -2
  37. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
  38. package/dist/bundlers/vite/index.d.ts +5 -2
  39. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  40. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  41. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  42. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
  43. package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
  44. package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
  45. package/dist/bundlers/vite/source-candidates.d.ts +19 -1
  46. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  47. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  48. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  49. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  50. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
  51. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
  52. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +2 -1
  53. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  54. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
  55. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  56. package/dist/cache/index.d.ts +6 -6
  57. package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
  58. package/dist/cli/context.d.ts +1 -14
  59. package/dist/cli/doctor/types.d.ts +11 -11
  60. package/dist/cli/helpers.d.ts +1 -2
  61. package/dist/cli/mount-options.d.ts +2 -0
  62. package/dist/cli/types.d.ts +0 -2
  63. package/dist/cli/vscode-entry.d.ts +3 -3
  64. package/dist/cli.js +758 -604
  65. package/dist/cli.mjs +766 -612
  66. package/dist/constants.d.ts +1 -2
  67. package/dist/context/runtime-package-replacements.d.ts +2 -0
  68. package/dist/context/style-options.d.ts +3 -0
  69. package/dist/core.js +12 -20
  70. package/dist/core.mjs +8 -14
  71. package/dist/css-macro/auto.d.ts +10 -0
  72. package/dist/css-macro/constants.d.ts +5 -2
  73. package/dist/css-macro/postcss.d.ts +1 -0
  74. package/dist/css-macro/postcss.js +7 -46
  75. package/dist/css-macro/postcss.mjs +2 -46
  76. package/dist/css-macro.d.ts +1 -0
  77. package/dist/css-macro.js +16 -7
  78. package/dist/css-macro.mjs +15 -6
  79. package/dist/defaults-8xrgzxFY.mjs +151 -0
  80. package/dist/defaults-zKUH2mDe.js +193 -0
  81. package/dist/defaults.d.ts +15 -1
  82. package/dist/defaults.js +6 -131
  83. package/dist/defaults.mjs +2 -129
  84. package/dist/escape.js +10 -2
  85. package/dist/escape.mjs +10 -2
  86. package/dist/generator/index.d.ts +1 -1
  87. package/dist/generator/options.d.ts +9 -8
  88. package/dist/generator/types.d.ts +3 -3
  89. package/dist/generator-CrU-Ghc1.js +90 -0
  90. package/dist/generator-Qw-tZ0Z2.mjs +65 -0
  91. package/dist/generator.js +12 -12
  92. package/dist/generator.mjs +2 -1
  93. package/dist/gulp.js +187 -48
  94. package/dist/gulp.mjs +180 -41
  95. package/dist/incremental-runtime-class-set-BdZHkoTs.mjs +1975 -0
  96. package/dist/incremental-runtime-class-set-BxvZONkv.js +2038 -0
  97. package/dist/index.d.ts +3 -2
  98. package/dist/index.js +19 -7
  99. package/dist/index.mjs +6 -5
  100. package/dist/js/babel/cache-options.d.ts +3 -0
  101. package/dist/js/babel/parse.d.ts +7 -4
  102. package/dist/js/index.d.ts +1 -0
  103. package/dist/js/literal-transform.d.ts +2 -0
  104. package/dist/js/precheck.d.ts +2 -2
  105. package/dist/logger-BNzxZbZj.mjs +2 -0
  106. package/dist/logger-TlKT3xmR.js +1 -0
  107. package/dist/postcss/config-directive.d.ts +1 -0
  108. package/dist/postcss/context.d.ts +9 -0
  109. package/dist/postcss/source-files.d.ts +8 -0
  110. package/dist/postcss/tailwind-version.d.ts +3 -0
  111. package/dist/postcss-C6zOQqlL.mjs +228 -0
  112. package/dist/postcss-C7BMYpEF.mjs +169 -0
  113. package/dist/postcss-CiYLsqZn.js +192 -0
  114. package/dist/postcss-DAWf9D3C.js +237 -0
  115. package/dist/postcss-html-transform.js +1 -1
  116. package/dist/postcss.d.ts +2 -2
  117. package/dist/postcss.js +3 -276
  118. package/dist/postcss.mjs +1 -269
  119. package/dist/precheck-D7K12zeX.mjs +4716 -0
  120. package/dist/precheck-D7gJSmJz.js +4842 -0
  121. package/dist/presets/index.d.ts +1 -0
  122. package/dist/presets/uni-app-x.d.ts +1 -0
  123. package/dist/presets.js +29 -13
  124. package/dist/presets.mjs +25 -11
  125. package/dist/reset.d.ts +1 -0
  126. package/dist/reset.js +1 -1
  127. package/dist/runtime-registry-DpcR3IHI.js +5496 -0
  128. package/dist/shared/mpx.d.ts +1 -0
  129. package/dist/source-candidates-CX2ozpKM.mjs +322 -0
  130. package/dist/source-candidates-DNM8iwXW.js +335 -0
  131. package/dist/tailwindcss/miniprogram.d.ts +1 -1
  132. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  133. package/dist/tailwindcss/patcher.d.ts +1 -2
  134. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  135. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  136. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  137. package/dist/tailwindcss/runtime.d.ts +11 -12
  138. package/dist/tailwindcss/source-scan.d.ts +35 -0
  139. package/dist/tailwindcss/targets.d.ts +1 -5
  140. package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
  141. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  142. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  143. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  144. package/dist/tailwindcss/v4/patcher.d.ts +1 -0
  145. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  146. package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
  147. package/dist/tailwindcss/version.d.ts +4 -0
  148. package/dist/tailwindcss-B-e2RiXr.js +642 -0
  149. package/dist/tailwindcss-C7dJHZ0G.mjs +591 -0
  150. package/dist/typedoc.export.d.ts +0 -2
  151. package/dist/types/index.d.ts +52 -49
  152. package/dist/types/shared.d.ts +6 -0
  153. package/dist/types/user-defined-options/general.d.ts +25 -24
  154. package/dist/types/user-defined-options/important.d.ts +33 -28
  155. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  156. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  157. package/dist/uni-app-x/vite.d.ts +1 -1
  158. package/dist/unocss/index.d.ts +2 -0
  159. package/dist/utils/disabled.d.ts +2 -3
  160. package/dist/utils/object.d.ts +9 -0
  161. package/dist/utils/options.d.ts +2 -0
  162. package/dist/utils/regex.d.ts +1 -0
  163. package/dist/{utils-DmC9_In3.js → utils-D7Ygohep.js} +2 -2
  164. package/dist/{utils-7DUGTFED.mjs → utils-DsaS975I.mjs} +1 -1
  165. package/dist/v3-engine-CHItlVq5.js +3616 -0
  166. package/dist/v3-engine-DcvCCHfs.mjs +3321 -0
  167. package/dist/vite-C65DdWEj.js +24439 -0
  168. package/dist/vite-rmL1rsA_.mjs +24425 -0
  169. package/dist/vite.d.ts +1 -2
  170. package/dist/vite.js +3 -4
  171. package/dist/vite.mjs +2 -2
  172. package/dist/weapp-tw-css-import-rewrite-loader.js +5032 -18
  173. package/dist/weapp-tw-runtime-classset-loader.js +32 -9
  174. package/dist/webpack-BU2Er4qg.mjs +841 -0
  175. package/dist/webpack-CqGvjvSQ.js +851 -0
  176. package/dist/webpack.d.ts +1 -3
  177. package/dist/webpack.js +3 -4
  178. package/dist/webpack.mjs +2 -2
  179. package/package.json +38 -48
  180. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  181. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  182. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  183. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  184. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  185. package/dist/cli/config.d.ts +0 -5
  186. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  187. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  188. package/dist/cli/patch-options.d.ts +0 -6
  189. package/dist/cli/tokens.d.ts +0 -4
  190. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  191. package/dist/cli/workspace/patch-package.d.ts +0 -3
  192. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  193. package/dist/cli/workspace/types.d.ts +0 -11
  194. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  195. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  196. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  197. package/dist/cli/workspace.d.ts +0 -2
  198. package/dist/constants-B-_T5UnW.mjs +0 -44
  199. package/dist/constants-p1dyh1x1.js +0 -73
  200. package/dist/css-imports-BbrbluP9.js +0 -177
  201. package/dist/css-imports-CSdPq_Sc.mjs +0 -128
  202. package/dist/experimental/index.d.ts +0 -2
  203. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  204. package/dist/experimental/oxc/index.d.ts +0 -2
  205. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  206. package/dist/experimental/shared/cache.d.ts +0 -3
  207. package/dist/experimental/shared/transform.d.ts +0 -3
  208. package/dist/experimental/shared.d.ts +0 -8
  209. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  210. package/dist/experimental/swc/index.d.ts +0 -2
  211. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  212. package/dist/generator-Y-Ikv4Fu.mjs +0 -1177
  213. package/dist/generator-css-Bwy_Uz89.mjs +0 -1097
  214. package/dist/generator-css-CRLrHW4F.js +0 -1124
  215. package/dist/generator-mmhXzZnv.js +0 -1276
  216. package/dist/js/syntax.d.ts +0 -10
  217. package/dist/lightningcss/index.d.ts +0 -8
  218. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  219. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  220. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  221. package/dist/lightningcss/style-handler.d.ts +0 -17
  222. package/dist/loader-anchors-1MumTAtA.mjs +0 -205
  223. package/dist/loader-anchors-TrFvT6g1.js +0 -273
  224. package/dist/logger-BZ45DZJT.js +0 -1003
  225. package/dist/logger-BoVx1Dbt.mjs +0 -935
  226. package/dist/patcher-options-6gJN2EXy.js +0 -115
  227. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  228. package/dist/recorder-GdTJ3QqX.js +0 -2878
  229. package/dist/recorder-XdFvVASS.mjs +0 -2763
  230. package/dist/tailwindcss/recorder.d.ts +0 -13
  231. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  232. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  233. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  234. package/dist/tailwindcss/targets/types.d.ts +0 -35
  235. package/dist/types/disabled-options.d.ts +0 -4
  236. package/dist/vite-BDywuCjn.mjs +0 -2186
  237. package/dist/vite-DgRh_GXn.js +0 -2199
  238. package/dist/webpack-CAJR4hhP.js +0 -456
  239. package/dist/webpack-CiHqVZTg.mjs +0 -441
  240. package/dist/webpack4.d.ts +0 -4
  241. package/dist/webpack4.js +0 -387
  242. package/dist/webpack4.mjs +0 -379
  243. package/scripts/postinstall.mjs +0 -59
@@ -0,0 +1,591 @@
1
+ import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-DcvCCHfs.mjs";
2
+ import { n as defuOverrideArray } from "./utils-DsaS975I.mjs";
3
+ import { createRequire } from "node:module";
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import path from "node:path";
6
+ import process from "node:process";
7
+ import { logger } from "@weapp-tailwindcss/logger";
8
+ import { fileURLToPath } from "node:url";
9
+ //#region src/tailwindcss/v4/css-sources.ts
10
+ function hasCssEntriesValue(value) {
11
+ if (typeof value === "string") return value.trim().length > 0;
12
+ return Array.isArray(value) && value.some((entry) => typeof entry === "string" && entry.trim().length > 0);
13
+ }
14
+ function hasCssSourcesValue(value) {
15
+ return Array.isArray(value) && value.some((source) => {
16
+ return typeof source === "object" && source !== null && typeof source.css === "string" && source.css.trim().length > 0;
17
+ });
18
+ }
19
+ function hasConfiguredTailwindV4CssRoots(options) {
20
+ return hasCssEntriesValue(options.cssEntries) || hasCssEntriesValue(options.tailwindcss?.v4?.cssEntries) || hasCssEntriesValue(options.tailwindcssPatcherOptions?.tailwindcss?.v4?.cssEntries) || hasCssSourcesValue(options.tailwindcss?.v4?.cssSources) || hasCssSourcesValue(options.tailwindcssPatcherOptions?.tailwindcss?.v4?.cssSources);
21
+ }
22
+ function normalizeCssSourceFile(file) {
23
+ if (!file) return;
24
+ return path.isAbsolute(file) ? path.normalize(file) : file;
25
+ }
26
+ function normalizeCssSourceBase(base) {
27
+ if (!base) return;
28
+ return path.resolve(base);
29
+ }
30
+ function normalizeDependencies(dependencies) {
31
+ return dependencies?.map(normalizeCssSourceFile).filter((dependency) => typeof dependency === "string" && dependency.length > 0);
32
+ }
33
+ function isSameCssSource(a, b) {
34
+ return a.css === b.css && normalizeCssSourceBase(a.base) === normalizeCssSourceBase(b.base) && normalizeCssSourceFile(a.file) === normalizeCssSourceFile(b.file) && JSON.stringify(normalizeDependencies(a.dependencies)) === JSON.stringify(normalizeDependencies(b.dependencies));
35
+ }
36
+ function upsertTailwindV4CssSource(opts, source) {
37
+ const normalizedSource = omitUndefined({
38
+ ...source,
39
+ ...source.base === void 0 ? {} : { base: normalizeCssSourceBase(source.base) },
40
+ ...source.file === void 0 ? {} : { file: normalizeCssSourceFile(source.file) },
41
+ ...source.dependencies === void 0 ? {} : { dependencies: normalizeDependencies(source.dependencies) }
42
+ });
43
+ const tailwindcss = opts.tailwindcss ?? {};
44
+ const v4 = tailwindcss.v4 ?? {};
45
+ const cssSources = [...v4.cssSources ?? []];
46
+ const sourceFile = normalizeCssSourceFile(normalizedSource.file);
47
+ const existingIndex = cssSources.findIndex((candidate) => normalizeCssSourceFile(candidate.file) === sourceFile);
48
+ if (existingIndex >= 0) {
49
+ const existing = cssSources[existingIndex];
50
+ if (!existing) {
51
+ cssSources[existingIndex] = normalizedSource;
52
+ return true;
53
+ }
54
+ const nextSource = {
55
+ ...existing,
56
+ ...normalizedSource
57
+ };
58
+ if (isSameCssSource(existing, nextSource)) return false;
59
+ cssSources[existingIndex] = nextSource;
60
+ } else cssSources.push(normalizedSource);
61
+ opts.tailwindcss = {
62
+ ...tailwindcss,
63
+ v4: {
64
+ ...v4,
65
+ cssSources
66
+ }
67
+ };
68
+ return true;
69
+ }
70
+ //#endregion
71
+ //#region src/tailwindcss/v4/config.ts
72
+ const DEFAULT_CSS_CALC_CUSTOM_PROPERTIES = [];
73
+ function includesToken(list, token) {
74
+ return list.some((candidate) => {
75
+ if (typeof token === "string") {
76
+ if (typeof candidate === "string") return candidate === token;
77
+ candidate.lastIndex = 0;
78
+ return candidate.test(token);
79
+ }
80
+ if (typeof candidate === "string") {
81
+ token.lastIndex = 0;
82
+ return token.test(candidate);
83
+ }
84
+ return candidate.source === token.source && candidate.flags === token.flags;
85
+ });
86
+ }
87
+ function ensureDefaultsIncluded(value) {
88
+ if (value === true) return { includeCustomProperties: [...DEFAULT_CSS_CALC_CUSTOM_PROPERTIES] };
89
+ if (Array.isArray(value)) {
90
+ if (!DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.length) return value;
91
+ const missing = DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.filter((token) => !includesToken(value, token));
92
+ return missing.length > 0 ? [...value, ...missing] : value;
93
+ }
94
+ if (value && typeof value === "object") {
95
+ const include = value.includeCustomProperties;
96
+ if (!Array.isArray(include)) return {
97
+ ...value,
98
+ includeCustomProperties: [...DEFAULT_CSS_CALC_CUSTOM_PROPERTIES]
99
+ };
100
+ if (!DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.length) return value;
101
+ const missing = DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.filter((token) => !includesToken(include, token));
102
+ return missing.length > 0 ? {
103
+ ...value,
104
+ includeCustomProperties: [...include, ...missing]
105
+ } : value;
106
+ }
107
+ return value;
108
+ }
109
+ function normalizeCssEntriesConfig(entries) {
110
+ return normalizeStringListOption(entries);
111
+ }
112
+ function hasConfiguredCssEntries(ctx) {
113
+ if (normalizeCssEntriesConfig(ctx.cssEntries)) return true;
114
+ if (normalizeCssEntriesConfig(ctx.tailwindcss?.v4?.cssEntries)) return true;
115
+ const patcherOptions = ctx.tailwindcssPatcherOptions;
116
+ if (patcherOptions) {
117
+ if (normalizeCssEntriesConfig(patcherOptions.tailwindcss?.v4?.cssEntries)) return true;
118
+ }
119
+ return false;
120
+ }
121
+ let hasWarnedMissingCssEntries = false;
122
+ function warnMissingCssEntries(ctx, patcher) {
123
+ if (hasWarnedMissingCssEntries) return;
124
+ if (patcher?.majorVersion !== 4) return;
125
+ if (hasConfiguredCssEntries(ctx) || hasConfiguredTailwindV4CssRoots(ctx)) return;
126
+ hasWarnedMissingCssEntries = true;
127
+ logger.warn("[tailwindcss@4] 未检测到 cssEntries 配置。请传入包含 tailwindcss 引用的 CSS 绝对路径,例如 cssEntries: [\"/absolute/path/to/src/app.css\"],否则 tailwindcss 生成的类名不会参与转译。");
128
+ }
129
+ function applyV4CssCalcDefaults(cssCalc, patcher) {
130
+ const cssCalcOptions = cssCalc ?? patcher?.majorVersion === 4;
131
+ if (patcher?.majorVersion === 4 && cssCalcOptions) return ensureDefaultsIncluded(cssCalcOptions);
132
+ return cssCalcOptions;
133
+ }
134
+ //#endregion
135
+ //#region src/tailwindcss/v4/multi-patcher.ts
136
+ function createMultiTailwindcssPatcher(patchers) {
137
+ if (patchers.length <= 1) {
138
+ const [patcher] = patchers;
139
+ if (!patcher) throw new Error("createMultiTailwindcssPatcher requires at least one patcher.");
140
+ return patcher;
141
+ }
142
+ const first = patchers[0];
143
+ const firstWithoutPatch = { ...first };
144
+ delete firstWithoutPatch.patch;
145
+ const multiPatcher = {
146
+ ...firstWithoutPatch,
147
+ packageInfo: first?.packageInfo,
148
+ majorVersion: first?.majorVersion,
149
+ options: first?.options,
150
+ async getClassSet() {
151
+ const aggregated = /* @__PURE__ */ new Set();
152
+ for (const patcher of patchers) {
153
+ const current = await patcher.getClassSet();
154
+ for (const className of current) aggregated.add(className);
155
+ }
156
+ return aggregated;
157
+ },
158
+ async extract(options) {
159
+ const aggregatedSet = /* @__PURE__ */ new Set();
160
+ const aggregatedList = [];
161
+ let filename;
162
+ for (const patcher of patchers) {
163
+ const result = await patcher.extract(options);
164
+ if (!result) continue;
165
+ if (filename === void 0 && result.filename) filename = result.filename;
166
+ if (result.classList) for (const className of result.classList) {
167
+ if (!aggregatedSet.has(className)) aggregatedList.push(className);
168
+ aggregatedSet.add(className);
169
+ }
170
+ if (result.classSet) for (const className of result.classSet) aggregatedSet.add(className);
171
+ }
172
+ return omitUndefined({
173
+ classList: aggregatedList,
174
+ classSet: aggregatedSet,
175
+ filename
176
+ });
177
+ }
178
+ };
179
+ if (patchers.every((patcher) => typeof patcher.getClassSetSync === "function")) multiPatcher.getClassSetSync = () => {
180
+ const aggregated = /* @__PURE__ */ new Set();
181
+ for (const patcher of patchers) {
182
+ const current = patcher.getClassSetSync?.();
183
+ if (!current) continue;
184
+ for (const className of current) aggregated.add(className);
185
+ }
186
+ return aggregated;
187
+ };
188
+ Object.defineProperty(multiPatcher, runtimeSignaturePatchersSymbol, {
189
+ value: [...patchers],
190
+ configurable: true
191
+ });
192
+ return multiPatcher;
193
+ }
194
+ //#endregion
195
+ //#region src/tailwindcss/v4/patcher-options.ts
196
+ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries) {
197
+ const hasCssEntries = cssEntries.length > 0;
198
+ if (!options) return options;
199
+ const modernTailwind = options.tailwindcss;
200
+ if (!modernTailwind) return options;
201
+ return {
202
+ ...options,
203
+ tailwindcss: {
204
+ ...modernTailwind,
205
+ v4: {
206
+ ...modernTailwind.v4 ?? {},
207
+ ...hasCssEntries ? {} : { base: modernTailwind.v4?.base ?? baseDir },
208
+ cssEntries: hasCssEntries ? cssEntries : modernTailwind.v4?.cssEntries ?? cssEntries
209
+ }
210
+ }
211
+ };
212
+ }
213
+ //#endregion
214
+ //#region src/tailwindcss/v4/css-entries.ts
215
+ function guessBasedirFromEntries(entries) {
216
+ if (!entries) return;
217
+ for (const entry of entries) {
218
+ if (typeof entry !== "string") continue;
219
+ const trimmed = entry.trim();
220
+ if (!trimmed || !path.isAbsolute(trimmed)) continue;
221
+ const entryDir = path.dirname(trimmed);
222
+ const resolved = findNearestPackageRoot(entryDir) ?? entryDir;
223
+ if (resolved) return resolved;
224
+ }
225
+ }
226
+ function normalizeCssEntries(entries, anchor) {
227
+ if (!entries || entries.length === 0) return;
228
+ const normalized = /* @__PURE__ */ new Set();
229
+ for (const entry of entries) {
230
+ if (typeof entry !== "string") continue;
231
+ const trimmed = entry.trim();
232
+ if (trimmed.length === 0) continue;
233
+ const resolved = path.isAbsolute(trimmed) ? path.normalize(trimmed) : path.normalize(path.resolve(anchor, trimmed));
234
+ normalized.add(resolved);
235
+ }
236
+ return normalized.size > 0 ? [...normalized] : void 0;
237
+ }
238
+ function isSubPath(parent, child) {
239
+ if (!parent || !child) return false;
240
+ const relative = path.relative(parent, child);
241
+ return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
242
+ }
243
+ function resolveCssEntryBase(entryDir, options) {
244
+ const normalizedDir = path.normalize(entryDir);
245
+ const { preferredBaseDir, workspaceRoot } = options;
246
+ if (preferredBaseDir && isSubPath(preferredBaseDir, normalizedDir)) return preferredBaseDir;
247
+ if (workspaceRoot && isSubPath(workspaceRoot, normalizedDir)) return workspaceRoot;
248
+ const packageRoot = findNearestPackageRoot(normalizedDir);
249
+ if (packageRoot) return path.normalize(packageRoot);
250
+ return normalizedDir;
251
+ }
252
+ function groupCssEntriesByBase(entries, options = {}) {
253
+ const normalizedOptions = {
254
+ preferredBaseDir: options.preferredBaseDir ? path.normalize(options.preferredBaseDir) : void 0,
255
+ workspaceRoot: options.workspaceRoot ? path.normalize(options.workspaceRoot) : void 0
256
+ };
257
+ const groups = /* @__PURE__ */ new Map();
258
+ for (const entry of entries) {
259
+ const baseDir = resolveCssEntryBase(path.dirname(entry), normalizedOptions);
260
+ const bucket = groups.get(baseDir);
261
+ if (bucket) bucket.push(entry);
262
+ else groups.set(baseDir, [entry]);
263
+ }
264
+ return groups;
265
+ }
266
+ //#endregion
267
+ //#region src/tailwindcss/v4/patcher.ts
268
+ const CONFIGURED_TAILWIND_VERSION_RE = /Configured tailwindcss\.version=\d+/u;
269
+ const RESOLVED_TAILWIND_VERSION_RE = /resolved package ".+" is version /u;
270
+ function isTailwindcss4Package(packageName) {
271
+ return Boolean(packageName && (packageName === "tailwindcss4" || packageName === "@tailwindcss/postcss" || packageName.includes("tailwindcss4")));
272
+ }
273
+ function resolveExplicitTailwindVersion(configuredVersion, configuredPackageName) {
274
+ if (typeof configuredVersion === "number") return configuredVersion;
275
+ if (configuredPackageName === "tailwindcss") return 3;
276
+ if (isTailwindcss4Package(configuredPackageName)) return 4;
277
+ }
278
+ function hasOwnV4Signal(value) {
279
+ return typeof value === "object" && value !== null && "v4" in value;
280
+ }
281
+ function isTailwindVersionMismatchError(error) {
282
+ return error instanceof Error && CONFIGURED_TAILWIND_VERSION_RE.test(error.message) && RESOLVED_TAILWIND_VERSION_RE.test(error.message);
283
+ }
284
+ function createPatcherForBase(baseDir, cssEntries, options) {
285
+ const { tailwindcss, tailwindcssPatcherOptions, supportCustomLengthUnitsPatch, bareArbitraryValues } = options;
286
+ const hasCssEntries = Boolean(cssEntries?.length);
287
+ const configuredV4Options = tailwindcss?.v4 ?? tailwindcssPatcherOptions?.tailwindcss?.v4;
288
+ const hasCssSources = Boolean(configuredV4Options?.cssSources?.length);
289
+ const defaultTailwindcssConfig = {
290
+ cwd: baseDir,
291
+ v2: { cwd: baseDir },
292
+ v3: { cwd: baseDir },
293
+ v4: hasCssEntries ? omitUndefined({ cssEntries }) : omitUndefined({
294
+ base: baseDir,
295
+ cssEntries
296
+ })
297
+ };
298
+ const mergedTailwindOptions = defuOverrideArray(tailwindcss ?? {}, defaultTailwindcssConfig);
299
+ if (!mergedTailwindOptions.v4) mergedTailwindOptions.v4 = hasCssEntries ? { cssEntries: cssEntries ?? [] } : {
300
+ base: baseDir,
301
+ cssEntries: cssEntries ?? []
302
+ };
303
+ else {
304
+ if (!hasCssEntries && !mergedTailwindOptions.v4.base) mergedTailwindOptions.v4.base = baseDir;
305
+ if (hasCssEntries) {
306
+ if (cssEntries?.length) mergedTailwindOptions.v4.cssEntries = cssEntries;
307
+ else if (!mergedTailwindOptions.v4.cssEntries) mergedTailwindOptions.v4.cssEntries = [];
308
+ } else if (!mergedTailwindOptions.v4.cssEntries) mergedTailwindOptions.v4.cssEntries = cssEntries ?? [];
309
+ }
310
+ if (bareArbitraryValues !== void 0 && bareArbitraryValues !== false) mergedTailwindOptions.v4.bareArbitraryValues = bareArbitraryValues;
311
+ const patchedOptions = overrideTailwindcssPatcherOptionsForBase(tailwindcssPatcherOptions, baseDir, cssEntries ?? []);
312
+ const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwindcss?.packageName;
313
+ const explicitTailwindVersion = resolveExplicitTailwindVersion(tailwindcss?.version || tailwindcssPatcherOptions?.tailwindcss?.version || mergedTailwindOptions.version, configuredPackageName);
314
+ const hasExplicitV4Signals = hasCssEntries || hasCssSources || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
315
+ const packageNameForVersionDetection = configuredPackageName ?? mergedTailwindOptions.packageName ?? "tailwindcss";
316
+ const installedTailwindVersion = readInstalledPackageMajorVersion(packageNameForVersionDetection, baseDir);
317
+ const resolvedTailwindVersion = installedTailwindVersion ?? explicitTailwindVersion;
318
+ const supportedResolvedTailwindVersion = resolvedTailwindVersion === 2 || resolvedTailwindVersion === 3 || resolvedTailwindVersion === 4 ? resolvedTailwindVersion : void 0;
319
+ const shouldPatchV4PostcssPackage = (resolvedTailwindVersion === 4 && (installedTailwindVersion === 4 || explicitTailwindVersion === 4 || hasExplicitV4Signals && isTailwindcss4Package(packageNameForVersionDetection)) || resolvedTailwindVersion === void 0 && (hasCssEntries || hasCssSources || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss))) && !Boolean(configuredPackageName);
320
+ const packageCandidates = /* @__PURE__ */ new Set();
321
+ if (shouldPatchV4PostcssPackage) packageCandidates.add("@tailwindcss/postcss");
322
+ packageCandidates.add(mergedTailwindOptions.packageName ?? configuredPackageName ?? "tailwindcss");
323
+ const patchers = [];
324
+ const packageCandidateList = [...packageCandidates];
325
+ let firstVersionMismatchError;
326
+ for (const packageName of packageCandidateList) {
327
+ const tailwindOptionsForPackage = {
328
+ ...mergedTailwindOptions,
329
+ packageName
330
+ };
331
+ if (supportedResolvedTailwindVersion) tailwindOptionsForPackage.version = supportedResolvedTailwindVersion;
332
+ try {
333
+ patchers.push(createTailwindcssPatcher(omitUndefined({
334
+ basedir: baseDir,
335
+ supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch ?? true,
336
+ tailwindcss: tailwindOptionsForPackage,
337
+ tailwindcssPatcherOptions: patchedOptions
338
+ })));
339
+ } catch (error) {
340
+ if (packageCandidateList.length > 1 && isTailwindVersionMismatchError(error)) {
341
+ firstVersionMismatchError ?? (firstVersionMismatchError = error);
342
+ logger.warn("skip incompatible Tailwind package candidate \"%s\" for v4 patcher: %s", packageName, error.message);
343
+ continue;
344
+ }
345
+ throw error;
346
+ }
347
+ }
348
+ if (patchers.length === 0 && firstVersionMismatchError) throw firstVersionMismatchError;
349
+ const [singlePatcher] = patchers;
350
+ return patchers.length === 1 && singlePatcher ? singlePatcher : createMultiTailwindcssPatcher(patchers);
351
+ }
352
+ function tryCreateMultiTailwindcssPatcher(groups, options) {
353
+ if (groups.size <= 1) return;
354
+ logger.debug("detected multiple Tailwind CSS entry bases: %O", [...groups.keys()]);
355
+ const patchers = [];
356
+ for (const [baseDir, entries] of groups) {
357
+ const patcher = createPatcherForBase(baseDir, entries, options);
358
+ if (patcher) patchers.push(patcher);
359
+ }
360
+ return createMultiTailwindcssPatcher(patchers);
361
+ }
362
+ //#endregion
363
+ //#region src/uni-app-x/options.ts
364
+ const DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS = {
365
+ enabled: true,
366
+ onlyWhenStyleIsolationVersion2: true
367
+ };
368
+ const DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS = {
369
+ enabled: false,
370
+ onlyWhenStyleIsolationVersion2: true
371
+ };
372
+ function isBooleanUniAppXShortcut(option) {
373
+ return option === true || option === false || option === void 0;
374
+ }
375
+ function resolveComponentLocalStyles(option) {
376
+ if (isBooleanUniAppXShortcut(option)) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
377
+ const componentLocalStyles = option.componentLocalStyles;
378
+ if (componentLocalStyles === false) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
379
+ if (componentLocalStyles === true || componentLocalStyles === void 0) return DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS;
380
+ return {
381
+ enabled: componentLocalStyles.enabled !== false,
382
+ onlyWhenStyleIsolationVersion2: componentLocalStyles.onlyWhenStyleIsolationVersion2 !== false
383
+ };
384
+ }
385
+ function resolveUniAppXOptions(option) {
386
+ if (typeof option === "object" && option) return {
387
+ enabled: option.enabled !== false,
388
+ componentLocalStyles: resolveComponentLocalStyles(option),
389
+ uvueUnsupported: option.uvueUnsupported ?? "warn"
390
+ };
391
+ return {
392
+ enabled: Boolean(option),
393
+ componentLocalStyles: resolveComponentLocalStyles(option),
394
+ uvueUnsupported: "warn"
395
+ };
396
+ }
397
+ function isUniAppXEnabled(option) {
398
+ return resolveUniAppXOptions(option).enabled;
399
+ }
400
+ //#endregion
401
+ //#region src/context/tailwindcss/basedir.ts
402
+ const ENV_BASEDIR_KEYS = [
403
+ "WEAPP_TAILWINDCSS_BASEDIR",
404
+ "WEAPP_TAILWINDCSS_BASE_DIR",
405
+ "TAILWINDCSS_BASEDIR",
406
+ "TAILWINDCSS_BASE_DIR",
407
+ "UNI_INPUT_DIR",
408
+ "UNI_INPUT_ROOT",
409
+ "UNI_CLI_ROOT",
410
+ "UNI_APP_INPUT_DIR",
411
+ "INIT_CWD",
412
+ "PWD"
413
+ ];
414
+ const GENERIC_ENV_BASEDIR_KEYS = new Set(["INIT_CWD", "PWD"]);
415
+ function pickEnvBasedir() {
416
+ for (const key of ENV_BASEDIR_KEYS) {
417
+ const value = process.env[key];
418
+ if (value && path.isAbsolute(value)) return {
419
+ key,
420
+ value
421
+ };
422
+ }
423
+ }
424
+ function pickPackageEnvBasedir() {
425
+ const packageJsonPath = process.env["npm_package_json"];
426
+ if (packageJsonPath) {
427
+ const packageDir = path.dirname(packageJsonPath);
428
+ if (packageDir && path.isAbsolute(packageDir)) return packageDir;
429
+ }
430
+ const localPrefix = process.env["npm_config_local_prefix"];
431
+ if (localPrefix && path.isAbsolute(localPrefix)) return localPrefix;
432
+ }
433
+ const STACK_PAREN_RE = /\(([^)]+)\)/u;
434
+ const STACK_AT_RE = /at\s+(\S.*)$/u;
435
+ function detectCallerBasedir() {
436
+ const stack = (/* @__PURE__ */ new Error("resolveTailwindcssBasedir stack probe")).stack;
437
+ if (!stack) return;
438
+ if (process.env["WEAPP_TW_DEBUG_STACK"] === "1") logger.debug("caller stack: %s", stack);
439
+ const lines = stack.split("\n");
440
+ for (const line of lines) {
441
+ const location = (line.match(STACK_PAREN_RE) ?? line.match(STACK_AT_RE))?.[1];
442
+ if (!location) continue;
443
+ let filePath = location;
444
+ if (filePath.startsWith("file://")) try {
445
+ filePath = fileURLToPath(filePath);
446
+ } catch {
447
+ continue;
448
+ }
449
+ const [candidate = ""] = filePath.split(":");
450
+ const resolvedPath = path.isAbsolute(filePath) ? filePath : candidate;
451
+ if (!path.isAbsolute(resolvedPath)) continue;
452
+ if (resolvedPath.includes("node_modules") && resolvedPath.includes("weapp-tailwindcss")) continue;
453
+ try {
454
+ return path.dirname(resolvedPath);
455
+ } catch {
456
+ continue;
457
+ }
458
+ }
459
+ }
460
+ function resolveTailwindcssBasedir(basedir, fallback) {
461
+ const envBasedirResult = pickEnvBasedir();
462
+ const envBasedir = envBasedirResult?.value;
463
+ const envBasedirKey = envBasedirResult?.key;
464
+ const envBasedirIsGeneric = envBasedirKey ? GENERIC_ENV_BASEDIR_KEYS.has(envBasedirKey) : false;
465
+ const packageEnvBasedir = pickPackageEnvBasedir();
466
+ const callerBasedir = !envBasedir || envBasedirIsGeneric ? detectCallerBasedir() : void 0;
467
+ const cwd = process.cwd();
468
+ const anchor = envBasedir ?? packageEnvBasedir ?? fallback ?? callerBasedir ?? cwd;
469
+ const resolveRelative = (value) => path.isAbsolute(value) ? path.normalize(value) : path.normalize(path.resolve(anchor, value));
470
+ if (process.env["WEAPP_TW_DEBUG_STACK"] === "1") logger.debug("resolveTailwindcssBasedir anchor %O", {
471
+ basedir,
472
+ envBasedir,
473
+ envBasedirKey,
474
+ envBasedirIsGeneric,
475
+ packageEnvBasedir,
476
+ fallback,
477
+ callerBasedir,
478
+ npm_package_json: process.env["npm_package_json"],
479
+ cwd,
480
+ anchor
481
+ });
482
+ if (basedir && basedir.trim().length > 0) return resolveRelative(basedir);
483
+ if (envBasedir && !envBasedirIsGeneric) return path.normalize(envBasedir);
484
+ if (fallback && fallback.trim().length > 0) return resolveRelative(fallback);
485
+ if (packageEnvBasedir) return path.normalize(packageEnvBasedir);
486
+ if (callerBasedir) {
487
+ const normalizedCaller = path.normalize(callerBasedir);
488
+ const librarySegment = `${path.sep}weapp-tailwindcss${path.sep}`;
489
+ if (!normalizedCaller.includes(librarySegment)) return normalizedCaller;
490
+ }
491
+ const packageName = process.env["PNPM_PACKAGE_NAME"];
492
+ if (packageName) try {
493
+ const packageJsonPath = createRequire(path.join(anchor, "__resolve_tailwindcss_basedir__.cjs")).resolve(`${packageName}/package.json`);
494
+ if (process.env["WEAPP_TW_DEBUG_STACK"] === "1") logger.debug("package basedir resolved from PNPM_PACKAGE_NAME: %s", packageJsonPath);
495
+ return path.normalize(path.dirname(packageJsonPath));
496
+ } catch {
497
+ if (process.env["WEAPP_TW_DEBUG_STACK"] === "1") logger.debug("failed to resolve package json for %s", packageName);
498
+ const workspaceRoot = findWorkspaceRoot(anchor);
499
+ if (workspaceRoot) {
500
+ const packageDir = findWorkspacePackageDir(workspaceRoot, packageName);
501
+ if (packageDir) return packageDir;
502
+ }
503
+ }
504
+ if (envBasedir) return path.normalize(envBasedir);
505
+ return path.normalize(cwd);
506
+ }
507
+ //#endregion
508
+ //#region src/context/tailwindcss/rax.ts
509
+ function isRaxWorkspace(appType, baseDir) {
510
+ if (appType === "rax") return true;
511
+ try {
512
+ const pkgPath = path.join(baseDir, "package.json");
513
+ if (!existsSync(pkgPath)) return false;
514
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
515
+ const deps = {
516
+ ...pkg["dependencies"] ?? {},
517
+ ...pkg["devDependencies"] ?? {}
518
+ };
519
+ if (deps["rax-app"] || deps.rax) return true;
520
+ } catch {
521
+ return false;
522
+ }
523
+ return false;
524
+ }
525
+ function collectRaxStyleEntries(baseDir) {
526
+ const STYLE_CANDIDATES = [
527
+ "src/global.css",
528
+ "src/global.scss",
529
+ "src/global.less",
530
+ "src/global.sass",
531
+ "src/global.styl",
532
+ "src/global.stylus"
533
+ ];
534
+ const discovered = [];
535
+ for (const relative of STYLE_CANDIDATES) {
536
+ const candidate = path.resolve(baseDir, relative);
537
+ if (existsSync(candidate)) discovered.push(path.normalize(candidate));
538
+ }
539
+ return discovered;
540
+ }
541
+ function detectImplicitCssEntries(appType, baseDir) {
542
+ const baseCandidates = /* @__PURE__ */ new Set();
543
+ baseCandidates.add(path.normalize(baseDir));
544
+ const envCandidates = [
545
+ process.cwd(),
546
+ process.env["INIT_CWD"],
547
+ process.env["PWD"]
548
+ ];
549
+ for (const candidate of envCandidates) if (candidate) baseCandidates.add(path.normalize(candidate));
550
+ for (const candidateBase of baseCandidates) {
551
+ if (!isRaxWorkspace(appType, candidateBase)) continue;
552
+ const entries = collectRaxStyleEntries(candidateBase);
553
+ if (entries.length) return entries;
554
+ }
555
+ }
556
+ //#endregion
557
+ //#region src/context/tailwindcss.ts
558
+ function createTailwindcssPatcherFromContext(ctx) {
559
+ const { tailwindcssBasedir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions, cssEntries: rawCssEntries, appType, arbitraryValues } = ctx;
560
+ const absoluteCssEntryBasedir = guessBasedirFromEntries(rawCssEntries);
561
+ const resolvedTailwindcssBasedir = resolveTailwindcssBasedir(tailwindcssBasedir, absoluteCssEntryBasedir);
562
+ ctx.tailwindcssBasedir = resolvedTailwindcssBasedir;
563
+ logger.debug("tailwindcss basedir resolved: %s", resolvedTailwindcssBasedir);
564
+ let normalizedCssEntries = normalizeCssEntries(rawCssEntries, resolvedTailwindcssBasedir);
565
+ if (!normalizedCssEntries) normalizedCssEntries = detectImplicitCssEntries(ctx.appType, resolvedTailwindcssBasedir);
566
+ if (normalizedCssEntries) ctx.cssEntries = normalizedCssEntries;
567
+ const patcherOptions = {
568
+ tailwindcss,
569
+ tailwindcssPatcherOptions,
570
+ supportCustomLengthUnitsPatch,
571
+ appType,
572
+ bareArbitraryValues: arbitraryValues?.bareArbitraryValues
573
+ };
574
+ const workspaceRoot = findWorkspaceRoot(resolvedTailwindcssBasedir) ?? (absoluteCssEntryBasedir ? findWorkspaceRoot(absoluteCssEntryBasedir) : void 0);
575
+ const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries, omitUndefined({
576
+ preferredBaseDir: resolvedTailwindcssBasedir,
577
+ workspaceRoot
578
+ })) : void 0;
579
+ const multiPatcher = groupedCssEntries ? tryCreateMultiTailwindcssPatcher(groupedCssEntries, patcherOptions) : void 0;
580
+ if (multiPatcher) return multiPatcher;
581
+ if (groupedCssEntries?.size === 1) {
582
+ const firstGroup = groupedCssEntries.entries().next().value;
583
+ if (firstGroup) {
584
+ const [baseDir, entries] = firstGroup;
585
+ return createPatcherForBase(baseDir, entries, patcherOptions);
586
+ }
587
+ }
588
+ return createPatcherForBase(resolvedTailwindcssBasedir, normalizedCssEntries ?? rawCssEntries, patcherOptions);
589
+ }
590
+ //#endregion
591
+ export { applyV4CssCalcDefaults as a, upsertTailwindV4CssSource as c, resolveUniAppXOptions as i, resolveTailwindcssBasedir as n, warnMissingCssEntries as o, isUniAppXEnabled as r, hasConfiguredTailwindV4CssRoots as s, createTailwindcssPatcherFromContext as t };
@@ -1,5 +1,3 @@
1
1
  export type { WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, WeappTailwindcssPostcssPluginOptions, } from './index';
2
- export type { DisabledOptions } from './types/disabled-options';
3
2
  export type { UserDefinedOptions } from './types/user-defined-options';
4
3
  export type { ApplyOptions, CacheOptions, ExtractOptions, TailwindCssOptions, TailwindCssPatchOptions, TailwindV2Options, TailwindV3Options, TailwindV4Options, } from 'tailwindcss-patch';
5
- export type TailwindcssPatchOptions = import('tailwindcss-patch').TailwindCssPatchOptions;