weapp-tailwindcss 4.12.0 → 5.0.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/README.md +4 -5
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/babel/index.d.ts +3 -0
  4. package/dist/bundle-state-BWqi5ZyX.mjs +343 -0
  5. package/dist/bundle-state-EUbcdKqo.js +410 -0
  6. package/dist/bundlers/gulp/index.d.ts +7 -0
  7. package/dist/bundlers/shared/cache.d.ts +16 -0
  8. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
  9. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
  10. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +4 -0
  11. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  12. package/dist/bundlers/shared/css-cleanup.d.ts +3 -0
  13. package/dist/bundlers/shared/css-imports.d.ts +8 -0
  14. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  15. package/dist/bundlers/shared/generator-css/directives.d.ts +13 -0
  16. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  17. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  18. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  19. package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
  20. package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
  21. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
  22. package/dist/bundlers/shared/generator-css.d.ts +33 -0
  23. package/dist/bundlers/shared/module-graph.d.ts +5 -0
  24. package/dist/bundlers/shared/run-tasks.d.ts +2 -0
  25. package/dist/bundlers/vite/bundle-entries.d.ts +14 -0
  26. package/dist/bundlers/vite/bundle-state.d.ts +43 -0
  27. package/dist/bundlers/vite/css-finalizer.d.ts +22 -0
  28. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  29. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
  30. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
  31. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  32. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  33. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  34. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  35. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  36. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  37. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  38. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  39. package/dist/bundlers/vite/generate-bundle.d.ts +34 -0
  40. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +21 -0
  41. package/dist/bundlers/vite/index.d.ts +3 -0
  42. package/dist/bundlers/vite/js-precheck.d.ts +1 -0
  43. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  44. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  45. package/dist/bundlers/vite/query.d.ts +15 -0
  46. package/dist/bundlers/vite/resolve-app-type.d.ts +2 -0
  47. package/dist/bundlers/vite/rewrite-css-imports.d.ts +13 -0
  48. package/dist/bundlers/vite/runtime-affecting-signature.d.ts +2 -0
  49. package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
  50. package/dist/bundlers/vite/source-candidates.d.ts +18 -0
  51. package/dist/bundlers/vite/source-scan.d.ts +8 -0
  52. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  53. package/dist/bundlers/vite/utils.d.ts +9 -0
  54. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +21 -0
  55. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +20 -0
  56. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +20 -0
  57. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +10 -0
  58. package/dist/bundlers/webpack/index.d.ts +1 -0
  59. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +14 -0
  60. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
  61. package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
  62. package/dist/cache/index.d.ts +38 -0
  63. package/dist/cache/md5.d.ts +1 -0
  64. package/dist/cache-BVAiJV3J.js +502 -0
  65. package/dist/cache-CHs4DXui.mjs +434 -0
  66. package/dist/chunk-8l464Juk.js +28 -0
  67. package/dist/cli/context.d.ts +13 -0
  68. package/dist/cli/doctor/constants.d.ts +7 -0
  69. package/dist/cli/doctor/types.d.ts +31 -0
  70. package/dist/cli/doctor.d.ts +4 -0
  71. package/dist/cli/helpers/options/format.d.ts +2 -0
  72. package/dist/cli/helpers/options/parse.d.ts +3 -0
  73. package/dist/cli/helpers/options/resolve.d.ts +1 -0
  74. package/dist/cli/helpers/options.d.ts +3 -0
  75. package/dist/cli/helpers.d.ts +4 -0
  76. package/dist/cli/mount-options.d.ts +4 -0
  77. package/dist/cli/types.d.ts +15 -0
  78. package/dist/cli/vscode-entry.d.ts +14 -0
  79. package/dist/cli.d.ts +1 -2
  80. package/dist/cli.js +1985 -3574
  81. package/dist/cli.mjs +1962 -3554
  82. package/dist/constants-BG12WAKw.mjs +44 -0
  83. package/dist/constants-BeeyfJ9k.js +73 -0
  84. package/dist/constants.d.ts +12 -0
  85. package/dist/context/compiler-context-cache.d.ts +3 -0
  86. package/dist/context/custom-attributes.d.ts +2 -0
  87. package/dist/context/handlers.d.ts +6 -0
  88. package/dist/context/index.d.ts +7 -0
  89. package/dist/context/logger.d.ts +4 -0
  90. package/dist/context/tailwindcss/basedir.d.ts +1 -0
  91. package/dist/context/tailwindcss/rax.d.ts +2 -0
  92. package/dist/context/tailwindcss.d.ts +4 -0
  93. package/dist/context/workspace.d.ts +3 -0
  94. package/dist/core.d.ts +5 -21
  95. package/dist/core.js +131 -180
  96. package/dist/core.mjs +129 -180
  97. package/dist/css-macro/constants.d.ts +14 -0
  98. package/dist/css-macro/index.d.ts +15 -0
  99. package/dist/css-macro/postcss.d.ts +3 -7
  100. package/dist/css-macro/postcss.js +44 -58
  101. package/dist/css-macro/postcss.mjs +44 -56
  102. package/dist/css-macro.d.ts +2 -20
  103. package/dist/css-macro.js +37 -50
  104. package/dist/css-macro.mjs +33 -47
  105. package/dist/debug/index.d.ts +5 -0
  106. package/dist/defaults.d.ts +16 -11
  107. package/dist/defaults.js +151 -8
  108. package/dist/defaults.mjs +143 -7
  109. package/dist/escape.js +31 -54
  110. package/dist/escape.mjs +18 -25
  111. package/dist/generator/index.d.ts +11 -0
  112. package/dist/generator/options.d.ts +16 -0
  113. package/dist/generator/types.d.ts +20 -0
  114. package/dist/generator-DKkhJbOg.js +1531 -0
  115. package/dist/generator-UBmfduYg.mjs +1432 -0
  116. package/dist/generator.d.ts +1 -0
  117. package/dist/generator.js +19 -0
  118. package/dist/generator.mjs +2 -0
  119. package/dist/gulp.d.ts +4 -24
  120. package/dist/gulp.js +370 -13
  121. package/dist/gulp.mjs +362 -13
  122. package/dist/incremental-runtime-class-set-BYmzQ-_f.js +1555 -0
  123. package/dist/incremental-runtime-class-set-BgMW6wf2.mjs +1510 -0
  124. package/dist/index.d.ts +8 -15
  125. package/dist/index.js +12 -24
  126. package/dist/index.mjs +6 -24
  127. package/dist/js/JsTokenUpdater.d.ts +14 -0
  128. package/dist/js/ModuleGraph.d.ts +18 -0
  129. package/dist/js/NodePathWalker.d.ts +33 -0
  130. package/dist/js/babel/parse.d.ts +9 -0
  131. package/dist/js/babel/process.d.ts +4 -0
  132. package/dist/js/babel.d.ts +13 -0
  133. package/dist/js/class-context.d.ts +3 -0
  134. package/dist/js/evalTransforms.d.ts +7 -0
  135. package/dist/js/handlers.d.ts +5 -0
  136. package/dist/js/index.d.ts +5 -0
  137. package/dist/js/literal-transform.d.ts +2 -0
  138. package/dist/js/module-graph/ignored-exports.d.ts +18 -0
  139. package/dist/js/module-graph/types.d.ts +17 -0
  140. package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
  141. package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
  142. package/dist/js/precheck.d.ts +2 -0
  143. package/dist/js/sourceAnalysis.d.ts +17 -0
  144. package/dist/js/taggedTemplateIgnore.d.ts +13 -0
  145. package/dist/js/types.d.ts +11 -0
  146. package/dist/lightningcss/index.d.ts +8 -0
  147. package/dist/lightningcss/style-handler/options.d.ts +3 -0
  148. package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
  149. package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
  150. package/dist/lightningcss/style-handler.d.ts +17 -0
  151. package/dist/logger/index.d.ts +2 -0
  152. package/dist/logger-CZUxvJJD.mjs +2 -0
  153. package/dist/logger-EVNB9z7i.js +1 -0
  154. package/dist/postcss/config-directive.d.ts +1 -0
  155. package/dist/postcss/context.d.ts +9 -0
  156. package/dist/postcss/source-files.d.ts +8 -0
  157. package/dist/postcss/tailwind-version.d.ts +3 -0
  158. package/dist/postcss-C7efq3hr.mjs +231 -0
  159. package/dist/postcss-Dg-_lyHS.js +240 -0
  160. package/dist/postcss-html-transform.d.ts +3 -3
  161. package/dist/postcss-html-transform.js +7 -10
  162. package/dist/postcss-html-transform.mjs +3 -6
  163. package/dist/postcss.d.ts +15 -0
  164. package/dist/postcss.js +7 -0
  165. package/dist/postcss.mjs +2 -0
  166. package/dist/precheck-B32p-gLI.js +2736 -0
  167. package/dist/precheck-B4RH6ZNN.mjs +2622 -0
  168. package/dist/presets/hbuilderx.d.ts +4 -0
  169. package/dist/presets/index.d.ts +3 -0
  170. package/dist/presets/shared.d.ts +10 -0
  171. package/dist/presets/taro.d.ts +4 -0
  172. package/dist/presets/uni-app-x.d.ts +16 -0
  173. package/dist/presets/uni-app.d.ts +4 -0
  174. package/dist/presets.d.ts +1 -76
  175. package/dist/presets.js +117 -163
  176. package/dist/presets.mjs +109 -163
  177. package/dist/reset/index.d.ts +2 -0
  178. package/dist/reset.d.ts +2 -4
  179. package/dist/reset.js +19 -8
  180. package/dist/reset.mjs +2 -8
  181. package/dist/runtime-patch-CwN5ya72.mjs +71 -0
  182. package/dist/runtime-patch-D6mBo_KB.js +85 -0
  183. package/dist/shared/classname-transform.d.ts +14 -0
  184. package/dist/shared/mpx.d.ts +7 -0
  185. package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
  186. package/dist/source-scan-BaYvNx-k.js +293 -0
  187. package/dist/source-scan-cGZxoJqP.mjs +254 -0
  188. package/dist/tailwindcss/index.d.ts +11 -0
  189. package/dist/tailwindcss/miniprogram.d.ts +5 -0
  190. package/dist/tailwindcss/patcher-options.d.ts +8 -0
  191. package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
  192. package/dist/tailwindcss/patcher.d.ts +12 -0
  193. package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
  194. package/dist/tailwindcss/runtime/cache.d.ts +11 -0
  195. package/dist/tailwindcss/runtime-logs.d.ts +3 -0
  196. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  197. package/dist/tailwindcss/runtime.d.ts +28 -0
  198. package/dist/tailwindcss/source-scan.d.ts +25 -0
  199. package/dist/tailwindcss/targets.d.ts +2 -0
  200. package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
  201. package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
  202. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
  203. package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
  204. package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
  205. package/dist/tailwindcss/v4/config.d.ts +5 -0
  206. package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
  207. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  208. package/dist/tailwindcss/v4/index.d.ts +2 -0
  209. package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
  210. package/dist/tailwindcss/v4/patcher-options.d.ts +2 -0
  211. package/dist/tailwindcss/v4/patcher.d.ts +15 -0
  212. package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
  213. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
  214. package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
  215. package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
  216. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +5 -0
  217. package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
  218. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
  219. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
  220. package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
  221. package/dist/tailwindcss/v4-engine/types.d.ts +19 -0
  222. package/dist/tailwindcss/version.d.ts +4 -0
  223. package/dist/tailwindcss-Bu-RWIHx.js +630 -0
  224. package/dist/tailwindcss-C5IgPlQ0.mjs +579 -0
  225. package/dist/typedoc.export.d.ts +3 -0
  226. package/dist/types/base.d.ts +1 -0
  227. package/dist/types/index.d.ts +97 -0
  228. package/dist/types/shared.d.ts +10 -0
  229. package/dist/types/user-defined-options/general.d.ts +29 -0
  230. package/dist/types/user-defined-options/important.d.ts +37 -0
  231. package/dist/types/user-defined-options/index.d.ts +11 -0
  232. package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
  233. package/dist/types/user-defined-options/matcher.d.ts +9 -0
  234. package/dist/types.d.ts +1 -150
  235. package/dist/types.js +0 -1
  236. package/dist/types.mjs +1 -1
  237. package/dist/uni-app-x/component-local-style.d.ts +19 -0
  238. package/dist/uni-app-x/index.d.ts +2 -0
  239. package/dist/uni-app-x/options.d.ts +12 -0
  240. package/dist/uni-app-x/style-isolation.d.ts +2 -0
  241. package/dist/uni-app-x/transform.d.ts +9 -0
  242. package/dist/uni-app-x/vite.d.ts +36 -0
  243. package/dist/utils/decode.d.ts +2 -0
  244. package/dist/utils/disabled.d.ts +5 -0
  245. package/dist/utils/hbuilderx.d.ts +5 -0
  246. package/dist/utils/index.d.ts +7 -0
  247. package/dist/utils/nameMatcher.d.ts +4 -0
  248. package/dist/utils/resolve-package.d.ts +1 -0
  249. package/dist/utils/uni-platform.d.ts +11 -0
  250. package/dist/utils-BiShvil9.js +61 -0
  251. package/dist/utils-Btw1iOVV.mjs +48 -0
  252. package/dist/vite-BU74SkOi.mjs +2246 -0
  253. package/dist/vite-CKjx_5c3.js +2261 -0
  254. package/dist/vite.d.ts +3 -17
  255. package/dist/vite.js +4 -14
  256. package/dist/vite.mjs +2 -14
  257. package/dist/weapp-tw-css-import-rewrite-loader.js +68 -92
  258. package/dist/weapp-tw-runtime-classset-loader.js +31 -50
  259. package/dist/webpack-CAk_ITq7.mjs +713 -0
  260. package/dist/webpack-damWiYqY.js +723 -0
  261. package/dist/webpack.d.ts +4 -25
  262. package/dist/webpack.js +6 -17
  263. package/dist/webpack.mjs +2 -17
  264. package/dist/wxml/Tokenizer.d.ts +15 -0
  265. package/dist/wxml/custom-attributes.d.ts +4 -0
  266. package/dist/wxml/index.d.ts +2 -0
  267. package/dist/wxml/shared.d.ts +2 -0
  268. package/dist/wxml/tokenizer/types.d.ts +18 -0
  269. package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
  270. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
  271. package/dist/wxml/utils/codegen.d.ts +2 -0
  272. package/dist/wxml/utils/custom-template.d.ts +3 -0
  273. package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
  274. package/dist/wxml/utils/fragment-updater.d.ts +4 -0
  275. package/dist/wxml/utils/template-fragments.d.ts +3 -0
  276. package/dist/wxml/utils.d.ts +8 -0
  277. package/dist/wxml/whitespace.d.ts +2 -0
  278. package/generator-placeholder.css +1 -0
  279. package/package.json +39 -38
  280. package/dist/chunk-24AGZQVR.js +0 -183
  281. package/dist/chunk-3VQKDHGP.mjs +0 -179
  282. package/dist/chunk-4AFQP74Z.js +0 -24
  283. package/dist/chunk-57SOQCAU.mjs +0 -582
  284. package/dist/chunk-5ZYHNDEK.mjs +0 -2439
  285. package/dist/chunk-76S2EME4.mjs +0 -34
  286. package/dist/chunk-A5PB4KZT.js +0 -138
  287. package/dist/chunk-DUHYLR2R.js +0 -276
  288. package/dist/chunk-DYLQ6UOI.js +0 -71
  289. package/dist/chunk-E7I5TW5K.js +0 -52
  290. package/dist/chunk-FS2NOOEB.js +0 -292
  291. package/dist/chunk-HVNGIKLS.js +0 -3930
  292. package/dist/chunk-JZQBZHN5.js +0 -579
  293. package/dist/chunk-KGTVD4EP.mjs +0 -3930
  294. package/dist/chunk-NNOQDMUP.mjs +0 -10
  295. package/dist/chunk-OF6MFURR.js +0 -34
  296. package/dist/chunk-OFB2KBRP.js +0 -2442
  297. package/dist/chunk-OOHJLO5M.mjs +0 -71
  298. package/dist/chunk-PCDYXXSK.mjs +0 -1515
  299. package/dist/chunk-RKISS72P.js +0 -7
  300. package/dist/chunk-RRQZL7FQ.mjs +0 -292
  301. package/dist/chunk-XAKAD2CR.mjs +0 -138
  302. package/dist/chunk-XZP3MREK.mjs +0 -276
  303. package/dist/chunk-ZAA5ZG3D.js +0 -1518
  304. package/dist/chunk-ZCH4YINE.mjs +0 -52
  305. package/dist/cli.d.mts +0 -2
  306. package/dist/core.d.mts +0 -26
  307. package/dist/css-macro/postcss.d.mts +0 -7
  308. package/dist/css-macro.d.mts +0 -18
  309. package/dist/defaults.d.mts +0 -11
  310. package/dist/gulp.d.mts +0 -24
  311. package/dist/index-BXrmQelt.d.mts +0 -672
  312. package/dist/index-BXrmQelt.d.ts +0 -672
  313. package/dist/index.d.mts +0 -15
  314. package/dist/postcss-html-transform.d.mts +0 -2
  315. package/dist/presets.d.mts +0 -76
  316. package/dist/reset.d.mts +0 -1
  317. package/dist/types.d.mts +0 -150
  318. package/dist/vite.d.mts +0 -17
  319. package/dist/webpack.d.mts +0 -25
  320. package/dist/webpack4.d.mts +0 -26
  321. package/dist/webpack4.d.ts +0 -26
  322. package/dist/webpack4.js +0 -493
  323. package/dist/webpack4.mjs +0 -495
  324. package/scripts/postinstall.mjs +0 -59
@@ -0,0 +1,630 @@
1
+ const require_chunk = require("./chunk-8l464Juk.js");
2
+ const require_cache = require("./cache-BVAiJV3J.js");
3
+ require("./utils-BiShvil9.js");
4
+ let node_module = require("node:module");
5
+ let node_path = require("node:path");
6
+ node_path = require_chunk.__toESM(node_path);
7
+ let node_process = require("node:process");
8
+ node_process = require_chunk.__toESM(node_process);
9
+ let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
10
+ let node_fs = require("node:fs");
11
+ let node_url = require("node:url");
12
+ let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
13
+ //#region src/tailwindcss/v4/css-sources.ts
14
+ function hasCssEntriesValue(value) {
15
+ if (typeof value === "string") return value.trim().length > 0;
16
+ return Array.isArray(value) && value.some((entry) => typeof entry === "string" && entry.trim().length > 0);
17
+ }
18
+ function hasCssSourcesValue(value) {
19
+ return Array.isArray(value) && value.some((source) => {
20
+ return typeof source === "object" && source !== null && typeof source.css === "string" && source.css.trim().length > 0;
21
+ });
22
+ }
23
+ function hasConfiguredTailwindV4CssRoots(options) {
24
+ 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);
25
+ }
26
+ function normalizeCssSourceFile(file) {
27
+ if (!file) return;
28
+ return node_path.default.isAbsolute(file) ? node_path.default.normalize(file) : file;
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 && a.base === 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 = {
38
+ ...source,
39
+ ...source.file === void 0 ? {} : { file: normalizeCssSourceFile(source.file) },
40
+ ...source.dependencies === void 0 ? {} : { dependencies: normalizeDependencies(source.dependencies) }
41
+ };
42
+ const tailwindcss = opts.tailwindcss ?? {};
43
+ const v4 = tailwindcss.v4 ?? {};
44
+ const cssSources = [...v4.cssSources ?? []];
45
+ const sourceFile = normalizeCssSourceFile(normalizedSource.file);
46
+ const existingIndex = cssSources.findIndex((candidate) => normalizeCssSourceFile(candidate.file) === sourceFile);
47
+ if (existingIndex >= 0) {
48
+ const existing = cssSources[existingIndex];
49
+ const nextSource = {
50
+ ...existing,
51
+ ...normalizedSource
52
+ };
53
+ if (isSameCssSource(existing, nextSource)) return false;
54
+ cssSources[existingIndex] = nextSource;
55
+ } else cssSources.push(normalizedSource);
56
+ opts.tailwindcss = {
57
+ ...tailwindcss,
58
+ v4: {
59
+ ...v4,
60
+ cssSources
61
+ }
62
+ };
63
+ return true;
64
+ }
65
+ //#endregion
66
+ //#region src/tailwindcss/v4/config.ts
67
+ const DEFAULT_CSS_CALC_CUSTOM_PROPERTIES = [];
68
+ function includesToken(list, token) {
69
+ return list.some((candidate) => {
70
+ if (typeof token === "string") {
71
+ if (typeof candidate === "string") return candidate === token;
72
+ candidate.lastIndex = 0;
73
+ return candidate.test(token);
74
+ }
75
+ if (typeof candidate === "string") {
76
+ token.lastIndex = 0;
77
+ return token.test(candidate);
78
+ }
79
+ return candidate.source === token.source && candidate.flags === token.flags;
80
+ });
81
+ }
82
+ function ensureDefaultsIncluded(value) {
83
+ if (value === true) return { includeCustomProperties: [...DEFAULT_CSS_CALC_CUSTOM_PROPERTIES] };
84
+ if (Array.isArray(value)) {
85
+ if (!DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.length) return value;
86
+ const missing = DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.filter((token) => !includesToken(value, token));
87
+ return missing.length > 0 ? [...value, ...missing] : value;
88
+ }
89
+ if (value && typeof value === "object") {
90
+ const include = value.includeCustomProperties;
91
+ if (!Array.isArray(include)) return {
92
+ ...value,
93
+ includeCustomProperties: [...DEFAULT_CSS_CALC_CUSTOM_PROPERTIES]
94
+ };
95
+ if (!DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.length) return value;
96
+ const missing = DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.filter((token) => !includesToken(include, token));
97
+ return missing.length > 0 ? {
98
+ ...value,
99
+ includeCustomProperties: [...include, ...missing]
100
+ } : value;
101
+ }
102
+ return value;
103
+ }
104
+ function normalizeCssEntriesConfig(entries) {
105
+ if (!entries) return;
106
+ if (typeof entries === "string") {
107
+ const trimmed = entries.trim();
108
+ return trimmed ? [trimmed] : void 0;
109
+ }
110
+ if (!Array.isArray(entries)) return;
111
+ const normalized = entries.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
112
+ return normalized.length > 0 ? normalized : void 0;
113
+ }
114
+ function hasConfiguredCssEntries(ctx) {
115
+ if (normalizeCssEntriesConfig(ctx.cssEntries)) return true;
116
+ if (normalizeCssEntriesConfig(ctx.tailwindcss?.v4?.cssEntries)) return true;
117
+ const patcherOptions = ctx.tailwindcssPatcherOptions;
118
+ if (patcherOptions) {
119
+ if (normalizeCssEntriesConfig(patcherOptions.tailwindcss?.v4?.cssEntries)) return true;
120
+ }
121
+ return false;
122
+ }
123
+ let hasWarnedMissingCssEntries = false;
124
+ function warnMissingCssEntries(ctx, patcher) {
125
+ if (hasWarnedMissingCssEntries) return;
126
+ if (patcher?.majorVersion !== 4) return;
127
+ if (hasConfiguredCssEntries(ctx) || hasConfiguredTailwindV4CssRoots(ctx)) return;
128
+ hasWarnedMissingCssEntries = true;
129
+ _weapp_tailwindcss_logger.logger.warn("[tailwindcss@4] 未检测到 cssEntries 配置。请传入包含 tailwindcss 引用的 CSS 绝对路径,例如 cssEntries: [\"/absolute/path/to/src/app.css\"],否则 tailwindcss 生成的类名不会参与转译。");
130
+ }
131
+ function applyV4CssCalcDefaults(cssCalc, patcher) {
132
+ const cssCalcOptions = cssCalc ?? patcher?.majorVersion === 4;
133
+ if (patcher?.majorVersion === 4 && cssCalcOptions) return ensureDefaultsIncluded(cssCalcOptions);
134
+ return cssCalcOptions;
135
+ }
136
+ //#endregion
137
+ //#region src/tailwindcss/v4/multi-patcher.ts
138
+ function createMultiTailwindcssPatcher(patchers) {
139
+ if (patchers.length <= 1) return patchers[0];
140
+ const first = patchers[0];
141
+ const firstWithoutPatch = { ...first };
142
+ delete firstWithoutPatch.patch;
143
+ const multiPatcher = {
144
+ ...firstWithoutPatch,
145
+ packageInfo: first?.packageInfo,
146
+ majorVersion: first?.majorVersion,
147
+ options: first?.options,
148
+ async getClassSet() {
149
+ const aggregated = /* @__PURE__ */ new Set();
150
+ for (const patcher of patchers) {
151
+ const current = await patcher.getClassSet();
152
+ for (const className of current) aggregated.add(className);
153
+ }
154
+ return aggregated;
155
+ },
156
+ async extract(options) {
157
+ const aggregatedSet = /* @__PURE__ */ new Set();
158
+ const aggregatedList = [];
159
+ let filename;
160
+ for (const patcher of patchers) {
161
+ const result = await patcher.extract(options);
162
+ if (!result) continue;
163
+ if (filename === void 0 && result.filename) filename = result.filename;
164
+ if (result.classList) for (const className of result.classList) {
165
+ if (!aggregatedSet.has(className)) aggregatedList.push(className);
166
+ aggregatedSet.add(className);
167
+ }
168
+ if (result.classSet) for (const className of result.classSet) aggregatedSet.add(className);
169
+ }
170
+ return {
171
+ classList: aggregatedList,
172
+ classSet: aggregatedSet,
173
+ filename
174
+ };
175
+ }
176
+ };
177
+ if (patchers.every((patcher) => typeof patcher.getClassSetSync === "function")) multiPatcher.getClassSetSync = () => {
178
+ const aggregated = /* @__PURE__ */ new Set();
179
+ for (const patcher of patchers) {
180
+ const current = patcher.getClassSetSync?.();
181
+ if (!current) continue;
182
+ for (const className of current) aggregated.add(className);
183
+ }
184
+ return aggregated;
185
+ };
186
+ Object.defineProperty(multiPatcher, require_cache.runtimeSignaturePatchersSymbol, {
187
+ value: [...patchers],
188
+ configurable: true
189
+ });
190
+ return multiPatcher;
191
+ }
192
+ //#endregion
193
+ //#region src/tailwindcss/v4/patcher-options.ts
194
+ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries) {
195
+ const hasCssEntries = cssEntries.length > 0;
196
+ if (!options) return options;
197
+ const modernTailwind = options.tailwindcss;
198
+ if (!modernTailwind) return options;
199
+ return {
200
+ ...options,
201
+ tailwindcss: {
202
+ ...modernTailwind,
203
+ v4: {
204
+ ...modernTailwind.v4 ?? {},
205
+ ...hasCssEntries ? {} : { base: modernTailwind.v4?.base ?? baseDir },
206
+ cssEntries: hasCssEntries ? cssEntries : modernTailwind.v4?.cssEntries ?? cssEntries
207
+ }
208
+ }
209
+ };
210
+ }
211
+ //#endregion
212
+ //#region src/tailwindcss/v4/css-entries.ts
213
+ function guessBasedirFromEntries(entries) {
214
+ if (!entries) return;
215
+ for (const entry of entries) {
216
+ if (typeof entry !== "string") continue;
217
+ const trimmed = entry.trim();
218
+ if (!trimmed || !node_path.default.isAbsolute(trimmed)) continue;
219
+ const entryDir = node_path.default.dirname(trimmed);
220
+ const resolved = require_cache.findNearestPackageRoot(entryDir) ?? entryDir;
221
+ if (resolved) return resolved;
222
+ }
223
+ }
224
+ function normalizeCssEntries(entries, anchor) {
225
+ if (!entries || entries.length === 0) return;
226
+ const normalized = /* @__PURE__ */ new Set();
227
+ for (const entry of entries) {
228
+ if (typeof entry !== "string") continue;
229
+ const trimmed = entry.trim();
230
+ if (trimmed.length === 0) continue;
231
+ const resolved = node_path.default.isAbsolute(trimmed) ? node_path.default.normalize(trimmed) : node_path.default.normalize(node_path.default.resolve(anchor, trimmed));
232
+ normalized.add(resolved);
233
+ }
234
+ return normalized.size > 0 ? [...normalized] : void 0;
235
+ }
236
+ function isSubPath(parent, child) {
237
+ if (!parent || !child) return false;
238
+ const relative = node_path.default.relative(parent, child);
239
+ return relative === "" || !relative.startsWith("..") && !node_path.default.isAbsolute(relative);
240
+ }
241
+ function resolveCssEntryBase(entryDir, options) {
242
+ const normalizedDir = node_path.default.normalize(entryDir);
243
+ const { preferredBaseDir, workspaceRoot } = options;
244
+ if (preferredBaseDir && isSubPath(preferredBaseDir, normalizedDir)) return preferredBaseDir;
245
+ if (workspaceRoot && isSubPath(workspaceRoot, normalizedDir)) return workspaceRoot;
246
+ const packageRoot = require_cache.findNearestPackageRoot(normalizedDir);
247
+ if (packageRoot) return node_path.default.normalize(packageRoot);
248
+ return normalizedDir;
249
+ }
250
+ function groupCssEntriesByBase(entries, options = {}) {
251
+ const normalizedOptions = {
252
+ preferredBaseDir: options.preferredBaseDir ? node_path.default.normalize(options.preferredBaseDir) : void 0,
253
+ workspaceRoot: options.workspaceRoot ? node_path.default.normalize(options.workspaceRoot) : void 0
254
+ };
255
+ const groups = /* @__PURE__ */ new Map();
256
+ for (const entry of entries) {
257
+ const baseDir = resolveCssEntryBase(node_path.default.dirname(entry), normalizedOptions);
258
+ const bucket = groups.get(baseDir);
259
+ if (bucket) bucket.push(entry);
260
+ else groups.set(baseDir, [entry]);
261
+ }
262
+ return groups;
263
+ }
264
+ //#endregion
265
+ //#region src/tailwindcss/v4/patcher.ts
266
+ const CONFIGURED_TAILWIND_VERSION_RE = /Configured tailwindcss\.version=\d+/u;
267
+ const RESOLVED_TAILWIND_VERSION_RE = /resolved package ".+" is version /u;
268
+ function isTailwindcss4Package(packageName) {
269
+ return Boolean(packageName && (packageName === "tailwindcss4" || packageName === "@tailwindcss/postcss" || packageName.includes("tailwindcss4")));
270
+ }
271
+ function resolveExplicitTailwindVersion(configuredVersion, configuredPackageName) {
272
+ if (typeof configuredVersion === "number") return configuredVersion;
273
+ if (configuredPackageName === "tailwindcss") return 3;
274
+ if (isTailwindcss4Package(configuredPackageName)) return 4;
275
+ }
276
+ function hasOwnV4Signal(value) {
277
+ return typeof value === "object" && value !== null && "v4" in value;
278
+ }
279
+ function isTailwindVersionMismatchError(error) {
280
+ return error instanceof Error && CONFIGURED_TAILWIND_VERSION_RE.test(error.message) && RESOLVED_TAILWIND_VERSION_RE.test(error.message);
281
+ }
282
+ function createPatcherForBase(baseDir, cssEntries, options) {
283
+ const { tailwindcss, tailwindcssPatcherOptions, supportCustomLengthUnitsPatch, bareArbitraryValues } = options;
284
+ const hasCssEntries = Boolean(cssEntries?.length);
285
+ const mergedTailwindOptions = (0, _weapp_tailwindcss_shared.defuOverrideArray)(tailwindcss ?? {}, {
286
+ cwd: baseDir,
287
+ v2: { cwd: baseDir },
288
+ v3: { cwd: baseDir },
289
+ v4: hasCssEntries ? { cssEntries } : {
290
+ base: baseDir,
291
+ cssEntries
292
+ }
293
+ });
294
+ if (!mergedTailwindOptions.v4) mergedTailwindOptions.v4 = hasCssEntries ? { cssEntries: cssEntries ?? [] } : {
295
+ base: baseDir,
296
+ cssEntries: cssEntries ?? []
297
+ };
298
+ else {
299
+ if (!hasCssEntries && !mergedTailwindOptions.v4.base) mergedTailwindOptions.v4.base = baseDir;
300
+ if (hasCssEntries) {
301
+ if (cssEntries?.length) mergedTailwindOptions.v4.cssEntries = cssEntries;
302
+ else if (!mergedTailwindOptions.v4.cssEntries) mergedTailwindOptions.v4.cssEntries = [];
303
+ } else if (!mergedTailwindOptions.v4.cssEntries) mergedTailwindOptions.v4.cssEntries = cssEntries ?? [];
304
+ }
305
+ if (bareArbitraryValues !== void 0 && bareArbitraryValues !== false) mergedTailwindOptions.v4.bareArbitraryValues = bareArbitraryValues;
306
+ const patchedOptions = overrideTailwindcssPatcherOptionsForBase(tailwindcssPatcherOptions, baseDir, cssEntries ?? []);
307
+ const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwindcss?.packageName;
308
+ const explicitTailwindVersion = resolveExplicitTailwindVersion(tailwindcss?.version || tailwindcssPatcherOptions?.tailwindcss?.version || mergedTailwindOptions.version, configuredPackageName);
309
+ const hasExplicitV4Signals = hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
310
+ const packageNameForVersionDetection = configuredPackageName ?? mergedTailwindOptions.packageName ?? "tailwindcss";
311
+ const installedTailwindVersion = require_cache.readInstalledPackageMajorVersion(packageNameForVersionDetection, baseDir);
312
+ const resolvedTailwindVersion = installedTailwindVersion ?? explicitTailwindVersion;
313
+ const shouldPatchV4PostcssPackage = (resolvedTailwindVersion === 4 && (installedTailwindVersion === 4 || explicitTailwindVersion === 4 || hasExplicitV4Signals && isTailwindcss4Package(packageNameForVersionDetection)) || resolvedTailwindVersion === void 0 && (hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss))) && !Boolean(configuredPackageName);
314
+ const packageCandidates = /* @__PURE__ */ new Set();
315
+ if (shouldPatchV4PostcssPackage) packageCandidates.add("@tailwindcss/postcss");
316
+ packageCandidates.add(mergedTailwindOptions.packageName ?? configuredPackageName ?? "tailwindcss");
317
+ const patchers = [];
318
+ const packageCandidateList = [...packageCandidates];
319
+ let firstVersionMismatchError;
320
+ for (const packageName of packageCandidateList) {
321
+ const tailwindOptionsForPackage = {
322
+ ...mergedTailwindOptions,
323
+ packageName
324
+ };
325
+ if (resolvedTailwindVersion) tailwindOptionsForPackage.version = resolvedTailwindVersion;
326
+ try {
327
+ patchers.push(require_cache.createTailwindcssPatcher({
328
+ basedir: baseDir,
329
+ supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch ?? true,
330
+ tailwindcss: tailwindOptionsForPackage,
331
+ tailwindcssPatcherOptions: patchedOptions
332
+ }));
333
+ } catch (error) {
334
+ if (packageCandidateList.length > 1 && isTailwindVersionMismatchError(error)) {
335
+ firstVersionMismatchError ?? (firstVersionMismatchError = error);
336
+ _weapp_tailwindcss_logger.logger.warn("skip incompatible Tailwind package candidate \"%s\" for v4 patcher: %s", packageName, error.message);
337
+ continue;
338
+ }
339
+ throw error;
340
+ }
341
+ }
342
+ if (patchers.length === 0 && firstVersionMismatchError) throw firstVersionMismatchError;
343
+ return patchers.length === 1 ? patchers[0] : createMultiTailwindcssPatcher(patchers);
344
+ }
345
+ function tryCreateMultiTailwindcssPatcher(groups, options) {
346
+ if (groups.size <= 1) return;
347
+ _weapp_tailwindcss_logger.logger.debug("detected multiple Tailwind CSS entry bases: %O", [...groups.keys()]);
348
+ const patchers = [];
349
+ for (const [baseDir, entries] of groups) patchers.push(createPatcherForBase(baseDir, entries, options));
350
+ return createMultiTailwindcssPatcher(patchers);
351
+ }
352
+ //#endregion
353
+ //#region src/uni-app-x/options.ts
354
+ function resolveComponentLocalStyles(option) {
355
+ if (option === false) return {
356
+ enabled: false,
357
+ onlyWhenStyleIsolationVersion2: true
358
+ };
359
+ if (option === true || option === void 0) return {
360
+ enabled: false,
361
+ onlyWhenStyleIsolationVersion2: true
362
+ };
363
+ const componentLocalStyles = option.componentLocalStyles;
364
+ if (componentLocalStyles === false) return {
365
+ enabled: false,
366
+ onlyWhenStyleIsolationVersion2: true
367
+ };
368
+ if (componentLocalStyles === true || componentLocalStyles === void 0) return {
369
+ enabled: true,
370
+ onlyWhenStyleIsolationVersion2: true
371
+ };
372
+ return {
373
+ enabled: componentLocalStyles.enabled !== false,
374
+ onlyWhenStyleIsolationVersion2: componentLocalStyles.onlyWhenStyleIsolationVersion2 !== false
375
+ };
376
+ }
377
+ function resolveUniAppXOptions(option) {
378
+ if (typeof option === "object" && option) return {
379
+ enabled: option.enabled !== false,
380
+ componentLocalStyles: resolveComponentLocalStyles(option),
381
+ uvueUnsupported: option.uvueUnsupported ?? "warn"
382
+ };
383
+ return {
384
+ enabled: Boolean(option),
385
+ componentLocalStyles: resolveComponentLocalStyles(option),
386
+ uvueUnsupported: "warn"
387
+ };
388
+ }
389
+ function isUniAppXEnabled(option) {
390
+ return resolveUniAppXOptions(option).enabled;
391
+ }
392
+ //#endregion
393
+ //#region src/context/tailwindcss/basedir.ts
394
+ const ENV_BASEDIR_KEYS = [
395
+ "WEAPP_TAILWINDCSS_BASEDIR",
396
+ "WEAPP_TAILWINDCSS_BASE_DIR",
397
+ "TAILWINDCSS_BASEDIR",
398
+ "TAILWINDCSS_BASE_DIR",
399
+ "UNI_INPUT_DIR",
400
+ "UNI_INPUT_ROOT",
401
+ "UNI_CLI_ROOT",
402
+ "UNI_APP_INPUT_DIR",
403
+ "INIT_CWD",
404
+ "PWD"
405
+ ];
406
+ const GENERIC_ENV_BASEDIR_KEYS = new Set(["INIT_CWD", "PWD"]);
407
+ function pickEnvBasedir() {
408
+ for (const key of ENV_BASEDIR_KEYS) {
409
+ const value = node_process.default.env[key];
410
+ if (value && node_path.default.isAbsolute(value)) return {
411
+ key,
412
+ value
413
+ };
414
+ }
415
+ }
416
+ function pickPackageEnvBasedir() {
417
+ const packageJsonPath = node_process.default.env.npm_package_json;
418
+ if (packageJsonPath) {
419
+ const packageDir = node_path.default.dirname(packageJsonPath);
420
+ if (packageDir && node_path.default.isAbsolute(packageDir)) return packageDir;
421
+ }
422
+ const localPrefix = node_process.default.env.npm_config_local_prefix;
423
+ if (localPrefix && node_path.default.isAbsolute(localPrefix)) return localPrefix;
424
+ }
425
+ const STACK_PAREN_RE = /\(([^)]+)\)/u;
426
+ const STACK_AT_RE = /at\s+(\S.*)$/u;
427
+ function detectCallerBasedir() {
428
+ const stack = (/* @__PURE__ */ new Error("resolveTailwindcssBasedir stack probe")).stack;
429
+ if (!stack) return;
430
+ if (node_process.default.env.WEAPP_TW_DEBUG_STACK === "1") _weapp_tailwindcss_logger.logger.debug("caller stack: %s", stack);
431
+ const lines = stack.split("\n");
432
+ for (const line of lines) {
433
+ const location = (line.match(STACK_PAREN_RE) ?? line.match(STACK_AT_RE))?.[1];
434
+ if (!location) continue;
435
+ let filePath = location;
436
+ if (filePath.startsWith("file://")) try {
437
+ filePath = (0, node_url.fileURLToPath)(filePath);
438
+ } catch {
439
+ continue;
440
+ }
441
+ const [candidate] = filePath.split(":");
442
+ const resolvedPath = node_path.default.isAbsolute(filePath) ? filePath : candidate;
443
+ if (!node_path.default.isAbsolute(resolvedPath)) continue;
444
+ if (resolvedPath.includes("node_modules") && resolvedPath.includes("weapp-tailwindcss")) continue;
445
+ try {
446
+ return node_path.default.dirname(resolvedPath);
447
+ } catch {
448
+ continue;
449
+ }
450
+ }
451
+ }
452
+ function resolveTailwindcssBasedir(basedir, fallback) {
453
+ const envBasedirResult = pickEnvBasedir();
454
+ const envBasedir = envBasedirResult?.value;
455
+ const envBasedirKey = envBasedirResult?.key;
456
+ const envBasedirIsGeneric = envBasedirKey ? GENERIC_ENV_BASEDIR_KEYS.has(envBasedirKey) : false;
457
+ const packageEnvBasedir = pickPackageEnvBasedir();
458
+ const callerBasedir = !envBasedir || envBasedirIsGeneric ? detectCallerBasedir() : void 0;
459
+ const cwd = node_process.default.cwd();
460
+ const anchor = envBasedir ?? packageEnvBasedir ?? fallback ?? callerBasedir ?? cwd;
461
+ const resolveRelative = (value) => node_path.default.isAbsolute(value) ? node_path.default.normalize(value) : node_path.default.normalize(node_path.default.resolve(anchor, value));
462
+ if (node_process.default.env.WEAPP_TW_DEBUG_STACK === "1") _weapp_tailwindcss_logger.logger.debug("resolveTailwindcssBasedir anchor %O", {
463
+ basedir,
464
+ envBasedir,
465
+ envBasedirKey,
466
+ envBasedirIsGeneric,
467
+ packageEnvBasedir,
468
+ fallback,
469
+ callerBasedir,
470
+ npm_package_json: node_process.default.env.npm_package_json,
471
+ cwd,
472
+ anchor
473
+ });
474
+ if (basedir && basedir.trim().length > 0) return resolveRelative(basedir);
475
+ if (envBasedir && !envBasedirIsGeneric) return node_path.default.normalize(envBasedir);
476
+ if (fallback && fallback.trim().length > 0) return resolveRelative(fallback);
477
+ if (packageEnvBasedir) return node_path.default.normalize(packageEnvBasedir);
478
+ if (callerBasedir) {
479
+ const normalizedCaller = node_path.default.normalize(callerBasedir);
480
+ const librarySegment = `${node_path.default.sep}weapp-tailwindcss${node_path.default.sep}`;
481
+ if (!normalizedCaller.includes(librarySegment)) return normalizedCaller;
482
+ }
483
+ const packageName = node_process.default.env.PNPM_PACKAGE_NAME;
484
+ if (packageName) try {
485
+ const packageJsonPath = (0, node_module.createRequire)(node_path.default.join(anchor, "__resolve_tailwindcss_basedir__.cjs")).resolve(`${packageName}/package.json`);
486
+ if (node_process.default.env.WEAPP_TW_DEBUG_STACK === "1") _weapp_tailwindcss_logger.logger.debug("package basedir resolved from PNPM_PACKAGE_NAME: %s", packageJsonPath);
487
+ return node_path.default.normalize(node_path.default.dirname(packageJsonPath));
488
+ } catch {
489
+ if (node_process.default.env.WEAPP_TW_DEBUG_STACK === "1") _weapp_tailwindcss_logger.logger.debug("failed to resolve package json for %s", packageName);
490
+ const workspaceRoot = require_cache.findWorkspaceRoot(anchor);
491
+ if (workspaceRoot) {
492
+ const packageDir = require_cache.findWorkspacePackageDir(workspaceRoot, packageName);
493
+ if (packageDir) return packageDir;
494
+ }
495
+ }
496
+ if (envBasedir) return node_path.default.normalize(envBasedir);
497
+ return node_path.default.normalize(cwd);
498
+ }
499
+ //#endregion
500
+ //#region src/context/tailwindcss/rax.ts
501
+ function isRaxWorkspace(appType, baseDir) {
502
+ if (appType === "rax") return true;
503
+ try {
504
+ const pkgPath = node_path.default.join(baseDir, "package.json");
505
+ if (!(0, node_fs.existsSync)(pkgPath)) return false;
506
+ const pkg = JSON.parse((0, node_fs.readFileSync)(pkgPath, "utf8"));
507
+ const deps = {
508
+ ...pkg.dependencies ?? {},
509
+ ...pkg.devDependencies ?? {}
510
+ };
511
+ if (deps["rax-app"] || deps.rax) return true;
512
+ } catch {
513
+ return false;
514
+ }
515
+ return false;
516
+ }
517
+ function collectRaxStyleEntries(baseDir) {
518
+ const STYLE_CANDIDATES = [
519
+ "src/global.css",
520
+ "src/global.scss",
521
+ "src/global.less",
522
+ "src/global.sass",
523
+ "src/global.styl",
524
+ "src/global.stylus"
525
+ ];
526
+ const discovered = [];
527
+ for (const relative of STYLE_CANDIDATES) {
528
+ const candidate = node_path.default.resolve(baseDir, relative);
529
+ if ((0, node_fs.existsSync)(candidate)) discovered.push(node_path.default.normalize(candidate));
530
+ }
531
+ return discovered;
532
+ }
533
+ function detectImplicitCssEntries(appType, baseDir) {
534
+ const baseCandidates = /* @__PURE__ */ new Set();
535
+ baseCandidates.add(node_path.default.normalize(baseDir));
536
+ const envCandidates = [
537
+ node_process.default.cwd(),
538
+ node_process.default.env.INIT_CWD,
539
+ node_process.default.env.PWD
540
+ ];
541
+ for (const candidate of envCandidates) if (candidate) baseCandidates.add(node_path.default.normalize(candidate));
542
+ for (const candidateBase of baseCandidates) {
543
+ if (!isRaxWorkspace(appType, candidateBase)) continue;
544
+ const entries = collectRaxStyleEntries(candidateBase);
545
+ if (entries.length) return entries;
546
+ }
547
+ }
548
+ //#endregion
549
+ //#region src/context/tailwindcss.ts
550
+ function createTailwindcssPatcherFromContext(ctx) {
551
+ const { tailwindcssBasedir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions, cssEntries: rawCssEntries, appType, arbitraryValues } = ctx;
552
+ const absoluteCssEntryBasedir = guessBasedirFromEntries(rawCssEntries);
553
+ const resolvedTailwindcssBasedir = resolveTailwindcssBasedir(tailwindcssBasedir, absoluteCssEntryBasedir);
554
+ ctx.tailwindcssBasedir = resolvedTailwindcssBasedir;
555
+ _weapp_tailwindcss_logger.logger.debug("tailwindcss basedir resolved: %s", resolvedTailwindcssBasedir);
556
+ let normalizedCssEntries = normalizeCssEntries(rawCssEntries, resolvedTailwindcssBasedir);
557
+ if (!normalizedCssEntries) normalizedCssEntries = detectImplicitCssEntries(ctx.appType, resolvedTailwindcssBasedir);
558
+ if (normalizedCssEntries) ctx.cssEntries = normalizedCssEntries;
559
+ const patcherOptions = {
560
+ tailwindcss,
561
+ tailwindcssPatcherOptions,
562
+ supportCustomLengthUnitsPatch,
563
+ appType,
564
+ bareArbitraryValues: arbitraryValues?.bareArbitraryValues
565
+ };
566
+ const workspaceRoot = require_cache.findWorkspaceRoot(resolvedTailwindcssBasedir) ?? (absoluteCssEntryBasedir ? require_cache.findWorkspaceRoot(absoluteCssEntryBasedir) : void 0);
567
+ const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries, {
568
+ preferredBaseDir: resolvedTailwindcssBasedir,
569
+ workspaceRoot
570
+ }) : void 0;
571
+ const multiPatcher = groupedCssEntries ? tryCreateMultiTailwindcssPatcher(groupedCssEntries, patcherOptions) : void 0;
572
+ if (multiPatcher) return multiPatcher;
573
+ if (groupedCssEntries?.size === 1) {
574
+ const firstGroup = groupedCssEntries.entries().next().value;
575
+ if (firstGroup) {
576
+ const [baseDir, entries] = firstGroup;
577
+ return createPatcherForBase(baseDir, entries, patcherOptions);
578
+ }
579
+ }
580
+ return createPatcherForBase(resolvedTailwindcssBasedir, normalizedCssEntries ?? rawCssEntries, patcherOptions);
581
+ }
582
+ //#endregion
583
+ Object.defineProperty(exports, "applyV4CssCalcDefaults", {
584
+ enumerable: true,
585
+ get: function() {
586
+ return applyV4CssCalcDefaults;
587
+ }
588
+ });
589
+ Object.defineProperty(exports, "createTailwindcssPatcherFromContext", {
590
+ enumerable: true,
591
+ get: function() {
592
+ return createTailwindcssPatcherFromContext;
593
+ }
594
+ });
595
+ Object.defineProperty(exports, "hasConfiguredTailwindV4CssRoots", {
596
+ enumerable: true,
597
+ get: function() {
598
+ return hasConfiguredTailwindV4CssRoots;
599
+ }
600
+ });
601
+ Object.defineProperty(exports, "isUniAppXEnabled", {
602
+ enumerable: true,
603
+ get: function() {
604
+ return isUniAppXEnabled;
605
+ }
606
+ });
607
+ Object.defineProperty(exports, "resolveTailwindcssBasedir", {
608
+ enumerable: true,
609
+ get: function() {
610
+ return resolveTailwindcssBasedir;
611
+ }
612
+ });
613
+ Object.defineProperty(exports, "resolveUniAppXOptions", {
614
+ enumerable: true,
615
+ get: function() {
616
+ return resolveUniAppXOptions;
617
+ }
618
+ });
619
+ Object.defineProperty(exports, "upsertTailwindV4CssSource", {
620
+ enumerable: true,
621
+ get: function() {
622
+ return upsertTailwindV4CssSource;
623
+ }
624
+ });
625
+ Object.defineProperty(exports, "warnMissingCssEntries", {
626
+ enumerable: true,
627
+ get: function() {
628
+ return warnMissingCssEntries;
629
+ }
630
+ });